diff options
-rw-r--r-- | config/mailreport/mailreport.xml | 4 | ||||
-rw-r--r-- | config/mailreport/status_mail_report_edit.php | 95 |
2 files changed, 87 insertions, 12 deletions
diff --git a/config/mailreport/mailreport.xml b/config/mailreport/mailreport.xml index 5a759984..3b926753 100644 --- a/config/mailreport/mailreport.xml +++ b/config/mailreport/mailreport.xml @@ -37,7 +37,7 @@ ]]> </copyright> <name>mailreport</name> - <version>2.0.6</version> + <version>2.0.7</version> <title>Status: Mail Reports</title> <additional_files_needed> <prefix>/usr/local/bin/</prefix> @@ -96,6 +96,8 @@ exec("rmdir /usr/local/etc/phpmailer"); exec("rm /usr/local/www/status_mail_report.php"); exec("rm /usr/local/www/status_mail_report_edit.php"); + exec("rm /usr/local/www/status_mail_report_add_cmd.php"); + exec("rm /usr/local/www/status_mail_report_add_log.php"); exec("rm /usr/local/www/status_mail_report_add_graph.php"); ]]> </custom_php_deinstall_command> diff --git a/config/mailreport/status_mail_report_edit.php b/config/mailreport/status_mail_report_edit.php index 9e6bb071..0baa9aa6 100644 --- a/config/mailreport/status_mail_report_edit.php +++ b/config/mailreport/status_mail_report_edit.php @@ -91,17 +91,35 @@ if ($_GET['act'] == "del") { } } -$frequencies = array("daily", "weekly", "monthly"); +$frequencies = array("daily", "weekly", "monthly", "quarterly", "yearly"); $daysofweek = array( "" => "", - "0" => "sunday", - "1" => "monday", - "2" => "tuesday", - "3" => "wednesday", - "4" => "thursday", - "5" => "friday", - "6" => "saturday"); + "0" => "Sunday", + "1" => "Monday", + "2" => "Tuesday", + "3" => "Wednesday", + "4" => "Thursday", + "5" => "Friday", + "6" => "Saturday"); $dayofmonth = array("", "1", "15"); +$monthofquarter = array( + "" => "", + "1" => "beginning", + "2" => "middle"); +$monthofyear = array( + "" => "", + "1" => "January", + "2" => "February", + "3" => "March", + "4" => "April", + "5" => "May", + "6" => "June", + "7" => "July", + "8" => "August", + "9" => "September", + "10" => "October", + "11" => "November", + "12" => "December"); if ($_POST) { unset($_POST['__csrf_magic']); @@ -131,11 +149,40 @@ if ($_POST) { if ($pconfig['frequency'] == "monthly") { $pconfig['dayofmonth'] = isset($pconfig['dayofmonth']) ? $pconfig['dayofmonth'] : 1; $friendly = "Monthly, on day {$pconfig['dayofmonth']} at {$friendlytime}"; - } else { + } elseif ($pconfig['frequency'] != "yearly") { if (isset($pconfig['dayofmonth'])) unset($pconfig['dayofmonth']); } + // If quarterly, check for day of the month + if ($pconfig['frequency'] == "quarterly") { + $pconfig['monthofquarter'] = isset($pconfig['monthofquarter']) ? $pconfig['monthofquarter'] : 1; + $friendly = "Quarterly, at the {$monthofquarter[$pconfig['monthofquarter']]}, at {$friendlytime}"; + switch ($pconfig['monthofquarter']) { + case 2: + $pconfig['dayofmonth'] = 15; + $pconfig['monthofyear'] = "2,5,8,11"; + break; + case 1: + default: + $pconfig['dayofmonth'] = 1; + $pconfig['monthofyear'] = "1,4,7,10"; + break; + } + } else { + if (isset($pconfig['monthofquarter'])) + unset($pconfig['monthofquarter']); + } + + // If yearly, check for day of the month + if ($pconfig['frequency'] == "yearly") { + $pconfig['monthofyear'] = isset($pconfig['monthofyear']) ? $pconfig['monthofyear'] : 1; + $friendly = "Yearly, on day {$pconfig['dayofmonth']} of {$monthofyear[$pconfig['monthofyear']]} at {$friendlytime}"; + } else { + if (isset($pconfig['monthofyear'])) + unset($pconfig['monthofyear']); + } + // Copy back into the schedule. $pconfig['cmd']["row"] = $a_cmds; $pconfig['log']["row"] = $a_logs; @@ -211,10 +258,36 @@ include("head.inc"); <td class="vtable" colspan="3"> <select name="dayofmonth"> <?php foreach($dayofmonth as $dom): ?> - <option value="<?php echo $dom; ?>" <?php if($pconfig["dayofmonth"] === $dom) echo "selected"; ?>><?php echo $dom; ?></option> + <option value="<?php echo $dom; ?>" <?php if($pconfig["dayofmonth"] == $dom) echo "selected"; ?>><?php echo $dom; ?></option> + <?php endforeach; ?> + </select> + <br/>Select the day of the month to send the report. Only valid for monthly and yearly reports. + <br/> + </td> + <td></td> + </tr> + <tr> + <td class="vncell" valign="top" colspan="1">Time of Quarter</td> + <td class="vtable" colspan="3"> + <select name="monthofquarter"> + <?php foreach($monthofquarter as $moqi => $moq): ?> + <option value="<?php echo $moqi; ?>" <?php if($pconfig["monthofquarter"] == $moqi) echo "selected"; ?>><?php echo $moq; ?></option> + <?php endforeach; ?> + </select> + <br/>Select the time of the quarter to send the report. Only valid for quarter reports. + <br/> + </td> + <td></td> + </tr> + <tr> + <td class="vncell" valign="top" colspan="1">Month of the Year</td> + <td class="vtable" colspan="3"> + <select name="monthofyear"> + <?php foreach($monthofyear as $moyi => $moy): ?> + <option value="<?php echo $moyi; ?>" <?php if($pconfig["monthofyear"] == $moyi) echo "selected"; ?>><?php echo $moy; ?></option> <?php endforeach; ?> </select> - <br/>Select the day of the month to send the report. Only valid for monthly reports. + <br/>Select the month of the year to send the report. Only valid for yearly reports. <br/> </td> <td></td> |