Changes for page Attachments

Last modified by Simon Urli on 2023/05/25

<
From version < 7.1 >
edited by Thomas Mortagne
on 2012/03/02
To version < 8.1 >
edited by Vincent Massol
on 2012/10/16
>
Change comment: Imported from XAR

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ThomasMortagne
1 +XWiki.VincentMassol
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.0
1 +XWiki 2.1
Hidden
... ... @@ -1,1 +1,1 @@
1 -false
1 +true
Content
... ... @@ -1,9 +1,11 @@
1 1  {{velocity output="false"}}
2 2  #if ($request.xaction == 'postUpload')
3 3   #set ($targetDocument = $xwiki.getDocument($request.get('docname')))
4 + #set ($targetAttachDocument = $xwiki.getDocument($request.get('targetdocname')))
5 +
4 4   #set ($fieldname = $request.get('fieldname'))
5 5   #set ($docAction = $request.get('docAction'))
6 - #set ($attachmentList = $targetDocument.getAttachmentList())
8 + #set ($attachmentList = $targetAttachDocument.getAttachmentList())
7 7   #if ($attachmentList && $attachmentList.size() > 0)
8 8   #set ($sortedAttachments = $sorttool.sort($attachmentList, 'date:desc'))
9 9   #set ($lastAttachment = $sortedAttachments.get(0))
... ... @@ -25,24 +25,28 @@
25 25  
26 26  #**
27 27   * 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.
28 - *
29 - * @param $targetDocument the document being modified
30 + *
31 + * @param $targetDocument the document to recieve the field value being modified
32 + * @param $targetAttachDocument the document to list/save attachments to
30 30   * @param $options generic picker options
31 31   *#
32 -#macro (attachmentPicker_displayAttachmentGallery $targetDocument, $options)
35 +#macro (attachmentPicker_displayAttachmentGallery $targetDocument, $targetAttachDocument, $options)
33 33   #set ($currentValue = $targetDocument.getValue($options.property))
34 - #if ("$!{targetDocument.getAttachment($currentValue)}" == '')
37 + #if ("$!{targetAttachDocument.getAttachment($currentValue)}" == '')
35 35   #set ($currentValue = "$!{options.defaultValue}")
36 36   #end
37 37   (% class="gallery" %)(((
38 - #attachmentPicker_displayUploadForm($targetDocument, $options)
39 - #attachmentPicker_displayAttachmentGalleryEmptyValue($targetDocument, $options, $currentValue)
40 - #set ($sortedAttachments = $sorttool.sort($targetDocument.getAttachmentList(), 'date:desc') )
41 + ## Only display the upload form if they have edit permission on targetAttachDocument
42 + #if ($xwiki.hasAccessLevel('edit',$xcontext.user,${targetAttachDocument.fullName}))
43 + #attachmentPicker_displayUploadForm($targetDocument, $targetAttachDocument, $options)
44 + #end
45 + #attachmentPicker_displayAttachmentGalleryEmptyValue($targetDocument, $targetAttachDocument, $options, $currentValue)
46 + #set ($sortedAttachments = $sorttool.sort($targetAttachDocument.getAttachmentList(), "${options.sortAttachmentsBy}") )
41 41   #foreach ($attachment in $sortedAttachments)
42 42   #set ($extension = $attachment.getFilename())
43 43   #set ($extension = $extension.substring($mathtool.add($extension.lastIndexOf('.'), 1)).toLowerCase())
44 44   #if ($options.filter.size() == 0 || $options.filter.contains($extension))
45 - #attachmentPicker_displayAttachment($attachment $targetDocument, $options $currentValue)
51 + #attachmentPicker_displayAttachmentBox($attachment $targetDocument $targetAttachDocument, $options $currentValue)
46 46   #end
47 47   #end
48 48   )))
... ... @@ -50,23 +50,23 @@
50 50  
51 51  #**
52 52   * Displays an attachment box.
53 - *
59 + *
54 54   * @param $attachment the target attachment to display
55 55   * @param $targetDocument the document being modified
56 56   * @param $options generic picker options
57 57   * @param $currentValue the currently selected file, used for determining if the box should be highlighted as the current value
58 58   *#
59 -#macro (attachmentPicker_displayAttachment $attachment $targetDocument, $options $currentValue)
65 +#macro (attachmentPicker_displayAttachmentBox $attachment $targetDocument $targetAttachDocument, $options $currentValue)
60 60   #if ($options.displayImage && $attachment.isImage())
61 61   #set ($cssClass = 'gallery_image')
62 62   #else
63 63   #set ($cssClass = '')
64 64   #end
65 - #attachmentPicker_displayStartFrame({'value' : $attachment.filename, 'text' : $attachment.filename, 'cssClass' : "$!{cssClass}"} $targetDocument $currentValue)
71 + #attachmentPicker_displayStartFrame({'value' : $attachment.filename, 'text' : $attachment.filename, 'cssClass' : "$!{cssClass}"} $currentValue)
66 66   #attachmentPicker_displayAttachmentDetails($attachment $options)
67 67   #set ($returnURL = $escapetool.url($doc.getURL('view', $request.queryString)))
68 - #set ($deleteURL = $targetDocument.getAttachmentURL($attachment.filename, 'delattachment', "xredirect=${returnURL}&form_token=$!{services.csrf.getToken()}") )
69 - #set ($viewURL = $targetDocument.getAttachmentURL($attachment.filename) )##{'name' : 'download', 'url' : $viewURL, 'rel' : '__blank'}
74 + #set ($deleteURL = $targetAttachDocument.getAttachmentURL($attachment.filename, 'delattachment', "xredirect=${returnURL}&form_token=$!{services.csrf.getToken()}") )
75 + #set ($viewURL = $targetAttachDocument.getAttachmentURL($attachment.filename) )##{'name' : 'download', 'url' : $viewURL, 'rel' : '__blank'}
70 70   #set ($selectURL = $targetDocument.getURL(${options.get('docAction')}, "${options.get('classname')}_${options.get('object')}_${options.get('property')}=${attachment.filename}&form_token=$!{services.csrf.getToken()}"))
71 71   #attachmentPicker_displayEndFrame ([{'name' : 'select', 'url' : $selectURL}, {'name' : 'delete', 'url' : $deleteURL}])
72 72  #end
... ... @@ -73,13 +73,12 @@
73 73  
74 74  #**
75 75   * Writes the wiki code used at the start of an attachment box. Outputs the attachment title bar, and opens the inner frame div.
76 - *
82 + *
77 77   * @param $boxOptions a map of parameters/options for the current attachment, holding, for example, the attachment name (boxOptions.value),
78 78   * the title to display (boxOptions.text), optional extra CSS classnames to put on the box (boxOptions.cssClass)
79 - * @param $targetDocument the document being modified
80 80   * @param $currentValue the currently selected file, used for determining if this attachment should be highlighted as the current value
81 81   *#
82 -#macro (attachmentPicker_displayStartFrame $boxOptions $targetDocument $currentValue)
87 +#macro (attachmentPicker_displayStartFrame $boxOptions $currentValue)
83 83   (% class="gallery_attachmentbox $!{boxOptions.cssClass} #if ("$!{boxOptions.value}" == $currentValue) current#{end}" %)(((
84 84   (% class="gallery_attachmenttitle" title="$!{boxOptions.value}" %)((($boxOptions.text)))
85 85   (% class="gallery_attachmentframe" %)(((
... ... @@ -88,7 +88,7 @@
88 88  #**
89 89   * Displays details about an attachment inside the attachment box. If the attachment is an image and the "displayImage" option is on,
90 90   * then the image is displayed. Otherwise, some basic information is displayed: the version, the size, the date and the author.
91 - *
96 + *
92 92   * @param $attachment the target attachment to display
93 93   * @param $options generic picker options
94 94   *#
... ... @@ -108,7 +108,7 @@
108 108  
109 109  #**
110 110   * Writes the wiki code used at the end of an attachment box. Closes the inner frame div, and outputs the attachment actions.
111 - *
116 + *
112 112   * @param $actions a list of maps defining action buttons, where each entry contains a subset of the following:
113 113   * <dl>
114 114   * <dt>name</dt>
... ... @@ -123,7 +123,8 @@
123 123   )))## attachmentframe
124 124   (% class="gallery_actions" %)(((
125 125   #foreach ($action in $actions)
126 - {{html}}<a href="${action.url}" class="tool ${action.name}" title="$msg.get("${translationPrefix}.actions.${action.name}")" #if($action.rel) rel="${action.rel}"#end>$msg.get("${translationPrefix}.actions.${action.name}")</a>{{/html}} ##
131 + #set( $actionname = $msg.get("${translationPrefix}.actions.${action.name}") )
132 + [[${actionname}>>path:${action.url}||class="tool ${action.name}" title="${actionname}" #if($action.rel) rel="${action.rel}"#end]]##
127 127   #end
128 128   )))## actions
129 129   )))## attachmentbox
... ... @@ -131,24 +131,25 @@
131 131  
132 132  #**
133 133   * Displays the upload box used for adding and selecting a new attachment.
134 - *
135 - * @param $targetDocument the document being modified
140 + *
141 + * @param $targetDocument the document with the property being modified
142 + * @param $targetAttachDocument the document to upload the attachment to
136 136   * @param $options generic picker options
137 137   *#
138 -#macro (attachmentPicker_displayUploadForm $targetDocument, $options)
145 +#macro (attachmentPicker_displayUploadForm $targetDocument, $targetAttachDocument, $options)
139 139  #attachmentPicker_displayStartFrame({
140 140   'value' : $msg.get("${translationPrefix}.upload.title"),
141 141   'text' : $msg.get("${translationPrefix}.upload.title"),
142 142   'cssClass' : 'gallery_upload'
143 - } $targetDocument $util.null)
150 + } $NULL)
144 144  {{html clean="false"}}
145 -<form action="$targetDocument.getURL('upload')" enctype="multipart/form-data" method="post" id="uploadAttachment" class="uploadAttachment xform">
152 +<form action="$targetAttachDocument.getURL('upload')" enctype="multipart/form-data" method="post" id="uploadAttachment" class="uploadAttachment xform">
146 146   <div class="gallery_upload_input">
147 147   #if (${options.rawfilter} != '')
148 148   <span class="xHint">$msg.get("${translationPrefix}.upload.hint", [${options.rawfilter}])</span>
149 149   #end
150 150   <input type="file" name="filepath" id="attachfile" class="attachment" size="30" title="$!{escapetool.xml($options.rawfilter)}"/>
151 - <input type="hidden" name="xredirect" value="$xwiki.getDocument($attachmentPickerDocName).getURL('get', "xaction=postUpload&amp;docAction=$!{escapetool.url($options.get('docAction'))}&amp;docname=$!{escapetool.url($targetDocument.fullName)}&amp;fieldname=$!{escapetool.url($options.get('classname'))}_$!{escapetool.url($options.get('object'))}_$!{escapetool.url($options.get('property'))}&amp;form_token=$!{services.csrf.getToken()}")" />
158 + <input type="hidden" name="xredirect" value="$xwiki.getDocument($attachmentPickerDocName).getURL('get', "xaction=postUpload&amp;docAction=$!{escapetool.url($options.get('docAction'))}&amp;targetdocname=$!{escapetool.url($targetAttachDocument.fullName)}&amp;docname=$!{escapetool.url($targetDocument.fullName)}&amp;fieldname=$!{escapetool.url($options.get('classname'))}_$!{escapetool.url($options.get('object'))}_$!{escapetool.url($options.get('property'))}&amp;form_token=$!{services.csrf.getToken()}")" />
152 152   <input type="hidden" name="docname" value="$!{escapetool.xml($targetDocument.fullName)}" />
153 153   <input type="hidden" name="classname" value="$!{escapetool.xml($options.get('classname'))}" />
154 154   <input type="hidden" name="object" value="$!{escapetool.xml($options.get('object'))}" />
... ... @@ -167,12 +167,13 @@
167 167  
168 168  #**
169 169   * Displays the "empty value" box, used for unsetting the field value.
170 - *
177 + *
171 171   * @param $targetDocument the document being modified
179 + * @param $targetAttachDocument the document that the attachments will the loaded from/saved to
172 172   * @param $options generic picker options
173 173   * @param $currentValue the currently selected file, used for determining if the empty box should be highlighted as the current value
174 174   *#
175 -#macro (attachmentPicker_displayAttachmentGalleryEmptyValue $targetDocument, $options, $currentValue)
183 +#macro (attachmentPicker_displayAttachmentGalleryEmptyValue $targetDocument, $targetAttachDocument, $options, $currentValue)
176 176   #if ("$!{options.get('defaultValue')}" != '')
177 177   #set ($reference = ${options.get('defaultValue')})
178 178   #set ($docNameLimit = $reference.indexOf('@'))
... ... @@ -179,7 +179,7 @@
179 179   #if ($docNameLimit > 0)
180 180   #set ($docName = $reference.substring(0, $docNameLimit))
181 181   #else
182 - #set ($docName = $targetDocument.fullName)
190 + #set ($docName = $targetAttachDocument.fullName)
183 183   #end
184 184   #set ($attachmentName = $reference.substring($mathtool.add($docNameLimit, 1)))
185 185   #set ($defaultAttachment = $xwiki.getDocument($docName).getAttachment($attachmentName))
... ... @@ -187,7 +187,7 @@
187 187   #set($dcssClass = 'gallery_image')
188 188   #end
189 189   #end
190 - #attachmentPicker_displayStartFrame({'cssClass' : "gallery_emptyChoice $!{dcssClass}", 'text' : $msg.get("${translationPrefix}.default"), 'value' : "${options.defaultValue}"} $targetDocument $currentValue)
198 + #attachmentPicker_displayStartFrame({'cssClass' : "gallery_emptyChoice $!{dcssClass}", 'text' : $msg.get("${translationPrefix}.default"), 'value' : "${options.defaultValue}"} $currentValue)
191 191   #attachmentPicker_displayAttachmentDetails($defaultAttachment $options)
192 192   #set ($returnURL = $escapetool.url($doc.getURL('view', $request.queryString)))
193 193   #set ($selectURL = $targetDocument.getURL(${options.get('docAction')}, "${options.get('classname')}_${options.get('object')}_${options.get('property')}=&form_token=$!{services.csrf.getToken()}"))
... ... @@ -203,10 +203,17 @@
203 203   ## $response.setContentType('multipart/formdata')
204 204   ###end
205 205   #set ($targetDocument = $xwiki.getDocument($request.docname))
214 + #if ($request.targetdocname)
215 + ## Use the target document if it exists.
216 + #set ($targetAttachDocument = $xwiki.getDocument($request.targetdocname))
217 + #else
218 + ## Otherwise, just use the current document as the target to save/load attachments
219 + #set ($targetAttachDocument = $targetDocument)
220 + #end
206 206   #if ("$!{request.savemode}" == 'direct')
207 207   #set($docAction = 'save')
208 208   #else
209 - #set($docAction = 'inline')
224 + #set($docAction = $targetAttachDocument.getDefaultEditMode())
210 210   #end
211 211   #set ($filter = [])
212 212   #set ($rawfilter = '')
... ... @@ -226,18 +226,34 @@
226 226   #else
227 227   #set ($displayImage = false)
228 228   #end
244 + ### Determine attachment sorting
245 + #set($sortAttachmentsBy = "$!{request.sortAttachmentsBy}")
246 + #set ($validAttachmentProperties = ['filename', 'date', 'filesize', 'author', 'version', 'mimeType'])
247 + #if($sortAttachmentsBy == '' || $validAttachmentProperties.indexOf($sortAttachmentsBy) == -1)
248 + ### Default to sorting by filename, sort not requested.
249 + #set($sortAttachmentsBy = "filename")
250 + #end
251 + ### Set attachment sorting direction
252 + #if($sortAttachmentsBy == 'date')
253 + ### Sort the date descending
254 + #set($sortAttachmentsBy = "date:desc")
255 + #else
256 + ### Sort everything else ascending
257 + #set($sortAttachmentsBy = "${sortAttachmentsBy}:asc")
258 + #end
229 229   #set ($options = {
230 230   'classname' : ${request.get('classname')},
231 - 'object' : ${util.parseInt($request.object)},
261 + 'object' : $!{mathtool.toInteger($request.object)},
232 232   'property' : ${request.property},
233 233   'displayImage' : ${displayImage},
234 234   'docAction' : ${docAction},
235 235   'defaultValue' : "$!{request.defaultValue}",
236 236   'rawfilter': "$!{rawfilter}",
237 - 'filter': ${filter}
267 + 'filter': ${filter},
268 + 'sortAttachmentsBy': ${sortAttachmentsBy}
238 238   })
239 239   $!targetDocument.use($targetDocument.getObject($options.classname, $options.object))##
240 - #attachmentPicker_displayAttachmentGallery($targetDocument, $options)
271 + #attachmentPicker_displayAttachmentGallery($targetDocument, $targetAttachDocument, $options)
241 241  
242 242   (% class="gallery_buttons buttons" %)(((
243 243   (% class="buttonwrapper secondary" %)[[$msg.get("${translationPrefix}.cancel")>>$targetDocument||class="button secondary" id="attachment-picker-close"]]
XWiki.JavaScriptExtension[0]
Code
... ... @@ -285,7 +285,7 @@
285 285   }
286 286   // Manually convert the special rel values into target attributes for the newly inserted content (rel="_something" => target="something")
287 287   if (typeof (XWiki.fixLinksTargetAttribute) == 'function') {
288 - // Trick the function into updating link targets in inline mode; normally the conversion only takes place in view mode
288 + // Trick the function into updating link targets in edit mode; normally the conversion only takes place in view mode
289 289   var __tmp = XWiki.contextaction;
290 290   XWiki.contextaction = 'view';
291 291   XWiki.fixLinksTargetAttribute(dialog.dialog);
XWiki.StyleSheetExtension[0]
Code
... ... @@ -136,16 +136,16 @@
136 136   opacity: 1;
137 137  }
138 138  .gallery_actions .select {
139 - background-image: url("$xwiki.getSkinFile('icons/silk/tick.gif')");
139 + background-image: url("$xwiki.getSkinFile('icons/silk/tick.png')");
140 140  }
141 141  .gallery_actions .delete {
142 - background-image: url("$xwiki.getSkinFile('icons/silk/cross.gif')");
142 + background-image: url("$xwiki.getSkinFile('icons/silk/cross.png')");
143 143  }
144 144  .gallery_actions .view {
145 - background-image: url("$xwiki.getSkinFile('icons/silk/link.gif')");
145 + background-image: url("$xwiki.getSkinFile('icons/silk/link.png')");
146 146  }
147 147  .gallery_actions .download {
148 - background-image: url("$xwiki.getSkinFile('icons/silk/arrow_down.gif')");
148 + background-image: url("$xwiki.getSkinFile('icons/silk/arrow_down.png')");
149 149  }
150 150  /*--------------------------------------------------*/
151 151  /* Upload form */
... ... @@ -162,7 +162,7 @@
162 162  
163 163  .gallery_upload .gallery_attachmenttitle {
164 164   background-position: 1px center;
165 - background-image: url("$xwiki.getSkinFile('icons/silk/bullet_add.gif')");
165 + background-image: url("$xwiki.getSkinFile('icons/silk/bullet_add.png')");
166 166   background-repeat: no-repeat;
167 167   padding-left: 16px;
168 168  }
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -13,9 +13,26 @@
13 13  ##
14 14  ## Prepare parameters
15 15  ##
16 +## Keep track for when we have a target document
17 +#set ($hasTargetDoc = false)
18 +#set ($targetdoc = "$!{xcontext.macro.params.targetdocname}")
19 +###
20 +## Set the targetdoc we want to save to (default to current doc if not set)
21 +#if ("$!{targetdoc}" != '')
22 + ## Check access on targetdocname
23 + #set ($targetPermView = $xwiki.hasAccessLevel('view',$xcontext.user,${targetdoc}))
24 + #set ($targetPermEdit = $xwiki.hasAccessLevel('edit',$xcontext.user,${targetdoc}))
25 + #set ($targetdoc = $xwiki.getDocument($targetdoc) )
26 + #set ($hasTargetDoc = true)
27 +#else
28 + ## The user should have edit and view permissions for the current doc
29 + #set ($targetPermView = true)
30 + #set ($targetPermEdit = true)
31 + #set($targetdoc = $doc)
32 +#end
16 16  #set ($classname = "$!{xcontext.macro.params.classname}")
17 17  #set ($property = "$!{xcontext.macro.params.property}")
18 -#set ($object = $util.parseInt("$!{xcontext.macro.params.object}"))
35 +#set ($object = $mathtool.toInteger("$!{xcontext.macro.params.object}"))
19 19  #if ("$!{object}" != $!{xcontext.macro.params.object})
20 20   #set ($object = ${doc.getObject($classname).number})
21 21   #if ("$!{object}" == '')
... ... @@ -23,7 +23,7 @@
23 23   #end
24 24  #end
25 25  
26 -#if ("$!{xcontext.macro.params.displayImage}" == 'true')
43 +#if ("$!{xcontext.macro.params.displayImage}" == 'true' && $targetPermView)
27 27   #set ($displayImage = true)
28 28  #else
29 29   #set ($displayImage = false)
... ... @@ -32,6 +32,7 @@
32 32   #set ($alt = "$!{xcontext.macro.params.alternateText}")
33 33   #set ($width = "$!{xcontext.macro.params.width}")
34 34   #set ($height = "$!{xcontext.macro.params.height}")
52 + #set ($imageParams = '')
35 35   #if ("${width}" != '')
36 36   #set($imageParams = "$!{imageParams} width=${width}")
37 37   #end
... ... @@ -72,9 +72,9 @@
72 72  ##
73 73  
74 74  #macro (attachmentPicker_displayAttachment $name $displayImage $withLink $forceElement)
75 - #set ($attachment = $doc.getAttachment("$!{name}"))
93 + #set ($attachment = $targetdoc.getAttachment("$!{name}"))
76 76   #if ("$!{name}" != '' && "$!{attachment}" != '')
77 - #set ($attachmentRef = $services.model.createAttachmentReference(${doc.documentReference}, ${name}))
95 + #set ($attachmentRef = $services.model.createAttachmentReference(${targetdoc.documentReference}, ${name}))
78 78   #set ($attachmentName = $name)
79 79   #else
80 80   #set ($attachmentRef = $defaultReference)
... ... @@ -81,7 +81,7 @@
81 81   #if ($attachmentRef)
82 82   #set ($docReference = $attachmentRef.documentReference)
83 83   #else
84 - #set ($docReference = $doc.documentReference)
102 + #set ($docReference = $targetdoc.documentReference)
85 85   #end
86 86   #set ($attachmentName = $attachmentRef.name)
87 87   #set ($attachment = $xwiki.getDocument($docReference).getAttachment($attachmentName))
... ... @@ -94,15 +94,18 @@
94 94   #else
95 95   #set ($attachmentResource = '')
96 96   #end
97 - #if ($displayImage)## && $attachment && $attachment.isImage())
115 + #if ($displayImage)
98 98   (% class="$!{cssClass}#if (!$attachment) hidden#end" %)(((#if ("$!{attachmentResource}" != '' || $forceElement)#if($withLink)[[#end[[image:${attachmentResource}$!{imageParams}]]#if($withLink)>>attach:${attachmentResource}||rel=lightbox]]#{end}#end)))##
99 99   #else
100 - (% class="$!{cssClass}" %)#if ("$!{attachmentResource}" != '' || $forceElement)#if ($withLink)[[attach:${attachmentResource}||rel=__blank]]#{else}(% class="displayed" %)${attachmentName}(% %)#{end}#end(%%)##
118 + (% class="$!{cssClass}" %)#if ("$!{attachmentResource}" != '' || $forceElement)#if ($withLink)[[attach:${attachmentResource}||rel=__blank]]#{else}(% class="displayed" %)#if($targetPermView)$!{attachmentName}#{else}Access Denied#{end}(% %)#{end}#end(%%)##
101 101   #end
102 102  #end
103 103  
122 +## Display the "Choose an attachment" button if they can:
123 +## 1. Edit the current page
124 +## 2. View the target attachment page. (can be the same page)
104 104  #macro (attachmentPicker_displayButton)
105 - #if ($hasEdit)(% class="buttonwrapper" %)[[${buttontext}>>${xcontext.macro.doc.fullName}?docname=${escapetool.url($doc.fullName)}&classname=${classname}&property=${property}&object=${object}&savemode=${savemode}&defaultValue=$escapetool.url($defaultValue)&filter=$!{filter}&displayImage=${displayImage}||class="attachment-picker-start button" title="${buttontext}"]](%%)#end
126 + #if ($hasEdit && $targetPermView)(% class="buttonwrapper" %)[[${buttontext}>>${xcontext.macro.doc.fullName}||queryString="#if ($hasTargetDoc)targetdocname=${escapetool.url($targetdoc.fullName)}&#{end}docname=${escapetool.url($doc.fullName)}&classname=${classname}&property=${property}&object=${object}&savemode=${savemode}&defaultValue=$escapetool.url($defaultValue)&filter=$!{filter}&displayImage=${displayImage}" class="attachment-picker-start button" title="${buttontext}"]](%%)#end
106 106  #end
107 107  {{/velocity}}
108 108  
Macro description
... ... @@ -1,1 +1,1 @@
1 -A control to be used for object properties that are supposed to contain the name of an attachment of the containing document.
1 +A control to be used for object properties of the current document that are supposed to contain the name of an attachment from the current (or target) document. Allows uploading new attachments, and deleting attachments from the target document. If no target document is specified, the current document will be used. Object properties are only saved to the current document.
XWiki.WikiMacroParameterClass[18]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +The target document name to save/list attachments from
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +targetdocname

Get Connected