Merge lp:~yoboy-leguesh/ubuntu-fr-doc/tagnotes into lp:ubuntu-fr-doc

Proposed by YoBoY
Status: Merged
Merged at revision: 122
Proposed branch: lp:~yoboy-leguesh/ubuntu-fr-doc/tagnotes
Merge into: lp:ubuntu-fr-doc
Diff against target: 234 lines (+200/-0)
6 files modified
lib/plugins/tagnotes/README (+27/-0)
lib/plugins/tagnotes/action.php (+94/-0)
lib/plugins/tagnotes/conf/default.php (+40/-0)
lib/plugins/tagnotes/conf/metadata.php (+10/-0)
lib/plugins/tagnotes/plugin.info.txt (+7/-0)
lib/plugins/tagnotes/style.css (+22/-0)
To merge this branch: bzr merge lp:~yoboy-leguesh/ubuntu-fr-doc/tagnotes
Reviewer Review Type Date Requested Status
Ubuntu-fr-webteam Pending
Review via email: mp+141254@code.launchpad.net

Description of the change

Plugin d'ajout de notes en fonction des étiquettes présentes sur une page
 - filtres créé avec les mêmes règles que la fonction TOPIC du plugin TAG
 - Ajoute une note si aucunes étiquettes de définies
 - Ajoute une note si une étiquette n'existe pas sur d'autres pages (faute de frappe ou étiquette farfelue)
 - Possibilité d'exclure des pages contenant certaines étiquettes
 - Possibilité d'exclure des pages par des expressions régulières
 - Possibilité d'exclure des espaces complets
 - Possibilité d'ajouter un texte avant et après les notes

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'lib/plugins/tagnotes'
2=== added file 'lib/plugins/tagnotes/README'
3--- lib/plugins/tagnotes/README 1970-01-01 00:00:00 +0000
4+++ lib/plugins/tagnotes/README 2012-12-26 12:25:26 +0000
5@@ -0,0 +1,27 @@
6+tagnotes Plugin for DokuWiki
7+
8+affiche une note
9+
10+All documentation for this plugin can be found at
11+http://launchpad.net/ubuntu-fr-doc/
12+
13+If you install this plugin manually, make sure it is installed in
14+lib/plugins/version/ - if the folder is called different it
15+will not work!
16+
17+Please refer to http://www.dokuwiki.org/plugins for additional info
18+on how to install plugins in DokuWiki.
19+
20+----
21+Copyright (C) YoBoY <yoboy@ubuntu-fr.org>
22+
23+This program is free software; you can redistribute it and/or modify
24+it under the terms of the GNU General Public License as published by
25+the Free Software Foundation; version 2 of the License
26+
27+This program is distributed in the hope that it will be useful,
28+but WITHOUT ANY WARRANTY; without even the implied warranty of
29+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30+GNU General Public License for more details.
31+
32+See the COPYING file in your DokuWiki folder for details
33
34=== added file 'lib/plugins/tagnotes/action.php'
35--- lib/plugins/tagnotes/action.php 1970-01-01 00:00:00 +0000
36+++ lib/plugins/tagnotes/action.php 2012-12-26 12:25:26 +0000
37@@ -0,0 +1,94 @@
38+<?php
39+/**
40+ * DokuWiki Plugin version (Action Component)
41+ *
42+ * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
43+ * @author YoBoY <yoboy@ubuntu-fr.org>
44+ */
45+
46+// must be run within Dokuwiki
47+if (!defined('DOKU_INC')) die();
48+
49+if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
50+if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
51+if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
52+
53+require_once(DOKU_PLUGIN.'action.php');
54+
55+class action_plugin_tagnotes extends DokuWiki_Action_Plugin {
56+
57+ /**
58+ * return some info
59+ */
60+ function getInfo() {
61+ return array(
62+ 'author' => 'YoBoY',
63+ 'email' => 'YoBoY',
64+ 'date' => '2012-03-20',
65+ 'name' => 'Tag Notes Plugin',
66+ 'desc' => 'Add top notes to a page with or without some tags.',
67+ 'url' => 'http://launchpad.net/ubuntu-fr-doc',
68+ );
69+ }
70+
71+
72+ function register(&$contr) {
73+ $contr->register_hook('TPL_CONTENT_DISPLAY', 'BEFORE', $this, '_handleTagNotes', array());
74+ }
75+
76+ function _handleTagNotes(&$event, $param) {
77+ global $ID;
78+ global $ACT;
79+ global $INFO;
80+ if ($ACT == 'show') {
81+ if (!$my =& plugin_load('helper', 'tag')) return false;
82+ $tags = $my->_getSubjectMetadata($ID);
83+ $notes = "";
84+ // no notes if page doesn't exists
85+ if (!$INFO['exists']) return false;
86+ // excluded pages and NS
87+ foreach ($this->getConf('excludeNS') as $pageNS) {
88+ if($pageNS == $INFO['namespace']) return false;
89+ }
90+ foreach ($this->getConf('excludeID') as $pageID) {
91+ if(preg_match($pageID, $ID)) return false;
92+ }
93+
94+ // page with excluding tags (no notes when there is these tags)
95+ $excludeTags = $my->_parseTagList($this->getConf('exclude'));
96+ if ($my->_checkPageTags($tags, $excludeTags)) return false;
97+
98+ // the page have no tags
99+ if ((empty($tags) || !$tags[0]) && $this->getConf('alertNoTags') != "") {
100+ $tags = array();
101+ $notes = $this->getConf('alertNoTags')."<br />".DOKU_LF;
102+ }
103+
104+ // Some tags have no other page associated
105+ if ($this->getConf('wrongTag') != "") {
106+ $occurrences = $my->tagOccurrences($tags);
107+ foreach($tags as $tag ) {
108+ if (!isset($occurrences[$tag]) || $occurrences[$tag] == 1) {
109+ $notes .= $this->getConf('wrongTag')."<br />".DOKU_LF;
110+ break;
111+ }
112+ }
113+ }
114+
115+ // the other pages not excluded until this point
116+ $tagsNotes = $this->getConf('notes');
117+ foreach ($tagsNotes as $tagCond => $tagNote) {
118+ $tagConds = $my->_parseTagList($tagCond);
119+ if($my->_checkPageTags($tags, $tagConds)) {
120+ $notes .= $tagNote."<br />".DOKU_LF;
121+ }
122+ }
123+ if ($notes == '') return false;
124+ $notes = '<div class="notetag">'.$this->getConf('prependText').$notes.$this->getConf('appendText').'</div>'.DOKU_LF;
125+ $event->data = $notes . $event->data;
126+ }
127+ }
128+
129+}
130+
131+// vim:ts=4:sw=4:et:
132
133=== added directory 'lib/plugins/tagnotes/conf'
134=== added file 'lib/plugins/tagnotes/conf/default.php'
135--- lib/plugins/tagnotes/conf/default.php 1970-01-01 00:00:00 +0000
136+++ lib/plugins/tagnotes/conf/default.php 2012-12-26 12:25:26 +0000
137@@ -0,0 +1,40 @@
138+<?php
139+/**
140+ * Default settings for the version plugin
141+ *
142+ * @author YoBoY <yoboy@ubuntu-fr.org>
143+ */
144+
145+$conf['exclude'] = 'portail';
146+$conf['alertNoTags'] = 'Cette page n\'a pas encore d\'<a href="/wiki/tags">étiquettes</a>.';
147+$conf['excludeID'] = array(
148+ '/^(accueil|Accueil)$/',
149+ '/(warty|hoary|breezy|dapper|edgy|feisty|gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring)/',
150+ '/(4\.10|5\.04|5\.10|6\.06|6\.10|7\.04|7\.10|8\.04|8\.10|9\.04|9\.10|10\.04|10\.10|11\.04|11\.10|12\.04|12\.10|13\.04)/',
151+ );
152+$conf['excludeNS'] = array(
153+ 'evenements',
154+ 'groupes',
155+ 'playground',
156+ 'projets',
157+ 'ubuntu-l10n-fr',
158+ 'utilisateurs',
159+ 'wiki',
160+ );
161+$conf['wrongTag'] = 'Une des étiquettes de cette page n\'a pas d\'autres pages associées.';
162+$conf['notes'] = array(
163+ 'lucid oneiric precise -quantal'
164+ => 'Les informations contenues dans cette page n\'ont pas été vérifiées pour <a href="/quantal">Ubuntu 12.10.</a>',
165+ 'warty hoary breezy dapper edgy feisty gutsy hardy intrepid jaunty karmic -lucid maverick natty -oneiric -precise -quantal'
166+ => 'Cette page est ancienne et ne contient plus d\'informations pour les <a href="/versions">versions supportées d\'Ubuntu</a>.',
167+ '-warty -hoary -breezy -dapper -edgy -feisty -gutsy -hardy -intrepid -jaunty -karmic -lucid -maverick -natty -oneiric -precise -quantal'
168+ => 'Cette page n\'a pas d\'étiquettes de version.',
169+ 'vetuste vétuste'
170+ => 'Cette page est considée comme vétuste et ne contient plus d\'informations utiles.',
171+ 'BROUILLON brouillon'
172+ => 'Cette page est en cours de rédaction.',
173+
174+ );
175+$conf['prependText'] = "";
176+$conf['appendText'] = "<a href=\"/wiki/participer_wiki\">Apportez votre aide…</a>".DOKU_LF;
177+
178
179=== added file 'lib/plugins/tagnotes/conf/metadata.php'
180--- lib/plugins/tagnotes/conf/metadata.php 1970-01-01 00:00:00 +0000
181+++ lib/plugins/tagnotes/conf/metadata.php 2012-12-26 12:25:26 +0000
182@@ -0,0 +1,10 @@
183+<?php
184+/**
185+ * Options for the version plugin
186+ *
187+ * @author YoBoY <yoboy@ubuntu-fr.org>
188+ */
189+
190+
191+//$meta['fixme'] = array('string');
192+
193
194=== added directory 'lib/plugins/tagnotes/images'
195=== added file 'lib/plugins/tagnotes/images/attention.png'
196Binary files lib/plugins/tagnotes/images/attention.png 1970-01-01 00:00:00 +0000 and lib/plugins/tagnotes/images/attention.png 2012-12-26 12:25:26 +0000 differ
197=== added file 'lib/plugins/tagnotes/plugin.info.txt'
198--- lib/plugins/tagnotes/plugin.info.txt 1970-01-01 00:00:00 +0000
199+++ lib/plugins/tagnotes/plugin.info.txt 2012-12-26 12:25:26 +0000
200@@ -0,0 +1,7 @@
201+base tagnotes
202+author YoBoY
203+email yoboy@ubuntu-fr.org
204+date 2012-05-31
205+name tagnotes plugin
206+desc affiche une note
207+url http://launchpad.net/ubuntu-fr-doc/
208
209=== added file 'lib/plugins/tagnotes/style.css'
210--- lib/plugins/tagnotes/style.css 1970-01-01 00:00:00 +0000
211+++ lib/plugins/tagnotes/style.css 2012-12-26 12:25:26 +0000
212@@ -0,0 +1,22 @@
213+.notetag {
214+ margin: 0em;
215+ margin-bottom: 1em;
216+// width: 92% !important;
217+ clear: none;
218+ text-align: justify;
219+ vertical-align: top;
220+ border-collapse: collapse;
221+ padding: 0.4em;
222+ padding-left: 3.3em;
223+ background-position: 0.5em 50%;
224+ background-repeat: no-repeat;
225+ -moz-border-radius: 0.5em;
226+ -khtml-border-radius: 0.5em;
227+ border-radius: 0.5em;
228+ border-color : #9d9;
229+ background-color: #AEA79F;
230+ background-image: url(images/attention.png);
231+}
232+.notetag a {
233+ color: #77216F;
234+}

Subscribers

People subscribed via source and target branches

to all changes: