Modifications pour le document Sections des configurations personnalisables

Modifié par Florent Charton le 2025/08/19 15:15

Depuis la version 1.1
modifié par superadmin
sur 2022/06/20 08:48
Commentaire de modification : Install extension [org.xwiki.platform:xwiki-platform-administration-ui/13.10.6]
À la version 4.1
modifié par Florent Charton
sur 2025/08/19 15:15
Commentaire de modification : Install extension [org.xwiki.platform:xwiki-platform-administration-ui/17.4.3]

Résumé

Détails

Propriétés de la Page
Auteur du document
... ... @@ -1,1 +1,1 @@
1 -XWiki.superadmin
1 +xwiki:XWiki.fcharton
Syntaxe
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.0
1 +XWiki 2.1
Contenu
... ... @@ -69,7 +69,8 @@
69 69   #foreach($appName in $outputList)
70 70   ##
71 71   ## Make sure the current user has permission to edit the configurable application.
72 - #set($userHasAccessToDocument = $xcontext.hasAccessLevel('edit', $appName))
72 + ## Unless we are in the page administration which is never about modifying the application configuration page
73 + #set($userHasAccessToDocument = $level == '.page' || $xcontext.hasAccessLevel('edit', $appName))
73 73   ##
74 74   ## If the document was not last saved by a user with edit privilege on this page
75 75   ## then we can't safely display the page but we should warn the viewer.
... ... @@ -123,6 +123,9 @@
123 123   {{warning}}{{translation key="xe.admin.configurable.cannotLockNoJavascript"/}}{{/warning}}
124 124  
125 125   </noscript>
127 + {{/html}}
128 +
129 + {{html clean=false}}
126 126   <script>
127 127   document.observe("xwiki:dom:loaded", function() {
128 128   XWiki.DocumentLock && new XWiki.DocumentLock('$escapetool.javascript($app.prefixedFullName)').lock();
... ... @@ -146,7 +146,8 @@
146 146   ## Internal error, not translated.
147 147   #showHeading($appName, $headingShowing)
148 148  
149 - {{error}}Internal error: All objects were filtered out for application: $appName.{{/error}}
153 + {{error}}Internal error: All objects were filtered out for application:
154 + $services.rendering.escape($appName, 'xwiki/2.1').{{/error}}
150 150  
151 151   #else
152 152   #set($formAction = $xwiki.getURL($app.getFullName(), 'save'))
... ... @@ -153,26 +153,23 @@
153 153   #set($formId = "${section.toLowerCase()}_${app.getFullName()}")
154 154   #set($escapedAppName = $escapetool.xml($app.getFullName()))
155 155   #foreach($configurableObj in $configurableObjs)
156 - ## Execute the content code if any
157 - ## FIXME: we have to do that before the title before of the dropPermissions
158 - #set($codeToExecute = "$!app.getValue('codeToExecute', $configurableObj)")
159 - #if($codeToExecute != '')
160 - #set($codeToExecuteResult = $configurableObj.display('codeToExecute', 'view', false))
161 + #set ($heading = $app.getValue('heading', $configurableObj))
162 + #set ($codeToExecute = "$!app.getValue('codeToExecute', $configurableObj)")
163 + ## If linkPrefix is set, then we will make each property label a link which starts with that prefix.
164 + #set ($linkPrefix = "$!app.getValue('linkPrefix', $configurableObj)")
165 + #if (!$app.restricted)
166 + #set ($evaluatedConfigurableObj = $configurableObj.evaluate())
167 + #set ($heading = $evaluatedConfigurableObj.heading)
168 + #set ($linkPrefix = $evaluatedConfigurableObj.linkPrefix)
161 161   #end
162 162   ## Display the header if one exists.
163 - #set($heading = $app.getValue('heading', $configurableObj))
164 164   #if($heading && $heading != '')
165 - ## This application should not run with programming rights because it evaluates code which may not be trustworthy.
166 - ## Removing the next line will open a security hole.
167 - ## Can't use $configurableObj.display('heading', 'view', false) to have proper heading id (because of the html macro)
168 - ## FIXME: find a cleaner solution
169 - #set($void = $doc.dropPermissions())
170 - == #evaluate($heading) ==
172 + == $services.rendering.escape($heading, 'xwiki/2.1') ==
171 171   #end
172 172   ## Display code to execute
173 - #if($codeToExecute != '')
175 + #if ($codeToExecute != '')
174 174   (%class="codeToExecute"%)(((##
175 - $codeToExecuteResult
177 + $configurableObj.display('codeToExecute', 'view', false)
176 176   )))
177 177   #end
178 178   ##
... ... @@ -182,9 +182,6 @@
182 182   #set($propertiesToShow = [])
183 183   #end
184 184   ##
185 - ## If linkPrefix is set, then we will make each property label a link which starts with that prefix.
186 - #set($linkPrefix = "$!app.getValue('linkPrefix', $configurableObj)")
187 - ##
188 188   ## If the Configurable object specifies a configuration class, use it,
189 189   ## otherwise assume custom forms are used instead.
190 190   #set($configClassName = "$!app.getValue('configurationClass', $configurableObj)")
... ... @@ -203,7 +203,12 @@
203 203   #showHeading($appName, $headingShowing)
204 204  
205 205   {{error}}
206 - {{translation key="xe.admin.configurable.noObjectOfConfigurationClassFound" parameters="$objClass.getName(), $app.getFullName()"/}}
205 + #set($escapedObjClassName =
206 + $services.rendering.escape($escapetool.java($objClass.getName()), 'xwiki/2.1'))
207 + #set($translationEscapedAppName =
208 + $services.rendering.escape($escapetool.java($app.getFullName()), 'xwiki/2.1'))
209 + {{translation key="xe.admin.configurable.noObjectOfConfigurationClassFound"
210 + parameters="~"$escapedObjClassName~", ~"$translationEscapedAppName~""/}}
207 207   {{/error}}
208 208  
209 209   #else
... ... @@ -354,7 +354,7 @@
354 354   #if($globaladmin)
355 355   #set($queryString = "editor=globaladmin&amp;section=")
356 356   #else
357 - #set($queryString = "space=${currentSpace}&amp;section=")
361 + #set($queryString = "space=$escapetool.url($currentSpace)&amp;section=")
358 358   #if($request.getParameter('editor'))
359 359   #set($queryString = "editor=$escapetool.url($request.getParameter('editor'))&amp;$queryString")
360 360   #end
... ... @@ -387,7 +387,7 @@
387 387   $escapetool.xml($sectionDisplayName)
388 388   </span>
389 389   #if(!$hasAccess)
390 - <br/><span class="errormessage">$services.localization.render('xe.admin.configurable.sectionIconNoAccess')</span>
394 + <br/>#inlineError($services.localization.render('xe.admin.configurable.sectionIconNoAccess'))
391 391   #end
392 392   </a>
393 393   </li>
... ... @@ -396,9 +396,9 @@
396 396  
397 397   ## Finally we display an error message if there are any applications which we were unable to view.
398 398   #if($appsUserCannotView.size() > 0)
403 + {{error}}$services.localization.render('xe.admin.configurable.noViewAccessSomeApplications',
404 + 'xwiki/2.1', [$appsUserCannotView]){{/error}}
399 399  
400 - {{error}}$services.localization.render('xe.admin.configurable.noViewAccessSomeApplications', [$appsUserCannotView]){{/error}}
401 -
402 402   #end
403 403  #end## If we should be looking at the main administration page.
404 404  {{/velocity}}