From 6e61f09defd4f204a7b982653d9c49c98ebbe648 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Wed, 8 Jan 2014 09:32:41 -0700 Subject: Added quarterly and yearly mailreport frequencies - Defined frequencies for quarterly and yearly mail reports - Extended frequency-to-crontab conversion logic to cover new frequency settings - Added form elements for new frequency configurations - Bumped version number, and added files to deinstall command for cleaner removal Signed-off-by: Daniel Hunsaker --- config/mailreport/mailreport.xml | 4 +- config/mailreport/status_mail_report_edit.php | 93 ++++++++++++++++++++++++--- 2 files changed, 86 insertions(+), 11 deletions(-) (limited to 'config') 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 @@ ]]> mailreport - 2.0.6 + 2.0.7 Status: Mail Reports /usr/local/bin/ @@ -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"); ]]> diff --git a/config/mailreport/status_mail_report_edit.php b/config/mailreport/status_mail_report_edit.php index 9e6bb071..6572c370 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; @@ -214,7 +261,33 @@ include("head.inc"); -
Select the day of the month to send the report. Only valid for monthly reports. +
Select the day of the month to send the report. Only valid for monthly and yearly reports. +
+ + + + + Time of Quarter + + +
Select the time of the quarter to send the report. Only valid for quarter reports. +
+ + + + + Month of the Year + + +
Select the month of the year to send the report. Only valid for yearly reports.
-- cgit v1.2.3