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 $xwiki.ssx.use('Main.Dashboard')##
12 ##
13 ## Set application variables (action and tag) from URL parameters.
14 ##
15 #set($do = "$!{request.get('do')}")
16 #set($tag = "$!{request.get('tag')}")
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 <h1 class="xapp">
24 <span class="highlight tag">
25 <a href="$doc.getURL('view', "do=viewTag&amp;tag=${urlEscapedTag}")">$htmlEscapedTag</a>
26 #if($xwiki.hasAdminRights() && $displayButtons)
27 <a href="$doc.getURL('view', "do=prepareRename&amp;tag=${urlEscapedTag}")" class="button rename" rel="nofollow">Rename</a>&nbsp;<a href="$doc.getURL('view', "do=prepareDelete&amp;tag=${urlEscapedTag}")" class="button delete" rel="nofollow">Delete</a>
28 #end
29 </span>
30 </h1>
31 #end
32 ##
33 ## Switch between all possible actions:
34 ## viewTag, prepareRename, rename, prepareDelete, delete, default (Tag cloud)
35 ##
36 {{html wiki=true}}
37 #if($do == 'viewTag')
38 ##
39 ## View tag
40 ##
41 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag true)
42 #if("$!{request.get('renamedTag')}" != '')
43 #set($htmlEscapedRenamedTag = $escapetool.xml($request.get('renamedTag')))
44 #info($msg.get('xe.tag.rename.success', [$htmlEscapedRenamedTag]))
45 #end
46 #set($list = $xwiki.tag.getDocumentsWithTag($tag))
47 <div>
48 <div id="dashboardleft">
49 <div id="dashboardleftcontent">
50 <h3 class="xapp"><span>$msg.get('xe.tag.alldocs', [$htmlEscapedTag])</span></h3>
51 #displayDocumentList($list true $blacklistedSpaces)
52 </div>
53 </div>
54 <div id="dashboardright">
55 <div id="dashboardrightcontent">
56 <h3 class="xapp"><span>$msg.get("xe.tag.activity", [$htmlEscapedTag])</span></h3>
57
58 {{activity tags="$htmlEscapedTag" /}}
59
60 </div>
61 </div>
62 <div style="clear:both; margin-bottom: 40px;"></div>
63 </div>
64 #elseif($do == 'prepareRename')
65 ##
66 ## Prepare rename tag
67 ##
68 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag false)
69 <form id="renameForm" action="$doc.getURL()" method="post">
70 <div>
71 <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
72 <input name="do" type="hidden" value="renameTag" />
73 <input name="tag" type="hidden" value="$htmlEscapedTag" />
74 $msg.get('xe.tag.rename.renameto', [$htmlEscapedTag]) <input type="text" name="renameTo" /> <span class="buttonwrapper"><input type="submit" value="$msg.get('xe.tag.rename')" class="button"/></span>
75 </div>
76 </form>
77 #elseif($do == 'renameTag')
78 ##
79 ## Rename tag
80 ##
81 #set($renameTo = "$!{request.get('renameTo')}")
82 #set($success = false)
83 #if ($renameTo != '')
84 #set($success = $xwiki.tag.renameTag($tag, $renameTo))
85 #end
86 #if ($success == true || $success == 'OK')
87 #set($urlEscapedRenameTo = $escapetool.url($renameTo))
88 $response.sendRedirect($doc.getURL('view', "do=viewTag&tag=${urlEscapedRenameTo}&renamedTag=${urlEscapedTag}"))
89 #else
90 #set($htmlEscapedRenameTo = $escapetool.xml($renameTo))
91 #error($msg.get('xe.tag.rename.failure', [$htmlEscapedTag, $htmlEscapedRenameTo]))
92 #end
93 #elseif($do == 'prepareDelete')
94 ##
95 ## Prepare delete tag
96 ##
97 #displayTagAppTitle($urlEscapedTag $htmlEscapedTag false)
98 <form id="deleteForm" action="$doc.getURL()" method="post">
99 <div>
100 <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
101 <input name="do" type="hidden" value="deleteTag" />
102 <input name="tag" type="hidden" value="$htmlEscapedTag" />
103 <span class="buttonwrapper"><input type="submit" value="$msg.get('xe.tag.delete', [$htmlEscapedTag])" class="button"/></span>
104 </div>
105 </form>
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($msg.get('xe.tag.delete.failure', [$htmlEscapedTag]))
115 #end
116 #else
117 ##
118 ## View all tags (Tag Cloud)
119 ##
120 #set($tags = $xwiki.tag.getTags(true))
121 #set($title = 'All Tags')
122 #if("$!{request.get('deletedTag')}" != '')
123 #set($htmlEscapedTag = $escapetool.xml($request.get('deletedTag')))
124 #info($msg.get('xe.tag.delete.success', [$htmlEscapedTag]))
125 #end
126 #set($docextras = [])
127 #includeInContext("XWiki.TagCloud")
128 #end
129 {{/html}}
130 {{/velocity}}

Get Connected