Изменения документа Макрос для настраиваемых разделов
Редактировал(а) Dmitriy Rybakov 04.10.2024, 00:09
От версии 2.1
отредактировано Dmitriy Rybakov
на 04.10.2024, 00:09
на 04.10.2024, 00:09
Изменить комментарий:
Install extension [org.xwiki.platform:xwiki-platform-administration-ui/15.10.12]
К версии 1.1
отредактировано Admin xWiKi
на 15.10.2019, 13:19
на 15.10.2019, 13:19
Изменить комментарий:
Install extension [org.xwiki.platform:xwiki-platform-administration-ui/11.8.1]
Сводка
-
Свойства страницы (3 изменено, 0 добавлено, 0 удалено)
Подробности
- Свойства страницы
-
- Автор документа
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. rybakovds1 +XWiki.admin - Синтаксис
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki 2. 11 +XWiki 2.0 - Содержимое
-
... ... @@ -43,39 +43,18 @@ 43 43 * a safety measure because macros can't return values. 44 44 *### 45 45 #macro(findNamesOfAppsToConfigure, $section, $globaladmin, $space, $outputList) 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 = [ 46 + #set ($fromClause = [ 52 52 'BaseObject as obj', 53 53 'StringProperty as category', 54 - 'IntegerProperty as sectionOrder' 49 + 'IntegerProperty as sectionOrder', 50 + 'IntegerProperty as global' 55 55 ]) 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 = [ 52 + #set ($whereClause = [ 66 66 "obj.name = doc.fullName and obj.className = :className", 67 67 "category.id = obj.id and category.name = 'displayInCategory'", 68 - "sectionOrder.id = obj.id and sectionOrder.name = 'sectionOrder'" 55 + "sectionOrder.id = obj.id and sectionOrder.name = 'sectionOrder'", 56 + "global.id = obj.id and global.name = 'configureGlobally' and global.value = :global" 69 69 ]) 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 - ## 79 79 #set ($params = {'className' : $nameOfThisDocument}) 80 80 ## Order by category and section priority, leaving empty/null category at the end, because we want to read the 81 81 ## category meta data from the first (most important) section in each category. ... ... @@ -85,50 +85,27 @@ 85 85 'sectionOrder.value' 86 86 ]) 87 87 #if ($globaladmin == true) 88 - #set ($discard = $params.put('deprecatedGlobal', 1)) 89 - #set ($discard = $params.put('global', ['WIKI','WIKI+ALL_SPACES'])) 67 + #set ($discard = $params.put('global', 1)) 90 90 #else 91 - #set ($discard = $params.put(' deprecatedGlobal', 0))69 + #set ($discard = $params.put('global', 0)) 92 92 #if ("$!space" != '') 93 - #set ($discard = $params.put('global', ['SPACE'])) 94 94 #set ($discard = $whereClause.add('doc.space = :space')) 95 95 #set ($discard = $params.put('space', $space)) 96 - #else 97 - #set ($discard = $params.put('global', ['ALL_SPACES','WIKI+ALL_SPACES'])) 98 98 #end 99 99 #end 100 100 #if ("$!section" != '') 101 101 #set ($discard = $fromClause.add('StringProperty as section')) 102 - #set ($discard = $fromClauseDeprecated.add('StringProperty as section')) 103 103 #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")) 105 105 #set ($discard = $params.put('section', $section)) 106 106 #end 107 107 #set ($statement = ', ' + $stringtool.join($fromClause, ', ') + 108 108 ' where ' + $stringtool.join($whereClause, ' and ') + 109 109 ' 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 - ## 120 120 ## We can't remove duplicates using the unique filter because the select clause will be extended with the information 121 121 ## needed by the order by clause. Thus we remove the duplicates after we get the results. 122 - #set ($orderedSetOfAppNames = $collectiontool.orderedSet) 85 + #set ($orderedSetOfAppNames = $collectionstool.orderedSet) 123 123 #set ($discard = $orderedSetOfAppNames.addAll($services.query.hql($statement).bindValues($params).execute())) 124 - #set ($discard = $orderedSetOfAppNames.addAll($services.query.hql($statementDeprecated).bindValues($deprecatedParams).execute())) 125 125 #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 132 132 #end 133 133 134 134 #* ... ... @@ -273,7 +273,7 @@ 273 273 #break 274 274 #end 275 275 #end 276 - #set ($adminMenu = $ collectiontool.sort($adminMenu, 'score:desc'))232 + #set ($adminMenu = $sorttool.sort($adminMenu, 'score:desc')) 277 277 #end 278 278 279 279 ... ... @@ -287,10 +287,8 @@ 287 287 #macro(showHeading, $appName, $headingAlreadyShowing) 288 288 #if(!$headingAlreadyShowing) 289 289 #set($headingAlreadyShowing = true) 290 - #set($escapedAppName = $services.rendering.escape($appName, 'xwiki/2.1')) 291 - #set($doubleEscapedAppName = $services.rendering.escape($escapedAppName, 'xwiki/2.1')) 292 292 293 - = ={{translation key="admin.customize"/}} [[$doubleEscapedAppName>>$escapedAppName]]: ==247 + = {{translation key="admin.customize"/}} [[$appName>>$appName]]: = 294 294 #end 295 295 #end 296 296 ... ... @@ -301,6 +301,8 @@ 301 301 #if($propertiesToShow.size() > 0 && !$propertiesToShow.contains($propName)) 302 302 ## Silently skip over this property. 303 303 #else 258 + #set($prettyName = "#evaluate($app.displayPrettyName($propName, $obj))") 259 + ## 304 304 #set($hintKey = "${obj.xWikiClass.name}_${propName}.hint") 305 305 #set($hint = $services.localization.render($hintKey)) 306 306 #if($hint == $hintKey) ... ... @@ -324,10 +324,11 @@ 324 324 $out ## 325 325 #set ($out = '') 326 326 #end 327 - $escapetool.xml($ app.displayPrettyName($propName, $obj))283 + $escapetool.xml($prettyName) 328 328 </label> 329 329 #if($linkPrefix != '') 330 - <a href="$escapetool.xml($linkPrefix + $propName)" class="xHelp" title="$services.localization.render('admin.documentation')">$services.localization.render('admin.documentation')</a> 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> 331 331 #end 332 332 #if ($hint) 333 333 <span class="xHint">$hint</span> ... ... @@ -335,9 +335,6 @@ 335 335 </dt> 336 336 #if ($out != '') 337 337 <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> 341 341 #end 342 342 #end## If property is in propertiesToShow 343 343 #end## Foreach property in this class