Редактировал(а) Dmitriy Rybakov 04.10.2024, 00:09

От версии 1.1
отредактировано Admin xWiKi
на 15.10.2019, 13:19
Изменить комментарий: Install extension [org.xwiki.platform:xwiki-platform-administration-ui/11.8.1]
К версии 2.1
отредактировано Dmitriy Rybakov
на 04.10.2024, 00:09
Изменить комментарий: Install extension [org.xwiki.platform:xwiki-platform-administration-ui/15.10.12]

Сводка

Подробности

Свойства страницы
Автор документа
... ... @@ -1,1 +1,1 @@
1 -XWiki.admin
1 +XWiki.rybakovds
Синтаксис
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.0
1 +XWiki 2.1
Содержимое
... ... @@ -43,18 +43,39 @@
43 43   * a safety measure because macros can't return values.
44 44   *###
45 45  #macro(findNamesOfAppsToConfigure, $section, $globaladmin, $space, $outputList)
46 - #set ($fromClause = [
46 + ## We keep looking in the old configureGlobally property since we do not provide a migration for it:
47 + ## this choice has been made to avoid any problem during the upgrade of old wikis.
48 + ## And we are doing this look in a separate query for performance reason: adding a or statement is very bad
49 + ## in terms of performance. This all should be improved in the future with proper caching.
50 + ##
51 + #set ($fromClauseWithoutGlobal = [
47 47   'BaseObject as obj',
48 48   'StringProperty as category',
49 - 'IntegerProperty as sectionOrder',
50 - 'IntegerProperty as global'
54 + 'IntegerProperty as sectionOrder'
51 51   ])
52 - #set ($whereClause = [
56 + ##
57 + #set ($fromClause = [])
58 + #set ($discard = $fromClause.addAll($fromClauseWithoutGlobal))
59 + #set ($discard = $fromClause.add('StringProperty as global'))
60 + ##
61 + #set ($fromClauseDeprecated = [])
62 + #set ($discard = $fromClauseDeprecated.addAll($fromClauseWithoutGlobal))
63 + #set ($discard = $fromClauseDeprecated.add('IntegerProperty as deprecatedGlobal'))
64 + ##
65 + #set ($whereClauseWithoutGlobal = [
53 53   "obj.name = doc.fullName and obj.className = :className",
54 54   "category.id = obj.id and category.name = 'displayInCategory'",
55 - "sectionOrder.id = obj.id and sectionOrder.name = 'sectionOrder'",
56 - "global.id = obj.id and global.name = 'configureGlobally' and global.value = :global"
68 + "sectionOrder.id = obj.id and sectionOrder.name = 'sectionOrder'"
57 57   ])
70 + ##
71 + #set ($whereClause = [])
72 + #set ($discard = $whereClause.addAll($whereClauseWithoutGlobal))
73 + #set ($discard = $whereClause.add("global.id = obj.id and global.name = 'scope' and global.value in (:global)"))
74 + ##
75 + #set ($whereClauseDeprecated = [])
76 + #set ($discard = $whereClauseDeprecated.addAll($whereClauseWithoutGlobal))
77 + #set ($discard = $whereClauseDeprecated.add("deprecatedGlobal.id = obj.id and deprecatedGlobal.name = 'configureGlobally' and deprecatedGlobal.value = :deprecatedGlobal"))
78 + ##
58 58   #set ($params = {'className' : $nameOfThisDocument})
59 59   ## Order by category and section priority, leaving empty/null category at the end, because we want to read the
60 60   ## category meta data from the first (most important) section in each category.
... ... @@ -64,27 +64,50 @@
64 64   'sectionOrder.value'
65 65   ])
66 66   #if ($globaladmin == true)
67 - #set ($discard = $params.put('global', 1))
88 + #set ($discard = $params.put('deprecatedGlobal', 1))
89 + #set ($discard = $params.put('global', ['WIKI','WIKI+ALL_SPACES']))
68 68   #else
69 - #set ($discard = $params.put('global', 0))
91 + #set ($discard = $params.put('deprecatedGlobal', 0))
70 70   #if ("$!space" != '')
93 + #set ($discard = $params.put('global', ['SPACE']))
71 71   #set ($discard = $whereClause.add('doc.space = :space'))
72 72   #set ($discard = $params.put('space', $space))
96 + #else
97 + #set ($discard = $params.put('global', ['ALL_SPACES','WIKI+ALL_SPACES']))
73 73   #end
74 74   #end
75 75   #if ("$!section" != '')
76 76   #set ($discard = $fromClause.add('StringProperty as section'))
102 + #set ($discard = $fromClauseDeprecated.add('StringProperty as section'))
77 77   #set ($discard = $whereClause.add("section.id = obj.id and section.name = 'displayInSection' and section.value = :section"))
104 + #set ($discard = $whereClauseDeprecated.add("section.id = obj.id and section.name = 'displayInSection' and section.value = :section"))
78 78   #set ($discard = $params.put('section', $section))
79 79   #end
80 80   #set ($statement = ', ' + $stringtool.join($fromClause, ', ') +
81 81   ' where ' + $stringtool.join($whereClause, ' and ') +
82 82   ' order by ' + $stringtool.join($orderByClause, ', '))
110 + #set ($statementDeprecated = ', ' + $stringtool.join($fromClauseDeprecated, ', ') +
111 + ' where ' + $stringtool.join($whereClauseDeprecated, ' and ') +
112 + ' order by ' + $stringtool.join($orderByClause, ', '))
113 + ##
114 + #set ($deprecatedParams = {})
115 + #set ($discard = $deprecatedParams.putAll($params))
116 + #set ($discard = $deprecatedParams.remove('global'))
117 + #set ($discard = $deprecatedParams.remove('space'))
118 + #set ($discard = $params.remove('deprecatedGlobal'))
119 + ##
83 83   ## We can't remove duplicates using the unique filter because the select clause will be extended with the information
84 84   ## needed by the order by clause. Thus we remove the duplicates after we get the results.
85 - #set ($orderedSetOfAppNames = $collectionstool.orderedSet)
122 + #set ($orderedSetOfAppNames = $collectiontool.orderedSet)
86 86   #set ($discard = $orderedSetOfAppNames.addAll($services.query.hql($statement).bindValues($params).execute()))
124 + #set ($discard = $orderedSetOfAppNames.addAll($services.query.hql($statementDeprecated).bindValues($deprecatedParams).execute()))
87 87   #set ($discard = $outputList.addAll($orderedSetOfAppNames))
126 + #if ($globaladmin == false && "$!space" != '')
127 + ## If we are looking for the apps of a specific space, we should also get the one configured for all spaces.
128 + ## Note that we're doing that call at the end to avoid polluting the different velocity variables during the
129 + ## execution.
130 + #findNamesOfAppsToConfigure($section, false, '', $outputList)
131 + #end
88 88  #end
89 89  
90 90  #*
... ... @@ -229,7 +229,7 @@
229 229   #break
230 230   #end
231 231   #end
232 - #set ($adminMenu = $sorttool.sort($adminMenu, 'score:desc'))
276 + #set ($adminMenu = $collectiontool.sort($adminMenu, 'score:desc'))
233 233  #end
234 234  
235 235  
... ... @@ -243,8 +243,10 @@
243 243  #macro(showHeading, $appName, $headingAlreadyShowing)
244 244   #if(!$headingAlreadyShowing)
245 245   #set($headingAlreadyShowing = true)
290 + #set($escapedAppName = $services.rendering.escape($appName, 'xwiki/2.1'))
291 + #set($doubleEscapedAppName = $services.rendering.escape($escapedAppName, 'xwiki/2.1'))
246 246  
247 - = {{translation key="admin.customize"/}} [[$appName>>$appName]]: =
293 + == {{translation key="admin.customize"/}} [[$doubleEscapedAppName>>$escapedAppName]]: ==
248 248   #end
249 249  #end
250 250  
... ... @@ -255,8 +255,6 @@
255 255   #if($propertiesToShow.size() > 0 && !$propertiesToShow.contains($propName))
256 256   ## Silently skip over this property.
257 257   #else
258 - #set($prettyName = "#evaluate($app.displayPrettyName($propName, $obj))")
259 - ##
260 260   #set($hintKey = "${obj.xWikiClass.name}_${propName}.hint")
261 261   #set($hint = $services.localization.render($hintKey))
262 262   #if($hint == $hintKey)
... ... @@ -280,11 +280,10 @@
280 280   $out ##
281 281   #set ($out = '')
282 282   #end
283 - $escapetool.xml($prettyName)
327 + $escapetool.xml($app.displayPrettyName($propName, $obj))
284 284   </label>
285 285   #if($linkPrefix != '')
286 - #set($linkScript = "$linkPrefix$propName")
287 - <a href="$escapetool.xml("#evaluate($linkScript)")" class="xHelp" title="$services.localization.render('admin.documentation')">$services.localization.render('admin.documentation')</a>
330 + <a href="$escapetool.xml($linkPrefix + $propName)" class="xHelp" title="$services.localization.render('admin.documentation')">$services.localization.render('admin.documentation')</a>
288 288   #end
289 289   #if ($hint)
290 290   <span class="xHint">$hint</span>
... ... @@ -292,6 +292,9 @@
292 292   </dt>
293 293   #if ($out != '')
294 294   <dd>$out</dd>
338 + #else
339 + ## We always display a dd element to avoid having a last dt element alone, which would lead to an invalid html.
340 + <dd class="hidden">$out</dd>
295 295   #end
296 296   #end## If property is in propertiesToShow
297 297   #end## Foreach property in this class