]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: New create backup job wizard
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 13 Apr 2019 12:13:19 +0000 (14:13 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Mon, 15 Apr 2019 19:00:32 +0000 (21:00 +0200)
Changes:
- New client file browser for selecting FileSet includes/excludes
- Resign from using BConditional control
- Start using renderer classes
- Rename basic directive controls to have consistent names
- Show 'save' button for editing existing resources
- Show 'create' button for creating new resource
- Fix run job Accurate and Priority values

62 files changed:
gui/baculum/protected/Common/Class/Miscellaneous.php
gui/baculum/protected/Web/JavaScript/bacula-config.js
gui/baculum/protected/Web/Lang/en/messages.mo
gui/baculum/protected/Web/Lang/en/messages.po
gui/baculum/protected/Web/Lang/ja/messages.mo
gui/baculum/protected/Web/Lang/ja/messages.po
gui/baculum/protected/Web/Lang/pl/messages.mo
gui/baculum/protected/Web/Lang/pl/messages.po
gui/baculum/protected/Web/Lang/pt/messages.mo
gui/baculum/protected/Web/Lang/pt/messages.po
gui/baculum/protected/Web/Layouts/Wizard.tpl
gui/baculum/protected/Web/Pages/FileSetView.php
gui/baculum/protected/Web/Pages/JobHistoryList.page
gui/baculum/protected/Web/Pages/JobList.page
gui/baculum/protected/Web/Pages/NewJobWizard.page
gui/baculum/protected/Web/Pages/NewJobWizard.php
gui/baculum/protected/Web/Portlets/BConditional.php
gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php
gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.tpl
gui/baculum/protected/Web/Portlets/DirectiveCheckBox.php [moved from gui/baculum/protected/Web/Portlets/DirectiveBoolean.php with 89% similarity]
gui/baculum/protected/Web/Portlets/DirectiveCheckBox.tpl [moved from gui/baculum/protected/Web/Portlets/DirectiveBoolean.tpl with 100% similarity]
gui/baculum/protected/Web/Portlets/DirectiveComboBox.php
gui/baculum/protected/Web/Portlets/DirectiveComboBox.tpl
gui/baculum/protected/Web/Portlets/DirectiveFileSet.php
gui/baculum/protected/Web/Portlets/DirectiveFileSet.tpl
gui/baculum/protected/Web/Portlets/DirectiveInteger.php
gui/baculum/protected/Web/Portlets/DirectiveInteger.tpl
gui/baculum/protected/Web/Portlets/DirectiveListBox.tpl
gui/baculum/protected/Web/Portlets/DirectiveListTemplate.php
gui/baculum/protected/Web/Portlets/DirectiveMessages.php
gui/baculum/protected/Web/Portlets/DirectiveMessages.tpl
gui/baculum/protected/Web/Portlets/DirectiveRenderer.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/DirectiveRunscript.php
gui/baculum/protected/Web/Portlets/DirectiveRunscript.tpl
gui/baculum/protected/Web/Portlets/DirectiveSchedule.php
gui/baculum/protected/Web/Portlets/DirectiveSchedule.tpl
gui/baculum/protected/Web/Portlets/DirectiveSize.php
gui/baculum/protected/Web/Portlets/DirectiveSize.tpl
gui/baculum/protected/Web/Portlets/DirectiveTemplate.php
gui/baculum/protected/Web/Portlets/DirectiveTextBox.php [moved from gui/baculum/protected/Web/Portlets/DirectiveText.php with 90% similarity]
gui/baculum/protected/Web/Portlets/DirectiveTextBox.tpl [moved from gui/baculum/protected/Web/Portlets/DirectiveText.tpl with 96% similarity]
gui/baculum/protected/Web/Portlets/DirectiveTimePeriod.php
gui/baculum/protected/Web/Portlets/DirectiveTimePeriod.tpl
gui/baculum/protected/Web/Portlets/FileSetBrowser.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/FileSetBrowser.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/FileSetOptionRenderer.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/JobRunscriptRenderer.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/MessageTypes.php
gui/baculum/protected/Web/Portlets/MessageTypes.tpl
gui/baculum/protected/Web/Portlets/NewFileSetExcMenu.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/NewFileSetExcMenu.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/NewFileSetFileOptMenu.php [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/NewFileSetFileOptMenu.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/NewFileSetIncExcMenu.php [moved from gui/baculum/protected/Web/Portlets/NewFileSetMenu.php with 88% similarity]
gui/baculum/protected/Web/Portlets/NewFileSetIncExcMenu.tpl [new file with mode: 0644]
gui/baculum/protected/Web/Portlets/NewFileSetMenu.tpl [deleted file]
gui/baculum/protected/Web/Portlets/NewRunscriptMenu.tpl
gui/baculum/protected/Web/Portlets/RunJob.php
gui/baculum/protected/Web/endpoints.xml
gui/baculum/themes/Baculum-v2/css/baculum.css
gui/baculum/themes/Baculum-v2/css/restore-wizard.css
gui/baculum/themes/Baculum-v2/link-icon.png [new file with mode: 0644]

index 38f2c0c6d97c1fcc858bf966d6b6331f8753bff1..0c18b1bd452c908ea6d2ab183ad52bdf3df7b193 100644 (file)
@@ -204,7 +204,15 @@ class Miscellaneous extends TModule {
        }
 
        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) {
index 98ab78d4b01064d95e20a4d6422a9352aa450253..7ae5d6251a13e8ad97f6446e805b6eab9c000a8a 100644 (file)
@@ -28,8 +28,14 @@ var BaculaConfigClass = jQuery.klass({
                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');
index 233e33fa36562a3593e9a1c91de3e7174ace12b6..837a5fbed09c635f069cd95b5eff8de6ad646de7 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ
index 612aa9580e8440b2778da3bdaae5a7020cf354e7..e2e7cd7af719247ce0a745bf8108c8c7374444ef 100644 (file)
@@ -1835,3 +1835,194 @@ msgstr "Error code:"
 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"
index d6fb25d12a4d0ac242b748e897c29567aa72bf0f..0cc644f389550daf0d0999931c29131d02cb22a1 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ
index d2456e511b314f352b20d0f39ff197f25a5c2f39..b38e1041d053b4dc0f90f43330bb031f6e952a53 100644 (file)
@@ -1935,3 +1935,195 @@ msgid ""
 "{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"
index 48c7918dfa32eb4a6e54dfc3ab3951f13db409cf..cdcef410b77dd61ca8a6ec4ec1356bb7b8a6ac94 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ
index c7f3fb67c1cf9748399f451c2fff6382e67b68d9..eafdc55dfc9cabe0220fbead6127e6ddb09357ee 100644 (file)
@@ -1841,3 +1841,195 @@ msgstr "Kod błędu:"
 
 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"
index a7ec95d0390cb9891f83dfd155eb0ab9dabe3439..322093e982beaba8d3d0a27798cbfdf4a17be948 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ
index 695c9fed354b6e43dfe253c0b6eee68d49ae27e5..b61149f0801c6f0d73542d707c97d2cdda2268f5 100644 (file)
@@ -1850,3 +1850,194 @@ msgstr "Error code:"
 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"
index 7342b8d15d28d68933db1f06bbea89232159e632..bf043972d4f5739458123480eccf7305e606fc8a 100644 (file)
                        <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>
index 4056dc162b52047ba58d18b862ba77d8b7435984..2756091187c06b8ede5d398af23c7236b4c19229 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -38,6 +38,13 @@ class FileSetView extends BaculumWebPage {
                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());
index 36a1e1dbbcc9d0e6e87522907badbf0bf0b09627..ea18d57632fd1e3095271fbb32655c7fa787d47d 100644 (file)
@@ -8,6 +8,7 @@
        </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> &nbsp;<%[ 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> &nbsp;<%[ New job wizard ]%></button>
                <com:TActiveLinkButton
                        CssClass="w3-button w3-green"
                        OnClick="loadRunJobModal"
index 4e95b9f68d88040671b87aedada4dda43d5e5a50..2ee6826083e11dab5a0ef6ccd123b4fce00a67f2 100644 (file)
@@ -8,6 +8,7 @@
        </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> &nbsp;<%[ 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> &nbsp;<%[ New job wizard ]%></button>
                <com:TActiveLinkButton
                        CssClass="w3-button w3-green"
                        OnClick="loadRunJobModal"
index 6baba64872e78614ca643f8b198b8f7ffc152f86..b86d85667c25ab691930174653c0dbd39b83e165 100644 (file)
@@ -1,4 +1,4 @@
-<%@ 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 &raquo; ]%>" /></div>
+                       <div class="w3-center w3-section">
+                               <com:TLinkButton
+                                       CommandName="Cancel"
+                                       CssClass="w3-button w3-red"
+                               >
+                                       <i class="fa fa-times"></i> &nbsp;<%[ Cancel ]%>
+                               </com:TLinkButton>
+                               <com:TLinkButton
+                                       CommandName="NextStep"
+                                       CommandParameter="save"
+                                       ValidationGroup="NewJobDirective"
+                                       CssClass="w3-button w3-green"
+                               >
+                                       <%[ Next ]%>&nbsp; <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="<%[ &laquo; Previous ]%>" />
-                               <com:BButton ID="NextButton" CommandName="NextStep" Text="<%[ Next &raquo; ]%>" 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> &nbsp;<%[ Cancel ]%>
+                               </com:TLinkButton>
+                               <com:TLinkButton
+                                       ID="PreviousStepBtn"
+                                       CommandName="PreviousStep"
+                                       CausesValidation="false"
+                                       CssClass="w3-button w3-green"
+                               >
+                                       <i class="fa fa-angle-left"></i> &nbsp;<%[ Previous ]%>
+                               </com:TLinkButton>
+                               <com:TLinkButton
+                                       CommandName="NextStep"
+                                       CommandParameter="save"
+                                       ValidationGroup="NewJobDirective"
+                                       CssClass="w3-button w3-green"
+                               >
+                                       <%[ Next ]%>&nbsp; <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="<%[ &laquo; 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> &nbsp;<%[ Previous ]%>
+                               </com:TLinkButton>
+                               <com:TLinkButton
+                                       CommandName="Complete"
+                                       CommandParameter="save"
+                                       CssClass="w3-button w3-green"
+                               >
+                                       <%[ Create job ]%> &nbsp;<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> &nbsp;<%[ 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> &nbsp;<%[ 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> &nbsp;<%[ 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> &nbsp;<%[ 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> &nbsp;<%[ 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> &nbsp;<%[ 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>
index 86655a20101b3227958e5efa4e55de28ca9c6c1a..ade0e20467572e60e992d283fa1b676401bfc589 100644 (file)
@@ -3,7 +3,7 @@
  * 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);
        }
 }
 ?>
index dc3621345585939c8da6fdb4b405dfbdadc61df5..b90ee114e0ddadd781758b6520c8fc7bd64918da 100644 (file)
@@ -3,7 +3,7 @@
  * 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;
@@ -31,6 +30,12 @@ class BConditional extends TTemplateControl implements IActiveControl {
 
        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();
@@ -41,49 +46,46 @@ class BConditional extends TTemplateControl implements IActiveControl {
                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() {
@@ -105,57 +107,5 @@ class BConditional extends TTemplateControl implements IActiveControl {
                        $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;
-               }
-       }
 }
 ?>
index 3a89fdb641f7ad9c2cac2cfd7c9c1002163d6516..2ffe7ff881e80fb8ff26f86a8b6d7fcc08140291 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -24,14 +24,13 @@ 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.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');
@@ -48,11 +47,11 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
        public $resource_names = array();
 
        private $directive_types = array(
-               'DirectiveBoolean',
+               'DirectiveCheckBox',
                'DirectiveComboBox',
                'DirectiveInteger',
                'DirectiveListBox',
-               'DirectiveText',
+               'DirectiveTextBox',
                'DirectiveSize',
                'DirectiveTimePeriod'
        );
@@ -117,6 +116,7 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                                ));
                        }
                }
+
                $data_desc = $this->Application->getModule('data_desc');
                $resource_desc = $data_desc->getDescription($component_type, $resource_type);
                foreach ($resource_desc as $directive_name => $directive_desc) {
@@ -164,6 +164,21 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                        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,
@@ -180,6 +195,8 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                                        '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);
@@ -269,13 +286,16 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                                }
                                $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');
@@ -295,6 +315,9 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                                if (is_null($directive_value)) {
                                        continue;
                                }
+                               if ($directive_name === 'Exclude') {
+                                       continue;
+                               }
                                if (!array_key_exists($directive_name, $directives)) {
                                        $directives[$directive_name] = array();
                                }
@@ -306,6 +329,11 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                                                        $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) {
index 1751c15642b3a779327a3f623c3d7372e70c7764..450170c4a57c29cbdf29a8bfa4deca2e53ee4be1 100644 (file)
        </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> &nbsp;<%=Prado::localize('Save')%>
+                               <i class="fa fa-save"></i> &nbsp;<%=$this->getLoadValues() ? Prado::localize('Save') : Prado::localize('Create')%>
                        </prop:Text>
                        <prop:ClientSide.OnLoading>
                                $('.save_progress').show();
similarity index 89%
rename from gui/baculum/protected/Web/Portlets/DirectiveBoolean.php
rename to gui/baculum/protected/Web/Portlets/DirectiveCheckBox.php
index e36dd2e071422215e45ddcbad08d887bb021857a..c2486ebbd2b46685ffbf347964874ec187605d24 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -24,7 +24,7 @@ Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
 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.)
@@ -40,7 +40,7 @@ class DirectiveBoolean extends DirectiveTemplate {
                $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();
index 757052d3380ab9342c733657a3a8a306397e9612..62adbd31ba15696fad8370ed97187631e001b473 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -26,6 +26,18 @@ Prado::using('Application.Web.Portlets.DirectiveTemplate');
 
 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)) {
@@ -34,7 +46,7 @@ class DirectiveComboBox extends DirectiveTemplate {
                return $value;
        }
 
-       public function createDirective() {
+       public function createDirectiveInternal() {
                $this->Label->Text = $this->getLabel();
                $data = $this->getData();
                $resource_names = $this->getResourceNames();
@@ -57,7 +69,7 @@ class DirectiveComboBox extends DirectiveTemplate {
 
                $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 {
index 7ee02e467a0b01852e6e8869ca3282a8c93c3426..217be8b8bcfa60b4b39e9d3d56a8f4cc3d796eed 100644 (file)
@@ -12,7 +12,7 @@
                <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"
index 733aaf41ddafd59587848d6572a66a3d65f30e39..469c5006bdefc988c4da2a6c9b7bde2dbddf11c2 100644 (file)
@@ -3,7 +3,7 @@
  * 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) {
@@ -50,39 +50,52 @@ class DirectiveFileSet extends DirectiveListTemplate {
                $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) {
@@ -91,6 +104,10 @@ class DirectiveFileSet extends DirectiveListTemplate {
                $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(
@@ -101,12 +118,23 @@ class DirectiveFileSet extends DirectiveListTemplate {
                                '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();
@@ -118,10 +146,17 @@ class DirectiveFileSet extends DirectiveListTemplate {
 
                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;
@@ -142,6 +177,17 @@ class DirectiveFileSet extends DirectiveListTemplate {
                                                $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);
                                }
@@ -156,6 +202,7 @@ class DirectiveFileSet extends DirectiveListTemplate {
                                                'directive_value' => $directive_value[$j],
                                                'default_value' => $default_value,
                                                'required' => $required,
+                                               'resource' => null,
                                                'data' => $data,
                                                'field_type' => $field_type,
                                                'in_config' => $in_config,
@@ -170,54 +217,64 @@ class DirectiveFileSet extends DirectiveListTemplate {
        }
 
        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();
@@ -226,43 +283,21 @@ class DirectiveFileSet extends DirectiveListTemplate {
                                        // 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) {
@@ -285,59 +320,81 @@ class DirectiveFileSet extends DirectiveListTemplate {
                }
        }
 
-       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);
+       }
 }
 ?>
index eb4ac1e92e0808118dfd53bd924791cf6e0aa645..4524c47dbc80f7050bc89eec7248c925273e94ec 100644 (file)
@@ -1,74 +1,76 @@
-<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> &nbsp;<%[ 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> &nbsp;<%[ 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> &nbsp;<%[ 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> &nbsp;<%[ 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> &nbsp; <%[ 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> &nbsp;<%[ 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');
index e55df261234c7d149d4facc2b8f22f693ecbf4fe..13a919230668dc8429f4c33da83fbbea407efb3c 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -39,7 +39,7 @@ class DirectiveInteger extends DirectiveTemplate {
                $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 {
index 5f63a8d839e807295aede0a0acf6433271a2a9b5..9714de267eb2ca1c763179602c60131618b531eb 100644 (file)
@@ -12,7 +12,7 @@
                <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"
@@ -20,7 +20,7 @@
                        Enabled="<%=$this->getRequired() && $this->getShow()%>"
                />
                <com:TDataTypeValidator
-                       ValidationGroup="Directive"
+                       ValidationGroup="<%=$this->getValidationGroup()%>"
                        Display="Dynamic"
                        ControlToValidate="Directive"
                        FocusOnError="true"
index 3ca7a9d61fddc33b57170ded2305d9e49218bd92..da92f9e020842c49417285fc8aba20322e01a179 100644 (file)
@@ -13,7 +13,7 @@
                <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"
index 1f16931358a2a907aeaf67fd3e67cc306f13f7bc..2b08f7e699d82ee3b7e4177ade661f20ccd43ca7 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -58,9 +58,11 @@ class DirectiveListTemplate extends ConfigListTemplate implements IActiveControl
                $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();
        }
 
@@ -137,7 +139,7 @@ class DirectiveListTemplate extends ConfigListTemplate implements IActiveControl
        }
 
        public function getLoadValues() {
-               return $this->getViewState(self::LOAD_VALUES);
+               return $this->getViewState(self::LOAD_VALUES, true);
        }
 
        public function setLoadValues($load_values) {
index 4943ece4cfb24a0a1e1d0619289216ddceb5c49b..21a2850fe2a711f35a862b59552240f06e67f725 100644 (file)
@@ -3,7 +3,7 @@
  * 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(
@@ -129,7 +128,7 @@ class DirectiveMessages extends DirectiveListTemplate {
                $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());
                        }
@@ -162,7 +161,7 @@ class DirectiveMessages extends DirectiveListTemplate {
                $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());
                        }
index 567add3b95e8ce77b69e4d407964615fbe8a8d60..25906eff85db9970847cb6c6c3757b1e06ff0c8f 100644 (file)
@@ -1,13 +1,11 @@
-<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> &nbsp;<%[ 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>
diff --git a/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php b/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php
new file mode 100644 (file)
index 0000000..d064c0a
--- /dev/null
@@ -0,0 +1,134 @@
+<?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;
+       }
+}
+?>
index a7d1940251c2f245170fca155ee33593762c7015..91b69fd021c34b3042e8c8d18e50fd007fe02cb9 100644 (file)
@@ -3,7 +3,7 @@
  * 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'
        );
 
@@ -41,101 +41,75 @@ class DirectiveRunscript extends DirectiveListTemplate {
                $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();
@@ -146,46 +120,44 @@ class DirectiveRunscript extends DirectiveListTemplate {
                        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);
index 1ca92ae28e9363d8697ec9aa2c0c2ba4459b23fa..170c0eef8bdc961e3319231fe634404256ee2e11 100644 (file)
@@ -1,31 +1,11 @@
-<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> &nbsp;<%[ 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>
index 8b7ead3167ce4e5261a03cbfca7a4e3a2c66b638..3e561820b563841d79fada2fbcd2d121e5ba45e3 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -22,9 +22,9 @@
 
 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 {
@@ -32,8 +32,8 @@ class DirectiveSchedule extends DirectiveListTemplate {
        public $directives;
 
        private $directive_types = array(
-               'DirectiveBoolean',
-               'DirectiveText',
+               'DirectiveCheckBox',
+               'DirectiveTextBox',
                'DirectiveComboBox',
                'DirectiveTimePeriod'
        );
@@ -310,7 +310,7 @@ class DirectiveSchedule extends DirectiveListTemplate {
                                if (is_null($directive_value)) {
                                        continue;
                                }
-                               if ($this->directive_types[$i] === 'DirectiveBoolean') {
+                               if ($this->directive_types[$i] === 'DirectiveCheckBox') {
                                        settype($default_value, 'bool');
                                }
 
@@ -318,7 +318,7 @@ class DirectiveSchedule extends DirectiveListTemplate {
                                        // 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}\"";
index 6b85822d3045879f06ac13b440bfccea9c79e3e5..f3bf2afe427b362b6c3eae75d7104d1190bc0c4a 100644 (file)
-<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>
index 6605335509823a7fb33010003df94a58d5867db6..00edfa24d55c3c0d1f922fb52432bcfba83a1600 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -74,7 +74,7 @@ class DirectiveSize extends DirectiveTemplate {
                $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 {
index 4ff363e140572f32f144b4f4c54cc83e71ec97e1..02d3947b0ec753886a1e212546ed73a14db26dc1 100644 (file)
@@ -21,7 +21,7 @@
                <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"
index 5473b66055e58869efe5353d56ffe2786bd5e408..6e458abf9305302d97e23b2c18efd0c83c36601e 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -44,6 +44,7 @@ class DirectiveTemplate extends TTemplateControl implements IDirectiveField, IAc
        const PARENT_NAME = 'ParentName';
        const GROUP_NAME = 'GroupName';
        const IS_DIRECTIVE_CREATED = 'IsDirectiveCreated';
+       const VALIDATION_GROUP = 'ValidationGroup';
 
        public $display_directive;
 
@@ -58,6 +59,11 @@ class DirectiveTemplate extends TTemplateControl implements IDirectiveField, IAc
                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);
@@ -68,9 +74,6 @@ class DirectiveTemplate extends TTemplateControl implements IDirectiveField, IAc
        }
 
        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();
@@ -78,20 +81,27 @@ class DirectiveTemplate extends TTemplateControl implements IDirectiveField, IAc
                }
        }
 
-       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();
        }
@@ -249,5 +259,13 @@ class DirectiveTemplate extends TTemplateControl implements IDirectiveField, IAc
        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);
+       }
 }
 ?>
similarity index 90%
rename from gui/baculum/protected/Web/Portlets/DirectiveText.php
rename to gui/baculum/protected/Web/Portlets/DirectiveTextBox.php
index 491df85da8e40f5f08e5864452b3d4ee7b134eb0..5f98bf4dbe6dc534e90cd135232437f8116f1b62 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -24,7 +24,7 @@ Prado::using('System.Web.UI.ActiveControls.TActiveLabel');
 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();
@@ -38,7 +38,7 @@ class DirectiveText extends DirectiveTemplate {
                $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 {
similarity index 96%
rename from gui/baculum/protected/Web/Portlets/DirectiveText.tpl
rename to gui/baculum/protected/Web/Portlets/DirectiveTextBox.tpl
index 7f9552c5aa38bdb5ff9ef5c444eb9a3f95209daf..f22621b19dd4efb3a750627561722a689d463950 100644 (file)
@@ -12,7 +12,7 @@
                <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"
index 0e16f2a43e0a58e88782e22b635c8d04fdb0562c..ba70247777455f68dc0a9b7c9f1dcb809f9b2cc9 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -73,7 +73,7 @@ class DirectiveTimePeriod extends DirectiveTemplate {
                $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 {
index 135244c049567e80227b78f6f654d6710dd975f1..c4617d7152cf4776c87b36b364c2bbb5bcd3d16c 100644 (file)
@@ -21,7 +21,7 @@
                <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"
diff --git a/gui/baculum/protected/Web/Portlets/FileSetBrowser.php b/gui/baculum/protected/Web/Portlets/FileSetBrowser.php
new file mode 100644 (file)
index 0000000..6cca095
--- /dev/null
@@ -0,0 +1,102 @@
+<?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, '/');
+       }
+}
+?>
diff --git a/gui/baculum/protected/Web/Portlets/FileSetBrowser.tpl b/gui/baculum/protected/Web/Portlets/FileSetBrowser.tpl
new file mode 100644 (file)
index 0000000..5d9a1ac
--- /dev/null
@@ -0,0 +1,340 @@
+<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> &nbsp;<%[ 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> &nbsp;<%[ 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> &nbsp;<%[ 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>
diff --git a/gui/baculum/protected/Web/Portlets/FileSetOptionRenderer.php b/gui/baculum/protected/Web/Portlets/FileSetOptionRenderer.php
new file mode 100644 (file)
index 0000000..d10f4b5
--- /dev/null
@@ -0,0 +1,51 @@
+<?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;
+       }
+}
+?>
diff --git a/gui/baculum/protected/Web/Portlets/JobRunscriptRenderer.php b/gui/baculum/protected/Web/Portlets/JobRunscriptRenderer.php
new file mode 100644 (file)
index 0000000..7f97209
--- /dev/null
@@ -0,0 +1,51 @@
+<?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;
+       }
+}
+?>
index ebd63d2faeae70004fc1d8360e5a763541258387..aae49442956c983b9a24956093aa80677535020a 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -23,7 +23,7 @@
 
 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 {
 
@@ -33,7 +33,7 @@ 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++) {
@@ -52,7 +52,7 @@ class MessageTypes extends DirectiveListTemplate {
        }
 
        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']);
index ae0e8c657983886fa0ce0b3bb2efa918b4e95b62..1c5b39a96cb18b7b5a8722699341a80b5a8c7e3f 100644 (file)
@@ -1,5 +1,5 @@
 <com:TActiveRepeater ID="RepeaterMessageTypes" OnItemCreated="createTypeListElement">
        <prop:ItemTemplate>
-               <com:Application.Web.Portlets.DirectiveBoolean />
+               <com:Application.Web.Portlets.DirectiveCheckBox />
        </prop:ItemTemplate>
 </com:TActiveRepeater>
diff --git a/gui/baculum/protected/Web/Portlets/NewFileSetExcMenu.php b/gui/baculum/protected/Web/Portlets/NewFileSetExcMenu.php
new file mode 100644 (file)
index 0000000..29581f3
--- /dev/null
@@ -0,0 +1,37 @@
+<?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);
+       }
+}
+?>
diff --git a/gui/baculum/protected/Web/Portlets/NewFileSetExcMenu.tpl b/gui/baculum/protected/Web/Portlets/NewFileSetExcMenu.tpl
new file mode 100644 (file)
index 0000000..0ebdcfb
--- /dev/null
@@ -0,0 +1,14 @@
+<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>
diff --git a/gui/baculum/protected/Web/Portlets/NewFileSetFileOptMenu.php b/gui/baculum/protected/Web/Portlets/NewFileSetFileOptMenu.php
new file mode 100644 (file)
index 0000000..cde0dc4
--- /dev/null
@@ -0,0 +1,37 @@
+<?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);
+       }
+}
+?>
diff --git a/gui/baculum/protected/Web/Portlets/NewFileSetFileOptMenu.tpl b/gui/baculum/protected/Web/Portlets/NewFileSetFileOptMenu.tpl
new file mode 100644 (file)
index 0000000..a08ab63
--- /dev/null
@@ -0,0 +1,29 @@
+<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> &nbsp;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> &nbsp;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> &nbsp;Add options block"
+                       Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
+                       />
+               </li>
+       </ul>
+</div>
similarity index 88%
rename from gui/baculum/protected/Web/Portlets/NewFileSetMenu.php
rename to gui/baculum/protected/Web/Portlets/NewFileSetIncExcMenu.php
index 01d39e007731f4e62cc13ba178e9633b9cc00f1c..d77d3691f86158b3bb82ae9da25698c8944a69e0 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -22,5 +22,6 @@
 
 Prado::using('Application.Web.Portlets.DirectiveListTemplate');
 
-class NewFileSetMenu extends DirectiveListTemplate {
+class NewFileSetIncExcMenu extends DirectiveListTemplate {
 }
+?>
diff --git a/gui/baculum/protected/Web/Portlets/NewFileSetIncExcMenu.tpl b/gui/baculum/protected/Web/Portlets/NewFileSetIncExcMenu.tpl
new file mode 100644 (file)
index 0000000..80cbb54
--- /dev/null
@@ -0,0 +1,23 @@
+<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> &nbsp;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> &nbsp;Add exclude block"
+                       Attributes.onclick="$(this).closest('div.config_new_fileset').hide();"
+                       />
+               </li>
+       </ul>
+</div>
diff --git a/gui/baculum/protected/Web/Portlets/NewFileSetMenu.tpl b/gui/baculum/protected/Web/Portlets/NewFileSetMenu.tpl
deleted file mode 100644 (file)
index 8ba3b5b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<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>
index 686a5e265a83f5a9dbabceaaec423f25866093b8..e79e52deb99d2bbb22711514798b1d832ad7f795 100644 (file)
@@ -5,7 +5,7 @@
                        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();"
                        />
index 8db4a3fc3236e203ee4f516b81f2ce676dca3a05..3457f6f2cdff45750e325d9ee5551c2c2eb17e55 100644 (file)
@@ -3,7 +3,7 @@
  * 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
@@ -40,6 +40,7 @@ class RunJob extends Portlets {
 
        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;
 
@@ -75,6 +76,8 @@ class RunJob extends Portlets {
                        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;
@@ -184,6 +187,10 @@ class RunJob extends Portlets {
                }
                $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;
@@ -269,6 +276,9 @@ class RunJob extends Portlets {
                                $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;
                        }
                }
index 4175bd623f84d12658b6497e14226d90bc3e522b..22a1daa2108c7bc3834b5a548ee88bca805bf84d 100644 (file)
@@ -28,6 +28,7 @@
        <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/" />
index c0f7913dc0331cf026b0bdc6359e3df93ff3cf71..c427b941235975fb7b390b23d7433539cc39a2a9 100644 (file)
@@ -126,3 +126,82 @@ div.config_directives {
 .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');
+}
index 7a7f20cc6c82b90b2a24691aed90aeecd17ad181..e40d33d759d7441b3ef672d2b0f6890673ff0b95 100644 (file)
@@ -69,6 +69,10 @@ tr.file-browser-element:hover {
        overflow-y: auto;
 }
 
+.normal {
+       font-weight: normal;
+}
+
 .bold {
        font-weight: bold;
 }
diff --git a/gui/baculum/themes/Baculum-v2/link-icon.png b/gui/baculum/themes/Baculum-v2/link-icon.png
new file mode 100644 (file)
index 0000000..7f56713
Binary files /dev/null and b/gui/baculum/themes/Baculum-v2/link-icon.png differ