Details
-
Bug
-
Resolution: Fixed
-
Minor
-
2.2.2
-
None
-
XWiki Enterprise Manager 2.2
-
patch, UI Deleted documents/attachments
-
Description
Deleted documents not displayed in virtual wikis.
Errormessage:
org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [##
#set($dateFormat = 'yyyy MMMM d, HH:mm')
#if(!$request.list)
$xwiki.ssx.use('XWiki.DeletedDocuments')##
#if(!$xwiki.hasProgrammingRights())
warning}}This document requires programming rights and needs to be saved by an administrator of this Wiki{{/warning
#end
$xwiki.jsx.use('XWiki.DeletedDocuments')##
##
#set($columns = ["ddoc.fullName", "ddoc.title", "ddoc.date", "ddoc.deleter", 'actions'])
#set($columnProperties = {
'ddoc.fullName' :
,
'ddoc.title' :
,
'ddoc.date' :
,
'ddoc.deleter' :
,
'actions' :
})##
#set($options =
)##
##
##
##
html wiki="true" clean="false"
<div class="hidden">
#livetable('documentsTrash' $columns $columnProperties $options)
</div>
/html
##
##
##
html wiki="true" clean="false"
<noscript>
#set($deletedDocuments = $xwiki.search('select count(ddoc.id) from XWikiDeletedDocument as ddoc').get(0))
#if($deletedDocuments == 0)
info$msg.get('xe.index.trash.documents.empty')/info
#else
#macro(displayDeletedDoc $id)
#set($ddoc = $xwiki.getDeletedDocument('', '', "$id"))
#set($originalDocument = $ddoc.getDocument())
<tr>
<td><a href="$originalDocument.getURL('view', "viewer=recyclebin&id=${id}")">$ddoc.fullName</a></td>
<td>$originalDocument.displayTitle</td>
<td>$xwiki.formatDate($ddoc.getDate(), $dateFormat)</td>
<td>$xwiki.getLocalUserName($ddoc.getDeleter())</td>
<td class="itemActions">
#if($xwiki.getDocument($ddoc.fullName).isNew())
#if($ddoc.canUndelete())
<a href="${originalDocument.getURL('undelete', "id=${id}")}" class="tool restore" title="$msg.get('xe.index.trash.documents.actions.restore.tooltip')">$msg.get('xe.index.trash.documents.actions.restore.text')</a>
#end
#else
<a href="${originalDocument.getURL()}" class="tool cannot-restore" title="$msg.get('xe.index.trash.documents.actions.cannotRestore.tooltip')">$msg.get('xe.index.trash.documents.actions.cannotRestore.text')</a>
#end
#if($ddoc.canDelete())
<a href="${originalDocument.getURL('delete', "id=${id}&xredirect=$util.encodeURI($!request.getRequestURI())?$util.encodeURI($!request.getQueryString())")}" class="tool delete" title="$msg.get('xe.index.trash.documents.actions.delete.tooltip')">$msg.get('xe.index.trash.documents.actions.delete.text')</a>
#end
</td>
</tr>
#end
##
#if("$!
#set($queryParams = '')
#else
#set($queryParams = "view=$!{request.view}
")
#end
#set($paginationParameters =
)
#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.documents.ddoc.fullName')</th>
<th scope="col" class="xwiki-livetable-display-header-text">$msg.get('xe.index.trash.documents.ddoc.title')</th>
<th scope="col" class="xwiki-livetable-display-header-text">$msg.get('xe.index.trash.documents.ddoc.date')</th>
<th scope="col" class="xwiki-livetable-display-header-text">$msg.get('xe.index.trash.documents.ddoc.deleter')</th>
<th scope="col" class="xwiki-livetable-display-header-text">$msg.get('xe.index.trash.documents.actions')</th>
</tr></thead>
<tbody class="xwiki-livetable-display-body">
#foreach($item in $xwiki.search('select ddoc.id from XWikiDeletedDocument as ddoc order by ddoc.fullName asc', $paginationParameters.itemsPerPage, $paginationParameters.firstItem))
#displayDeletedDoc($item)
#end
</tbody>
</table>
#set($discard = $paginationParameters.put('position', 'bottom'))
#pagination($paginationParameters)
#end ## deletedDocuments.size
</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($docNameFilter = $request.get('ddoc.fullName'))
#set($deleterFilter = $request.get('ddoc.deleter'))
#set($sql = '')
#if("$!{docNameFilter}" != '')
#set($sql = "and lower(ddoc.fullName) like '%${docNameFilter.trim().toLowerCase()}%' ")
#end
#if("$!{deleterFilter}" != '')
#set($sql = $sql + "and lower(ddoc.deleter) like '%${deleterFilter.trim().toLowerCase()}%' ")
#end
#if("$!{request.sort}" != '')
#set($order = $request.sort)
#else
#set($order = 'ddoc.id')
#end
#if("$!{request.dir}" != '')
#set($dir = $request.dir)
#else
#set($dir = 'asc')
#end
#set($selectSql = "select ddoc.id from XWikiDeletedDocument as ddoc where 1=1 " + $sql + " order by $order $dir")
#set($countSql = "select count from XWikiDeletedDocument as ddoc 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},
"rows": [
#foreach($item in $items)
#set($ddoc = $xwiki.getDeletedDocument('', '', "$item"))
#if($velocityCount > 1) , #end
{
#set($originalDocument = $ddoc.getDocument())
"fullname" : "$originalDocument.fullName",
"title" : "$originalDocument.displayTitle",
"url" : "$originalDocument.getURL('view', "viewer=recyclebin&id=${item}")",
"originalUrl" : "$originalDocument.getURL()",
"canDelete" : $ddoc.canDelete(),
"deleteUrl" : "$originalDocument.getURL('delete', "id=${item}")",
"canRestore" : $ddoc.canUndelete(),
"alreadyExists" : !$xwiki.getDocument($ddoc.fullName).isNew(),
"restoreUrl" : "$originalDocument.getURL('undelete', "id=${item}")",
"date" : "$xwiki.formatDate($ddoc.date, $dateFormat)",
"deleter" : "$ddoc.deleter",
"deletername" : "$xwiki.getUserName($ddoc.deleter, false)",
"deleterurl" : "$xwiki.getURL($ddoc.deleter, 'view')"
}
#end
]}
## ==============================================
## json ended
## ==============================================
#end ## xpage=plain
#end ## request.list]
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluate(VelocityMacro.java:118)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluate(VelocityMacro.java:44)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:200)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:53)
at org.xwiki.rendering.internal.transformation.MacroTransformation.transformOnce(MacroTransformation.java:175)
at org.xwiki.rendering.internal.transformation.MacroTransformation.transform(MacroTransformation.java:120)
at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:72)
at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:6847)
at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:6822)
at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:725)
at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:739)
at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:492)
at sun.reflect.GeneratedMethodAccessor386.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:191)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:156)
at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1806)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1727)
at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:740)
at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:332)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:191)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:156)
at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1806)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1727)
at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:148)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:224)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:118)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with id [velocity macro]
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:200)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:156)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluate(VelocityMacro.java:110)
... 93 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'get' in class java.util.Collections$EmptyList threw exception java.lang.IndexOutOfBoundsException: Index: 0 at velocity macro[line 37, column 99]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:191)
... 95 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0
at java.util.Collections$EmptyList.get(Collections.java:2970)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
... 103 more
Error switching to deleted attachments tab when attachment recyclebin is disabled in xwiki.cfg.
Errormessage:
org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [##
#set($dateFormat = 'yyyy MMMM d, HH:mm')
#if(!$request.list)
$xwiki.ssx.use('XWiki.DeletedAttachments')##
#if(!$xwiki.hasProgrammingRights())
warning}}This document requires programming rights and needs to be saved by an administrator of this Wiki{{/warning
#end
$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}" != '')
{docNameFilter}
#set($sql = "and lower(datt.filename) like '%${filenameFilter.trim().toLowerCase()}%' ")
#end
#if("$!" != '')
{deleterFilter}
#set($sql = "and lower(datt.docName) like '%${docNameFilter.trim().toLowerCase()}%' ")
#end
#if("$!" != '')
{request.sort}
#set($sql = $sql + "and lower(datt.deleter) like '%${deleterFilter.trim().toLowerCase()}%' ")
#end
#if("$!" != '')
{request.dir}
#set($order = $request.sort)
#else
#set($order = 'datt.id')
#end
#if("$!" != '')
#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]
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluate(VelocityMacro.java:118)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluate(VelocityMacro.java:44)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:200)
at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:53)
at org.xwiki.rendering.internal.transformation.MacroTransformation.transformOnce(MacroTransformation.java:175)
at org.xwiki.rendering.internal.transformation.MacroTransformation.transform(MacroTransformation.java:120)
at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:72)
at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:6847)
at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:6822)
at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:725)
at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:739)
at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:492)
at sun.reflect.GeneratedMethodAccessor386.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:191)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:156)
at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1806)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1727)
at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:740)
at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:332)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)
at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:191)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:156)
at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1806)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1727)
at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:148)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:224)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:152)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:118)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with id [velocity macro]
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:200)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:156)
at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluate(VelocityMacro.java:110)
... 93 more
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'get' in class java.util.Collections$EmptyList threw exception java.lang.IndexOutOfBoundsException: Index: 0 at velocity macro[line 36, column 98]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:493)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:191)
... 95 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0
at java.util.Collections$EmptyList.get(Collections.java:2970)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
... 103 more
Attachments
Issue Links
- is duplicated by
-
XE-612 Deleted Docs/Attachment tabs on AllDocs page don't work in subwikis
- Closed