General Actions:
Log-in
Wiki:
L3D's Wiki
▼
:
Document Index
»
Space:
XWiki
▼
:
Document Index
»
Page:
DeletedAttachments
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Welcome to your wiki
»
Documents on this Wiki
»
Deleted Attachments
Wiki source code of
Deleted Attachments
Last modified by
Administrator
on 2011/03/02 17:34
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Show line numbers
{{velocity}} #if(!$xwiki.hasProgrammingRights()) {{warning}}This document requires programming rights and needs to be saved by an administrator of this Wiki{{/warning}} #else #set($dateFormat = 'yyyy MMMM d, HH:mm') #if(!$request.list) $xwiki.ssx.use('XWiki.DeletedAttachments')## $xwiki.jsx.use('XWiki.DeletedAttachments', {'minify' : 'false'})## ## #set($columns = ['datt.filename', 'datt.docName', 'datt.date', 'datt.deleter', 'actions']) #set($columnProperties = { 'datt.filename' : { 'type' : 'text', 'size' : 10 }, 'datt.docName' : { 'type' : 'text', 'size' : 10 }, 'datt.date' : { 'type' : 'date', 'filterable' : false }, 'datt.deleter' : { 'type' : 'text', 'size' : 10 }, 'actions' : { 'type' : 'text', 'filterable' : false, 'sortable' : false } })## #set($options = { 'url' : "$xwiki.getURL('XWiki.DeletedAttachments', 'view', 'list=1&xpage=plain&outputSyntax=plain')", 'callback' : 'XWiki.index.trash.attachments.displayEntry', 'translationPrefix' : 'xe.index.trash.attachments.' })## ## ## ## {{html wiki="true" clean="false"}} <div class="hidden"> #livetable('attachmentTrash' $columns $columnProperties $options) </div> {{/html}} {{html wiki="true" clean="false"}} <noscript> #set($deletedAttachments = $xwiki.search('select count(datt.id) from DeletedAttachment as datt').get(0)) #if($deletedAttachments == 0) {{info}}$msg.get('xe.index.trash.attachments.empty'){{/info}} #else #macro(displayDeletedAttachment $id) #set($datt = $xwiki.getDeletedAttachment("$id")) #set($originalAttachment = $datt.getAttachment()) #set($originalDocument = $xwiki.getDocument($datt.docName)) <tr> <td><a href="$originalDocument.getAttachmentRevisionURL($originalAttachment.filename, $originalAttachment.version, "rid=${datt.id}").replaceAll('&', '&')">$datt.filename</a></td> <td><a href="$originalDocument.getURL()">$originalDocument.displayTitle (${originalDocument.fullName})</a></td> <td>$xwiki.formatDate($datt.getDate(), $dateFormat)</td> <td>$xwiki.getLocalUserName($datt.getDeleter())</td> <td class="itemActions"> #if($datt.canDelete()) <a href="${originalDocument.getAttachmentURL($datt.filename, 'delattachment', "trashId=${datt.id}&xredirect=$util.encodeURI($!request.getRequestURI())?$util.encodeURI($!request.getQueryString())")}" class="tool delete" title="$msg.get('xe.index.trash.attachments.actions.delete.tooltip')">$msg.get('xe.index.trash.attachments.delete.text')</a> #end </td> </tr> #end ## #if("$!{request.view}" == '') #set($queryParams = '') #else #set($queryParams = "view=$!{request.view}") #end #set($paginationParameters = { 'totalItems' : $xwiki.search("select count(datt.id) from DeletedAttachment as datt").get(0), 'defaultItemsPerPage' : 15, 'url' : $doc.getURL('view', $queryParams) }) #pagination($paginationParameters) <table id="searchResults" class="xwiki-livetable xwiki-livetable-display"> <thead class="xwiki-livetable-display-header"><tr> <th scope="col" class="xwiki-livetable-display-header-text selected asc">$msg.get('xe.index.trash.attachments.datt.filename')</th> <th scope="col" class="xwiki-livetable-display-header-text">$msg.get('xe.index.trash.attachments.datt.docName')</th> <th scope="col" class="xwiki-livetable-display-header-text">$msg.get('xe.index.trash.attachments.datt.date')</th> <th scope="col" class="xwiki-livetable-display-header-text">$msg.get('xe.index.trash.attachments.datt.deleter')</th> <th scope="col" class="xwiki-livetable-display-header-text">$msg.get('xe.index.trash.attachments.actions')</th> </tr></thead> <tbody class="xwiki-livetable-display-body"> #foreach($item in $xwiki.search('select datt.id from DeletedAttachment as datt order by datt.filename asc', $paginationParameters.itemsPerPage, $paginationParameters.firstItem)) #displayDeletedAttachment($item) #end </tbody> </table> #set($discard = $paginationParameters.put('position', 'bottom')) #pagination($paginationParameters) #end ## deletedAttachments != 0 </noscript> {{/html}}## #else ## request.list ## ============================================================================================ ## This page is called from live table via Ajax with the argument xpage=plain. It returns a ## set of results serialized in JSON. ## @programming This service page needs to be saved by a user with the programming access level ## to work as expected ## ============================================================================================ #if("$!{request.get('xpage')}" == 'plain') $response.setContentType('application/json') #set($offset = $util.parseInt($request.get('offset'))) ## offset starts from 0 in velocity and 1 in javascript #set($offset = $offset - 1) #set($limit = $util.parseInt($request.get('limit'))) #set($filenameFilter = $request.get('datt.filename')) #set($docNameFilter = $request.get('datt.docName')) #set($deleterFilter = $request.get('datt.deleter')) #set($sql = '') #if("$!{filenameFilter}" != '') #set($sql = "and lower(datt.filename) like '%${filenameFilter.trim().toLowerCase()}%' ") #end #if("$!{docNameFilter}" != '') #set($sql = "and lower(datt.docName) like '%${docNameFilter.trim().toLowerCase()}%' ") #end #if("$!{deleterFilter}" != '') #set($sql = $sql + "and lower(datt.deleter) like '%${deleterFilter.trim().toLowerCase()}%' ") #end #if("$!{request.sort}" != '') #set($order = $request.sort) #else #set($order = 'datt.id') #end #if("$!{request.dir}" != '') #set($dir = $request.dir) #else #set($dir = 'asc') #end #set($selectSql = "select datt.id, $order from DeletedAttachment as datt where 1=1 " + $sql + " order by $order $dir") #set($countSql = "select count(*) from DeletedAttachment as datt where 1=1 " + $sql) #set($items = $xwiki.search($selectSql, $limit, $offset)) #set($totalItems = $xwiki.search($countSql).get(0)) #set($returnedItems = $items.size()) ## ============================================== ## json starts ## ============================================== { "totalrows": $totalItems, "returnedrows": $returnedItems, "offset": ${request.get('offset')}, "reqNo": ${request.reqNo}, "query" : "$selectSql", "rows": [ #foreach($item in $items) #set($datt = $xwiki.getDeletedAttachment("$item.get(0)")) #if($velocityCount > 1) , #end { #set($originalAttachment = $datt.getAttachment()) #set($originalDocument = $xwiki.getDocument($datt.docName)) "filename" : "$datt.filename", "docName" : "$datt.docName", "title" : "$originalDocument.displayTitle", "url" : "$originalDocument.getAttachmentRevisionURL($originalAttachment.filename, $originalAttachment.version, "rid=${datt.id}")", "documentUrl" : "$originalDocument.getURL()", "canDelete" : $datt.canDelete(), "deleteUrl" : "$originalDocument.getAttachmentURL($datt.filename, 'delattachment', "trashId=${datt.id}")", "canRestore" : $datt.canRestore(), "alreadyExists" : #if($originalDocument.getAttachment($datt.filename)) true #else false #end, "restoreUrl" : "$originalDocument.getAttachmentURL($datt.filename)", "date" : "$xwiki.formatDate($datt.date, $dateFormat)", "deleter" : "$datt.deleter", "deletername" : "$xwiki.getUserName($datt.deleter, false)", "deleterurl" : "$xwiki.getURL($datt.deleter, 'view')" } #end ]} ## ============================================== ## json ended ## ============================================== #end## xpage=plain #end## request.list #end## hasProgramR {{/velocity}}
Quick Links
L3D Calendar
Wiki Dashboard
Document Index
Blog
Sandbox