From: Marcin Haba Date: Mon, 11 Nov 2019 16:52:09 +0000 (+0100) Subject: baculum: Improvements to messages resource X-Git-Tag: Release-9.6.0~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=456bb4190297f4f3c09c5594295636e76634c924;p=thirdparty%2Fbacula.git baculum: Improvements to messages resource Changes: - Add capability to remove messages' destinations - Enable to manage many the same type destinations --- diff --git a/gui/baculum/protected/Web/Lang/en/messages.mo b/gui/baculum/protected/Web/Lang/en/messages.mo index 412675618..f5f25b530 100644 Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/en/messages.po b/gui/baculum/protected/Web/Lang/en/messages.po index 98beb1e5b..86bc3682d 100644 --- a/gui/baculum/protected/Web/Lang/en/messages.po +++ b/gui/baculum/protected/Web/Lang/en/messages.po @@ -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" diff --git a/gui/baculum/protected/Web/Lang/ja/messages.mo b/gui/baculum/protected/Web/Lang/ja/messages.mo index bbc5f54d3..6a13e2b19 100644 Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/ja/messages.po b/gui/baculum/protected/Web/Lang/ja/messages.po index 2591e4121..483e15440 100644 --- a/gui/baculum/protected/Web/Lang/ja/messages.po +++ b/gui/baculum/protected/Web/Lang/ja/messages.po @@ -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" diff --git a/gui/baculum/protected/Web/Lang/pl/messages.mo b/gui/baculum/protected/Web/Lang/pl/messages.mo index 3db092edc..a58b60314 100644 Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/pl/messages.po b/gui/baculum/protected/Web/Lang/pl/messages.po index f719a3c65..aa9db1c73 100644 --- a/gui/baculum/protected/Web/Lang/pl/messages.po +++ b/gui/baculum/protected/Web/Lang/pl/messages.po @@ -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" diff --git a/gui/baculum/protected/Web/Lang/pt/messages.mo b/gui/baculum/protected/Web/Lang/pt/messages.mo index d91d7bd6b..f3533073d 100644 Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ diff --git a/gui/baculum/protected/Web/Lang/pt/messages.po b/gui/baculum/protected/Web/Lang/pt/messages.po index 08a206e1c..8e1aa112a 100644 --- a/gui/baculum/protected/Web/Lang/pt/messages.po +++ b/gui/baculum/protected/Web/Lang/pt/messages.po @@ -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" diff --git a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php index 4ed97d07a..fe4925ab0 100644 --- a/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php +++ b/gui/baculum/protected/Web/Portlets/BaculaConfigDirectives.php @@ -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, diff --git a/gui/baculum/protected/Web/Portlets/DirectiveMessages.php b/gui/baculum/protected/Web/Portlets/DirectiveMessages.php index 7d1634877..c682c67ba 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveMessages.php +++ b/gui/baculum/protected/Web/Portlets/DirectiveMessages.php @@ -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(); + } + } + } diff --git a/gui/baculum/protected/Web/Portlets/DirectiveMessages.tpl b/gui/baculum/protected/Web/Portlets/DirectiveMessages.tpl index 25906eff8..b0158f2e5 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveMessages.tpl +++ b/gui/baculum/protected/Web/Portlets/DirectiveMessages.tpl @@ -1,8 +1,17 @@ +

<%[ Tip: checking 'All' message type causes, that rest checked message types are saved with negation ex. Catalog = All, !Debug, !Saved, !Skipped ]%>

+ +  <%[ Remove ]%> +

<%=$this->Data['directive_name']%>