Compare commits

..

10 commits

Author SHA1 Message Date
10b95ab4b8
2024-10-04 bugfix release
* Prevent PHP warnings due to trying to fetch unset array entries.
2024-10-04 20:37:28 +02:00
adc1f27528
Prevent PHP warnings due to trying to fetch unset array entries 2024-10-04 20:36:02 +02:00
Simon DELAGE
cb61358939 Update style.css
Minor fix
2021-10-05 13:18:33 +02:00
Simon DELAGE
32726b1c07 Minor styling improvement
Reduce overlapping between tagalerts messages and top tags
2021-10-05 13:14:31 +02:00
Simon DELAGE
182dcc4211 Fix #1
Had to remove underscores to compare Tagalerts conf to against actual tags but I did not realize I had to re-introduce underscores later on
2019-02-09 06:56:17 +01:00
Simon DELAGE
76d9e44023
Update README.md
Added link to plugin's public page
2019-01-27 09:23:51 +01:00
Simon DELAGE
0c23f24502 Updated author info 2019-01-25 21:52:09 +01:00
Simon DELAGE
31ed7cbf59 Fix alerts margins 2018-12-13 04:29:12 +01:00
Simon DELAGE
333cadec5c Added setting to trigger some alerts with 'inline' setting 2018-11-15 07:11:39 +01:00
Simon DELAGE
35e1d042d2 Fixed bug: alerts were triggered only for first tag of each type 2018-11-15 07:10:28 +01:00
10 changed files with 43 additions and 29 deletions

View file

