Changes for page Attachments
Last modified by Ludovic Dubost on 2024/07/22 15:50
From version 10.1
edited by Ludovic Dubost
on 2019/11/21 10:03
on 2019/11/21 10:03
Change comment:
Install extension [org.xwiki.platform:xwiki-platform-attachment-ui/11.9]
To version 15.1
edited by Ludovic Dubost
on 2022/08/01 13:49
on 2022/08/01 13:49
Change comment:
Migrated property [defaultCategories] from class [XWiki.WikiMacroClass]
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -10,7 +10,7 @@ 10 10 #set ($docAction = $request.get('docAction')) 11 11 #set ($attachmentList = $targetAttachDocument.getAttachmentList()) 12 12 #if ($attachmentList && $attachmentList.size() > 0) 13 - #set ($sortedAttachments = $ sorttool.sort($attachmentList, 'date:desc'))13 + #set ($sortedAttachments = $collectiontool.sort($attachmentList, 'date:desc')) 14 14 #set ($lastAttachment = $sortedAttachments.get(0)) 15 15 #end 16 16 $response.sendRedirect($targetDocument.getURL($docAction, $escapetool.url({ ... ... @@ -49,7 +49,7 @@ 49 49 #attachmentPicker_displayUploadForm($targetDocument, $targetAttachDocument, $options) 50 50 #end 51 51 #attachmentPicker_displayAttachmentGalleryEmptyValue($targetDocument, $targetAttachDocument, $options, $currentValue) 52 - #set ($sortedAttachments = $ sorttool.sort($targetAttachDocument.getAttachmentList(), "${options.sortAttachmentsBy}") )52 + #set ($sortedAttachments = $collectiontool.sort($targetAttachDocument.getAttachmentList(), "${options.sortAttachmentsBy}") ) 53 53 #foreach ($attachment in $sortedAttachments) 54 54 #set ($extension = $attachment.getFilename()) 55 55 #set ($extension = $extension.substring($mathtool.add($extension.lastIndexOf('.'), 1)).toLowerCase()) ... ... @@ -112,12 +112,12 @@ 112 112 #if ($attachment.isImage() && $options.displayImage) 113 113 ## We add the version to the query string in order to invalidate the cache when an image attachment is replaced. 114 114 #set ($queryString = $escapetool.url({'version': $attachment.version})) 115 - [[[[image:$attachmentStringReference||width=180 queryString="$queryString"]]>>attach:$attachmentStringReference]] 115 + [[[[image:${attachmentStringReference}||width=180 queryString="$queryString"]]>>attach:$attachmentStringReference]] 116 116 #else 117 117 * (% class="mime" %){{html wiki=false clean=false}}#mimetypeimg($attachment.getMimeType().toLowerCase() $attachment.getFilename().toLowerCase()){{/html}}(%%) (% class="filename" %)$attachment.getFilename()(% %) 118 118 * v$attachment.getVersion() (#dynamicsize($attachment.longSize)) 119 119 * $services.localization.render('core.viewers.attachments.author', [$!{xwiki.getUserName($attachment.author, false)}]) $services.localization.render('core.viewers.attachments.date', [$!{xwiki.formatDate($attachment.date, 'dd/MM/yyyy hh:mm')}]) 120 - * (% class="buttonwrapper" %)[[${services.localization.render("${translationPrefix}.actions.download")}>>attach:$attachmentStringReference||title="$services.localization.render("${translationPrefix}.actions.download")" rel="__blank" class="button"]](%%) 120 + * (% class="buttonwrapper" %)[[${services.localization.render("${translationPrefix}.actions.download")}>>attach:${attachmentStringReference}||title="$services.localization.render("${translationPrefix}.actions.download")" rel="__blank" class="button"]](%%) 121 121 #end 122 122 #end 123 123 #end ... ... @@ -285,7 +285,7 @@ 285 285 #end 286 286 #set ($options = { 287 287 'classname' : ${request.get('classname')}, 288 - 'object' : $!{m athtool.toInteger($request.object)},288 + 'object' : $!{numbertool.toNumber($request.object).intValue()}, 289 289 'property' : ${request.property}, 290 290 'displayImage' : ${displayImage}, 291 291 'docAction' : ${docAction}, ... ... @@ -299,7 +299,7 @@ 299 299 #attachmentPicker_displayAttachmentGallery($targetDocument, $targetAttachDocument, $options) 300 300 301 301 (% class="gallery_buttons buttons" %)((( 302 - (% class="buttonwrapper secondary" %)[[$services.localization.render("${translationPrefix}.cancel")>>$targetDocument||class="button secondary" id="attachment-picker-close"]] 302 + (% class="buttonwrapper secondary" %)[[$services.localization.render("${translationPrefix}.cancel")>>${targetDocument}||class="button secondary" id="attachment-picker-close"]] 303 303 ))) 304 304 #end 305 305 {{/velocity}}
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -173,10 +173,7 @@ 173 173 this.dialog.closeDialog(); 174 174 }.bindAsEventListener(this), 175 175 onFailure : function(response) { 176 - var failureReason = response.statusText; 177 - if (response.statusText == '' /* No response */ || response.status == 12031 /* In IE */) { 178 - failureReason = 'Server not responding'; 179 - } 176 + var failureReason = response.statusText || 'Server not responding'; 180 180 if (targetElement._x_notif) { 181 181 targetElement._x_notif.replace(new XWiki.widgets.Notification("$services.localization.render('core.widgets.confirmationBox.notification.failed')" + failureReason, "error")); 182 182 } else { ... ... @@ -183,9 +183,6 @@ 183 183 new XWiki.widgets.Notification(this.interactionParameters.failureMessageText + failureReason, "error"); 184 184 } 185 185 }, 186 - on1223 : function(response) { 187 - response.request.options.onSuccess(response); 188 - }, 189 189 on0 : function(response) { 190 190 response.request.options.onFailure(response); 191 191 },
- XWiki.StyleSheetExtension[0]
-
- Code
-
... ... @@ -140,9 +140,6 @@ 140 140 ## Make this box twice as large as the others 141 141 width: ${uploadBoxSize}px; 142 142 } 143 -* html .gallery_upload { 144 - width: ${mathtool.add($uploadBoxSize, 2)}px; 145 -} 146 146 .gallery_upload, .gallery_upload:hover { 147 147 background-color: $theme.backgroundSecondaryColor; 148 148 }
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -3,7 +3,6 @@ 3 3 $xwiki.ssfx.use('js/xwiki/widgets/modalPopup.css', true)## 4 4 $xwiki.jsx.use($xcontext.macro.doc.fullName)## 5 5 $xwiki.ssx.use($xcontext.macro.doc.fullName)## 6 -$xwiki.jsfx.use('js/scriptaculous/builder.js')## 7 7 ## Integrates the optional Lightbox widget (from http://extensions.xwiki.org/xwiki/bin/view/Extension/Lightbox+Application ) 8 8 #if ($xwiki.exists('XWiki.Lightbox')) 9 9 $xwiki.jsx.use('XWiki.Lightbox') ... ... @@ -32,7 +32,7 @@ 32 32 #end 33 33 #set ($classname = "$!{xcontext.macro.params.classname}") 34 34 #set ($property = "$!{xcontext.macro.params.property}") 35 -#set ($object = $m athtool.toInteger("$!{xcontext.macro.params.object}"))34 +#set ($object = $numbertool.toNumber("$!{xcontext.macro.params.object}").intValue()) 36 36 #if ("$!{object}" != $!{xcontext.macro.params.object}) 37 37 #set ($object = ${doc.getObject($classname).number}) 38 38 #if ("$!{object}" == '') ... ... @@ -138,7 +138,7 @@ 138 138 #if ($hasTargetDoc) 139 139 #set ($queryString.targetdocname = $targetdoc.fullName) 140 140 #end 141 - (% class="buttonwrapper" %)[[$buttontext>>$xcontext.macro.doc.fullName||queryString="$escapetool.url($queryString)" 140 + (% class="buttonwrapper" %)[[$buttontext>>${xcontext.macro.doc.fullName}||queryString="$escapetool.url($queryString)" 142 142 class="attachment-picker-start button" title="$buttontext"]](%%)## 143 143 #end 144 144 #end