Hi!
Abel Solórzano Astorga wrote:
Hi,
I want to create an application similar or based on the attachment panel
application at the bottom of the xwiki pages. The application should let the
user select the file to upload to the xwiki server and write a description
of the file. Then, the file name and description should be automatically
added to a table. The first column of the table is the file name, that is a
link to the file. The second column of the table is the description of the
file. So, the table is like a repository of the files and its respective
descriptions.
My question is. Is there a macro or code snipped to add a file to the
attachment panel application?
I don't understand well your question. It seems to me that could be
reduced to how add a comment to an attachment "event" and retrieve it
together with the filename. I guess this comment must be linked to each
document version, not to the attachment name as this is shared by all
the releases of a document.
It is easy to get the filenames of the attached files for a page using
XML-RPC following this example...
http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples#HAttac…
Or simply using this code snip (sorry, I don't remember who sent it to
me! I'm looking for it in
xwiki.org site without success):
*****
#set($attachments = $doc.attachmentList)
#if($attachments.size()>0)
#foreach ($attach in $attachments)
<span class="name"><a
href="$doc.getAttachmentURL("${attach.filename}",
"download")"
title="$msg.get("downloadthisattachment")">#packName($attach.filename)</a></span><br>
#end
#end
*****
About how to add a comment to each attachment "event" and retrieve it,
sorry, I can't be of any help. I don't now even if this can be easy
using the current data model. Now, it is possible to retreive version,
size, author and date, but I don't know how to add and retreive a
description/comment for each of them.
I must recognized that I've been from XWiki development for a while, but
I hope this could be helpful for you.
Greetings,
Ricardo
--
Ricardo Rodríguez
CTO
eBioTIC.
Life Sciences, Data Modeling and Information Management Systems