@ -1,2 +1,5 @@
# dokuwiki-plugin-tagalerts
Plugin to highlight specified tags or throw alert messages (requires tag plugin)
All documentation for this plugin can be found [here](http://www.dokuwiki.org/plugin:tagalerts).

View file

@ -2,7 +2,7 @@
/**
* Tag Alerts plugin main file
*
* @author: Simon Delage <simon.geekitude@gmail.com>
* @author Simon DELAGE <sdelage@gmail.com>
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
*/
@ -35,13 +35,17 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{
if(is_null($tags)) true;
foreach($event->data['meta'] as &$meta) {
// FIXME: Skip entries where the "name" key is not set,
// this might be a symptom of some bug.
if ( ! array_key_exists('name', $meta) ) continue;
if($meta['name'] == 'keywords') {
// Get an array of page's tags
$this->pagetags = explode(',', $meta['content']);
}
}
// Load special messages from ...tagalerts/conf/tagalerts.conf to global conf
// $specAlertsFile = dirname(__FILE__).'/conf/tagalerts.conf';
$specAlertsFile = DOKU_CONF.'tagalerts.conf';
if (@file_exists($specAlertsFile)) {
$conf['plugin']['tagalerts']['specAlerts'] = confToHash($specAlertsFile);
@ -52,8 +56,8 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{
global $conf;
global $ACT;
if (($this->getConf('action') == "messages") & ($ACT == "show")) {
// Get an array of notification triggers from 'notify' option (make sure the list is well formated: no blanks between triggers and no '_' in triggers)
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'))));
$successTriggers = explode(',',str_replace('_', ' ', str_replace(', ', ',', $this->getConf('success'))));
@ -64,16 +68,19 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{
$tagalerts['info'] = array_values((array_intersect($this->pagetags, $infoTriggers)));
$tagalerts['success'] = array_values((array_intersect($this->pagetags, $successTriggers)));
$tagalerts['notify'] = array_values((array_intersect($this->pagetags, $notifyTriggers)));
foreach($tagalerts as $type=>$tag) {
if (isset($tag[0])) {
// Alert from conf file
if (isset($conf['plugin']['tagalerts']['specAlerts'][$tag[0]])) {
$msg = $conf['plugin']['tagalerts']['specAlerts'][$tag[0]];
// Or from localized $conf
} else {
$msg = $this->getLang('tagalerts').$tag[0].".";
foreach($tagalerts as $type=>$tags) {
for ($i = 0; $i < count($tags); $i++) {
$underscored = str_replace(' ', '_', $tags[$i]);
if ((isset($tags[$i])) and (($this->getConf('action') == "messages") or (strpos($this->getConf('forcemsg'), $underscored) !== false))) {
// Alert from conf file
if (isset($conf['plugin']['tagalerts']['specAlerts'][$underscored])) {
$msg = $conf['plugin']['tagalerts']['specAlerts'][$underscored];
// Or from localized $conf
} else {
$msg = $this->getLang('tagalerts').$tags[$i].".";
}
echo '<div class="tag'.$type.'">'.hsc($msg).'</div>';
}
echo '<div class="tag'.$type.'">'.hsc($msg).'</div>';
}
}
}
@ -117,7 +124,6 @@ class action_plugin_tagalerts extends DokuWiki_Action_Plugin{
// Register the plugin conf file in ConfManager Plugin
public function addConfigFile(Doku_Event $event, $params) {
if (class_exists('ConfigManagerTwoLine')) {
// $config = new ConfigManagerTwoLine('Tag Alerts', $this->getLang('confdescription'), DOKU_PLUGIN . 'tagalerts/conf/tagalerts.conf');
$config = new ConfigManagerTwoLine('Tag Alerts', $this->getLang('confdescription'), DOKU_CONF . 'tagalerts.conf');
$event->data[] = $config;
}

View file

@ -2,12 +2,13 @@
/**
* Configuration defaults file for Tag Alert plugin
*
* @author: Simon Delage <simon.geekitude@gmail.com>
* @author Simon DELAGE <sdelage@gmail.com>
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
*/
$conf['action'] = 'inline';
$conf['error'] = ''; //comma separated list of tags for wich a "tag error" should be thrown
$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['error'] = ''; //comma separated list of tags for wich a "tag error" should be thrown
$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

View file

@ -2,7 +2,7 @@
/**
* Configuration metadata file for Tag Alert plugin
*
* @author: Simon Delage <simon.geekitude@gmail.com>
* @author Simon DELAGE <sdelage@gmail.com>
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
*/
@ -11,3 +11,4 @@ $meta['error'] = array('string');
$meta['info'] = array('string');
$meta['success'] = array('string');
$meta['notify'] = array('string');
$meta['forcemsg'] = array('string');

View file

@ -2,7 +2,7 @@
/**
* English language file for Tag Alerts plugin
*
* @author: Simon Delage <simon.geekitude@gmail.com>
* @author Simon DELAGE <sdelage@gmail.com>
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
*/

View file

@ -2,7 +2,7 @@
/**
* English settings file for Tag Alerts plugin
*
* @author: Simon Delage <simon.geekitude@gmail.com>
* @author Simon DELAGE <sdelage@gmail.com>
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
*/
@ -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.';

View file

@ -2,7 +2,7 @@
/**
* French language file for Tag Alerts plugin
*
* @author: Simon Delage <simon.geekitude@gmail.com>
* @author Simon DELAGE <sdelage@gmail.com>
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
*/

View file

@ -2,7 +2,7 @@
/**
* French settings file for Tag Alerts plugin
*
* @author: Simon Delage <simon.geekitude@gmail.com>
* @author Simon DELAGE <sdelage@gmail.com>
* @license: CC Attribution-Share Alike 3.0 Unported <http://creativecommons.org/licenses/by-sa/3.0/>
*/
@ -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`.';

View file

@ -1,7 +1,7 @@
base tagalerts
author Simon Delage
email simon.geekitude@gmail.com
date 2018-11-14
author Simon Delage, patched by vv221 for Numenaute
email numenaute@vv221.fr
date 2024-10-04
name Tag Alerts
desc Throw alerts when some tags are detected (based on Dokuwiki system messages or just styling tag list links)
url https://www.dokuwiki.org/plugin:tagalerts
url https://port.numenaute.org/dokuwiki/dokuwiki-plugin-tagalerts

View file

@ -33,8 +33,9 @@
.dokuwiki div.tagsuccess,
.dokuwiki div.tagnotify {
padding: 0 .5em 0 3em;
margin: -1.4em auto 1.8em auto;
margin: .5em auto .5em 0;
background-position: 8px 50%;
display: table;
}
.dokuwiki div.tagerror {