DekiScript - UserFlow

Pagina modificata 15:11, 4 Mag 2009 da wikiadmin | Cronologia

Description

UserFlow is a simple script that allow you to ask a review from a specific wiki user using a text tag inside pages.

  • Insert in some wiki pages a tag in the form v_wikiusername
  • Insert the script in your home page
  • The script will search for any page that contain v_wikiusername and display a list.

Template code

Copy this code in a deki template page (example: XsysUserFlow) using  html source code editor

<h1>Template:XsysUserFlow</h1>
<p class="comment">This program is free software: you can redistribute it and/or modify&nbsp;it under the terms of the GNU General Public License http://www.gnu.org/licenses - no warrenty -&nbsp;http://deki.intertesto.com/sviluppo</p>
<p class="comment">UserFlow is a simple script that allow you to ask a review from a specific wiki user using a text tag inside pages.&nbsp;<br />
Description:<br />
Insert in some wiki pages a tag in the form v_wikiusername&nbsp;<br />
Insert the script in your home page&nbsp;{{wiki.template("Xsys-userflow")}}<br />
The script will search for any page that contain&nbsp;v_wikiusername and display a list.<br />
<br />
Parameters:<br />
&nbsp;&nbsp;path = (optional) restrict search scope to a specific path according to lucene sintax, append an * to include all descending pages<br />
&nbsp;&nbsp;number = (default 20) number of row to display<br />
&nbsp;&nbsp;prefix = {default "v_") is the char used to prefix the wikiusername and create a unique string<br />
&nbsp;&nbsp;relaxed = (default FALSE) if set to true enablethe relaxed mode match, this means that the username logged in will be split in two parts using namesep and any string using prefix*second_part_username will be matched&nbsp;<br />
&nbsp;&nbsp;namesep = char used to separate username (default ".")<br />
Example:<br />
&nbsp;&nbsp;wikiusernmae form = name.surname<br />
&nbsp;&nbsp;prefix=v<br />
&nbsp;&nbsp;relaxed=false -&gt; Only v_name.surname will be matched<br />
&nbsp;&nbsp;relaxed=true -&gt; Any string v_*surname will be matched (* means an arbitrary &nbsp;sequence of chars)<br />
Check source code for more parameters.&nbsp;</p>
<table block="
var number = (args.number ?? 20);
var prefix = (args.prefix ?? 'v_');
var namesep = (args.namesep ?? '.');
var msg=(#user.name!='anonymous' ? 'Benvenuto '..web.link(user.uri,user.name)..' un utente ha richiesto il tuo intervento sulle pagine seguenti' : 'Funzione disponibile solo agli utenti registrati');
var searchstring = prefix..''..user.name;
var strlight = (string.contains(user.name,namesep) ? string.substr(user.name,0,string.IndexOf(user.name,namesep)) : user.name);
if (args.relaxed==true &amp;&amp; string.contains(user.name,namesep) ) {
var tn = string.split(user.name,namesep);
let searchstring = '&quot;'..prefix..'*'..tn[1]..'&quot;';
}
var pagelink = '&amp;highlight='..prefix..strlight;
var path=(#args.path!=0 ? 'path:'..args.path..'/*':'');
var result = wiki.getsearch('type:wiki AND content:'..searchstring, number, '-date',path);" width="100%" border="1" cellpadding="4" cellspacing="0" class="feedtable">
<tbody>
<tr>
<td valign="top" colspan="4" bgcolor="#cccc99" style="text-align: _fckstyle=" _fckstyle="text-align: _fckstyle="text-align: _fckstyle="text-align: _fckstyle="text-align: _fckstyle="text-align: _fckstyle="text-align: _fckstyle="text-align: center; "><strong>(<a title="Help/Estensioni/Userflow - Flusso di utenti" class="internal" href="mks://localhost/Help/Estensioni/Userflow_-_Flusso_di_utenti">?</a>) {{web.html(msg)}}</strong>{{searchstring}}</td>
</tr>
<tr>
<td bgcolor="#cccc99"><strong>Pagina</strong></td>
<td bgcolor="#cccc99"><strong>Data</strong></td>
<td bgcolor="#cccc99"><strong>Autore</strong></td>
<td bgcolor="#cccc99"><strong>Sommario</strong></td>
</tr>
<tr foreach="var pa in result" class="{{__count % 2 == 0 ? 'feedroweven' : 'feedrowodd'}}">
<td style="WORD-BREAK:BREAK-ALL" _fckstyle="WORD-BREAK:BREAK-ALL" _fckstyle="WORD-BREAK:BREAK-ALL" _fckstyle="WORD-BREAK:BREAK-ALL" _fckstyle="WORD-BREAK:BREAK-ALL" _fckstyle="WORD-BREAK:BREAK-ALL" _fckstyle="WORD-BREAK:BREAK-ALL" _fckstyle="WORD-BREAK:BREAK-ALL" width="50%">{{pa.id ? web.link(pa.uri..pagelink, pa.path):web.html("File "..web.link(pa.uri, pa.name).." in "..web.link(pa.page.uri,pa.page.path).."")}}</td>
<td nowrap=""><small>{{date.format(pa.date,"dd/MM/yy - HH:mm")}}</small></td>
<td><small>{{web.link("/Special:Contributions?target="..pa.author.name, pa.author.name)}}</small></td>
<td><small>{{ pa.id? web.link('/index.php?title='..uri.encode(pa.path)..'&amp;action=history',pa.editsummary):''}}</small></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>

How to use

 

  • Define a tag syntax (default is v_wikiusername)
  • Insert v_wikiusername in some pages (whait 1 minutes so pages get updated in the search engine)
  • Create a page where you want to list pages that required your attention and insert the script
{{wiki.template("XsysUserFlow",{})}}

Parameters:

You can pass some parameters in the form {paramName1:value, paramName2:value}

path = (optional) restrict search scope to a specific path according to lucene sintax, append an * to include all descending pages
number = (default 20) number of row to display
prefix = {default "v_") is the char used to prefix the wikiusername and create a unique string
relaxed = (default FALSE) if set to true enablethe relaxed mode match, this means that the username logged in will be split in two parts using namesep and any string using prefix*second_part_username will be matched
namesep = char used to separate username (default ".")
Example:
wikiusernmae form = name.surname
prefix=v_
relaxed=false -> Only v_name.surname will be matched
relaxed=true -> Any string v_*surname will be matched (* means an arbitrary sequence of chars)

Example

This script apllied in this page

 

Benvenuto Anonymous un utente ha richiesto il tuo intervento sulle pagine seguenti
Pagina Data Autore Sommario
Applicazioni/Progetti/Elenco/Implementazione_piattaforma_deki_wiki 07/12/08 - 18:26 wikiadmin pagina creata, 252 parole aggiunte

 

 

Etichette
Statistiche pagina
431 view(s), 9 edit(s), and 7672 character(s)

Commenti

E' necessario connettersi per inserire un commento.

Aggiungi file

Allegati