Added a button on the Edit Job page for cloning an existing job
authorJamie Cameron <jcameron@webmin.com>
Tue, 3 Jul 2007 19:24:35 +0000 (19:24 +0000)
committerJamie Cameron <jcameron@webmin.com>
Tue, 3 Jul 2007 19:24:35 +0000 (19:24 +0000)
cron/CHANGELOG
cron/edit_cron.cgi
cron/lang/en

index 4751851..dd73ab5 100644 (file)
@@ -17,3 +17,5 @@ Multiple Cron jobs can be enabled or disabled at once, in a similar way to many
 Changed the default schedule for new jobs to hourly.
 ---- Changes since 1.300 ----
 When a user's home directory is changed in the Users and Groups module, any Cron jobs that use the old path are updated to the new.
+---- Changes since 1.350 ----
+Added a button on the Edit Job page for cloning an existing job.
index d6926ac..355c537 100755 (executable)
@@ -4,9 +4,9 @@
 
 require './cron-lib.pl';
 &ReadParse();
+@jobs = &list_cron_jobs();
 
 if (!$in{'new'}) {
-       @jobs = &list_cron_jobs();
        $job = $jobs[$in{'idx'}];
        &can_edit_user(\%access, $job->{'user'}) ||
                &error($text{'edit_ecannot'});
@@ -14,7 +14,12 @@ if (!$in{'new'}) {
        }
 else {
        &ui_print_header(undef, $text{'create_title'}, "");
-       if ($config{'vixie_cron'}) {
+       if (defined($in{'clone'})) {
+               # Default to clone source
+               $clone = $jobs[$in{'clone'}];
+               $job = { %$clone };
+               }
+       elsif ($config{'vixie_cron'}) {
                # Default to hourly, using @ format
                $job = { 'special' => 'hourly',
                         'active' => 1 };
@@ -123,20 +128,32 @@ if ($rangeable) {
 
 if (!$in{'new'}) {
        print "<table width=100%>\n";
-       print "<tr> <td align=left width=33%><input type=submit value=\"$text{'save'}\"></td>\n";
+
+       # Save button
+       print "<tr> <td align=left width=25%><input type=submit value=\"$text{'save'}\"></td>\n";
+
+       # Run button
        if (!$rpd) {
                print "</form><form action=\"exec_cron.cgi\">\n";
                print "<input type=hidden name=idx value=\"$in{'idx'}\">\n";
-               print "<td align=center width=33%>",
+               print "<td align=center width=25%>",
                      "<input type=submit value=\"$text{'edit_run'}\"></td>\n";
                }
+
+       # Clone button
+       print "</form><form action=\"edit_cron.cgi\">\n";
+       print "<input type=hidden name=clone value=\"$in{'idx'}\">\n";
+       print "<input type=hidden name=new value=\"1\">\n";
+       print "<td align=right width=25%><input type=submit value=\"$text{'edit_clone'}\"></td>\n";
+
+       # Delete button
        if ($access{'delete'}) {
                print "</form><form action=\"delete_cron.cgi\">\n";
                print "<input type=hidden name=idx value=\"$in{'idx'}\">\n";
-               print "<td align=right width=33%><input type=submit value=\"$text{'delete'}\"></td> </tr>\n";
+               print "<td align=right width=25%><input type=submit value=\"$text{'delete'}\"></td> </tr>\n";
                }
        else {
-               print "<td align=right width=33%></td>\n";
+               print "<td align=right width=25%></td>\n";
                }
        print "</form></table><p>\n";
        }
index 4be946c..f980b95 100644 (file)
@@ -40,6 +40,7 @@ edit_weekdays=Weekdays
 edit_all=All
 edit_selected=Selected ..
 edit_run=Run Now
+edit_clone=Clone Job
 edit_return=cron job
 edit_ctrl=Note: Ctrl-click (or command-click on the Mac) to select and de-select minutes, hours, days and months.
 edit_special1=Simple schedule ..