Changes for page Sandbox Test Page 3
Last modified by Matej TISO on 13.02.2026, 13:16
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -6,49 +6,3 @@ 6 6 7 7 8 8 [[image:Screenshot 2024-10-17 102234.png]] 9 - 10 -{{velocity}}{{html}} 11 -<form action="" method='get' class='xform full'> 12 - <dl> 13 - <dt><label for='wiki'>Wiki:</label></dt> 14 - <dd><select name='wiki'> 15 - #foreach($w in $services.wiki.getAllIds()) 16 - <option value='$w' #if($w == $request.wiki)selected='selected'#end>$w</option> 17 - #end 18 - </select></dd> 19 - <dt><label for='pagename'>Page reference (as provided in the page information tab): </label></dt> 20 - <dd><input type='text' name='pagename' value="$!request.pagename" /></dd> 21 - <dt><label for='filename'>Filename: </label></dt> 22 - <dd><input type='text' name='filename' value="$!request.filename" /></dd> 23 - </dl> 24 - <div class='buttonwrapper'> 25 - <input type='submit' class='btn primary button' value='Get path'/> 26 - </div> 27 -</form> 28 -{{/html}}{{/velocity}} 29 - 30 -{{groovy}} 31 -println ""; 32 -import org.xwiki.store.filesystem.internal.FilesystemStoreTools; 33 -if(request.get('filename') != null && request.get('filename').size() > 0 && request.get('wiki') != null && request.get('wiki').size() > 0 && request.get('pagename') != null && request.get('pagename').size() > 0) { 34 - def pageReference = services.model.resolveDocument(request.get('pagename'), services.model.createWikiReference(request.get('wiki'))); 35 - def attachmentReference = services.model.createAttachmentReference(pageReference, request.get('filename')); 36 - def attachmentDoc = xwiki.getDocument(attachmentReference.getDocumentReference()) 37 - if (attachmentDoc != null && !attachmentDoc.isNew()) { 38 - def attachment = attachmentDoc.getAttachment(attachmentReference.getName()) 39 - if (attachment != null) { 40 - //println attachmentReference; 41 - def comp = services.component.getInstance(FilesystemStoreTools.class); 42 - println "File path is "; 43 - println ""; 44 - println "{{box}}{{{ " + comp.getAttachmentFileProvider(attachmentReference).getAttachmentContentFile() + " }}}\\\\{{/box}}"; 45 - } else { 46 - println "Page exists but attachment does not exist."; 47 - } 48 - } else { 49 - println "Page does not exist."; 50 - } 51 -} else { 52 - println "Please fill in a wiki, a page name and an attachment name."; 53 -} 54 -{{/groovy}}