Changes for page Attachments
Last modified by Sebastian Marsching on 2024/01/08 23:13
From version 6.1
edited by Sebastian Marsching
on 2022/11/02 11:24
on 2022/11/02 11:24
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-attachment-ui/14.9]
To version 12.1
edited by Sebastian Marsching
on 2024/01/08 23:13
on 2024/01/08 23:13
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-attachment-ui/15.10.4]
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -333,8 +333,10 @@ 333 333 $!targetDocument.use($targetDocument.getObject($options.classname, $options.object))## 334 334 #attachmentPicker_displayAttachmentGallery($targetDocument, $targetAttachDocument, $options) 335 335 336 + #set ($cancelLinkName = $services.rendering.escape($services.rendering.escape($services.localization.render("${translationPrefix}.cancel"), 'xwiki/2.1'), 'xwiki/2.1')) 337 + #set ($cancelLinkTarget = $services.rendering.escape($services.model.serialize($targetDocument), 'xwiki/2.1')) 336 336 (% class="gallery_buttons buttons" %)((( 337 - (% class="buttonwrapper secondary" %)[[$ services.localization.render("${translationPrefix}.cancel")>>${targetDocument}||class="button secondary" id="attachment-picker-close"]]339 + (% class="buttonwrapper secondary" %)[[$cancelLinkName>>$cancelLinkTarget||class="button secondary" id="attachment-picker-close"]] 338 338 ))) 339 339 #end 340 340 {{/velocity}}
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -122,6 +122,13 @@ 122 122 new XWiki.widgets.Notification("$services.localization.render('xe.attachmentSelector.upload.error.badExtension')", 'error'); 123 123 hasErrors = true; 124 124 } 125 + const beforeUploadEvent = Event.fire(document, 'xwiki:actions:beforeUpload', { 126 + file: fileInput.files[0] 127 + }); 128 + 129 + if (beforeUploadEvent.defaultPrevented) { 130 + hasErrors = true; 131 + } 125 125 }.bind(this)); 126 126 if (!hasErrors) { 127 127 if (this.directSave) {
- XWiki.StyleSheetExtension[0]
-
- Code
-
... ... @@ -27,7 +27,7 @@ 27 27 .gallery_attachmentbox { 28 28 background: $theme.pageContentBackgroundColor; 29 29 border: 1px solid $theme.borderColor; 30 - border-radius: 5px;30 + border-radius: 8px; 31 31 float: left; 32 32 margin: ${boxMargin}px; 33 33 overflow: hidden; ... ... @@ -49,7 +49,7 @@ 49 49 .gallery_attachmenttitle { 50 50 background: $theme.backgroundSecondaryColor; 51 51 border-bottom: 1px dotted $theme.borderColor; 52 - border-radius: 5px5px 0px 0px;52 + border-radius: 8px 8px 0px 0px; 53 53 font-size: 85%; 54 54 padding: 3px ${boxPadding}px; 55 55 overflow: hidden;
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -33,7 +33,7 @@ 33 33 #set ($property = "$!{xcontext.macro.params.property}") 34 34 #set ($object = $numbertool.toNumber("$!{xcontext.macro.params.object}").intValue()) 35 35 #if ("$!{object}" != $!{xcontext.macro.params.object}) 36 - #set ($object = ${doc.getObject($classname).number}) 36 + #set ($object = ${targetdoc.getObject($classname).number}) 37 37 #if ("$!{object}" == '') 38 38 #set ($object = 0) 39 39 #end ... ... @@ -94,7 +94,7 @@ 94 94 #set ($savemode = 'form') 95 95 #end 96 96 97 -#set ($propValue = "$!{doc.getObject($classname, $object).getProperty($property).value}") 97 +#set ($propValue = "$!{targetdoc.getObject($classname, $object).getProperty($property).value}") 98 98 ## 99 99 100 100 #macro (attachmentPicker_displayAttachment $name $displayImage $withLink $forceElement) ... ... @@ -123,7 +123,7 @@ 123 123 #if ($displayImage) 124 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)))## 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="$!{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(%%)## 127 127 #end 128 128 #end 129 129 ... ... @@ -159,7 +159,7 @@ 159 159 #elseif ($xcontext.action == 'inline' || $xcontext.action == 'edit') 160 160 (% class="attachment-picker" %)(((## 161 161 #attachmentPicker_displayAttachment($propValue $displayImage false true) #attachmentPicker_displayButton()## 162 - {{html}}<input type="hidden" name="${classname}_${object}_${property}" value="${propValue}" class="property-reference"/>{{/html}}## 162 + {{html}}<input type="hidden" name="$escapetool.xml("${classname}_${object}_${property}")" value="$escapetool.xml("${propValue}")" class="property-reference"/>{{/html}}## 163 163 ))) 164 164 #else 165 165 #attachmentPicker_displayAttachment($propValue $displayImage $link false)