Changes for page Attachments
Last modified by Ricardo Julio Rodríguez Fernández on 2026/09/01 20:31
From version 4.1
edited by Ricardo Julio Rodríguez Fernández
on 2026/05/24 12:46
on 2026/05/24 12:46
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-attachment-ui/18.3.0]
To version 6.1
edited by Ricardo Julio Rodríguez Fernández
on 2026/09/01 20:31
on 2026/09/01 20:31
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-attachment-ui/18.7.0]
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -34,7 +34,7 @@ 34 34 #** 35 35 * Displays the attachment gallery as a list of attachment boxes, starting with special boxes for uploading a new attachment and for setting a default value. 36 36 * 37 - * @param $targetDocument the document to rec ieve the field value being modified37 + * @param $targetDocument the document to receive the field value being modified 38 38 * @param $targetAttachDocument the document to list/save attachments to 39 39 * @param $options generic picker options 40 40 *#
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -2,6 +2,7 @@ 2 2 function uploadTemporaryAttachment() { 3 3 // Require jquery locally until we are able to fully migrate this code away from prototype. 4 4 const form = this.property.up('form'); 5 + const propertyReferenceInput = this.property.querySelector('input[type="hidden"].property-reference'); 5 5 require(['jquery'], function ($) { 6 6 const data = new FormData(); 7 7 const uploadedFile = $('#attachfile')[0].files[0]; ... ... @@ -13,7 +13,7 @@ 13 13 "$services.localization.render('xe.attachmentSelector.upload.inProgress')", 'inprogress'); 14 14 const params = { 15 15 'form_token': $(form).find('[name="form_token"]').val(), 16 - 'sheet': ' CKEditor.FileUploader',17 + 'sheet': 'XWiki.WYSIWYG.FileUploader', 17 17 'outputSyntax': 'plain' 18 18 }; 19 19 ... ... @@ -40,7 +40,7 @@ 40 40 .prop('type', 'hidden') 41 41 .prop('name', 'uploadedFiles') 42 42 .prop('value', response.fileName)) 43 - $(form).find('input[type="hidden"].property-reference').prop('value',response.fileName);44 + propertyReferenceInput.value = response.fileName; 44 44 this.updateAttachment(response.fileName, response.url); 45 45 this.dialog.closeDialog(); 46 46 }.bind(this)).fail(function () { ... ... @@ -318,8 +318,8 @@ 318 318 document.observe('xwiki:dom:loaded', function() { 319 319 $$('.attachment-picker-start').invoke('observe', 'click', function(event) { 320 320 event.stop(); 321 - vartargetElement = event.element();322 - varurl = targetElement.href;322 + const targetElement = event.target.closest('.attachment-picker-start'); 323 + let url = targetElement.dataset.modalUrl; 323 323 if (url.indexOf('?') < 0) { 324 324 url += '?'; 325 325 }
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -121,9 +121,9 @@ 121 121 #set ($attachmentResource = '') 122 122 #end 123 123 #if ($displayImage) 124 - (% class="$ !{cssClass}#if (!$attachment) hidden#end" %)(((#if ("$!{attachmentResource}" != '' || $forceElement)#if($withLink)[[#end[[image:$services.rendering.escape(${attachmentResource}, 'xwiki/2.1')$!{imageParams}]]#if($withLink)>>attach:$services.rendering.escape(${attachmentResource},'xwiki/2.1')||rel=lightbox]]#{end}#end)))##124 + (% class="${services.rendering.escape($!cssClass, 'xwiki/2.1')}#if (!$attachment) hidden#end" %)(((#if ("$!{attachmentResource}" != '' || $forceElement)#if($withLink)[[#end[[image:$services.rendering.escape(${attachmentResource}, 'xwiki/2.1')$!{imageParams}]]#if($withLink)>>attach:$services.rendering.escape(${attachmentResource},'xwiki/2.1')||rel=lightbox]]#{end}#end)))## 125 125 #else 126 - (% class="$!{cssClass}" %)#if ("$!{attachmentResource}" != '' || $forceElement)#if ($withLink)[[attach:${attachmentResource}||rel=__blank]]#{else}(% class="displayed" %)#if($targetPermView)$!{services.rendering.escape($!{attachmentName}, 'xwiki/2.1')}#{else}Access Denied#{end}(% %)#{end}#end(%%)##126 + (% class="${services.rendering.escape($!cssClass, 'xwiki/2.1')}" %)#if ("$!{attachmentResource}" != '' || $forceElement)#if ($withLink)[[attach:${attachmentResource}||rel=__blank]]#{else}(% class="displayed" %)#if($targetPermView)$!{services.rendering.escape($!{attachmentName}, 'xwiki/2.1')}#{else}Access Denied#{end}(% %)#{end}#end(%%)## 127 127 #end 128 128 #end 129 129 ... ... @@ -146,9 +146,17 @@ 146 146 #if ($hasTargetDoc) 147 147 #set ($queryString.targetdocname = $targetdoc.fullName) 148 148 #end 149 - #set ($linkLabel = $services.rendering.escape($services.rendering.escape($buttontext, 'xwiki/2.1'), 'xwiki/2.1')) 150 - (% class="buttonwrapper" %)[[$linkLabel>>${xcontext.macro.doc.fullName}||queryString="$escapetool.url($queryString)" 151 - class="attachment-picker-start button" title="$services.rendering.escape($buttontext, 'xwiki/2.1')"]](%%)## 149 + #set ($linkLabel = $escapetool.xml($buttontext)) 150 + #set ($modalUrl = $escapetool.xml("$xcontext.macro.doc.URL?$escapetool.url($queryString)")) 151 + {{html clean="false"}} 152 + <p> 153 + <span class="buttonwrapper"> 154 + <button type="button" class="attachment-picker-start button" 155 + title="$!{linkLabel}" 156 + data-modal-url="${modalUrl}">$!linkLabel</button> 157 + </span> 158 + </p> 159 + {{/html}}## 152 152 #end 153 153 #end 154 154 {{/velocity}}