]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
no message
authoreldy <>
Mon, 14 Jun 2004 23:45:33 +0000 (23:45 +0000)
committereldy <>
Mon, 14 Jun 2004 23:45:33 +0000 (23:45 +0000)
tools/webmin/awstats/schedule_stats.cgi

index dcb719e29da08f506802a53701c883f456bd0eec..2136efc0c324b32784f3e63fe001ad5d8419e941 100644 (file)
@@ -37,21 +37,52 @@ print "<br>\n";
 
 # For global update
 print "<table border width=100%>\n";
-print "<tr $tb> <td colspan=2 align=left><b>";
+print "<tr $tb> <td align=left><b>";
 print "Scheduled AWStats global update process (For all files in /etc/awstats)";
 print "</b></td> </tr>\n";
 
-print "<tr> <td valign=top><input name=GlobalUpdate type=radio value='none'> <b>None</b></td> <td> &nbsp; </td> </tr>\n";
-print "<tr> <td valign=top><input name=GlobalUpdate type=radio value='yes'> <b>Yes</b></td> <td> ";
-
-print "<table border=0 width=100%>\n";
-# Show cron found
-print "<tr> <td><input name=GlobalUpdate type=checkbox value='bycron'> <b>By cron</b></td> <td> Date: NA </td> <td> Remove this order </td> </tr>\n";
-# Loop on each logrotate found
-print "<tr> <td><input name=GlobalUpdate type=checkbox value='bylogrotate'> <b>By logrotate preprocess</b></td> <td> File: NA </td> <td> Remove this order </td> </tr>\n";
-print "<tr> <td> Add a new global update order by cron </td> </tr>\n";
-print "<tr> <td> Add a new global update order by a logrotate file </td> </tr>\n";
-print "</table>";
+print "<tr> <td> ";
+
+if ( foreign_installed('cron', 0) || foreign_installed('logrotate', 0) ) {
+    print "<table border=0 width=100%>\n";
+    # Show cron found
+    if ( foreign_installed('cron', 0) ) {
+        $idcron=0;
+        @jobs = &foreign_call("cron","list_cron_jobs");
+
+        #TODO detect idcron for /.*/awstats_updateall.pl in @jobs
+        
+        print "<tr> <td> <b>By cron</b></td> <td> ";
+        if (! $idcron) {        
+            print "Off\n";
+        }
+        else {
+            print "On\n";
+        }
+        print " </td> <td> ";
+        if (! $idcron) {        
+            print "<a href=\"/cron/edit_cron.cgi?new=1\">Add AWStats global update process in cron</a>\n";
+        } else {
+            print "<a href=\"/cron/edit_cron.cgi?idx=$idcron\">Edit cron task to update all AWStats config files</a> ";
+        }
+        print "</td> </tr>\n";
+    }
+    # Loop on each logrotate found
+    if ( foreign_installed('logrotate', 0) ) {
+        print "<tr> <td> <b>By logrotate preprocess</b></td> ";
+
+        print " <td> File: NA </td> ";
+        print " <td> Edit logrotate file<br>";
+        
+        print "Add a logrotate for this file";
+        
+        print "</td></tr>";
+    }
+    print "</table>";
+}
+else {
+    print "Nor cron, nor logrotate module are installed. They are required to setup AWStats scheduled tasks";
+}
 
 print "</td> </tr>\n";
 print "</table>";
@@ -62,21 +93,51 @@ print "<br>\n";
 
 # For particular config file update
 print "<table border width=100%>\n";
-print "<tr $tb> <td colspan=2 align=left><b>";
+print "<tr $tb> <td align=left><b>";
 print "Scheduled AWStats update process for this config file only (".$in{'file'}.")";
 print "</b></td> </tr>\n";
 
-print "<tr> <td valign=top><input name=GlobalUpdate type=radio value='none'> <b>None</b></td> <td> &nbsp; </td> </tr>\n";
-print "<tr> <td valign=top><input name=GlobalUpdate type=radio value='yes'> <b>Yes</b></td> <td> ";
-
-print "<table border=0 width=100%>\n";
-# Show cron found
-print "<tr> <td><input name=GlobalUpdate type=checkbox value='bycron'> <b>By cron</b></td> <td> Date: NA </td> <td> Remove this order </td> </tr>\n";
-# Loop on each logrotate found
-print "<tr> <td><input name=GlobalUpdate type=checkbox value='bylogrotate'> <b>By logrotate preprocess</b></td> <td> File: NA </td> <td> Remove this order </td> </tr>\n";
-print "<tr> <td> Add a new global update order by cron </td> </tr>\n";
-print "<tr> <td> Add a new global update order by a logrotate file </td> </tr>\n";
-print "</table>";
+print "<tr> <td> ";
+
+if ( foreign_installed('cron', 0) || foreign_installed('logrotate', 0) ) {
+    print "<table border=0 width=100%>\n";
+    # Show cron found
+    if ( foreign_installed('cron', 0) ) {
+        @jobs = &foreign_call("cron","list_cron_jobs");
+
+        #TODO detect idcron for /.*/awstats_updateall.pl in @jobs
+        
+        print "<tr> <td> <b>By cron</b></td> <td> ";
+        if (! $idcron) {        
+            print "Off\n";
+        }
+        else {
+            print "On\n";
+        }
+        print " </td> <td> ";
+        if (! $idcron) {        
+            print "<a href=\"/cron/edit_cron.cgi?new=1\">Add AWStats update process in cron for config file</a>\n";
+        } else {
+            print "<a href=\"/cron/edit_cron.cgi?idx=$idcron\">Edit cron task to update only this AWStats config files</a> ";
+        }
+        print "</td> </tr>\n";
+    }
+    # Loop on each logrotate found
+    if ( foreign_installed('logrotate', 0) ) {
+        print "<tr> <td> <b>By logrotate preprocess</b></td> ";
+        print " <td> File: NA </td> ";
+        print " <td> Edit logrotate file<br>";
+        
+        print "Add a logrotate for this file";
+        
+        print "</td></tr>";
+   
+    }
+    print "</table>";
+}
+else {
+    print "Nor cron, nor logrotate module are installed. They are required to setup AWStats scheduled tasks";
+}
 
 print "</td> </tr>\n";
 print "</table>";