From 333cadec5c2eb20d3d22a5994070886f45cc4da4 Mon Sep 17 00:00:00 2001 From: Simon DELAGE Date: Thu, 15 Nov 2018 07:11:39 +0100 Subject: [PATCH] Added setting to trigger some alerts with 'inline' setting --- action.php | 4 ++-- conf/default.php | 1 + conf/metadata.php | 1 + lang/en/settings.php | 1 + lang/fr/settings.php | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/action.php b/action.php index b9a0585..e1adf48 100644 --- a/action.php +++ b/action.php @@ -52,7 +52,7 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{ global $conf; global $ACT; - if (($this->getConf('action') == "messages") & ($ACT == "show")) { + if ((($this->getConf('action') == "messages") or ($this->getConf('forcemsg') != null)) & ($ACT == "show")) { // Get an array of triggers from settings (make sure the list is well formated: no blanks between triggers and no '_' in triggers) $errorTriggers = explode(',',str_replace('_', ' ', str_replace(', ', ',', $this->getConf('error')))); $infoTriggers = explode(',',str_replace('_', ' ', str_replace(', ', ',', $this->getConf('info')))); @@ -66,7 +66,7 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{ $tagalerts['notify'] = array_values((array_intersect($this->pagetags, $notifyTriggers))); foreach($tagalerts as $type=>$tags) { for ($i = 0; $i < count($tags); $i++) { - if (isset($tags[$i]) { + if ((isset($tags[$i])) and (($this->getConf('action') == "messages") or (strpos($this->getConf('forcemsg'), $tags[$i]) !== false))) { // Alert from conf file if (isset($conf['plugin']['tagalerts']['specAlerts'][$tags[$i]])) { $msg = $conf['plugin']['tagalerts']['specAlerts'][$tags[$i]]; diff --git a/conf/default.php b/conf/default.php index de34150..2c482fd 100644 --- a/conf/default.php +++ b/conf/default.php @@ -11,3 +11,4 @@ $conf['error'] = ''; //comma separated list of tags for w $conf['info'] = ''; //comma separated list of tags for wich a "tag info" should be thrown $conf['success'] = ''; //comma separated list of tags for wich a "tag success" should be thrown $conf['notify'] = ''; //comma separated list of tags for wich a "tag notification" should be thrown +$conf['forcemsg'] = ''; //comma separated list of tags for wich messages will be forced, even with `inline` setting diff --git a/conf/metadata.php b/conf/metadata.php index b27a351..b1a767d 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -11,3 +11,4 @@ $meta['error'] = array('string'); $meta['info'] = array('string'); $meta['success'] = array('string'); $meta['notify'] = array('string'); +$meta['forcemsg'] = array('string'); diff --git a/lang/en/settings.php b/lang/en/settings.php index 0904003..8d94a39 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -13,3 +13,4 @@ $lang['error'] = 'Comma separated list of tags that will trigge $lang['info'] = 'Comma separated list of tags that will trigger an alert based on system information message.'; $lang['success'] = 'Comma separated list of tags that will trigger an alert based on system success message.'; $lang['notify'] = 'Comma separated list of tags that will trigger an alert based on system notification message.'; +$lang['forcemsg'] = 'Comma separated list of tags for wich messages will be forced, even with `inline` setting.'; diff --git a/lang/fr/settings.php b/lang/fr/settings.php index 6ca331e..4eaf0c6 100644 --- a/lang/fr/settings.php +++ b/lang/fr/settings.php @@ -11,3 +11,4 @@ $lang['error'] = 'Liste de tags séparés par une virgule qui d $lang['info'] = 'Liste de tags séparés par une virgule qui déclencheront une alerte basée sur les messages système d\'information.'; $lang['success'] = 'Liste de tags séparés par une virgule qui déclencheront une alerte basée sur les messages système de succès.'; $lang['notify'] = 'Liste de tags séparés par une virgule qui déclencheront une alerte basée sur les messages système de notification..'; +$lang['forcemsg'] = 'Liste de tags séparés par une virgule pour lesquels une alerte sera déclenchés, même avec l\'option `inline`.';