Show last authors
1 {{velocity}}
2 ##
3 ## Tag application.
4 ##
5 ## - See a Tag Cloud of all tags within the wiki.
6 ## - See all the pages tagged with the given tag.
7 ## - Rename a tag.
8 ## - Delete a tag.
9 ##
10 $xwiki.ssx.use('Main.Tags')##
11 ##
12 ## Set application variables (action and tag) from URL parameters.
13 ##
14 #set ($do = "$!{request.get('do')}")
15 #set ($tag = "$!{request.get('tag')}")
16 #set ($wikiEscapedTag = $services.rendering.escape($tag, 'xwiki/2.1'))
17 #set ($urlEscapedTag = $escapetool.url($tag))
18 #set ($htmlEscapedTag = $escapetool.xml($tag))
19 ##
20 ## Macro displayTagAppTitle. Display level1 title of this app.
21 ##
22 #macro (displayTagAppTitle $urlEscapedTag $htmlEscapedTag $displayButtons)
23 (% class="xapp" %)
24 = (% class="highlight tag" %)${wikiEscapedTag}##
25 #if ($xwiki.hasAdminRights() && $displayButtons) ##
26 [[$services.localization.render('xe.tag.rename.link')>>||queryString="do=prepareRename&tag=${urlEscapedTag}" class="button rename" rel="nofollow"]] [[$services.localization.render('xe.tag.delete.link')>>||queryString="do=prepareDelete&tag=${urlEscapedTag}" class="button delete" rel="nofollow"]]##
27 #end
28 (%%) =
29 #end
30 ##
31 ## Switch between all possible actions:
32 ## viewTag, prepareRename, rename, prepareDelete, delete, default (Tag cloud)
33 ##
34 #if ($do == 'viewTag')
35 ##
36 ## View tag
37 ##
38 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag true)
39 #if ("$!{request.get('renamedTag')}" != '')
40 {{info}}$services.localization.render('xe.tag.rename.success', ["//${services.rendering.escape(${request.get('renamedTag')}, 'xwiki/2.1')}//"]){{/info}}
41
42 #end
43 #set ($list = $xwiki.tag.getDocumentsWithTag($tag))
44 {{container layoutStyle="columns"}}
45 (((
46 (% class="xapp" %)
47 === $services.localization.render('xe.tag.alldocs', ["//${wikiEscapedTag}//"]) ===
48
49 #if ($list.size()> 0)
50 {{html}}#displayDocumentList($list false $blacklistedSpaces){{/html}}
51 #else
52 (% class='noitems' %)$services.localization.render('xe.tag.notags')
53 #end
54 )))
55 (((
56 (% class="xapp" %)
57 === $services.localization.render('xe.tag.activity', ["//${wikiEscapedTag}//"]) ===
58 {{notifications useUserPreferences="false" displayOwnEvents="true" tags="$wikiEscapedTag" displayRSSLink="true" /}}
59 )))
60 {{/container}}
61 #elseif ($do == 'prepareRename')
62 ##
63 ## Prepare rename tag
64 ##
65 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag false)
66 {{html}}
67 <form id="renameForm" action="$doc.getURL()" method="post">
68 <div>
69 <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
70 <input name="do" type="hidden" value="renameTag" />
71 <input name="tag" type="hidden" value="$htmlEscapedTag" />
72 $services.localization.render('xe.tag.rename.renameto', [$htmlEscapedTag]) <input type="text" name="renameTo" /> <span class="buttonwrapper"><input type="submit" value="$services.localization.render('xe.tag.rename')" class="button"/></span><span class="buttonwrapper"><a href="$doc.getURL('view', "do=viewTag&tag=${urlEscapedTag}")" class="secondary button">$services.localization.render('cancel')</a></span>
73 </div>
74 </form>
75 {{/html}}
76 #elseif ($do == 'renameTag')
77 ##
78 ## Rename tag
79 ##
80 #set ($renameTo = "$!{request.get('renameTo')}")
81 #set ($success = false)
82 #if ($renameTo != '')
83 #set ($success = $xwiki.tag.renameTag($tag, $renameTo))
84 #end
85 #if ($success == true || $success == 'OK')
86 #set ($urlEscapedRenameTo = $escapetool.url($renameTo))
87 $response.sendRedirect($doc.getURL('view', "do=viewTag&tag=${urlEscapedRenameTo}&renamedTag=${urlEscapedTag}"))
88 #else
89 {{error}}$services.localization.render('xe.tag.rename.failure', ["//${wikiEscapedTag}//", "//${services.rendering.escape($renameTo, 'xwiki/2.1')}//"]){{/error}}
90 #end
91 #elseif ($do == 'prepareDelete')
92 ##
93 ## Prepare delete tag
94 ##
95 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag false)
96 {{html}}
97 <form id="deleteForm" action="$doc.getURL()" method="post">
98 <div>
99 <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
100 <input name="do" type="hidden" value="deleteTag" />
101 <input name="tag" type="hidden" value="$htmlEscapedTag" />
102 <span class="buttonwrapper"><input type="submit" value="$services.localization.render('xe.tag.delete', [$htmlEscapedTag])" class="button"/></span><span class="buttonwrapper"><a href="$doc.getURL('view', "do=viewTag&tag=${urlEscapedTag}")" class="secondary button">$services.localization.render('cancel')</a></span>
103 </div>
104 </form>
105 {{/html}}
106 #elseif ($do == 'deleteTag')
107 ##
108 ## Delete tag
109 ##
110 #set ($success = $xwiki.tag.deleteTag($tag))
111 #if ($success == true || $success == 'OK')
112 $response.sendRedirect($doc.getURL('view', "deletedTag=${urlEscapedTag}"))
113 #else
114 {{error}}$services.localization.render('xe.tag.delete.failure', ["//${wikiEscapedTag}//"]){{/error}}
115 #end
116 #else
117 ##
118 ## View all tags (Tag Cloud)
119 ##
120 #set ($title = 'All Tags')
121 #if ("$!{request.get('deletedTag')}" != '')
122 {{info}}$services.localization.render('xe.tag.delete.success', ["//${services.rendering.escape($request.get('deletedTag'), 'xwiki/2.1')}//"]){{/info}}
123
124 #end
125 {{tagcloud/}}
126 #end
127 #set ($displayDocExtra = false)
128 {{/velocity}}
This wiki is licensed under a Creative Commons 2.0 license