Changes for page Main
Last modified by Administrator on 2023/03/27 10:53
From version
2.1


edited by Administrator
on 2019/11/04 23:53
on 2019/11/04 23:53
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-appwithinminutes-ui/10.11.9]
To version 1.1

edited by Administrator
on 2018/07/24 00:25
on 2018/07/24 00:25
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-appwithinminutes-ui/9.11.7]
Summary
Details
- Page properties
-
- Content
-
... ... @@ -73,17 +73,13 @@ 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 - #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' />") 76 + #if($formFieldIcon.contains('/')) 77 + #set($formFieldIconURL = $xwiki.getSkinFile($formFieldIcon)) 78 + #else 79 + #set($formFieldIconURL = $formFieldDoc.getAttachmentURL($formFieldIcon)) 84 84 #end 85 85 ** (% class="field" %){{html}} 86 - $formFieldIconRe ndered82 + <img src="$formFieldIconURL" alt="$escapetool.xml($formFieldDoc.plainTitle)" class="icon" /> 87 87 $escapetool.xml($formFieldDoc.plainTitle) 88 88 ## FIXME: We should use the 'get' action instead to prevent the stats module from recording this AJAX request. 89 89 ## The 'edit' action is a temporary solution until the sheet module is modified to allow a sheet to be enforced through ... ... @@ -238,9 +238,7 @@ 238 238 #displayFieldMetaData($field) 239 239 ## We need this information to avoid querying and loading all FormField documents twice. 240 240 ## NOTE: We use a different ID format to avoid collisions with the field meta properties. 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])" /> 237 + <input type="hidden" id="template-$field.name" name="template-$field.name" value="$escapetool.xml($formFieldDoc.fullName)" /> 244 244 {{/html}} 245 245 246 246 #set($className = $stringtool.removeEnd($doc.fullName, 'Class')) ... ... @@ -305,10 +305,8 @@ 305 305 *# 306 306 #macro(displayNewField) 307 307 ## 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. 309 309 ## The class editor moves this resource includes in the HTML page head. 310 310 {{html}} 311 - <!-- com.xpn.xwiki.plugin.skinx.LinkExtensionPlugin --> 312 312 #skinExtensionHooks 313 313 {{/html}} 314 314 ... ... @@ -320,9 +320,7 @@ 320 320 #if("$!field.prettyName" == '') 321 321 #set($discard = $field.setPrettyName($formFieldDoc.title)) 322 322 #end 323 - #set($xclass = $doc.getxWikiClass().getXWikiClass()) 324 - #set($discard = $xclass.addField($field.name, $field)) 325 - #set($discard = $field.setObject($xclass)) 315 + #set($discard = $doc.getxWikiClass().getXWikiClass().addField($field.name, $field)) 326 326 #displayField($doc.getxWikiClass().get($field.name) $formFieldDoc) 327 327 #else 328 328 Unsupported form field. ... ... @@ -356,7 +356,6 @@ 356 356 ## (otherwise the field value from the request is ignored). 357 357 #set($xclass = $doc.getxWikiClass().getXWikiClass()) 358 358 #set($discard = $xclass.addField($fieldName, $field)) 359 - #set($discard = $field.setObject($xclass)) 360 360 ## 361 361 ## Create an object that has this field and set its value from request. 362 362 #set($object = $fieldTemplateDoc.getObject($doc.fullName, true)) ... ... @@ -373,8 +373,10 @@ 373 373 #set($discard = $xclass.fromMap({$fieldName: $values.toArray($stringArray)}, $object.getXWikiObject())) 374 374 #end 375 375 ## 376 - ## Display the field. 365 + ## Display the field (with the rights of the current user). 377 377 #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)) 378 378 {{html clean="false"}}#displayPropertyEditInput($field, "${doc.fullName}_0_", $object){{/html}} 379 379 #end 380 380
- XWiki.JavaScriptExtension[2]
-
- Code
-
... ... @@ -367,11 +367,7 @@ 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'); 372 372 field.getViewer().down('label').insert({after: hintInput}); 373 - dt.remove(); 374 - dd.remove(); 375 375 // Enhance the hint input. 376 376 new XWiki.InputWithTitle(hintInput); 377 377 new XWiki.AutoResizeInput(hintInput); ... ... @@ -430,7 +430,7 @@ 430 430 }); 431 431 }, 432 432 _onDrop : function(field) { 433 - var fieldContainer = new Element('li' , {'data-new': 'true'});429 + var fieldContainer = new Element('li'); 434 434 this.fields.insert(fieldContainer); 435 435 this.container.removeClassName('empty'); 436 436 new XWiki.FormField(fieldContainer).enhance(field.down('.data').value); ... ... @@ -562,44 +562,3 @@ 562 562 } 563 563 (XWiki.domIsLoaded && init()) || document.observe('xwiki:dom:loaded', init); 564 564 }).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,9 +38,7 @@ 38 38 } 39 39 40 40 #fields input.xHint { 41 - color: $theme.textSecondaryColor; 42 - font-size: smaller; 43 - font-weight: normal; 41 + border: 0 none; 44 44 } 45 45 46 46 #fields .labelLine label {