[loop list="[scratch list_databases]"]
[loop-sub db_action]
sub {
#Log("args=" . $Tag->uneval({ ref => \@_ }));
my $name = shift;
return if $admin{$name};
my $rec = shift;
my $tab = $rec->[0];
return '' if $admin{$tab};
#Log("name=$name tab=$tab");
$name = $tab if ! $name;
my $url = "$Config->{VendURL}/__UI_BASE__";
my $froot = sub {
my $fn = shift;
$fn =~ s#^$Config->{VendRoot}/##o;
return $fn;
};
my $ref = {
upload => {
img => 'ico_upload.gif',
url => $Tag->area(
'__UI_BASE__/upload_file',
$froot->(join "/",
($Config->{Database}{$tab}{dir} || $Config->{ProductDir}),
$Config->{Database}{$tab}{file}
),
{
form => 'ui_return_to=@@MV_PAGE@@'
}
),
},
download => {
img => 'ico_download.gif',
url => $Tag->area(
{
href => 'ui_download/' .
$froot->(
join "/",
( $Config->{Database}{$tab}{dir}
||
$Config->{ProductDir}
),
$Config->{Database}{$tab}{file}
),
form => 'filler=1',
add_dot_html => 0,
},
),
},
import => {
img => 'ico_import.gif',
url => $Tag->area(
{
href => '__UI_BASE__/import_table',
form => "mv_data_table=$tab",
}
),
},
export => {
img => 'ico_export.gif',
url => $Tag->area(
{
href => '__UI_BASE__/export_table',
form => "mv_data_table=$tab",
}
),
},
config => {
img => 'icon_config.gif',
url => $Tag->area(
{
href => '__UI_BASE__/dbconfig',
form => "mv_data_table=$tab",
}
),
},
edit => {
img => 'layout.gif',
url => $Tag->area(
{
href => '__UI_BASE__/flex_select',
form => "mv_data_table=$tab",
}
),
},
};
my $out = '';
my @litems = (
$title_thing || '[L]Table name[/L] ([L]description[/L]) -- [L]click to edit[/L]',
'[L]views[/L]',
'[L]import[/L]',
'[L]export[/L]',
'[L]upload[/L]',
'[L]download[/L]',
);
if ($Variable->{UI_DBCONFIG}) {
push @litems, '[L]config[/L]';
}
if(! $dblist_done_one++) {
$out .= ' ';
my $i = 0;
for(@litems) { # Add "report"
my $align = $i++ == 0 ? 'left' : 'center';
$out .= qq{$_ | };
}
$out .= " ";
}
my $class;
if($dblist_done_one % 2) {
$class = 'rownorm';
}
else {
$class = 'rowalt';
}
my $desc = tag_data('__UI_META_TABLE__', 'name', $name);
my $totdesc = $name;
$totdesc .= " ($desc)" if $desc;
my $titdesc = errmsg('edit table %s', $totdesc);
$titdesc = $Tag->filter('encode_entities', $titdesc);
my $mainwidth = $Variable->{UI_DBCONFIG} ? '30%' : '40%';
my $mref = $ref->{edit};
$out .= <
$totdesc
|
EOF
$out .= <
EOF
if(my $ary = $views{$name}) {
for(sort @$ary) {
my $tit = errmsg("edit %s with view %s", $tab, $_);
my $url = $Tag->area(
{
href => '__UI_BASE__/flex_select',
form => qq{
mv_data_table=$tab
ui_meta_view=$_
},
}
);
$out .= qq{$_ };
}
}
else {
$out .= ' ';
}
$out .= "\n\t\n";
my @mitems = (qw/import export upload download/);
if($Variable->{UI_DBCONFIG}) {
push @mitems, 'config';
}
for(@mitems) { # Add "report"
my $line = $ref->{$_};
if($_ eq 'config' and $Config->{Database}{$tab}{type} > 7) {
$out .= qq{ | };
}
else {
$out .= <
EOF
}
}
$out .= q{};
return $out;
}
[/loop-sub]
[loop-exec db_action][loop-data __UI_META_TABLE__ label][/loop-exec]
[/loop]
[if-mm super]
[calc]
%admin = ();
undef $dblist_done_one;
$title_thing = q{[L]Hidden Admin Tables[/L]};
return;
[/calc]
|