Show last authors
1 {{include reference="XWiki.ConfigurableClassMacros" /}}
2
3 {{velocity output="false"}}
4 #if ($request.xaction == 'switchContext')
5 $response.sendRedirect($request.target)
6 #stop
7 #end
8
9 #set ($adminAction = 'admin')
10 #set ($crtCategoryId = "$!{request.category}")
11 #if ($crtCategoryId != '')
12 #set ($crtCategoryId = $mathtool.toInteger($crtCategoryId))
13 #end
14 #set ($crtSectionId = "$!{request.section}")
15
16 ##
17 ## Admin menu map
18 ##
19 #set($adminMenu = [
20 {
21 'id' : 'lf',
22 'icon': 'columns',
23 'displayBeforeCategory': 'content',
24 'children': [
25 {'id' : 'Themes', 'perSpace' : true, 'order' : 100},
26 {'id' : 'Panels.PanelWizard', 'perSpace' : true, 'order' : 200},
27 {'id' : 'Presentation', 'perSpace' : true, 'order' : 300}
28 ]
29 },
30 {
31 'id' : 'usersgroups',
32 'icon': 'group',
33 'displayBeforeCategory': 'extensionmanager',
34 'children': [
35 {'id' : 'Users', 'order' : 100},
36 {'id' : 'Groups', 'order' : 200},
37 {'id' : 'Rights', 'perSpace' : false, 'order' : 300},
38 {'id' : 'PageAndChildrenRights', 'perSpace' : true, 'order' : 300, 'global': false},
39 {'id' : 'PageRights', 'perSpace' : true, 'order' : 350, 'global': false},
40 {'id' : 'UserProfile', 'order' : 400},
41 {'id' : 'Registration', 'order' : 500}
42 ]
43 },
44 {
45 'id' : 'other',
46 'icon': 'wrench',
47 'children' : []
48 }
49 ])
50
51 ##
52 ## Fill in the list of custom applications to configure
53 ##
54 #findCustomSectionsToConfigure($adminMenu)
55 ##
56 ## Filter only the sections that are valid in the context
57 ##
58 #set ($categoriesToRemove = [])
59 #foreach ($category in $adminMenu)
60 #set ($sectionsToRemove = [])
61 #foreach ($section in $category.children)
62 #if ($editor == 'spaceadmin' && !$section.perSpace)
63 #set ($discard = $sectionsToRemove.add($section))
64 #elseif ($editor == 'globaladmin' && "$!section.global" == "false")
65 ## For retro-compatibility, all sections are global unless the 'global' field is explicitly marked as false
66 #set ($discard = $sectionsToRemove.add($section))
67 #end
68 #end
69 #set ($discard = $category.children.removeAll($sectionsToRemove))
70 #if ($category.children.size() == 0)
71 #set ($discard = $categoriesToRemove.add($category))
72 #end
73 #end
74 #set ($discard = $adminMenu.removeAll($categoriesToRemove))
75 #if ("$!crtCategoryId" != '' && $crtCategoryId >= $adminMenu.size())
76 #set ($crtCategoryId = '')
77 #end
78
79 ##
80 ## Prepare the Admin menu map for processing
81 ##
82 #set ($filteredAdminMenu = [])
83 #set ($crtSection = $NULL)
84 #set ($crtCategory = $NULL)
85 #foreach ($category in $adminMenu)
86 ## "Standard" URLs and icons for categories
87 #set ($category.url = $xwiki.getURL($currentDoc, $adminAction, "category=${mathtool.sub($velocityCount, 1)}"))
88 #if ($xwiki.getDocument('XWiki.AdminSheet').getAttachment("${category.id}.png"))
89 #set ($category.iconReference = "XWiki.AdminSheet@${category.id}.png")
90 #else
91 #set ($category.iconReference = "XWiki.ConfigurableClass@DefaultAdminSectionIcon.png")
92 #end
93 #set ($category.description = $services.localization.render("admin.${category.id}.description").trim())
94 #set ($category.cssClass = "${category.id}Icon")
95 #set ($category.name = $services.localization.render("admin.${category.id}").trim())
96 #if ("$!{crtCategoryId}" != '' && $velocityCount == $mathtool.add($crtCategoryId, 1))
97 #set ($crtCategory = $category)
98 #end
99 ##
100 ## Process each admin section
101 #set ($filteredCategoryChildren = [])
102 #foreach ($section in $category.children)
103 #if ($xwiki.exists($section.id) || $xwiki.exists("XWiki.Admin${section.id}Sheet"))
104 #if ($crtSectionId == $section.id)
105 #set ($crtSection = $section)
106 #set ($crtCategory = $category)
107 #end
108 #set ($section.iconReference = '')
109 #if ($section.id.indexOf('.') > 0)
110 #set ($sectionDoc = $xwiki.getDocument($section.id))
111 #set ($section.name = $sectionDoc.getDisplayTitle())
112 #if ($sectionDoc.getAttachment('icon.png'))
113 #set ($section.iconReference = "${sectionDoc}@icon.png")
114 #else
115 #set ($section.iconReference = 'XWiki.ConfigurableClass@DefaultAdminSectionIcon.png')
116 #end
117 #else
118 #set ($sectionDoc = $xwiki.getDocument('XWiki.AdminSheet'))
119 #set ($section.name = $services.localization.render("admin.${section.id.toLowerCase()}"))
120 #set ($iconName = "${section.id.toLowerCase()}.png")
121 #if ($sectionDoc.getAttachment($iconName))
122 #set ($section.iconReference = "${sectionDoc}@${iconName}")
123 #else
124 #set ($section.iconReference = 'XWiki.ConfigurableClass@DefaultAdminSectionIcon.png')
125 #end
126 #end
127 #set ($query = "editor=$escapetool.url(${editor})&section=$escapetool.url(${section.id})")
128 #if ($editor != 'globaladmin')
129 #set ($query = $query + "&space=$escapetool.url(${currentSpace})")
130 #end
131 #set ($action = "$!{section.action}")
132 #if ($action == '')
133 #set ($action = $adminAction)
134 #end
135 #set ($section.url = $xwiki.getURL($currentDoc, $action, $query))
136 #set ($key = "admin.${section.id.toLowerCase()}.description")
137 #if ($services.localization.get($key))
138 #set ($section.description = $services.localization.render($key))
139 #end
140 #set ($discard = $filteredCategoryChildren.add($section))
141 #elseif ($section.configurable)
142 #if ($section.readOnly)
143 #set ($section.cssClass = 'readOnly')
144 #end
145 #if ($crtSectionId == $section.id)
146 #set ($crtSection = $section)
147 #set ($crtCategory = $category)
148 #end
149 #set ($discard = $filteredCategoryChildren.add($section))
150 #end
151 #end
152 #set ($category.children = $filteredCategoryChildren)
153 #if ($filteredCategoryChildren.size() > 0)
154 #set ($discard = $filteredAdminMenu.add($category))
155 #end
156 #end
157 #set ($adminMenu = $filteredAdminMenu)
158
159 ## Mark the active category/section. We use this flag when displaying the menu.
160 #if ($crtCategory)
161 #set ($crtCategory.active = true)
162 #if ($crtSection)
163 #set ($crtSection.active = true)
164 #else
165 #set ($crtSectionId = $NULL)
166 #end
167 #else
168 #set ($crtCategoryId = $NULL)
169 #end
170
171 #**
172 * Displays the sections from an administration category
173 *
174 * Expected format:
175 * sections = vector of items
176 * item = map with the following fields:
177 * 'id' : mandatory
178 * 'name' : the text displayed for the corresponding menu item;
179 * optional, defaults to
180 * $services.localization.render("$!{translationPrefix}${item.id}")
181 * 'description' : the description displayed for the corresponding section;
182 * optional
183 * 'link' : the "action" of the menu item; mandatory
184 * 'cssClass' : a specific css class for the menu item for custom
185 * styling; optional, defaults to ''
186 *
187 * @param $sections the sections list, in the format described above
188 * @param $translationPrefix the translation prefix added to the id of each
189 * item, in order to generate the name and description; ignored when
190 * name or description are specified
191 *#
192 #macro(admin_displayCategory $sections $translationPrefix)
193 (% class="admin-category" %)
194 #set ($sortedSections = [])
195 #sortCollectionOfMapsByField($sections, 'order', 9999, 'asc', $sortedSections)
196 #foreach ($section in $sortedSections)
197 * [[[[image:${section.iconReference}]] **${section.name}**>>path:${section.url}]] (% class="description" %)$!{section.description}
198 #end
199 #end
200
201
202 #**
203 * Displays the administration categories
204 *
205 * Expected format:
206 * sections = vector of items
207 * item = map with the following fields:
208 * 'id' : mandatory
209 * 'name' : the text displayed for the corresponding menu item;
210 * optional, defaults to
211 * $services.localization.render("$!{translationPrefix}${item.id}")
212 * 'description' : the description displayed for the corresponding section;
213 * optional
214 * 'link' : the "action" of the menu item; mandatory
215 * 'cssClass' : a specific css class for the menu item for custom
216 * styling; optional, defaults to ''
217 *
218 * @param $sections the sections list, in the format described above
219 * @param $translationPrefix the translation prefix added to the id of each
220 * item, in order to generate the name and description; ignored when
221 * name or description are specified
222 *#
223 #macro(admin_displayCategories $adminMenu $translationPrefix)
224 (% class="admin-category" %)
225 #foreach ($category in $adminMenu)
226 * [[[[image:${category.iconReference}]] **${category.name}**>>path:${category.url}]] (% class="description" %)$!{category.description}
227 #end
228 #end
229
230 #macro (verticalNavigation $menu $options)
231 {{html clean="false"}}
232 <div id="$!options.id" class="panel-group $!options.cssClass" role="tablist" aria-multiselectable="true">
233 <div class="panel xform">
234 <input type="text" class="form-control panel-group-filter" autocomplete="off"
235 placeholder="$escapetool.xml($services.localization.render('administration.menu.search.hint'))" />
236 </div>
237 #foreach ($item in $menu)
238 #verticalNavigationItem($item $options)
239 #end
240 <div class="panel panel-default noitems hidden">
241 <div class="panel-heading collapsed">
242 $escapetool.xml($services.localization.render('administration.menu.search.noResults'))
243 </div>
244 </div>
245 </div>
246 {{/html}}
247 #end
248
249 #macro (verticalNavigationItem $item $options)
250 #set ($escapedId = $escapetool.xml($item.id))
251 #set ($name = "$!item.name")
252 #if ($name == '')
253 #set ($name = $services.localization.render("$!options.translationPrefix$item.id"))
254 #end
255 #set ($isActive = $item.active == true)
256 #set ($hasChildren = $item.children && $item.children.size() > 0)
257 #if ($hasChildren)
258 #set ($children = [])
259 #sortCollectionOfMapsByField($item.children, 'order', 99999, 'asc', $children)
260 <div class="panel panel-default">
261 <a class="panel-heading#if (!$isActive) collapsed#end" role="tab" id="panel-heading-$escapedId"
262 href="$!item.url" data-toggle="collapse"#if ("$!options.id" != '') data-parent="#$options.id" #end
263 data-target="#panel-body-$escapedId" aria-expanded="$isActive" aria-controls="panel-body-$escapedId"
264 title="$!escapetool.xml($item.description)">$!services.icon.renderHTML($item.icon)$escapetool.xml($name)</a>
265 <div class="panel-collapse collapse#if ($isActive) in#end" role="tabpanel" id="panel-body-$escapedId"
266 aria-labelledby="panel-heading-$escapedId">
267 <div class="list-group">
268 #foreach ($child in $children)
269 #verticalNavigationItem($child $options)
270 #end
271 </div>
272 </div>
273 </div>
274 #else
275 <a class="list-group-item#if ($isActive) active#end" data-id="$escapedId"
276 href="$!item.url" title="$!escapetool.xml($item.description)"
277 >$!services.icon.renderHTML($item.icon)$escapetool.xml($name)</a>
278 #end
279 #end
280 {{/velocity}}
281
282 {{velocity}}
283 ##**************************************************************************************************
284 ## Administration Sheet, used to display a common UI for some wiki features (presentation, users,
285 ## groups, rights etc.) at global / space level and also for several applications.
286 ##**************************************************************************************************
287 #if($xcontext.action == 'view')
288 $response.sendRedirect($xwiki.getURL($doc.getFullName(), 'admin', $request.getQueryString()))##
289 #else
290 $xwiki.jsx.use('XWiki.AdminSheet')##
291 ## Construct the SSX parameter map.
292 #set ($parameterMap = {})
293 #if ($themeDoc)
294 #set ($discard = $parameterMap.put('colorTheme', $themeDocFullName))
295 #end
296 $xwiki.ssx.use('XWiki.AdminSheet', $parameterMap)##
297 #if ("$!crtSectionId" != '' && $crtSectionId.indexOf('.') > 0 && $xwiki.exists($crtSectionId))
298 #set ($sectionName = $xwiki.getDocument($crtSectionId).getDisplayTitle())
299 #elseif ($crtSectionId != '' && $services.localization.get("admin.${crtSectionId.toLowerCase()}"))
300 #set ($sectionName = $services.localization.render("admin.${crtSectionId.toLowerCase()}"))
301 #elseif ("$!crtSectionId" != '')
302 #set ($sectionName = $crtSectionId)
303 #elseif ("$!crtCategoryId" != '')
304 #set ($sectionName = $services.localization.render("admin.$crtCategory.id"))
305 #elseif ($editor == 'globaladmin')
306 #set ($sectionName = $services.wiki.getById($xcontext.database).prettyName)
307 #if ("$!sectionName" == '')
308 #set ($sectionName = $xcontext.database)
309 #end
310 #else
311 #set ($sectionName = $currentSpace)
312 #end
313
314 {{html}}
315 #template('hierarchy.vm')
316 {{/html}}
317
318 ## Determine the administration level.
319 #set ($level = '')
320 #if ($doc.name == 'WebPreferences')
321 #set ($level = '.page')
322 #elseif ($doc.fullName == 'XWiki.XWikiPreferences')
323 #if ($xcontext.isMainWiki())
324 #set ($level = '.global')
325 #else
326 #set ($level = '.wiki')
327 #end
328 #end
329 (% id="document-title" %)(((
330 = $services.localization.render("administration.sectionTitle$level", [$sectionName]) =
331 ## Display the category/section description below the title.
332 #set ($categoryOrSectionId = $crtCategory.id)
333 #if ("$!crtSection.id" != '')
334 #set ($categoryOrSectionId = $crtSection.id)
335 #end
336 #set ($descriptionTranslationKey = "admin.$!{categoryOrSectionId.toLowerCase()}.description")
337 #if ($services.localization.get($descriptionTranslationKey))
338 (% class = "noitems" %)(((
339 $services.localization.render($descriptionTranslationKey)
340 )))
341 #end
342
343 ----
344 )))
345
346 #verticalNavigation($adminMenu {
347 'id': 'administration-menu',
348 'translationPrefix': 'admin.',
349 'cssClass': 'admin-menu'
350 })
351
352 ##-----------------------------------------
353 ## admin-page display
354 ##-----------------------------------------
355 #if(!$crtSection && !$crtCategory)
356 #admin_displayCategories($adminMenu)
357 #elseif (!$crtSection)
358 #admin_displayCategory($crtCategory.children)
359 #else
360 (% id="admin-page-content" %)(((
361 ##------------------------------------------------------------------------------------------------------------
362 ## The Administration allows editing other pages from different applications inside the admin context (UI)
363 ##------------------------------------------------------------------------------------------------------------
364 #if ("$!{request.editmode}" == 'inline' && $xwiki.exists($section))
365 #set ($discard = $xcontext.setDisplayMode('edit'))
366 {{html clean="false"}}{{include reference="XWiki.AdminInlineSheet" /}}{{/html}}
367 #elseif ($xwiki.exists("XWiki.Admin${section}Sheet"))
368 ## Custom XE administration section
369 {{include reference="XWiki.Admin${section}Sheet" /}}
370 #elseif ($xwiki.exists($section))
371 {{html clean="false"}}#includeForm($section){{/html}}
372 #end
373 #if ($crtSection.configurable)
374
375 {{include reference="XWiki.ConfigurableClass" /}}
376 #end
377 ))) ## admin-page-content
378 #end
379 #end
380 {{/velocity}}