]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Improvements to messages resource
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 11 Nov 2019 16:52:09 +0000 (17:52 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 14 Dec 2019 15:02:16 +0000 (16:02 +0100)
Changes:
 - Add capability to remove messages' destinations
 - Enable to manage many the same type destinations

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/Portlets/BaculaConfigDirectives.php
gui/baculum/protected/Web/Portlets/DirectiveMessages.php
gui/baculum/protected/Web/Portlets/DirectiveMessages.tpl

index 412675618cf26e884e4725f9e65df1fddd77fe30..f5f25b5305610408c4e10481abe0565e58b7467d 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 98beb1e5bffdee301dbfff8de42e74d50ae9ec7a..86bc3682db51a39345ab52d41207d125290a6eb1 100644 (file)
@@ -2509,3 +2509,6 @@ msgstr "Virtual full backup"
 
 msgid "Volume recycling"
 msgstr "Volume recycling"
+
+msgid "Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped"
+msgstr "Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped"
index bbc5f54d30893bba2b33ba18584529c132cd704b..6a13e2b1943ee9f09260f396985c55af1fc4cf03 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 2591e4121e968671d101e551426d93919b482274..483e1544012c6bc310c1bfe654403ecec863968b 100644 (file)
@@ -2595,3 +2595,6 @@ msgstr "Virtual full backup"
 
 msgid "Volume recycling"
 msgstr "Volume recycling"
+
+msgid "Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped"
+msgstr "Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped"
index 3db092edcaf1189e5bb953b6afebecfcc9be6e52..a58b6031422cceef1801c98abb6ebb8d2dd27e36 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 f719a3c651756b8ba8eddcfe63bf47bbd6304b92..aa9db1c737e1079f155d6e96906653e3ea17c982 100644 (file)
@@ -2516,3 +2516,6 @@ msgstr "Backup konsolidacyjny (Virtual Full)"
 
 msgid "Volume recycling"
 msgstr "Recykling wolumenów"
+
+msgid "Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped"
+msgstr "Porada: zaznaczenie typu wiadomości 'All' powoduje, że reszta zaznaczonych typów wiadomości jest zapisana z negacją np. Catalog = All, !Debug, !Saved, !Skipped"
index d91d7bd6b8d010e14e92dff30adca9c4942ffd29..f3533073d85b39c9638f941268451998a623621b 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 08a206e1c262e507adad1cd1b8dfb37f0d142c37..8e1aa112a56c72e65c592852264de6cf2c54525c 100644 (file)
@@ -2524,3 +2524,6 @@ msgstr "Virtual full backup"
 
 msgid "Volume recycling"
 msgstr "Volume recycling"
+
+msgid "Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped"
+msgstr "Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped"
index 4ed97d07a6a9eadfe880ed9379ff0d74f883a2df..fe4925ab0af1107d071f5547164b158c01981a7f 100644 (file)
@@ -182,7 +182,7 @@ class BaculaConfigDirectives extends DirectiveListTemplate {
                                $directive_value = (array)$directive_value;
                        }
 
-                       if ($directive_name === 'Include' || $directive_name === 'Exclude' || $directive_name === 'Runscript') {
+                       if ($directive_name === 'Include' || $directive_name === 'Exclude' || $directive_name === 'Runscript' || $directive_name === 'Destinations') {
                                // provide all include blocks at once
                                $directive_value = array(array(
                                        $directive_name => $directive_value,
index 7d16348770c473efcf5f0b68fb1dcb188a5c74ef..c682c67baecd3eb192d16af4a9d6ee782f43b361 100644 (file)
@@ -66,29 +66,30 @@ class DirectiveMessages extends DirectiveListTemplate {
 
        public function loadConfig() {
                $load_values = $this->getLoadValues();
-               $destinations = (array)$this->getData();
-               if (array_key_exists('Type', $destinations)) {
-                       $destinations = array($destinations);
+               $dests = $this->getData();
+               if (key_exists('Destinations', $dests)) {
+                       $dests = $dests['Destinations'];
                }
                $directives = array();
-               for ($i = 0; $i < count($destinations); $i++) {
-                       $is_address_type = in_array($destinations[$i]['Type'], $this->destination_address);
+               for ($i = 0; $i < count($dests); $i++) {
+                       $dest = (array)$dests[$i];
+                       $is_address_type = in_array($dest['Type'], $this->destination_address);
                        $directive_value = null;
-                       if ($is_address_type && array_key_exists('Where', $destinations[$i])) {
-                               $directive_value = implode(',', $destinations[$i]['Where']);
+                       if ($is_address_type && key_exists('Where', $dest)) {
+                               $directive_value = implode(',', $dest['Where']);
                        }
-                       $this->setDirectiveName($destinations[$i]['Type']);
+                       $this->setDirectiveName($dest['Type']);
                        $directives[$i] = array(
                                'host' => $this->getHost(),
                                'component_type' => $this->getComponentType(),
                                'component_name' => $this->getComponentName(),
                                'resource_type' => $this->getResourceType(),
                                'resource_name' => $this->getResourceName(),
-                               'directive_name' => $destinations[$i]['Type'],
+                               'directive_name' => $dest['Type'],
                                'directive_value' => $directive_value,
                                'default_value' => false,
                                'required' => false,
-                               'label' => $destinations[$i]['Type'],
+                               'label' => $dest['Type'],
                                'field_type' => 'TextBox',
                                'in_config' => true,
                                'show' => true,
@@ -98,8 +99,8 @@ class DirectiveMessages extends DirectiveListTemplate {
                        );
                        $value_all = $value_not = null;
                        for ($j = 0; $j < count($this->messages_types); $j++) {
-                               $value_all = in_array('!' . $this->messages_types[$j], $destinations[$i]['MsgTypes']);
-                               $value_not = in_array($this->messages_types[$j], $destinations[$i]['MsgTypes']);
+                               $value_all = in_array('!' . $this->messages_types[$j], $dest['MsgTypes']);
+                               $value_not = in_array($this->messages_types[$j], $dest['MsgTypes']);
                                $directives[$i]['messages_types'][] = array(
                                        'host' => $this->getHost(),
                                        'component_type' => $this->getComponentType(),
@@ -112,7 +113,7 @@ class DirectiveMessages extends DirectiveListTemplate {
                                        'required' => false,
                                        'label' => $this->messages_types[$j],
                                        'field_type' => 'Messages',
-                                       'data' => $destinations[$i]['Type'],
+                                       'data' => $dest['Type'],
                                        'in_config' => true,
                                        'show' => true,
                                        'parent_name' => __CLASS__
@@ -143,17 +144,12 @@ class DirectiveMessages extends DirectiveListTemplate {
                        if (count($directive_values) === 0) {
                                continue;
                        }
-                       $values[$directive_name] = implode(' ', $directive_values);
-               }
-               $ret = null;
-               if (count($values) > 1) {
-                       // multiple messages values
-                       $ret = $values;
-               } else {
-                       // single messages value
-                       $ret = implode('', array_values($values));
+                       if (!key_exists($directive_name, $values)) {
+                               $values[$directive_name] = array();
+                       }
+                       $values[$directive_name][] = implode(' ', $directive_values);
                }
-               return $ret;
+               return $values;
        }
 
        public function getDirectiveData() {
@@ -205,8 +201,18 @@ class DirectiveMessages extends DirectiveListTemplate {
                $data = $this->getDirectiveData();
                $msg_type = $sender->getID();
                array_push($data, array('Type' => $msg_type, 'MsgTypes' => array()));
-               $data = (object)$data;
                $this->setData($data);
-               $this->loadConfig(null, null);
+               $this->loadConfig();
        }
+
+       public function removeMessages($sender, $param) {
+               if ($param instanceof Prado\Web\UI\TCommandEventParameter) {
+                       $idx = $param->getCommandName();
+                       $data = $this->getDirectiveData();
+                       array_splice($data, $idx, 1);
+                       $this->setData($data);
+                       $this->loadConfig();
+               }
+       }
+
 }
index 25906eff85db9970847cb6c6c3757b1e06ff0c8f..b0158f2e5934164874b91c304745bba2b78371e3 100644 (file)
@@ -1,8 +1,17 @@
 <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>
+<p class="bold"><%[ Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped ]%></p>
 <com:Application.Web.Portlets.NewMessagesMenu ID="MessagesMenu" />
 <com:TActiveRepeater ID="RepeaterMessages" OnItemCreated="createDirectiveListElement" OnItemDataBound="loadMessageTypes">
        <prop:ItemTemplate>
                <div class="w3-card w3-padding directive">
+                       <com:TActiveLinkButton
+                               CssClass="w3-button w3-green w3-right"
+                               OnCommand="SourceTemplateControl.removeMessages"
+                               CommandName="<%=$this->ItemIndex%>"
+                               CommandParameter="save"
+                       >
+                               <i class="fa fa-trash-alt"></i> &nbsp;<%[ Remove ]%>
+                       </com:TActiveLinkButton>
                        <h2><%=$this->Data['directive_name']%></h2>
                        <com:Application.Web.Portlets.DirectiveTextBox />
                        <com:Application.Web.Portlets.MessageTypes ID="Types" />