}
public function isValidBoolean($val) {
- return (preg_match('/^(yes|no|0|1|true|false)$/', $val) === 1);
+ return (preg_match('/^(yes|no|1|0|true|false)$/i', $val) === 1);
+ }
+
+ public function isValidBooleanTrue($val) {
+ return (preg_match('/^(yes|1|true)$/i', $val) === 1);
+ }
+
+ public function isValidBooleanFalse($val) {
+ return (preg_match('/^(no|0|false)$/i', $val) === 1);
}
public function isValidId($id) {
this.show_item(container, true);
this.scroll_to_element(container);
},
- scroll_to_element: function(selector) {
- $('html,body').animate({scrollTop: $(selector).offset().top}, 'slow');
+ scroll_to_element: function(selector, additional_offset) {
+ var offset = $(selector).offset().top;
+ if (additional_offset) {
+ offset += additional_offset;
+ }
+ $('html,body').animate({
+ scrollTop: offset
+ }, 'slow');
},
get_child_container: function(sender) {
var child_container = $('#' + sender).closest('table').next('div');
msgid "Message:"
msgstr "Message:"
+msgid "Include"
+msgstr "Include"
+
+msgid "Exclude"
+msgstr "Exclude"
+
+msgid "Step 1 - select job type"
+msgstr "Step 1 - select job type"
+
+msgid "New job wizard"
+msgstr "New job wizard"
+
+msgid "This wizard enables you to create in easy way a new job."
+msgstr "This wizard enables you to create in easy way a new job."
+
+msgid "To start please select job type that you wish to create."
+msgstr "To start please select job type that you wish to create."
+
+msgid "Job Type"
+msgstr "Job Type"
+
+msgid "Job Name"
+msgstr "Job Name"
+
+msgid "JobDefs"
+msgstr "JobDefs"
+
+msgid "Step 2 - what you want to backup"
+msgstr "Step 2 - what you want to backup"
+
+msgid "Client and FileSet"
+msgstr "Client and FileSet"
+
+msgid "Please select Client from which you want to backup data and please select FileSet with files/directories definition to backup."
+msgstr "Please select Client from which you want to backup data and please select FileSet with files/directories definition to backup."
+
+msgid "If your FileSet for this backup does not exist yet, you can create it."
+msgstr "If your FileSet for this backup does not exist yet, you can create it."
+
+msgid "FileSet"
+msgstr "FileSet"
+
+msgid "Add new FileSet"
+msgstr "Add new FileSet"
+
+msgid "New FileSet"
+msgstr "New FileSet"
+
+msgid "Step 3 - where you want to backup"
+msgstr "Step 3 - where you want to backup"
+
+msgid "Storage and Pool"
+msgstr "Storage and Pool"
+
+msgid "Please select Storage where you want to backup data and please select Pool with volumes which Storage will use to store backup data."
+msgstr "Please select Storage where you want to backup data and please select Pool with volumes which Storage will use to store backup data."
+
+msgid "Storage"
+msgstr "Storage"
+
+msgid "Show Storage directives for Job"
+msgstr "Show Storage directives for Job"
+
+msgid "Spool setting"
+msgstr "Spool setting"
+
+msgid "Spool Data"
+msgstr "Spool Data"
+
+msgid "Spool Attributes"
+msgstr "Spool Attributes"
+
+msgid "Spool Size"
+msgstr "Spool Size"
+
+msgid "Show Pool directives for Job"
+msgstr "Show Pool directives for Job"
+
+msgid "Pool setting"
+msgstr "Pool setting"
+
+msgid "Full Backup Pool"
+msgstr "Full Backup Pool"
+
+msgid "Incremental Backup Pool"
+msgstr "Incremental Backup Pool"
+
+msgid "Differential Backup Pool"
+msgstr "Differential Backup Pool"
+
+msgid "Step 4 - how would you like to backup"
+msgstr "Step 4 - how would you like to backup"
+
+msgid "Backup Job directives"
+msgstr "Backup Job directives"
+
+msgid "Accurate"
+msgstr "Accurate"
+
+msgid "Step 5 - when would you like to run backup"
+msgstr "Step 5 - when would you like to run backup"
+
+msgid "Schedule"
+msgstr "Schedule"
+
+msgid "Show Reschedule directives"
+msgstr "Show Reschedule directives"
+
+msgid "Reschedule setting"
+msgstr "Reschedule setting"
+
+msgid "Reschedule On Error"
+msgstr "Reschedule On Error"
+
+msgid "Reschedule Incomplete Jobs"
+msgstr "Reschedule Incomplete Jobs"
+
+msgid "Reschedule Interval"
+msgstr "Reschedule Interval"
+
+msgid "Reschedule Times"
+msgstr "Reschedule Times"
+
+msgid "What"
+msgstr "What"
+
+msgid "Maximum Concurrent Jobs"
+msgstr "Maximum Concurrent Jobs"
+
+msgid "Priority"
+msgstr "Priority"
+
+msgid "ReRun Failed Levels"
+msgstr "ReRun Failed Levels"
+
+msgid "General"
+msgstr "General"
+
+msgid "How"
+msgstr "How"
+
+msgid "When"
+msgstr "When"
+
+msgid "Other directives"
+msgstr "Other directives"
+
+msgid "Messages"
+msgstr "Messages"
+
+msgid "Step 6 - summary"
+msgstr "Step 6 - summary"
+
+msgid "Add new Pool"
+msgstr "Add new Pool"
+
+msgid "New Pool"
+msgstr "New Pool"
+
+msgid "Add new Schedule"
+msgstr "Add new Schedule"
+
+msgid "New Schedule"
+msgstr "New Schedule"
+
+msgid "Summary"
+msgstr "Summary"
+
+msgid "inherited from JobDefs"
+msgstr "inherited from JobDefs"
+
+msgid "Create job"
+msgstr "Create job"
+
+msgid "Please select Client"
+msgstr "Please select Client"
+
+msgid "Go to path"
+msgstr "Go to path"
+
+msgid "Add new include path"
+msgstr "Add new include path"
+
+msgid "Add new global exclude path"
+msgstr "Add new global exclude path"
+
+msgid "Include files to FileSet"
+msgstr "Include files to FileSet"
+
+msgid "Apply file selection"
+msgstr "Apply file selection"
"{user} keyword will be replaced for each logged user into according username."
msgstr ""
"{user} keyword will be replaced for each logged user into according username."
+
+msgid "Include"
+msgstr "Include"
+
+msgid "Exclude"
+msgstr "Exclude"
+
+msgid "Step 1 - select job type"
+msgstr "Step 1 - select job type"
+
+msgid "New job wizard"
+msgstr "New job wizard"
+
+msgid "This wizard enables you to create in easy way a new job."
+msgstr "This wizard enables you to create in easy way a new job."
+
+msgid "To start please select job type that you wish to create."
+msgstr "To start please select job type that you wish to create."
+
+msgid "Job Type"
+msgstr "Job Type"
+
+msgid "Job Name"
+msgstr "Job Name"
+
+msgid "JobDefs"
+msgstr "JobDefs"
+
+msgid "Step 2 - what you want to backup"
+msgstr "Step 2 - what you want to backup"
+
+msgid "Client and FileSet"
+msgstr "Client and FileSet"
+
+msgid "Please select Client from which you want to backup data and please select FileSet with files/directories definition to backup."
+msgstr "Please select Client from which you want to backup data and please select FileSet with files/directories definition to backup."
+
+msgid "If your FileSet for this backup does not exist yet, you can create it."
+msgstr "If your FileSet for this backup does not exist yet, you can create it."
+
+msgid "FileSet"
+msgstr "FileSet"
+
+msgid "Add new FileSet"
+msgstr "Add new FileSet"
+
+msgid "New FileSet"
+msgstr "New FileSet"
+
+msgid "Step 3 - where you want to backup"
+msgstr "Step 3 - where you want to backup"
+
+msgid "Storage and Pool"
+msgstr "Storage and Pool"
+
+msgid "Please select Storage where you want to backup data and please select Pool with volumes which Storage will use to store backup data."
+msgstr "Please select Storage where you want to backup data and please select Pool with volumes which Storage will use to store backup data."
+
+msgid "Storage"
+msgstr "Storage"
+
+msgid "Show Storage directives for Job"
+msgstr "Show Storage directives for Job"
+
+msgid "Spool setting"
+msgstr "Spool setting"
+
+msgid "Spool Data"
+msgstr "Spool Data"
+
+msgid "Spool Attributes"
+msgstr "Spool Attributes"
+
+msgid "Spool Size"
+msgstr "Spool Size"
+
+msgid "Show Pool directives for Job"
+msgstr "Show Pool directives for Job"
+
+msgid "Pool setting"
+msgstr "Pool setting"
+
+msgid "Full Backup Pool"
+msgstr "Full Backup Pool"
+
+msgid "Incremental Backup Pool"
+msgstr "Incremental Backup Pool"
+
+msgid "Differential Backup Pool"
+msgstr "Differential Backup Pool"
+
+msgid "Step 4 - how would you like to backup"
+msgstr "Step 4 - how would you like to backup"
+
+msgid "Backup Job directives"
+msgstr "Backup Job directives"
+
+msgid "Accurate"
+msgstr "Accurate"
+
+msgid "Step 5 - when would you like to run backup"
+msgstr "Step 5 - when would you like to run backup"
+
+msgid "Schedule"
+msgstr "Schedule"
+
+msgid "Show Reschedule directives"
+msgstr "Show Reschedule directives"
+
+msgid "Reschedule setting"
+msgstr "Reschedule setting"
+
+msgid "Reschedule On Error"
+msgstr "Reschedule On Error"
+
+msgid "Reschedule Incomplete Jobs"
+msgstr "Reschedule Incomplete Jobs"
+
+msgid "Reschedule Interval"
+msgstr "Reschedule Interval"
+
+msgid "Reschedule Times"
+msgstr "Reschedule Times"
+
+msgid "What"
+msgstr "What"
+
+msgid "Maximum Concurrent Jobs"
+msgstr "Maximum Concurrent Jobs"
+
+msgid "Priority"
+msgstr "Priority"
+
+msgid "ReRun Failed Levels"
+msgstr "ReRun Failed Levels"
+
+msgid "General"
+msgstr "General"
+
+msgid "How"
+msgstr "How"
+
+msgid "When"
+msgstr "When"
+
+msgid "Other directives"
+msgstr "Other directives"
+
+msgid "Messages"
+msgstr "Messages"
+
+msgid "Step 6 - summary"
+msgstr "Step 6 - summary"
+
+msgid "Add new Pool"
+msgstr "Add new Pool"
+
+msgid "New Pool"
+msgstr "New Pool"
+
+msgid "Add new Schedule"
+msgstr "Add new Schedule"
+
+msgid "New Schedule"
+msgstr "New Schedule"
+
+msgid "Summary"
+msgstr "Summary"
+
+msgid "inherited from JobDefs"
+msgstr "inherited from JobDefs"
+
+msgid "Create job"
+msgstr "Create job"
+
+msgid "Please select Client"
+msgstr "Please select Client"
+
+msgid "Go to path"
+msgstr "Go to path"
+
+msgid "Add new include path"
+msgstr "Add new include path"
+
+msgid "Add new global exclude path"
+msgstr "Add new global exclude path"
+
+msgid "Include files to FileSet"
+msgstr "Include files to FileSet"
+
+msgid "Apply file selection"
+msgstr "Apply file selection"
msgid "Message:"
msgstr "Wiadomość:"
+
+msgid "Include"
+msgstr "Include"
+
+msgid "Exclude"
+msgstr "Exclude"
+
+msgid "Step 1 - select job type"
+msgstr "Krok 1 - wybierz typ zadania"
+
+msgid "New job wizard"
+msgstr "Konfigurator nowego zadania"
+
+msgid "This wizard enables you to create in easy way a new job."
+msgstr "Ten konfigurator umożliwia ci stworzenie nowego zadania w łatwy sposób."
+
+msgid "To start please select job type that you wish to create."
+msgstr "Aby zacząć proszę wybrać typ zadania, które życzysz sobie stworzyć."
+
+msgid "Job Type"
+msgstr "Typ Zadania"
+
+msgid "Job Name"
+msgstr "Nazwa Zadania"
+
+msgid "JobDefs"
+msgstr "JobDefs"
+
+msgid "Step 2 - what you want to backup"
+msgstr "Krok 2 - co chcesz backupować"
+
+msgid "Client and FileSet"
+msgstr "Klient i FileSet"
+
+msgid "Please select Client from which you want to backup data and please select FileSet with files/directories definition to backup."
+msgstr "Proszę wybrać Klienta z którego chcesz backupować dane i proszę wybrać FileSet z definicją plików/katalogów do backupu"
+
+msgid "If your FileSet for this backup does not exist yet, you can create it."
+msgstr "Jeśli twój FileSet dla backupu nie istnieje jeszcze, możesz go stworzyć."
+
+msgid "FileSet"
+msgstr "FileSet"
+
+msgid "Add new FileSet"
+msgstr "Dodaj nowy FileSet"
+
+msgid "New FileSet"
+msgstr "Nowy FileSet"
+
+msgid "Step 3 - where you want to backup"
+msgstr "Krok 3 - gdzie chcesz składować backup"
+
+msgid "Storage and Pool"
+msgstr "Magazyn i Pula wolumenów"
+
+msgid "Please select Storage where you want to backup data and please select Pool with volumes which Storage will use to store backup data."
+msgstr "Proszę wybrać Magazyn danych gdzie chcesz składować backup i proszę wybrać Pulę z wolumenami które Magazyn będzie używał do składowania danych backupu"
+
+msgid "Storage"
+msgstr "Magazyn danych"
+
+msgid "Show Storage directives for Job"
+msgstr "Pokaż opcje Magazynu danych dla zadania"
+
+msgid "Spool setting"
+msgstr "Ustawienia Spool"
+
+msgid "Spool Data"
+msgstr "Spool Data"
+
+msgid "Spool Attributes"
+msgstr "Spool Attributes"
+
+msgid "Spool Size"
+msgstr "Spool Size"
+
+msgid "Show Pool directives for Job"
+msgstr "Pokaż opcje Puli wolumenów dla zadania"
+
+msgid "Pool setting"
+msgstr "Ustawienia Puli wolumenów"
+
+msgid "Full Backup Pool"
+msgstr "Full Backup Pool"
+
+msgid "Incremental Backup Pool"
+msgstr "Incremental Backup Pool"
+
+msgid "Differential Backup Pool"
+msgstr "Differential Backup Pool"
+
+msgid "Step 4 - how would you like to backup"
+msgstr "Krok 4 - jak chciałbyś backupować"
+
+msgid "Backup Job directives"
+msgstr "Opcje zadania backupowego"
+
+msgid "Accurate"
+msgstr "Tryb dokładny"
+
+msgid "Step 5 - when would you like to run backup"
+msgstr "Krok 5 - kiedy chciałbyć uruchamiać backup"
+
+msgid "Schedule"
+msgstr "Harmonogram zadań"
+
+msgid "Show Reschedule directives"
+msgstr "Pokaż opcje Reschedule"
+
+msgid "Reschedule setting"
+msgstr "Ustawienia Reschedule"
+
+msgid "Reschedule On Error"
+msgstr "Reschedule On Error"
+
+msgid "Reschedule Incomplete Jobs"
+msgstr "Reschedule Incomplete Jobs"
+
+msgid "Reschedule Interval"
+msgstr "Reschedule Interval"
+
+msgid "Reschedule Times"
+msgstr "Reschedule Times"
+
+msgid "What"
+msgstr "Co"
+
+msgid "Maximum Concurrent Jobs"
+msgstr "Maximum Concurrent Jobs"
+
+msgid "Priority"
+msgstr "Priorytet"
+
+msgid "ReRun Failed Levels"
+msgstr "ReRun Failed Levels"
+
+msgid "General"
+msgstr "Ogólne"
+
+msgid "How"
+msgstr "Jak"
+
+msgid "When"
+msgstr "Kiedy"
+
+msgid "Other directives"
+msgstr "Inne dyrektywy"
+
+msgid "Messages"
+msgstr "Messages"
+
+msgid "Step 6 - summary"
+msgstr "Krok 6 - podsumowanie"
+
+msgid "Add new Pool"
+msgstr "Dodaj nową Pulę wolumenów"
+
+msgid "New Pool"
+msgstr "Nowa Pula wolumenów"
+
+msgid "Add new Schedule"
+msgstr "Dodaj nowy harmonogram zadań"
+
+msgid "New Schedule"
+msgstr "Nowy harmonogram zadań"
+
+msgid "Summary"
+msgstr "Podsumowanie"
+
+msgid "inherited from JobDefs"
+msgstr "odziedziczone z JobDefs"
+
+msgid "Create job"
+msgstr "Stwórz zadanie"
+
+msgid "Please select Client"
+msgstr "Proszę wybrać Klienta"
+
+msgid "Go to path"
+msgstr "Idź do lokalizacji"
+
+msgid "Add new include path"
+msgstr "Dodaj nową lokalizację listy dołączeń"
+
+msgid "Add new global exclude path"
+msgstr "Dodaj nową globalną lokalizację do listy wykluczeń"
+
+msgid "Include files to FileSet"
+msgstr "Dołącz pliki do FileSet"
+
+msgid "Apply file selection"
+msgstr "Zastosuj wybrane pliki"
msgid "Message:"
msgstr "Message:"
+msgid "Include"
+msgstr "Include"
+
+msgid "Exclude"
+msgstr "Exclude"
+
+msgid "Step 1 - select job type"
+msgstr "Step 1 - select job type"
+
+msgid "New job wizard"
+msgstr "New job wizard"
+
+msgid "This wizard enables you to create in easy way a new job."
+msgstr "This wizard enables you to create in easy way a new job."
+
+msgid "To start please select job type that you wish to create."
+msgstr "To start please select job type that you wish to create."
+
+msgid "Job Type"
+msgstr "Job Type"
+
+msgid "Job Name"
+msgstr "Job Name"
+
+msgid "JobDefs"
+msgstr "JobDefs"
+
+msgid "Step 2 - what you want to backup"
+msgstr "Step 2 - what you want to backup"
+
+msgid "Client and FileSet"
+msgstr "Client and FileSet"
+
+msgid "Please select Client from which you want to backup data and please select FileSet with files/directories definition to backup."
+msgstr "Please select Client from which you want to backup data and please select FileSet with files/directories definition to backup."
+
+msgid "If your FileSet for this backup does not exist yet, you can create it."
+msgstr "If your FileSet for this backup does not exist yet, you can create it."
+
+msgid "FileSet"
+msgstr "FileSet"
+
+msgid "Add new FileSet"
+msgstr "Add new FileSet"
+
+msgid "New FileSet"
+msgstr "New FileSet"
+
+msgid "Step 3 - where you want to backup"
+msgstr "Step 3 - where you want to backup"
+
+msgid "Storage and Pool"
+msgstr "Storage and Pool"
+
+msgid "Please select Storage where you want to backup data and please select Pool with volumes which Storage will use to store backup data."
+msgstr "Please select Storage where you want to backup data and please select Pool with volumes which Storage will use to store backup data."
+
+msgid "Storage"
+msgstr "Storage"
+
+msgid "Show Storage directives for Job"
+msgstr "Show Storage directives for Job"
+
+msgid "Spool setting"
+msgstr "Spool setting"
+
+msgid "Spool Data"
+msgstr "Spool Data"
+
+msgid "Spool Attributes"
+msgstr "Spool Attributes"
+
+msgid "Spool Size"
+msgstr "Spool Size"
+
+msgid "Show Pool directives for Job"
+msgstr "Show Pool directives for Job"
+
+msgid "Pool setting"
+msgstr "Pool setting"
+
+msgid "Full Backup Pool"
+msgstr "Full Backup Pool"
+
+msgid "Incremental Backup Pool"
+msgstr "Incremental Backup Pool"
+
+msgid "Differential Backup Pool"
+msgstr "Differential Backup Pool"
+
+msgid "Step 4 - how would you like to backup"
+msgstr "Step 4 - how would you like to backup"
+
+msgid "Backup Job directives"
+msgstr "Backup Job directives"
+
+msgid "Accurate"
+msgstr "Accurate"
+
+msgid "Step 5 - when would you like to run backup"
+msgstr "Step 5 - when would you like to run backup"
+
+msgid "Schedule"
+msgstr "Schedule"
+
+msgid "Show Reschedule directives"
+msgstr "Show Reschedule directives"
+
+msgid "Reschedule setting"
+msgstr "Reschedule setting"
+
+msgid "Reschedule On Error"
+msgstr "Reschedule On Error"
+
+msgid "Reschedule Incomplete Jobs"
+msgstr "Reschedule Incomplete Jobs"
+
+msgid "Reschedule Interval"
+msgstr "Reschedule Interval"
+
+msgid "Reschedule Times"
+msgstr "Reschedule Times"
+
+msgid "What"
+msgstr "What"
+
+msgid "Maximum Concurrent Jobs"
+msgstr "Maximum Concurrent Jobs"
+
+msgid "Priority"
+msgstr "Priority"
+
+msgid "ReRun Failed Levels"
+msgstr "ReRun Failed Levels"
+
+msgid "General"
+msgstr "General"
+
+msgid "How"
+msgstr "How"
+
+msgid "When"
+msgstr "When"
+
+msgid "Other directives"
+msgstr "Other directives"
+
+msgid "Messages"
+msgstr "Messages"
+
+msgid "Step 6 - summary"
+msgstr "Step 6 - summary"
+
+msgid "Add new Pool"
+msgstr "Add new Pool"
+
+msgid "New Pool"
+msgstr "New Pool"
+
+msgid "Add new Schedule"
+msgstr "Add new Schedule"
+
+msgid "New Schedule"
+msgstr "New Schedule"
+
+msgid "Summary"
+msgstr "Summary"
+
+msgid "inherited from JobDefs"
+msgstr "inherited from JobDefs"
+
+msgid "Create job"
+msgstr "Create job"
+
+msgid "Please select Client"
+msgstr "Please select Client"
+
+msgid "Go to path"
+msgstr "Go to path"
+
+msgid "Add new include path"
+msgstr "Add new include path"
+
+msgid "Add new global exclude path"
+msgstr "Add new global exclude path"
+
+msgid "Include files to FileSet"
+msgstr "Include files to FileSet"
+
+msgid "Apply file selection"
+msgstr "Apply file selection"
<com:BClientScript ScriptUrl=<%~ ../JavaScript/opentip.js %> />
<com:BClientScript ScriptUrl=<%~ ../JavaScript/tooltip.js %> />
<com:BClientScript ScriptUrl=<%~ ../JavaScript/misc.js %> />
+ <com:BClientScript ScriptUrl=<%~ ../JavaScript/bacula-config.js %> />
<!-- Top container -->
<com:TContentPlaceHolder ID="Wizard" />
</com:TForm>
+ <script type="text/javascript">
+ Formatters.set_formatters();
+ </script>
</body>
</html>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2018 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
if ($this->Request->contains('fileset')) {
$this->setFileSetName($this->Request['fileset']);
}
+ }
+
+ public function onLoad($param) {
+ parent::onLoad($param);
+ if ($this->getPage()->IsCallBack || $this->getPage()->IsPostBack) {
+ return;
+ }
if (!empty($_SESSION['dir'])) {
$this->FileSetConfig->setComponentName($_SESSION['dir']);
$this->FileSetConfig->setResourceName($this->getFileSetName());
</header>
<div class="w3-margin-left w3-margin-bottom">
<button type="button" class="w3-button w3-green<%=empty($_SESSION['dir']) ? ' hide': ''%>" onclick="document.location.href='<%=$this->Service->constructUrl('NewResource', array('component_type' => 'dir', 'component_name' => $_SESSION['dir'], 'resource_type' => 'Job'))%>';"><i class="fa fa-plus"></i> <%[ Add job ]%></button>
+ <button type="button" class="w3-button w3-green<%=empty($_SESSION['dir']) ? ' hide': ''%>" onclick="document.location.href='<%=$this->Service->constructUrl('NewJobWizard')%>';"><i class="fa fa-magic"></i> <%[ New job wizard ]%></button>
<com:TActiveLinkButton
CssClass="w3-button w3-green"
OnClick="loadRunJobModal"
</header>
<div class="w3-margin-left w3-margin-bottom">
<button type="button" class="w3-button w3-green<%=empty($_SESSION['dir']) ? ' hide': ''%>" onclick="document.location.href='<%=$this->Service->constructUrl('NewResource', array('component_type' => 'dir', 'component_name' => $_SESSION['dir'], 'resource_type' => 'Job'))%>';"><i class="fa fa-plus"></i> <%[ Add job ]%></button>
+ <button type="button" class="w3-button w3-green<%=empty($_SESSION['dir']) ? ' hide': ''%>" onclick="document.location.href='<%=$this->Service->constructUrl('NewJobWizard')%>';"><i class="fa fa-magic"></i> <%[ New job wizard ]%></button>
<com:TActiveLinkButton
CssClass="w3-button w3-green"
OnClick="loadRunJobModal"
-<%@ MasterClass="Application.Web.Layouts.Wizard" Theme="Baculum-v1"%>
+<%@ MasterClass="Application.Web.Layouts.Wizard" Theme="Baculum-v2"%>
<com:TContent ID="Wizard">
<com:TWizard ID="NewJobWizard"
CssClass="wizard"
OnCompleteButtonClick="wizardCompleted"
>
<prop:HeaderTemplate>
- <div>
- <div class="step step-<%=($this->Parent->ActiveStepIndex === 0) ? 'first-active' : (($this->Parent->ActiveStepIndex === 1) ? 'first-next-active' : 'first')%>">
- <div><com:TTranslate Text="Type" /></div>
+ <div class="w3-half">
+ <div class="w3-third w3-padding-16">
+ <div class="step w3-padding w3-text-white w3-margin-right <%=($this->Parent->ActiveStepIndex === 0 ? 'w3-light-green' : 'w3-green')%>">
+ <div class="w3-left"><i class="fa fa-tasks w3-xxxlarge"></i></div>
+ <div class="w3-clear"></div>
+ <h4><com:TTranslate Text="Type" /></h4>
+ </div>
</div>
- <div class="step step-<%=($this->Parent->ActiveStepIndex === 1) ? 'active' : (($this->Parent->ActiveStepIndex === 2) ? 'prev-active' : 'normal')%>">
- <div><com:TTranslate Text="What" /></div>
+ <div class="w3-third w3-padding-16">
+ <div class="step w3-padding w3-text-white w3-margin-right <%=($this->Parent->ActiveStepIndex === 1 ? 'w3-light-green' : 'w3-green')%>">
+ <div class="w3-left"><i class="fa fa-upload w3-xxxlarge"></i></div>
+ <div class="w3-clear"></div>
+ <h4><com:TTranslate Text="What" /></h4>
+ </div>
</div>
- <div class="step step-<%=($this->Parent->ActiveStepIndex === 2) ? 'active' : (($this->Parent->ActiveStepIndex === 3) ? 'prev-active' : 'normal')%>">
- <div><com:TTranslate Text="Where" /></div>
+ <div class="w3-third w3-padding-16">
+ <div class="step w3-padding w3-text-white w3-margin-right <%=($this->Parent->ActiveStepIndex === 2 ? 'w3-light-green' : 'w3-green')%>">
+ <div class="w3-left"><i class="fa fa-download w3-xxxlarge"></i></div>
+ <div class="w3-clear"></div>
+ <h4><com:TTranslate Text="Where" /></h4>
+ </div>
</div>
- <div class="step step-<%=($this->Parent->ActiveStepIndex === 3) ? 'active' : (($this->Parent->ActiveStepIndex === 4) ? 'prev-active' : 'normal')%>">
- <div><com:TTranslate Text="How" /></div>
+ </div>
+ <div class="w3-half">
+ <div class="w3-third w3-padding-16">
+ <div class="step w3-padding w3-text-white w3-margin-right <%=($this->Parent->ActiveStepIndex === 3 ? 'w3-light-green' : 'w3-green')%>">
+ <div class="w3-left"><i class="fa fa-question w3-xxxlarge"></i></div>
+ <div class="w3-clear"></div>
+ <h4><com:TTranslate Text="How" /></h4>
+ </div>
</div>
- <div class="step step-<%=($this->Parent->ActiveStepIndex === 4) ? 'active' : (($this->Parent->ActiveStepIndex === 5) ? 'prev-active' : 'normal')%>">
- <div><com:TTranslate Text="When" /></div>
+ <div class="w3-third w3-padding-16">
+ <div class="step w3-padding w3-text-white w3-margin-right <%=($this->Parent->ActiveStepIndex === 4 ? 'w3-light-green' : 'w3-green')%>">
+ <div class="w3-left"><i class="fa fa-clock w3-xxxlarge"></i></div>
+ <div class="w3-clear"></div>
+ <h4><com:TTranslate Text="When" /></h4>
+ </div>
</div>
- <div class="step step-<%=($this->Parent->ActiveStepIndex === 5) ? 'last-active' : (($this->Parent->ActiveStepIndex === 6) ? 'last-prev-active' : 'last')%>">
- <div><com:TTranslate Text="Summary" /></div>
+ <div class="w3-third w3-padding-16">
+ <div class="step w3-padding w3-text-white w3-margin-right <%=($this->Parent->ActiveStepIndex === 5 ? 'w3-light-green' : 'w3-green')%>">
+ <div class="w3-left"><i class="fa fa-paper-plane w3-xxxlarge"></i></div>
+ <div class="w3-clear"></div>
+ <h4><com:TTranslate Text="Summary" /></h4>
+ </div>
</div>
- <div id="title"><%=$this->Parent->ActiveStep->Title%><div>
</div>
+ <div class="step_title w3-panel w3-green w3-margin-right"><h3><%=$this->Parent->ActiveStep->Title%></h3></div>
</prop:HeaderTemplate>
<prop:StartNavigationTemplate>
- <div class="button-cancel"><com:BButton CommandName="Cancel" Text="<%[ Cancel ]%>" /></div>
- <div class="button-prev-next"><com:BButton CommandName="NextStep" Text="<%[ Next » ]%>" /></div>
+ <div class="w3-center w3-section">
+ <com:TLinkButton
+ CommandName="Cancel"
+ CssClass="w3-button w3-red"
+ >
+ <i class="fa fa-times"></i> <%[ Cancel ]%>
+ </com:TLinkButton>
+ <com:TLinkButton
+ CommandName="NextStep"
+ CommandParameter="save"
+ ValidationGroup="NewJobDirective"
+ CssClass="w3-button w3-green"
+ >
+ <%[ Next ]%> <i class="fa fa-angle-right"></i>
+ </com:TLinkButton>
+ </div>
</prop:StartNavigationTemplate>
<prop:StepNavigationTemplate>
- <div class="button-cancel"><com:BButton CommandName="Cancel" Text="<%[ Cancel ]%>" /></div>
- <div class="button-prev-next">
- <com:BButton CausesValidation="False" CssClass="bbutton" CommandName="PreviousStep" Text="<%[ « Previous ]%>" />
- <com:BButton ID="NextButton" CommandName="NextStep" Text="<%[ Next » ]%>" Visible="<%=($this->getPage()->NewJobWizard->ActiveStepIndex != 1%)>" />
+ <div class="w3-center w3-section">
+ <com:TLinkButton CommandName="Cancel" CssClass="w3-button w3-red">
+ <i class="fa fa-times"></i> <%[ Cancel ]%>
+ </com:TLinkButton>
+ <com:TLinkButton
+ ID="PreviousStepBtn"
+ CommandName="PreviousStep"
+ CausesValidation="false"
+ CssClass="w3-button w3-green"
+ >
+ <i class="fa fa-angle-left"></i> <%[ Previous ]%>
+ </com:TLinkButton>
+ <com:TLinkButton
+ CommandName="NextStep"
+ CommandParameter="save"
+ ValidationGroup="NewJobDirective"
+ CssClass="w3-button w3-green"
+ >
+ <%[ Next ]%> <i class="fa fa-angle-right"></i>
+ </com:TLinkButton>
</div>
</prop:StepNavigationTemplate>
<prop:FinishNavigationTemplate>
- <div class="button-cancel"><com:BButton CommandName="Cancel" Text="<%[ Cancel ]%>" /></div>
- <div class="button-prev-next">
- <com:BButton CausesValidation="False" CssClass="bbutton" CommandName="PreviousStep" Text="<%[ « Previous ]%>" />
- <com:BButton CommandName="Complete" Text="<%[ Run restore ]%>" />
+ <div class="w3-center w3-section">
+ <com:TLinkButton
+ CommandName="PreviousStep"
+ CausesValidation="false"
+ CssClass="w3-button w3-green"
+ >
+ <i class="fa fa-angle-left"></i> <%[ Previous ]%>
+ </com:TLinkButton>
+ <com:TLinkButton
+ CommandName="Complete"
+ CommandParameter="save"
+ CssClass="w3-button w3-green"
+ >
+ <%[ Create job ]%> <i class="fa fa-paper-plane"></i>
+ </com:TLinkButton>
+ </div>
</div>
</prop:FinishNavigationTemplate>
<com:TWizardStep ID="Step1" Title="<%[ Step 1 - select job type ]%>" StepType="Auto">
- <h2><%[ New job wizard ]%></h2>
- <p><%[ This wizard enables you to create in easy way new job. ]%></p>
- <p><%[ To start, please select job type that you wish to create. ]%></p>
- <div class="line">
- <div class="text"><com:TLabel ForControl="JobType" Text="<%[ Job type: ]%>" /></div>
- <div class="field">
- <com:TDropDownList
- ID="JobType"
- CssClass="textbox"
- Width="350px"
- CausesValidation="false">
- <com:TListItem Text="Backup" Value="backup" />
- <com:TListItem Text="Restore" Value="restore" />
- <com:TListItem Text="Copy" Value="copy" />
- <com:TListItem Text="Verify" Value="verify" />
- <com:TListItem Text="Migrate" Value="migrate" />
- <com:TListItem Text="Admin" Value="admin" />
- </com:TDropDownList>
- </div>
+ <div class="w3-container">
+ <h2><%[ New job wizard ]%></h2>
+ <p><%[ This wizard enables you to create in easy way a new job. ]%></p>
+ <!--p><%[ To start please select job type that you wish to create. ]%></p-->
+ </div>
+ <div class="w3-container w3-margin-top">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="Type"
+ DirectiveName="Type"
+ Label="<%[ Job Type ]%>"
+ Show="true"
+ ValidationGroup="NewJobDirective"
+ Required="true"
+ />
+ </div>
+ <div class="w3-container w3-margin-top">
+ <com:Application.Web.Portlets.DirectiveTextBox
+ ID="Name"
+ DirectiveName="Name"
+ Label="<%[ Job Name ]%>"
+ ValidationGroup="NewJobDirective"
+ Required="true"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container w3-margin-top">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="JobDefs"
+ DirectiveName="JobDefs"
+ Label="<%[ JobDefs ]%>"
+ Show="true"
+ />
</div>
</com:TWizardStep>
<com:TWizardStep ID="Step2" Title="<%[ Step 2 - what you want to backup ]%>" StepType="Auto">
- <div class="line">
- <div class="text"><com:TLabel ForControl="Client" Text="<%[ Client: ]%>" /></div>
- <div class="field">
- <com:TDropDownList
- ID="Client"
- CssClass="textbox"
- Width="350px"
- CausesValidation="false"
- OnInit="loadClients"
- >
- </com:TDropDownList>
+ <div class="w3-container">
+ <h2><%[ Client and FileSet ]%></h2>
+ <p><%[ Please select Client from which you want to backup data and please select FileSet with files/directories definition to backup. ]%></p>
+ <p><%[ If your FileSet for this backup does not exist yet, you can create it. ]%></p>
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="Client"
+ DirectiveName="Client"
+ Label="<%[ Client ]%>"
+ Show="true"
+ ValidationGroup="NewJobDirective"
+ Required="true"
+ />
+ </div>
+ <div class="w3-container w3-margin-top">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="Fileset"
+ DirectiveName="Fileset"
+ Label="<%[ FileSet ]%>"
+ Show="true"
+ ValidationGroup="NewJobDirective"
+ Required="true"
+ />
+ <span><a href="javascript:void(0)" onclick="$('#job_wizard_new_fileset').slideToggle();" class="w3-button w3-green" ><i class="fa fa-plus"></i> <%[ Add new FileSet ]%></a></span>
+ </div>
+ <div id="fileset_save_ok" class="w3-panel w3-green w3-display-container" style="display: none">
+ <span onclick="this.parentElement.style.display='none'" class="w3-button w3-green w3-large w3-display-topright">x</span>
+ <p><%[ Resource has been saved successfully. ]%></p>
+ </div>
+ <div id="job_wizard_new_fileset" class="w3-card-4 w3-padding w3-margin-top" style="display: none">
+ <h3><%[ New FileSet ]%></h3>
+ <com:Application.Web.Portlets.BaculaConfigDirectives
+ ID="FilesetConfig"
+ ComponentType="dir"
+ ResourceType="Fileset"
+ ShowCancelButton="false"
+ SaveDirectiveActionOk="$('#job_wizard_new_fileset').slideUp(); set_new_fileset(); $('#fileset_save_ok').show();"
+ />
+ </div>
+ <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);
+ }
+ </script>
+ </com:TWizardStep>
+ <com:TWizardStep ID="Step3" Title="<%[ Step 3 - where you want to backup ]%>" StepType="Auto">
+ <div class="w3-container">
+ <h2><%[ Storage and Pool ]%></h2>
+ <p><%[ Please select Storage where you want to backup data and please select Pool with volumes which Storage will use to store backup data. ]%></p>
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="Storage"
+ DirectiveName="Storage"
+ Label="<%[ Storage ]%>"
+ Show="true"
+ ValidationGroup="NewJobDirective"
+ Required="true"
+ />
+ <span><a href="javascript:void(0)" onclick="$('#job_wizard_storage_directives').slideToggle();" class="w3-button w3-green"><i class="fa fa-angle-down"></i> <%[ Show Storage directives for Job ]%></a></span>
+ </div>
+ <div id="job_wizard_storage_directives" class="w3-card-4 w3-padding w3-margin-top" style="display: none">
+ <h3><%[ Spool setting ]%></h3>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveCheckBox
+ ID="SpoolData"
+ DirectiveName="SpoolData"
+ Label="<%[ Spool Data ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveCheckBox
+ ID="SpoolAttributes"
+ DirectiveName="SpoolAttributes"
+ Label="<%[ Spool Attributes ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveSize
+ ID="SpoolSize"
+ DirectiveName="SpoolSize"
+ Label="<%[ Spool Size ]%>"
+ Show="true"
+ />
+ </div>
+ </div>
+ <div class="w3-container w3-margin-top">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="Pool"
+ DirectiveName="Pool"
+ Label="<%[ Pool ]%>"
+ Show="true"
+ ValidationGroup="NewJobDirective"
+ Required="true"
+ />
+ <span><a href="javascript:void(0)" onclick="$('#job_wizard_pool_directives').hide(); $('#job_wizard_new_pool').slideToggle();" class="w3-button w3-green"><i class="fa fa-plus"></i> <%[ Add new Pool ]%></a></span>
+ <span><a href="javascript:void(0)" onclick="$('#job_wizard_new_pool').hide(); $('#job_wizard_pool_directives').slideToggle();" class="w3-button w3-green"><i class="fa fa-angle-down"></i> <%[ Show Pool directives for Job ]%></a></span>
+ </div>
+ <div id="pool_save_ok" class="w3-panel w3-green w3-display-container" style="display: none">
+ <span onclick="this.parentElement.style.display='none'" class="w3-button w3-green w3-large w3-display-topright">x</span>
+ <p><%[ Resource has been saved successfully. ]%></p>
+ </div>
+ <div id="job_wizard_new_pool" class="w3-card-4 w3-padding w3-margin-top" style="display: none">
+ <h3><%[ New Pool ]%></h3>
+ <com:Application.Web.Portlets.BaculaConfigDirectives
+ ID="PoolConfig"
+ ComponentType="dir"
+ ResourceType="Pool"
+ ShowCancelButton="false"
+ SaveDirectiveActionOk="$('#job_wizard_new_pool').slideUp(); set_new_pool(); $('#pool_save_ok').show();"
+ />
+ </div>
+ <div id="job_wizard_pool_directives" class="w3-card-4 w3-padding w3-margin-top" style="display: none">
+ <h3><%[ Pool setting ]%></h3>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="FullBackupPool"
+ DirectiveName="FullBackupPool"
+ Label="<%[ Full Backup Pool ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="IncrementalBackupPool"
+ DirectiveName="IncrementalBackupPool"
+ Label="<%[ Incremental Backup Pool ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="DifferentialBackupPool"
+ DirectiveName="DifferentialBackupPool"
+ Label="<%[ Differential Backup Pool ]%>"
+ Show="true"
+ />
</div>
</div>
+ <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);
+ }
+ </script>
</com:TWizardStep>
- <com:TWizardStep ID="Step6" Title="<%[ Step 6 - Summary ]%>" StepType="Finish">
+ <com:TWizardStep ID="Step4" Title="<%[ Step 4 - how would you like to backup ]%>" StepType="Auto">
+ <div class="w3-container">
+ <h2><%[ Backup Job directives ]%></h2>
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveCheckBox
+ ID="Accurate"
+ DirectiveName="Accurate"
+ DefaultValue="0"
+ Label="<%[ Accurate ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveTextBox
+ ID="MaximumConcurrentJobs"
+ DirectiveName="MaximumConcurrentJobs"
+ DefaultValue="1"
+ Label="<%[ Maximum Concurrent Jobs ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveTextBox
+ ID="Priority"
+ DirectiveName="Priority"
+ DefaultValue="10"
+ Label="<%[ Priority ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveCheckBox
+ ID="ReRunFailedLevels"
+ DirectiveName="ReRunFailedLevels"
+ DefaultValue="0"
+ Label="<%[ ReRun Failed Levels ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <h2><%[ Other directives ]%></h2>
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="Messages"
+ DirectiveName="Messages"
+ Label="<%[ Messages ]%>"
+ Show="true"
+ ValidationGroup="NewJobDirective"
+ Required="true"
+ />
+ </div>
+ </com:TWizardStep>
+ <com:TWizardStep ID="Step5" Title="<%[ Step 5 - when would you like to run backup ]%>" StepType="Auto">
+ <div class="w3-container">
+ <h2><%[ Schedule ]%></h2>
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="Schedule"
+ DirectiveName="Schedule"
+ Label="<%[ Schedule ]%>"
+ Show="true"
+ />
+ <span><a href="javascript:void(0)" onclick="$('#job_wizard_schedule_directives').hide(); $('#job_wizard_new_schedule').slideToggle();" class="w3-button w3-green"><i class="fa fa-plus"></i> <%[ Add new Schedule ]%></a></span>
+ <span><a href="javascript:void(0)" onclick="$('#job_wizard_new_schedule').hide(); $('#job_wizard_reschedule_directives').slideToggle();" class="w3-button w3-green"><i class="fa fa-angle-down"></i> <%[ Show Reschedule directives ]%></a></span>
+ </div>
+ <div id="schedule_save_ok" class="w3-panel w3-green w3-display-container" style="display: none">
+ <span onclick="this.parentElement.style.display='none'" class="w3-button w3-green w3-large w3-display-topright">x</span>
+ <p><%[ Resource has been saved successfully. ]%></p>
+ </div>
+ <div id="job_wizard_new_schedule" class="w3-card-4 w3-padding w3-margin-top" style="display: none">
+ <h3><%[ New Schedule ]%></h3>
+ <com:Application.Web.Portlets.BaculaConfigDirectives
+ ID="ScheduleConfig"
+ ComponentType="dir"
+ ResourceType="Schedule"
+ ShowCancelButton="false"
+ SaveDirectiveActionOk="$('#job_wizard_new_schedule').slideUp(); set_new_schedule(); $('#schedule_save_ok').show();"
+ />
+ </div>
+ <div id="job_wizard_reschedule_directives" class="w3-card-4 w3-padding w3-margin-top" style="display: none">
+ <h3><%[ Reschedule setting ]%></h3>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveCheckBox
+ ID="RescheduleOnError"
+ DirectiveName="RescheduleOnError"
+ DefaultValue="0"
+ Label="<%[ Reschedule On Error ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveCheckBox
+ ID="RescheduleIncompleteJobs"
+ DirectiveName="RescheduleIncompleteJobs"
+ DefaultValue="0"
+ Label="<%[ Reschedule Incomplete Jobs ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveTimePeriod
+ ID="RescheduleInterval"
+ DirectiveName="RescheduleInterval"
+ DefaultValue="1800"
+ Label="<%[ Reschedule Interval ]%>"
+ Show="true"
+ />
+ </div>
+ <div class="w3-container">
+ <com:Application.Web.Portlets.DirectiveInteger
+ ID="RescheduleTimes"
+ DirectiveName="RescheduleTimes"
+ Label="<%[ Reschedule Times ]%>"
+ Show="true"
+ />
+ </div>
+ </div>
+ <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);
+ }
+ </script>
+ </com:TWizardStep>
+ <com:TWizardStep ID="Step6" Title="<%[ Step 6 - summary ]%>" StepType="Finish">
<fieldset>
- <legend><%[ Source parameters ]%></legend>
- <div class="line">
- <div class="text"><%[ Backup data from client: ]%></div>
- <div class="field bold"><%=$this->BackupClientName->SelectedValue%></div>
+ <legend><%[ General ]%></legend>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Job Type ]%></div>
+ <div class="w3-threequarter bold"><%=$this->Type->getDirectiveValue()%></div>
</div>
- <div class="line">
- <div class="text"><%[ Backup selection method: ]%></div>
- <div class="field bold">
- <com:TLabel Text="<%[ Only selected backup ]%>" Visible="<%=$this->OnlySelectedBackupSelection->Checked%>" />
- <com:TLabel Text="<%[ Group most recent backups ]%>" Visible="<%=$this->GroupBackupSelection->Checked%>" />
- </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Job Name ]%></div>
+ <div class="w3-threequarter bold"><%=$this->Name->getDirectiveValue()%></div>
</div>
- <div class="line">
- <div class="text"><%[ Backup for restore: ]%></div>
- <div class="field bold">
- <com:TLabel Text="<%=$this->GroupBackupToRestore->SelectedValue%>" Visible="<%=$this->GroupBackupSelection->Checked%>" />
- </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ JobDefs ]%></div>
+ <div class="w3-threequarter bold"><%=$this->JobDefs->getDirectiveValue()%></div>
</div>
- <com:TPanel Visible="<%=$this->GroupBackupSelection->Checked%>">
- <div class="line">
- <div class="text"><%[ FileSet for restore: ]%></div>
- <div class="field bold"><%=$this->GroupBackupFileSet->SelectedValue%></div>
- </div>
- </com:TPanel>
</fieldset>
<fieldset>
- <legend><%[ Files for restore ]%></legend>
- <div class="line">
- <div class="text"><%[ Selected directories count: ]%></div>
- <div class="field bold"><%=isset($this->getRestoreElements(true)->dirid) ? count($this->getRestoreElements(true)->dirid) : '0'%></div>
+ <legend><%[ What ]%></legend>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Client ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->Client->getDirectiveValue()%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('Client', $this->Client->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
</div>
- <div class="line">
- <div class="text"><%[ Selected files count: ]%></div>
- <div class="field bold"><%=isset($this->getRestoreElements(true)->fileid) ? count($this->getRestoreElements(true)->fileid) : '0'%></div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ FileSet ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->Fileset->getDirectiveValue()%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('Fileset', $this->Fileset->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
</div>
</fieldset>
<fieldset>
- <legend><%[ Destination parameters ]%></legend>
- <div class="line">
- <div class="text"><%[ Restore to client: ]%></div>
- <div class="field bold"><%=$this->RestoreClient->SelectedValue%></div>
+ <legend><%[ Where ]%></legend>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Storage ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->Storage->getDirectiveValue()%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('Storage', $this->Storage->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Spool Data ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->SpoolData->getDirectiveValue() ? Prado::localize('Yes') : Prado::localize('No')%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('SpoolData', $this->SpoolData->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
</div>
- <div class="line">
- <div class="text"><%[ Restore to path: ]%></div>
- <div class="field bold"><%=$this->RestorePath->Text%></div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Spool Attributes ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->SpoolAttributes->getDirectiveValue() ? Prado::localize('Yes') : Prado::localize('No')%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('SpoolAttributes', $this->SpoolAttributes->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Spool Size ]%></div>
+ <div class="w3-threequarter bold size">
+ <%=$this->SpoolSize->getDirectiveValue() ?: '0'%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('SpoolSize', $this->SpoolSize->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Pool ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->Pool->getDirectiveValue()%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('Pool', $this->Pool->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Full Backup Pool ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->FullBackupPool->getDirectiveValue() ?: '-'%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('FullBackupPool', $this->FullBackupPool->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Incremental Backup Pool ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->IncrementalBackupPool->getDirectiveValue() ?: '-'%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('IncrementalBackupPool', $this->IncrementalBackupPool->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Differential Backup Pool ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->DifferentialBackupPool->getDirectiveValue() ?: '-'%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('DifferentialBackupPool', $this->DifferentialBackupPool->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
</div>
</fieldset>
<fieldset>
- <legend><%[ Restore job options ]%></legend>
- <div class="line">
- <div class="text"><%[ Restore job: ]%></div>
- <div class="field bold"><%=$this->RestoreJob->Text%></div>
+ <legend><%[ How ]%></legend>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Accurate ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->Accurate->getDirectiveValue() ? Prado::localize('Yes') : Prado::localize('No') %>
+ <span class="w3-small normal"><%=$this->isInJobDefs('Accurate', $this->Accurate->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
</div>
- <div class="line">
- <div class="text"><%[ Replace files: ]%></div>
- <div class="field bold">
- <com:TLabel Visible="<%=$this->ReplaceFiles->SelectedValue == 'never'%>" Text="<%[ do not replace files ]%>"/>
- <com:TLabel Visible="<%=$this->ReplaceFiles->SelectedValue == 'ifolder'%>" Text="<%[ if files from restore are older]%>"/>
- <com:TLabel Visible="<%=$this->ReplaceFiles->SelectedValue == 'ifnewer'%>" Text="<%[ if files from restore are newer]%>"/>
- <com:TLabel Visible="<%=$this->ReplaceFiles->SelectedValue == 'always'%>" Text="<%[ always replace files ]%>"/>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Maximum Concurrent Jobs ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->MaximumConcurrentJobs->getDirectiveValue() ?: $this->MaximumConcurrentJobs->getDefaultValue()%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('MaximumConcurrentJobs', $this->MaximumConcurrentJobs->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
</div>
</div>
- <div class="line">
- <div class="text"><%[ Restore job priority: ]%></div>
- <div class="field bold"><%=$this->RestoreJobPriority->Text%></div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Priority ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->Priority->getDirectiveValue() ?: $this->Priority->getDefaultValue()%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('Priority', $this->Priority->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
</div>
- <div class="line">
- <div class="text"><%[ File relocation option: ]%></div>
- <div class="field bold">
- <com:TLabel Visible="<%=$this->file_relocation_opt == 1%>" Text="<%[ Do not relocate files ]%>"/>
- <com:TLabel Visible="<%=$this->file_relocation_opt == 2%>" Text="<%[ Relocate files with prefix and/or suffix ]%>"/>
- <com:TLabel Visible="<%=$this->file_relocation_opt == 3%>" Text="<%[ Relocate files with regular expression ]%>"/>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ ReRun Failed Levels ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->ReRunFailedLevels->getDirectiveValue() ? Prado::localize('Yes') : Prado::localize('No') %>
+ <span class="w3-small normal"><%=$this->isInJobDefs('ReRunFailedLevels', $this->ReRunFailedLevels->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
</div>
</div>
- <div style="display: <%=$this->file_relocation_opt == 2 ? 'block' : 'none'%>">
- <div class="line">
- <div class="text"><%[ Strip prefix: ]%></div>
- <div class="field bold"><%=$this->RestoreStripPrefix->Text%></div>
+ </fieldset>
+ <fieldset>
+ <legend><%[ When ]%></legend>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Schedule ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->Schedule->getDirectiveValue() ?: '-' %>
+ <span class="w3-small normal"><%=$this->isInJobDefs('Schedule', $this->Schedule->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
</div>
- <div class="line">
- <div class="text"><%[ Add prefix: ]%></div>
- <div class="field bold"><%=$this->RestoreAddPrefix->Text%></div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Reschedule On Error ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->RescheduleOnError->getDirectiveValue() ? Prado::localize('Yes') : Prado::localize('No') %>
+ <span class="w3-small normal"><%=$this->isInJobDefs('RescheduleOnError', $this->RescheduleOnError->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
</div>
- <div class="line">
- <div class="text"><%[ Add suffix: ]%></div>
- <div class="field bold"><%=$this->RestoreAddSuffix->Text%></div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Reschedule Incomplete Jobs ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->RescheduleIncompleteJobs->getDirectiveValue() ? Prado::localize('Yes') : Prado::localize('No') %>
+ <span class="w3-small normal"><%=$this->isInJobDefs('RescheduleIncompleteJobs', $this->RescheduleIncompleteJobs->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
+ </div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Reschedule Interval ]%></div>
+ <div class="w3-threequarter bold time">
+ <%=$this->RescheduleInterval->getDirectiveValue()%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('RescheduleInterval', $this->RescheduleInterval->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
</div>
</div>
- <div style="display: <%=$this->file_relocation_opt == 3 ? 'block' : 'none'%>">
- <div class="line">
- <div class="text"><%[ RegexWhere: ]%></div>
- <div class="field bold"><%=$this->RestoreRegexWhere->Text%></div>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Reschedule Times ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->RescheduleTimes->getDirectiveValue() ?: '-'%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('RescheduleTimes', $this->RescheduleTimes->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
+ </div>
+ </div>
+ </fieldset>
+ <fieldset>
+ <legend><%[ Other directives ]%></legend>
+ <div class="w3-container">
+ <div class="w3-quarter"><%[ Messages ]%></div>
+ <div class="w3-threequarter bold">
+ <%=$this->Messages->getDirectiveValue() ?: '-'%>
+ <span class="w3-small normal"><%=$this->isInJobDefs('Messages', $this->Messages->getDirectiveValue()) ? ' (' . Prado::localize('inherited from JobDefs') . ')': ''%></span>
</div>
</div>
</fieldset>
+ <com:TActiveLabel ID="CreateResourceErrorMsg" Display="None" CssClass="w3-text-red"></com:TActiveLabel>
</com:TWizardStep>
</com:TWizard>
+ <script type="text/javascript">
+ function set_new_resource(container_id, resource_id) {
+ var resource_container = document.getElementById(container_id);
+ var new_resource = resource_container.querySelector('div.directive_value input').value;
+ var resource_el = document.getElementById(resource_id);
+ var opt = document.createElement('OPTION');
+ var txt = document.createTextNode(new_resource);
+ opt.appendChild(txt);
+ opt.value = new_resource;
+ resource_el.appendChild(opt);
+ resource_el.value = new_resource;
+ }
+ </script>
</com:TContent>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2018 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
*/
Prado::using('Application.Web.Class.BaculumWebPage');
+Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
Prado::using('System.Web.UI.WebControls.TWizard');
class NewJobWizard extends BaculumWebPage {
+ const PREV_STEP = 'PrevStep';
+ const JOBDEFS = 'JobDefs';
+
+ public function onLoad($param) {
+ parent::onLoad($param);
+ $this->JobDefs->saveDirective();
+ $this->Client->saveDirective();
+ $this->Fileset->saveDirective();
+ $this->Storage->saveDirective();
+ $this->Pool->saveDirective();
+ $this->FullBackupPool->saveDirective();
+ $this->IncrementalBackupPool->saveDirective();
+ $this->DifferentialBackupPool->saveDirective();
+ $this->Messages->saveDirective();
+ $this->Schedule->saveDirective();
+ }
+
+ public function onLoadComplete($param) {
+ parent::onLoadComplete($param);
+ $step_index = $this->NewJobWizard->getActiveStepIndex();
+ $prev_step = $this->getPrevStep();
+ $this->setPrevStep($step_index);
+ if ($prev_step > $step_index) {
+ return;
+ }
+ switch ($step_index) {
+ case 0: {
+ $this->loadJobTypes();
+ $this->loadJobDefs();
+ break;
+ }
+ case 1: {
+ $this->setupJobDefs();
+ $this->loadClients();
+ $this->loadFilesets();
+ $this->loadNewFilesetForm();
+ break;
+ }
+ case 2: {
+ $this->loadStorages();
+ $this->loadNewPoolForm();
+ $this->loadPools();
+ break;
+ }
+ case 3: {
+ $this->loadBackupJobDirectives();
+ $this->loadMessages();
+ break;
+ }
+ case 4: {
+ $this->loadRescheduleDirectives();
+ $this->loadNewScheduleForm();
+ $this->loadSchedules();
+ break;
+ }
+ }
+ }
+
+ /**
+ * Wizard previous button callback actions.
+ *
+ * @param TWizard $sender sender object
+ * @param TWizardNavigationEventParameter $param sender parameters
+ * @return none
+ */
+ public function wizardPrev($sender, $param) {
+ }
+
+ /**
+ * Wizard next button callback actions.
+ *
+ * @param TWizard $sender sender object
+ * @param TWizardNavigationEventParameter $param sender parameters
+ * @return none
+ */
+ public function wizardNext($sender, $param) {
+ }
+
+ /**
+ * Load Job Types (step 1).
+ *
+ * @return none
+ */
+ public function loadJobTypes() {
+ //$jobtype_list = array('Backup', 'Restore', 'Copy', 'Verify', 'Migrate', 'Admin');
+ $jobtype_list = array('Backup');
+ asort($jobtype_list);
+ $this->Type->setData($jobtype_list);
+ $this->Type->setDirectiveValue($jobtype_list[0]);
+ $this->Type->onLoad(null);
+ }
+
+ /**
+ * Load JobDefs (step 1).
+ *
+ * @return none
+ */
+ public function loadJobDefs() {
+ $jobdefs_list = array();
+ $jobdefs = $this->getModule('api')->get(array('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);
+ }
+
+ /**
+ * Setup and remember selected JobDefs values to use in next wizard steps.
+ *
+ * @return none
+ */
+ public function setupJobDefs() {
+ $directive_value = $this->JobDefs->getDirectiveValue();
+ if (is_null($directive_value)) {
+ return;
+ }
+ $jobdefs = rawurlencode($directive_value);
+ $result = $this->getModule('api')->get(array(
+ 'config', 'dir', 'jobdefs', $jobdefs
+ ));
+ if ($result->error === 0) {
+ $value = (array)$result->output;
+ $this->setJobDefs($value);
+ }
+ }
+
+ public function isInJobDefs($directive_name, $directive_value) {
+ $jobdefs = $this->getJobDefs();
+ $ret = false;
+ if ($directive_name === 'Storage') {
+ $ret = (key_exists($directive_name, $jobdefs) && $jobdefs[$directive_name][0] === $directive_value);
+ } else {
+ $ret = (key_exists($directive_name, $jobdefs) && $jobdefs[$directive_name] === $directive_value);
+ }
+ return $ret;
+ }
+
/**
* Load client list (step 2).
*
- * @param TActiveDropDownList $sender sender object
- * @param TCommandParameter $param parameters object
* @return none
*/
- public function loadClients($sender, $param) {
+ public function loadClients() {
$client_list = array();
$clients = $this->getModule('api')->get(array('clients'))->output;
for ($i = 0; $i < count($clients); $i++) {
$client_list[$clients[$i]->name] = $clients[$i]->name;
}
asort($client_list);
- $this->Client->dataSource = $client_list;
- $this->Client->dataBind();
+ $this->Client->setData($client_list);
+ $jobdefs = $this->getJobDefs();
+ if (key_exists('Client', $jobdefs) && is_null($this->Client->getDirectiveValue())) {
+ $this->Client->setDirectiveValue($jobdefs['Client']);
+ }
+ $this->Client->onLoad(null);
}
/**
- * Wizard next button callback actions.
+ * Load fileset list (step 2).
*
- * @param TWizard $sender sender object
- * @param TWizardNavigationEventParameter $param sender parameters
* @return none
*/
- public function wizardNext($sender, $param) {
+ public function loadFilesets() {
+ $fileset_list = array();
+ $filesets = $this->getModule('api')->get(array('config', 'dir', 'fileset'))->output;
+ for ($i = 0; $i < count($filesets); $i++) {
+ $fileset_list[] = $filesets[$i]->Fileset->Name;
+ }
+ 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);
}
/**
- * Wizard prev button callback actions.
+ * Load new fileset form.
*
- * @param TWizard $sender sender object
- * @param TWizardNavigationEventParameter $param sender parameters
* @return none
*/
- public function wizardPrev($sender, $param) {
+ public function loadNewFilesetForm() {
+ if ($this->IsCallBack) {
+ return;
+ }
+ if (!empty($_SESSION['dir'])) {
+ $this->FilesetConfig->setComponentName($_SESSION['dir']);
+ $this->FilesetConfig->setLoadValues(false);
+ $this->FilesetConfig->raiseEvent('OnDirectiveListLoad', $this, null);
+ }
+ }
+
+ /**
+ * Load new pool form.
+ *
+ * @return none
+ */
+ public function loadNewPoolForm() {
+ if ($this->IsCallBack) {
+ return;
+ }
+ if (!empty($_SESSION['dir'])) {
+ $this->PoolConfig->setComponentName($_SESSION['dir']);
+ $this->PoolConfig->setLoadValues(false);
+ $this->PoolConfig->raiseEvent('OnDirectiveListLoad', $this, null);
+ }
+ }
+
+ /**
+ * Load new schedule form.
+ *
+ * @return none
+ */
+ public function loadNewScheduleForm() {
+ if ($this->IsCallBack) {
+ return;
+ }
+ if (!empty($_SESSION['dir'])) {
+ $this->ScheduleConfig->setComponentName($_SESSION['dir']);
+ $this->ScheduleConfig->setLoadValues(false);
+ $this->ScheduleConfig->raiseEvent('OnDirectiveListLoad', $this, null);
+ }
+ }
+
+ /**
+ * Load storage list (step 2).
+ *
+ * @return none
+ */
+ public function loadStorages() {
+ $storage_list = array();
+ $storages = $this->getModule('api')->get(array('config', 'dir', 'storage'))->output;
+ for ($i = 0; $i < count($storages); $i++) {
+ $storage_list[] = $storages[$i]->Storage->Name;
+ }
+ asort($storage_list);
+ $this->Storage->setData($storage_list);
+ $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->onLoad(null);
+ if (key_exists('SpoolData', $jobdefs) && is_null($this->SpoolData->getDirectiveValue())) {
+ $this->SpoolData->setDirectiveValue($jobdefs['SpoolData']);
+ $this->SpoolData->createDirective();
+ }
+ if (key_exists('SpoolAttributes', $jobdefs) && is_null($this->SpoolAttributes->getDirectiveValue())) {
+ $this->SpoolAttributes->setDirectiveValue($jobdefs['SpoolAttributes']);
+ $this->SpoolAttributes->createDirective();
+ }
+ if (key_exists('SpoolSize', $jobdefs) && is_null($this->SpoolSize->getDirectiveValue())) {
+ $this->SpoolSize->setDirectiveValue($jobdefs['SpoolSize']);
+ $this->SpoolSize->createDirective();
+ }
+ }
+
+ /**
+ * Load pool list (step 2).
+ *
+ * @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);
+ $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->IncrementalBackupPool->setData($pool_list);
+ if (key_exists('IncrementalBackupPool', $jobdefs) && is_null($this->IncrementalBackupPool->getDirectiveValue())) {
+ $this->IncrementalBackupPool->setDirectiveValue($jobdefs['IncrementalBackupPool']);
+ }
+ $this->IncrementalBackupPool->onLoad(null);
+ $this->DifferentialBackupPool->setData($pool_list);
+ if (key_exists('DifferentialBackupPool', $jobdefs) && is_null($this->DifferentialBackupPool->getDirectiveValue())) {
+ $this->DifferentialBackupPool->setDirectiveValue($jobdefs['DifferentialBackupPool']);
+ }
+ $this->DifferentialBackupPool->onLoad(null);
+ if (key_exists('Pool', $jobdefs) && is_null($this->Pool->getDirectiveValue())) {
+ $this->Pool->setDirectiveValue($jobdefs['Pool']);
+ }
+ $this->Pool->onLoad(null);
+ }
+
+ public function loadBackupJobDirectives() {
+ $jobdefs = $this->getJobDefs();
+ if (key_exists('Accurate', $jobdefs) && is_null($this->Accurate->getDirectiveValue())) {
+ $this->Accurate->setDirectiveValue($jobdefs['Accurate']);
+ $this->Accurate->createDirective();
+ }
+ if (key_exists('MaximumConcurrentJobs', $jobdefs) && is_null($this->MaximumConcurrentJobs->getDirectiveValue())) {
+ $this->MaximumConcurrentJobs->setDirectiveValue($jobdefs['MaximumConcurrentJobs']);
+ $this->MaximumConcurrentJobs->createDirective();
+ }
+ if (key_exists('Priority', $jobdefs) && is_null($this->Priority->getDirectiveValue())) {
+ $this->Priority->setDirectiveValue($jobdefs['Priority']);
+ $this->Priority->createDirective();
+ }
+ if (key_exists('ReRunFailedLevels', $jobdefs) && is_null($this->ReRunFailedLevels->getDirectiveValue())) {
+ $this->ReRunFailedLevels->setDirectiveValue($jobdefs['ReRunFailedLevels']);
+ $this->ReRunFailedLevels->createDirective();
+ }
+ }
+
+ public function loadRescheduleDirectives() {
+ $jobdefs = $this->getJobDefs();
+ if (key_exists('RescheduleOnError', $jobdefs) && is_null($this->RescheduleOnError->getDirectiveValue())) {
+ $this->RescheduleOnError->setDirectiveValue($jobdefs['RescheduleOnError']);
+ $this->RescheduleOnError->createDirective();
+ }
+ if (key_exists('RescheduleIncompleteJobs', $jobdefs) && is_null($this->RescheduleIncompleteJobs->getDirectiveValue())) {
+ $this->RescheduleIncompleteJobs->setDirectiveValue($jobdefs['RescheduleIncompleteJobs']);
+ $this->RescheduleIncompleteJobs->createDirective();
+ }
+ if (key_exists('RescheduleInterval', $jobdefs) && is_null($this->RescheduleInterval->getDirectiveValue())) {
+ $this->RescheduleInterval->setDirectiveValue($jobdefs['RescheduleInterval']);
+ $this->RescheduleInterval->createDirective();
+ }
+ if (key_exists('RescheduleTimes', $jobdefs) && is_null($this->RescheduleTimes->getDirectiveValue())) {
+ $this->RescheduleTimes->setDirectiveValue($jobdefs['RescheduleTimes']);
+ $this->RescheduleTimes->createDirective();
+ }
+ }
+
+ /**
+ * Load messages.
+ *
+ * @return none
+ */
+ public function loadMessages() {
+ $message_list = array();
+ $messages = $this->getModule('api')->get(array('config', 'dir', 'messages'))->output;
+ for ($i = 0; $i < count($messages); $i++) {
+ $message_list[] = $messages[$i]->Messages->Name;
+ }
+ asort($message_list);
+ $this->Messages->setData($message_list);
+ $jobdefs = $this->getJobDefs();
+ if (key_exists('Messages', $jobdefs)) {
+ $this->Messages->setDirectiveValue($jobdefs['Messages']);
+ }
+ $this->Messages->onLoad(null);
+ }
+
+ /**
+ * Load schedule.
+ *
+ * @return none
+ */
+ public function loadSchedules() {
+ $schedule_list = array();
+ $schedules = $this->getModule('api')->get(array('config', 'dir', 'schedule'))->output;
+ for ($i = 0; $i < count($schedules); $i++) {
+ $schedule_list[] = $schedules[$i]->Schedule->Name;
+ }
+ 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);
+ }
+
+ public function wizardCompleted($sender, $param) {
+ $jobdefs = $this->getJobDefs();
+ $job = array(
+ 'Name' => $this->Name->getDirectiveValue(),
+ 'Type' => $this->Type->getDirectiveValue(),
+ );
+ $jd = $this->JobDefs->getDirectiveValue();
+ $directives = array('Client', 'Fileset', 'Storage', 'SpoolData', 'SpoolAttributes',
+ 'SpoolSize', 'Pool', 'FullBackupPool', 'IncrementalBackupPool', 'DifferentialBackupPool',
+ 'Accurate', 'MaximumConcurrentJobs', 'Priority', 'ReRunFailedLevels', 'Schedule',
+ 'RescheduleOnError', 'RescheduleIncompleteJobs', 'RescheduleInterval', 'RescheduleTimes',
+ 'Messages'
+ );
+ if (is_string($jd)) {
+ $job['JobDefs'] = $jd;
+ }
+ for ($i = 0; $i < count($directives); $i++) {
+ $val = $this->{$directives[$i]}->getDirectiveValue();
+ if (is_null($val)) {
+ continue;
+ }
+ if (is_null($jd) || !$this->isInJobDefs($directives[$i], $val)) {
+ $job[$directives[$i]] = $val;
+ }
+ }
+ $params = array(
+ 'config',
+ 'dir',
+ 'Job',
+ $job['Name']
+ );
+ $result = $this->getModule('api')->set(
+ $params,
+ array('config' => json_encode($job))
+ );
+ if ($result->error === 0) {
+ $this->getModule('api')->set(array('console'), array('reload'));
+ $this->goToPage('JobList');
+ } else {
+ $this->CreateResourceErrMsg->Display = 'None';
+ $this->CreateResourceErrMsg->Text = '';
+ }
+ }
+
+ /**
+ * Cancel wizard.
+ *
+ * @return none
+ */
+ public function wizardStop($sender, $param) {
+ $this->goToDefaultPage();
+ }
+
+ /**
+ * Set selected JobDefs values.
+ *
+ * @param $jobdefs selected JobDefs values
+ * @return none
+ */
+ public function setJobDefs($jobdefs) {
+ $this->setViewState(self::JOBDEFS, $jobdefs);
+ }
+
+ /**
+ * Get selected JobDefs values.
+ *
+ * @return array selected JobDefs values
+ */
+ public function getJobDefs() {
+ return $this->getViewState(self::JOBDEFS, array());
+ }
+
+ /**
+ * Set previous wizard step.
+ *
+ * @param integer $step previous step number
+ * @return none
+ */
+ public function setPrevStep($step) {
+ $step = intval($step);
+ $this->setViewState(self::PREV_STEP, $step);
+ }
+
+ /**
+ * Get previous wizard step.
+ *
+ * @return integer previous wizard step
+ */
+ public function getPrevStep() {
+ return $this->getViewState(self::PREV_STEP);
}
}
?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2019 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.TTemplateControl');
-Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter');
+Prado::using('System.Web.UI.WebControls.TConditional');
-class BConditional extends TTemplateControl implements IActiveControl {
+class BConditional extends TTemplateControl implements IDataRenderer, IActiveControl {
const BCONDITION = 'BCondition';
const TYPE_TPL_FALSE = 0;
private $item_true_template;
private $item_false_template;
+ private $data;
+ private $creating_children = false;
+
+ public function onInit($param) {
+ parent::onInit($param);
+ }
public function __construct() {
parent::__construct();
return $this->getAdapter()->getBaseActiveControl();
}
- public function onLoad($param) {
- $this->prepareControlContent();
- parent::onLoad($param);
+ public function getData() {
+ return $this->data;
}
- public function bubbleEvent($sender, $param) {
- if ($param instanceof Prado\Web\UI\TCommandEventParameter) {
- $this->raiseBubbleEvent($this, $param);
- return true;
- } else {
- return false;
- }
+ public function setData($data) {
+ $this->data = $data;
}
- private function createItemInternal($item_type) {
- $item = $this->createItem($item_type);
- if (!is_null($item)) {
- $this->getControls()->add($item);
- }
- return $item;
+ public function setCondition($value) {
+ settype($value, 'bool');
+ $this->setViewState(self::BCONDITION, $value);
}
- protected function createItem($item_type) {
- $template = null;
- $item = null;
- switch ($item_type) {
- case self::TYPE_TPL_TRUE: {
- $template = $this->getTrueTemplate();
- break;
- }
- case self::TYPE_TPL_FALSE: {
- $template = $this->getFalseTemplate();
- break;
+ public function getCondition() {
+ return $this->getViewState(self::BCONDITION);
+ }
+
+ public function createChildControls()
+ {
+ $this->creating_children = true;
+ $this->dataBindProperties();
+ $result = $this->getCondition();
+ $true_template = $this->getTrueTemplate();
+ $false_template = $this->getFalseTemplate();
+ if ($result) {
+ if ($true_template) {
+ $true_template->instantiateIn($this->getTemplateControl(), $this);
}
+ } elseif ($false_template) {
+ $false_template->instantiateIn($this->getTemplateControl(), $this);
}
- if (!is_null($template)) {
- $item = new BConditionalItem;
- $item->setItemType($item_type);
- $item->setTemplate($template);
- $item->setTemplateControl($this);
- $item->setData($this->getTemplateControl());
+ $this->setData($this->getTemplateControl());
+ $this->creating_children = false;
+ }
+
+ public function addParsedObject($object)
+ {
+ if ($this->creating_children) {
+ parent::addParsedObject($object);
}
- return $item;
}
public function getTrueTemplate() {
$this->item_false_template = $template;
}
}
-
- public function setBCondition($value) {
- settype($value, 'bool');
- $this->setViewState(self::BCONDITION, $value);
- }
-
- public function getBCondition() {
- return $this->getViewState(self::BCONDITION);
- }
-
- public function dataBind() {
- $this->dataBindProperties();
- $this->prepareControlContent();
- }
-
- public function prepareControlContent() {
- if ($this->getBCondition() === true) {
- $this->createItemInternal(self::TYPE_TPL_TRUE);
- } else {
- $this->createItemInternal(self::TYPE_TPL_FALSE);
- }
- }
-}
-
-class BConditionalItem extends TTemplateControl implements IDataRenderer, INamingContainer {
- private $item_type;
- private $data;
-
- public function getItemType() {
- return $this->item_type;
- }
-
- public function setItemType($type) {
- $this->item_type = $type;
- }
-
- public function getData() {
- return $this->data;
- }
-
- public function setData($data) {
- $this->data = $data;
- }
-
- public function bubbleEvent($sender,$param) {
- if ($param instanceof Prado\Web\UI\TCommandEventParameter) {
- $this->raiseBubbleEvent($this, $param);
- return true;
- } else {
- return false;
- }
- }
}
?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2018 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
Prado::using('System.Web.UI.ActiveControls.TActivePanel');
Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
-Prado::using('Application.Web.Portlets.BConditional');
Prado::using('Application.Web.Portlets.DirectiveListTemplate');
-Prado::using('Application.Web.Portlets.DirectiveBoolean');
+Prado::using('Application.Web.Portlets.DirectiveCheckBox');
Prado::using('Application.Web.Portlets.DirectiveComboBox');
Prado::using('Application.Web.Portlets.DirectiveInteger');
Prado::using('Application.Web.Portlets.DirectiveListBox');
Prado::using('Application.Web.Portlets.DirectiveSize');
-Prado::using('Application.Web.Portlets.DirectiveText');
+Prado::using('Application.Web.Portlets.DirectiveTextBox');
Prado::using('Application.Web.Portlets.DirectiveTimePeriod');
Prado::using('Application.Web.Portlets.DirectiveRunscript');
Prado::using('Application.Web.Portlets.DirectiveMessages');
public $resource_names = array();
private $directive_types = array(
- 'DirectiveBoolean',
+ 'DirectiveCheckBox',
'DirectiveComboBox',
'DirectiveInteger',
'DirectiveListBox',
- 'DirectiveText',
+ 'DirectiveTextBox',
'DirectiveSize',
'DirectiveTimePeriod'
);
));
}
}
+
$data_desc = $this->Application->getModule('data_desc');
$resource_desc = $data_desc->getDescription($component_type, $resource_type);
foreach ($resource_desc as $directive_name => $directive_desc) {
if (is_object($directive_value)) {
$directive_value = (array)$directive_value;
}
+
+ if ($directive_name === 'Include' || $directive_name === 'Exclude' || $directive_name === 'Runscript') {
+ // provide all include blocks at once
+ $directive_value = array(array(
+ $directive_name => $directive_value,
+ ));
+ if (property_exists($config, 'Exclude')) {
+ $directive_value[0]['Exclude'] = (array)$config->{'Exclude'};
+ }
+ }
+
+ if ($directive_name === 'Exclude') {
+ continue;
+ }
+
foreach ($directive_value as $key => $value) {
$directive = array(
'host' => $host,
'field_type' => $field_type,
'label' => $directive_name,
'in_config' => $in_config,
+ 'parent_name' => null,
+ 'group_name' => null,
'show' => (($in_config || !$load_values) || $this->getShowAllDirectives())
);
array_push($directives, $directive);
}
$directive_name = $controls[$j]->getDirectiveName();
$directive_value = $controls[$j]->getDirectiveValue();
- $default_value = $resource_desc[$directive_name]->DefaultValue;
+ $default_value = null;
+ if (key_exists($directive_name, $resource_desc)) {
+ $default_value = $resource_desc[$directive_name]->DefaultValue;
+ }
$in_config = $controls[$j]->getInConfig();
if (is_null($directive_value)) {
// skip not changed values that don't exist in config
continue;
}
- if ($this->directive_types[$i] === 'DirectiveBoolean') {
+ if ($this->directive_types[$i] === 'DirectiveCheckBox') {
settype($default_value, 'bool');
} elseif ($this->directive_types[$i] === 'DirectiveInteger') {
settype($directive_value, 'int');
if (is_null($directive_value)) {
continue;
}
+ if ($directive_name === 'Exclude') {
+ continue;
+ }
if (!array_key_exists($directive_name, $directives)) {
$directives[$directive_name] = array();
}
$directives[$directive_name] = array();
}
$directives[$directive_name] = array_merge($directives[$directive_name], $directive_value[$directive_name]);
+ } elseif ($this->directive_list_types[$i] === 'DirectiveFileSet') {
+ if (key_exists('Exclude', $directive_value) && count($directive_value['Exclude']) > 0) {
+ $directives['Exclude'] = array($directive_value['Exclude']);
+ }
+ $directives[$directive_name] = $directive_value[$directive_name];
} elseif (array_key_exists($directive_name, $directive_value)) {
$directives[$directive_name][] = $directive_value[$directive_name];
} elseif (count($directive_value) > 0) {
</com:TActiveLinkButton>
<com:TActiveRepeater
ID="RepeaterDirectives"
- OnItemDataBound="createDirectiveElement"
+ ItemRenderer="Application.Web.Portlets.DirectiveRenderer"
>
- <prop:ItemTemplate>
- <div class="directive_field">
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'TextBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveText />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'Integer')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveInteger />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'CheckBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveBoolean />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'TimePeriod')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveTimePeriod />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'Size')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveSize />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'ComboBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveComboBox />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'ListBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveListBox />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'FileSet')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveFileSet />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'Schedule')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveSchedule />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'Messages')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveMessages />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'Runscript')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveRunscript />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- </div>
- </prop:ItemTemplate>
</com:TActiveRepeater>
<div class="w3-row w3-center">
<com:TActiveLinkButton
CommandParameter="save"
>
<prop:Text>
- <i class="fa fa-save"></i> <%=Prado::localize('Save')%>
+ <i class="fa fa-save"></i> <%=$this->getLoadValues() ? Prado::localize('Save') : Prado::localize('Create')%>
</prop:Text>
<prop:ClientSide.OnLoading>
$('.save_progress').show();
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
Prado::using('System.Web.UI.ActiveControls.TActiveCheckBox');
Prado::using('Application.Web.Portlets.DirectiveTemplate');
-class DirectiveBoolean extends DirectiveTemplate {
+class DirectiveCheckBox extends DirectiveTemplate {
public function getValue() {
// @TODO: Define boolean directive values (yes/no/0/1...etc.)
$directive_value = $this->getDirectiveValue();
$default_value = $this->getDefaultValue();
settype($default_value, 'bool');
- if ($this->getInConfig() === false) {
+ if ($this->getInConfig() === false && empty($directive_value)) {
$directive_value = $default_value;
}
$this->Label->Text = $this->getLabel();
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2019 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 onLoad($param) {
+ $this->createDirectiveInternal();
+ $this->saveDirective();
+ parent::onLoad($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 createDirective() {
+ public function createDirectiveInternal() {
$this->Label->Text = $this->getLabel();
$data = $this->getData();
$resource_names = $this->getResourceNames();
$directive_value = $this->getDirectiveValue();
$default_value = $this->getDefaultValue();
- if ($in_config === false) {
+ if ($in_config === false && empty($directive_value)) {
if ($default_value !== 0) {
$directive_value = $default_value;
} else {
<i class="fa fa-trash-alt remove_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>"></i>
<com:TRequiredFieldValidator
ID="DirectiveValidator"
- ValidationGroup="Directive"
+ ValidationGroup="<%=$this->getValidationGroup()%>"
Display="Dynamic"
ControlToValidate="Directive"
FocusOnError="true"
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
Prado::using('System.Web.UI.ActiveControls.TActiveLinkButton');
+Prado::using('System.Web.UI.ActiveControls.TCallback');
Prado::using('Application.Web.Portlets.DirectiveListTemplate');
-Prado::using('Application.Web.Portlets.DirectiveBoolean');
-Prado::using('Application.Web.Portlets.DirectiveText');
+Prado::using('Application.Web.Portlets.DirectiveCheckBox');
+Prado::using('Application.Web.Portlets.DirectiveTextBox');
Prado::using('Application.Web.Portlets.DirectiveComboBox');
Prado::using('Application.Web.Portlets.DirectiveInteger');
+Prado::using('Application.Web.Portlets.FileSetOptionRenderer');
class DirectiveFileSet extends DirectiveListTemplate {
- const MENU_CONTROL = 'NewFileSetMenu';
-
private $directive_types = array(
- 'DirectiveBoolean',
- 'DirectiveText',
+ 'DirectiveCheckBox',
+ 'DirectiveTextBox',
'DirectiveComboBox',
'DirectiveListBox',
'DirectiveInteger'
);
private $directive_inc_exc_types = array(
- 'DirectiveText'
+ 'DirectiveTextBox'
);
public function loadConfig($sender, $param) {
$resource_type = $this->getResourceType();
$directive_name = $this->getDirectiveName();
$directives = $this->getData();
- $data_source = array();
- $include = array();
+ $includes = array();
+ $file = array();
$exclude = array();
$options = array();
- if (is_object($directives)) { // Include with options
- foreach($directives as $name => $values) {
- switch($name) {
- case 'File': {
- $this->setFile($include, $name, $values);
- break;
- }
- case 'Options': {
- $this->setOption($options, $name, $values);
- break;
+ if (!is_array($directives) || $directive_name === 'Exclude') {
+ return;
+ }
+ foreach ($directives as $index => $subres) {
+ if ($index === 'Include') {
+ for ($i = 0; $i < count($subres); $i++) {
+ if (is_null($subres[$i])) {
+ // load page with new fileset to create
+ continue;
}
- case 'Exclude': {
- $this->setFile($exclude, $name, $values);
- break;
+ foreach ($subres[$i] as $name => $values) {
+ switch($name) {
+ case 'File': {
+ $this->setFile($file, $name, $values);
+ break;
+ }
+ case 'Options': {
+ $this->setOption($options, $name, $values);
+ break;
+ }
+ }
}
+ $includes[] = array(
+ 'file' => $file,
+ 'options' => $options
+ );
+ $file = $options = array();
}
+ } elseif ($index === 'Exclude') {
+ if (!key_exists('File', $subres)) {
+ // empty exclude
+ continue;
+ }
+ // this is exclude
+ $this->setFile($exclude, 'File', $subres['File']);
}
}
-
- $this->RepeaterFileSetOptions->DataSource = $options;
- $this->RepeaterFileSetOptions->dataBind();
- $this->RepeaterFileSetInclude->DataSource = $include;
- $this->RepeaterFileSetInclude->dataBind();
+ $this->RepeaterFileSetIncludes->DataSource = $includes;
+ $this->RepeaterFileSetIncludes->dataBind();
$this->RepeaterFileSetExclude->DataSource = $exclude;
$this->RepeaterFileSetExclude->dataBind();
- $this->FileSetMenu->setComponentType($component_type);
- $this->FileSetMenu->setComponentName($component_name);
- $this->FileSetMenu->setResourceType($resource_type);
- $this->FileSetMenu->setDirectiveName($directive_name);
+ $this->FSBrowser->loadClients(null, null);
}
private function setFile(&$files, $name, $config) {
$component_name = $this->getComponentName();
$resource_type = $this->getResourceType();
$resource_name = $this->getResourceName();
+ $directive_name = 'File';
+ $field_type = 'TextBox';
+ $default_value = '';
+ $required = false;
for ($i = 0; $i < count($config); $i++) {
$files[] = array(
'resource_name' => $resource_name,
'directive_name' => $name,
'directive_value' => $config[$i],
- 'parent_name' => $name
+ 'parent_name' => $name,
+ 'field_type' => $field_type,
+ 'default_value' => $default_value,
+ 'required' => $required,
+ 'data' => null,
+ 'resource' => null,
+ 'in_config' => true,
+ 'label' => $directive_name,
+ 'show' => true,
+ 'parent_name' => $name,
+ 'group_name' => $i
);
}
}
private function setOption(&$options, $name, $config) {
+ $misc = $this->getModule('misc');
$load_values = $this->getLoadValues();
$host = $this->getHost();
$component_type = $this->getComponentType();
for ($i = 0; $i < count($config); $i++) {
foreach ($resource_desc->SubSections as $directive_name => $directive_desc) {
- $in_config = property_exists($config[$i], $directive_name);
+ if ($directive_name == 'File') {
+ // In options block File cannot be defined
+ continue;
+ }
+ if (is_object($config[$i])) {
+ $config[$i] = (array)$config[$i];
+ }
+ $in_config = key_exists($directive_name, $config[$i]);
$directive_value = null;
if ($in_config === true) {
- $directive_value = $config[$i]->{$directive_name};
+ $directive_value = $config[$i][$directive_name];
}
$default_value = null;
$field_type = $directive_desc->FieldType;
}
}
+ if ($field_type === 'CheckBox') {
+ /**
+ * It is because bdirjson returns FileSet options boolean values
+ * as Yes/No instead of returning true/false as it does for the rest.
+ */
+ if ($misc->isValidBooleanTrue($directive_value)) {
+ $directive_value = true;
+ } else if ($misc->isValidBooleanFalse($directive_value)) {
+ $directive_value = false;
+ }
+ }
if (!is_array($directive_value)) {
$directive_value = array($directive_value);
}
'directive_value' => $directive_value[$j],
'default_value' => $default_value,
'required' => $required,
+ 'resource' => null,
'data' => $data,
'field_type' => $field_type,
'in_config' => $in_config,
}
public function getDirectiveValue() {
- $directive_values = array();
+ $directive_values = array('Include' => array(), 'Exclude' => array());
$component_type = $this->getComponentType();
$resource_type = $this->getResourceType();
$resource_desc = $this->Application->getModule('data_desc')->getDescription($component_type, $resource_type);
- for ($i = 0; $i < count($this->directive_types); $i++) {
- $controls = $this->RepeaterFileSetOptions->findControlsByType($this->directive_types[$i]);
- for ($j = 0; $j < count($controls); $j++) {
- $directive_name = $controls[$j]->getDirectiveName();
- $directive_value = $controls[$j]->getDirectiveValue();
- $index = $controls[$j]->getGroupName();
- $default_value = $resource_desc['Include']->SubSections->{$directive_name}->DefaultValue;
- $in_config = $controls[$j]->getInConfig();
- if (is_null($directive_value)) {
- // option not set or removed
- continue;
- }
- if ($this->directive_types[$i] === 'DirectiveBoolean') {
- settype($default_value, 'bool');
- }
- if ($directive_value === $default_value) {
- // value the same as default value, skip it
- continue;
- }
- if (!array_key_exists('Include', $directive_values)) {
- $directive_values['Include'] = array('Options' => array());
- }
- if (!isset($directive_values['Include']['Options'][$index])) {
- $directive_values['Include']['Options'][$index] = array();
- }
- $directive_values['Include']['Options'][$index][$directive_name] = $directive_value;
- }
- $controls = $this->RepeaterFileSetInclude->findControlsByType($this->directive_types[$i]);
- for ($j = 0; $j < count($controls); $j++) {
- $directive_name = $controls[$j]->getDirectiveName();
- $directive_value = $controls[$j]->getDirectiveValue();
- if (is_null($directive_value)) {
- // Include file directive removed
- continue;
- }
- if (!array_key_exists('Include', $directive_values)) {
- $directive_values['Include'] = array();
+ $counter = 0;
+ $ctrls = $this->RepeaterFileSetIncludes->getItems();
+ foreach ($ctrls as $value) {
+ for ($i = 0; $i < count($this->directive_types); $i++) {
+ $controls = $value->RepeaterFileSetOptions->findControlsByType($this->directive_types[$i]);
+ for ($j = 0; $j < count($controls); $j++) {
+ $directive_name = $controls[$j]->getDirectiveName();
+ $directive_value = $controls[$j]->getDirectiveValue();
+ $index = $controls[$j]->getGroupName();
+ $default_value = $resource_desc['Include']->SubSections->{$directive_name}->DefaultValue;
+ $in_config = $controls[$j]->getInConfig();
+ if (is_null($directive_value)) {
+ // option not set or removed
+ continue;
+ }
+ if ($this->directive_types[$i] === 'DirectiveCheckBox') {
+ settype($default_value, 'bool');
+ }
+ if ($directive_value === $default_value) {
+ // value the same as default value, skip it
+ continue;
+ }
+ if (!isset($counter, $directive_values['Include'][$counter])) {
+ $directive_values['Include'][$counter] = array('Options' => array());
+ }
+ if (!isset($directive_values['Include'][$counter]['Options'][$index])) {
+ $directive_values['Include'][$counter]['Options'][$index] = array();
+ }
+ $directive_values['Include'][$counter]['Options'][$index][$directive_name] = $directive_value;
}
- if (!array_key_exists($directive_name, $directive_values['Include'])) {
- $directive_values['Include'][$directive_name] = array();
+ $controls = $value->RepeaterFileSetInclude->findControlsByType($this->directive_types[$i]);
+ for ($j = 0; $j < count($controls); $j++) {
+ $directive_name = $controls[$j]->getDirectiveName();
+ $directive_value = $controls[$j]->getDirectiveValue();
+ if (empty($directive_value)) {
+ // Include file directive removed
+ continue;
+ }
+ if (!key_exists('Include', $directive_values)) {
+ $directive_values['Include'] = array();
+ }
+ if (!isset($directive_values['Include'][$counter])) {
+ $directive_values['Include'][$counter] = array();
+ }
+ if (!key_exists($directive_name, $directive_values['Include'][$counter])) {
+ $directive_values['Include'][$counter][$directive_name] = array();
+ }
+ array_push($directive_values['Include'][$counter][$directive_name], $directive_value);
}
- array_push($directive_values['Include'][$directive_name], $directive_value);
}
+ $counter++;
+ }
+ for ($i = 0; $i < count($this->directive_types); $i++) {
$controls = $this->RepeaterFileSetExclude->findControlsByType($this->directive_types[$i]);
for ($j = 0; $j < count($controls); $j++) {
$directive_name = $controls[$j]->getDirectiveName();
// Exclude file directive removed
continue;
}
- if (!array_key_exists($directive_name, $directive_values)) {
- $directive_values[$directive_name] = array('File' => array());
+ if (!key_exists('File', $directive_values['Exclude'])) {
+ $directive_values['Exclude']['File'] = array();
}
- array_push($directive_values[$directive_name]['File'], $directive_value);
+ array_push($directive_values['Exclude']['File'], $directive_value);
}
}
-
return $directive_values;
}
- public function createFileSetOptions($sender, $param) {
- $load_values = $this->getLoadValues();
- $bconditionals = $this->RepeaterFileSetOptions->findControlsByType('BConditionalItem');
- for ($i = 0; $i < count($bconditionals); $i++) {
- $item = $bconditionals[$i]->getData();
- for ($j = 0; $j < count($this->directive_types); $j++) {
- $control = $this->getChildControl($item, $this->directive_types[$j]);
- if (is_object($control)) {
- $control->setHost($item->Data['host']);
- $control->setComponentType($item->Data['component_type']);
- $control->setComponentName($item->Data['component_name']);
- $control->setResourceType($item->Data['resource_type']);
- $control->setResourceName($item->Data['resource_name']);
- $control->setDirectiveName($item->Data['directive_name']);
- $control->setDirectiveValue($item->Data['directive_value']);
- $control->setDefaultValue($item->Data['default_value']);
- $control->setRequired($item->Data['required']);
- $control->setData($item->Data['data']);
- $control->setLabel($item->Data['label']);
- $control->setInConfig($item->Data['in_config']);
- $show_all_directives = ($item->Data['in_config'] || !$load_values || $this->SourceTemplateControl->getShowAllDirectives());
- $control->setShow($show_all_directives);
- $control->setParentName($item->Data['parent_name']);
- $control->setGroupName($item->Data['group_name']);
- }
- }
- }
+ public function createFileSetIncludes($sender, $param) {
+ $param->Item->RepeaterFileSetOptions->DataSource = $param->Item->Data['options'];
+ $param->Item->RepeaterFileSetOptions->dataBind();
+ $param->Item->RepeaterFileSetInclude->DataSource = $param->Item->Data['file'];
+ $param->Item->RepeaterFileSetInclude->dataBind();
+ $param->Item->FileSetFileOptMenu->setItemIndex($param->Item->getItemIndex());
}
public function createFileSetIncExcElement($sender, $param) {
}
}
- private function getDirectiveData() {
- $values = $this->getDirectiveValue();
- $data = array();
- if (array_key_exists('Include', $values) && array_key_exists('File', $values['Include'])) {
- $data['File'] = $values['Include']['File'];
- if (array_key_exists('Options', $values['Include']) && is_array($values['Include']['Options'])) {
- $data['Options'] = array();
- for ($i = 0; $i < count($values['Include']['Options']); $i++) {
- $data['Options'][$i] = (object)$values['Include']['Options'][$i];
- }
- }
- }
- if (array_key_exists('Exclude', $values) && array_key_exists('File', $values['Exclude'])) {
- $data['Exclude'] = $values['Exclude']['File'];
- }
- return $data;
+ public function newIncludeBlock($sender, $param) {
+ $data = $this->getDirectiveValue();
+ $data['Include'][] = array();
+ $this->setData($data);
+ $this->loadConfig(null, null);
}
public function newIncludeFile($sender, $param) {
- $data = $this->getDirectiveData();
- if (array_key_exists('File', $data) && is_array($data['File'])) {
- $data['File'][] = '';
- } else {
- $data['File'] = array('');
+ $data = $this->getDirectiveValue();
+ $inc_index = $sender->Parent->getItemIndex();
+ $file_index = 0;
+ if (key_exists($inc_index, $data['Include']) && key_exists('File', $data['Include'][$inc_index])) {
+ $file_index = count($data['Include'][$inc_index]['File']);
}
- $data = (object)$data;
+ $data['Include'][$inc_index]['File'][$file_index] = '';
$this->setData($data);
$this->loadConfig(null, null);
}
public function newExcludeFile($sender, $param) {
- $data = $this->getDirectiveData();
- if (array_key_exists('Exclude', $data) && is_array($data['Exclude'])) {
- $data['Exclude'][] = '';
+ $data = $this->getDirectiveValue();
+ $file_index = 0;
+ if (key_exists('Exclude', $data) && is_array($data['Exclude']) && key_exists('File', $data['Exclude'])) {
+ $file_index = count($data['Exclude']['File']);
} else {
- $data['Exclude'] = array('');
+ $data['Exclude'] = array('File' => array());
}
- $data = (object)$data;
+ $data['Exclude']['File'][$file_index] = '';
$this->setData($data);
$this->loadConfig(null, null);
}
public function newIncludeOptions($sender, $param) {
- $data = $this->getDirectiveData();
- if (array_key_exists('Options', $data) && is_array($data['Options'])) {
- $data['Options'][] = new stdClass;
- } else {
- $data['Options'] = array(new stdClass);
+ $data = $this->getDirectiveValue();
+ $inc_index = $sender->Parent->getItemIndex();
+ $opt_index = 0;
+ if (key_exists($inc_index, $data['Include']) && key_exists('Options', $data['Include'][$inc_index])) {
+ $opt_index = count($data['Include'][$inc_index]['Options']);
}
- $data = (object)$data;
+ $data['Include'][$inc_index]['Options'][$opt_index] = array();
$this->SourceTemplateControl->setShowAllDirectives(true);
$this->setData($data);
$this->loadConfig(null, null);
}
+
+ public function newIncludeExcludeFile($sender, $param) {
+ $data = $this->getDirectiveValue();
+ $inc_index = $this->RepeaterFileSetIncludes->getItems()->getCount() - 1;
+ $inc_exc = $param->getCallbackParameter();
+ if (property_exists($inc_exc, 'Include') && is_array($inc_exc->Include)) {
+ if (!key_exists($inc_index, $data['Include'])) {
+ $data['Include'][$inc_index] = array('File' => array());
+ }
+ for ($i = 0; $i < count($inc_exc->Include); $i++) {
+ if (in_array($inc_exc->Include[$i], $data['Include'][$inc_index]['File'])) {
+ // path already in includes, skip it to not double it
+ continue;
+ }
+ $data['Include'][$inc_index]['File'][] = $inc_exc->Include[$i];
+ }
+ }
+ if (property_exists($inc_exc, 'Exclude') && is_array($inc_exc->Exclude)) {
+ if (!key_exists('File', $data['Exclude'])) {
+ $data['Exclude'] = array('File' => array());
+ }
+ for ($i = 0; $i < count($inc_exc->Exclude); $i++) {
+ if (in_array($inc_exc->Exclude[$i], $data['Exclude']['File'])) {
+ // path already in includes, skip it to not double it
+ continue;
+ }
+ $data['Exclude']['File'][] = $inc_exc->Exclude[$i];
+ }
+ }
+ $this->setData($data);
+ $this->loadConfig(null, null);
+ }
}
?>
-<div class="w3-card-4 w3-padding w3-margin-bottom directive incexc">
- <h2><%=$this->getDirectiveName()%></h2>
- <button type="button" onmousedown="openElementOnCursor(event, '<%=$this->FileSetMenu->ClientID%>_new_fileset', 0, 20);" class="w3-button w3-green w3-margin-bottom"><i class="fa fa-plus"></i> <%[ Add ]%></button>
- <com:Application.Web.Portlets.NewFileSetMenu ID="FileSetMenu" />
-<com:TActiveRepeater ID="RepeaterFileSetOptions" OnItemDataBound="createFileSetOptions">
- <prop:HeaderTemplate>
- <div class="w3-card-4 w3-padding w3-margin-bottom directive">
- <h2><%[ Options ]%></h2>
- </prop:HeaderTemplate>
+<button type="button" onmousedown="openElementOnCursor(event, '<%=$this->FileSetIncludeMenu->ClientID%>_new_fileset', 0, 20);" class="w3-button w3-green w3-margin-bottom" style="display: <%=$this->getDirectiveName() == 'Include' ? '' : 'none'%>"><i class="fa fa-plus"></i> <%[ Add ]%></button>
+<com:Application.Web.Portlets.NewFileSetIncExcMenu ID="FileSetIncludeMenu" />
+<com:TActiveRepeater ID="RepeaterFileSetIncludes" OnItemDataBound="createFileSetIncludes">
<prop:ItemTemplate>
- <%=($this->getItemIndex() % 31 === 0 ? '<h3 class="options">Options #' . (($this->getItemIndex()/31)+1) . '</h3><hr />' : '')%>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'ComboBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveComboBox />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'TextBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveText />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'CheckBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveBoolean />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'Integer')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveInteger />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'ListBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveListBox />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- </prop:ItemTemplate>
- <prop:FooterTemplate>
+ <div class="w3-card-4 w3-padding w3-margin-bottom directive incexc">
+ <h2><%#$this->SourceTemplateControl->getDirectiveName()%> #<%#$this->ItemIndex + 1%></h2>
+ <button type="button" onmousedown="openElementOnCursor(event, '<%=$this->FileSetFileOptMenu->ClientID%>_new_fileset', 0, 20);" class="w3-button w3-green w3-margin-bottom"><i class="fa fa-plus"></i> <%[ Add ]%></button>
+ <com:Application.Web.Portlets.NewFileSetFileOptMenu ID="FileSetFileOptMenu" />
+ <com:TActiveRepeater
+ ID="RepeaterFileSetOptions"
+ ItemRenderer="Application.Web.Portlets.FileSetOptionRenderer"
+ >
+ <prop:HeaderTemplate>
+ <div class="w3-card-4 w3-padding w3-margin-bottom directive">
+ <h2><%[ Options ]%></h2>
+ </prop:HeaderTemplate>
+ <prop:FooterTemplate>
+ </div>
+ </prop:FooterTemplate>
+ </com:TActiveRepeater>
+ <com:TActiveRepeater ID="RepeaterFileSetInclude" ItemRenderer="Application.Web.Portlets.DirectiveRenderer" CssClass="incexc_item">
+ <prop:HeaderTemplate>
+ <div class="w3-card-4 w3-padding w3-margin-bottom directive include_file">
+ <h3><%[ Files ]%></h3>
+ </prop:HeaderTemplate>
+ <prop:FooterTemplate>
+ </div>
+ </prop:FooterTemplate>
+ </com:TActiveRepeater>
</div>
- </prop:FooterTemplate>
-</com:TActiveRepeater>
-<com:TActiveRepeater ID="RepeaterFileSetInclude" OnItemCreated="createFileSetIncExcElement" CssClass="incexc_item">
- <prop:HeaderTemplate>
- <div class="w3-card-4 w3-padding w3-margin-bottom directive include_file">
- <h2><%[ Files ]%></h2>
- </prop:HeaderTemplate>
- <prop:ItemTemplate>
- <div class="directive_field">
- <com:Application.Web.Portlets.DirectiveText />
- </div>
</prop:ItemTemplate>
- <prop:FooterTemplate>
- </div>
- </prop:FooterTemplate>
</com:TActiveRepeater>
<com:TActiveRepeater ID="RepeaterFileSetExclude" OnItemCreated="createFileSetIncExcElement" CssClass="incexc_item">
<prop:HeaderTemplate>
<div class="w3-card-4 w3-padding w3-margin-bottom directive">
- <h2><%[ Files ]%></h2>
+ <h2><%[ Exclude ]%></h2>
+ <button type="button" onmousedown="openElementOnCursor(event, '<%=$this->FileSetExcMenu->ClientID%>_new_fileset', 0, 20);" class="w3-button w3-green w3-margin-bottom"><i class="fa fa-plus"></i> <%[ Add ]%></button>
+ <com:Application.Web.Portlets.NewFileSetExcMenu ID="FileSetExcMenu" />
+ <h3><%[ Files ]%></h3>
</prop:HeaderTemplate>
<prop:ItemTemplate>
- <div class="directive_field">
- <com:Application.Web.Portlets.DirectiveText />
+ <div class="directive_field exclude_file">
+ <com:Application.Web.Portlets.DirectiveTextBox />
</div>
</prop:ItemTemplate>
<prop:FooterTemplate>
</div>
</prop:FooterTemplate>
</com:TActiveRepeater>
+<div class="w3-modal" id="fileset_browser" style="display: none;">
+ <div class="w3-modal-content w3-card-4 w3-padding-large w3-animate-zoom" style="width: 85%">
+ <span onclick="document.getElementById('fileset_browser').style.display = 'none'" class="w3-button w3-xlarge w3-hover-red w3-display-topright">×</span>
+ <h2><%[ Include files to FileSet]%></h2>
+ <com:Application.Web.Portlets.FileSetBrowser ID="FSBrowser" />
+ <com:TCallback ID="NewIncExcFile" OnCallback="newIncludeExcludeFile" />
+ <div class="w3-center">
+ <button type="button" class="w3-button w3-red" onclick="document.getElementById('fileset_browser').style.display = 'none'"><i class="fa fa-times"></i> <%[ Cancel ]%></button>
+ <a class="w3-button w3-green button_fixed" onclick="set_include_exclude(); document.getElementById('fileset_browser').style.display = 'none'">
+ <i class="fa fa-check"></i> <%[ Apply file selection ]%></a>
+ </a>
+ </div>
+ </div>
</div>
<script type="text/javascript">
+function set_include_exclude() {
+ var request = <%=$this->NewIncExcFile->ActiveControl->Javascript%>;
+ var param = {
+ 'Include': oFileSetBrowser.get_includes(),
+ 'Exclude': oFileSetBrowser.get_excludes()
+ };
+ request.setCallbackParameter(param);
+ request.dispatch();
+}
var incexc = document.getElementsByClassName('incexc');
for (var i = 0; i < incexc.length; i++) {
var dvs = incexc[i].getElementsByTagName('H2');
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2017 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
$directive_value = $this->getDirectiveValue();
$default_value = $this->getDefaultValue();
settype($default_value, 'int');
- if ($this->getInConfig() === false) {
+ if ($this->getInConfig() === false && empty($directive_value)) {
if ($default_value !== 0) {
$directive_value = $default_value;
} else {
<i class="fa fa-trash-alt remove_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>"></i>
<com:TRequiredFieldValidator
ID="DirectiveValidator"
- ValidationGroup="Directive"
+ ValidationGroup="<%=$this->getValidationGroup()%>"
Display="Dynamic"
ControlToValidate="Directive"
FocusOnError="true"
Enabled="<%=$this->getRequired() && $this->getShow()%>"
/>
<com:TDataTypeValidator
- ValidationGroup="Directive"
+ ValidationGroup="<%=$this->getValidationGroup()%>"
Display="Dynamic"
ControlToValidate="Directive"
FocusOnError="true"
<i class="fa fa-trash-alt remove_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>"></i>
<com:TRequiredFieldValidator
ID="DirectiveValidator"
- ValidationGroup="Directive"
+ ValidationGroup="<%=$this->getValidationGroup()%>"
Display="Dynamic"
ControlToValidate="Directive"
FocusOnError="true"
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2018 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
$this->attachEventHandler('OnDirectiveListLoad', $handler);
}
- public function onPreRender($param) {
- parent::onPreRender($param);
- // show directives existing in config or all
+ public function onLoad($param) {
+ parent::onLoad($param);
+ if ($this->getPage()->IsCallBack || $this->getPage()->IsPostBack) {
+ return;
+ }
$this->display_directive = $this->getShow();
}
}
public function getLoadValues() {
- return $this->getViewState(self::LOAD_VALUES);
+ return $this->getViewState(self::LOAD_VALUES, true);
}
public function setLoadValues($load_values) {
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2017 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
*/
Prado::using('Application.Web.Portlets.DirectiveListTemplate');
-Prado::using('Application.Web.Portlets.BConditional');
-Prado::using('Application.Web.Portlets.DirectiveText');
+Prado::using('Application.Web.Portlets.DirectiveTextBox');
class DirectiveMessages extends DirectiveListTemplate {
private $directive_types = array(
- 'DirectiveText'
+ 'DirectiveTextBox'
);
public $destination_simple = array(
$controls = $this->RepeaterMessages->getControls();
for ($i = 0; $i < $controls->count(); $i++) {
$directive_values = array();
- $where_control = $controls->itemAt($i)->findControlsByType('DirectiveText');
+ $where_control = $controls->itemAt($i)->findControlsByType('DirectiveTextBox');
if (count($where_control) === 1 && $where_control[0]->getShow() === true) {
$directive_values = array($where_control[0]->getDirectiveValue());
}
$controls = $this->RepeaterMessages->getControls();
for ($i = 0; $i < $controls->count(); $i++) {
$directive_values = array();
- $where_control = $controls->itemAt($i)->findControlsByType('DirectiveText');
+ $where_control = $controls->itemAt($i)->findControlsByType('DirectiveTextBox');
if (count($where_control) === 1 && $where_control[0]->getShow() === true) {
$directive_values['Where'] = array($where_control[0]->getDirectiveValue());
}
-<div class="<%=!$this->display_directive ? ' hide' : '';%>">
<button type="button" class="w3-button w3-green w3-margin" onmousedown="openElementOnCursor(event, '<%=$this->MessagesMenu->ClientID%>_new_messages', 0, 20);"><i class="fa fa-plus"></i> <%[ Add ]%></button>
<com:Application.Web.Portlets.NewMessagesMenu ID="MessagesMenu" />
<com:TActiveRepeater ID="RepeaterMessages" OnItemCreated="createDirectiveListElement" OnItemDataBound="loadMessageTypes">
<prop:ItemTemplate>
- <div class="w3-card w3-white w3-padding directive">
+ <div class="w3-card w3-padding directive">
<h2><%=$this->Data['directive_name']%></h2>
- <com:Application.Web.Portlets.DirectiveText />
+ <com:Application.Web.Portlets.DirectiveTextBox />
<com:Application.Web.Portlets.MessageTypes ID="Types" />
</div>
</prop:ItemTemplate>
</com:TActiveRepeater>
-</div>
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 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.TActiveLinkButton');
+Prado::using('System.Web.UI.ActiveControls.TActivePanel');
+Prado::using('System.Web.UI.ActiveControls.TActiveRepeater');
+Prado::using('Application.Web.Portlets.DirectiveListTemplate');
+Prado::using('Application.Web.Portlets.DirectiveCheckBox');
+Prado::using('Application.Web.Portlets.DirectiveComboBox');
+Prado::using('Application.Web.Portlets.DirectiveInteger');
+Prado::using('Application.Web.Portlets.DirectiveListBox');
+Prado::using('Application.Web.Portlets.DirectiveSize');
+Prado::using('Application.Web.Portlets.DirectiveTextBox');
+Prado::using('Application.Web.Portlets.DirectiveTimePeriod');
+Prado::using('Application.Web.Portlets.DirectiveRunscript');
+Prado::using('Application.Web.Portlets.DirectiveMessages');
+
+class DirectiveRenderer extends DirectiveListTemplate implements IItemDataRenderer {
+
+ const DATA = 'Data';
+ const ITEM_INDEX = 'ItemIndex';
+
+ private $directive_types = array(
+ 'DirectiveCheckBox',
+ 'DirectiveComboBox',
+ 'DirectiveInteger',
+ 'DirectiveListBox',
+ 'DirectiveTextBox',
+ 'DirectiveSize',
+ 'DirectiveTimePeriod'
+ );
+
+ private $directive_list_types = array(
+ 'DirectiveFileSet',
+ 'DirectiveSchedule',
+ 'DirectiveMessages',
+ 'DirectiveRunscript'
+ );
+
+ public $resource_names = array();
+
+ public function onLoad($param) {
+ parent::onLoad($param);
+ $data = $this->getData();
+ $this->createItem($data);
+ }
+
+ public function createItem($data) {
+ $load_values = $this->SourceTemplateControl->getLoadValues();
+ $field = $this->getField($data['field_type']);
+ $control = Prado::createComponent($field);
+ $type = 'Directive' . $data['field_type'];
+ if (in_array($type, $this->directive_types)) {
+ $control->setHost($data['host']);
+ $control->setComponentType($data['component_type']);
+ $control->setComponentName($data['component_name']);
+ $control->setResourceType($data['resource_type']);
+ $control->setResourceName($data['resource_name']);
+ $control->setDirectiveName($data['directive_name']);
+ $control->setDirectiveValue($data['directive_value']);
+ $control->setDefaultValue($data['default_value']);
+ $control->setRequired($data['required']);
+ $control->setData($data['data']);
+ $control->setResource($data['resource']);
+ $control->setLabel($data['label']);
+ $control->setInConfig($data['in_config']);
+ $control->setShow($data['show']);
+ $control->setGroupName($data['group_name']);
+ $control->setParentName($data['parent_name']);
+ $control->setResourceNames($this->SourceTemplateControl->getResourceNames());
+ $this->getControls()->add($control);
+ } elseif (in_array($type, $this->directive_list_types)) {
+ $control->setHost($data['host']);
+ $control->setComponentType($data['component_type']);
+ $control->setComponentName($data['component_name']);
+ $control->setResourceType($data['resource_type']);
+ $control->setResourceName($data['resource_name']);
+ $control->setDirectiveName($data['directive_name']);
+ $control->setData($data['directive_value']);
+ $control->setLoadValues($this->SourceTemplateControl->getLoadValues());
+ $control->setResourceNames($this->SourceTemplateControl->getResourceNames());
+ $control->setShow(true);
+ $this->getControls()->add($control);
+ $control->raiseEvent('OnDirectiveListLoad', $this, null);
+ }
+ }
+
+ public function getItemIndex() {
+ return $this->getViewState(self::ITEM_INDEX, 0);
+ }
+
+ public function setItemIndex($item_index) {
+ $this->setViewState(self::ITEM_INDEX, $item_index);
+ }
+
+ public function getItemType() {
+ }
+
+ public function setItemType($item_type) {
+ }
+
+ public function getData() {
+ return $this->getViewState(self::DATA);
+ }
+
+ public function setData($data) {
+ $this->setViewState(self::DATA, $data);
+ }
+
+ 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-2017 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
*/
Prado::using('Application.Web.Portlets.DirectiveListTemplate');
-Prado::using('Application.Web.Portlets.DirectiveBoolean');
-Prado::using('Application.Web.Portlets.DirectiveText');
+Prado::using('Application.Web.Portlets.DirectiveCheckBox');
+Prado::using('Application.Web.Portlets.DirectiveTextBox');
Prado::using('Application.Web.Portlets.DirectiveComboBox');
class DirectiveRunscript extends DirectiveListTemplate {
private $directive_types = array(
- 'DirectiveBoolean',
- 'DirectiveText',
+ 'DirectiveCheckBox',
+ 'DirectiveTextBox',
'DirectiveComboBox'
);
$resource_type = $this->getResourceType();
$resource_name = $this->getResourceName();
- $config = $this->getData();
- if (is_null($config)) {
- return null;
- } elseif (is_object($config)) {
- $config = array($config);
- }
+ $directives = $this->getData();
$options = array();
+ if (!is_array($directives)) {
+ return;
+ }
$resource_desc = $this->Application->getModule('data_desc')->getDescription($component_type, $resource_type, 'Runscript');
- for ($i = 0; $i < count($config); $i++) {
- foreach ($resource_desc->SubSections as $directive_name => $directive_desc) {
- $in_config = property_exists($config[$i], $directive_name);
-
- $directive_value = null;
- if ($in_config === true) {
- $directive_value = $config[$i]->{$directive_name};
+ foreach ($directives as $index => $config) {
+ for ($i = 0; $i < count($config); $i++) {
+ if (!is_object($config[$i])) {
+ continue;
}
+ foreach ($resource_desc->SubSections as $directive_name => $directive_desc) {
+ $in_config = property_exists($config[$i], $directive_name);
- $default_value = null;
- $data = null;
- $field_type = 'TextBox';
- $required = false;
- if (is_object($directive_desc)) {
- if (property_exists($directive_desc, 'Required')) {
- $required = $directive_desc->Required;
+ $directive_value = null;
+ if ($in_config === true) {
+ $directive_value = $config[$i]->{$directive_name};
}
- if (property_exists($directive_desc, 'DefaultValue')) {
- $default_value = $directive_desc->DefaultValue;
+
+ $default_value = null;
+ $data = null;
+ $field_type = 'TextBox';
+ $required = false;
+ if (is_object($directive_desc)) {
+ if (property_exists($directive_desc, 'Required')) {
+ $required = $directive_desc->Required;
+ }
+ if (property_exists($directive_desc, 'DefaultValue')) {
+ $default_value = $directive_desc->DefaultValue;
+ }
+ if (property_exists($directive_desc, 'Data')) {
+ $data = $directive_desc->Data;
+ }
+ if (property_exists($directive_desc, 'FieldType')) {
+ $field_type = $directive_desc->FieldType;
+ }
}
- if (property_exists($directive_desc, 'Data')) {
- $data = $directive_desc->Data;
+ if (!is_array($directive_value)) {
+ $directive_value = array($directive_value);
}
- if (property_exists($directive_desc, 'FieldType')) {
- $field_type = $directive_desc->FieldType;
+ for ($j = 0; $j < count($directive_value); $j++) {
+ $options[] = array(
+ 'host' => $host,
+ 'component_type' => $component_type,
+ 'component_name' => $component_name,
+ 'resource_type' => $resource_type,
+ 'resource_name' => $resource_name,
+ 'directive_name' => $directive_name,
+ 'directive_value' => $directive_value[$j],
+ 'default_value' => $default_value,
+ 'required' => $required,
+ 'resource' => null,
+ 'data' => $data,
+ 'label' => $directive_name,
+ 'field_type' => $field_type,
+ 'in_config' => $in_config,
+ 'show' => ($in_config || !$load_values || $this->SourceTemplateControl->getShowAllDirectives()),
+ 'parent_name' => __CLASS__,
+ 'group_name' => $i
+ );
}
}
- if (!is_array($directive_value)) {
- $directive_value = array($directive_value);
- }
- for ($j = 0; $j < count($directive_value); $j++) {
- $options[] = array(
- 'host' => $host,
- 'component_type' => $component_type,
- 'component_name' => $component_name,
- 'resource_type' => $resource_type,
- 'resource_name' => $resource_name,
- 'directive_name' => $directive_name,
- 'directive_value' => $directive_value[$j],
- 'default_value' => $default_value,
- 'required' => $required,
- 'data' => $data,
- 'label' => $directive_name,
- 'field_type' => $field_type,
- 'in_config' => $in_config,
- 'show' => ($in_config || !$load_values || $this->SourceTemplateControl->getShowAllDirectives()),
- 'parent_name' => __CLASS__,
- 'group_name' => $i
- );
- }
}
}
$this->RepeaterRunscriptOptions->dataSource = $options;
$this->RepeaterRunscriptOptions->dataBind();
}
- public function createRunscriptOptions($sender, $param) {
- $load_values = $this->getLoadValues();
- $bconditionals = $this->RepeaterRunscriptOptions->findControlsByType('BConditionalItem');
- for ($i = 0; $i < count($bconditionals); $i++) {
- $item = $bconditionals[$i]->getData();
- for ($j = 0; $j < count($this->directive_types); $j++) {
- $control = $this->getChildControl($item, $this->directive_types[$j]);
- if (is_object($control)) {
- $control->setHost($item->Data['host']);
- $control->setComponentType($item->Data['component_type']);
- $control->setComponentName($item->Data['component_name']);
- $control->setResourceType($item->Data['resource_type']);
- $control->setResourceName($item->Data['resource_name']);
- $control->setDirectiveName($item->Data['directive_name']);
- $control->setDirectiveValue($item->Data['directive_value']);
- $control->setDefaultValue($item->Data['default_value']);
- $control->setRequired($item->Data['required']);
- $control->setData($item->Data['data']);
- $control->setLabel($item->Data['label']);
- $control->setInConfig($item->Data['in_config']);
- $show_all_directives = ($item->Data['in_config'] || !$load_values || $this->SourceTemplateControl->getShowAllDirectives());
- $control->setShow($show_all_directives);
- $control->setParentName($item->Data['parent_name']);
- $control->setGroupName($item->Data['group_name']);
- break;
- }
- }
- }
- }
-
- public function getDirectiveValue() {
+ public function getDirectiveValue($allow_empty = false) {
$directive_values = null;
$component_type = $this->getComponentType();
$resource_type = $this->getResourceType();
for ($j = 0; $j < count($controls); $j++) {
$directive_name = $controls[$j]->getDirectiveName();
$directive_value = $controls[$j]->getDirectiveValue();
- $default_value = $resource_desc['Runscript']->SubSections->{$directive_name}->DefaultValue;
+ $default_value = null;
+ if (property_exists($resource_desc['Runscript']->SubSections, $directive_name)) {
+ $default_value = $resource_desc['Runscript']->SubSections->{$directive_name}->DefaultValue;
+ }
$in_config = $controls[$j]->getInConfig();
$index = $controls[$j]->getGroupName();
+
+ if (!isset($directive_values['Runscript'])) {
+ $directive_values = array('Runscript' => array());
+ }
+ if (!isset($directive_values['Runscript'][$index])) {
+ $directive_values['Runscript'][$index] = new stdClass;
+ }
+
if (is_null($directive_value)) {
// skip not changed values that don't exist in config
continue;
}
- if ($this->directive_types[$i] === 'DirectiveBoolean') {
+ if ($this->directive_types[$i] === 'DirectiveCheckBox') {
settype($default_value, 'bool');
}
if ($directive_value === $default_value) {
// value the same as default value, skip it
continue;
}
- if (!isset($directive_values['Runscript'])) {
- $directive_values['Runscript'] = array();
- }
- if (!isset($directive_values['Runscript'][$index])) {
- $directive_values['Runscript'][$index] = array();
- }
- $directive_values['Runscript'][$index][$directive_name] = $directive_value;
+ $directive_values['Runscript'][$index]->{$directive_name} = $directive_value;
}
}
return $directive_values;
}
- public function getDirectiveData() {
- $data = array();
- $values = $this->getDirectiveValue();
- if (is_array($values) && array_key_exists('Runscript', $values)) {
- for ($i = 0; $i < count($values['Runscript']); $i++) {
- $data[$i] = (object)$values['Runscript'][$i];
- }
- }
- return $data;
- }
-
public function newRunscriptDirective() {
- $data = $this->getDirectiveData();
- array_push($data, new stdClass);
+ $data = $this->getDirectiveValue(true);
+ if (is_array($data) && key_exists('Runscript', $data) && is_array($data['Runscript'])) {
+ $data['Runscript'][] = new stdClass;
+ } else {
+ $data = array('Runscript' => array(new stdClass));
+ }
$this->setData($data);
$this->SourceTemplateControl->setShowAllDirectives(true);
$this->loadConfig(null, null);
-<div class="<%=!$this->display_directive ? ' hide' : '';%>">
<button type="button" class="w3-button w3-green" onmousedown="openElementOnCursor(event, '<%=$this->RunscriptMenu->ClientID%>_new_runscript', 0, 20);"><i class="fa fa-plus"></i> <%[ Add ]%></button>
<com:Application.Web.Portlets.NewRunscriptMenu ID="RunscriptMenu" />
-<com:TActiveRepeater ID="RepeaterRunscriptOptions" OnItemDataBound="createRunscriptOptions">
+<com:TActiveRepeater ID="RepeaterRunscriptOptions" ItemRenderer="Application.Web.Portlets.JobRunscriptRenderer">
<prop:HeaderTemplate>
<div class="w3-card-4 w3-padding w3-margin-bottom directive runscript">
<h2>Runscript</h2>
</prop:HeaderTemplate>
- <prop:ItemTemplate>
- <%=($this->getItemIndex() % 7 === 0 ? '<h3 class="runscript">Runscript #' . (($this->getItemIndex()/7)+1) . '</h3><hr />' : '')%>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'ComboBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveComboBox />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'TextBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveText />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- <com:Application.Web.Portlets.BConditional BCondition="<%#($this->Data['field_type'] === 'CheckBox')%>">
- <prop:TrueTemplate>
- <com:Application.Web.Portlets.DirectiveBoolean />
- </prop:TrueTemplate>
- </com:Application.Web.Portlets.BConditional>
- </prop:ItemTemplate>
<prop:FooterTemplate>
</fieldset>
</prop:FooterTemplate>
</com:TActiveRepeater>
-</div>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2017 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
Prado::using('Application.Common.Class.Params');
Prado::using('Application.Web.Portlets.DirectiveListTemplate');
-Prado::using('Application.Web.Portlets.DirectiveBoolean');
+Prado::using('Application.Web.Portlets.DirectiveCheckBox');
Prado::using('Application.Web.Portlets.DirectiveComboBox');
-Prado::using('Application.Web.Portlets.DirectiveText');
+Prado::using('Application.Web.Portlets.DirectiveTextBox');
Prado::using('Application.Web.Portlets.DirectiveTimePeriod');
class DirectiveSchedule extends DirectiveListTemplate {
public $directives;
private $directive_types = array(
- 'DirectiveBoolean',
- 'DirectiveText',
+ 'DirectiveCheckBox',
+ 'DirectiveTextBox',
'DirectiveComboBox',
'DirectiveTimePeriod'
);
if (is_null($directive_value)) {
continue;
}
- if ($this->directive_types[$i] === 'DirectiveBoolean') {
+ if ($this->directive_types[$i] === 'DirectiveCheckBox') {
settype($default_value, 'bool');
}
// value the same as default value, skip it
continue;
}
- if ($this->directive_types[$i] === 'DirectiveBoolean') {
+ if ($this->directive_types[$i] === 'DirectiveCheckBox') {
$directive_value = Params::getBoolValue($directive_value);
}
$directive_values[] = "{$directive_name}=\"{$directive_value}\"";
-<div class="w3-card-4 w3-padding w3-margin-bottom directive<%=!$this->display_directive ? ' hide' : '';%>">
- <h2><%[ Run ]%></h2>
- <com:TPanel ID="DirectiveContainer">
- <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.DirectiveBoolean
- ID="Accurate"
- />
- <com:Application.Web.Portlets.DirectiveText
- ID="Priority"
- />
- <com:Application.Web.Portlets.DirectiveBoolean
- ID="SpoolData"
- />
- <com:Application.Web.Portlets.DirectiveBoolean
- ID="writepartafterjob"
- />
- <com:Application.Web.Portlets.DirectiveTimePeriod
- ID="MaxRunSchedTime"
- />
- </com:TPanel>
- <com:TRadioButton
- ID="MonthDisable"
- CssClass="w3-radio"
- GroupName="Month"
- Attributes.onclick="$('.month<%=$this->MonthSingle->ClientID%>').hide();"
- Checked="true" />
- <com:TLabel ForControl="MonthDisable" Text="<%[ Disabled ]%>" />
- <com:TRadioButton
- ID="MonthSingle"
- CssClass="w3-radio"
- GroupName="Month"
- Attributes.onclick="$('.month<%=$this->MonthSingle->ClientID%>').hide();$('#month<%=$this->MonthSingle->ClientID%>').show()" />
- <com:TLabel ForControl="MonthSingle" Text="<%[ Single month ]%>" />
- <com:TRadioButton
- ID="MonthRange"
- CssClass="w3-radio"
- GroupName="Month"
- Attributes.onclick="$('.month<%=$this->MonthSingle->ClientID%>').hide();$('#month_range<%=$this->MonthSingle->ClientID%>').show()" />
- <com:TLabel ForControl="MonthRange" Text="<%[ Month range ]%>" />
- <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"
- />
- </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"
- />
- <com:Application.Web.Portlets.DirectiveComboBox
- ID="MonthRangeTo"
- Label="<%[ To month ]%>"
- InConfig="true"
- Show="true"
- />
- </div>
- <hr />
- <com:TRadioButton
- ID="WeekDisable"
- CssClass="w3-radio"
- GroupName="Week"
- Attributes.onclick="$('.week<%=$this->WeekSingle->ClientID%>').hide();"
- Checked="true" />
- <com:TLabel ForControl="WeekDisable" Text="<%[ Disabled ]%>" />
- <com:TRadioButton
- ID="WeekSingle"
- CssClass="w3-radio"
- GroupName="Week"
- Attributes.onclick="$('.week<%=$this->WeekSingle->ClientID%>').hide();$('#week<%=$this->WeekSingle->ClientID%>').show()" />
- <com:TLabel ForControl="WeekSingle" Text="<%[ Single week ]%>" />
- <com:TRadioButton
- ID="WeekRange"
- CssClass="w3-radio"
- GroupName="Week"
- Attributes.onclick="$('.week<%=$this->WeekSingle->ClientID%>').hide();$('#week_range<%=$this->WeekSingle->ClientID%>').show()" />
- <com:TLabel ForControl="WeekRange" Text="<%[ Week range ]%>" />
- <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"
- />
- </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"
- />
- <com:Application.Web.Portlets.DirectiveComboBox
- ID="WeekRangeTo"
- Label="<%[ To week ]%>"
- InConfig="true"
- Show="true"
- />
- </div>
+<h2><%[ Run ]%></h2>
+<com:TPanel ID="DirectiveContainer">
+ <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"
+ />
+ <com:Application.Web.Portlets.DirectiveCheckBox
+ ID="SpoolData"
+ />
+ <com:Application.Web.Portlets.DirectiveCheckBox
+ ID="writepartafterjob"
+ />
+ <com:Application.Web.Portlets.DirectiveTimePeriod
+ ID="MaxRunSchedTime"
+ />
+</com:TPanel>
+<com:TRadioButton
+ ID="MonthDisable"
+ CssClass="w3-radio"
+ GroupName="Month"
+ Attributes.onclick="$('.month<%=$this->MonthSingle->ClientID%>').hide();"
+ Checked="true" />
+<com:TLabel ForControl="MonthDisable" Text="<%[ Disabled ]%>" />
+<com:TRadioButton
+ ID="MonthSingle"
+ CssClass="w3-radio"
+ GroupName="Month"
+ Attributes.onclick="$('.month<%=$this->MonthSingle->ClientID%>').hide();$('#month<%=$this->MonthSingle->ClientID%>').show()" />
+<com:TLabel ForControl="MonthSingle" Text="<%[ Single month ]%>" />
+<com:TRadioButton
+ ID="MonthRange"
+ CssClass="w3-radio"
+ GroupName="Month"
+ Attributes.onclick="$('.month<%=$this->MonthSingle->ClientID%>').hide();$('#month_range<%=$this->MonthSingle->ClientID%>').show()" />
+<com:TLabel ForControl="MonthRange" Text="<%[ Month range ]%>" />
+<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"
+ />
+</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"
+ />
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="MonthRangeTo"
+ Label="<%[ To month ]%>"
+ InConfig="true"
+ Show="true"
+ />
+</div>
+<hr />
+<com:TRadioButton
+ ID="WeekDisable"
+ CssClass="w3-radio"
+ GroupName="Week"
+ Attributes.onclick="$('.week<%=$this->WeekSingle->ClientID%>').hide();"
+ Checked="true" />
+<com:TLabel ForControl="WeekDisable" Text="<%[ Disabled ]%>" />
+<com:TRadioButton
+ ID="WeekSingle"
+ CssClass="w3-radio"
+ GroupName="Week"
+ Attributes.onclick="$('.week<%=$this->WeekSingle->ClientID%>').hide();$('#week<%=$this->WeekSingle->ClientID%>').show()" />
+<com:TLabel ForControl="WeekSingle" Text="<%[ Single week ]%>" />
+<com:TRadioButton
+ ID="WeekRange"
+ CssClass="w3-radio"
+ GroupName="Week"
+ Attributes.onclick="$('.week<%=$this->WeekSingle->ClientID%>').hide();$('#week_range<%=$this->WeekSingle->ClientID%>').show()" />
+<com:TLabel ForControl="WeekRange" Text="<%[ Week range ]%>" />
+<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"
+ />
+</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"
+ />
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="WeekRangeTo"
+ Label="<%[ To week ]%>"
+ InConfig="true"
+ Show="true"
+ />
+</div>
- <hr />
- <com:TRadioButton
- ID="DayDisable"
- CssClass="w3-radio"
- GroupName="Day"
- Attributes.onclick="$('.day<%=$this->DaySingle->ClientID%>').hide();"
- Checked="true" />
- <com:TLabel ForControl="DayDisable" Text="<%[ Disabled ]%>" />
- <com:TRadioButton
- ID="DaySingle"
- CssClass="w3-radio"
- GroupName="Day"
- Attributes.onclick="$('.day<%=$this->DaySingle->ClientID%>').hide();$('#day<%=$this->DaySingle->ClientID%>').show()" />
- <com:TLabel ForControl="DaySingle" Text="<%[ Single day ]%>" />
- <com:TRadioButton
- ID="DayRange"
- CssClass="w3-radio"
- GroupName="Day"
- Attributes.onclick="$('.day<%=$this->DaySingle->ClientID%>').hide();$('#day_range<%=$this->DaySingle->ClientID%>').show()" />
- <com:TLabel ForControl="DayRange" Text="<%[ Day range ]%>" />
- <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"
- />
- </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"
- />
- <com:Application.Web.Portlets.DirectiveComboBox
- ID="DayRangeTo"
- Label="<%[ To day ]%>"
- InConfig="true"
- Show="true"
- />
- </div>
- <hr />
- <com:TRadioButton
- ID="WdayDisable"
- CssClass="w3-radio"
- GroupName="Wday"
- Attributes.onclick="$('.day<%=$this->WdaySingle->ClientID%>').hide();"
- Checked="true" />
- <com:TLabel ForControl="WdayDisable" Text="<%[ Disabled ]%>" />
- <com:TRadioButton
- ID="WdaySingle"
- CssClass="w3-radio"
- GroupName="Wday"
- Attributes.onclick="$('.day<%=$this->WdaySingle->ClientID%>').hide();$('#day<%=$this->WdaySingle->ClientID%>').show()" />
- <com:TLabel ForControl="WdaySingle" Text="<%[ Single day of week ]%>" />
- <com:TRadioButton
- ID="WdayRange"
- CssClass="w3-radio"
- GroupName="Wday"
- Attributes.onclick="$('.day<%=$this->WdaySingle->ClientID%>').hide();$('#day_range<%=$this->WdaySingle->ClientID%>').show()" />
- <com:TLabel ForControl="WdayRange" Text="<%[ Day of week range ]%>" />
- <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"
- />
- </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"
- />
- <com:Application.Web.Portlets.DirectiveComboBox
- ID="WdayRangeTo"
- Label="<%[ To day of week ]%>"
- InConfig="true"
- Show="true"
- />
- </div>
- <hr />
- <com:TRadioButton
- ID="TimeDisable"
- CssClass="w3-radio"
- GroupName="Time"
- Attributes.onclick="$('.day<%=$this->TimeAt->ClientID%>').hide();"
- Checked="true" />
- <com:TLabel ForControl="TimeDisable" Text="<%[ Disabled ]%>" />
- <com:TRadioButton
- ID="TimeAt"
- CssClass="w3-radio"
- GroupName="Time"
- Attributes.onclick="$('.day<%=$this->TimeAt->ClientID%>').hide();$('#day<%=$this->TimeAt->ClientID%>').show()" />
- <com:TLabel ForControl="TimeAt" Text="<%[ At HH:MM ]%>" />
- <com:TRadioButton
- ID="TimeHourly"
- CssClass="w3-radio"
- GroupName="Time"
- Attributes.onclick="$('.day<%=$this->TimeAt->ClientID%>').hide();$('#day_range<%=$this->TimeAt->ClientID%>').show()" />
- <com:TLabel ForControl="TimeHourly" Text="<%[ Hourly at ]%>" />
- <div id="day<%=$this->TimeAt->ClientID%>" class="w3-margin day<%=$this->TimeAt->ClientID%>" style="display: <%=$this->TimeAt->Checked ? 'block' : 'none'%>">
- <com:Application.Web.Portlets.DirectiveText
- ID="TimeHourAt"
- Label="<%[ Hour ]%>"
- InConfig="true"
- Show="true"
- />
- <com:Application.Web.Portlets.DirectiveText
- ID="TimeMinAt"
- Label="<%[ Minute ]%>"
- InConfig="true"
- Show="true"
- />
- </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.DirectiveText
- ID="TimeMinHourly"
- Label="<%[ Minute ]%>"
- InConfig="true"
- Show="true"
- />
- </div>
+<hr />
+<com:TRadioButton
+ ID="DayDisable"
+ CssClass="w3-radio"
+ GroupName="Day"
+ Attributes.onclick="$('.day<%=$this->DaySingle->ClientID%>').hide();"
+ Checked="true" />
+<com:TLabel ForControl="DayDisable" Text="<%[ Disabled ]%>" />
+<com:TRadioButton
+ ID="DaySingle"
+ CssClass="w3-radio"
+ GroupName="Day"
+ Attributes.onclick="$('.day<%=$this->DaySingle->ClientID%>').hide();$('#day<%=$this->DaySingle->ClientID%>').show()" />
+<com:TLabel ForControl="DaySingle" Text="<%[ Single day ]%>" />
+<com:TRadioButton
+ ID="DayRange"
+ CssClass="w3-radio"
+ GroupName="Day"
+ Attributes.onclick="$('.day<%=$this->DaySingle->ClientID%>').hide();$('#day_range<%=$this->DaySingle->ClientID%>').show()" />
+<com:TLabel ForControl="DayRange" Text="<%[ Day range ]%>" />
+<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"
+ />
+</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"
+ />
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="DayRangeTo"
+ Label="<%[ To day ]%>"
+ InConfig="true"
+ Show="true"
+ />
+</div>
+<hr />
+<com:TRadioButton
+ ID="WdayDisable"
+ CssClass="w3-radio"
+ GroupName="Wday"
+ Attributes.onclick="$('.day<%=$this->WdaySingle->ClientID%>').hide();"
+ Checked="true" />
+<com:TLabel ForControl="WdayDisable" Text="<%[ Disabled ]%>" />
+<com:TRadioButton
+ ID="WdaySingle"
+ CssClass="w3-radio"
+ GroupName="Wday"
+ Attributes.onclick="$('.day<%=$this->WdaySingle->ClientID%>').hide();$('#day<%=$this->WdaySingle->ClientID%>').show()" />
+<com:TLabel ForControl="WdaySingle" Text="<%[ Single day of week ]%>" />
+<com:TRadioButton
+ ID="WdayRange"
+ CssClass="w3-radio"
+ GroupName="Wday"
+ Attributes.onclick="$('.day<%=$this->WdaySingle->ClientID%>').hide();$('#day_range<%=$this->WdaySingle->ClientID%>').show()" />
+<com:TLabel ForControl="WdayRange" Text="<%[ Day of week range ]%>" />
+<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"
+ />
+</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"
+ />
+ <com:Application.Web.Portlets.DirectiveComboBox
+ ID="WdayRangeTo"
+ Label="<%[ To day of week ]%>"
+ InConfig="true"
+ Show="true"
+ />
+</div>
+<hr />
+<com:TRadioButton
+ ID="TimeDisable"
+ CssClass="w3-radio"
+ GroupName="Time"
+ Attributes.onclick="$('.day<%=$this->TimeAt->ClientID%>').hide();"
+ Checked="true" />
+<com:TLabel ForControl="TimeDisable" Text="<%[ Disabled ]%>" />
+<com:TRadioButton
+ ID="TimeAt"
+ CssClass="w3-radio"
+ GroupName="Time"
+ Attributes.onclick="$('.day<%=$this->TimeAt->ClientID%>').hide();$('#day<%=$this->TimeAt->ClientID%>').show()" />
+<com:TLabel ForControl="TimeAt" Text="<%[ At HH:MM ]%>" />
+<com:TRadioButton
+ ID="TimeHourly"
+ CssClass="w3-radio"
+ GroupName="Time"
+ Attributes.onclick="$('.day<%=$this->TimeAt->ClientID%>').hide();$('#day_range<%=$this->TimeAt->ClientID%>').show()" />
+<com:TLabel ForControl="TimeHourly" Text="<%[ Hourly at ]%>" />
+<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"
+ />
+ <com:Application.Web.Portlets.DirectiveTextBox
+ ID="TimeMinAt"
+ Label="<%[ Minute ]%>"
+ InConfig="true"
+ Show="true"
+ />
+</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"
+ />
</div>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2018 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
$size_format = $this->getSizeFormat();
$directive_value = $this->getDirectiveValue();
$default_value = $this->getDefaultValue();
- if ($this->getInConfig() === false) {
+ if ($this->getInConfig() === false && empty($directive_value)) {
if ($default_value !== 0) {
$directive_value = $default_value;
} else {
<i class="fa fa-trash-alt remove_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>"></i>
<com:TRequiredFieldValidator
ID="DirectiveValidator"
- ValidationGroup="Directive"
+ ValidationGroup="<%=$this->getValidationGroup()%>"
Display="Dynamic"
ControlToValidate="Directive"
FocusOnError="true"
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
const PARENT_NAME = 'ParentName';
const GROUP_NAME = 'GroupName';
const IS_DIRECTIVE_CREATED = 'IsDirectiveCreated';
+ const VALIDATION_GROUP = 'ValidationGroup';
public $display_directive;
return $this->getAdapter()->getBaseActiveControl();
}
+ public function onInit($param) {
+ parent::onInit($param);
+ $this->ensureChildControls();
+ }
+
public function bubbleEvent($sender, $param) {
if ($param instanceof TCommandEventParameter) {
$this->raiseBubbleEvent($this, $param);
}
public function saveValue($sender, $param) {
- if (!$this->getPage()->IsPostBack) {
- return;
- }
$command_param = $this->getCmdParam();
if ($command_param === 'save' && method_exists($this, 'getValue')) {
$new_value = $this->getValue();
}
}
- private function getCmdParam() {
+ public function getCmdParam() {
$command_param = null;
- if (method_exists($this->getPage()->CallBackEventTarget, 'getCommandParameter')) {
- $command_param = $this->getPage()->CallBackEventTarget->getCommandParameter();
+ if ($this->getPage()->IsCallBack) {
+ if (method_exists($this->getPage()->CallBackEventTarget, 'getCommandParameter')) {
+ $command_param = $this->getPage()->CallBackEventTarget->getCommandParameter();
+ }
+ } elseif ($this->getPage()->IsPostBack) {
+ if (method_exists($this->getPage()->PostBackEventTarget, 'getCommandParameter')) {
+ $command_param = $this->getPage()->PostBackEventTarget->getCommandParameter();
+ }
}
return $command_param;
}
- public function onPreRender($param) {
- parent::onPreRender($param);
+ public function onLoad($param) {
+ parent::onLoad($param);
if (!$this->getIsDirectiveCreated()) {
$this->createDirective();
$this->setIsDirectiveCreated(true);
}
+
// show directives existing in config or all
$this->display_directive = $this->getShow();
}
public function setIsDirectiveCreated($is_created) {
$this->setViewState(self::IS_DIRECTIVE_CREATED, $is_created);
}
+
+ public function getValidationGroup() {
+ return $this->getViewState(self::VALIDATION_GROUP, 'Directive');
+ }
+
+ public function setValidationGroup($validation_group) {
+ $this->setViewState(self::VALIDATION_GROUP, $validation_group);
+ }
}
?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
Prado::using('System.Web.UI.ActiveControls.TActiveTextBox');
Prado::using('Application.Web.Portlets.DirectiveTemplate');
-class DirectiveText extends DirectiveTemplate {
+class DirectiveTextBox extends DirectiveTemplate {
public function getValue() {
$value = $this->Directive->getText();
$this->Label->Text = $this->getLabel();
$directive_value = $this->getDirectiveValue();
$default_value = $this->getDefaultValue();
- if ($this->getInConfig() === false) {
+ if ($this->getInConfig() === false && empty($directive_value)) {
if ($default_value !== 0) {
$directive_value = $default_value;
} else {
<i class="fa fa-trash-alt remove_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>"></i>
<com:TRequiredFieldValidator
ID="DirectiveValidator"
- ValidationGroup="Directive"
+ ValidationGroup="<%=$this->getValidationGroup()%>"
Display="Dynamic"
ControlToValidate="Directive"
FocusOnError="true"
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
$time_format = $this->getTimeFormat();
$directive_value = $this->getDirectiveValue();
$default_value = $this->getDefaultValue();
- if ($this->getInConfig() === false) {
+ if ($this->getInConfig() === false && empty($directive_value)) {
if ($default_value !== 0) {
$directive_value = $default_value;
} else {
<i class="fa fa-trash-alt remove_btn" onclick="document.getElementById('<%=$this->Directive->ClientID%>').value = '';" alt="<%[ Remove directive ]%>" title="<%[ Remove directive ]%>"></i>
<com:TRequiredFieldValidator
ID="DirectiveValidator"
- ValidationGroup="Directive"
+ ValidationGroup="<%=$this->getValidationGroup()%>"
Display="Dynamic"
ControlToValidate="Directive"
FocusOnError="true"
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 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.TCallback');
+Prado::using('Application.Web.Portlets.Portlets');
+
+class FileSetBrowser extends Portlets {
+
+ const CLIENT_ID = 'ClientId';
+ const PATH = 'Path';
+
+ /**
+ * Load client list.
+ *
+ * @return none
+ */
+ public function loadClients($sender, $param) {
+ $client_list = array('none' => Prado::localize('Please select Client'));
+ $clients = $this->getModule('api')->get(array('clients'))->output;
+ for ($i = 0; $i < count($clients); $i++) {
+ $client_list[$clients[$i]->clientid] = $clients[$i]->name;
+ }
+ asort($client_list);
+ $this->Client->dataSource = $client_list;
+ $this->Client->dataBind();
+ }
+
+ /**
+ * Set selected client.
+ *
+ * @param TActiveDropDownList $sender, sender object
+ * @param TCommandParameter $param parameters object
+ * @return none
+ */
+ public function selectClient($sender, $param) {
+ $client_id = $this->Client->getSelectedValue();
+ if ($client_id !== 'none') {
+ $this->setClientId($client_id);
+ $this->goToPath();
+ }
+ }
+
+ public function getItems($sender, $param) {
+ if ($param instanceof Prado\Web\UI\ActiveControls\TCallbackEventParameter) {
+ $path = $param->getCallbackParameter();
+ $this->setPath($path);
+ $this->goToPath();
+ }
+ }
+
+ public function goToPath() {
+ $client_id = $this->getClientId();
+ $query = '?path=' . rawurlencode($this->getPath());
+ $params = array(
+ 'clients',
+ $client_id,
+ 'ls',
+ $query
+ );
+ $result = $this->getModule('api')->get($params);
+ $this->getPage()->getCallbackClient()->callClientFunction(
+ 'FileSetBrowser_set_content',
+ json_encode($result->output)
+ );
+ }
+
+ public function setClientId($client_id) {
+ $this->setViewState(self::CLIENT_ID, $client_id);
+ }
+
+ public function getClientId() {
+ return $this->getViewState(self::CLIENT_ID);
+ }
+
+ public function setPath($path) {
+ $this->setViewState(self::PATH, $path);
+ }
+
+ public function getPath() {
+ return $this->getViewState(self::PATH, '/');
+ }
+}
+?>
--- /dev/null
+<div class="w3-container">
+ <div class="w3-container">
+ <div class="w3-third"><com:TLabel ForControl="Client" Text="<%[ Client: ]%>" /></div>
+ <div class="w3-third">
+ <com:TActiveDropDownList
+ ID="Client"
+ CssClass="w3-select w3-border"
+ Width="350px"
+ CausesValidation="false"
+ OnSelectedIndexChanged="selectClient"
+ >
+ </com:TActiveDropDownList>
+ </div>
+ </div>
+ <div class="w3-section w3-half">
+ <input type="text" id="fileset_browser_path" class="w3-input w3-twothird w3-border" placeholder="<%[ Go to path ]%>" />
+ <button type="button" class="w3-button w3-green" onclick="oFileSetBrowser.ls_items(document.getElementById('fileset_browser_path').value);"><i class="fa fa-check"></i> <%[ OK ]%></button>
+ </div>
+ <div class="w3-section w3-half">
+ <input type="text" id="fileset_browser_add_include_path" class="w3-input w3-twothird w3-border w3-margin-left" placeholder="<%[ Add new include path ]%>" onkeypress="oFileSetBrowser.add_include_path_by_input(event);" autocomplete="off" />
+ <button type="button" class="w3-button w3-green" onclick="oFileSetBrowser.add_include_path();"><i class="fa fa-plus"></i> <%[ Add ]%></button>
+ </div>
+ <div id="fileset_browser_file_container" class="w3-container w3-half w3-border"></div>
+ <div id="fileset_browser_include_container" class="w3-container w3-half w3-border"></div>
+ <div class="w3-section w3-half">
+ <input type="text" id="fileset_browser_add_exclude_path" class="w3-input w3-twothird w3-border w3-margin-left" placeholder="<%[ Add new global exclude path ]%>" onkeypress="oFileSetBrowser.add_exclude_path_by_input(event);" autocomplete="off" />
+ <button type="button" class="w3-button w3-green" onclick="oFileSetBrowser.add_exclude_path();"><i class="fa fa-plus"></i> <%[ Add ]%></button>
+ </div>
+ <div id="fileset_browser_exclude_container" class="w3-container w3-half w3-border"></div>
+ <com:TCallback ID="FileSetBrowserFiles" OnCallback="TemplateControl.getItems" />
+</div>
+<script type="text/javascript">
+var oFileSetBrowser = {
+ file_content: null,
+ include_content: null,
+ path_field: null,
+ path: [],
+ ids: {
+ file_container: 'fileset_browser_file_container',
+ include_container: 'fileset_browser_include_container',
+ exclude_container: 'fileset_browser_exclude_container',
+ path_field: 'fileset_browser_path',
+ add_include_path_field: 'fileset_browser_add_include_path',
+ add_exclude_path_field: 'fileset_browser_add_exclude_path'
+ },
+ css: {
+ item: 'item',
+ item_included: 'item_included',
+ item_excluded: 'item_excluded',
+ item_inc_exc_btn: 'item_inc_exc_btn',
+ item_selected_del_btn: 'item_selected_del_btn',
+ item_name: 'item_name',
+ dir_img: 'dir_item_img',
+ file_img: 'file_item_img',
+ link_img: 'link_item_img'
+ },
+ init: function() {
+ this.file_content = document.getElementById(this.ids.file_container);
+ this.include_content = document.getElementById(this.ids.include_container);
+ this.exclude_content = document.getElementById(this.ids.exclude_container);
+ this.path_field = document.getElementById(this.ids.path_field);
+ this.make_droppable();
+ },
+ reset: function() {
+ this.clear_content();
+ this.clear_includes();
+ this.path_field.value = '';
+ },
+ ls_items: function(path) {
+ var dpath;
+ if (path) {
+ this.set_path(path);
+ dpath = path;
+ } else {
+ dpath = this.get_path();
+ }
+ var request = <%=$this->FileSetBrowserFiles->ActiveControl->Javascript%>;
+ request.setCallbackParameter(dpath);
+ request.dispatch();
+ },
+ set_content: function(content) {
+ this.clear_content();
+
+ var items = JSON.parse(content);
+ items.sort(function(a, b) {
+ if (a.type === 'd' && b.type !== 'd') {
+ return -1;
+ } else if (a.type !== 'd' && b.type === 'd') {
+ return 1;
+ }
+ return a.item.localeCompare(b.item, undefined, { numeric: true, sensitivity: 'base' });
+ });
+
+ for (var i = 0; i < items.length; i++) {
+ this.set_item(items[i]);
+ }
+ this.make_draggable();
+ },
+ clear_content: function() {
+ while (this.file_content.firstChild) {
+ this.file_content.removeChild(this.file_content.firstChild);
+ }
+ },
+ make_draggable: function() {
+ $('.' + this.css.item).draggable({
+ helper: "clone"
+ });
+ },
+ make_droppable: function() {
+ $('#' + this.ids.include_container).droppable({
+ accept: '.' + this.css.item,
+ drop: function(e, ui) {
+ var path = ui.helper[0].getAttribute('rel');
+ this.add_include(path);
+ }.bind(this)
+ });
+ $('#' + this.ids.exclude_container).droppable({
+ accept: '.' + this.css.item,
+ drop: function(e, ui) {
+ var path = ui.helper[0].getAttribute('rel');
+ this.add_exclude(path);
+ }.bind(this)
+ });
+ },
+ set_item: function(item) {
+ var pattern = new RegExp('^' + this.get_path() + '/?');
+ var item_name = item.item;
+ if (item_name.substr(0, 1) !== '/') {
+ item_name += '/';
+ }
+ if (item_name !== this.get_path()) {
+ item_name = item.item.replace(pattern, '');
+ } else {
+ item_name = '.';
+ }
+ var el = document.createElement('DIV');
+ el.className = this.css.item;
+ el.setAttribute('rel', item.item);
+ var title = item_name;
+ var img = document.createElement('DIV');
+ if (item.type === 'd') {
+ img.className = this.css.dir_img;
+ el.addEventListener('click', function(e) {
+ var path = el.getAttribute('rel');
+ this.set_path(path);
+ this.ls_items(path);
+ }.bind(this));
+ } else if (item.type === '-') {
+ img.className = this.css.file_img;
+ } else if (item.type === 'l') {
+ img.className = this.css.link_img;
+ title = item_name + item.dest;
+ }
+ var name = document.createElement('DIV');
+ name.className = this.css.item_name;
+ name.textContent = item_name;
+
+ var include_btn = document.createElement('A');
+ include_btn.className = this.css.item_inc_exc_btn;
+ var include_btn_txt = document.createTextNode('<%[ Include ]%>');
+ include_btn.appendChild(include_btn_txt);
+ include_btn.addEventListener('click', function(e) {
+ e.stopPropagation();
+ this.add_include(item.item);
+ return false;
+ }.bind(this));
+
+ var exclude_btn = document.createElement('A');
+ exclude_btn.className = this.css.item_inc_exc_btn;
+ var exclude_btn_txt = document.createTextNode('<%[ Exclude ]%>');
+ exclude_btn.appendChild(exclude_btn_txt);
+ exclude_btn.addEventListener('click', function(e) {
+ e.stopPropagation();
+ this.add_exclude(item.item);
+ return false;
+ }.bind(this));
+
+ el.setAttribute('title',title);
+
+ el.appendChild(img);
+ el.appendChild(name);
+ el.appendChild(exclude_btn);
+ el.appendChild(include_btn);
+ this.file_content.appendChild(el);
+ if (item_name === '.' && this.get_path() !== '/') {
+ this.set_special_items();
+ }
+ },
+ set_special_items: function() {
+ var item_name = '..';
+ var el = document.createElement('DIV');
+ el.className = this.css.item;
+ el.setAttribute('rel', item_name);
+ var img = document.createElement('DIV');
+ img.className = this.css.dir_img;
+ var name = document.createElement('DIV');
+ name.className = this.css.item_name;
+ name.textContent = item_name;
+
+ el.addEventListener('click', function(e) {
+ var path = el.getAttribute('rel');
+ this.set_path(path);
+ this.ls_items();
+ }.bind(this));
+
+ el.setAttribute('title', item_name);
+
+ el.appendChild(img);
+ el.appendChild(name);
+ this.file_content.appendChild(el);
+ },
+ get_includes: function() {
+ var container = document.getElementById(this.ids.include_container);
+ var inc_elements = container.querySelectorAll('div.' + this.css.item_included);
+ var includes = [];
+ for (var i = 0; i < inc_elements.length; i++) {
+ includes.push(inc_elements[i].getAttribute('rel'));
+ }
+ return includes;
+ },
+ get_excludes: function() {
+ var container = document.getElementById(this.ids.exclude_container);
+ var exc_elements = container.querySelectorAll('div.' + this.css.item_excluded);
+ var excludes = [];
+ for (var i = 0; i < exc_elements.length; i++) {
+ excludes.push(exc_elements[i].getAttribute('rel'));
+ }
+ return excludes;
+ },
+ add_include: function(item) {
+ var el = document.createElement('DIV');
+ el.className = this.css.item_included;
+ el.setAttribute('rel', item);
+ var name = document.createElement('DIV');
+ name.textContent = item;
+ /**
+ * Container is needed, because <i> is replaced to SVG icon
+ * and it is impossible to set click event.
+ */
+ var del_btn_container = document.createElement('DIV');
+ var del_btn = document.createElement('I');
+ del_btn.className = 'fa fa-trash-alt item_selected_del_btn';
+ del_btn_container.appendChild(del_btn);
+ del_btn_container.addEventListener('click', function(e) {
+ el.parentNode.removeChild(el);
+ })
+ el.appendChild(del_btn_container);
+ el.appendChild(name);
+ this.include_content.appendChild(el);
+ },
+ add_exclude: function(item) {
+ var el = document.createElement('DIV');
+ el.className = this.css.item_excluded;
+ el.setAttribute('rel', item);
+ var name = document.createElement('DIV');
+ name.textContent = item;
+ /**
+ * Container is needed, because <i> is replaced to SVG icon
+ * and it is impossible to set click event.
+ */
+ var del_btn_container = document.createElement('DIV');
+ var del_btn = document.createElement('I');
+ del_btn.className = 'fa fa-trash-alt item_selected_del_btn';
+ del_btn_container.appendChild(del_btn);
+ del_btn_container.addEventListener('click', function(e) {
+ el.parentNode.removeChild(el);
+ })
+ el.appendChild(del_btn_container);
+ el.appendChild(name);
+ this.exclude_content.appendChild(el);
+ },
+ clear_includes: function() {
+ while (this.include_content.firstChild) {
+ this.include_content.removeChild(this.include_content.firstChild);
+ }
+ },
+ clear_excludes: function() {
+ while (this.exclude_content.firstChild) {
+ this.exclude_content.removeChild(this.exclude_content.firstChild);
+ }
+ },
+ set_path: function(item) {
+ var path = item.split('/');
+ if (path.length === 1) {
+ if (item === '..') {
+ this.path.pop();
+ } else {
+ this.path.push(item);
+ }
+ } else {
+ this.path = path;
+ }
+ this.path_field.value = this.get_path();
+ },
+ get_path: function() {
+ var path = this.path.join('/');
+ if (!path) {
+ path += '/';
+ }
+ return path;
+ },
+ add_include_path_by_input: function(e) {
+ var evt = e || window.event;
+ var key_code = evt.keyCode || evt.which;
+ if (key_code === 13) {
+ this.add_include_path();
+ }
+ },
+ add_include_path: function() {
+ var el = document.getElementById(this.ids.add_include_path_field);
+ if (el.value) {
+ this.add_include(el.value);
+ el.value = '';
+ el.focus();
+ }
+ },
+ add_exclude_path_by_input: function(e) {
+ var evt = e || window.event;
+ var key_code = evt.keyCode || evt.which;
+ if (key_code === 13) {
+ this.add_exclude_path();
+ }
+ },
+ add_exclude_path: function() {
+ var el = document.getElementById(this.ids.add_exclude_path_field);
+ if (el.value) {
+ this.add_exclude(el.value);
+ el.value = '';
+ el.focus();
+ }
+ }
+};
+
+function FileSetBrowser_set_content(content) {
+ oFileSetBrowser.set_content(content);
+}
+$(function() {
+ oFileSetBrowser.init();
+});
+</script>
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 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('Application.Web.Portlets.DirectiveRenderer');
+
+class FileSetOptionRenderer extends DirectiveRenderer {
+
+ private static $index = 0;
+ private $item_count;
+
+ public function onPreRender($param) {
+ parent::onPreRender($param);
+ $this->item_count = $this->getParent()->getItems()->getCount();
+ }
+
+ public function render($writer) {
+ if (self::$index % 30 === 0) {
+ $writer->write('<h3 class="options">Options #' . ((self::$index/30) + 1) . '</h3><hr />');
+ }
+ self::$index++;
+
+ if (self::$index === $this->item_count) {
+ $this->resetIndex();
+ }
+ parent::render($writer);
+ }
+
+ public static function resetIndex() {
+ self::$index = 0;
+ }
+}
+?>
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 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('Application.Web.Portlets.DirectiveRenderer');
+
+class JobRunscriptRenderer extends DirectiveRenderer {
+
+ private static $index = 0;
+ private $item_count;
+
+ public function onPreRender($param) {
+ parent::onPreRender($param);
+ $this->item_count = $this->getParent()->getItems()->getCount();
+ }
+
+ public function render($writer) {
+ if (self::$index % 7 === 0) {
+ $writer->write('<h3 class="options">Runscript #' . ((self::$index/7) + 1) . '</h3><hr />');
+ }
+ self::$index++;
+
+ if (self::$index === $this->item_count) {
+ $this->resetIndex();
+ }
+ parent::render($writer);
+ }
+
+ public static function resetIndex() {
+ self::$index = 0;
+ }
+}
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2017 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
Prado::using('System.Web.Ui.ActiveControls.TActiveRepeater');
Prado::using('Application.Web.Portlets.DirectiveListTemplate');
-Prado::using('Application.Web.Portlets.DirectiveBoolean');
+Prado::using('Application.Web.Portlets.DirectiveCheckBox');
class MessageTypes extends DirectiveListTemplate {
}
public function getDirectiveValues() {
- $type_controls = $this->RepeaterMessageTypes->findControlsByType('DirectiveBoolean');
+ $type_controls = $this->RepeaterMessageTypes->findControlsByType('DirectiveCheckBox');
$is_all = false;
$types = array();
for ($i = 0; $i < count($type_controls); $i++) {
}
public function createTypeListElement($sender, $param) {
- $control = $this->getChildControl($param->Item, 'DirectiveBoolean');
+ $control = $this->getChildControl($param->Item, 'DirectiveCheckBox');
if (is_object($control)) {
$control->setHost($param->Item->Data['host']);
$control->setComponentType($param->Item->Data['component_type']);
<com:TActiveRepeater ID="RepeaterMessageTypes" OnItemCreated="createTypeListElement">
<prop:ItemTemplate>
- <com:Application.Web.Portlets.DirectiveBoolean />
+ <com:Application.Web.Portlets.DirectiveCheckBox />
</prop:ItemTemplate>
</com:TActiveRepeater>
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 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('Application.Web.Portlets.DirectiveListTemplate');
+
+class NewFileSetExcMenu extends DirectiveListTemplate {
+
+ const ITEM_INDEX = 'ItemIndex';
+
+ public function setItemIndex($index) {
+ $this->setViewState(self::ITEM_INDEX, $index);
+ }
+
+ public function getItemIndex() {
+ return $this->getViewState(self::ITEM_INDEX);
+ }
+}
+?>
--- /dev/null
+<div id="<%=$this->ClientID%>_new_fileset" class="w3-card w3-white w3-padding left config_new_fileset" style="display: none">
+ <i class="fa fa-times w3-right" onclick="$('#<%=$this->ClientID%>_new_fileset').hide();" /></i>
+ <ul class="w3-ul" style="margin-top: 0">
+ <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();"
+ Text="Add file/directory"
+ Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
+ />
+ </li>
+ </ul>
+</div>
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 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('Application.Web.Portlets.DirectiveListTemplate');
+
+class NewFileSetFileOptMenu extends DirectiveListTemplate {
+
+ const ITEM_INDEX = 'ItemIndex';
+
+ public function setItemIndex($index) {
+ $this->setViewState(self::ITEM_INDEX, $index);
+ }
+
+ public function getItemIndex() {
+ return $this->getViewState(self::ITEM_INDEX);
+ }
+}
+?>
--- /dev/null
+<div id="<%=$this->ClientID%>_new_fileset" class="w3-card w3-white w3-padding left config_new_fileset" style="display: none">
+ <i class="fa fa-times w3-right" onclick="$('#<%=$this->ClientID%>_new_fileset').hide();" /></i>
+ <ul class="w3-ul" style="margin-top: 0">
+ <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();"
+ Text="<i class='fa fa-plus'></i> Add single file/directory"
+ Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
+ />
+ </li>
+ <li><com:TLinkButton
+ ID="IncludeFileItemByBrowser"
+ Text="<i class='fa fa-plus'></i> Add files by file browser"
+ Attributes.onclick="$(this).closest('div.config_new_fileset').hide(); oFileSetBrowser.reset(); $('#fileset_browser').show(); return false;"
+ />
+ </li>
+ <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);"
+ Text="<i class='fa fa-plus'></i> Add options block"
+ Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
+ />
+ </li>
+ </ul>
+</div>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2017 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
Prado::using('Application.Web.Portlets.DirectiveListTemplate');
-class NewFileSetMenu extends DirectiveListTemplate {
+class NewFileSetIncExcMenu extends DirectiveListTemplate {
}
+?>
--- /dev/null
+<div id="<%=$this->ClientID%>_new_fileset" class="w3-card w3-white w3-padding left config_new_fileset" style="display: none">
+ <i class="fa fa-times w3-right" onclick="$('#<%=$this->ClientID%>_new_fileset').hide();" /></i>
+ <ul class="w3-ul" style="margin-top: 0">
+ <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="<i class='fa fa-plus'></i> Add include block"
+ Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
+ />
+ </li>
+ <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="<i class='fa fa-plus'></i> Add exclude block"
+ Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
+ />
+ </li>
+ </ul>
+</div>
+++ /dev/null
-<div id="<%=$this->ClientID%>_new_fileset" class="w3-card w3-white w3-padding left config_new_fileset" style="display: none">
- <i class="fa fa-times w3-right" onclick="$('#<%=$this->ClientID%>_new_fileset').hide();" /></i>
- <ul class="w3-ul" style="margin-top: 0">
- <li style="display: <%=$this->getDirectiveName() == 'Include' ? '' : 'none'%>"><com:TActiveLinkButton
- ID="IncludeFileItem"
- OnCommand="Parent.SourceTemplateControl.newIncludeFile"
- CommandParameter="save"
- ClientSide.OnComplete="var el = $('#<%=$this->IncludeFileItem->ClientID%>').parents('div').find('div.include_file'); BaculaConfig.scroll_to_element(el[el.length-1]);"
- Text="File"
- Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
- />
- </li>
- <li style="display: <%=$this->getDirectiveName() == 'Include' ? '' : 'none'%>"><com:TActiveLinkButton
- ID="OptionsItem"
- OnCommand="Parent.SourceTemplateControl.newIncludeOptions"
- CommandParameter="save"
- ClientSide.OnComplete="var el = $('#<%=$this->OptionsItem->ClientID%>').parents('div').find('h3.options'); BaculaConfig.scroll_to_element(el[el.length-1]);"
- Text="Options"
- Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
- />
- </li>
- <li style="display: <%=$this->getDirectiveName() == 'Exclude' ? '' : 'none'%>"><com:TActiveLinkButton
- OnCommand="Parent.SourceTemplateControl.newExcludeFile"
- CommandParameter="save"
- Text="Exclude"
- Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
- />
- </li>
- </ul>
-</div>
ID="RunscriptItem"
OnCommand="Parent.SourceTemplateControl.newRunscriptDirective"
CommandParameter="save"
- ClientSide.OnComplete="var el = $('#<%=$this->RunscriptItem->ClientID%>').parents('div.directive_field').find('div').find('h3.runscript'); BaculaConfig.scroll_to_element(el[el.length-1]);"
+ ClientSide.OnComplete="var el = $('#<%=$this->RunscriptItem->ClientID%>').parents('div').find('h3.options'); BaculaConfig.scroll_to_element(el[el.length-1]);"
Text="Runscript"
Attributes.onclick="$(this).closest('div.config_new_runscript').hide();"
/>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2018 Kern Sibbald
+ * Copyright (C) 2013-2019 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
const RESOURCE_SHOW_PATTERN = '/^\s+--> %resource: name=(.+?(?=\s\S+\=.+)|.+$)/i';
const JOB_SHOW_PATTERN = '/^Job:\sname=(?P<jobname>.+)\sJobType=\d+\slevel=(?P<level>\w+)?\sPriority=(?P<priority>\d+)/i';
+ const ACCURATE_PATTERN = '/^\s+Accurate=(?P<accurate>\d)/i';
const DEFAULT_JOB_PRIORITY = 10;
if (empty($jobdata->storage)) {
$jobdata->storage = $this->getResourceName('autochanger', $job_show);
}
+ $jobdata->priorjobid = $job_attr['priority'];
+ $jobdata->accurate = (key_exists('accurate', $job_attr) && $job_attr['accurate'] == 1);
} else {
$jobs = array();
$job_list = $this->getModule('api')->get(array('jobs', 'resnames'), null, true, self::USE_CACHE)->output;
}
$this->Storage->dataBind();
+ if (is_object($jobdata) && property_exists($jobdata, 'accurate')) {
+ $this->Accurate->Checked = $jobdata->accurate;
+ }
+
$priority = self::DEFAULT_JOB_PRIORITY;
if (is_object($jobdata) && property_exists($jobdata, 'priorjobid') && $jobdata->priorjobid > 0) {
$priority = $jobdata->priorjobid;
$attr['jobname'] = $match['jobname'];
$attr['level'] = $match['level'];
$attr['priority'] = $match['priority'];
+ }
+ if (preg_match(self::ACCURATE_PATTERN, $jobshow[$i], $match) === 1) {
+ $attr['accurate'] = $match['accurate'];
break;
}
}
<url ServiceParameter="WebConfigWizard" pattern="web/config/" />
<url ServiceParameter="RestoreWizard" pattern="web/restore/" />
<url ServiceParameter="RestoreWizard" pattern="web/restore/{jobid}/" parameters.jobid="\d+" />
+ <url ServiceParameter="NewJobWizard" pattern="web/new/job/" />
<url ServiceParameter="BaculumError" pattern="web/message/{error}/" parameters.error="\d+" />
<url ServiceParameter="Monitor" pattern="web/monitor/" />
<url ServiceParameter="OAuth2Redirect" pattern="web/redirect/" />
.justify {
text-align: justify;
}
+
+#fileset_browser_file_container, #fileset_browser_include_container, #fileset_browser_exclude_container {
+ width: 50%;
+ overflow-y: auto;
+ overflow-x: none;
+ background-color: white;
+ padding: 0;
+ height: 384px;
+}
+
+#fileset_browser_include_container {
+ height: 150px;
+}
+
+#fileset_browser_exclude_container {
+ height: 162px;
+}
+
+.item {
+ cursor: pointer;
+ clear: left;
+ height: 30px;
+}
+
+.item a {
+ text-decoration: underline;
+}
+
+.item, .item_included, .item_excluded {
+ padding: 4px 0 4px 4px;
+ background-color: transparent;
+}
+
+.item_included, .item_excluded {
+ width: 100%;
+}
+
+.item:hover, .item_included:hover, .item_excluded:hover {
+ width: 100%;
+ height: 30px;
+ background-color: #e7e7e7;
+}
+
+.item_inc_exc_btn {
+ display: inline-block;
+ float: right;
+ margin-left: 5px;
+}
+
+.item_selected_del_btn {
+ float: right;
+ margin: 2px 10px;
+ cursor: pointer;
+}
+
+.item_name {
+ width: 69%;
+ float: left;
+ padding-left: 5px;
+}
+
+.dir_item_img, .file_item_img, .link_item_img {
+ width: 30px;
+ height: 24px;
+ background-repeat: no-repeat;
+ float: left;
+}
+
+.dir_item_img {
+ background-image: url('/themes/Baculum-v2/directory-icon.png');
+}
+
+.file_item_img {
+ background-image: url('/themes/Baculum-v2/file-icon.png');
+}
+
+.link_item_img {
+ background-image: url('/themes/Baculum-v2/link-icon.png');
+}
overflow-y: auto;
}
+.normal {
+ font-weight: normal;
+}
+
.bold {
font-weight: bold;
}