#!/usr/local/bin/perl # index.cgi # Display commands available for execution require './custom-lib.pl'; &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1); @cust = grep { &can_run_command($_) } &list_commands(); @cust = sort { local $o = $b->{'order'} <=> $a->{'order'}; $o ? $o : $a->{'id'} <=> $b->{'id'} } @cust; # Build links @links = ( ); if ($access{'edit'}) { push(@links,"$text{'index_create'}"); push(@links,"$text{'index_ecreate'}"); push(@links,"$text{'index_screate'}"); } if (!@cust) { print "$text{'index_none'}

\n"; } elsif ($config{'display_mode'} == 0) { # Show command buttons print &ui_links_row(\@links); print "
\n"; $form = 0; for($i=0; $i<@cust; $i++) { $c = $cust[$i]; @a = @{$c->{'args'}}; if ($c->{'edit'}) { print "
\n"; } elsif ($c->{'sql'}) { print "\n"; } else { local ($up) = grep { $_->{'type'} == 10 } @a; if ($up) { print "\n"; } elsif (@a) { print "\n"; } else { print "\n"; } } print "\n"; print "
\n"; print "
\n"; print &filter_javascript($c->{'html'}),"\n"; print "\n"; foreach $a (@a) { print "\n"; } if ($access{'edit'}) { if ($c->{'edit'}) { print "\n"; } elsif ($c->{'sql'}) { print "\n"; } else { print "\n"; } } print "
",&html_escape($a->{'desc'}), " \n"; $n = $a->{'name'}; if ($a->{'type'} == 0) { print "\n"; } elsif ($a->{'type'} == 1 || $a->{'type'} == 2) { print " ", &user_chooser_button($n, 0, $form); } elsif ($a->{'type'} == 3 || $a->{'type'} == 4) { print " ", &group_chooser_button($n, 0, $form); } elsif ($a->{'type'} == 5 || $a->{'type'} == 6) { print " ", &file_chooser_button( $n, $a->{'type'}-5, $form); } elsif ($a->{'type'} == 7) { print " $text{'yes'}\n"; print " $text{'no'}\n"; } elsif ($a->{'type'} == 8) { print "\n"; } elsif ($a->{'type'} == 9) { print "\n"; } elsif ($a->{'type'} == 10) { print "\n"; } elsif ($a->{'type'} == 11) { print "\n"; } print "
", "", "$text{'index_fedit'}
", "", "$text{'index_sedit'}
", "", "$text{'index_edit'}
\n"; $form++; if ($i == int((@cust-1)/2) && $config{'columns'} == 2) { print "
\n"; } } print "
\n"; } else { # Just show table of commands print &ui_links_row(\@links); print "\n"; print "\n"; if ($access{'edit'}) { print "\n"; } else { print "\n"; } foreach $c (@cust) { if ($c->{'edit'} && !@{$c->{'args'}}) { # Open file editor directly, as file is known print "\n"; } print "\n"; if ($access{'edit'}) { local $e = $c->{'edit'} ? "edit_file.cgi" : $c->{'sql'} ? "edit_sql.cgi" : "edit_cmd.cgi"; print "\n"; } print "\n"; } print "
$text{'index_cmd'}$text{'index_desc'}
$text{'index_desc'}
", &html_escape($c->{'desc'}),"\n"; } elsif ($c->{'sql'}) { # Link to SQL query form print "
", &html_escape($c->{'desc'}),"\n"; } else { # Link to parameters form print "
", &html_escape($c->{'desc'})," $c->{'html'}
", "$text{'index_ed'}
\n"; } print &ui_links_row(\@links); &ui_print_footer("/", $text{'index'});