Changes for page Attachments

Last modified by Ludovic Dubost on 2024/07/22 15:50

From version 5.1
edited by Ludovic Dubost
on 2017/03/08 18:02
Change comment: Install extension [org.xwiki.platform:xwiki-platform-attachment-ui-9.1.1]
To version 1.1
edited by Ludovic Dubost
on 2014/03/30 19:46
Change comment: Imported from XAR

Summary

Details

Page properties
Content
... ... @@ -10,10 +10,7 @@
10 10   #set ($sortedAttachments = $sorttool.sort($attachmentList, 'date:desc'))
11 11   #set ($lastAttachment = $sortedAttachments.get(0))
12 12   #end
13 - $response.sendRedirect($targetDocument.getURL($docAction, $escapetool.url({
14 - $fieldname: $lastAttachment.filename,
15 - 'form_token': $request.form_token
16 - })))
13 + $response.sendRedirect($targetDocument.getURL($docAction, "$!{fieldname}=$!{lastAttachment.filename}&form_token=$!{escapetool.url($request.get('form_token'))}"))
17 17   #stop
18 18  #end
19 19  {{/velocity}}
... ... @@ -104,10 +104,10 @@
104 104   #if ($attachment)
105 105   #if ($attachment.isImage() && $options.displayImage)
106 106   #set ($attachmentDocument = $attachment.getDocument())
107 -[[[[image:${attachmentDocument.fullName}@${attachment.filename}||width=180]]>>attach:${attachmentDocument.fullName}@${attachment.filename}||rel="lightbox[attachments]"]]
104 +[[[[image:${attachmentDocument.fullName}@${attachment.filename}||width=160]]>>attach:${attachmentDocument.fullName}@${attachment.filename}||rel="lightbox[attachments]"]]
108 108   #else
109 109   * (% class="mime" %){{html wiki=false clean=false}}#mimetypeimg($attachment.getMimeType().toLowerCase() $attachment.getFilename().toLowerCase()){{/html}}(%%) (% class="filename" %)$attachment.getFilename()(% %)
110 - * v$attachment.getVersion() (#dynamicsize($attachment.longSize))
107 + * v$attachment.getVersion() (#dynamicsize($attachment.filesize))
111 111   * $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')}])
112 112   * (% class="buttonwrapper" %)[[${services.localization.render("${translationPrefix}.actions.download")}>>attach:${attachment.getDocument()}@${attachment.filename}||title="$services.localization.render("${translationPrefix}.actions.download")" rel="__blank" class="button"]](%%)
113 113   #end
... ... @@ -155,7 +155,7 @@
155 155  <form action="$targetAttachDocument.getURL('upload')" enctype="multipart/form-data" method="post" id="uploadAttachment" class="uploadAttachment xform">
156 156   <div class="gallery_upload_input">
157 157   #if (${options.rawfilter} != '')
158 - <span class="xHint">$escapetool.xml($services.localization.render("${translationPrefix}.upload.hint", [${options.rawfilter}]))</span>
155 + <span class="xHint">$services.localization.render("${translationPrefix}.upload.hint", [${options.rawfilter}])</span>
159 159   #end
160 160   <input type="file" name="filepath" id="attachfile" class="attachment" size="30" title="$!{escapetool.xml($options.rawfilter)}"/>
161 161   <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()}")" />
... ... @@ -208,6 +208,11 @@
208 208  
209 209  {{velocity}}
210 210  #if ($request.docname)
208 + ###if ($request.xpage == 'plain')
209 + ## ## IE6 + XHR + gzip compression = BOOM!
210 + ## ## This disables the automatic gzip compression
211 + ## $response.setContentType('multipart/formdata')
212 + ###end
211 211   #set ($targetDocument = $xwiki.getDocument($request.docname))
212 212   #if ($request.targetdocname)
213 213   ## Use the target document if it exists.
XWiki.JavaScriptExtension[0]
Code
... ... @@ -270,7 +270,11 @@
270 270   );
271 271   dialog.shortcuts.close.keys = [];
272 272   dialog.showDialog();
273 - dialog.dialog.down().setStyle({position: "fixed"});
273 + if (window.browser.isIE6x) {
274 + dialog.dialog.down().setStyle({position: "absolute"});
275 + } else {
276 + dialog.dialog.down().setStyle({position: "fixed"});
277 + }
274 274   dialog.dialog.setStyle({top: document.viewport.getScrollOffsets().top + "px", position: "absolute"});
275 275   dialog.dialogBox.setStyle({overflow: "hidden", width: "80%", margin: "0 10%"});
276 276   new Ajax.Updater(loading.up(), url, {
XWiki.StyleSheetExtension[0]
Code
... ... @@ -10,6 +10,11 @@
10 10  #set ($imgSize = $mathtool.sub($boxSize, $mathtool.mul($boxPadding, 2)))
11 11  #set ($actionsHeight = 20)
12 12  #set ($actionsWidth = 16)
13 +#macro (__css3 $rule)
14 + ${rule};
15 + -moz-${rule};
16 + -webkit-${rule};
17 +#end
13 13  /*--------------------------------------------------------*/
14 14  /* Attachment picker layout fixes */
15 15  .attachment-picker p {
... ... @@ -27,7 +27,7 @@
27 27  .gallery_attachmentbox {
28 28   background: $theme.pageContentBackgroundColor;
29 29   border: 1px solid $theme.borderColor;
30 - border-radius: 5px;
35 + #__css3('border-radius: 5px')
31 31   float: left;
32 32   margin: ${boxMargin}px;
33 33   overflow: hidden;
... ... @@ -34,11 +34,19 @@
34 34   position: relative;
35 35   width: ${boxSize}px;
36 36  }
42 +/* Broken IE6 box model, add the border width to the total width. */
43 +* html .gallery_attachmentbox {
44 + width: ${mathtool.add($boxSize, 2)}px;
45 +}
37 37  .gallery .current {
38 38   background-color: $theme.highlightColor;
39 39   border-width: 3px;
40 40   margin: 3px;
41 41  }
51 +/* Broken IE6 box model, add the border width to the total width. */
52 +* html .gallery .current {
53 + width: ${mathtool.add($boxSize, 6)}px;
54 +}
42 42  .gallery .current .gallery_attachmenttitle {
43 43   font-weight: bold;
44 44  }
... ... @@ -49,7 +49,7 @@
49 49  .gallery_attachmenttitle {
50 50   background: $theme.backgroundSecondaryColor;
51 51   border-bottom: 1px dotted $theme.borderColor;
52 - border-radius: 5px 5px 0px 0px;
65 + #__css3('border-radius: 5px 5px 0px 0px')
53 53   font-size: 85%;
54 54   padding: 3px ${boxPadding}px;
55 55   overflow: hidden;