Work on UI for showing Webmin scheduled functions

This commit is contained in:
Jamie Cameron
2013-01-08 23:01:10 -08:00
parent 7bc6455381
commit 205ceffe3a
8 changed files with 64 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -1104,7 +1104,10 @@ Returns a human-readable text string describing when a cron job is run.
sub when_text
{
local $pfx = $_[1] ? "uc" : "";
if ($_[0]->{'special'}) {
if ($_[0]->{'interval'}) {
return &text($pfx.'when_interval', $_[0]->{'interval'});
}
elsif ($_[0]->{'special'}) {
$pfx = $_[1] ? "" : "lc";
return $text{$pfx.'edit_special_'.$_[0]->{'special'}};
}

View File

@@ -150,6 +150,7 @@ when_day=every day at $2:$1
when_month=on day $3 every month at $2:$1
when_weekday=every $3 at $2:$1
when_cron=at cron time $1
when_interval=every $1 seconds
ucwhen_min=Every minute
ucwhen_hour=Every hour at $1 past the hour
@@ -157,6 +158,7 @@ ucwhen_day=Every day at $2:$1
ucwhen_month=On day $3 every month at $2:$1
ucwhen_weekday=Every $3 at $2:$1
ucwhen_cron=At cron time $1
ucwhen_interval=Every $1 seconds
move_err=Failed to move Cron job
move_etype=This job cannot be moved

41
webmin/edit_webmincron.cgi Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/local/bin/perl
# Show a list of Webmin cron jobs
require './webmin-lib.pl';
&ui_print_header(undef, $text{'webmincron_title'}, "");
if (!&foreign_check("webmincron")) {
&ui_print_endpage($text{'webmincron_emodule'});
}
&foreign_require("webmincron");
&foreign_require("cron");
my @wcrons = &webmincron::list_webmin_crons();
if (@wcrons) {
my @tds = ( "width=5" );
print &ui_form_start("delete_webmincron.cgi");
print &ui_columns_start([ "",
$text{'webmincron_module'},
$text{'webmincron_func'},
$text{'webmincron_args'},
$text{'webmincron_when'},
],
100, 0, \@tds);
foreach my $w (@wcrons) {
my %minfo = &get_module_info($w->{'module'});
print &ui_checked_columns_row([
$minfo{'desc'} || $w->{'module'},
$w->{'func'},
join(" ", @{$w->{'args'}}),
&cron::when_text($w, 1),
], \@tds, "d", $w->{'id'});
}
print &ui_columns_end();
print &ui_form_end([ [ "delete", $text{'webmincron_delete'} ],
[ "run", $text{'webmincron_run'} ] ]);
}
else {
print "<b>$text{'webmincron_none'}</b><p>\n";
}
&ui_print_footer("", $text{'index_return'});

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -20,7 +20,8 @@ my (@wlinks, @wtitles, @wicons);
"edit_categories.cgi", "edit_descs.cgi", "edit_themes.cgi",
"edit_referers.cgi", "edit_anon.cgi", "edit_lock.cgi",
"edit_mobile.cgi", "edit_blocked.cgi", "edit_status.cgi",
"edit_advanced.cgi", "edit_debug.cgi", "edit_web.cgi", );
"edit_advanced.cgi", "edit_debug.cgi", "edit_web.cgi",
"edit_webmincron.cgi", );
@wtitles = ( $text{'access_title'}, $text{'bind_title'},
$text{'log_title'}, $text{'proxy_title'},
$text{'ui_title'}, $text{'mods_title'},
@@ -32,7 +33,8 @@ my (@wlinks, @wtitles, @wicons);
$text{'anon_title'}, $text{'lock_title'},
$text{'mobile_title'}, $text{'blocked_title'},
$text{'status_title'}, $text{'advanced_title'},
$text{'debug_title'}, $text{'web_title'}, );
$text{'debug_title'}, $text{'web_title'},
$text{'webmincron_title'}, );
@wicons = ( "images/access.gif", "images/bind.gif", "images/log.gif",
"images/proxy.gif", "images/ui.gif", "images/mods.gif",
"images/os.gif", "images/lang.gif", "images/startpage.gif",
@@ -41,7 +43,8 @@ my (@wlinks, @wtitles, @wicons);
"images/descs.gif", "images/themes.gif", "images/referers.gif",
"images/anon.gif", "images/lock.gif", "images/mobile.gif",
"images/blocked.gif", "images/status.gif",
"images/advanced.gif", "images/debug.gif", "images/web.gif", );
"images/advanced.gif", "images/debug.gif", "images/web.gif",
"images/webmincron.gif", );
if ($gconfig{'eazel'}) {
push(@wlinks, "edit_syslet.cgi");
push(@wtitles, $text{'syslet_title'});

View File

@@ -968,4 +968,14 @@ web_expirespath=Path regular expression
web_expirestime=Cache time in seconds
web_eexpires2=Missing or non-numeric client side cache time in row $1
webmincron_title=Webmin Scheduled Functions
webmincron_emodule=The Webmin Cron Jobs module is not installed!
webmincron_module=Webmin module
webmincron_func=Function name
webmincron_args=Parameters
webmincron_when=Run at
webmincron_none=No Webmin scheduled functions have been created yet. These are typically created by other modules, not by users.
webmincron_delete=Delete Selected Functions
webmincron_run=Run Selected Functions Now
__norefs=1

View File

@@ -90,7 +90,7 @@ if ($wcron{'args'}) {
&write_file($file, \%wcron);
&unlock_file($file);
eval {
# Reload may fail in Webmin isn't running
# Reload may fail if Webmin isn't running
$main::error_must_die = 1;
&reload_miniserv();
};