... |
... |
@@ -1,21 +1,17 @@ |
1 |
1 |
{{velocity output="false"}} |
2 |
|
-#set ($translationPrefix = 'xe.attachmentSelector') |
3 |
|
- |
4 |
4 |
#if ($request.xaction == 'postUpload') |
5 |
5 |
#set ($targetDocument = $xwiki.getDocument($request.get('docname'))) |
6 |
6 |
#set ($targetAttachDocument = $xwiki.getDocument($request.get('targetdocname'))) |
7 |
7 |
|
8 |
8 |
#set ($fieldname = $request.get('fieldname')) |
9 |
|
- #set ($comment = $services.localization.render("${translationPrefix}.postUpload.comment", [$fieldname])) |
10 |
10 |
#set ($docAction = $request.get('docAction')) |
11 |
11 |
#set ($attachmentList = $targetAttachDocument.getAttachmentList()) |
12 |
12 |
#if ($attachmentList && $attachmentList.size() > 0) |
13 |
|
- #set ($sortedAttachments = $collectiontool.sort($attachmentList, 'date:desc')) |
|
10 |
+ #set ($sortedAttachments = $sorttool.sort($attachmentList, 'date:desc')) |
14 |
14 |
#set ($lastAttachment = $sortedAttachments.get(0)) |
15 |
15 |
#end |
16 |
16 |
$response.sendRedirect($targetDocument.getURL($docAction, $escapetool.url({ |
17 |
17 |
$fieldname: $lastAttachment.filename, |
18 |
|
- 'comment': $comment, |
19 |
19 |
'form_token': $request.form_token |
20 |
20 |
}))) |
21 |
21 |
#stop |
... |
... |
@@ -26,6 +26,7 @@ |
26 |
26 |
## |
27 |
27 |
## Macros |
28 |
28 |
## |
|
25 |
+#set ($translationPrefix = 'xe.attachmentSelector') |
29 |
29 |
#set ($attachmentPickerDocName = 'XWiki.AttachmentSelector') |
30 |
30 |
|
31 |
31 |
$xwiki.ssx.use($attachmentPickerDocName) |
... |
... |
@@ -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 = $collectiontool.sort($targetAttachDocument.getAttachmentList(), "${options.sortAttachmentsBy}") ) |
|
49 |
+ #set ($sortedAttachments = $sorttool.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()) |
... |
... |
@@ -79,10 +79,7 @@ |
79 |
79 |
#set ($returnURL = $escapetool.url($doc.getURL('view', $request.queryString))) |
80 |
80 |
#set ($deleteURL = $targetAttachDocument.getAttachmentURL($attachment.filename, 'delattachment', "xredirect=${returnURL}&form_token=$!{services.csrf.getToken()}") ) |
81 |
81 |
#set ($viewURL = $targetAttachDocument.getAttachmentURL($attachment.filename) )##{'name' : 'download', 'url' : $viewURL, 'rel' : '__blank'} |
82 |
|
- #set ($selectURL = $targetDocument.getURL(${options.get('docAction')}, $escapetool.url({ |
83 |
|
- "${options.get('classname')}_${options.get('object')}_${options.get('property')}": ${attachment.filename}, |
84 |
|
- 'form_token': $!{services.csrf.getToken()} |
85 |
|
- }))) |
|
79 |
+ #set ($selectURL = $targetDocument.getURL(${options.get('docAction')}, "${options.get('classname')}_${options.get('object')}_${options.get('property')}=${attachment.filename}&form_token=$!{services.csrf.getToken()}")) |
86 |
86 |
#attachmentPicker_displayEndFrame ([{'name' : 'select', 'url' : $selectURL}, {'name' : 'delete', 'url' : $deleteURL}]) |
87 |
87 |
#end |
88 |
88 |
|
... |
... |
@@ -95,9 +95,7 @@ |
95 |
95 |
*# |
96 |
96 |
#macro (attachmentPicker_displayStartFrame $boxOptions $currentValue) |
97 |
97 |
(% class="gallery_attachmentbox $!{boxOptions.cssClass} #if ("$!{boxOptions.value}" == $currentValue) current#{end}" %)((( |
98 |
|
- (% class="gallery_attachmenttitle" title="$services.rendering.escape($!{boxOptions.value}, 'xwiki/2.1')" %)((( |
99 |
|
- $services.rendering.escape($boxOptions.text, 'xwiki/2.1') |
100 |
|
- ))) |
|
92 |
+ (% class="gallery_attachmenttitle" title="$!{boxOptions.value}" %)((($boxOptions.text))) |
101 |
101 |
(% class="gallery_attachmentframe" %)((( |
102 |
102 |
#end |
103 |
103 |
|
... |
... |
@@ -113,16 +113,16 @@ |
113 |
113 |
## Compute the attachment reference because there's no getter. |
114 |
114 |
#set ($attachmentReference = $services.model.createAttachmentReference($attachment.document.documentReference, |
115 |
115 |
$attachment.filename)) |
116 |
|
- #set ($attachmentStringReference = $services.rendering.escape($services.model.serialize($attachmentReference, 'default'), 'xwiki/2.1')) |
|
108 |
+ #set ($attachmentStringReference = $services.model.serialize($attachmentReference, 'default')) |
117 |
117 |
#if ($attachment.isImage() && $options.displayImage) |
118 |
118 |
## We add the version to the query string in order to invalidate the cache when an image attachment is replaced. |
119 |
119 |
#set ($queryString = $escapetool.url({'version': $attachment.version})) |
120 |
|
- [[[[image:${attachmentStringReference}||width=180 queryString="$queryString"]]>>attach:$attachmentStringReference]] |
|
112 |
+ [[[[image:$attachmentStringReference||width=180 queryString="$queryString"]]>>attach:$attachmentStringReference]] |
121 |
121 |
#else |
122 |
|
- * (% class="mime" %){{html wiki=false clean=false}}#mimetypeimg($attachment.getMimeType().toLowerCase() $attachment.getFilename().toLowerCase()){{/html}}(%%) (% class="filename" %)$services.rendering.escape($attachment.getFilename(), 'xwiki/2.1')(% %) |
|
114 |
+ * (% class="mime" %){{html wiki=false clean=false}}#mimetypeimg($attachment.getMimeType().toLowerCase() $attachment.getFilename().toLowerCase()){{/html}}(%%) (% class="filename" %)$attachment.getFilename()(% %) |
123 |
123 |
* v$attachment.getVersion() (#dynamicsize($attachment.longSize)) |
124 |
124 |
* $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')}]) |
125 |
|
- * (% class="buttonwrapper" %)[[${services.localization.render("${translationPrefix}.actions.download")}>>attach:${attachmentStringReference}||title="$services.localization.render("${translationPrefix}.actions.download")" rel="__blank" class="button"]](%%) |
|
117 |
+ * (% class="buttonwrapper" %)[[${services.localization.render("${translationPrefix}.actions.download")}>>attach:$attachmentStringReference||title="$services.localization.render("${translationPrefix}.actions.download")" rel="__blank" class="button"]](%%) |
126 |
126 |
#end |
127 |
127 |
#end |
128 |
128 |
#end |
... |
... |
@@ -290,7 +290,7 @@ |
290 |
290 |
#end |
291 |
291 |
#set ($options = { |
292 |
292 |
'classname' : ${request.get('classname')}, |
293 |
|
- 'object' : $!{numbertool.toNumber($request.object).intValue()}, |
|
285 |
+ 'object' : $!{mathtool.toInteger($request.object)}, |
294 |
294 |
'property' : ${request.property}, |
295 |
295 |
'displayImage' : ${displayImage}, |
296 |
296 |
'docAction' : ${docAction}, |
... |
... |
@@ -304,7 +304,7 @@ |
304 |
304 |
#attachmentPicker_displayAttachmentGallery($targetDocument, $targetAttachDocument, $options) |
305 |
305 |
|
306 |
306 |
(% class="gallery_buttons buttons" %)((( |
307 |
|
- (% class="buttonwrapper secondary" %)[[$services.localization.render("${translationPrefix}.cancel")>>${targetDocument}||class="button secondary" id="attachment-picker-close"]] |
|
299 |
+ (% class="buttonwrapper secondary" %)[[$services.localization.render("${translationPrefix}.cancel")>>$targetDocument||class="button secondary" id="attachment-picker-close"]] |
308 |
308 |
))) |
309 |
309 |
#end |
310 |
310 |
{{/velocity}} |