|
|
|
@ -8,6 +8,7 @@ require './cluster-cron-lib.pl';
|
|
|
|
|
if (!$in{'new'}) {
|
|
|
|
|
@jobs = &list_cluster_jobs();
|
|
|
|
|
($job) = grep { $_->{'cluster_id'} eq $in{'id'} } @jobs;
|
|
|
|
|
$job || &error($text{'edit_emissing'});
|
|
|
|
|
&ui_print_header(undef, $text{'edit_title'}, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -20,81 +21,62 @@ else {
|
|
|
|
|
'active' => 1 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "<form action=save.cgi>\n";
|
|
|
|
|
print "<input type=hidden name=new value='$in{'new'}'>\n";
|
|
|
|
|
print "<input type=hidden name=id value='$in{'id'}'>\n";
|
|
|
|
|
print "<table border width=100%>\n";
|
|
|
|
|
print "<tr $tb> <td><b>$cron::text{'edit_details'}</b></td> </tr>\n";
|
|
|
|
|
print "<tr $cb> <td><table width=100%>\n";
|
|
|
|
|
print &ui_form_start("save.cgi", "post");
|
|
|
|
|
print &ui_hidden("new", $in{'new'});
|
|
|
|
|
print &ui_hidden("id", $in{'id'});
|
|
|
|
|
print &ui_table_start($cron::text{'edit_details'}, "width=100%", 4);
|
|
|
|
|
|
|
|
|
|
print "<tr> <td><b>$cron::text{'edit_user'}</b></td>\n";
|
|
|
|
|
print "<td><input name=user size=8 value=\"$job->{'cluster_user'}\"> ",
|
|
|
|
|
&user_chooser_button("user", 0),"</td>\n";
|
|
|
|
|
# Run as user
|
|
|
|
|
print &ui_table_row($cron::text{'edit_user'},
|
|
|
|
|
&ui_user_textbox("user", $job->{'cluster_user'}));
|
|
|
|
|
|
|
|
|
|
%serv = map { $_, 1 } split(/ /, $job->{'cluster_server'});
|
|
|
|
|
print "<td rowspan=4 valign=top><b>$text{'edit_servers'}</b></td>\n";
|
|
|
|
|
print "<td rowspan=4 valign=top><select multiple size=8 name=server>\n";
|
|
|
|
|
printf "<option value=ALL %s>%s</option>\n",
|
|
|
|
|
$serv{'ALL'} ? 'selected' : '', $text{'edit_all'};
|
|
|
|
|
printf "<option value=* %s>%s</option>\n",
|
|
|
|
|
$serv{'*'} ? 'selected' : '', $text{'edit_this'};
|
|
|
|
|
# Cron job active?
|
|
|
|
|
print &ui_table_row($cron::text{'edit_active'},
|
|
|
|
|
&ui_yesno_radio("active", $job->{'active'}));
|
|
|
|
|
|
|
|
|
|
# Run on servers
|
|
|
|
|
my @opts;
|
|
|
|
|
push(@opts, [ "ALL", $text{'edit_all'} ]);
|
|
|
|
|
push(@opts, [ "*", $text{'edit_this'} ]);
|
|
|
|
|
foreach $s (grep { $_->{'user'} }
|
|
|
|
|
sort { $a->{'host'} cmp $b->{'host'} }
|
|
|
|
|
&servers::list_servers()) {
|
|
|
|
|
printf "<option value=%s %s>%s</option>\n",
|
|
|
|
|
$s->{'host'}, $serv{$s->{'host'}} ? "selected" : "",
|
|
|
|
|
$s->{'host'}.($s->{'desc'} ? " ($s->{'desc'})" : "");
|
|
|
|
|
push(@opts, [ $s->{'host'},
|
|
|
|
|
$s->{'host'}.($s->{'desc'} ? " ($s->{'desc'})" : "") ]);
|
|
|
|
|
}
|
|
|
|
|
foreach $g (sort { $a->{'name'} cmp $b->{'name'} }
|
|
|
|
|
&servers::list_all_groups()) {
|
|
|
|
|
$gn = "group_".$g->{'name'};
|
|
|
|
|
printf "<option value=%s %s>%s</option>\n",
|
|
|
|
|
$gn, $serv{$gn} ? "selected" : "",
|
|
|
|
|
&text('edit_group', $g->{'name'});
|
|
|
|
|
push(@opts, [ $gn, &text('edit_group', $g->{'name'}) ]);
|
|
|
|
|
}
|
|
|
|
|
print "</select></td> </tr>\n";
|
|
|
|
|
print &ui_table_row($text{'edit_servers'},
|
|
|
|
|
&ui_select("server", [ split(/ /, $job->{'cluster_server'}) ],
|
|
|
|
|
\@opts, 8, 1), 3);
|
|
|
|
|
|
|
|
|
|
print "<tr> <td> <b>$cron::text{'edit_active'}</b></td>\n";
|
|
|
|
|
printf "<td><input type=radio name=active value=1 %s> $text{'yes'}\n",
|
|
|
|
|
$job->{'active'} ? "checked" : "";
|
|
|
|
|
printf "<input type=radio name=active value=0 %s> $text{'no'}</td> </tr>\n",
|
|
|
|
|
$job->{'active'} ? "" : "checked";
|
|
|
|
|
|
|
|
|
|
# Normal cron job.. can edit command
|
|
|
|
|
print "<tr> <td><b>$cron::text{'edit_command'}</b></td>\n";
|
|
|
|
|
print "<td><input name=cmd size=30 ",
|
|
|
|
|
"value='",&html_escape($job->{'cluster_command'}),"'></td> </tr>\n";
|
|
|
|
|
# Command to run
|
|
|
|
|
print &ui_table_row($cron::text{'edit_command'},
|
|
|
|
|
&ui_textbox("cmd", job->{'cluster_command'}, 70), 3);
|
|
|
|
|
|
|
|
|
|
if ($cron::config{'cron_input'}) {
|
|
|
|
|
# Input to command
|
|
|
|
|
@lines = split(/%/ , $job->{'cluster_input'});
|
|
|
|
|
print "<tr> <td valign=top><b>$cron::text{'edit_input'}</b></td>\n";
|
|
|
|
|
print "<td><textarea name=input rows=3 cols=30>",
|
|
|
|
|
join("\n" , @lines),"</textarea></td> </tr>\n";
|
|
|
|
|
print &ui_table_row($cron::text{'edit_input'},
|
|
|
|
|
&ui_textarea("input", join("\n" , @lines), 3, 70), 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "</table></td></tr></table><p>\n";
|
|
|
|
|
print &ui_table_end();
|
|
|
|
|
|
|
|
|
|
print "<table border width=100%>\n";
|
|
|
|
|
print "<tr $tb> <td colspan=5><b>$cron::text{'edit_when'}</b></td> </tr>\n";
|
|
|
|
|
&cron::show_times_input($job, 1);
|
|
|
|
|
print "</table>\n";
|
|
|
|
|
print &ui_table_start($cron::text{'edit_when'}, "width=100%", 2);
|
|
|
|
|
print &cron::get_times_input($job);
|
|
|
|
|
print &ui_table_end();
|
|
|
|
|
|
|
|
|
|
if (!$in{'new'}) {
|
|
|
|
|
print "<table width=100%>\n";
|
|
|
|
|
print "<tr> <td align=left><input type=submit value=\"$text{'save'}\"></td>\n";
|
|
|
|
|
|
|
|
|
|
print "</form><form action=\"exec.cgi\">\n";
|
|
|
|
|
print "<input type=hidden name=id value=\"$in{'id'}\">\n";
|
|
|
|
|
print "<td align=center>",
|
|
|
|
|
"<input type=submit value=\"$cron::text{'edit_run'}\"></td>\n";
|
|
|
|
|
|
|
|
|
|
print "</form><form action=\"delete.cgi\">\n";
|
|
|
|
|
print "<input type=hidden name=id value=\"$in{'id'}\">\n";
|
|
|
|
|
print "<td align=right><input type=submit value=\"$cron::text{'delete'}\"></td> </tr>\n";
|
|
|
|
|
print "</form></table><p>\n";
|
|
|
|
|
print &ui_form_end([ [ undef, $text{'save'} ],
|
|
|
|
|
[ 'exec', $cron::text{'edit_run'} ],
|
|
|
|
|
[ 'delete', $text{'delete'} ] ]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
print "<input type=submit value=\"$text{'create'}\"></form><p>\n";
|
|
|
|
|
print &ui_form_end([ [ undef, $text{'create'} ] ]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&ui_print_footer("", $text{'index_return'});
|
|
|
|
|