There has been also changed way of loading all directive controls. Now they are loaded on PreRender event instead of on Load event.
* 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
$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();
*/
class BClientScript extends TClientScript {
- const SCRIPTS_VERSION = 22;
+ const SCRIPTS_VERSION = 23;
public function getScriptUrl()
{
* 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
'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.
*
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"
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"
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"
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"
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"
$this->DirDirectorConfig->setComponentName($component_name);
$this->DirDirectorConfig->setResourceName($component_name);
$this->DirDirectorConfig->setLoadValues(true);
+ $this->DirDirectorConfig->IsDirectiveCreated = false;
$this->DirDirectorConfig->raiseEvent('OnDirectiveListLoad', $this, null);
}
}
</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 ]%> <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>
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);
*/
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();
}
/**
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);
if (key_exists('Client', $jobdefs) && is_null($this->Client->getDirectiveValue())) {
$this->Client->setDirectiveValue($jobdefs['Client']);
}
- $this->Client->onLoad(null);
+ $this->Client->createDirective();
}
/**
* @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++) {
}
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();
}
/**
$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();
* @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() {
if (key_exists('Level', $jobdefs)) {
$this->Level->setDirectiveValue($jobdefs['Level']);
}
- $this->Level->onLoad(null);
+ $this->Level->createDirective();
}
/**
* Load messages.
if (key_exists('Messages', $jobdefs)) {
$this->Messages->setDirectiveValue($jobdefs['Messages']);
}
- $this->Messages->onLoad(null);
+ $this->Messages->createDirective();
}
/**
* @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++) {
}
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) {
</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 ]%> <i class="fa fa-paper-plane"></i>
<com:Application.Web.Portlets.DirectiveTextBox
ID="MaximumSpawnedJobs"
DirectiveName="MaximumSpawnedJobs"
- DirectiveValue="600"
+ DefaultValue="600"
Label="Maximum Spawned Jobs"
Show="true"
ShowResetButton="false"
];
}
- 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);
}
asort($jobdefs_list);
$this->JobDefs->setData($jobdefs_list);
- $this->JobDefs->onLoad(null);
+ $this->JobDefs->createDirective();
}
}
if (key_exists($name, $jobdefs) && is_null($control->getDirectiveValue())) {
$control->setDirectiveValue($jobdefs[$name]);
}
- $control->onLoad(null);
+ $control->createDirective();
}
/**
*/
public function loadSelectionTypes() {
$this->SelectionType->setData($this->sel_types);
- $this->SelectionType->onLoad(null);
+ $this->SelectionType->createDirective();
}
/**
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();
}
}
if (key_exists('Messages', $jobdefs)) {
$this->Messages->setDirectiveValue($jobdefs['Messages']);
}
- $this->Messages->onLoad(null);
+ $this->Messages->createDirective();
}
}
if (key_exists('Schedule', $jobdefs)) {
$this->Schedule->setDirectiveValue($jobdefs['Schedule']);
}
- $this->Schedule->onLoad(null);
+ $this->Schedule->createDirective();
}
}
// no level in jobdefs, take first level
$this->Level->setDirectiveValue($level_list[0]);
}
- $this->Level->onLoad(null);
+ $this->Level->createDirective();
}
/**
} elseif (count($client_list) > 0) {
$this->Client->setDirectiveValue($client_list[0]);
}
- $this->Client->onLoad(null);
+ $this->Client->createDirective();
}
}
} elseif (count($fileset_list) > 0) {
$this->FileSet->setDirectiveValue($fileset_list[0]);
}
- $this->FileSet->onLoad(null);
+ $this->FileSet->createDirective();
}
}
* 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
}
$this->ConsoleConfig->setHost($this->User->getDefaultAPIHost());
$this->ConsoleConfig->setComponentName($_SESSION['dir']);
+ $this->ConsoleConfig->IsDirectiveCreated = false;
$this->ConsoleConfig->raiseEvent('OnDirectiveListLoad', $this, null);
}
]
];
$this->ConsoleConfig->setData($config);
+ $this->ConsoleConfig->IsDirectiveCreated = false;
$this->ConsoleConfig->raiseEvent('OnDirectiveListLoad', $this, null);
$this->getCallbackClient()->callClientFunction('oBaculaConfigSection.show_sections', [true]);
}
* 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
}
}
- 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);
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();
$this->RepeaterDirectives->DataSource = $directives;
$this->RepeaterDirectives->dataBind();
$this->ConfigDirectives->Display = 'Dynamic';
+ $this->IsDirectiveCreated = true;
}
public function loadDirectives($sender, $param) {
$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;
}
}
$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
$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);
}
<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"
* 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
*/
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)) {
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();
--- /dev/null
+<?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);
+ }
+}
--- /dev/null
+<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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ </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>
--- /dev/null
+<?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);
+ }
+}
--- /dev/null
+<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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
* 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
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();
$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)) {
}
$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)) {
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)) {
* 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
*/
class DirectiveListBox extends DirectiveTemplate {
- public function onPreRender($param) {
- parent::onPreRender($param);
- $this->createDirectiveInternal();
- }
-
public function getValue() {
$value = array();
$values = $this->Directive->getSelectedIndices();
return $value;
}
- public function createDirectiveInternal() {
+ public function createDirective() {
$this->Label->Text = $this->getLabel();
$data = $this->getData();
$resource_names = $this->getResourceNames();
* 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
const SHOW = 'Show';
const PARENT_NAME = 'ParentName';
const GROUP_NAME = 'GroupName';
+ const IS_DIRECTIVE_CREATED = 'IsDirectiveCreated';
public $display_directive;
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();
}
}
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);
+ }
+
}
?>
$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;
CssClass="w3-button w3-green w3-right"
OnCommand="SourceTemplateControl.removeMessages"
CommandName="<%=$this->ItemIndex%>"
- CommandParameter="save"
>
<i class="fa fa-trash-alt"></i> <%[ Remove ]%>
</com:TActiveLinkButton>
--- /dev/null
+<?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);
+ }
+}
--- /dev/null
+<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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
* 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
class DirectiveRenderer extends TItemDataRenderer {
const DATA = 'Data';
+ const IS_DATA_BOUND = 'IsDataBound';
private $directive_types = array(
'DirectiveCheckBox',
$this->addSection($data['section']);
}
- $item = $this->createItem($data);
- $this->addParsedObject($item);
+ $this->createItem($data);
+ $this->setIsDataBound(true);
}
public function createItem($data) {
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']);
$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;
}
$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;
}
* 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
private $directive_types = array(
'DirectiveCheckBox',
- 'DirectiveTextBox',
- 'DirectiveComboBox'
+ 'DirectiveComboBox',
+ 'DirectiveTextBox'
);
public function loadConfig() {
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;
}
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 {
* 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.
*/
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',
'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();
$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;
$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,
}
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,
'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();
$control->setShow($data['show']);
$control->setResourceNames($data['resource_names']);
$control->setParentName($data['parent_name']);
- $control->onLoad(null);
- $control->createDirective();
}
}
}
}
- $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);
}
}
+ 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();
$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();
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
}
$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);
}
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);
if (is_array($data)) {
$data[] = $obj;
} else {
- $data = array($obj);
+ $data = [$obj];
}
$this->setData($data);
$this->SourceTemplateControl->setShowAllDirectives(true);
CssClass="w3-button w3-green w3-right"
OnCommand="SourceTemplateControl.removeSchedule"
CommandName="<%=$this->ItemIndex%>"
- CommandParameter="save"
>
<i class="fa fa-trash-alt"></i> <%[ 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>
+ <com:TActiveRadioButton
+ ID="TimeHourlyCustomOption"
+ CssClass="w3-check"
+ AutoPostBack="false"
+ GroupName="TimeCustomOptions"
+ /> <label for="<%=$this->TimeHourlyCustomOption->ClientID%>"><%[ Run hourly at minute ]%></label>
+ <com:TActiveRadioButton
+ ID="TimeAtCustomOption"
+ CssClass="w3-check"
+ AutoPostBack="false"
+ GroupName="TimeCustomOptions"
+ /> <label for="<%=$this->TimeAtCustomOption->ClientID%>"><%[ Run at specified HH:MM ]%></label>
+ <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>
* 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
const SHOW_REMOVE_BUTTON = 'ShowRemoveButton';
public $display_directive;
+ private $data_changed = false;
private $command_params = array('save', 'add');
$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);
}
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);
}
public function getDirectiveValue() {
+ $this->saveValue(null, null);
return $this->getViewState(self::DIRECTIVE_VALUE);
}
--- /dev/null
+<?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);
+ }
+}
--- /dev/null
+<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() ? ' <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>
--- /dev/null
+<?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);
+ }
+}
--- /dev/null
+<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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
--- /dev/null
+<?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);
+ }
+}
--- /dev/null
+<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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
+ <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>
+ <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>
+ <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>
+ <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>
+ </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>
* 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
$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> ' . Prado::localize('Remove');
$this->addParsedObject($alb);
}
* 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
$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) {
<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();"
>
<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> <%[ Add single file/directory ]%>
<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();"
>
<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();"
>
<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();"
<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();"
<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();"
>
<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();"
>
<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();"
>
<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();"
>
<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();"
>
<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();"
>
<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();"
>
<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();"
>
<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();"
>
<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();"
>
<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();"
>
<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' : '')%>
width: 160px;
}
+.xtinybox {
+ width: 65px !important;
+}
+
a.raw {
text-decoration: none;
}
flex-basis: 385px;
}
+.status_header.schedule > div {
+ flex-basis: 300px;
+}
+
#status_storage_filters select {
width: 250px;
margin-left: 10px;
flex-basis: 140px;
height: 28px;
}
+
+/* Schedule setting */
+.day_of_month, .week_of_month, .week_of_year {
+ width: 14px;
+}
+