]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: New advanced schedule settings
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 31 Jul 2021 03:29:47 +0000 (05:29 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:26 +0000 (09:03 +0100)
There has been also changed way of loading all directive controls. Now they are loaded on PreRender event instead of on Load event.

54 files changed:
gui/baculum/protected/API/Class/BaculaSetting.php
gui/baculum/protected/Common/Class/BClientScript.php
gui/baculum/protected/Common/Class/Params.php
gui/baculum/protected/Web/Lang/en/messages.mo
gui/baculum/protected/Web/Lang/en/messages.po
gui/baculum/protected/Web/Lang/ja/messages.mo
gui/baculum/protected/Web/Lang/ja/messages.po
gui/baculum/protected/Web/Lang/pl/messages.mo
gui/baculum/protected/Web/Lang/pl/messages.po
gui/baculum/protected/Web/Lang/pt/messages.mo
gui/baculum/protected/Web/Lang/pt/messages.po
gui/baculum/protected/Web/Lang/ru/messages.mo
gui/baculum/protected/Web/Lang/ru/messages.po
gui/baculum/protected/Web/Pages/DirectorView.php
gui/baculum/protected/Web/Pages/NewBackupJobWizard.page
gui/baculum/protected/Web/Pages/NewBackupJobWizard.php
gui/baculum/protected/Web/Pages/NewCopyJobWizard.page
gui/baculum/protected/Web/Pages/NewCopyJobWizard.php
gui/baculum/protected/Web/Pages/Security.php
gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php
gui/baculum/protected/Web/Portlets/BaculaConfigResourceList.php
gui/baculum/protected/Web/Portlets/BaculaConfigResourceList.tpl
gui/baculum/protected/Web/Portlets/DirectiveComboBox.php
gui/baculum/protected/Web/Portlets/DirectiveDaysOfMonth.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveDaysOfMonth.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveDaysOfWeek.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveDaysOfWeek.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveFileSet.php
gui/baculum/protected/Web/Portlets/DirectiveListBox.php
gui/baculum/protected/Web/Portlets/DirectiveListTemplate.php
gui/baculum/protected/Web/Portlets/DirectiveMessages.php
gui/baculum/protected/Web/Portlets/DirectiveMessages.tpl
gui/baculum/protected/Web/Portlets/DirectiveMonthsOfYear.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveMonthsOfYear.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveRenderer.php
gui/baculum/protected/Web/Portlets/DirectiveRunscript.php
gui/baculum/protected/Web/Portlets/DirectiveSchedule.php
gui/baculum/protected/Web/Portlets/DirectiveSchedule.tpl
gui/baculum/protected/Web/Portlets/DirectiveTemplate.php
gui/baculum/protected/Web/Portlets/DirectiveTime.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveTime.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveWeeksOfMonth.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveWeeksOfMonth.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveWeeksOfYear.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveWeeksOfYear.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/JobRunscriptRenderer.php
gui/baculum/protected/Web/Portlets/MessageTypes.php
gui/baculum/protected/Web/Portlets/NewFileSetExcMenu.tpl
gui/baculum/protected/Web/Portlets/NewFileSetFileOptMenu.tpl
gui/baculum/protected/Web/Portlets/NewFileSetIncExcMenu.tpl
gui/baculum/protected/Web/Portlets/NewMessagesMenu.tpl
gui/baculum/protected/Web/Portlets/NewRunscriptMenu.tpl
gui/baculum/protected/Web/Portlets/NewScheduleMenu.tpl
gui/baculum/themes/Baculum-v2/css/baculum.css

index 27e6f10e28f3fde6fc56e949b114f6201fcafe9d..e5a656de4a35e0a1f6a41aa2cba97df4968a11d2 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -306,31 +306,21 @@ class BaculaSetting extends APIModule {
                                                                        $values
                                                                );
                                                                $overwrite_directive = implode(' ', array_filter($overwrite_directive));
-                                                               $hour = $directive_value[$i]['Hour'][0];
-                                                               $hourly = '';
                                                                $min = 0;
-                                                               $minute = '00';
                                                                /**
                                                                 * Check if Minute key exists because of bug about missing Minute
                                                                 * @see http://bugs.bacula.org/view.php?id=2318
                                                                 */
                                                                if (array_key_exists('Minute', $directive_value[$i])) {
                                                                        $min = $directive_value[$i]['Minute'];
-                                                                       $minute = sprintf('%02d', $min);
-                                                               }
-                                                               $day = Params::getDaysConfig($directive_value[$i]['Day']);
-                                                               $month = Params::getMonthsConfig($directive_value[$i]['Month']);
-                                                               $week = Params::getWeeksConfig($directive_value[$i]['WeekOfMonth']);
-                                                               $wday = Params::getWdaysConfig($directive_value[$i]['DayOfWeek']);
-                                                               $value = array($overwrite_directive, $month, $week, $day, $wday);
-                                                               $hour_len = count($directive_value[$i]['Hour']);
-                                                               if ($hour_len == 24) {
-                                                                       $value[] = 'hourly';
-                                                               }
-                                                               if ($hour_len == 1 || ($hour_len == 24 && $min != 0)) {
-                                                                       $value[] = 'at';
-                                                                       $value[] = "$hour:$minute";
                                                                }
+                                                               $moys = Params::getMonthsOfYearConfig($directive_value[$i]['Month']);
+                                                               $woys = Params::getWeeksOfYearConfig($directive_value[$i]['WeekOfYear']);
+                                                               $doms = Params::getDaysOfMonthConfig($directive_value[$i]['Day']);
+                                                               $woms = Params::getWeeksOfMonthConfig($directive_value[$i]['WeekOfMonth']);
+                                                               $dows = Params::getDaysOfWeekConfig($directive_value[$i]['DayOfWeek']);
+                                                               $t = Params::getTimeConfig($directive_value[$i]['Hour'], $min);
+                                                               $value = array($overwrite_directive, $moys, $woys, $doms, $woms, $dows, $t);
                                                                $value = array_filter($value);
                                                                if (!array_key_exists($directive_name, $resource[$resource_type])) {
                                                                        $resource[$resource_type][$directive_name] = array();
index ed6afe25afda813a021e7cf3188121cb50a7061a..a32de643484b7662458880d1f65f02345cf36381 100644 (file)
@@ -31,7 +31,7 @@ Prado::using('System.Web.UI.WebControls.TClientScript');
  */
 class BClientScript extends TClientScript {
 
-       const SCRIPTS_VERSION = 22;
+       const SCRIPTS_VERSION = 23;
 
        public function getScriptUrl()
        {
index 94f5d92f26a5d1fa708049ade459221327ef6a36..34038340faccd62bc311aeb18d520d02b7c3acb2 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2020 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -66,69 +66,136 @@ class Params extends CommonModule {
                'sat' => 'Saturday'
        );
 
-       public static function getMonthsConfig(array $months_cfg) {
+       /**
+        * Get time value in config form.
+        * Possible is of three modes:
+        *  - hourly at specified minute
+        *  - hourly on every full hour
+        *  - daily at specified hour and minute
+        *
+        * @param string $hour time hour
+        * @param string $minute time minute
+        * @return string time config value
+        */
+       public static function getTimeConfig(array $hour, $minute) {
+               $t = '';
+               $hour_len = count($hour);
+               $is_hourly = ($hour_len == 24);
+               $is_daily = ($hour_len == 1);
+               if ($is_hourly && is_int($minute) && $minute > 0) {
+                       // hourly at minute
+                       $min = sprintf('%02d', $minute);
+                       $t = "hourly at 0:{$min}";
+               } elseif ($is_daily && is_int($minute)) {
+                       // at specified hour and minute
+                       $min = sprintf('%02d', $minute);
+                       $t = "at {$hour[0]}:{$min}";
+               } else {
+                       // hourly every full hour
+                       $t = 'hourly';
+               }
+               return $t;
+       }
+       /**
+        * Get months of the year value in config form.
+        *
+        * @param array $moys_cfg month array (ex. [0,1,2,3,4])
+        * @return string months of the year config value
+        */
+       public static function getMonthsOfYearConfig(array $moys_cfg) {
                $month = '';
-               $month_count = count($months_cfg);
                $months = array_keys(Params::$months);
-               if ($month_count < 12) {
-                       if ($month_count > 1) {
-                               $month_start = $months_cfg[0];
-                               $month_end = $months_cfg[$month_count-1];
-                               $month .= $months[$month_start] . '-' . $months[$month_end];
-                       } else {
-                               $month .= $months[$months_cfg[0]];
+               $moys_len = count($moys_cfg);
+               if ($moys_len < 12) {
+                       $moy_value_cfg = [];
+                       for ($i = 0; $i < $moys_len; $i++) {
+                               $moy_value_cfg[] = $months[$moys_cfg[$i]];
                        }
+                       $month = implode(',', $moy_value_cfg);
                }
                return $month;
        }
 
-       public static function getWeeksConfig(array $weeks_cfg) {
+       /**
+        * Get weeks of the month value in config form.
+        *
+        * @param array $woms_cfg week array (ex. [0,1,4])
+        * @return string weeks of the month config value
+        */
+       public static function getWeeksOfMonthConfig(array $woms_cfg) {
                $week = '';
-               $week_count = count($weeks_cfg);
+               $woms_len = count($woms_cfg);
                $weeks = array_keys(Params::$weeks);
-               if ($week_count < 6) {
-                       if ($week_count > 1) {
-                               $week_start = $weeks_cfg[0];
-                               $week_end = $weeks_cfg[$week_count-1];
-                               $week .= $weeks[$week_start] . '-' . $weeks[$week_end];
-                       } else {
-                               $week .= $weeks[$weeks_cfg[0]];
+               if ($woms_len < 6) {
+                       $wom_value_cfg = [];
+                       for ($i = 0; $i < $woms_len; $i++) {
+                               $wom_value_cfg[] = $weeks[$woms_cfg[$i]];
                        }
+                       $week = implode(',', $wom_value_cfg);
                }
                return $week;
        }
 
-       public static function getWdaysConfig(array $wdays_cfg) {
+       /**
+        * Get days of the week value in config form.
+        *
+        * @param array $dows_cfg day array (ex. [0,1,5])
+        * @return string days of the week config value
+        */
+       public static function getDaysOfWeekConfig(array $dows_cfg) {
                $wday = '';
-               $wday_count = count($wdays_cfg);
+               $dows_len = count($dows_cfg);
                $wdays = array_keys(Params::$wdays);
-               if ($wday_count < 7) {
-                       if ($wday_count > 1) {
-                               $wday_start = $wdays_cfg[0];
-                               $wday_end = $wdays_cfg[$wday_count-1];
-                               $wday .= $wdays[$wday_start] . '-' . $wdays[$wday_end];
-                       } else {
-                               $wday .= $wdays[$wdays_cfg[0]];
+               if ($dows_len < 7) {
+                       $dow_value_cfg = [];
+                       for ($i = 0; $i < $dows_len; $i++) {
+                               $dow_value_cfg[] = $wdays[$dows_cfg[$i]];
                        }
+                       $wday = implode(',', $dow_value_cfg);
                }
                return $wday;
        }
 
        /**
-        * Get day value in config form.
+        * Get days of the month value in config form.
+        * Zero-length $doms_cfg means lastday of the month.
         *
-        * @param array $days_cfg days array (ex. array(0,1,2,3,4))
-        * @return string days config value
+        * @param array $doms_cfg day array (ex. [0,1,5,22,30])
+        * @return string days of the month config value
         */
-       public static function getDaysConfig(array $days_cfg) {
+       public static function getDaysOfMonthConfig(array $doms_cfg) {
                $days = '';
-               if (count($days_cfg) < 31) {
-                       $days_map = array_map(array('Params', 'getDayByNo') , $days_cfg);
-                       $days = implode(',', $days_map);
+               $doms_len = count($doms_cfg);
+               if ($doms_len === 0) {
+                       $days = 'on lastday';
+               } elseif ($doms_len < 31) {
+                       $doms_w = array_map(function($el) {
+                               return ++$el;
+                       }, $doms_cfg);
+                       $days = 'on ' . implode(',', $doms_w);
                }
                return $days;
        }
 
+       /**
+        * Get weeks of year value in config form.
+        *
+        * @param array $woy_cfg week array (ex. array(0,1,2,3,4))
+        * @return string weeks of the year config value
+        */
+       public static function getWeeksOfYearConfig(array $woys_cfg) {
+               $weeks = '';
+               $woys_len = count($woys_cfg);
+               if ($woys_len < 54) {
+                       $woys_w = array_map(function($el) {
+                               return ('w' . sprintf('%02d', $el));
+                       }, $woys_cfg);
+                       $weeks = implode(',', $woys_w);
+               }
+               return $weeks;
+       }
+
+
        /**
         * Simple method to prepare day config value by day number.
         *
index 2cd01f7e4714f2ebe4adca4d0db25596a584052f..1e4002bf885605bc076ef4de20780338b8247f25 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ
index 70e007b056c74838e2168569c6f60dd1cd1f138e..11109dfbc6f9a0809054f3504cc4fde59fb488d9 100644 (file)
@@ -3589,3 +3589,144 @@ msgstr "New backup job wizard"
 
 msgid "This wizard enables you to create in easy way a new backup job."
 msgstr "This wizard enables you to create in easy way a new backup job."
+
+msgid "Monday"
+msgstr "Monday"
+
+msgid "Tuesday"
+msgstr "Tuesday"
+
+msgid "Wednesday"
+msgstr "Wednesday"
+
+msgid "Thursday"
+msgstr "Thursday"
+
+msgid "Friday"
+msgstr "Friday"
+
+msgid "Saturday"
+msgstr "Saturday"
+
+msgid "Sunday"
+msgstr "Sunday"
+
+msgid "Days of the week"
+msgstr "Days of the week"
+
+msgid "Weeks of the month"
+msgstr "Weeks of the month"
+
+msgid "first"
+msgstr "first"
+
+msgid "second"
+msgstr "second"
+
+msgid "third"
+msgstr "third"
+
+msgid "fourth"
+msgstr "fourth"
+
+msgid "fifth"
+msgstr "fifth"
+
+msgid "sixth"
+msgstr "sixth"
+
+msgid "Days of the month"
+msgstr "Days of the month"
+
+msgid "Weeks of the year"
+msgstr "Weeks of the year"
+
+msgid "All weeks"
+msgstr "All weeks"
+
+msgid "All days"
+msgstr "All days"
+
+msgid "Run at specified HH:MM"
+msgstr "Run at specified HH:MM"
+
+msgid "Run at"
+msgstr "Run at"
+
+msgid "All months"
+msgstr "All months"
+
+msgid "January"
+msgstr "January"
+
+msgid "February"
+msgstr "February"
+
+msgid "March"
+msgstr "March"
+
+msgid "April"
+msgstr "April"
+
+msgid "May"
+msgstr "May"
+
+msgid "June"
+msgstr "June"
+
+msgid "July"
+msgstr "July"
+
+msgid "August"
+msgstr "August"
+
+msgid "September"
+msgstr "September"
+
+msgid "October"
+msgstr "October"
+
+msgid "November"
+msgstr "November"
+
+msgid "December"
+msgstr "December"
+
+msgid "Last day of the month"
+msgstr "Last day of the month"
+
+msgid "Months of the year"
+msgstr "Months of the year"
+
+msgid "Hourly"
+msgstr "Hourly"
+
+msgid "Daily"
+msgstr "Daily"
+
+msgid "Weekly"
+msgstr "Weekly"
+
+msgid "Monthly"
+msgstr "Monthly"
+
+msgid "Custom"
+msgstr "Custom"
+
+msgid "Run job every hour at the specified minute"
+msgstr "Run job every hour at the specified minute"
+
+msgid "Run job every day at the specified time"
+msgstr "Run job every day at the specified time"
+
+msgid "Run job every week at the specified time on selected days of the week"
+msgstr "Run job every week at the specified time on selected days of the week"
+
+msgid "Run job every month at the specified time in selected weeks of the month"
+msgstr "Run job every month at the specified time in selected weeks of the month"
+
+msgid "Setup your custom schedule"
+msgstr "Setup your custom schedule"
+
+msgid "Override directives"
+msgstr "Override directives"
index 960a676bbc4aa16e7bf29b21e051a1b2885da206..0894da3bafe0fc9ccfb243ff05bf16911efaa0e5 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ
index 35e2c927e96c1c9d05e0778b00636b6f4c33c72c..eb7b7e012e4a26dbf5ce8d16af0c6220915b17ae 100644 (file)
@@ -3675,3 +3675,144 @@ msgstr "New backup job wizard"
 
 msgid "This wizard enables you to create in easy way a new backup job."
 msgstr "This wizard enables you to create in easy way a new backup job."
+
+msgid "Monday"
+msgstr "Monday"
+
+msgid "Tuesday"
+msgstr "Tuesday"
+
+msgid "Wednesday"
+msgstr "Wednesday"
+
+msgid "Thursday"
+msgstr "Thursday"
+
+msgid "Friday"
+msgstr "Friday"
+
+msgid "Saturday"
+msgstr "Saturday"
+
+msgid "Sunday"
+msgstr "Sunday"
+
+msgid "Days of the week"
+msgstr "Days of the week"
+
+msgid "Weeks of the month"
+msgstr "Weeks of the month"
+
+msgid "first"
+msgstr "first"
+
+msgid "second"
+msgstr "second"
+
+msgid "third"
+msgstr "third"
+
+msgid "fourth"
+msgstr "fourth"
+
+msgid "fifth"
+msgstr "fifth"
+
+msgid "sixth"
+msgstr "sixth"
+
+msgid "Days of the month"
+msgstr "Days of the month"
+
+msgid "Weeks of the year"
+msgstr "Weeks of the year"
+
+msgid "All weeks"
+msgstr "All weeks"
+
+msgid "All days"
+msgstr "All days"
+
+msgid "Run at specified HH:MM"
+msgstr "Run at specified HH:MM"
+
+msgid "Run at"
+msgstr "Run at"
+
+msgid "All months"
+msgstr "All months"
+
+msgid "January"
+msgstr "January"
+
+msgid "February"
+msgstr "February"
+
+msgid "March"
+msgstr "March"
+
+msgid "April"
+msgstr "April"
+
+msgid "May"
+msgstr "May"
+
+msgid "June"
+msgstr "June"
+
+msgid "July"
+msgstr "July"
+
+msgid "August"
+msgstr "August"
+
+msgid "September"
+msgstr "September"
+
+msgid "October"
+msgstr "October"
+
+msgid "November"
+msgstr "November"
+
+msgid "December"
+msgstr "December"
+
+msgid "Last day of the month"
+msgstr "Last day of the month"
+
+msgid "Months of the year"
+msgstr "Months of the year"
+
+msgid "Hourly"
+msgstr "Hourly"
+
+msgid "Daily"
+msgstr "Daily"
+
+msgid "Weekly"
+msgstr "Weekly"
+
+msgid "Monthly"
+msgstr "Monthly"
+
+msgid "Custom"
+msgstr "Custom"
+
+msgid "Run job every hour at the specified minute"
+msgstr "Run job every hour at the specified minute"
+
+msgid "Run job every day at the specified time"
+msgstr "Run job every day at the specified time"
+
+msgid "Run job every week at the specified time on selected days of the week"
+msgstr "Run job every week at the specified time on selected days of the week"
+
+msgid "Run job every month at the specified time in selected weeks of the month"
+msgstr "Run job every month at the specified time in selected weeks of the month"
+
+msgid "Setup your custom schedule"
+msgstr "Setup your custom schedule"
+
+msgid "Override directives"
+msgstr "Override directives"
index 55eb17021f829d3351b937adcef923cb30c04ec5..b3926e4008b92ba45f6cb29ecf367bdd376a3231 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ
index 4c6fe2b0cba68f4bf075df069b0556dcf81a74fa..08df61c1891b11a74eb36a95c2bca704569db66f 100644 (file)
@@ -3599,3 +3599,144 @@ msgstr "Kreator nowego zadania backupu"
 
 msgid "This wizard enables you to create in easy way a new backup job."
 msgstr "Ten kreator umożliwia tworzenie w łatwy sposób nowego zadania backupu."
+
+msgid "Monday"
+msgstr "Monday"
+
+msgid "Tuesday"
+msgstr "Tuesday"
+
+msgid "Wednesday"
+msgstr "Wednesday"
+
+msgid "Thursday"
+msgstr "Thursday"
+
+msgid "Friday"
+msgstr "Friday"
+
+msgid "Saturday"
+msgstr "Saturday"
+
+msgid "Sunday"
+msgstr "Sunday"
+
+msgid "Days of the week"
+msgstr "Days of the week"
+
+msgid "Weeks of the month"
+msgstr "Weeks of the month"
+
+msgid "first"
+msgstr "first"
+
+msgid "second"
+msgstr "second"
+
+msgid "third"
+msgstr "third"
+
+msgid "fourth"
+msgstr "fourth"
+
+msgid "fifth"
+msgstr "fifth"
+
+msgid "sixth"
+msgstr "sixth"
+
+msgid "Days of the month"
+msgstr "Days of the month"
+
+msgid "Weeks of the year"
+msgstr "Weeks of the year"
+
+msgid "All weeks"
+msgstr "All weeks"
+
+msgid "All days"
+msgstr "All days"
+
+msgid "Run at specified HH:MM"
+msgstr "Run at specified HH:MM"
+
+msgid "Run at"
+msgstr "Run at"
+
+msgid "All months"
+msgstr "All months"
+
+msgid "January"
+msgstr "January"
+
+msgid "February"
+msgstr "February"
+
+msgid "March"
+msgstr "March"
+
+msgid "April"
+msgstr "April"
+
+msgid "May"
+msgstr "May"
+
+msgid "June"
+msgstr "June"
+
+msgid "July"
+msgstr "July"
+
+msgid "August"
+msgstr "August"
+
+msgid "September"
+msgstr "September"
+
+msgid "October"
+msgstr "October"
+
+msgid "November"
+msgstr "November"
+
+msgid "December"
+msgstr "December"
+
+msgid "Last day of the month"
+msgstr "Last day of the month"
+
+msgid "Months of the year"
+msgstr "Months of the year"
+
+msgid "Hourly"
+msgstr "Hourly"
+
+msgid "Daily"
+msgstr "Daily"
+
+msgid "Weekly"
+msgstr "Weekly"
+
+msgid "Monthly"
+msgstr "Monthly"
+
+msgid "Custom"
+msgstr "Custom"
+
+msgid "Run job every hour at the specified minute"
+msgstr "Run job every hour at the specified minute"
+
+msgid "Run job every day at the specified time"
+msgstr "Run job every day at the specified time"
+
+msgid "Run job every week at the specified time on selected days of the week"
+msgstr "Run job every week at the specified time on selected days of the week"
+
+msgid "Run job every month at the specified time in selected weeks of the month"
+msgstr "Run job every month at the specified time in selected weeks of the month"
+
+msgid "Setup your custom schedule"
+msgstr "Setup your custom schedule"
+
+msgid "Override directives"
+msgstr "Override directives"
index 22e56536014d8ec4e63032d96a171a8398489f22..e9d410fbe831062519c9eb70be2ef3ca7c391d62 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ
index 07a66cd26b985816bb5e54951d4343c661580348..c3219c7b78ae80ac687fa439a7ac3521f41f4631 100644 (file)
@@ -3599,3 +3599,144 @@ msgstr "New backup job wizard"
 
 msgid "This wizard enables you to create in easy way a new backup job."
 msgstr "This wizard enables you to create in easy way a new backup job."
+
+msgid "Monday"
+msgstr "Monday"
+
+msgid "Tuesday"
+msgstr "Tuesday"
+
+msgid "Wednesday"
+msgstr "Wednesday"
+
+msgid "Thursday"
+msgstr "Thursday"
+
+msgid "Friday"
+msgstr "Friday"
+
+msgid "Saturday"
+msgstr "Saturday"
+
+msgid "Sunday"
+msgstr "Sunday"
+
+msgid "Days of the week"
+msgstr "Days of the week"
+
+msgid "Weeks of the month"
+msgstr "Weeks of the month"
+
+msgid "first"
+msgstr "first"
+
+msgid "second"
+msgstr "second"
+
+msgid "third"
+msgstr "third"
+
+msgid "fourth"
+msgstr "fourth"
+
+msgid "fifth"
+msgstr "fifth"
+
+msgid "sixth"
+msgstr "sixth"
+
+msgid "Days of the month"
+msgstr "Days of the month"
+
+msgid "Weeks of the year"
+msgstr "Weeks of the year"
+
+msgid "All weeks"
+msgstr "All weeks"
+
+msgid "All days"
+msgstr "All days"
+
+msgid "Run at specified HH:MM"
+msgstr "Run at specified HH:MM"
+
+msgid "Run at"
+msgstr "Run at"
+
+msgid "All months"
+msgstr "All months"
+
+msgid "January"
+msgstr "January"
+
+msgid "February"
+msgstr "February"
+
+msgid "March"
+msgstr "March"
+
+msgid "April"
+msgstr "April"
+
+msgid "May"
+msgstr "May"
+
+msgid "June"
+msgstr "June"
+
+msgid "July"
+msgstr "July"
+
+msgid "August"
+msgstr "August"
+
+msgid "September"
+msgstr "September"
+
+msgid "October"
+msgstr "October"
+
+msgid "November"
+msgstr "November"
+
+msgid "December"
+msgstr "December"
+
+msgid "Last day of the month"
+msgstr "Last day of the month"
+
+msgid "Months of the year"
+msgstr "Months of the year"
+
+msgid "Hourly"
+msgstr "Hourly"
+
+msgid "Daily"
+msgstr "Daily"
+
+msgid "Weekly"
+msgstr "Weekly"
+
+msgid "Monthly"
+msgstr "Monthly"
+
+msgid "Custom"
+msgstr "Custom"
+
+msgid "Run job every hour at the specified minute"
+msgstr "Run job every hour at the specified minute"
+
+msgid "Run job every day at the specified time"
+msgstr "Run job every day at the specified time"
+
+msgid "Run job every week at the specified time on selected days of the week"
+msgstr "Run job every week at the specified time on selected days of the week"
+
+msgid "Run job every month at the specified time in selected weeks of the month"
+msgstr "Run job every month at the specified time in selected weeks of the month"
+
+msgid "Setup your custom schedule"
+msgstr "Setup your custom schedule"
+
+msgid "Override directives"
+msgstr "Override directives"
index 6dc6583edd2ae9dc3a71bd870bada544cc153b9b..6d9532b091e9278e574edae98a482fbc6649ddc2 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ru/messages.mo and b/gui/baculum/protected/Web/Lang/ru/messages.mo differ
index b2064e46de294eaabb02c3afce2ce59fa42e0567..0b1be3bec84878953f9f83be7ad904c7c5d9ba50 100644 (file)
@@ -3600,3 +3600,144 @@ msgstr "Мастер нового задания"
 msgid "This wizard enables you to create in easy way a new backup job."
 msgstr "Этот мастер позволяет вам легко создать новое задание."
 
+
+msgid "Monday"
+msgstr "Monday"
+
+msgid "Tuesday"
+msgstr "Tuesday"
+
+msgid "Wednesday"
+msgstr "Wednesday"
+
+msgid "Thursday"
+msgstr "Thursday"
+
+msgid "Friday"
+msgstr "Friday"
+
+msgid "Saturday"
+msgstr "Saturday"
+
+msgid "Sunday"
+msgstr "Sunday"
+
+msgid "Days of the week"
+msgstr "Days of the week"
+
+msgid "Weeks of the month"
+msgstr "Weeks of the month"
+
+msgid "first"
+msgstr "first"
+
+msgid "second"
+msgstr "second"
+
+msgid "third"
+msgstr "third"
+
+msgid "fourth"
+msgstr "fourth"
+
+msgid "fifth"
+msgstr "fifth"
+
+msgid "sixth"
+msgstr "sixth"
+
+msgid "Days of the month"
+msgstr "Days of the month"
+
+msgid "Weeks of the year"
+msgstr "Weeks of the year"
+
+msgid "All weeks"
+msgstr "All weeks"
+
+msgid "All days"
+msgstr "All days"
+
+msgid "Run at specified HH:MM"
+msgstr "Run at specified HH:MM"
+
+msgid "Run at"
+msgstr "Run at"
+
+msgid "All months"
+msgstr "All months"
+
+msgid "January"
+msgstr "January"
+
+msgid "February"
+msgstr "February"
+
+msgid "March"
+msgstr "March"
+
+msgid "April"
+msgstr "April"
+
+msgid "May"
+msgstr "May"
+
+msgid "June"
+msgstr "June"
+
+msgid "July"
+msgstr "July"
+
+msgid "August"
+msgstr "August"
+
+msgid "September"
+msgstr "September"
+
+msgid "October"
+msgstr "October"
+
+msgid "November"
+msgstr "November"
+
+msgid "December"
+msgstr "December"
+
+msgid "Last day of the month"
+msgstr "Last day of the month"
+
+msgid "Months of the year"
+msgstr "Months of the year"
+
+msgid "Hourly"
+msgstr "Hourly"
+
+msgid "Daily"
+msgstr "Daily"
+
+msgid "Weekly"
+msgstr "Weekly"
+
+msgid "Monthly"
+msgstr "Monthly"
+
+msgid "Custom"
+msgstr "Custom"
+
+msgid "Run job every hour at the specified minute"
+msgstr "Run job every hour at the specified minute"
+
+msgid "Run job every day at the specified time"
+msgstr "Run job every day at the specified time"
+
+msgid "Run job every week at the specified time on selected days of the week"
+msgstr "Run job every week at the specified time on selected days of the week"
+
+msgid "Run job every month at the specified time in selected weeks of the month"
+msgstr "Run job every month at the specified time in selected weeks of the month"
+
+msgid "Setup your custom schedule"
+msgstr "Setup your custom schedule"
+
+msgid "Override directives"
+msgstr "Override directives"
index 35c507cece0b955006c9db93d9f9f37b0c68505b..614a8bb07d5285ad35cd6a021064070a2a9043fa 100644 (file)
@@ -49,6 +49,7 @@ class DirectorView extends BaculumWebPage {
                        $this->DirDirectorConfig->setComponentName($component_name);
                        $this->DirDirectorConfig->setResourceName($component_name);
                        $this->DirDirectorConfig->setLoadValues(true);
+                       $this->DirDirectorConfig->IsDirectiveCreated = false;
                        $this->DirDirectorConfig->raiseEvent('OnDirectiveListLoad', $this, null);
                }
        }
index 5b0e5d95a424667b7e3eb7446245f75c3a959f7e..3b4dec1356b03163347f191beca78ad0feaef7eb 100644 (file)
@@ -73,7 +73,6 @@
                                </com:TLinkButton>
                                <com:TLinkButton
                                        CommandName="NextStep"
-                                       CommandParameter="save"
                                        ValidationGroup="NewJobDirective"
                                        CssClass="w3-button w3-green"
                                >
                                </com:TLinkButton>
                                <com:TLinkButton
                                        CommandName="NextStep"
-                                       CommandParameter="save"
                                        ValidationGroup="NewJobDirective"
                                        CssClass="w3-button w3-green"
                                >
                                </com:TLinkButton>
                                <com:TLinkButton
                                        CommandName="Complete"
-                                       CommandParameter="save"
                                        CssClass="w3-button w3-green"
                                >
                                        <%[ Create job ]%> &nbsp;<i class="fa fa-paper-plane"></i>
                                        SaveDirectiveActionOk="$('#job_wizard_new_fileset').slideUp(); set_new_fileset(); $('#fileset_save_ok').show();"
                                />
                        </div>
+                       <com:TCallback ID="LoadFilesetList" OnCallback="LoadFilesetList" />
                        <script type="text/javascript">
                                function set_new_fileset() {
                                        var container_id = 'job_wizard_new_fileset';
                                        var resource_id = '<%=$this->Fileset->Directive->ClientID%>';
                                        set_new_resource(container_id, resource_id);
+                                       var cb = <%=$this->LoadFilesetList->ActiveControl->JavaScript%>;
+                                       cb.dispatch();
                                }
                        </script>
                </com:TWizardStep>
                                                />
                                </div>
                        </div>
+                       <com:TCallback ID="LoadPoolList" OnCallback="LoadPoolList" />
                        <script type="text/javascript">
                                function set_new_pool() {
                                        var container_id = 'job_wizard_new_pool';
                                        var resource_id = '<%=$this->Pool->Directive->ClientID%>';
                                        set_new_resource(container_id, resource_id);
+                                       var cb = <%=$this->LoadPoolList->ActiveControl->JavaScript%>;
+                                       cb.dispatch();
                                }
                        </script>
                </com:TWizardStep>
                                                 />
                                </div>
                        </div>
+                       <com:TCallback ID="LoadScheduleList" OnCallback="LoadScheduleList" />
                        <script type="text/javascript">
                                function set_new_schedule() {
                                        var container_id = 'job_wizard_new_schedule';
                                        var resource_id = '<%=$this->Schedule->Directive->ClientID%>';
                                        set_new_resource(container_id, resource_id);
+                                       var cb = <%=$this->LoadScheduleList->ActiveControl->JavaScript%>;
+                                       cb.dispatch();
                                }
                        </script>
                </com:TWizardStep>
index 54c6d05977c1899dd9f3d527df924e7596684dea..2421031be92acbd1be65a5360a456524cb1980c1 100644 (file)
@@ -36,23 +36,11 @@ class NewBackupJobWizard extends BaculumWebPage {
        const PREV_STEP = 'PrevStep';
        const JOBDEFS = 'JobDefs';
 
-       public function onLoad($param) {
-               parent::onLoad($param);
-               $this->JobDefs->saveDirective();
-               $this->Client->saveDirective();
-               $this->Fileset->saveDirective();
-               $this->Storage->saveDirective();
-               $this->Pool->saveDirective();
-               $this->FullBackupPool->saveDirective();
-               $this->IncrementalBackupPool->saveDirective();
-               $this->DifferentialBackupPool->saveDirective();
-               $this->Level->saveDirective();
-               $this->Messages->saveDirective();
-               $this->Schedule->saveDirective();
-       }
-
-       public function onLoadComplete($param) {
-               parent::onLoadComplete($param);
+       public function onPreRender($param) {
+               parent::onPreRender($param);
+               if ($this->IsCallBack) {
+                       return;
+               }
                $step_index = $this->NewJobWizard->getActiveStepIndex();
                $prev_step = $this->getPrevStep();
                $this->setPrevStep($step_index);
@@ -120,13 +108,15 @@ class NewBackupJobWizard extends BaculumWebPage {
         */
        public function loadJobDefs() {
                $jobdefs_list = array();
-               $jobdefs = $this->getModule('api')->get(array('config', 'dir', 'jobdefs'))->output;
+               $jobdefs = $this->getModule('api')->get([
+                       'config', 'dir', 'jobdefs'
+               ])->output;
                for ($i = 0; $i < count($jobdefs); $i++) {
                        $jobdefs_list[] = $jobdefs[$i]->JobDefs->Name;
                }
                asort($jobdefs_list);
                $this->JobDefs->setData($jobdefs_list);
-               $this->JobDefs->onLoad(null);
+               $this->JobDefs->createDirective();
        }
 
        /**
@@ -140,9 +130,9 @@ class NewBackupJobWizard extends BaculumWebPage {
                        return;
                }
                $jobdefs = rawurlencode($directive_value);
-               $result = $this->getModule('api')->get(array(
+               $result = $this->getModule('api')->get([
                        'config', 'dir', 'jobdefs', $jobdefs
-               ));
+               ]);
                if ($result->error === 0) {
                        $value = (array)$result->output;
                        $this->setJobDefs($value);
@@ -177,7 +167,7 @@ class NewBackupJobWizard extends BaculumWebPage {
                if (key_exists('Client', $jobdefs) && is_null($this->Client->getDirectiveValue())) {
                        $this->Client->setDirectiveValue($jobdefs['Client']);
                }
-               $this->Client->onLoad(null);
+               $this->Client->createDirective();
        }
 
        /**
@@ -186,6 +176,14 @@ class NewBackupJobWizard extends BaculumWebPage {
         * @return none
         */
        public function loadFilesets() {
+               $this->loadFilesetList(null, null);
+               $jobdefs = $this->getJobDefs();
+               if (key_exists('Fileset', $jobdefs) && is_null($this->Fileset->getDirectiveValue())) {
+                       $this->Fileset->setDirectiveValue($jobdefs['Fileset']);
+               }
+       }
+
+       public function loadFilesetList($sender, $param) {
                $fileset_list = array();
                $filesets = $this->getModule('api')->get(array('config', 'dir', 'fileset'))->output;
                for ($i = 0; $i < count($filesets); $i++) {
@@ -193,11 +191,7 @@ class NewBackupJobWizard extends BaculumWebPage {
                }
                asort($fileset_list);
                $this->Fileset->setData($fileset_list);
-               $jobdefs = $this->getJobDefs();
-               if (key_exists('Fileset', $jobdefs) && is_null($this->Fileset->getDirectiveValue())) {
-                       $this->Fileset->setDirectiveValue($jobdefs['Fileset']);
-               }
-               $this->Fileset->onLoad(null);
+               $this->Fileset->createDirective();
        }
 
        /**
@@ -264,8 +258,8 @@ class NewBackupJobWizard extends BaculumWebPage {
                $jobdefs = $this->getJobDefs();
                if (key_exists('Storage', $jobdefs) && is_array($jobdefs['Storage']) && count($jobdefs['Storage']) == 1 && is_null($this->Storage->getDirectiveValue())) {
                        $this->Storage->setDirectiveValue($jobdefs['Storage'][0]);
+                       $this->Storage->createDirective();
                }
-               $this->Storage->onLoad(null);
                if (key_exists('SpoolData', $jobdefs) && is_null($this->SpoolData->getDirectiveValue())) {
                        $this->SpoolData->setDirectiveValue($jobdefs['SpoolData']);
                        $this->SpoolData->createDirective();
@@ -286,33 +280,39 @@ class NewBackupJobWizard extends BaculumWebPage {
         * @return none
         */
        public function loadPools() {
-               $pool_list = array();
-               $pools = $this->getModule('api')->get(array('config', 'dir', 'pool'))->output;
-               for ($i = 0; $i < count($pools); $i++) {
-                       $pool_list[] = $pools[$i]->Pool->Name;
-               }
-               asort($pool_list);
-               $this->Pool->setData($pool_list);
+               $pool_list = $this->loadPoolList(null, null);
                $jobdefs = $this->getJobDefs();
                $this->FullBackupPool->setData($pool_list);
                if (key_exists('FullBackupPool', $jobdefs) && is_null($this->FullBackupPool->getDirectiveValue())) {
                        $this->FullBackupPool->setDirectiveValue($jobdefs['FullBackupPool']);
                }
-               $this->FullBackupPool->onLoad(null);
+               $this->FullBackupPool->createDirective();
                $this->IncrementalBackupPool->setData($pool_list);
                if (key_exists('IncrementalBackupPool', $jobdefs) && is_null($this->IncrementalBackupPool->getDirectiveValue())) {
                        $this->IncrementalBackupPool->setDirectiveValue($jobdefs['IncrementalBackupPool']);
                }
-               $this->IncrementalBackupPool->onLoad(null);
+               $this->IncrementalBackupPool->createDirective();
                $this->DifferentialBackupPool->setData($pool_list);
                if (key_exists('DifferentialBackupPool', $jobdefs) && is_null($this->DifferentialBackupPool->getDirectiveValue())) {
                        $this->DifferentialBackupPool->setDirectiveValue($jobdefs['DifferentialBackupPool']);
                }
-               $this->DifferentialBackupPool->onLoad(null);
+               $this->DifferentialBackupPool->createDirective();
                if (key_exists('Pool', $jobdefs) && is_null($this->Pool->getDirectiveValue())) {
                        $this->Pool->setDirectiveValue($jobdefs['Pool']);
                }
-               $this->Pool->onLoad(null);
+               $this->Pool->createDirective();
+       }
+
+       public function loadPoolList($sender, $param) {
+               $pool_list = array();
+               $pools = $this->getModule('api')->get(array('config', 'dir', 'pool'))->output;
+               for ($i = 0; $i < count($pools); $i++) {
+                       $pool_list[] = $pools[$i]->Pool->Name;
+               }
+               asort($pool_list);
+               $this->Pool->setData($pool_list);
+               $this->Pool->createDirective();
+               return $pool_list;
        }
 
        public function loadBackupJobDirectives() {
@@ -371,7 +371,7 @@ class NewBackupJobWizard extends BaculumWebPage {
                if (key_exists('Level', $jobdefs)) {
                        $this->Level->setDirectiveValue($jobdefs['Level']);
                }
-               $this->Level->onLoad(null);
+               $this->Level->createDirective();
        }
        /**
         * Load messages.
@@ -390,7 +390,7 @@ class NewBackupJobWizard extends BaculumWebPage {
                if (key_exists('Messages', $jobdefs)) {
                        $this->Messages->setDirectiveValue($jobdefs['Messages']);
                }
-               $this->Messages->onLoad(null);
+               $this->Messages->createDirective();
        }
 
        /**
@@ -399,6 +399,15 @@ class NewBackupJobWizard extends BaculumWebPage {
         * @return none
         */
        public function loadSchedules() {
+               $this->loadScheduleList(null, null);
+               $jobdefs = $this->getJobDefs();
+               if (key_exists('Schedule', $jobdefs)) {
+                       $this->Schedule->setDirectiveValue($jobdefs['Schedule']);
+               }
+               $this->Schedule->createDirective();
+       }
+
+       public function loadScheduleList($sender, $param) {
                $schedule_list = array();
                $schedules = $this->getModule('api')->get(array('config', 'dir', 'schedule'))->output;
                for ($i = 0; $i < count($schedules); $i++) {
@@ -406,11 +415,7 @@ class NewBackupJobWizard extends BaculumWebPage {
                }
                asort($schedule_list);
                $this->Schedule->setData($schedule_list);
-               $jobdefs = $this->getJobDefs();
-               if (key_exists('Schedule', $jobdefs)) {
-                       $this->Schedule->setDirectiveValue($jobdefs['Schedule']);
-               }
-               $this->Schedule->onLoad(null);
+               $this->Schedule->createDirective();
        }
 
        public function wizardCompleted($sender, $param) {
index dc61762924ec04699c02e04ea8fe72d7f23eb93c..9ae29dd9ebb7192ca8ca7e33751094380287976b 100644 (file)
@@ -73,7 +73,6 @@
                                </com:TLinkButton>
                                <com:TLinkButton
                                        CommandName="NextStep"
-                                       CommandParameter="save"
                                        ValidationGroup="NewCopyJobDirective"
                                        CssClass="w3-button w3-green"
                                >
                                </com:TLinkButton>
                                <com:TLinkButton
                                        CommandName="NextStep"
-                                       CommandParameter="save"
                                        ValidationGroup="NewCopyJobDirective"
                                        CssClass="w3-button w3-green"
                                >
                                </com:TLinkButton>
                                <com:TLinkButton
                                        CommandName="Complete"
-                                       CommandParameter="save"
                                        CssClass="w3-button w3-green"
                                >
                                        <%[ Create job ]%> &nbsp;<i class="fa fa-paper-plane"></i>
@@ -1754,7 +1751,7 @@ function show_storage_warning(storage, pool, jobs) {
                                        <com:Application.Web.Portlets.DirectiveTextBox
                                                ID="MaximumSpawnedJobs"
                                                DirectiveName="MaximumSpawnedJobs"
-                                               DirectiveValue="600"
+                                               DefaultValue="600"
                                                Label="Maximum Spawned Jobs"
                                                Show="true"
                                                ShowResetButton="false"
index 55b4c882936c600314a7d2fb665525742c09c44b..e928782245961463e516e2a60992d747ad5cfbad 100644 (file)
@@ -56,23 +56,11 @@ class NewCopyJobWizard extends BaculumWebPage {
                ];
        }
 
-       public function onLoad($param) {
-               parent::onLoad($param);
-               $this->JobDefs->saveDirective();
-               $this->Pool->saveDirective();
-               $this->SelectionType->saveDirective();
-               $this->NextPool->saveDirective();
-               $this->SourceStorage->saveDirective();
-               $this->DestinationStorage->saveDirective();
-               $this->Messages->saveDirective();
-               $this->Schedule->saveDirective();
-               $this->Level->saveDirective();
-               $this->Client->saveDirective();
-               $this->FileSet->saveDirective();
-       }
-
-       public function onLoadComplete($param) {
-               parent::onLoadComplete($param);
+       public function onPreRender($param) {
+               parent::onPreRender($param);
+               if ($this->IsCallBack) {
+                       return;
+               }
                $step_index = $this->NewJobWizard->getActiveStepIndex();
                $prev_step = $this->getPrevStep();
                $this->setPrevStep($step_index);
@@ -148,7 +136,7 @@ class NewCopyJobWizard extends BaculumWebPage {
                        }
                        asort($jobdefs_list);
                        $this->JobDefs->setData($jobdefs_list);
-                       $this->JobDefs->onLoad(null);
+                       $this->JobDefs->createDirective();
                }
        }
 
@@ -212,7 +200,7 @@ class NewCopyJobWizard extends BaculumWebPage {
                if (key_exists($name, $jobdefs) && is_null($control->getDirectiveValue())) {
                        $control->setDirectiveValue($jobdefs[$name]);
                }
-               $control->onLoad(null);
+               $control->createDirective();
        }
 
        /**
@@ -300,7 +288,7 @@ class NewCopyJobWizard extends BaculumWebPage {
         */
        public function loadSelectionTypes() {
                $this->SelectionType->setData($this->sel_types);
-               $this->SelectionType->onLoad(null);
+               $this->SelectionType->createDirective();
        }
 
        /**
@@ -384,7 +372,7 @@ class NewCopyJobWizard extends BaculumWebPage {
                        if (key_exists('Storage', $jobdefs) && is_array($jobdefs['Storage']) && count($jobdefs['Storage']) == 1 && is_null($control->getDirectiveValue())) {
                                $control->setDirectiveValue($jobdefs['Storage'][0]);
                        }
-                       $control->onLoad(null);
+                       $control->createDirective();
                }
        }
 
@@ -490,7 +478,7 @@ class NewCopyJobWizard extends BaculumWebPage {
                        if (key_exists('Messages', $jobdefs)) {
                                $this->Messages->setDirectiveValue($jobdefs['Messages']);
                        }
-                       $this->Messages->onLoad(null);
+                       $this->Messages->createDirective();
                }
        }
 
@@ -516,7 +504,7 @@ class NewCopyJobWizard extends BaculumWebPage {
                        if (key_exists('Schedule', $jobdefs)) {
                                $this->Schedule->setDirectiveValue($jobdefs['Schedule']);
                        }
-                       $this->Schedule->onLoad(null);
+                       $this->Schedule->createDirective();
                }
        }
 
@@ -537,7 +525,7 @@ class NewCopyJobWizard extends BaculumWebPage {
                        // no level in jobdefs, take first level
                        $this->Level->setDirectiveValue($level_list[0]);
                }
-               $this->Level->onLoad(null);
+               $this->Level->createDirective();
        }
 
        /**
@@ -563,7 +551,7 @@ class NewCopyJobWizard extends BaculumWebPage {
                        } elseif (count($client_list) > 0) {
                                $this->Client->setDirectiveValue($client_list[0]);
                        }
-                       $this->Client->onLoad(null);
+                       $this->Client->createDirective();
                }
        }
 
@@ -590,7 +578,7 @@ class NewCopyJobWizard extends BaculumWebPage {
                        } elseif (count($fileset_list) > 0) {
                                $this->FileSet->setDirectiveValue($fileset_list[0]);
                        }
-                       $this->FileSet->onLoad(null);
+                       $this->FileSet->createDirective();
                }
        }
 
index a773d46875d432dbf6565428a45a3bd7c05410dd..07ab40b0aad380a584ff18a4943ea9e00a7e0ec8 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2020 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -1279,6 +1279,7 @@ class Security extends BaculumWebPage {
                }
                $this->ConsoleConfig->setHost($this->User->getDefaultAPIHost());
                $this->ConsoleConfig->setComponentName($_SESSION['dir']);
+               $this->ConsoleConfig->IsDirectiveCreated = false;
                $this->ConsoleConfig->raiseEvent('OnDirectiveListLoad', $this, null);
        }
 
@@ -1344,6 +1345,7 @@ class Security extends BaculumWebPage {
                        ]
                ];
                $this->ConsoleConfig->setData($config);
+               $this->ConsoleConfig->IsDirectiveCreated = false;
                $this->ConsoleConfig->raiseEvent('OnDirectiveListLoad', $this, null);
                $this->getCallbackClient()->callClientFunction('oBaculaConfigSection.show_sections', [true]);
        }
index 5b26246fdb002ee841fb383f34f089d45d8c7e19..7145a953ae2325f2106116cf996771f4a3a3fcef 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -93,15 +93,6 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                }
        }
 
-       public function onPreRender($param) {
-               /**
-                * This method overwrites DirectiveListTemplate::onPreRender()
-                * Not calling parent method is intentional here because this class
-                * isn't typical control list class and calling parent::onPreRender()
-                * causes error.
-                */
-       }
-
        private function getConfigData($host, array $parameters) {
                $default_params = array('config');
                $params = array_merge($default_params, $parameters);
@@ -115,6 +106,10 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
 
        public function loadConfig() {
                $load_values = $this->getLoadValues();
+               if (!$load_values && $this->IsDirectiveCreated) {
+                       // This control is loaded only once, otherwise fields loose assigned values.
+                       return;
+               }
 
                $host = $this->getHost();
                $component_type = $this->getComponentType();
@@ -253,6 +248,7 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                $this->RepeaterDirectives->DataSource = $directives;
                $this->RepeaterDirectives->dataBind();
                $this->ConfigDirectives->Display = 'Dynamic';
+               $this->IsDirectiveCreated = true;
        }
 
        public function loadDirectives($sender, $param) {
@@ -286,6 +282,11 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                                $directive_name = $controls[$j]->getDirectiveName();
                                $directive_value = $controls[$j]->getDirectiveValue();
 
+                               if (is_null($directive_name)) {
+                                       // skip controls without data
+                                       continue;
+                               }
+
                                $default_value = null;
                                if (key_exists($directive_name, $resource_desc)) {
                                        $default_value = $resource_desc[$directive_name]->DefaultValue;
@@ -356,8 +357,12 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                        }
                }
                $load_values = $this->getLoadValues();
-               $res_name_dir = key_exists('Name', $directives) ? $directives['Name'] : '';
+               $res_name_dir = key_exists('Name', $directives) ? $directives['Name'] : null;
                $resource_name = $this->getResourceName();
+               if (!$res_name_dir && $resource_name) {
+                       // In some cases with double control load Name value stays empty. Recreate it here.
+                       $directives['Name'] = $res_name_dir = $resource_name;
+               }
                if ($load_values === true) {
                        if ($resource_name !== $res_name_dir) {
                                // RENAME RESOURCE
index 28876cf93b20c061dec3d2b9428e28fd049d10b4..1728223d2f98d5f767d65331a06dd0da85e02904 100644 (file)
@@ -124,6 +124,7 @@ class BaculaConfigResourceList extends Portlets {
                $this->ResourceConfig->setComponentType($component_type);
                $this->ResourceConfig->setComponentName($component_name);
                $this->ResourceConfig->setResourceType($resource_type);
+               $this->ResourceConfig->IsDirectiveCreated = false;
                $this->ResourceConfig->raiseEvent('OnDirectiveListLoad', $this, null);
        }
 
index 86c1957c1b70631f8169d5d19966c036c8093103..88bf0967d8ef50687efb462015e6b6c1e485b29e 100644 (file)
@@ -133,7 +133,7 @@ var oBaculaConfigResourceList<%=$this->ClientID%> = {
                        <h2 id="resource_window_title_add<%=$this->ClientID%>" style="display: none"><%[ Add ]%> <%=$this->getResourceType()%></h2>
                        <h2 id="resource_window_title_edit<%=$this->ClientID%>" style="display: none"><%[ Edit ]%> <%=$this->getResourceType()%></h2>
                </header>
-               <div class="w3-container w3-margin-left w3-margin-right w3-margin-top w3-text-teal">
+               <div class="w3-container w3-margin-left w3-margin-right w3-margin-top">
                        <com:Application.Web.Portlets.BaculaConfigDirectives
                                ID="ResourceConfig"
                                ShowRemoveButton="false"
index 9bf235fc5acac713fa238b345df4a0596ee2628c..455051cd1a2e388f00f223b59ae8be0faa3ecbc9 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -33,18 +33,6 @@ Prado::using('Application.Web.Portlets.DirectiveTemplate');
  */
 class DirectiveComboBox extends DirectiveTemplate {
 
-       public function onPreRender($param) {
-               $this->createDirectiveInternal();
-               $this->saveDirective();
-               parent::onPreRender($param);
-       }
-
-       public function saveDirective() {
-               $value = $this->getValue();
-               $this->Directive->setSelectedValue($value);
-               $this->setDirectiveValue($value);
-       }
-
        public function getValue() {
                $value = $this->Directive->getSelectedValue();
                if (!is_string($value) || empty($value)) {
@@ -53,12 +41,11 @@ class DirectiveComboBox extends DirectiveTemplate {
                return $value;
        }
 
-       public function createDirectiveInternal() {
+       public function createDirective() {
                $this->Label->Text = $this->getLabel();
                $data = $this->getData();
                $resource_names = $this->getResourceNames();
                $directive_name = $this->getDirectiveName();
-               $required = $this->getRequired();
                $resource = $this->getResource();
                $in_config = $this->getInConfig();
                $items = array();
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveDaysOfMonth.php b/gui/baculum/protected/Web/Portlets/DirectiveDaysOfMonth.php
new file mode 100644 (file)
index 0000000..c228e8e
--- /dev/null
@@ -0,0 +1,114 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2021 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox');
+Prado::using('Application.Common.Class.Params');
+Prado::using('Application.Web.Portlets.DirectiveTemplate');
+
+/**
+ * Days of month directive control.
+ *
+ * @author Marcin Haba <marcin.haba@bacula.pl>
+ * @category Control
+ * @package Baculum Web
+ */
+class DirectiveDaysOfMonth extends DirectiveTemplate {
+
+       const SHOW_OPTIONS = 'ShowOptions';
+       const DAY_CONTROL_PREFIX = 'day';
+
+       public function getValue() {
+               $value = [];
+               $days = range(1, 31);
+               for ($i = 0; $i < count($days); $i++) {
+                       if ($this->{self::DAY_CONTROL_PREFIX . $days[$i]}->Checked || $this->AllDaysOfMonth->Checked) {
+                               $value[] = $i;
+                       }
+               }
+               if (count($value) == 0) {
+                       $value = $days;
+               }
+               if ($this->lastday->Checked) {
+                       $value = [];
+               }
+               return $value;
+       }
+
+       public function createDirective() {
+               $this->Label->Text = $this->getLabel();
+               $directive_value = $this->getDirectiveValue();
+               $default_value = $this->getDefaultValue();
+               if (!is_array($directive_value)) {
+                       $directive_value = range(0, 30);
+               }
+
+               $days = range(1, 31);
+               $d_len = count($days);
+               $dv_len = count($directive_value);
+               if ($this->getInConfig() === false && $dv_len == $d_len) {
+                       if (is_array($default_value) && count($default_value) > 0) {
+                               $directive_value = $default_value;
+                       }
+               }
+
+               for ($i = 0; $i < count($days); $i++) {
+                       $key = self::DAY_CONTROL_PREFIX . $days[$i];
+                       if ($dv_len > 0 && $dv_len < $d_len) {
+                               // selected days
+                               $this->{$key}->Checked = in_array($i, $directive_value);
+                       }
+
+                       if ($this->Disabled) {
+                               $this->{$key}->Enabled = false;
+                       }
+                       if ($this->CssClass) {
+                               $cssclass = $this->CssClass . ' ' . $this->{$key}->getCssClass();
+                               $this->{$key}->setCssClass($cssclass);
+                       }
+               }
+
+               // set 'select all' checkbox
+               if ($this->Disabled) {
+                       $this->AllDaysOfMonth->Enabled = false;
+               } elseif ($dv_len == $d_len && $this->ShowOptions) {
+                       // all days
+                       $this->AllDaysOfMonth->Checked = true;
+               }
+
+               // set 'last day of the month' checkbox
+               if ($dv_len == 0) {
+                       $this->lastday->Checked = true;
+               } else {
+                       $this->lastday->Checked = false;
+               }
+       }
+
+       public function setShowOptions($show) {
+               $show = TPropertyValue::ensureBoolean($show);
+               $this->setViewState(self::SHOW_OPTIONS, $show);
+       }
+
+       public function getShowOptions() {
+               return $this->getViewState(self::SHOW_OPTIONS, false);
+       }
+}
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveDaysOfMonth.tpl b/gui/baculum/protected/Web/Portlets/DirectiveDaysOfMonth.tpl
new file mode 100644 (file)
index 0000000..b1cb4b0
--- /dev/null
@@ -0,0 +1,308 @@
+<div class="directive_field w3-row w3-border w3-padding w3-margin-bottom<%=!$this->display_directive ? ' hide' : '';%>">
+       <div class="w3-col w3-left" style="width: 180px; padding: 8px 0;">
+               <com:TActiveLabel
+                       ID="Label"
+                       ActiveControl.EnableUpdate="false"
+                       Visible="<%=$this->display_directive%>"
+                />:
+       </div>
+       <div class="w3-col w3-left directive_value" style="max-width: 1000px">
+               <div class="w3-row<%=$this->ShowOptions === false? ' w3-hide' : ''%>">
+                       <com:TCheckBox
+                               ID="AllDaysOfMonth"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->AllDaysOfMonth->ClientID%>"><%[ All days ]%></label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="day1"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day1->ClientID%>">1</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day2"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day2->ClientID%>">2</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day3"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day3->ClientID%>">3</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day4"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day4->ClientID%>">4</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day5"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day5->ClientID%>">5</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day6"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day6->ClientID%>">6</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day7"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day7->ClientID%>">7</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="day8"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day8->ClientID%>">8</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day9"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day9->ClientID%>">9</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day10"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day10->ClientID%>">10</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day11"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day11->ClientID%>">11</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day12"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day12->ClientID%>">12</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day13"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day13->ClientID%>">13</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day14"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day14->ClientID%>">14</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="day15"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day15->ClientID%>">15</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day16"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day16->ClientID%>">16</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day17"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day17->ClientID%>">17</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day18"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day18->ClientID%>">18</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day19"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day19->ClientID%>">19</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day20"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day20->ClientID%>">20</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day21"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day21->ClientID%>">21</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="day22"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day22->ClientID%>">22</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day23"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day23->ClientID%>">23</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day24"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day24->ClientID%>">24</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day25"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day25->ClientID%>">25</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day26"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day26->ClientID%>">26</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day27"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day27->ClientID%>">27</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day28"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day28->ClientID%>">28</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="day29"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day29->ClientID%>">29</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day30"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day30->ClientID%>">30</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="day31"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->day31->ClientID%>">31</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="lastday"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block lastday"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block day_of_month" for="<%=$this->lastday->ClientID%>" style="width: 300px"><%[ Last day of the month ]%></label> &nbsp;
+               </div>
+               <script>
+                       var <%=$this->AllDaysOfMonth->ClientID%>_check_all = function(check) {
+                               var el = $('#<%=$this->AllDaysOfMonth->ClientID%>');
+                               var p = $(el).closest('.directive_value');
+                               var ld = p.find('input[type=\'checkbox\'].lastday');
+                               if (!ld.get(0).checked) {
+                                       p.find('input[type=\'checkbox\'].dom').prop('disabled', check);
+                               }
+                               ld.prop('disabled', check);
+                       };
+                       var <%=$this->lastday->ClientID%>_check_lastday = function(check) {
+                               var el =$('#<%=$this->lastday->ClientID%>');
+                               el.closest('.directive_value').find('input[type=\'checkbox\'].dom').prop('disabled', check);
+                       };
+                       document.getElementById('<%=$this->AllDaysOfMonth->ClientID%>').addEventListener('click', function(e) {
+                               <%=$this->AllDaysOfMonth->ClientID%>_check_all(this.checked);
+                       });
+                       document.getElementById('<%=$this->lastday->ClientID%>').addEventListener('click', function(e) {
+                               <%=$this->lastday->ClientID%>_check_lastday(this.checked);
+                       });
+                       <%=$this->lastday->ClientID%>_check_lastday($('#<%=$this->lastday->ClientID%>').is(':checked'));
+                       <%=$this->AllDaysOfMonth->ClientID%>_check_all($('#<%=$this->AllDaysOfMonth->ClientID%>').is(':checked'));
+               </script>
+       </div>
+</div>
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveDaysOfWeek.php b/gui/baculum/protected/Web/Portlets/DirectiveDaysOfWeek.php
new file mode 100644 (file)
index 0000000..235bbb5
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2021 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox');
+Prado::using('Application.Common.Class.Params');
+Prado::using('Application.Web.Portlets.DirectiveTemplate');
+
+/**
+ * Days of week directive control.
+ *
+ * @author Marcin Haba <marcin.haba@bacula.pl>
+ * @category Control
+ * @package Baculum Web
+ */
+class DirectiveDaysOfWeek extends DirectiveTemplate {
+
+       const SHOW_OPTIONS = 'ShowOptions';
+
+       public function getValue() {
+               $value = [];
+               $wdays = array_values(Params::$wdays);
+               for ($i = 0; $i < count($wdays); $i++) {
+                       if ($this->{$wdays[$i]}->Checked || $this->AllDaysOfWeek->Checked) {
+                               $value[] = $i;
+                       }
+               }
+               if (count($value) == 0) {
+                       $value = range(0, 6);
+               }
+               return $value;
+       }
+
+       public function createDirective() {
+               $this->Label->Text = $this->getLabel();
+               $directive_value = $this->getDirectiveValue();
+               $default_value = $this->getDefaultValue();
+               $wdays = array_values(Params::$wdays);
+               if (!is_array($directive_value)) {
+                       $directive_value = $wdays;
+               }
+               $wd_len = count($wdays);
+               $dv_len = count($directive_value);
+               if ($this->getInConfig() === false && $dv_len == $wd_len) {
+                       if (is_array($default_value) && count($default_value) > 0) {
+                               $directive_value = $default_value;
+                       }
+               }
+
+               for ($i = 0; $i < $wd_len; $i++) {
+                       if ($dv_len < $wd_len) {
+                               // selected days
+                               $this->{$wdays[$i]}->Checked = in_array($i, $directive_value);
+                       }
+                       if ($this->Disabled) {
+                               $this->{$wdays[$i]}->Enabled = false;
+                       }
+                       if ($this->CssClass) {
+                               $cssclass = $this->CssClass . ' ' . $this->{$wdays[$i]}->getCssClass();
+                               $this->{$wdays[$i]}->setCssClass($cssclass);
+                       }
+               }
+               if ($this->Disabled) {
+                       $this->AllDaysOfWeek->Enabled = false;
+               } elseif ($dv_len == $wd_len && $this->ShowOptions) {
+                       // all days
+                       $this->AllDaysOfWeek->Checked = true;
+               }
+       }
+
+       public function setShowOptions($show) {
+               $show = TPropertyValue::ensureBoolean($show);
+               $this->setViewState(self::SHOW_OPTIONS, $show);
+       }
+
+       public function getShowOptions() {
+               return $this->getViewState(self::SHOW_OPTIONS, false);
+       }
+}
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveDaysOfWeek.tpl b/gui/baculum/protected/Web/Portlets/DirectiveDaysOfWeek.tpl
new file mode 100644 (file)
index 0000000..c51ea03
--- /dev/null
@@ -0,0 +1,86 @@
+<div class="directive_field w3-row w3-border w3-padding w3-margin-bottom<%=!$this->display_directive ? ' hide' : '';%>">
+       <div class="w3-col w3-left" style="width: 180px; padding: 8px 0;">
+               <com:TActiveLabel
+                       ID="Label"
+                       ActiveControl.EnableUpdate="false"
+                       Visible="<%=$this->display_directive%>"
+                />:
+       </div>
+       <div class="w3-col w3-left directive_value" style="max-width: 1000px">
+               <div class="w3-row<%=$this->ShowOptions === false? ' w3-hide' : ''%>">
+                       <com:TCheckBox
+                               ID="AllDaysOfWeek"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->AllDaysOfWeek->ClientID%>"><%[ All days ]%></label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="Sunday"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->Sunday->ClientID%>"><%[ Sunday ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                                ID="Monday"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->Monday->ClientID%>"><%[ Monday ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="Tuesday"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->Tuesday->ClientID%>"><%[ Tuesday ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="Wednesday"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->Wednesday->ClientID%>"><%[ Wednesday ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="Thursday"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->Thursday->ClientID%>"><%[ Thursday ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="Friday"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->Friday->ClientID%>"><%[ Friday ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="Saturday"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->Saturday->ClientID%>"><%[ Saturday ]%></label> &nbsp;
+               </div>
+               <script>
+                       var <%=$this->AllDaysOfWeek->ClientID%>_check_all = function(check) {
+                               $('#<%=$this->AllDaysOfWeek->ClientID%>').closest('.directive_value').find('input[type=\'checkbox\'].dow').prop('disabled', check);
+                       }
+                       <%=$this->AllDaysOfWeek->ClientID%>_check_all($('#<%=$this->AllDaysOfWeek->ClientID%>').is(':checked'));
+                       document.getElementById('<%=$this->AllDaysOfWeek->ClientID%>').addEventListener('click', function(e) {
+                               <%=$this->AllDaysOfWeek->ClientID%>_check_all(this.checked);
+                       });
+               </script>
+       </div>
+</div>
index 64fa90976673b48c5af4859a1c72064854ebf58f..6c27c0c48b6bc6b91ace0fb1b6bc59016fa1590f 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -286,6 +286,7 @@ class DirectiveFileSet extends DirectiveListTemplate {
                        for ($i = 0; $i < count($this->directive_types); $i++) {
                                $controls = $value->RepeaterFileSetOptions->findControlsByType($this->directive_types[$i]);
                                for ($j = 0; $j < count($controls); $j++) {
+                                       $controls[$j]->setValue();
                                        $directive_name = $controls[$j]->getDirectiveName();
                                        $directive_value = $controls[$j]->getDirectiveValue();
                                        $index = $controls[$j]->getGroupName();
@@ -316,6 +317,7 @@ class DirectiveFileSet extends DirectiveListTemplate {
 
                                $controls = $value->RepeaterFileSetInclude->findControlsByType($this->directive_types[$i]);
                                for ($j = 0; $j < count($controls); $j++) {
+                                       $controls[$j]->setValue();
                                        $directive_name = $controls[$j]->getDirectiveName();
                                        $directive_value = $controls[$j]->getDirectiveValue();
                                        if (empty($directive_value)) {
@@ -332,6 +334,7 @@ class DirectiveFileSet extends DirectiveListTemplate {
                                }
                                $controls = $value->RepeaterFileSetPlugin->findControlsByType($this->directive_types[$i]);
                                for ($j = 0; $j < count($controls); $j++) {
+                                       $controls[$j]->setValue();
                                        $directive_name = $controls[$j]->getDirectiveName();
                                        $directive_value = $controls[$j]->getDirectiveValue();
                                        if (empty($directive_value)) {
@@ -375,6 +378,7 @@ class DirectiveFileSet extends DirectiveListTemplate {
                for ($i = 0; $i < count($this->directive_types); $i++) {
                        $controls = $this->RepeaterFileSetExclude->findControlsByType($this->directive_types[$i]);
                        for ($j = 0; $j < count($controls); $j++) {
+                               $controls[$j]->setValue();
                                $directive_name = $controls[$j]->getDirectiveName();
                                $directive_value = $controls[$j]->getDirectiveValue();
                                if (is_null($directive_value)) {
index 283f308de9d571d0523ee7a29b1d936dbf86170b..79ba93a333662d1a16555d1920556c028926477c 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -33,11 +33,6 @@ Prado::using('Application.Web.Portlets.DirectiveTemplate');
  */
 class DirectiveListBox extends DirectiveTemplate {
 
-       public function onPreRender($param) {
-               parent::onPreRender($param);
-               $this->createDirectiveInternal();
-       }
-
        public function getValue() {
                $value = array();
                $values = $this->Directive->getSelectedIndices();
@@ -48,7 +43,7 @@ class DirectiveListBox extends DirectiveTemplate {
                return $value;
        }
 
-       public function createDirectiveInternal() {
+       public function createDirective() {
                $this->Label->Text = $this->getLabel();
                $data = $this->getData();
                $resource_names = $this->getResourceNames();
index 232be6954dc92b6c97f5adf2a274b8d73b27af36..bf206146f47d6ab59f6eda4b6f271d3a5461e49a 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -45,6 +45,7 @@ class DirectiveListTemplate extends ConfigListTemplate implements IActiveControl
        const SHOW = 'Show';
        const PARENT_NAME = 'ParentName';
        const GROUP_NAME = 'GroupName';
+       const IS_DIRECTIVE_CREATED = 'IsDirectiveCreated';
 
        public $display_directive;
 
@@ -69,10 +70,7 @@ class DirectiveListTemplate extends ConfigListTemplate implements IActiveControl
 
        public function onPreRender($param) {
                parent::onPreRender($param);
-               $cmd = $this->getCmdParam();
-               if ($this->getPage()->IsCallBack && (!$cmd || $cmd === 'show_all_directives') && method_exists($this, 'loadConfig')) {
-                       $this->loadConfig();
-               } elseif (!$this->getPage()->IsCallBack && !$this->getPage()->IsPostBack) {
+               if (!$this->getPage()->IsCallBack && !$this->getPage()->IsPostBack) {
                        $this->display_directive = $this->getShow();
                }
        }
@@ -188,5 +186,14 @@ class DirectiveListTemplate extends ConfigListTemplate implements IActiveControl
        public function setGroupName($group_name) {
                $this->setViewState(self::GROUP_NAME, $group_name);
        }
+
+       public function getIsDirectiveCreated() {
+               return $this->getViewState(self::IS_DIRECTIVE_CREATED);
+       }
+
+       public function setIsDirectiveCreated($is_created) {
+               $this->setViewState(self::IS_DIRECTIVE_CREATED, $is_created);
+       }
+
 }
 ?>
index 2e7b5f818e697dd38034f61fc502cf0a4919256c..33359dd294a337ea14a5f6bd819adee8b0f13831 100644 (file)
@@ -166,6 +166,7 @@ class DirectiveMessages extends DirectiveListTemplate {
                        $directive_values = array();
                        $where_control = $control->findControlsByType('DirectiveTextBox');
                        if (count($where_control) === 1 && $where_control[0]->getShow() === true) {
+                               $where_control[0]->setValue();
                                $directive_values['Where'] = array($where_control[0]->getDirectiveValue());
                        }
                        $types_control = $control->Types;
index 0ae54fc23cd8f594b9dfa9358c6292f147ee2a30..8a99c2d0d9bacbd4021fab81fb8091e12074527d 100644 (file)
@@ -8,7 +8,6 @@
                                CssClass="w3-button w3-green w3-right"
                                OnCommand="SourceTemplateControl.removeMessages"
                                CommandName="<%=$this->ItemIndex%>"
-                               CommandParameter="save"
                        >
                                <i class="fa fa-trash-alt"></i> &nbsp;<%[ Remove ]%>
                        </com:TActiveLinkButton>
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveMonthsOfYear.php b/gui/baculum/protected/Web/Portlets/DirectiveMonthsOfYear.php
new file mode 100644 (file)
index 0000000..2d3e8bd
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2021 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox');
+Prado::using('Application.Common.Class.Params');
+Prado::using('Application.Web.Portlets.DirectiveTemplate');
+
+/**
+ * Months of the year directive control.
+ *
+ * @author Marcin Haba <marcin.haba@bacula.pl>
+ * @category Control
+ * @package Baculum Web
+ */
+class DirectiveMonthsOfYear extends DirectiveTemplate {
+
+       const SHOW_OPTIONS = 'ShowOptions';
+
+       public function getValue() {
+               $value = [];
+               $months = array_values(Params::$months);
+               for ($i = 0; $i < count($months); $i++) {
+                       if ($this->{$months[$i]}->Checked || $this->AllMonthsOfYear->Checked) {
+                               $value[] = $i;
+                       }
+               }
+               if (count($value) == 0) {
+                       $value = range(0, 11);
+               }
+               return $value;
+       }
+
+       public function createDirective() {
+               $this->Label->Text = $this->getLabel();
+               $directive_value = $this->getDirectiveValue();
+               $default_value = $this->getDefaultValue();
+               $months = array_values(Params::$months);
+               if (!is_array($directive_value)) {
+                       $directive_value = $months;
+               }
+               $m_len = count($months);
+               $dv_len = count($directive_value);
+               if ($this->getInConfig() === false && $dv_len == $m_len) {
+                       if (is_array($default_value) && count($default_value) > 0) {
+                               $directive_value = $default_value;
+                       }
+               }
+
+               for ($i = 0; $i < $m_len; $i++) {
+                       if ($dv_len < $m_len) {
+                               // selected months
+                               $this->{$months[$i]}->Checked = in_array($i, $directive_value);
+                       }
+                       if ($this->Disabled) {
+                               $this->{$months[$i]}->Enabled = false;
+                       }
+                       if ($this->CssClass) {
+                               $cssclass = $this->CssClass . ' ' . $this->{$months[$i]}->getCssClass();
+                               $this->{$months[$i]}->setCssClass($cssclass);
+                       }
+               }
+               if ($this->Disabled) {
+                       $this->AllMonthsOfYear->Enabled = false;
+               } elseif ($dv_len == $m_len && $this->ShowOptions) {
+                       // all months
+                       $this->AllMonthsOfYear->Checked = true;
+               }
+       }
+
+       public function setShowOptions($show) {
+               $show = TPropertyValue::ensureBoolean($show);
+               $this->setViewState(self::SHOW_OPTIONS, $show);
+       }
+
+       public function getShowOptions() {
+               return $this->getViewState(self::SHOW_OPTIONS, false);
+       }
+}
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveMonthsOfYear.tpl b/gui/baculum/protected/Web/Portlets/DirectiveMonthsOfYear.tpl
new file mode 100644 (file)
index 0000000..225c04d
--- /dev/null
@@ -0,0 +1,126 @@
+<div class="directive_field w3-row w3-border w3-padding w3-margin-bottom<%=!$this->display_directive ? ' hide' : '';%>">
+       <div class="w3-col w3-left" style="width: 180px; padding: 8px 0;">
+               <com:TActiveLabel
+                       ID="Label"
+                       ActiveControl.EnableUpdate="false"
+                       Visible="<%=$this->display_directive%>"
+                />:
+       </div>
+       <div class="w3-col w3-left directive_value" style="max-width: 1200px">
+               <div class="w3-row<%=$this->ShowOptions === false? ' w3-hide' : ''%>">
+                       <com:TCheckBox
+                               ID="AllMonthsOfYear"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->AllMonthsOfYear->ClientID%>"><%[ All months ]%></label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="January"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->January->ClientID%>"><%[ January ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                                ID="February"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->February->ClientID%>"><%[ February ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="March"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->March->ClientID%>"><%[ March ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="April"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->April->ClientID%>"><%[ April ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="May"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->May->ClientID%>"><%[ May ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="June"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->June->ClientID%>"><%[ June ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="July"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->July->ClientID%>"><%[ July ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="August"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->August->ClientID%>"><%[ August ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="September"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->September->ClientID%>"><%[ September ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="October"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->October->ClientID%>"><%[ October ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="November"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->November->ClientID%>"><%[ November ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="December"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block dow"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->December->ClientID%>"><%[ December ]%></label> &nbsp;
+               </div>
+               <script>
+                       var <%=$this->AllMonthsOfYear->ClientID%>_check_all = function(check) {
+                               $('#<%=$this->AllMonthsOfYear->ClientID%>').closest('.directive_value').find('input[type=\'checkbox\'].dow').prop('disabled', check);
+                       }
+                       <%=$this->AllMonthsOfYear->ClientID%>_check_all($('#<%=$this->AllMonthsOfYear->ClientID%>').is(':checked'));
+                       document.getElementById('<%=$this->AllMonthsOfYear->ClientID%>').addEventListener('click', function(e) {
+                               <%=$this->AllMonthsOfYear->ClientID%>_check_all(this.checked);
+                       });
+               </script>
+       </div>
+</div>
index 27e378da1b0554a001d04c948e35d5b6e383ed95..cf0ddec9c2b18cc4d1dc3232893daa1965763d06 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -52,6 +52,7 @@ Prado::using('Application.Web.Portlets.DirectiveMessages');
 class DirectiveRenderer extends TItemDataRenderer {
 
        const DATA = 'Data';
+       const IS_DATA_BOUND = 'IsDataBound';
 
        private $directive_types = array(
                'DirectiveCheckBox',
@@ -88,8 +89,8 @@ class DirectiveRenderer extends TItemDataRenderer {
                        $this->addSection($data['section']);
                }
 
-               $item = $this->createItem($data);
-               $this->addParsedObject($item);
+               $this->createItem($data);
+               $this->setIsDataBound(true);
        }
 
        public function createItem($data) {
@@ -118,6 +119,8 @@ class DirectiveRenderer extends TItemDataRenderer {
                        if ($data['directive_name'] === 'Name') {
                                $control->setDisabled($this->SourceTemplateControl->getDisableRename());
                        }
+                       $this->addParsedObject($control);
+                       $control->createDirective();
                } elseif (in_array($type, $this->directive_list_types)) {
                        $control->setHost($data['host']);
                        $control->setComponentType($data['component_type']);
@@ -132,6 +135,10 @@ class DirectiveRenderer extends TItemDataRenderer {
                        $control->setShow($data['show']);
                        $control->setGroupName($data['group_name']);
                        $control->setResource($data['resource']);
+                       $this->addParsedObject($control);
+                       if (!$this->getIsDataBound()) {
+                               $control->raiseEvent('OnDirectiveListLoad', $this, null);
+                       }
                }
                return $control;
        }
@@ -159,6 +166,14 @@ class DirectiveRenderer extends TItemDataRenderer {
                $this->setViewState(self::DATA, $data);
        }
 
+       public function getIsDataBound() {
+               return $this->getViewState(self::IS_DATA_BOUND);
+       }
+
+       public function setIsDataBound($is_data_bound) {
+               $this->setViewState(self::IS_DATA_BOUND, $is_data_bound);
+       }
+
        private function getField($field_type) {
                return 'Application.Web.Portlets.Directive' . $field_type;
        }
index 5c2713af97917b93c0a5734adfaf860ae83eb4f7..c3bb030156c0b97eac7ddb4f966ae86e6e692c28 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -36,8 +36,8 @@ class DirectiveRunscript extends DirectiveListTemplate {
 
        private $directive_types = array(
                'DirectiveCheckBox',
-               'DirectiveTextBox',
-               'DirectiveComboBox'
+               'DirectiveComboBox',
+               'DirectiveTextBox'
        );
 
        public function loadConfig() {
@@ -133,6 +133,7 @@ class DirectiveRunscript extends DirectiveListTemplate {
                for ($i = 0; $i < count($this->directive_types); $i++) {
                        $controls = $this->RepeaterRunscriptOptions->findControlsByType($this->directive_types[$i]);
                        for ($j = 0; $j < count($controls); $j++) {
+                               $controls[$j]->setValue();
                                $directive_name = $controls[$j]->getDirectiveName();
                                $directive_value = $controls[$j]->getDirectiveValue();
                                $default_value = null;
@@ -180,7 +181,7 @@ class DirectiveRunscript extends DirectiveListTemplate {
        }
 
        public function newRunscriptDirective() {
-               $data = $this->getDirectiveValue(true);
+               $data = $this->getDirectiveValue();
                if (is_array($data) && key_exists('Runscript', $data) && is_array($data['Runscript'])) {
                        $data['Runscript'][] = new stdClass;
                } else {
index 0c9b9691ffcae23bfa47fc639626f3111db549bc..0ef3eae5c57e37c0f0cdfe54fcf9c70b5cdf23ec 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
  * Bacula(R) is a registered trademark of Kern Sibbald.
  */
 
+Prado::using('System.Web.UI.ActiveControls.TActiveHiddenField');
+Prado::using('System.Web.UI.ActiveControls.TActiveRadioButton');
 Prado::using('Application.Common.Class.Params');
 Prado::using('Application.Web.Portlets.DirectiveListTemplate');
 Prado::using('Application.Web.Portlets.DirectiveCheckBox');
 Prado::using('Application.Web.Portlets.DirectiveComboBox');
 Prado::using('Application.Web.Portlets.DirectiveTextBox');
 Prado::using('Application.Web.Portlets.DirectiveTimePeriod');
+Prado::using('Application.Web.Portlets.DirectiveTime');
+Prado::using('Application.Web.Portlets.DirectiveDaysOfWeek');
+Prado::using('Application.Web.Portlets.DirectiveDaysOfMonth');
+Prado::using('Application.Web.Portlets.DirectiveWeeksOfMonth');
+Prado::using('Application.Web.Portlets.DirectiveWeeksOfYear');
 
 /**
  * Schedule directive control.
@@ -36,12 +43,11 @@ Prado::using('Application.Web.Portlets.DirectiveTimePeriod');
  */
 class DirectiveSchedule extends DirectiveListTemplate {
 
-       private $directive_types = array(
-               'DirectiveCheckBox',
-               'DirectiveTextBox',
-               'DirectiveComboBox',
-               'DirectiveTimePeriod'
-       );
+       const SCHEDULE_MODE_HOURLY = 'hourly';
+       const SCHEDULE_MODE_DAILY = 'daily';
+       const SCHEDULE_MODE_WEEKLY = 'weekly';
+       const SCHEDULE_MODE_MONTHLY = 'monthly';
+       const SCHEDULE_MODE_CUSTOM = 'custom';
 
        private $directives_dir = [
                'Pool',
@@ -67,37 +73,33 @@ class DirectiveSchedule extends DirectiveListTemplate {
                'fd' => 'Connect'
        ];
 
-       private $time_values = array(
-               'Minute',
-               'Hour',
-               'Day',
-               'Month',
-               'DayOfWeek',
-               'WeekOfMonth',
-               'WeekOfYear'
-       );
-
-       private $time_directives = array(
-               'Month',
-               'MonthRangeFrom',
-               'MonthRangeTo',
-               'Week',
-               'WeekRangeFrom',
-               'WeekRangeTo',
-               'Day',
-               'DayRangeFrom',
-               'DayRangeTo',
-               'Wday',
-               'WdayRangeFrom',
-               'WdayRangeTo',
-               'TimeHourAt',
-               'TimeMinAt',
-               'TimeMinHourly'
-       );
+       private $time_directives = [
+               'TimeHourly',
+               'TimeDaily',
+               'TimeWeekly',
+               'TimeMonthly',
+               'TimeCustom',
+               'TimeHourlyCustom',
+               'DaysOfWeekWeekly',
+               'DaysOfWeekMonthly',
+               'DaysOfWeekCustom',
+               'DaysOfMonthCustom',
+               'WeeksOfMonthMonthly',
+               'WeeksOfMonthCustom',
+               'WeeksOfYearCustom',
+               'MonthsOfYearCustom'
+       ];
 
        public function loadConfig() {
                $load_values = $this->getLoadValues();
                $directives = $this->getData();
+               if ($load_values) {
+                       /**
+                        * For existing config without any 'Run' defined don't show sample 'Run' in form.
+                        * The sample 'Run' should be displayed only in new schedule form.
+                        */
+                       $directives = array_filter($directives);
+               }
                $host = $this->getHost();
                $component_type = $this->getComponentType();
                $component_name = $this->getComponentName();
@@ -105,7 +107,7 @@ class DirectiveSchedule extends DirectiveListTemplate {
                $resource_name = $this->getResourceName();
                $subdirectives = $this->getSubDirectives();
                $resource_desc = $this->getResourceDesc();
-               $time_directives = $directive_values = array();
+               $time_directives = $directive_values = [];
                foreach ($directives as $index => $directive) {
                        for ($i = 0; $i < count($subdirectives); $i++) {
                                $default_value = null;
@@ -131,11 +133,14 @@ class DirectiveSchedule extends DirectiveListTemplate {
                                        $resource = 'Pool';
                                }
                                $in_config = false;
-                               if ($load_values === true) {
+                               if ($load_values === true && is_object($directive)) {
                                        $in_config = property_exists($directive, $subdirectives[$i]);
                                }
 
-                               $directive_value = $in_config ? $directive->{$subdirectives[$i]} : null;
+                               $directive_value =  null;
+                               if (is_object($directive) && property_exists($directive, $subdirectives[$i])) {
+                                       $directive_value = $directive->{$subdirectives[$i]};
+                               }
                                $overwrite_directives[$subdirectives[$i]] = array(
                                        'host' => $host,
                                        'component_type' => $component_type,
@@ -158,7 +163,7 @@ class DirectiveSchedule extends DirectiveListTemplate {
                        }
 
                        for ($i = 0; $i < count($this->time_directives); $i++) {
-                               $time_directives[$this->time_directives[$i]] = array(
+                               $time_directives[$this->time_directives[$i]] = [
                                        'host' => $host,
                                        'component_type' => $component_type,
                                        'component_name' => $component_name,
@@ -169,12 +174,12 @@ class DirectiveSchedule extends DirectiveListTemplate {
                                        'default_value' => 0,
                                        'parent_name' => __CLASS__,
                                        'group_name' => $index
-                               );
+                               ];
                        }
-                       $directive_values[] = array(
+                       $directive_values[] = [
                                'overwrite_directives' => $overwrite_directives,
                                'time_directives' => $time_directives
-                       );
+                       ];
                }
                $this->RepeaterScheduleRuns->DataSource = $directive_values;
                $this->RepeaterScheduleRuns->dataBind();
@@ -235,8 +240,6 @@ class DirectiveSchedule extends DirectiveListTemplate {
                                $control->setShow($data['show']);
                                $control->setResourceNames($data['resource_names']);
                                $control->setParentName($data['parent_name']);
-                               $control->onLoad(null);
-                               $control->createDirective();
                        }
                }
 
@@ -255,152 +258,109 @@ class DirectiveSchedule extends DirectiveListTemplate {
                        }
                }
 
-               $directive = $param->Item->Data['time_directives']['Month']['directive_values'];
-
-               $months = array_keys(Params::$months);
-
-               $param->Item->Month->setData(Params::$months);
-               $param->Item->MonthRangeFrom->setData(Params::$months);
-               $param->Item->MonthRangeTo->setData(Params::$months);
-
-               $month_single = null;
-               $month_range_from = null;
-               $month_range_to = null;
-               $month_count = $load_values ? count($directive->Month) : 0;
-               if ($month_count === 12) {
-                       $param->Item->MonthDisable->Checked = true;
-               } elseif ($month_count == 1) {
-                       $month_single = $months[$directive->Month[0]];
-                       $param->Item->MonthSingle->Checked = true;
-               } elseif ($month_count > 0 && $month_count < 12) {
-                       $month_start = $directive->Month[0];
-                       $month_end = $directive->Month[$month_count-1];
-                       $month_range_from = $months[$month_start];
-                       $month_range_to = $months[$month_end];
-                       $param->Item->MonthRange->Checked = true;
-               }
-               $param->Item->Month->setDirectiveValue($month_single);
-               $param->Item->MonthRangeFrom->setDirectiveValue($month_range_from);
-               $param->Item->MonthRangeTo->setDirectiveValue($month_range_to);
-
-               $days = range(1, 31);
-               $param->Item->Day->setData($days);
-               $param->Item->DayRangeFrom->setData($days);
-               $param->Item->DayRangeTo->setData($days);
-
-               $day_single = null;
-               $day_range_from = null;
-               $day_range_to = null;
-               $day_count = $load_values ? count($directive->Day) : 0;
-               if ($day_count === 31) {
-                       $param->Item->DayDisable->Checked = true;
-               } elseif ($day_count === 1) {
-                       $day_single = $days[$directive->Day[0]];
-                       $param->Item->DaySingle->Checked = true;
-               } elseif ($day_count > 0 && $day_count < 31) {
-                       $day_start = $directive->Day[0];
-                       $day_end = $directive->Day[$day_count-1];
-                       $day_range_from = $days[$day_start];
-                       $day_range_to = $days[$day_end];
-                       $param->Item->DayRange->Checked = true;
-               }
-               $param->Item->Day->setDirectiveValue($day_single);
-               $param->Item->DayRangeFrom->setDirectiveValue($day_range_from);
-               $param->Item->DayRangeTo->setDirectiveValue($day_range_to);
-
-               $weeks = array_keys(Params::$weeks);
-
-               $param->Item->Week->setData(Params::$weeks);
-               $param->Item->WeekRangeFrom->setData(Params::$weeks);
-               $param->Item->WeekRangeTo->setData(Params::$weeks);
-               $week_single = null;
-               $week_range_from = null;
-               $week_range_to = null;
-               $week_count = $load_values ? count($directive->WeekOfMonth) : 0;
-               if ($week_count == 6) {
-                       $param->Item->WeekDisable->Checked = true;
-               } elseif ($week_count == 1) {
-                       $week_single = $weeks[$directive->WeekOfMonth[0]];
-                       $param->Item->WeekSingle->Checked = true;
-               } elseif ($week_count > 0 && $week_count < 6) {
-                       $week_start = $directive->WeekOfMonth[0];
-                       $week_end = $directive->WeekOfMonth[$week_count-1];
-                       $week_range_from = $weeks[$week_start];
-                       $week_range_to = $weeks[$week_end];
-                       $param->Item->WeekRange->Checked = true;
-               }
-               $param->Item->Week->setDirectiveValue($week_single);
-               $param->Item->WeekRangeFrom->setDirectiveValue($week_range_from);
-               $param->Item->WeekRangeTo->setDirectiveValue($week_range_to);
-
-               $wdays = array_keys(Params::$wdays);
-               $param->Item->Wday->setData(Params::$wdays);
-               $param->Item->WdayRangeFrom->setData(Params::$wdays);
-               $param->Item->WdayRangeTo->setData(Params::$wdays);
-
-               $wday_single = null;
-               $wday_range_from = null;
-               $wday_range_to = null;
-               $wday_count = $load_values ? count($directive->DayOfWeek) : 0;
-               if ($wday_count === 7) {
-                       $wday_single = '';
-               } elseif ($wday_count === 1) {
-                       $wday_single = $wdays[$directive->DayOfWeek[0]];
-                       $param->Item->WdaySingle->Checked = true;
-               } elseif ($wday_count > 0 && $wday_count < 7) {
-                       $wday_start = $directive->DayOfWeek[0];
-                       $wday_end = $directive->DayOfWeek[$wday_count-1];
-                       $wday_range_from = $wdays[$wday_start];
-                       $wday_range_to = $wdays[$wday_end];
-                       $param->Item->WdayRange->Checked = true;
-               }
-               $param->Item->Wday->setDirectiveValue($wday_single);
-               $param->Item->WdayRangeFrom->setDirectiveValue($wday_range_from);
-               $param->Item->WdayRangeTo->setDirectiveValue($wday_range_to);
+               $directive = $param->Item->Data['time_directives']['TimeHourly']['directive_values'];
 
+               // Hour and minute
                $hour = null;
                $minute = null;
-               if ($load_values) {
-                       $hour = $directive->Hour[0]; // @TODO: Check for many hour values;
+               $is_hourly = false;
+               if (is_object($directive)) {
+                       if (count($directive->Hour) == 24) {
+                               $is_hourly = true;
+                       }
+                       $hour = $directive->Hour[0];
                        /**
                         * Check if Minute property exists because of bug about missing Minute
                         * @see http://bugs.bacula.org/view.php?id=2318
                         */
                        $minute = property_exists($directive, 'Minute') ? $directive->Minute : 0;
                }
-               $param->Item->TimeHourAt->setDirectiveValue(0);
-               $param->Item->TimeMinAt->setDirectiveValue(0);
-               $param->Item->TimeMinHourly->setDirectiveValue(0);
-               if ($load_values) {
-                       if (count($directive->Hour) == 24) {
-                               if ($minute === 0) {
-                                       $param->Item->TimeDisable->Checked = true;
-                               } else {
-                                       $param->Item->TimeHourly->Checked = true;
-                                       $param->Item->TimeMinHourly->setDirectiveValue($minute);
-                               }
-                       } elseif (count($directive->Hour) == 1) {
-                               $param->Item->TimeAt->Checked = true;
-                               $param->Item->TimeHourAt->setDirectiveValue($hour);
-                               $param->Item->TimeMinAt->setDirectiveValue($minute);
-                       } else {
-                               $param->Item->TimeDisable->Checked = true;
-                       }
+
+               if ($is_hourly && is_integer($minute) && $minute > 0) {
+                       $param->Item->TimeHourlyCustomOption->Checked = true;
+                       $hour = null;
+               } elseif (!$is_hourly && is_integer($hour) && is_integer($minute)) {
+                       $param->Item->TimeAtCustomOption->Checked = true;
                } else {
-                       $param->Item->TimeDisable->Checked = true;
+                       $param->Item->TimeEveryHourCustomOption->Checked = true;
+                       $hour = null;
+                       $minute = null;
                }
 
-               // @TODO: Fix controls to avoid forcing onLoad() and createDirective()
-               for ($i = 0; $i < count($this->time_directives); $i++) {
-                       $control = $param->Item->{$this->time_directives[$i]};
-                       $control->onLoad(null);
-                       $control->createDirective();
+               $time_value = ['hour' => $hour, 'minute' => $minute];
+               $param->Item->TimeHourly->setDirectiveValue($time_value);
+               $param->Item->TimeDaily->setDirectiveValue($time_value);
+               $param->Item->TimeWeekly->setDirectiveValue($time_value);
+               $param->Item->TimeMonthly->setDirectiveValue($time_value);
+               $param->Item->TimeHourlyCustom->setDirectiveValue($time_value);
+               $param->Item->TimeCustom->setDirectiveValue($time_value);
+
+               // Day of the week
+               $all_dows = true;
+               if (is_object($directive)) {
+                       $all_dows = count($directive->DayOfWeek) == 7;
+                       $param->Item->DaysOfWeekWeekly->setDirectiveValue($directive->DayOfWeek);
+                       $param->Item->DaysOfWeekMonthly->setDirectiveValue($directive->DayOfWeek);
+                       $param->Item->DaysOfWeekCustom->setDirectiveValue($directive->DayOfWeek);
+               }
+
+               // Week of the month
+               $all_woms = true;
+               if (is_object($directive)) {
+                       $all_woms = count($directive->WeekOfMonth) == 6;
+                       $param->Item->WeeksOfMonthMonthly->setDirectiveValue($directive->WeekOfMonth);
+                       $param->Item->WeeksOfMonthCustom->setDirectiveValue($directive->WeekOfMonth);
+               }
+
+               // Days of the month
+               $all_doms = true;
+               if (is_object($directive)) {
+                       $all_doms = count($directive->Day) == 31;
+                       $param->Item->DaysOfMonthCustom->setDirectiveValue($directive->Day);
+               }
+
+               // Months of the year
+               $all_moys = true;
+               if (is_object($directive)) {
+                       $all_moys = count($directive->Month) == 12;
+                       $param->Item->MonthsOfYearCustom->setDirectiveValue($directive->Month);
+               }
+
+               // Weeks of the month
+               $all_woys = true;
+               if (is_object($directive)) {
+                       $all_woys = count($directive->WeekOfYear) == 54;
+                       $param->Item->WeeksOfYearCustom->setDirectiveValue($directive->WeekOfYear);
+               }
+
+
+               if (is_object($directive)) {
+                       $custom = $all_doms && $all_moys && $all_woys;
+                       if ($is_hourly && $all_dows && $all_woms && $custom) {
+                               // hourly
+                               $param->Item->ScheduleMode->Value = self::SCHEDULE_MODE_HOURLY;
+                       } elseif (!$is_hourly && is_integer($hour) && is_integer($minute) && $all_dows && $all_woms && $custom) {
+                               // daily
+                               $param->Item->ScheduleMode->Value = self::SCHEDULE_MODE_DAILY;
+                       } elseif (!$is_hourly && is_integer($hour) && is_integer($minute) && !$all_dows && $all_woms && $custom) {
+                               // weekly
+                               $param->Item->ScheduleMode->Value = self::SCHEDULE_MODE_WEEKLY;
+                       } elseif (!$is_hourly && is_integer($hour) && is_integer($minute) && !$all_dows && !$all_woms && $custom) {
+                               // monthly
+                               $param->Item->ScheduleMode->Value = self::SCHEDULE_MODE_MONTHLY;
+                       } else {
+                               // custom
+                               $param->Item->ScheduleMode->Value = self::SCHEDULE_MODE_CUSTOM;
+                       }
+               } else {
+                       // daily - default for new schedule
+                       $param->Item->ScheduleMode->Value = self::SCHEDULE_MODE_DAILY;
                }
        }
 
        public function removeSchedule($sender, $param) {
                if ($param instanceof Prado\Web\UI\TCommandEventParameter) {
-                       $idx = $param->getCommandName();
+                       $idx = (integer)$param->getCommandName();
                        $data = $this->getDirectiveValue(true);
                        array_splice($data, $idx, 1);
                        $this->setData($data);
@@ -408,6 +368,69 @@ class DirectiveSchedule extends DirectiveListTemplate {
                }
        }
 
+       private function setTime($directive, &$obj, &$directive_values) {
+               $t = $directive->getDirectiveValue();
+               $obj->Hour = [$t['hour']];
+               $obj->Minute = $t['minute'];
+               $min = sprintf('%02d', $t['minute']);
+               $directive_values[] = "at {$t['hour']}:{$min}";
+       }
+
+       private function setTimeHourly($t, &$obj, &$directive_values) {
+               $obj->Hour = range(0, 23);
+               $obj->Minute = $t['minute'];
+               if ($t['minute'] > 0) {
+                       $min = sprintf('%02d', $t['minute']);
+                       $directive_values[] = "hourly at 0:{$min}";
+               } else {
+                       $directive_values[] = 'hourly';
+               }
+       }
+
+       private function setDaysOfWeek($directive, &$obj, &$directive_values) {
+               $wdays = array_keys(Params::$wdays);
+               $dows = $directive->getDirectiveValue();
+               $dows_len = count($dows);
+               if ($dows_len == 0) {
+                       $obj->DayOfWeek = range(0, 6);
+               } else {
+                       $obj->DayOfWeek = $dows;
+                       $directive_values[] = Params::getDaysOfWeekConfig($dows);
+               }
+       }
+
+       private function setWeeksOfYear($directive, &$obj, &$directive_values) {
+               $woys = $directive->getDirectiveValue();
+               $obj->WeekOfYear = $woys;
+               $directive_values[] = Params::getWeeksOfYearConfig($woys);
+       }
+
+       private function setWeeksOfMonth($directive, &$obj, &$directive_values) {
+               $woms = $directive->getDirectiveValue();
+               $woms_len = count($woms);
+               if ($woms_len == 0) {
+                       // all weeks
+                       $obj->WeekOfMonth = range(0, 5);
+               } else {
+                       // selected weeks
+                       $obj->WeekOfMonth = $woms;
+                       $directive_values[] = Params::getWeeksOfMonthConfig($woms);
+               }
+       }
+
+       private function setMonthsOfYear($directive, &$obj, &$directive_values) {
+               $moys = $directive->getDirectiveValue();
+               $obj->Month = $moys;
+               $directive_values[] = Params::getMonthsOfYearConfig($moys);
+       }
+
+       private function setDaysOfMonth($directive, &$obj, &$directive_values) {
+               $doms = $directive->getDirectiveValue();
+               $doms_len = count($doms);
+               $obj->Day = $doms;
+               $directive_values[] = Params::getDaysOfMonthConfig($doms);
+       }
+
        public function getDirectiveValue($ret_obj = false) {
                $directive_values = [];
                $component_type = $this->getComponentType();
@@ -423,6 +446,7 @@ class DirectiveSchedule extends DirectiveListTemplate {
                        $obj = new StdClass;
                        for ($i = 0; $i < count($subdirectives); $i++) {
                                $control = $value->{$subdirectives[$i]};
+                               $control->setValue();
                                $subdirective_name = $control->getDirectiveName();
                                $subdirective_value = $control->getDirectiveValue();
                                $default_value = $control->getDefaultValue();
@@ -432,6 +456,9 @@ class DirectiveSchedule extends DirectiveListTemplate {
                                if (get_class($control) === 'DirectiveCheckBox') {
                                        settype($default_value, 'bool');
                                }
+                               if (get_class($control) === 'DirectiveTextBox') {
+                                       settype($default_value, 'string');
+                               }
 
                                if ($subdirective_value === $default_value) {
                                        // value the same as default value, skip it
@@ -443,86 +470,98 @@ class DirectiveSchedule extends DirectiveListTemplate {
                                }
                                $directive_values[] = "{$subdirective_name}=\"{$subdirective_value}\"";
                        }
-
-                       $obj->Month = range(0, 11);
-                       $months = array_keys(Params::$months);
-                       if ($value->MonthSingle->Checked === true) {
-                               $month_val = $value->Month->getDirectiveValue();
-                               $directive_values[] = $month_val;
-                               $obj->Month = array(array_search($month_val, $months));
-                       } elseif ($value->MonthRange->Checked === true) {
-                               $from = $value->MonthRangeFrom->getDirectiveValue();
-                               $to = $value->MonthRangeTo->getDirectiveValue();
-                               $directive_values[] = "{$from}-{$to}";
-                               $f = array_search($from, $months);
-                               $t = array_search($to, $months);
-                               $obj->Month = range($f, $t);
+                       for ($i = 0; $i < count($this->time_directives); $i++) {
+                               $value->{$this->time_directives[$i]}->setValue();
                        }
 
-                       $obj->WeekOfMonth = range(0, 5);
-                       $weeks = array_keys(Params::$weeks);
-                       if ($value->WeekSingle->Checked === true) {
-                               $week_val = $value->Week->getDirectiveValue();
-                               $directive_values[] = $week_val;
-                               $obj->WeekOfMonth = array(array_search($week_val, $weeks));
-                       } elseif ($value->WeekRange->Checked === true) {
-                               $from = $value->WeekRangeFrom->getDirectiveValue();
-                               $to = $value->WeekRangeTo->getDirectiveValue();
-                               $directive_values[] = "{$from}-{$to}";
-                               $f = array_search($from, $weeks);
-                               $t = array_search($to, $weeks);
-                               $obj->WeekOfMonth = range($f, $t);
-                       }
+                       switch ($value->ScheduleMode->Value) {
+                               case self::SCHEDULE_MODE_HOURLY: {
+                                       // time (hourly)
+                                       $t = $value->TimeHourly->getDirectiveValue();
+                                       $this->setTimeHourly($t, $obj, $directive_values);
+                                       break;
+                               }
+                               case self::SCHEDULE_MODE_DAILY: {
+                                       // time (HH:MM)
+                                       $this->setTime($value->TimeDaily, $obj, $directive_values);
+                                       break;
+                               }
+                               case self::SCHEDULE_MODE_WEEKLY: {
+                                       // set days of the week
+                                       $this->setDaysOfWeek($value->DaysOfWeekWeekly, $obj, $directive_values);
 
-                       $obj->Day = range(0, 30);
-                       if ($value->DaySingle->Checked === true) {
-                               $day = $value->Day->getDirectiveValue();
-                               $directive_values[] = $day;
-                               $obj->Day = array($day-1);
-                       } elseif ($value->DayRange->Checked === true) {
-                               $from = $value->DayRangeFrom->getDirectiveValue()-1;
-                               $to = $value->DayRangeTo->getDirectiveValue()-1;
-                               $day_range = range($from, $to);
-                               $directive_values[] = Params::getDaysConfig($day_range);
-                               $obj->Day = $day_range;
-                       }
+                                       // time (HH:MM)
+                                       $this->setTime($value->TimeWeekly, $obj, $directive_values);
+                                       break;
+                               }
+                               case self::SCHEDULE_MODE_MONTHLY: {
+                                       // weeks of the month
+                                       $this->setWeeksOfMonth($value->WeeksOfMonthMonthly, $obj, $directive_values);
 
-                       $obj->DayOfWeek = range(0, 6);
-                       $wdays = array_keys(Params::$wdays);
-                       if ($value->WdaySingle->Checked === true) {
-                               $directive_values[] = $value->Wday->getDirectiveValue();
-                               $obj->DayOfWeek = array(array_search($value->Wday->getDirectiveValue(), $wdays));
-                       } elseif ($value->WdayRange->Checked === true) {
-                               $from = $value->WdayRangeFrom->getDirectiveValue();
-                               $to = $value->WdayRangeTo->getDirectiveValue();
-                               $directive_values[] = "{$from}-{$to}";
-                               $f = array_search($from, $wdays);
-                               $t = array_search($to, $wdays);
-                               $obj->DayOfWeek = range($f, $t);
-                       }
+                                       // days of the week
+                                       $this->setDaysOfWeek($value->DaysOfWeekMonthly, $obj, $directive_values);
 
-                       $obj->Hour = range(0, 23);
-                       $obj->Minute = 0;
-                       if ($value->TimeAt->Checked === true) {
-                               $hour = $value->TimeHourAt->getDirectiveValue();
-                               $minute = sprintf('%02d', $value->TimeMinAt->getDirectiveValue());
-                               $directive_values[] = "at {$hour}:{$minute}";
-                               $obj->Hour = array($hour);
-                               $obj->Minute = $minute;
-
-                       } elseif ($value->TimeHourly->Checked === true) {
-                               $hour = '00';
-                               $minute = sprintf('%02d', $value->TimeMinHourly->getDirectiveValue());
-                               $directive_values[] = "hourly at {$hour}:{$minute}";
+                                       // time
+                                       $this->setTime($value->TimeMonthly, $obj, $directive_values);
+                                       break;
+                               }
+                               case self::SCHEDULE_MODE_CUSTOM: {
+                                       // months of the year
+                                       $this->setMonthsOfYear($value->MonthsOfYearCustom, $obj, $directive_values);
+
+                                       // weeks of the year
+                                       $this->setWeeksOfYear($value->WeeksOfYearCustom, $obj, $directive_values);
+
+                                       // days of the month
+                                       $this->setDaysOfMonth($value->DaysOfMonthCustom, $obj, $directive_values);
+
+                                       // weeks of the month
+                                       $this->setWeeksOfMonth($value->WeeksOfMonthCustom, $obj, $directive_values);
+
+                                       // days of the week
+                                       $this->setDaysOfWeek($value->DaysOfWeekCustom, $obj, $directive_values);
+
+                                       // time
+                                       if ($value->TimeEveryHourCustomOption->Checked) {
+                                               $t = ['hour' => 0, 'minute' => 0];
+                                               $this->setTimeHourly($t, $obj, $directive_values);
+                                       } elseif ($value->TimeHourlyCustomOption->Checked) {
+                                               $t = $value->TimeHourlyCustom->getDirectiveValue();
+                                               $this->setTimeHourly($t, $obj, $directive_values);
+                                       } elseif ($value->TimeAtCustomOption) {
+                                               $this->setTime($value->TimeCustom, $obj, $directive_values);
+                                       }
+                                       break;
+                               }
+                       }
+                       // add missing default properties
+                       if (!property_exists($obj, 'Hour')) {
                                $obj->Hour = range(0, 23);
-                               $obj->Minute = $value->TimeMinHourly->getDirectiveValue();
-                       } else {
-                               $directive_values[] = 'hourly';
                        }
+
+                       if (!property_exists($obj, 'Minute')) {
+                               $obj->Minute = 0;
+                       }
+                       if (!property_exists($obj, 'DayOfWeek')) {
+                               $obj->DayOfWeek = range(0, 6);
+                       }
+                       if (!property_exists($obj, 'WeekOfYear')) {
+                               $obj->WeekOfYear = range(0, 53);
+                       }
+                       if (!property_exists($obj, 'WeekOfMonth')) {
+                               $obj->WeekOfMonth = range(0, 5);
+                       }
+                       if (!property_exists($obj, 'Month')) {
+                               $obj->Month = range(0, 11);
+                       }
+                       if (!property_exists($obj, 'Day')) {
+                               $obj->Day = range(0, 30);
+                       }
+
+                       $directive_values = array_filter($directive_values);
                        $values[$directive_name][] = implode(' ', $directive_values);
                        $objs[] = $obj;
-                       $directive_values = array();
-                       $obj = null;
+                       $directive_values = [];
                }
                return (($ret_obj) ? $objs : $values);
        }
@@ -530,7 +569,7 @@ class DirectiveSchedule extends DirectiveListTemplate {
        public function newScheduleDirective() {
                $data = $this->getDirectiveValue(true);
                $obj = new StdClass;
-               $obj->Hour = range(0, 23);
+               $obj->Hour = [0];
                $obj->Minute = 0;
                $obj->Day = range(0, 30);
                $obj->Month = range(0, 11);
@@ -541,7 +580,7 @@ class DirectiveSchedule extends DirectiveListTemplate {
                if (is_array($data)) {
                        $data[] = $obj;
                } else {
-                       $data = array($obj);
+                       $data = [$obj];
                }
                $this->setData($data);
                $this->SourceTemplateControl->setShowAllDirectives(true);
index a7c3a99b54814cd614cda61ec19d27b340ebcbb1..f6376d37424fe8259985deb7929c4d1597f0d7f4 100644 (file)
                        CssClass="w3-button w3-green w3-right"
                        OnCommand="SourceTemplateControl.removeSchedule"
                        CommandName="<%=$this->ItemIndex%>"
-                       CommandParameter="save"
                >
                        <i class="fa fa-trash-alt"></i> &nbsp;<%[ Remove ]%>
                </com:TActiveLinkButton>
                        <h2 class="schedule_options"><%=$this->SourceTemplateControl->ComponentType == 'dir' ? 'Run' : ($this->SourceTemplateControl->ComponentType == 'fd' ? 'Connect' : '')%> #<%=($this->ItemIndex+1)%></h2>
-                       <com:Application.Web.Portlets.DirectiveComboBox
-                               ID="Level"
-                       />
-                       <com:Application.Web.Portlets.DirectiveComboBox
-                               ID="Pool"
-                       />
-                       <com:Application.Web.Portlets.DirectiveComboBox
-                               ID="Storage"
-                       />
-                       <com:Application.Web.Portlets.DirectiveComboBox
-                               ID="Messages"
-                       />
-                       <com:Application.Web.Portlets.DirectiveComboBox
-                               ID="NextPool"
-                       />
-                       <com:Application.Web.Portlets.DirectiveComboBox
-                               ID="FullPool"
-                       />
-                       <com:Application.Web.Portlets.DirectiveComboBox
-                               ID="DifferentialPool"
-                       />
-                       <com:Application.Web.Portlets.DirectiveComboBox
-                               ID="IncrementalPool"
-                       />
-                       <com:Application.Web.Portlets.DirectiveCheckBox
-                               ID="Accurate"
-                       />
-                       <com:Application.Web.Portlets.DirectiveTextBox
-                               ID="Priority"
-                               CssClass="smallbox"
-                       />
-                       <com:Application.Web.Portlets.DirectiveCheckBox
-                               ID="SpoolData"
-                       />
-                       <com:Application.Web.Portlets.DirectiveTimePeriod
-                               ID="MaxRunSchedTime"
-                       />
-                       <com:Application.Web.Portlets.DirectiveTimePeriod
-                               ID="MaxConnectTime"
-                       />
-               <div class="w3-border w3-padding w3-margin-top w3-margin-bottom">
-                       <h3><%[ Month ]%></h3>
-                       <div style="display: flex; flex-wrap: wrap;">
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="MonthDisable"
-                                               CssClass="w3-radio"
-                                               GroupName="Month"
-                                               Attributes.onchange="$('.month<%=$this->MonthSingle->ClientID%>').hide();"
-                                               Checked="true" />
-                                       <com:TLabel ForControl="MonthDisable" Text="<%[ Run every month ]%>" />
+               <div>
+                       <div class="status_header schedule" onclick="$('#<%=$this->ScheduleMode->ClientID%>').val('hourly'); $(this).parent().find('.status_content').removeClass('w3-show'); $(this).next().addClass('w3-show');">
+                               <div class="w3-container w3-cell w3-mobile" style="flex-basis: 65px">
+                                       <i class="w3-margin-right fas fa-chevron-down"></i>
                                </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="MonthSingle"
-                                               CssClass="w3-radio"
-                                               GroupName="Month"
-                                               Attributes.onchange="$('.month<%=$this->MonthSingle->ClientID%>').hide();$('#month<%=$this->MonthSingle->ClientID%>').show()" />
-                                       <com:TLabel ForControl="MonthSingle" Text="<%[ Run one month a year ]%>" />
-                               </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="MonthRange"
-                                               CssClass="w3-radio"
-                                               GroupName="Month"
-                                               Attributes.onchange="$('.month<%=$this->MonthSingle->ClientID%>').hide();$('#month_range<%=$this->MonthSingle->ClientID%>').show()" />
-                                       <com:TLabel ForControl="MonthRange" Text="<%[ Run from month to month a year (range) ]%>" />
-                               </div>
-                       </div>
-                       <div id="month<%=$this->MonthSingle->ClientID%>" class="w3-margin month<%=$this->MonthSingle->ClientID%>" style="display: <%=$this->MonthSingle->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="Month"
-                                       Label="<%[ Month ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="MonthSingle"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select month in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->MonthSingle->ClientID%>').prop('checked') && ($('#<%=$this->Month->ClientID%>_Directive').val()).trim() === '');
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
-                       </div>
-                       <div id="month_range<%=$this->MonthSingle->ClientID%>" class="w3-margin month<%=$this->MonthSingle->ClientID%>" style="display: <%=$this->MonthRange->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="MonthRangeFrom"
-                                       Label="<%[ From month ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="MonthRangeTo"
-                                       Label="<%[ To month ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="MonthRange"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select month range in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->MonthRange->ClientID%>').prop('checked') && (($('#<%=$this->MonthRangeFrom->ClientID%>_Directive').val()).trim() === '' || ($('#<%=$this->MonthRangeTo->ClientID%>_Directive').val()).trim() === ''));
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
+                               <div class="w3-container w3-cell w3-mobile"><%[ Hourly ]%></div>
+                               <span class="w3-small w3-padding-small"><%[ Run job every hour at the specified minute ]%></span>
                        </div>
-               </div>
-               <div class="w3-border w3-padding w3-margin-top w3-margin-bottom">
-                       <h3><%[ Week ]%></h3>
-                       <div style="display: flex; flex-wrap: wrap;">
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="WeekDisable"
-                                               CssClass="w3-radio"
-                                               GroupName="Week"
-                                               Attributes.onchange="$('.week<%=$this->WeekSingle->ClientID%>').hide();"
-                                               Checked="true" />
-                                       <com:TLabel ForControl="WeekDisable" Text="<%[ Run every week ]%>" />
-                               </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="WeekSingle"
-                                               CssClass="w3-radio"
-                                               GroupName="Week"
-                                               Attributes.onchange="$('.week<%=$this->WeekSingle->ClientID%>').hide();$('#week<%=$this->WeekSingle->ClientID%>').show()" />
-                                       <com:TLabel ForControl="WeekSingle" Text="<%[ Run one week a month ]%>" />
-                               </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="WeekRange"
-                                               CssClass="w3-radio"
-                                               GroupName="Week"
-                                               Attributes.onchange="$('.week<%=$this->WeekSingle->ClientID%>').hide();$('#week_range<%=$this->WeekSingle->ClientID%>').show()" />
-                                       <com:TLabel ForControl="WeekRange" Text="<%[ Run from week to week a month (range) ]%>" />
+                       <div class="w3-border w3-hide w3-animate-right status_content <%=$this->ScheduleMode->Value == DirectiveSchedule::SCHEDULE_MODE_HOURLY ? 'w3-show': ''%>">
+                               <div class="w3-padding">
+                                       <com:Application.Web.Portlets.DirectiveTime
+                                               ID="TimeHourly"
+                                               Label="<%[ Run hourly at minute ]%>"
+                                               InConfig="false"
+                                               ShowHour="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               Show="true"
+                                               CssClass="xtinybox"
+                                       />
                                </div>
                        </div>
-                       <div id="week<%=$this->WeekSingle->ClientID%>" class="w3-margin week<%=$this->WeekSingle->ClientID%>" style="display: <%=$this->WeekSingle->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="Week"
-                                       Label="<%[ Week ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="WeekSingle"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select week in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->WeekSingle->ClientID%>').prop('checked') && ($('#<%=$this->Week->ClientID%>_Directive').val()).trim() === '');
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
-                       </div>
-                       <div id="week_range<%=$this->WeekSingle->ClientID%>" class="w3-margin week<%=$this->WeekSingle->ClientID%>" style="display: <%=$this->WeekRange->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="WeekRangeFrom"
-                                       Label="<%[ From week ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="WeekRangeTo"
-                                       Label="<%[ To week ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="MonthRange"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select week range in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->WeekRange->ClientID%>').prop('checked') && (($('#<%=$this->WeekRangeFrom->ClientID%>_Directive').val()).trim() === '' || ($('#<%=$this->WeekRangeTo->ClientID%>_Directive').val()).trim() === ''));
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
-                       </div>
-               </div>
-               <div class="w3-border w3-padding w3-margin-top w3-margin-bottom">
-                       <h3><%[ Day ]%></h3>
-                       <div style="display: flex; flex-wrap: wrap;">
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="DayDisable"
-                                               CssClass="w3-radio"
-                                               GroupName="Day"
-                                               Attributes.onchange="$('.day<%=$this->DaySingle->ClientID%>').hide();"
-                                               Checked="true" />
-                                       <com:TLabel ForControl="DayDisable" Text="<%[ Run every day ]%>" />
-                               </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="DaySingle"
-                                               CssClass="w3-radio"
-                                               GroupName="Day"
-                                               Attributes.onchange="$('.day<%=$this->DaySingle->ClientID%>').hide();$('#day<%=$this->DaySingle->ClientID%>').show()" />
-                                       <com:TLabel ForControl="DaySingle" Text="<%[ Run one day a month ]%>" />
-                               </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="DayRange"
-                                               CssClass="w3-radio"
-                                               GroupName="Day"
-                                               Attributes.onchange="$('.day<%=$this->DaySingle->ClientID%>').hide();$('#day_range<%=$this->DaySingle->ClientID%>').show()" />
-                                       <com:TLabel ForControl="DayRange" Text="<%[ Run from day to day a month (range) ]%>" />
+                       <div class="status_header schedule" onclick="$('#<%=$this->ScheduleMode->ClientID%>').val('daily'); $(this).parent().find('.status_content').removeClass('w3-show'); $(this).next().addClass('w3-show');">
+                               <div class="w3-container w3-cell w3-mobile" style="flex-basis: 65px">
+                                       <i class="w3-margin-right fas fa-chevron-down"></i>
                                </div>
+                               <div class="w3-container w3-cell w3-mobile"><%[ Daily ]%></div>
+                               <span class="w3-small w3-padding-small"><%[ Run job every day at the specified time ]%></span>
                        </div>
-                       <div id="day<%=$this->DaySingle->ClientID%>" class="w3-margin day<%=$this->DaySingle->ClientID%>" style="display: <%=$this->DaySingle->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="Day"
-                                       Label="<%[ Day ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="DaySingle"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select day in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->DaySingle->ClientID%>').prop('checked') && ($('#<%=$this->Day->ClientID%>_Directive').val()).trim() === '');
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
-                       </div>
-                       <div id="day_range<%=$this->DaySingle->ClientID%>" class="w3-margin day<%=$this->DaySingle->ClientID%>" style="display: <%=$this->DayRange->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="DayRangeFrom"
-                                       Label="<%[ From day ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="DayRangeTo"
-                                       Label="<%[ To day ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="DayRange"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select day range in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->DayRange->ClientID%>').prop('checked') && (($('#<%=$this->DayRangeFrom->ClientID%>_Directive').val()).trim() === '' || ($('#<%=$this->DayRangeTo->ClientID%>_Directive').val()).trim() === ''));
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
-                       </div>
-               </div>
-               <div class="w3-border w3-padding w3-margin-top w3-margin-bottom">
-                       <h3><%[ Day of week ]%></h3>
-                       <div style="display: flex; flex-wrap: wrap;">
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="WdayDisable"
-                                               CssClass="w3-radio"
-                                               GroupName="Wday"
-                                               Attributes.onchange="$('.day<%=$this->WdaySingle->ClientID%>').hide();"
-                                               Checked="true" />
-                                       <com:TLabel ForControl="WdayDisable" Text="<%[ Run every day of week ]%>" />
-                               </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="WdaySingle"
-                                               CssClass="w3-radio"
-                                               GroupName="Wday"
-                                               Attributes.onchange="$('.day<%=$this->WdaySingle->ClientID%>').hide();$('#day<%=$this->WdaySingle->ClientID%>').show()" />
-                                       <com:TLabel ForControl="WdaySingle" Text="<%[ Run one day of week ]%>" />
+                       <div class="w3-border w3-hide w3-animate-right status_content <%=$this->ScheduleMode->Value == DirectiveSchedule::SCHEDULE_MODE_DAILY ? 'w3-show': ''%>">
+                               <div class="w3-padding">
+                                       <com:Application.Web.Portlets.DirectiveTime
+                                               ID="TimeDaily"
+                                               Label="<%[ Run at ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               Show="true"
+                                               CssClass="xtinybox"
+                                       />
                                </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="WdayRange"
-                                               CssClass="w3-radio"
-                                               GroupName="Wday"
-                                               Attributes.onchange="$('.day<%=$this->WdaySingle->ClientID%>').hide();$('#day_range<%=$this->WdaySingle->ClientID%>').show()" />
-                                       <com:TLabel ForControl="WdayRange" Text="<%[ Run from day of week to day of week (range) ]%>" />
-                               </div>
-                       </div>
-                       <div id="day<%=$this->WdaySingle->ClientID%>" class="w3-margin day<%=$this->WdaySingle->ClientID%>" style="display: <%=$this->WdaySingle->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="Wday"
-                                       Label="<%[ Day of week ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="WdaySingle"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select day of week in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->WdaySingle->ClientID%>').prop('checked') && ($('#<%=$this->Wday->ClientID%>_Directive').val()).trim() === '');
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
                        </div>
-                       <div id="day_range<%=$this->WdaySingle->ClientID%>" class="w3-margin day<%=$this->WdaySingle->ClientID%>" style="display: <%=$this->WdayRange->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="WdayRangeFrom"
-                                       Label="<%[ From day of week ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:Application.Web.Portlets.DirectiveComboBox
-                                       ID="WdayRangeTo"
-                                       Label="<%[ To day of week ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="WdayRange"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select day of week range in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->WdayRange->ClientID%>').prop('checked') && (($('#<%=$this->WdayRangeFrom->ClientID%>_Directive').val()).trim() === '' || ($('#<%=$this->WdayRangeTo->ClientID%>_Directive').val()).trim() === ''));
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
+                       <div class="status_header schedule" onclick="$('#<%=$this->ScheduleMode->ClientID%>').val('weekly'); $(this).parent().find('.status_content').removeClass('w3-show'); $(this).next().addClass('w3-show');">
+                               <div class="w3-container w3-cell w3-mobile" style="flex-basis: 65px">
+                                       <i class="w3-margin-right fas fa-chevron-down"></i>
+                               </div>
+                               <div class="w3-container w3-cell w3-mobile"><%[ Weekly ]%></div>
+                               <span class="w3-small w3-padding-small"><%[ Run job every week at the specified time on selected days of the week ]%></span>
                        </div>
-               </div>
-               <div class="w3-border w3-padding w3-margin-top w3-margin-bottom">
-                       <h3><%[ Hour and minute ]%></h3>
-                       <div style="display: flex; flex-wrap: wrap;">
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="TimeDisable"
-                                               CssClass="w3-radio"
-                                               GroupName="Time"
-                                               Attributes.onchange="$('.day<%=$this->TimeAt->ClientID%>').hide();" />
-                                       <com:TLabel ForControl="TimeDisable" Text="<%[ Run every full hour ]%>" />
+                       <div class="w3-border w3-hide w3-animate-right status_content <%=$this->ScheduleMode->Value == DirectiveSchedule::SCHEDULE_MODE_WEEKLY ? 'w3-show': ''%>">
+                               <div class="w3-padding">
+                                       <com:Application.Web.Portlets.DirectiveTime
+                                               ID="TimeWeekly"
+                                               Label="<%[ Run at ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               Show="true"
+                                               CssClass="xtinybox"
+                                       />
+                                       <com:Application.Web.Portlets.DirectiveDaysOfWeek
+                                               ID="DaysOfWeekWeekly"
+                                               Label="<%[ Days of the week ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               Show="true"
+                                       />
                                </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="TimeAt"
-                                               CssClass="w3-radio"
-                                               GroupName="Time"
-                                               Attributes.onchange="$('.day<%=$this->TimeAt->ClientID%>').hide();$('#day<%=$this->TimeAt->ClientID%>').show()" />
-                                       <com:TLabel ForControl="TimeAt" Text="<%[ Run at hour and minute ]%>" />
+                       </div>
+                       <div class="status_header schedule" onclick="$('#<%=$this->ScheduleMode->ClientID%>').val('monthly'); $(this).parent().find('.status_content').removeClass('w3-show'); $(this).next().addClass('w3-show');">
+                               <div class="w3-container w3-cell w3-mobile" style="flex-basis: 65px">
+                                       <i class="w3-margin-right fas fa-chevron-down"></i>
                                </div>
-                               <div class="option_cell">
-                                       <com:TRadioButton
-                                               ID="TimeHourly"
-                                               CssClass="w3-radio"
-                                               GroupName="Time"
-                                               Attributes.onchange="$('.day<%=$this->TimeAt->ClientID%>').hide();$('#day_range<%=$this->TimeAt->ClientID%>').show()" />
-                                       <com:TLabel ForControl="TimeHourly" Text="<%[ Run hourly at minute ]%>" />
+                               <div class="w3-container w3-cell w3-mobile"><%[ Monthly ]%></div>
+                               <span class="w3-small w3-padding-small"><%[ Run job every month at the specified time in selected weeks of the month ]%></span>
+                       </div>
+                       <div class="w3-border w3-hide w3-animate-right status_content <%=$this->ScheduleMode->Value == DirectiveSchedule::SCHEDULE_MODE_MONTHLY ? 'w3-show': ''%>">
+                               <div class="w3-padding">
+                                       <com:Application.Web.Portlets.DirectiveTime
+                                               ID="TimeMonthly"
+                                               Label="<%[ Run at ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               Show="true"
+                                               CssClass="xtinybox"
+                                       />
+                                       <com:Application.Web.Portlets.DirectiveWeeksOfMonth
+                                               ID="WeeksOfMonthMonthly"
+                                               Label="<%[ Weeks of the month ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               Show="true"
+                                       />
+                                       <com:Application.Web.Portlets.DirectiveDaysOfWeek
+                                               ID="DaysOfWeekMonthly"
+                                               Label="<%[ Days of the week ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               Show="true"
+                                       />
                                </div>
                        </div>
-                       <div id="day<%=$this->TimeAt->ClientID%>" class="w3-margin day<%=$this->TimeAt->ClientID%>" style="display: <%=$this->TimeAt->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveTextBox
-                                       ID="TimeHourAt"
-                                       Label="<%[ Hour ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:Application.Web.Portlets.DirectiveTextBox
-                                       ID="TimeMinAt"
-                                       Label="<%[ Minute ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="TimeAt"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select hour and minute in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->TimeAt->ClientID%>').prop('checked') && (($('#<%=$this->TimeHourAt->ClientID%>_Directive').val()).trim() === '' || ($('#<%=$this->TimeMinAt->ClientID%>_Directive').val()).trim() === ''));
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
+                       <div class="status_header schedule" onclick="$('#<%=$this->ScheduleMode->ClientID%>').val('custom'); $('.status_content').removeClass('w3-show'); $(this).next().addClass('w3-show');">
+                               <div class="w3-container w3-cell w3-mobile" style="flex-basis: 65px">
+                                       <i class="w3-margin-right fas fa-chevron-down"></i>
+                               </div>
+                               <div class="w3-container w3-cell w3-mobile"><%[ Custom ]%></div>
+                               <span class="w3-small w3-padding-small"><%[ Setup your custom schedule ]%></span>
                        </div>
-                       <div id="day_range<%=$this->TimeAt->ClientID%>" class="w3-margin day<%=$this->TimeAt->ClientID%>" style="display: <%=$this->TimeHourly->Checked ? 'block' : 'none'%>">
-                               <com:Application.Web.Portlets.DirectiveTextBox
-                                       ID="TimeMinHourly"
-                                       Label="<%[ Minute ]%>"
-                                       InConfig="true"
-                                       Show="true"
-                                       CssClass="smallbox"
-                               />
-                               <com:TCustomValidator
-                                       ValidationGroup="Directive"
-                                       ControlToValidate="TimeHourly"
-                                       Display="None"
-                                       ClientValidationFunction="schedule_required_fields_validator"
-                                       ErrorMessage="<%=Prado::localize('Please select hour in Run block')%> #<%=($this->ItemIndex+1)%>.">
-                                       <prop:ClientSide.OnValidate>
-                                               sender.enabled = ($('#<%=$this->TimeHourly->ClientID%>').prop('checked') && ($('#<%=$this->TimeMinHourly->ClientID%>_Directive').val()).trim() === '');
-                                       </prop:ClientSide.OnValidate>
-                               </com:TCustomValidator>
+                       <div class="w3-border w3-hide w3-animate-right status_content <%=$this->ScheduleMode->Value == DirectiveSchedule::SCHEDULE_MODE_CUSTOM ? 'w3-show': ''%>">
+                               <div class="w3-padding">
+                                       <div class="w3-padding w3-margin-bottom">
+                                               <com:TActiveRadioButton
+                                                       ID="TimeEveryHourCustomOption"
+                                                       CssClass="w3-check"
+                                                       AutoPostBack="false"
+                                                       GroupName="TimeCustomOptions"
+                                               /> <label for="<%=$this->TimeEveryHourCustomOption->ClientID%>"><%[ Run every full hour ]%></label> &nbsp;
+                                               <com:TActiveRadioButton
+                                                       ID="TimeHourlyCustomOption"
+                                                       CssClass="w3-check"
+                                                       AutoPostBack="false"
+                                                       GroupName="TimeCustomOptions"
+                                               /> <label for="<%=$this->TimeHourlyCustomOption->ClientID%>"><%[ Run hourly at minute ]%></label> &nbsp;
+                                               <com:TActiveRadioButton
+                                                       ID="TimeAtCustomOption"
+                                                       CssClass="w3-check"
+                                                       AutoPostBack="false"
+                                                       GroupName="TimeCustomOptions"
+                                               /> <label for="<%=$this->TimeAtCustomOption->ClientID%>"><%[ Run at specified HH:MM ]%></label> &nbsp;
+                                               <script>
+                                                       document.getElementById('<%=$this->TimeEveryHourCustomOption->ClientID%>').addEventListener('click', function(e) {
+                                                               $(this).closest('.status_content').find('.custom_hourly, .custom_time').removeClass('w3-show');
+                                                       });
+                                                       document.getElementById('<%=$this->TimeHourlyCustomOption->ClientID%>').addEventListener('click', function(e) {
+                                                               var sc = $(this).closest('.status_content'); sc.find('.custom_hourly').addClass('w3-show'); sc.find('.custom_time').removeClass('w3-show');
+                                                       });
+                                                       document.getElementById('<%=$this->TimeAtCustomOption->ClientID%>').addEventListener('click', function(e) {
+                                                               var sc = $(this).closest('.status_content'); sc.find('.custom_hourly').removeClass('w3-show'); sc.find('.custom_time').addClass('w3-show');
+                                                       });
+                                               </script>
+                                       </div>
+                                       <div class="w3-hide custom_hourly <%=$this->TimeHourlyCustomOption->Checked ? 'w3-show' : 'w3-hide'%>">
+                                               <com:Application.Web.Portlets.DirectiveTime
+                                                       ID="TimeHourlyCustom"
+                                                       Label="<%[ Run hourly at minute ]%>"
+                                                       InConfig="false"
+                                                       ShowHour="false"
+                                                       ShowRemoveButton="false"
+                                                       ShowResetButton="false"
+                                                       Show="true"
+                                                       CssClass="xtinybox"
+                                               />
+                                       </div>
+                                       <div class="w3-hide custom_time <%=$this->TimeAtCustomOption->Checked ? 'w3-show' : 'w3-hide'%>">
+                                               <com:Application.Web.Portlets.DirectiveTime
+                                                       ID="TimeCustom"
+                                                       Label="<%[ Run at ]%>"
+                                                       InConfig="false"
+                                                       ShowRemoveButton="false"
+                                                       ShowResetButton="false"
+                                                       Show="true"
+                                                       CssClass="xtinybox"
+                                               />
+                                       </div>
+                                       <com:Application.Web.Portlets.DirectiveWeeksOfMonth
+                                               ID="WeeksOfMonthCustom"
+                                               Label="<%[ Weeks of the month ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               ShowOptions="true"
+                                               Show="true"
+                                       />
+                                       <com:Application.Web.Portlets.DirectiveDaysOfWeek
+                                               ID="DaysOfWeekCustom"
+                                               Label="<%[ Days of the week ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               ShowOptions="true"
+                                               Show="true"
+                                       />
+                                       <com:Application.Web.Portlets.DirectiveDaysOfMonth
+                                               ID="DaysOfMonthCustom"
+                                               Label="<%[ Days of the month ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               ShowOptions="true"
+                                               Show="true"
+                                       />
+                                       <com:Application.Web.Portlets.DirectiveMonthsOfYear
+                                               ID="MonthsOfYearCustom"
+                                               Label="<%[ Months of the year ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               ShowOptions="true"
+                                               Show="true"
+                                       />
+                                       <com:Application.Web.Portlets.DirectiveWeeksOfYear
+                                               ID="WeeksOfYearCustom"
+                                               Label="<%[ Weeks of the year ]%>"
+                                               InConfig="false"
+                                               ShowRemoveButton="false"
+                                               ShowResetButton="false"
+                                               ShowOptions="true"
+                                               Show="true"
+                                       />
+                               </div>
                        </div>
                </div>
+               <com:TActiveHiddenField ID="ScheduleMode" Value="daily" />
+               <h3 class="<%=$this->Level->Show || $this->Pool->Show || $this->Storage->Show || $this->Messages->Show || $this->NextPool->Show || $this->FullPool->Show || $this->DifferentialPool->Show || $this->IncrementalPool->Show || $this->Accurate->Show || $this->Priority->Show || $this->SpoolData->Show || $this->MaxRunSchedTime->Show || $this->MaxConnectTime->Show ? 'w3-show' : 'w3-hide'%>"><%[ Override directives ]%></h3>
+               <com:Application.Web.Portlets.DirectiveComboBox
+                       ID="Level"
+               />
+               <com:Application.Web.Portlets.DirectiveComboBox
+                       ID="Pool"
+               />
+               <com:Application.Web.Portlets.DirectiveComboBox
+                       ID="Storage"
+               />
+               <com:Application.Web.Portlets.DirectiveComboBox
+                       ID="Messages"
+               />
+               <com:Application.Web.Portlets.DirectiveComboBox
+                       ID="NextPool"
+               />
+               <com:Application.Web.Portlets.DirectiveComboBox
+                       ID="FullPool"
+               />
+               <com:Application.Web.Portlets.DirectiveComboBox
+                       ID="DifferentialPool"
+               />
+               <com:Application.Web.Portlets.DirectiveComboBox
+                       ID="IncrementalPool"
+               />
+               <com:Application.Web.Portlets.DirectiveCheckBox
+                       ID="Accurate"
+               />
+               <com:Application.Web.Portlets.DirectiveTextBox
+                       ID="Priority"
+                       CssClass="smallbox"
+               />
+               <com:Application.Web.Portlets.DirectiveCheckBox
+                       ID="SpoolData"
+               />
+               <com:Application.Web.Portlets.DirectiveTimePeriod
+                       ID="MaxRunSchedTime"
+               />
+               <com:Application.Web.Portlets.DirectiveTimePeriod
+                       ID="MaxConnectTime"
+               />
        </div>
        </prop:ItemTemplate>
 </com:TActiveRepeater>
index e124204c8466cba11f600a3032d482f375f4cf00..a98cd0429f6e2d62d61fd7564a1058710856fe8e 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -58,6 +58,7 @@ class DirectiveTemplate extends DirectiveControlTemplate implements IDirectiveFi
        const SHOW_REMOVE_BUTTON = 'ShowRemoveButton';
 
        public $display_directive;
+       private $data_changed = false;
 
        private $command_params = array('save', 'add');
 
@@ -75,6 +76,14 @@ class DirectiveTemplate extends DirectiveControlTemplate implements IDirectiveFi
                $this->ensureChildControls();
        }
 
+       public function onLoad($param) {
+               parent::onLoad($param);
+               if ($this->getPage()->IsPostBack && $this->getValue() != $this->getDefaultValue()) {
+                       // It has special meaning for directive controls used in wizards
+                       $this->setValue();
+               }
+       }
+
        public function bubbleEvent($sender, $param) {
                if ($param instanceof TCommandEventParameter) {
                        $this->raiseBubbleEvent($this, $param);
@@ -92,15 +101,20 @@ class DirectiveTemplate extends DirectiveControlTemplate implements IDirectiveFi
        }
 
        public function saveValue($sender, $param) {
-               $command_param = $this->getCmdParam();
-               if ($command_param === 'save' && method_exists($this, 'getValue')) {
+               if ($this->getCmdParam() === 'save') {
+                       $this->setValue();
+               }
+       }
+
+       public function setValue() {
+               if (method_exists($this, 'getValue')) {
                        $new_value = $this->getValue();
                        $this->setDirectiveValue($new_value);
                }
        }
 
-       public function onLoad($param) {
-               parent::onLoad($param);
+       public function onPreRender($param) {
+               parent::onPreRender($param);
                if (!$this->getIsDirectiveCreated()) {
                        $this->createDirective();
                        $this->setIsDirectiveCreated(true);
@@ -168,6 +182,7 @@ class DirectiveTemplate extends DirectiveControlTemplate implements IDirectiveFi
        }
 
        public function getDirectiveValue() {
+               $this->saveValue(null, null);
                return $this->getViewState(self::DIRECTIVE_VALUE);
        }
 
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveTime.php b/gui/baculum/protected/Web/Portlets/DirectiveTime.php
new file mode 100644 (file)
index 0000000..b306b27
--- /dev/null
@@ -0,0 +1,116 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2021 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+use Prado\TPropertyValue;
+
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveDropDownList');
+Prado::using('Application.Web.Portlets.DirectiveTemplate');
+
+/**
+ * Time directive control.
+ *
+ * @author Marcin Haba <marcin.haba@bacula.pl>
+ * @category Control
+ * @package Baculum Web
+ */
+class DirectiveTime extends DirectiveTemplate {
+
+       const SHOW_HOUR = 'ShowHour';
+       const SHOW_MINUTE = 'ShowMinute';
+
+       public function getValue() {
+               $hour = (integer)$this->Hour->getSelectedValue();
+               if (!$this->ShowHour) {
+                       $hour = null;
+               }
+               $minute = (integer)$this->Minute->getSelectedValue();
+               if (!$this->ShowMinute) {
+                       $minute = null;
+               }
+               return $this->getTimeValue($hour, $minute);
+       }
+
+       private function getTimeValue($hour = null, $minute = null) {
+               return ['hour' => $hour, 'minute' => $minute];
+       }
+
+       public function createDirective() {
+               $this->Label->Text = $this->getLabel();
+               $directive_value = $this->getDirectiveValue();
+               $default_value = $this->getDefaultValue();
+               if (!is_array($directive_value)) {
+                       $directive_value = $this->getTimeValue();
+               }
+               if ($this->getInConfig() === false &&  is_null($directive_value['hour']) && is_null($directive_value['minute'])) {
+                       if (is_array($default_value) && !is_null($default_value['hour']) && !is_null($default_value['minute'])) {
+                               $directive_value = $default_value;
+                       } else {
+                               $directive_value = $this->getTimeValue(0, 0);
+                       }
+               }
+               $hours = range(0, 23);
+               $this->Hour->DataSource = array_map(function($h) {
+                       return sprintf('%02d', $h);
+               }, $hours);
+               $this->Hour->setSelectedValue($directive_value['hour']);
+               $this->Hour->dataBind();
+
+               $minutes = range(0, 59);
+               $this->Minute->DataSource = array_map(function($m) {
+                       return sprintf('%02d', $m);
+               }, $minutes);
+               $this->Minute->setSelectedValue($directive_value['minute']);
+               $this->Minute->dataBind();
+               if ($this->getDisabled()) {
+                       $this->Hour->setReadOnly(true);
+                       $this->Minute->setReadOnly(true);
+               }
+               $validate = $this->getRequired();
+               $this->TimeValidator->setVisible($validate);
+               $cssclass = $this->getCssClass();
+               if ($cssclass) {
+                       $hcssclass = $cssclass . ' ' . $this->Hour->getCssClass();
+                       $this->Hour->setCssClass($hcssclass);
+                       $mcssclass = $cssclass . ' ' . $this->Minute->getCssClass();
+                       $this->Minute->setCssClass($mcssclass);
+               }
+       }
+
+       public function getShowHour() {
+               return $this->getViewState(self::SHOW_HOUR, true);
+       }
+
+       public function setShowHour($show) {
+               $show = TPropertyValue::ensureBoolean($show);
+               $this->setViewState(self::SHOW_HOUR, $show);
+       }
+
+       public function getShowMinute() {
+               return $this->getViewState(self::SHOW_MINUTE, true);
+       }
+
+       public function setShowMinute($show) {
+               $show = TPropertyValue::ensureBoolean($show);
+               $this->setViewState(self::SHOW_MINUTE, $show);
+       }
+}
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveTime.tpl b/gui/baculum/protected/Web/Portlets/DirectiveTime.tpl
new file mode 100644 (file)
index 0000000..dab5467
--- /dev/null
@@ -0,0 +1,38 @@
+<div class="directive_field w3-row w3-border w3-padding w3-margin-bottom<%=!$this->display_directive ? ' hide' : '';%>">
+       <div class="w3-col w3-left" style="width: 180px; padding: 8px 0;">
+               <com:TActiveLabel
+                       ID="Label"
+                       ActiveControl.EnableUpdate="false"
+                       Visible="<%=$this->display_directive%>"
+                />:
+       </div>
+       <div class="w3-col w3-left directive_value" style="width: 250px">
+               <com:TActiveDropDownList ID="Hour"
+                       OnSelectedIndexChanged="saveValue"
+                       CssClass="w3-input w3-border w3-show-inline-block"
+                       Visible="<%=($this->display_directive && $this->ShowHour)%>"
+                       ActiveControl.EnableUpdate="false"
+                       AutoPostBack="false"
+               /><span<%=!$this->ShowHour ? ' style="display: none"' : '' %>> : </span>
+               <com:TActiveDropDownList ID="Minute"
+                       OnSelectedIndexChanged="saveValue"
+                       CssClass="w3-input w3-border w3-show-inline-block"
+                       Visible="<%=($this->display_directive && $this->ShowMinute)%>"
+                       ActiveControl.EnableUpdate="false"
+                       AutoPostBack="false"
+               /> <%=$this->getRequired() ? '&nbsp;<i class="fa fa-asterisk w3-text-red" style="line-height: 40px"></i>' : ''%>
+               <i class="fa fa-undo reset_btn<%=!$this->ShowResetButton ? ' hide' : ''%>" onclick="document.getElementById('<%=$this->Hour->ClientID%>').value = '<%=isset($this->DefaultValue->Hour) ? $this->DefaultValue->Hour : ''%>';document.getElementById('<%=$this->Minute->ClientID%>').value = '<%=isset($this->DefaultValue->Minute) ? $this->DefaultValue->Minute : ''%>';" alt="<%[ Reset to default value ]%>" title="<%[ Reset to default value ]%>"></i>
+               <i class="fa fa-trash-alt remove_btn<%=!$this->ShowRemoveButton ? ' hide' : ''%>" onclick="document.getElementById('<%=$this->Hour->ClientID%>').value = '';document.getElementById('<%=$this->Minute->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>"></i>
+               <com:TCustomValidator
+                       ID="TimeValidator"
+                       ValidationGroup="<%=$this->getValidationGroup()%>"
+                       Display="Dynamic"
+                       ControlToValidate="Hour"
+                       ClientValidationFunction="<%=$this->Hour->ClientID%>_validation_func"
+                       FocusOnError="true"
+                       Text="Field required."
+                       Enabled="<%=$this->getRequired() && $this->getShow()%>"
+                       Visible="<%=$this->ShowMinute%>"
+               />
+       </div>
+</div>
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveWeeksOfMonth.php b/gui/baculum/protected/Web/Portlets/DirectiveWeeksOfMonth.php
new file mode 100644 (file)
index 0000000..2a3661c
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2021 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox');
+Prado::using('Application.Common.Class.Params');
+Prado::using('Application.Web.Portlets.DirectiveTemplate');
+
+/**
+ * Weeks of month directive control.
+ *
+ * @author Marcin Haba <marcin.haba@bacula.pl>
+ * @category Control
+ * @package Baculum Web
+ */
+class DirectiveWeeksOfMonth extends DirectiveTemplate {
+
+       const SHOW_OPTIONS = 'ShowOptions';
+
+       public function getValue() {
+               $value = [];
+               $weeks = array_values(Params::$weeks);
+               for ($i = 0; $i < count($weeks); $i++) {
+                       if ($this->{$weeks[$i]}->Checked || $this->AllWeeksOfMonth->Checked) {
+                               $value[] = $i;
+                       }
+               }
+               return $value;
+       }
+
+       public function createDirective() {
+               $this->Label->Text = $this->getLabel();
+               $directive_value = $this->getDirectiveValue();
+               $default_value = $this->getDefaultValue();
+               $weeks = array_values(Params::$weeks);
+               if (!is_array($directive_value)) {
+                       $directive_value = $weeks;
+               }
+
+               $w_len = count($weeks);
+               $dv_len = count($directive_value);
+               if ($this->getInConfig() === false && $dv_len == $w_len) {
+                       if (is_array($default_value) && count($default_value) > 0) {
+                               $directive_value = $default_value;
+                       }
+               }
+
+               for ($i = 0; $i < $w_len; $i++) {
+                       if ($dv_len < $w_len) {
+                               // selected weeks
+                               $this->{$weeks[$i]}->Checked = in_array($i, $directive_value);
+                       }
+                       if ($this->Disabled) {
+                               $this->{$weeks[$i]}->Enabled = false;
+                       }
+                       if ($this->CssClass) {
+                               $cssclass = $this->CssClass . ' ' . $this->{$weeks[$i]}->getCssClass();
+                               $this->{$weeks[$i]}->setCssClass($cssclass);
+                       }
+               }
+               if ($this->Disabled) {
+                       $this->AllWeeksOfMonth->Enabled = false;
+               } elseif ($dv_len == $w_len && $this->ShowOptions) {
+                       // all weeks
+                       $this->AllWeeksOfMonth->Checked = true;
+               }
+       }
+
+       public function setShowOptions($show) {
+               $show = TPropertyValue::ensureBoolean($show);
+               $this->setViewState(self::SHOW_OPTIONS, $show);
+       }
+
+       public function getShowOptions() {
+               return $this->getViewState(self::SHOW_OPTIONS, false);
+       }
+}
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveWeeksOfMonth.tpl b/gui/baculum/protected/Web/Portlets/DirectiveWeeksOfMonth.tpl
new file mode 100644 (file)
index 0000000..32011e5
--- /dev/null
@@ -0,0 +1,78 @@
+<div class="directive_field w3-row w3-border w3-padding w3-margin-bottom<%=!$this->display_directive ? ' hide' : '';%>">
+       <div class="w3-col w3-left" style="width: 180px; padding: 8px 0;">
+               <com:TActiveLabel
+                       ID="Label"
+                       ActiveControl.EnableUpdate="false"
+                       Visible="<%=$this->display_directive%>"
+                />:
+       </div>
+       <div class="w3-col w3-left directive_value" style="max-width: 1000px">
+               <div class="w3-row<%=$this->ShowOptions === false? ' w3-hide' : ''%>">
+                       <com:TCheckBox
+                               ID="AllWeeksOfMonth"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->AllWeeksOfMonth->ClientID%>"><%[ All weeks ]%></label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="first"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block wom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->first->ClientID%>"><%[ first ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="second"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block wom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->second->ClientID%>"><%[ second ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="third"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block wom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->third->ClientID%>"><%[ third ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="fourth"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block wom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->fourth->ClientID%>"><%[ fourth ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="fifth"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block wom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->fifth->ClientID%>"><%[ fifth ]%></label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="sixth"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block wom"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->sixth->ClientID%>"><%[ sixth ]%></label> &nbsp;
+               </div>
+               <script>
+                       var <%=$this->AllWeeksOfMonth->ClientID%>_check_all = function(check) {
+                               $('#<%=$this->AllWeeksOfMonth->ClientID%>').closest('.directive_value').find('input[type=\'checkbox\'].wom').prop('disabled', check);
+                       };
+                       <%=$this->AllWeeksOfMonth->ClientID%>_check_all($('#<%=$this->AllWeeksOfMonth->ClientID%>').is(':checked'));
+                       document.getElementById('<%=$this->AllWeeksOfMonth->ClientID%>').addEventListener('click', function(e) {
+                               <%=$this->AllWeeksOfMonth->ClientID%>_check_all(this.checked);
+                       });
+               </script>
+       </div>
+</div>
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveWeeksOfYear.php b/gui/baculum/protected/Web/Portlets/DirectiveWeeksOfYear.php
new file mode 100644 (file)
index 0000000..febe535
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2021 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
+Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox');
+Prado::using('Application.Common.Class.Params');
+Prado::using('Application.Web.Portlets.DirectiveTemplate');
+
+/**
+ * Weeks of year directive control.
+ *
+ * @author Marcin Haba <marcin.haba@bacula.pl>
+ * @category Control
+ * @package Baculum Web
+ */
+class DirectiveWeeksOfYear extends DirectiveTemplate {
+
+       const SHOW_OPTIONS = 'ShowOptions';
+       const WEEK_CONTROL_PREFIX = 'week';
+
+       public function getValue() {
+               $value = [];
+               $weeks = range(0, 53);
+               for ($i = 0; $i < count($weeks); $i++) {
+                       if ($this->{self::WEEK_CONTROL_PREFIX . $weeks[$i]}->Checked || $this->AllWeeksOfYear->Checked) {
+                               $value[] = $i;
+                       }
+               }
+               if (count($value) == 0) {
+                       $value = $weeks;
+               }
+               return $value;
+       }
+
+       public function createDirective() {
+               $this->Label->Text = $this->getLabel();
+               $directive_value = $this->getDirectiveValue();
+               $default_value = $this->getDefaultValue();
+               $weeks = range(0, 53);
+               if (!is_array($directive_value)) {
+                       $directive_value = $weeks;
+               }
+
+               $w_len = count($weeks);
+               $dv_len = count($directive_value);
+               if ($this->getInConfig() === false && $dv_len == $w_len) {
+                       if (is_array($default_value) && count($default_value) > 0) {
+                               $directive_value = $default_value;
+                       }
+               }
+
+               for ($i = 0; $i < $w_len; $i++) {
+                       $key = self::WEEK_CONTROL_PREFIX . $weeks[$i];
+                       if ($dv_len < $w_len) {
+                               // selected days
+                               $this->{$key}->Checked = in_array($weeks[$i], $directive_value);
+                       }
+                       if ($this->Disabled) {
+                               $this->{$key}->Enabled = false;
+                       }
+                       if ($this->CssClass) {
+                               $cssclass = $this->CssClass . ' ' . $this->{$key}->getCssClass();
+                               $this->{$key}->setCssClass($cssclass);
+                       }
+               }
+               if ($this->Disabled) {
+                       $this->AllWeeksOfYear->Enabled = false;
+               } elseif ($dv_len == $w_len && $this->ShowOptions) {
+                       // all weeks
+                       $this->AllWeeksOfYear->Checked = true;
+               }
+       }
+
+       public function setShowOptions($show) {
+               $show = TPropertyValue::ensureBoolean($show);
+               $this->setViewState(self::SHOW_OPTIONS, $show);
+       }
+
+       public function getShowOptions() {
+               return $this->getViewState(self::SHOW_OPTIONS, false);
+       }
+}
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveWeeksOfYear.tpl b/gui/baculum/protected/Web/Portlets/DirectiveWeeksOfYear.tpl
new file mode 100644 (file)
index 0000000..88a93e8
--- /dev/null
@@ -0,0 +1,476 @@
+<div class="directive_field w3-row w3-border w3-padding w3-margin-bottom<%=!$this->display_directive ? ' hide' : '';%>">
+       <div class="w3-col w3-left" style="width: 180px; padding: 8px 0;">
+               <com:TActiveLabel
+                       ID="Label"
+                       ActiveControl.EnableUpdate="false"
+                       Visible="<%=$this->display_directive%>"
+                />:
+       </div>
+       <div class="w3-col w3-left directive_value" style="max-width: 1000px">
+               <div class="w3-row<%=$this->ShowOptions === false? ' w3-hide' : ''%>">
+                       <com:TCheckBox
+                               ID="AllWeeksOfYear"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check"
+                               AutoPostBack="false"
+                       /> <label for="<%=$this->AllWeeksOfYear->ClientID%>"><%[ All weeks ]%></label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="week0"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week0->ClientID%>">0</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week1"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week1->ClientID%>">1</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week2"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week2->ClientID%>">2</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week3"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week3->ClientID%>">3</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week4"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week4->ClientID%>">4</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week5"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week5->ClientID%>">5</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week6"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week6->ClientID%>">6</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="week7"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week7->ClientID%>">7</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week8"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week8->ClientID%>">8</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week9"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week9->ClientID%>">9</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week10"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week10->ClientID%>">10</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week11"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week11->ClientID%>">11</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week12"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week12->ClientID%>">12</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week13"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week13->ClientID%>">13</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="week14"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week14->ClientID%>">14</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week15"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week15->ClientID%>">15</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week16"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week16->ClientID%>">16</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week17"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week17->ClientID%>">17</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week18"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week18->ClientID%>">18</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week19"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week19->ClientID%>">19</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week20"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week20->ClientID%>">20</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="week21"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week21->ClientID%>">21</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week22"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week22->ClientID%>">22</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week23"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week23->ClientID%>">23</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week24"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week24->ClientID%>">24</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week25"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week25->ClientID%>">25</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week26"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week26->ClientID%>">26</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week27"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week27->ClientID%>">27</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="week28"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week28->ClientID%>">28</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week29"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week29->ClientID%>">29</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week30"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week30->ClientID%>">30</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week31"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week31->ClientID%>">31</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week32"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week32->ClientID%>">32</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week33"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week33->ClientID%>">33</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week34"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week34->ClientID%>">34</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="week35"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week35->ClientID%>">35</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week36"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week36->ClientID%>">36</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week37"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week37->ClientID%>">37</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week38"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week38->ClientID%>">38</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week39"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week39->ClientID%>">39</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week40"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week40->ClientID%>">40</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week41"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week41->ClientID%>">41</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="week42"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week42->ClientID%>">42</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week43"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week43->ClientID%>">43</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week44"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week44->ClientID%>">44</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week45"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week45->ClientID%>">45</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week46"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week46->ClientID%>">46</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week47"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week47->ClientID%>">47</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week48"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week48->ClientID%>">48</label> &nbsp;
+               </div>
+               <div class="w3-row">
+                       <com:TActiveCheckBox
+                               ID="week49"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week49->ClientID%>">49</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week50"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week50->ClientID%>">50</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week51"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week51->ClientID%>">51</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week52"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week52->ClientID%>">52</label> &nbsp;
+                       <com:TActiveCheckBox
+                               ID="week53"
+                               OnCheckedChanged="saveValue"
+                               CssClass="w3-check w3-border w3-show-inline-block woy"
+                               Visible="<%=$this->display_directive%>"
+                               ActiveControl.EnableUpdate="false"
+                               AutoPostBack="false"
+                       /> <label class="w3-show-inline-block week_of_year" for="<%=$this->week53->ClientID%>">53</label> &nbsp;
+               </div>
+               <script>
+                       var <%=$this->AllWeeksOfYear->ClientID%>_check_all = function(check) {
+                               $('#<%=$this->AllWeeksOfYear->ClientID%>').closest('.directive_value').find('input[type=\'checkbox\'].woy').prop('disabled', check);
+                       }
+                       <%=$this->AllWeeksOfYear->ClientID%>_check_all($('#<%=$this->AllWeeksOfYear->ClientID%>').is(':checked'));
+                       document.getElementById('<%=$this->AllWeeksOfYear->ClientID%>').addEventListener('click', function(e) {
+                               <%=$this->AllWeeksOfYear->ClientID%>_check_all(this.checked);
+                       });
+               </script>
+       </div>
+</div>
index 183bcf8d473f9c52adade07fe72c3d3f208d566b..b20d3379da2e6919e08bff850095dbe138119cc6 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -44,7 +44,6 @@ class JobRunscriptRenderer extends DirectiveRenderer {
                        $alb->CssClass = 'w3-button w3-green w3-right';
                        $alb->OnCommand = 'SourceTemplateControl.removeRunscript';
                        $alb->CommandName = $this->ItemIndex / self::DIRECTIVE_COUNT;
-                       $alb->CommandParameter = 'save';
                        $alb->Text = '<i class="fa fa-trash-alt"></i> &nbsp;' . Prado::localize('Remove');
                        $this->addParsedObject($alb);
                }
index 017b652415a011e300b0c352a5f79e3254834b0f..7b16d140148cca32b67bb5a712f6eb745d00d369 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2019 Kern Sibbald
+ * Copyright (C) 2013-2021 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -43,6 +43,7 @@ class MessageTypes extends DirectiveListTemplate {
                $is_all = false;
                $types = array();
                for ($i = 0; $i < count($type_controls); $i++) {
+                       $type_controls[$i]->setValue();
                        $directive_name = $type_controls[$i]->getDirectiveName();
                        $directive_value = $type_controls[$i]->getDirectiveValue();
                        if (is_null($directive_value) || $directive_value === false) {
index b6ec8b2b8061c986551b0d36c6cd4509a6b1599a..68e15fb7448397abf243283bc6994c7405f6197c 100644 (file)
@@ -4,7 +4,6 @@
                <li><com:TActiveLinkButton
                        ID="ExcludeFileItem"
                        OnCommand="Parent.SourceTemplateControl.newExcludeFile"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ExcludeFileItem->ClientID%>').parents('div').find('div.exclude_file');  BaculaConfig.scroll_to_element(el[el.length-1], -80); $(el[el.length-1]).find('input')[0].focus();"
                        Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
                        >
index 6a04f18428885b01b2f915a6aceb1eca124e1f40..2458ff604d91e405d0ebdf1102d51803e8cc0702 100644 (file)
@@ -4,8 +4,7 @@
                <li><com:TActiveLinkButton
                        ID="IncludeFileItem"
                        OnCommand="Parent.SourceTemplateControl.newIncludeFile"
-                       CommandParameter="save"
-                       ClientSide.OnComplete="var el1 = $('#<%=$this->IncludeFileItem->ClientID%>').parents('div').find('div.include_file')[<%=$this->Parent->ItemIndex%>]; var el2 = $(el1).find('div'); BaculaConfig.scroll_to_element(el2[el2.length-1], -100); $(el2[el2.length-1]).find('input')[0].focus();"
+                       ClientSide.OnComplete="var el1 = $('#<%=$this->IncludeFileItem->ClientID%>').parents('div').find('div.include_file')[<%=$this->Parent->ItemIndex%>]; var el2 = $(el1).find('div'); BaculaConfig.scroll_to_element(el2[el2.length-1], 0); $(el2[el2.length-1]).find('input')[0].focus();"
                        Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
                        >
                        <i class='fa fa-plus'></i> &nbsp;<%[ Add single file/directory ]%>
@@ -21,7 +20,6 @@
                <li><com:TActiveLinkButton
                        ID="OptionsItem"
                        OnCommand="Parent.SourceTemplateControl.newIncludeOptions"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el1 = $('#<%=$this->OptionsItem->ClientID%>').parents('div').find('div.incexc')[<%=$this->Parent->ItemIndex%>]; var el2 = $(el1).find('h3.options'); BaculaConfig.scroll_to_element(el2[el2.length-1], -80);"
                        Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
                        >
@@ -31,7 +29,6 @@
                <li><com:TActiveLinkButton
                        ID="PluginsItem"
                        OnCommand="Parent.SourceTemplateControl.newIncludePlugin"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el1 = $('#<%=$this->PluginsItem->ClientID%>').parents('div').find('div.incexc')[<%=$this->Parent->ItemIndex%>]; var el2 = $(el1).find('div.directive_field'); BaculaConfig.scroll_to_element(el2[el2.length-1], -80); $(el2[el2.length-1]).find('input')[0].focus();"
                        Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
                        >
index fdff9793bbfaba4dddbfc527b30599670f2d3235..c6f2bcbc4f6cb5c3e623d4cf6c6a0a7f30902188 100644 (file)
@@ -4,7 +4,6 @@
                <li><com:TActiveLinkButton
                        ID="NewIncludeBlock"
                        OnCommand="Parent.SourceTemplateControl.newIncludeBlock"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->NewIncludeBlock->ClientID%>').parents('div').find('div.incexc'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Text=""
                        Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
@@ -15,7 +14,6 @@
                <li><com:TActiveLinkButton
                        ID="NewExcludeBlock"
                        OnCommand="Parent.SourceTemplateControl.newExcludeFile"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->NewExcludeBlock->ClientID%>').parents('div').find('div.exclude_file'); BaculaConfig.scroll_to_element(el[el.length-1]); $(el[el.length-1]).find('input')[0].focus();"
                        Text=""
                        Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
index a0255a700d6c6c91a881eab8521c6a49e5e1e7d6..f60c76fbba7c0b7c036c1ec976ec5827fab8b66f 100644 (file)
@@ -4,7 +4,6 @@
                <li><com:TActiveLinkButton
                        ID="Console"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -14,7 +13,6 @@
                <li><com:TActiveLinkButton
                        ID="Stdout"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -24,7 +22,6 @@
                <li><com:TActiveLinkButton
                        ID="Stderr"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -34,7 +31,6 @@
                <li><com:TActiveLinkButton
                        ID="Syslog"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -44,7 +40,6 @@
                <li><com:TActiveLinkButton
                        ID="Catalog"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -54,7 +49,6 @@
                <li><com:TActiveLinkButton
                        ID="Director"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -64,7 +58,6 @@
                <li><com:TActiveLinkButton
                        ID="File"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -74,7 +67,6 @@
                <li><com:TActiveLinkButton
                        ID="Append"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -84,7 +76,6 @@
                <li><com:TActiveLinkButton
                        ID="Mail"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
@@ -94,7 +85,6 @@
                <li><com:TActiveLinkButton
                        ID="MailOnError"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
                <li><com:TActiveLinkButton
                        ID="MailOnSuccess"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
                <li><com:TActiveLinkButton
                        ID="Operator"
                        OnCommand="Parent.SourceTemplateControl.newMessagesDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->ClientID%>_new_messages').next().find('div.directive'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_messages').hide();"
                        >
index 14b151a591ec4af118bd8ddd376cf0392a6973ec..9d6ce5df176c036c1edfa23ff279c2abc858d2f7 100644 (file)
@@ -4,7 +4,6 @@
                <li><com:TActiveLinkButton
                        ID="RunscriptItem"
                        OnCommand="Parent.SourceTemplateControl.newRunscriptDirective"
-                       CommandParameter="save"
                        ClientSide.OnComplete="var el = $('#<%=$this->RunscriptItem->ClientID%>').parents('div').find('h3.runscript_options'); BaculaConfig.scroll_to_element(el[el.length-1]);"
                        Attributes.onclick="$(this).closest('div.config_new_runscript').hide();"
                        >
index a8de99be14fcc7339ebf06c296a15da362d98c83..421b52f696e60cfa20ec9c4c247e40e39828660d 100644 (file)
@@ -4,8 +4,7 @@
                <li><com:TActiveLinkButton
                        ID="RunscriptItem"
                        OnCommand="Parent.SourceTemplateControl.newScheduleDirective"
-                       CommandParameter="save"
-                       ClientSide.OnComplete="var el = $('#<%=$this->RunscriptItem->ClientID%>').parents('div').find('h2.schedule_options'); BaculaConfig.scroll_to_element(el[el.length-1], -100);"
+                       ClientSide.OnComplete="var el = $('#<%=$this->RunscriptItem->ClientID%>').parents('div').find('h2.schedule_options'); BaculaConfig.scroll_to_element(el[el.length-1], -50);"
                        Attributes.onclick="$(this).closest('div.config_new_schedule').hide();"
                        >
                                <%=$this->SourceTemplateControl->ComponentType == 'dir' ? 'Run' : ($this->SourceTemplateControl->ComponentType == 'fd' ? 'Connect' : '')%>
index 53a5c0bcfccf5f58759a4f4b125caf5215fbfda1..d3ddd9c4304cb7cd89b5a9fa19b4ed9e80ed3c6c 100644 (file)
@@ -373,6 +373,10 @@ table.status_table td, table.status_table td i {
        width: 160px;
 }
 
+.xtinybox {
+       width: 65px !important;
+}
+
 a.raw {
        text-decoration: none;
 }
@@ -501,6 +505,10 @@ table.component td:nth-of-type(1) {
        flex-basis: 385px;
 }
 
+.status_header.schedule > div {
+       flex-basis: 300px;
+}
+
 #status_storage_filters select {
        width: 250px;
        margin-left: 10px;
@@ -567,3 +575,9 @@ img.job_weather_icon {
        flex-basis: 140px;
        height: 28px;
 }
+
+/* Schedule setting */
+.day_of_month, .week_of_month, .week_of_year {
+       width: 14px;
+}
+