Changes for page Default Class Sheet

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

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