From version 1.1 >
edited by Xwiki Admin
on 2018/03/14 16:00
To version < 2.1 >
edited by Rahel Fainchtein
on 2018/07/25 18:00
>
Change comment: Install extension [org.xwiki.platform:xwiki-platform-appwithinminutes-ui/10.6]

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.XwikiAdmin
1 +XWiki.RahelFainchtein
Content
... ... @@ -73,13 +73,17 @@
73 73   #set($formFieldDoc = $xwiki.getDocument($formField))
74 74   #set($discard = $formFieldDocs.add($formFieldDoc))
75 75   #set($formFieldIcon = $formFieldDoc.getObject($formFieldClassName).getProperty('icon').value)
76 - #if($formFieldIcon.contains('/'))
77 - #set($formFieldIconURL = $xwiki.getSkinFile($formFieldIcon))
78 - #else
79 - #set($formFieldIconURL = $formFieldDoc.getAttachmentURL($formFieldIcon))
76 + #set($formFieldIconRendered = $services.icon.renderHTML($formFieldIcon))
77 + #if ("$!formFieldIconRendered" == "")
78 + #if($formFieldIcon.contains('/'))
79 + #set($formFieldIconURL = $xwiki.getSkinFile($formFieldIcon))
80 + #else
81 + #set($formFieldIconURL = $formFieldDoc.getAttachmentURL($formFieldIcon))
82 + #end
83 + #set($formFieldIconRendered = "<img src='$formFieldIconURL' alt='$escapetool.xml($formFieldDoc.plainTitle)' class='icon' />")
80 80   #end
81 81   ** (% class="field" %){{html}}
82 - <img src="$formFieldIconURL" alt="$escapetool.xml($formFieldDoc.plainTitle)" class="icon" />
86 + $formFieldIconRendered
83 83   $escapetool.xml($formFieldDoc.plainTitle)
84 84   ## FIXME: We should use the 'get' action instead to prevent the stats module from recording this AJAX request.
85 85   ## The 'edit' action is a temporary solution until the sheet module is modified to allow a sheet to be enforced through
... ... @@ -234,7 +234,9 @@
234 234   #displayFieldMetaData($field)
235 235   ## We need this information to avoid querying and loading all FormField documents twice.
236 236   ## NOTE: We use a different ID format to avoid collisions with the field meta properties.
237 - <input type="hidden" id="template-$field.name" name="template-$field.name" value="$escapetool.xml($formFieldDoc.fullName)" />
241 + <input type="hidden" id="template-$field.name" name="template-$field.name"
242 + value="$escapetool.xml($formFieldDoc.fullName)"
243 + data-propertyName="$escapetool.xml($formFieldDoc.getxWikiClass().propertyNames[0])" />
238 238   {{/html}}
239 239  
240 240   #set($className = $stringtool.removeEnd($doc.fullName, 'Class'))
... ... @@ -299,8 +299,10 @@
299 299   *#
300 300  #macro(displayNewField)
301 301   ## Output the SkinExtension hooks to allow field displayers to pull JavaScript/CSS resources.
308 + ## Output also the LinkExtension hook because $xwiki.linkx.use() is used to load CSS files from WebJars.
302 302   ## The class editor moves this resource includes in the HTML page head.
303 303   {{html}}
311 + <!-- com.xpn.xwiki.plugin.skinx.LinkExtensionPlugin -->
304 304   #skinExtensionHooks
305 305   {{/html}}
306 306  
... ... @@ -312,7 +312,9 @@
312 312   #if("$!field.prettyName" == '')
313 313   #set($discard = $field.setPrettyName($formFieldDoc.title))
314 314   #end
315 - #set($discard = $doc.getxWikiClass().getXWikiClass().addField($field.name, $field))
323 + #set($xclass = $doc.getxWikiClass().getXWikiClass())
324 + #set($discard = $xclass.addField($field.name, $field))
325 + #set($discard = $field.setObject($xclass))
316 316   #displayField($doc.getxWikiClass().get($field.name) $formFieldDoc)
317 317   #else
318 318   Unsupported form field.
... ... @@ -346,6 +346,7 @@
346 346   ## (otherwise the field value from the request is ignored).
347 347   #set($xclass = $doc.getxWikiClass().getXWikiClass())
348 348   #set($discard = $xclass.addField($fieldName, $field))
359 + #set($discard = $field.setObject($xclass))
349 349   ##
350 350   ## Create an object that has this field and set its value from request.
351 351   #set($object = $fieldTemplateDoc.getObject($doc.fullName, true))
... ... @@ -362,10 +362,8 @@
362 362   #set($discard = $xclass.fromMap({$fieldName: $values.toArray($stringArray)}, $object.getXWikiObject()))
363 363   #end
364 364   ##
365 - ## Display the field (with the rights of the current user).
376 + ## Display the field.
366 366   #set($field = $doc.getxWikiClass().get($fieldName))
367 - ## Note that we don't modify the cached document because the previous line has cloned it.
368 - #set ($discard = $doc.document.setAuthorReference($xcontext.userReference))
369 369   {{html clean="false"}}#displayPropertyEditInput($field, "${doc.fullName}_0_", $object){{/html}}
370 370  #end
371 371  
XWiki.JavaScriptExtension[2]
code
... ... @@ -367,7 +367,11 @@
367 367   hintInput.title = 'Hint';
368 368   }
369 369   // Move the hint input below the pretty name input, in the field viewer.
370 + var dd = hintInput.up('dd');
371 + var dt = dd.previous('dt');
370 370   field.getViewer().down('label').insert({after: hintInput});
373 + dt.remove();
374 + dd.remove();
371 371   // Enhance the hint input.
372 372   new XWiki.InputWithTitle(hintInput);
373 373   new XWiki.AutoResizeInput(hintInput);
... ... @@ -426,7 +426,7 @@
426 426   });
427 427   },
428 428   _onDrop : function(field) {
429 - var fieldContainer = new Element('li');
433 + var fieldContainer = new Element('li', {'data-new': 'true'});
430 430   this.fields.insert(fieldContainer);
431 431   this.container.removeClassName('empty');
432 432   new XWiki.FormField(fieldContainer).enhance(field.down('.data').value);
... ... @@ -558,3 +558,44 @@
558 558   }
559 559   (XWiki.domIsLoaded && init()) || document.observe('xwiki:dom:loaded', init);
560 560  }).call();
565 +
566 +require(['jquery', 'xwiki-events-bridge'], function($) {
567 + $(document).on('xwiki:class:displayField xwiki:class:previewField', function(event, data) {
568 + var container = $(data.field.getContainer());
569 + if (container.attr('data-new') === 'true') {
570 + // We can't suggest property values for properties that don't exist yet (have not been saved) so we provide
571 + // suggestions for the template property that was used to create them. Note that the suggested values depend on
572 + // the saved property meta data so changing the property (field) meta data may not affect the suggestions until
573 + // those changes are saved.
574 + var templateHiddenInput = container.find('#' + 'template-' + data.field.getName());
575 + var propertyValueSuggester = container.find('.field-viewer .suggest-propertyValues').first();
576 + propertyValueSuggester.attr({
577 + 'data-className': templateHiddenInput.val(),
578 + 'data-propertyName': templateHiddenInput.attr('data-propertyName')
579 + });
580 + }
581 + }).on('xwiki:document:saved', function(event) {
582 + // We need to update the property value suggesters because:
583 + // * newly saved properties should have their own suggestions instead of relying on the template property
584 + // * for renamed properties we need to fetch the suggestions from a different location
585 + $('ul#fields > li').each(function() {
586 + var container = $(this);
587 + container.removeAttr('data-new');
588 + var propertyValueSuggester = container.find('.field-viewer .suggest-propertyValues').first();
589 + if (propertyValueSuggester.length > 0) {
590 + // We need to preserve the selected values because they are lost when the suggester is destroyed.
591 + var selectedValues = propertyValueSuggester.children();
592 + propertyValueSuggester[0].selectize.destroy();
593 + // Restore the selected values.
594 + propertyValueSuggester.empty().append(selectedValues);
595 + var className = XWiki.Model.serialize(XWiki.currentDocument.documentReference.relativeTo(
596 + new XWiki.WikiReference(XWiki.currentWiki)));
597 + propertyValueSuggester.attr({
598 + 'data-className': className,
599 + 'data-propertyName': propertyValueSuggester.attr('name').substr((className + '_0_').length)
600 + });
601 + propertyValueSuggester.suggestPropertyValues();
602 + }
603 + });
604 + });
605 +});
XWiki.StyleSheetExtension[1]
code
... ... @@ -38,7 +38,9 @@
38 38  }
39 39  
40 40  #fields input.xHint {
41 - border: 0 none;
41 + color: $theme.textSecondaryColor;
42 + font-size: smaller;
43 + font-weight: normal;
42 42  }
43 43  
44 44  #fields .labelLine label {
Failed to execute the [groovy] macro. Cause: [The execution of the [groovy] script macro is not allowed in [xwiki:AppWithinMinutes.ClassEditSheet]. Check the rights of its last author or the parameters if it's rendered from another script.]. Click on this message for details.

Field Palette

Drag & drop fields from the palette to create the form that will be used to input your data.

  • Standard
    • Short Text Short Text
    • Long Text Long Text
    • Number Number
    • Boolean Boolean
    • Static List Static List
  • Pickers
    • Page Page
    • Page
    • Date Date
    • Date
    • User User
    • User
    • Group Group
    • Group
  • Page
    • Content Content
    • Content
    • Title Title
    • Title
  • Advanced
    • Database List Database List

Drag fields from the palette and drop them in this area.

My Recent Modifications

Need help?

If you need help with XWiki you can contact:

----------------------------