Changes for page Main

Last modified by Administrator on 2026/02/17 22:15

From version 5.1
edited by Administrator
on 2020/12/29 00:17
Change comment: Install extension [org.xwiki.platform:xwiki-platform-appwithinminutes-ui/12.10.2]
To version 9.1
edited by Administrator
on 2026/02/17 22:15
Change comment: Install extension [org.xwiki.platform:xwiki-platform-appwithinminutes-ui/17.10.3]

Summary

Details

Page properties
Content
... ... @@ -66,7 +66,7 @@
66 66   #foreach ($category in $services.query.xwql($categoryListStatement).execute())
67 67   #set ($categoryDoc = $xwiki.getDocument($category))
68 68   <li>
69 - <div class="category">$categoryDoc.plainTitle</div>
69 + <div class="category">$escapetool.xml($categoryDoc.plainTitle)</div>
70 70   #set ($formFieldsForCategoryStatement = "from doc.object($formFieldClassName) as field where field.category = :category order by field.priority")
71 71   #set ($formFieldsForCategoryQuery = $services.query.xwql($formFieldsForCategoryStatement).bindValue('category', $category))
72 72   <ul>
... ... @@ -81,7 +81,7 @@
81 81   #else
82 82   #set ($formFieldIconURL = $formFieldDoc.getAttachmentURL($formFieldIcon))
83 83   #end
84 - #set ($formFieldIconRendered = "<img src='$formFieldIconURL' alt='$escapetool.xml($formFieldDoc.plainTitle)' class='icon' />")
84 + #set ($formFieldIconRendered = "<img src='$escapetool.xml($formFieldIconURL)' alt='$escapetool.xml($formFieldDoc.plainTitle)' class='icon' />")
85 85   #end
86 86   <li class="field">
87 87   $formFieldIconRendered
... ... @@ -97,11 +97,12 @@
97 97   #set ($fieldURL = $doc.getURL('edit', $escapetool.url({
98 98   'xpage': 'plain',
99 99   'sheet': 'AppWithinMinutes.ClassEditSheet',
100 + 'form_token': $services.csrf.getToken(),
100 100   'template': 'AppWithinMinutes.ClassTemplate',
101 101   'field': $formFieldDoc.fullName,
102 102   'xeditmode': 'text'
103 103   })))
104 - <input type="hidden" value="$fieldURL" class="data"/>
105 + <input type="hidden" value="$escapetool.xml($fieldURL)" class="data"/>
105 105   </li>
106 106   #end
107 107   </ul>
... ... @@ -189,9 +189,7 @@
189 189   ["#pageLink($sheetReference)"])
190 190   </span>
191 191   #else
192 - <span class="warningmessage">
193 - $services.localization.render('platform.appwithinminutes.classEditorMultipleSheetsWarning')
194 - </span>
193 + #inlineWarning($services.localization.render('platform.appwithinminutes.classEditorMultipleSheetsWarning'))
195 195   #end
196 196   </dd>
197 197   <dt>
... ... @@ -275,6 +275,7 @@
275 275   * Displays a configuration property of a class field. This macro can also be used to display a property of an object.
276 276   *#
277 277  #macro (displayFieldProperty $property $prefix $field)
277 + ## This 'displayFormType' property only exists for boolean fields.
278 278   #set ($displayFormType = $property.getProperty('displayFormType'))
279 279   #if ($property.classType == 'Boolean' && (!$displayFormType || $displayFormType.value == 'checkbox'))
280 280   <dt>
... ... @@ -388,8 +388,6 @@
388 388   * Display the edit class form.
389 389   *#
390 390  #macro (displayEditForm)
391 - #set ($discard = $xwiki.jsfx.use('js/scriptaculous/effects.js'))
392 - #set ($discard = $xwiki.jsfx.use('js/scriptaculous/dragdrop.js'))
393 393   #set ($discard = $xwiki.jsx.use('AppWithinMinutes.ClassEditSheet'))
394 394   #set ($discard = $xwiki.ssx.use('AppWithinMinutes.ClassEditSheet'))
395 395   #set ($discard = $xwiki.ssx.use('AppWithinMinutes.ClassSheetGenerator'))
... ... @@ -668,7 +668,7 @@
668 668   #updateAndSaveTranslations
669 669   #if ($action == 'save')
670 670   #if ($errorMessage)
671 - <div class="box errormessage">$errorMessage</div>
669 + #error($errorMessage)
672 672   #elseif ("$!request.wizard" == 'true')
673 673   ## Redirect to next wizard step.
674 674   #set ($className = $stringtool.removeEnd($doc.fullName, 'Class'))
... ... @@ -679,6 +679,7 @@
679 679   })
680 680   #if (!$xwiki.exists($templateProviderReference))
681 681   #set ($discard = $queryString.putAll({
680 + 'form_token': $services.csrf.getToken(),
682 682   'template': 'XWiki.TemplateProviderTemplate',
683 683   'parent': $doc.fullName
684 684   }))
XWiki.JavaScriptExtension[2]
Code
... ... @@ -300,8 +300,10 @@
300 300   var label = previousDT.down('label');
301 301   prettyNameInput.title = label.textContent || label.innerText;
302 302   }
303 + prettyNameInput.ariaLabel = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldPrettyNameToolTip'))';
303 303   // Replace the preview label with the pretty name input.
304 304   var previewLabel = field.getViewer().down('label');
306 + // We unset the for attribute, so that this label will not be set implicitely OR explicitely anymore.
305 305   previewLabel.writeAttribute('for', '');
306 306   previewLabel.removeChild(previewLabel.lastChild);
307 307   previewLabel.insert(prettyNameInput);
... ... @@ -326,10 +326,12 @@
326 326   _enhanceFieldDefaultValue : function(event) {
327 327   var field = event.memo.field;
328 328   var fieldName = field.getName();
329 - field.getViewer().select('input[type=text]', 'textarea').each(function(input) {
331 + // We select the default field input and update it.
332 + field.getViewer().select('dd :input').each(function(input) {
330 330   if (!input.title && input.name.endsWith('_0_' + fieldName)) {
331 331   input.title = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldDefaultValueToolTip'))';
332 332   }
336 + input.ariaLabel = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldDefaultValueToolTip'))';
333 333   });
334 334   },
335 335   _onSave : function() {
... ... @@ -364,7 +364,8 @@
364 364   if (hintInput) {
365 365   hintInput.addClassName('xHint');
366 366   if (!hintInput.title) {
367 - hintInput.title = 'Hint';
371 + hintInput.title = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldHintToolTip'))';
372 + hintInput.ariaLabel = '$escapetool.javascript($services.localization.render('platform.appwithinminutes.classEditorFieldHintToolTip'))';
368 368   }
369 369   // Move the hint input below the pretty name input, in the field viewer.
370 370   var dd = hintInput.up('dd');
... ... @@ -515,11 +515,7 @@
515 515  }(XWiki || {}));
516 516  
517 517  (function() {
518 - function init() {
519 - var form = $('inline');
520 - if (!form) {
521 - return false;
522 - }
523 + function initForm(form) {
523 523   // Let the sheet handle the form submit. The form is submitted by default to the preview action which dispatches the
524 524   // request to the save action if the save button is detected on the request parameters. By submitting to the edit
525 525   // action the edit sheet is evaluated and thus it can handle the save by itself.
... ... @@ -557,9 +557,18 @@
557 557   // Make the palette and the canvas live.
558 558   new XWiki.FormFieldPalette('palette');
559 559   new XWiki.FormCanvas('canvas');
561 + }
560 560  
561 - return true;
563 + function init() {
564 + var form = $('inline');
565 + if (form) {
566 + require(['scriptaculous/dragdrop'], function() {
567 + initForm(form);
568 + });
569 + }
570 + return form;
562 562   }
572 +
563 563   (XWiki.domIsLoaded && init()) || document.observe('xwiki:dom:loaded', init);
564 564  }).call();
565 565