Modifications pour le document Download Attachments
Modifié par Paul Libbrecht (admin) le 2021/12/12 21:39
modifié par Paul Libbrecht (admin)
sur 2016/08/18 23:58
sur 2016/08/18 23:58
modifié par Paul Libbrecht (admin)
sur 2016/08/18 23:48
sur 2016/08/18 23:48
Commentaire de modification :
Il n'y a aucun commentaire pour cette version
Résumé
Détails
- Propriétés de la Page
-
- Contenu
-
... ... @@ -10,17 +10,18 @@ 10 10 def page = request.getParameter("page"); 11 11 Document pageDoc = null; 12 12 try { 13 - 13 + pageDoc = xwiki.getDocument(page); 14 14 } catch(Exception ex) {} 15 15 16 16 if(page && pageDoc) { 17 17 System.err.println("Should download attachments from page ${pageDoc}."); 18 - response.setContentType("application/zip"); 19 - response.addHeader("Content-Disposition", "attachment; filename=${pageDoc.getName()}_attachments.zip"); 18 + //System.err.println("content: " + pageDoc.getContent()); 19 + response.setContentType("application/zip; filename=${pageDoc.getName()}_attachments.zip"); 20 + response.addHeader("Content-Disposition", "attachment"); 20 20 21 21 22 22 ZipOutputStream out = null; 23 - System.err.println("Attachments list 's size: ${pageDoc.document.attachmentList.size()}.");24 + System.err.println("Attachments list: ${pageDoc.document.attachmentList.size()}."); 24 24 try { 25 25 out = new ZipOutputStream(response.getOutputStream()); 26 26 for(Attachment att in pageDoc.getAttachmentList()) { ... ... @@ -38,7 +38,10 @@ 38 38 } 39 39 40 40 } else { 41 - println("Sorry, I need a page parameter."); 42 + println(""" 43 += Download Attachments = 44 +call this page with a parameter ``page`` set to the name of the page, it will put all attachments of that page in a single zip and download it. 45 +"""); 42 42 } 43 43 44 44