Hide last authors
Ludovic Dubost 1.1 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 ##
Marius Dumitru Florea 3.1 14 #set ($do = "$!{request.get('do')}")
15 #set ($tag = "$!{request.get('tag')}")
16 #set ($urlEscapedTag = $escapetool.url($tag))
17 #set ($htmlEscapedTag = $escapetool.xml($tag))
Ludovic Dubost 1.1 18 ##
19 ## Macro displayTagAppTitle. Display level1 title of this app.
20 ##
Marius Dumitru Florea 3.1 21 #macro (displayTagAppTitle $urlEscapedTag $htmlEscapedTag $displayButtons)
22 (% class="xapp" %)
23 = (% class="highlight tag" %)${tag}##
24 #if ($xwiki.hasAdminRights() && $displayButtons) ##
Marius Dumitru Florea 4.1 25 [[$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"]]##
Ludovic Dubost 1.1 26 #end
Marius Dumitru Florea 3.1 27 (%%) =
Ludovic Dubost 1.1 28 #end
29 ##
30 ## Switch between all possible actions:
31 ## viewTag, prepareRename, rename, prepareDelete, delete, default (Tag cloud)
32 ##
Marius Dumitru Florea 3.1 33 #if ($do == 'viewTag')
Ludovic Dubost 1.1 34 ##
35 ## View tag
36 ##
37 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag true)
Marius Dumitru Florea 3.1 38 #if ("$!{request.get('renamedTag')}" != '')
Marius Dumitru Florea 4.1 39 {{info}}$services.localization.render('xe.tag.rename.success', ["//${request.get('renamedTag')}//"]){{/info}}
Marius Dumitru Florea 3.1 40
Ludovic Dubost 1.1 41 #end
Marius Dumitru Florea 3.1 42 #set ($list = $xwiki.tag.getDocumentsWithTag($tag))
43 {{container layoutStyle="columns"}}
44 (((
45 (% class="xapp" %)
Marius Dumitru Florea 4.1 46 === $services.localization.render('xe.tag.alldocs', ["//${tag}//"]) ===
Marius Dumitru Florea 3.1 47
Vincent Massol 5.1 48 #if ($list.size()> 0)
Thomas Mortagne 8.1 49 {{html}}#displayDocumentList($list false $blacklistedSpaces){{/html}}
Vincent Massol 5.1 50 #else
51 (% class='noitems' %)$services.localization.render('xe.tag.notags')
52 #end
Marius Dumitru Florea 3.1 53 )))
54 (((
55 (% class="xapp" %)
Marius Dumitru Florea 4.1 56 === $services.localization.render('xe.tag.activity', ["//${tag}//"]) ===
Marius Dumitru Florea 3.1 57
Vincent Massol 6.1 58 {{activity tags="$tag" rss='true'/}}
Marius Dumitru Florea 3.1 59 )))
60 {{/container}}
61 #elseif ($do == 'prepareRename')
Ludovic Dubost 1.1 62 ##
63 ## Prepare rename tag
64 ##
65 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag false)
Marius Dumitru Florea 3.1 66 {{html}}
Ludovic Dubost 1.1 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" />
Vincent Massol 7.1 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>
Ludovic Dubost 1.1 73 </div>
74 </form>
Marius Dumitru Florea 3.1 75 {{/html}}
76 #elseif ($do == 'renameTag')
Ludovic Dubost 1.1 77 ##
78 ## Rename tag
79 ##
Marius Dumitru Florea 3.1 80 #set ($renameTo = "$!{request.get('renameTo')}")
81 #set ($success = false)
Ludovic Dubost 1.1 82 #if ($renameTo != '')
Marius Dumitru Florea 3.1 83 #set ($success = $xwiki.tag.renameTag($tag, $renameTo))
Ludovic Dubost 1.1 84 #end
85 #if ($success == true || $success == 'OK')
Marius Dumitru Florea 3.1 86 #set ($urlEscapedRenameTo = $escapetool.url($renameTo))
Ludovic Dubost 1.1 87 $response.sendRedirect($doc.getURL('view', "do=viewTag&tag=${urlEscapedRenameTo}&renamedTag=${urlEscapedTag}"))
88 #else
Marius Dumitru Florea 4.1 89 {{error}}$services.localization.render('xe.tag.rename.failure', ["//${tag}//", "//${renameTo}//"]){{/error}}
Ludovic Dubost 1.1 90 #end
Marius Dumitru Florea 3.1 91 #elseif ($do == 'prepareDelete')
Ludovic Dubost 1.1 92 ##
93 ## Prepare delete tag
94 ##
95 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag false)
Marius Dumitru Florea 3.1 96 {{html}}
Ludovic Dubost 1.1 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" />
Vincent Massol 7.1 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>
Ludovic Dubost 1.1 103 </div>
104 </form>
Marius Dumitru Florea 3.1 105 {{/html}}
106 #elseif ($do == 'deleteTag')
Ludovic Dubost 1.1 107 ##
108 ## Delete tag
109 ##
Marius Dumitru Florea 3.1 110 #set ($success = $xwiki.tag.deleteTag($tag))
Ludovic Dubost 1.1 111 #if ($success == true || $success == 'OK')
112 $response.sendRedirect($doc.getURL('view', "deletedTag=${urlEscapedTag}"))
113 #else
Marius Dumitru Florea 4.1 114 {{error}}$services.localization.render('xe.tag.delete.failure', ["//${tag}//"]){{/error}}
Ludovic Dubost 1.1 115 #end
116 #else
117 ##
118 ## View all tags (Tag Cloud)
119 ##
Marius Dumitru Florea 3.1 120 #set ($title = 'All Tags')
121 #if ("$!{request.get('deletedTag')}" != '')
Marius Dumitru Florea 4.1 122 {{info}}$services.localization.render('xe.tag.delete.success', ["//${request.get('deletedTag')}//"]){{/info}}
Marius Dumitru Florea 3.1 123
Ludovic Dubost 1.1 124 #end
Marius Dumitru Florea 3.1 125 {{tagcloud/}}
Ludovic Dubost 1.1 126 #end
Marius Dumitru Florea 3.1 127 #set ($displayDocExtra = false)
Ludovic Dubost 1.1 128 {{/velocity}}
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 12.10.5-node2 - Documentation