Changes for page Default Class Sheet

Last modified by Thomas Coelho (local) on 2023/08/09 10:59

From version 5.1
edited by Thomas Coelho (local)
on 2023/08/09 10:59
Change comment: Install extension [org.xwiki.platform:xwiki-platform-xclass-ui/15.5]
To version 1.1
edited by Laura Sagunski
on 2022/09/27 12:39
Change comment: Install extension [org.xwiki.platform:xwiki-platform-xclass-ui/14.6]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.coelho
1 +xwiki:XWiki.sagunski
Content
... ... @@ -30,7 +30,6 @@
30 30   ## inline action.
31 31   #set ($editAction = $xwiki.getDocument($request.template).getDefaultEditMode())
32 32   $response.sendRedirect($xwiki.getURL($targetDocRef, $editAction, $escapetool.url({
33 - 'form_token': $request.form_token,
34 34   'template': $request.template,
35 35   'parent': $request.parent,
36 36   'title': $request.docName
... ... @@ -46,7 +46,7 @@
46 46  ## sheet output. Class authors can put the description of the class in the class document content.
47 47  #set($classSheetReference = $services.model.createDocumentReference($doc.wiki, 'XWiki', 'ClassSheet'))
48 48  #if($services.sheet.getDocumentSheets($doc).contains($classSheetReference))
49 - {{include reference="" author="target"/}}
48 + {{include reference="" /}}
50 50  #end
51 51  {{/velocity}}
52 52  
... ... @@ -92,17 +92,10 @@
92 92  
93 93   #set ($classEditorURL = $doc.getURL('edit', 'editor=class'))
94 94   #if($doc.getxWikiClass().properties.size() == 0)
95 - #set ($openLink = "<a href='$escapetool.xml($classEditorURL)'>")
96 - #set ($closeLink = '</a>')
97 - {{warning}}
98 - {{html}}
99 - ## First escape the content of the translation, then replace the placeholders with content that would otherwise be
100 - ## escaped during the first escaping.
101 - #set ($warningMessage = $services.localization.render('platform.xclass.defaultClassSheet.properties.empty',
102 - ['__OPEN_LINK__', '__CLOSE_LINK__']))
103 - $escapetool.xml($warningMessage).replace('__OPEN_LINK__', $openLink).replace('__CLOSE_LINK__', $closeLink)
104 - {{/html}}
105 - {{/warning}}
94 + {{warning}}$services.localization.render('platform.xclass.defaultClassSheet.properties.empty', [
95 + "{{html}}<a href='$classEditorURL'>",
96 + '</a>{{/html}}'
97 + ]){{/warning}}
106 106   #else
107 107   (% id="HClassProperties" %)
108 108   = {{translation key="platform.xclass.defaultClassSheet.properties.heading"/}} =
... ... @@ -109,12 +109,10 @@
109 109   #foreach($property in $doc.getxWikiClass().properties)
110 110   * $services.rendering.escape("$property.prettyName ($property.name: $xwiki.metaclass.get($property.classType).prettyName)", $xwiki.currentContentSyntaxId)
111 111   #end
112 - #set ($openLink = "<a href='$escapetool.xml($classEditorURL)'>")
113 - #set ($closeLink = '</a>')
114 - #set ($warningMessage = $escapetool.xml($services.localization.render('platform.xclass.defaultClassSheet.properties.edit', ['__OPEN_LINK__', '__CLOSE_LINK__'])))
115 - ## First escape the content of the translation, then replace the placeholders with content that would otherwise be
116 - ## escaped during the first escaping.
117 - * //{{html}}$warningMessage.replace('__OPEN_LINK__', $openLink).replace('__CLOSE_LINK__', $closeLink){{/html}}//
104 + * //$services.localization.render('platform.xclass.defaultClassSheet.properties.edit', [
105 + "{{html}}<a href='$classEditorURL'>",
106 + '</a>{{/html}}'
107 + ])//
118 118  
119 119   #end
120 120   #if ($hasClassSheets && $hasClassTemplate)
... ... @@ -121,16 +121,11 @@
121 121   (% id="HCreatePage" %)
122 122   = {{translation key="platform.xclass.defaultClassSheet.createPage.heading"/}} =
123 123   #if("$!targetDocRef" != '' && $xwiki.exists($targetDocRef))
124 - {{warning}}
125 - {{html}}
126 - #set ($targetDocLink = $xwiki.getURL($targetDocRef))
127 - #set ($openLink = "<a href='$escapetool.xml($targetDocLink)'>")
128 - #set ($message = $escapetool.xml($services.localization.render('platform.xclass.defaultClassSheet.createPage.pageAlreadyExists', ['__OPEN_LINK__', '__CLOSE_LINK__'])))
129 - ## First escape the content of the translation, then replace the placeholders with content that would
130 - ## otherwise be escaped during the first escaping.
131 - $message.replace('__OPEN_LINK__', $openLink).replace('__CLOSE_LINK__', '</a>')
132 - {{/html}}
133 - {{/warning}}
114 +
115 + {{warning}}$services.localization.render('platform.xclass.defaultClassSheet.createPage.pageAlreadyExists', [
116 + '[[',
117 + ">>$services.model.serialize($targetDocRef)]]"
118 + ]){{/warning}}
134 134   #elseif("$!targetDocRef" != '')
135 135  
136 136   {{warning}}{{translation key="platform.xclass.defaultClassSheet.createPage.denied"/}}{{/warning}}
... ... @@ -138,11 +138,10 @@
138 138  
139 139   {{html}}
140 140   <form action="$doc.getURL()" id="newdoc" method="post" class="xform half">
141 - <fieldset>
142 142   <div class="hidden">
143 143   <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
144 - <input type="hidden" name="parent" value="$escapetool.xml(${defaultParent})"/>
145 - <input type="hidden" name="template" value="$escapetool.xml(${classTemplateDoc})"/>
128 + <input type="hidden" name="parent" value="${defaultParent}"/>
129 + <input type="hidden" name="template" value="${classTemplateDoc}"/>
146 146   <input type="hidden" name="sheet" value="1"/>
147 147   </div>
148 148   #locationPicker({
... ... @@ -177,7 +177,6 @@
177 177   'platform.xclass.defaultClassSheet.createPage.label'))"/>
178 178   </span>
179 179   </p>
180 - </fieldset>
181 181   </form>
182 182   {{/html}}
183 183  
... ... @@ -196,8 +196,8 @@
196 196   id="classEntries"
197 197   properties="doc.title,doc.location,doc.date,doc.author,doc.objectCount,_actions"
198 198   source="liveTable"
199 - className="$services.rendering.escape(${doc.fullName}, 'xwiki/2.1')"
200 - sourceParameters="$services.rendering.escape($escapetool.url($options), 'xwiki/2.1')"
182 + className="${doc.fullName}"
183 + sourceParameters="${escapetool.url($options)}"
201 201   }}
202 202   {
203 203   "meta": {
... ... @@ -224,13 +224,7 @@
224 224   {{translation key="platform.xclass.defaultClassSheet.sheets.missing"/}}
225 225   #end
226 226  
227 - {{info}}
228 - #set ($message = $services.localization.render('platform.xclass.defaultClassSheet.sheets.description', ['__START_EM__', '__END_EM__']))
229 - #set ($message = $escapetool.xml($message))
230 - ## First escape the content of the translation, then replace the placeholders with content that would
231 - ## otherwise be escaped during the first escaping.
232 - {{html}}$message.replace('__START_EM__', '<em>').replace('__END_EM__', '</em>'){{/html}}
233 - {{/info}}
210 + {{info}}$services.localization.render('platform.xclass.defaultClassSheet.sheets.description', ['//', '//']){{/info}}
234 234  
235 235   #if(!$hasClassSheets)
236 236   {{html}}
... ... @@ -237,8 +237,8 @@
237 237   <form action="$xwiki.getURL($defaultClassSheetReference, 'save', 'editor=wiki')" method="post">
238 238   <div>
239 239   <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
240 - <input type="hidden" name="parent" value="$escapetool.xml(${doc.fullName})"/>
241 - <input type="hidden" name="xredirect" value="$escapetool.xml(${doc.URL})"/>
217 + <input type="hidden" name="parent" value="${doc.fullName}"/>
218 + <input type="hidden" name="xredirect" value="${doc.URL}"/>
242 242   #set ($sheetContent = $xwiki.getDocument('XWiki.ObjectSheet').getContent().replace('XWiki.MyClass',
243 243   $doc.fullName))
244 244   ## We have to encode the new line characters in order to preserve them, otherwise they are replace with a
... ... @@ -263,9 +263,7 @@
263 263   {{translation key="platform.xclass.defaultClassSheet.sheets.notBound"/}} ##
264 264   #if ($hasEdit)
265 265   {{html}}
266 - <a href="$escapetool.xml($bindURL)">##
267 - $escapetool.xml($services.localization.render('platform.xclass.defaultClassSheet.sheets.bind')) »##
268 - </a>.
243 + <a href="$bindURL">$services.localization.render('platform.xclass.defaultClassSheet.sheets.bind') »</a>.
269 269   {{/html}}
270 270   #end
271 271   {{/warning}}
... ... @@ -277,12 +277,7 @@
277 277   #set($classSheetDoc = $xwiki.getDocument($classSheetReferences.get(0)))
278 278   #end
279 279   #set ($sheetPath = "#hierarchy($classSheetDoc.documentReference, {'plain': true, 'local': true, 'limit': 4})")
280 - #set ($classSheetLink = "$services.localization.render('platform.xclass.defaultClassSheet.sheets.view', [$sheetPath.trim()]) »")
281 - #set ($classSheetLink = $services.rendering.escape($classSheetLink, 'xwiki/2.1'))
282 - #set ($classSheetLink = $services.rendering.escape($classSheetLink, 'xwiki/2.1'))
283 - #set ($classSheetText = ${classSheetDoc.fullName})
284 - #set ($classSheetText = $services.rendering.escape($classSheetText, 'xwiki/2.1'))
285 - [[$classSheetLink>>$classSheetText]]
255 + [[$services.localization.render('platform.xclass.defaultClassSheet.sheets.view', [$sheetPath.trim()]) »>>${classSheetDoc.fullName}]]
286 286   #else
287 287   {{translation key="platform.xclass.defaultClassSheet.sheets.list"/}}
288 288  
... ... @@ -295,22 +295,17 @@
295 295   (% id="HClassTemplate" %)
296 296   = {{translation key="platform.xclass.defaultClassSheet.template.heading"/}} =
297 297  
298 - {{info}}
299 - #set ($message = $services.localization.render('platform.xclass.defaultClassSheet.template.description', ['__START_EM__', '__END_EM__']))
300 - #set ($message = $escapetool.xml($message))
301 - ## First escape the content of the translation, then replace the placeholders with content that would
302 - ## otherwise be escaped during the first escaping.
303 - {{html}}$message.replace('__START_EM__', '<em>').replace('__END_EM__', '</em>'){{/html}}
304 - {{/info}}
268 + {{info}}$services.localization.render('platform.xclass.defaultClassSheet.template.description',
269 + ['//', '//']){{/info}}
305 305  
306 306   #if (!$hasClassTemplate)
307 307   {{html}}
308 - <form action="$escapetool.xml($classTemplateDoc.getURL('save', 'editor=wiki'))" method="post">
273 + <form action="$classTemplateDoc.getURL('save', 'editor=wiki')" method="post">
309 309   <div>
310 310   <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
311 - <input type="hidden" name="parent" value="$escapetool.xml(${doc.fullName})"/>
312 - <input type="hidden" name="xredirect" value="$escapetool.xml(${doc.URL})"/>
313 - <input type="hidden" name="title" value="$escapetool.xml($className) Template"/>
276 + <input type="hidden" name="parent" value="${doc.fullName}"/>
277 + <input type="hidden" name="xredirect" value="${doc.URL}"/>
278 + <input type="hidden" name="title" value="$className Template"/>
314 314   <span class="buttonwrapper"><input type="submit" class="button" value="$escapetool.xml(
315 315   $services.localization.render('platform.xclass.defaultClassSheet.template.create'))"/></span>
316 316   </div>
... ... @@ -319,30 +319,17 @@
319 319   #else
320 320   #if(!$classTemplateDoc.getObject(${doc.fullName}))
321 321   #set($xredirect = $xwiki.relativeRequestURL)
322 - #set($createUrl = $classTemplateDoc.getURL('objectadd', "classname=${escapetool.url($doc.fullName)}&xredirect=${escapetool.url($xredirect)}&form_token=$!{services.csrf.getToken()}"))
287 + #set($createUrl = $classTemplateDoc.getURL('objectadd', "classname=${escapetool.url($doc.fullName)}&amp;xredirect=${escapetool.url($xredirect)}&amp;form_token=$!{services.csrf.getToken()}"))
323 323   {{warning}}
324 - #set ($message = $services.localization.render('platform.xclass.defaultClassSheet.template.missingObject', ['__CLASS_NAME__']))
325 - #set ($message = $escapetool.xml($message))
326 - {{html}}
327 - ## First escape the content of the translation, then replace the placeholders with content that would
328 - ## otherwise be escaped during the first escaping.
329 - $message.replace('__CLASS_NAME__', "<em>$escapetool.xml($className)</em>")
330 - <a href="$escapetool.xml($createUrl)">##
331 - $escapetool.xml($services.localization.render('platform.xclass.defaultClassSheet.template.addObject', [$className])) »##
332 - </a>.
333 - {{/html}}
289 + $services.localization.render('platform.xclass.defaultClassSheet.template.missingObject', ["//$className//"]) ##
290 + {{html}}<a href="$createUrl">$escapetool.xml($services.localization.render(
291 + 'platform.xclass.defaultClassSheet.template.addObject', [$className])) »</a>.{{/html}}
334 334   {{/warning}}
335 335  
336 336   #end
337 337   #set ($templatePath = "#hierarchy($classTemplateDoc.documentReference, {'plain': true, 'local': true, 'limit': 4})")
338 - #set ($templateDocLink = "$services.localization.render('platform.xclass.defaultClassSheet.template.view', [$templatePath.trim()]) »")
339 - #set ($templateDocLink = $services.rendering.escape($templateDocLink, 'xwiki/2.1'))
340 - #set ($templateDocLink = $services.rendering.escape($templateDocLink, 'xwiki/2.1'))
341 - #set ($templateDocText = "${classTemplateDoc.fullName}")
342 - ## First escape the xwiki/2.1 syntax of the translation, then replace the placeholders with content that would
343 - ## otherwise be escaped during the first escaping.
344 - #set ($templateDocText = $services.rendering.escape($templateDocText, 'xwiki/2.1'))
345 - [[$templateDocLink>>$templateDocText]]
296 + [[$services.localization.render('platform.xclass.defaultClassSheet.template.view',
297 + [$templatePath.trim()]) »>>${classTemplateDoc.fullName}]]
346 346   #end
347 347   ## Create a template provider only if a template for the current class exists.
348 348   #if ($classTemplateDoc.getObject(${doc.fullName}))
... ... @@ -349,14 +349,8 @@
349 349   (% id="HClassTemplateProvider" %)
350 350   = {{translation key="platform.xclass.defaultClassSheet.templateProvider.heading"/}} =
351 351  
352 - {{info}}
353 - #set ($message = $services.localization.render('platform.xclass.defaultClassSheet.templateProvider.description', ['__EM__']))
354 - #set ($message = $services.rendering.escape($message, 'xwiki/2.1'))
355 - ## First escape the xwiki/2.1 syntax of the translation, then replace the placeholders with content that would
356 - ## otherwise be escaped during the first escaping.
357 - ## The replacement key is itself escaped, and it's escaped form needs to be used for the replacement.
358 - $message.replace('~_~_~E~M~_~_', '//')
359 - {{/info}}
304 + {{info}}$services.localization.render('platform.xclass.defaultClassSheet.templateProvider.description',
305 + ['//']){{/info}}
360 360  
361 361   #if (!$hasClassTemplateProvider)
362 362   #set ($templateProviderClassName = 'XWiki.TemplateProviderClass')
... ... @@ -376,12 +376,12 @@
376 376   "${templateProviderClassName}_visibilityRestrictions": $restrictionSpace}))
377 377   #set ($createUrl = $classTemplateProviderDoc.getURL('objectadd', $createUrlQueryString))
378 378   {{html}}
379 - <form action="$escapetool.xml($classTemplateProviderDoc.getURL('save', 'editor=wiki'))" method="post">
325 + <form action="$classTemplateProviderDoc.getURL('save', 'editor=wiki')" method="post">
380 380   <div>
381 381   <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" />
382 - <input type="hidden" name="parent" value="$escapetool.xml(${doc.fullName})"/>
383 - <input type="hidden" name="xredirect" value="$escapetool.xml($createUrl)"/>
384 - <input type="hidden" name="title" value="$escapetool.xml($className) Template Provider"/>
328 + <input type="hidden" name="parent" value="${doc.fullName}"/>
329 + <input type="hidden" name="xredirect" value="$createUrl"/>
330 + <input type="hidden" name="title" value="$className Template Provider"/>
385 385   <span class="buttonwrapper"><input type="submit" class="button" value="$escapetool.xml(
386 386   $services.localization.render('platform.xclass.defaultClassSheet.templateProvider.create'))"/></span>
387 387   </div>
... ... @@ -389,11 +389,8 @@
389 389   {{/html}}
390 390   #else
391 391   #set ($templateProviderPath = "#hierarchy($classTemplateProviderDoc.documentReference, {'plain': true, 'local': true, 'limit': 4})")
392 - #set ($linkTarget = "$services.localization.render('platform.xclass.defaultClassSheet.templateProvider.view', [$templateProviderPath.trim()]) »")
393 - #set ($linkTarget = $services.rendering.escape($linkTarget, 'xwiki/2.1'))
394 - #set ($linkTarget = $services.rendering.escape($linkTarget, 'xwiki/2.1'))
395 - #set ($linkLabel = $services.rendering.escape(${classTemplateProviderDoc.fullName}, 'xwiki/2.1'))
396 - [[$linkTarget>>$linkLabel]]
338 + [[$services.localization.render('platform.xclass.defaultClassSheet.templateProvider.view',
339 + [$templateProviderPath.trim()]) »>>${classTemplateProviderDoc.fullName}]]
397 397   #end
398 398   #end
399 399