#!/usr/local/bin/perl # index.cgi # Display buttons for custom commands from webmin require './custom-lib.pl'; &ui_print_header(undef, $text{'index_title'}, "", undef, 0, 1); if (!-d $config{'webmin_config'}) { print &text('index_nodir', "$config{'webmin_config'}"), "

\n"; &ui_print_footer("/", $text{'index'}); exit; } @cust = grep { &can_run_command($_) } &list_commands(); @cust = sort { local $o = $b->{'order'} <=> $a->{'order'}; $o ? $o : $a->{'id'} <=> $b->{'id'} } @cust; if (!@cust) { print "$text{'index_none'}

\n"; } elsif ($config{'display_mode'} == 0) { # Show command buttons print "
\n"; $form = 0; for($i=0; $i<@cust; $i++) { $c = $cust[$i]; if ($c->{'edit'}) { @a = ( ); print "
\n"; } else { @a = @{$c->{'args'}}; 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"; } 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 "
\n"; $form++; if ($i == int((@cust-1)/2) && $config{'columns'} == 2) { print "
\n"; } } print "
\n"; } else { # Just show table of commands print "\n"; print "\n"; print "\n"; foreach $c (@cust) { if ($c->{'edit'} && !@{$c->{'args'}}) { print "\n"; } print "\n"; print "\n"; } print "
$text{'index_cmd'}$text{'index_desc'}
", &html_escape($c->{'desc'}),"\n"; } else { print "
", &html_escape($c->{'desc'})," $c->{'html'}
\n"; } &ui_print_footer("/", $text{'index'});