Changes for page Attachments Macro

Last modified by Ricardo Julio Rodríguez Fernández on 2024/09/05 08:36

From version 1.1
edited by Ricardo Julio Rodríguez Fernández
on 2023/12/26 12:27
Change comment: Install extension [org.xwiki.contrib:macro-attachments/3.4]
To version 2.1
edited by Ricardo Julio Rodríguez Fernández
on 2024/09/05 08:36
Change comment: Install extension [org.xwiki.contrib:macro-attachments/3.5]

Summary

Details

XWiki.WikiMacroClass[0]
Macro code
... ... @@ -59,5 +59,33 @@
59 59   #set ($liveTableId = "attachments-table-$mathtool.random(1, 1000)")
60 60  #end
61 61  (% style="width: 99%;" %)
62 +#if ($hasEdit || $hasAdmin)
63 + (% class="btn btn-default" id="macroUploadButton" data-toggle="modal" data-target="#attachmentUploadModal" %)
64 + $escapetool.xml($services.localization.render('core.viewers.attachments.upload.title'))
65 +#end
62 62  #livetable($liveTableId $columns $columnsProperties $options)
67 +{{html clean="false"}}
68 +<div class="modal fade" id="attachmentUploadModal" tabindex="-1" role="dialog">
69 + <div class="modal-dialog">
70 + <div class="modal-content">
71 + <div class="modal-header">
72 + <button type="button" class="close" data-dismiss="modal">&times;</button>
73 + <h4 class="modal-title">$services.localization.render('core.viewers.attachments.upload.title')</h4>
74 + </div>
75 + <div class="modal-body">
76 + <form action="$doc.getURL('upload')" enctype="multipart/form-data" method="post">
77 + <input type="hidden" name="form_token" value="$services.csrf.token" />
78 + <input type="hidden" name="xredirect" value="$doc.URL" />
79 + <label for="xwikiUploadFile">$services.localization.render('core.viewers.attachments.upload.file')</label>
80 + <input id="xwikiUploadFile" type="file" name="filepath" size="40" class="uploadFileInput noitems" data-max-file-size="$!escapetool.xml($xwiki.getSpacePreference('upload_maxsize'))" />
81 + <span class="buttonwrapper"><input type="submit" value="$services.localization.render('core.viewers.attachments.upload.submit')" class="button btn btn-primary"/></span>
82 + <span class="buttonwrapper"><a class="cancel secondary button btn btn-primary" href="$doc.getURL()">$services.localization.render('core.viewers.attachments.upload.cancel')</a></span>
83 + </form>
84 + </div>
85 + <div class="modal-footer">
86 + </div>
87 + </div>
88 + </div>
89 +</div>
90 +{{/html}}
63 63  {{/velocity}}