Hi Scott, On Thu, Sep 22, 2011 at 12:36 AM, Scott Serr <[email protected]> wrote:
[I'm hoping that scripting belongs here an not in the dev list]
I'm trying to tie an attachment to an object. Say, I want to create several TrackingClass objects on a page. But one of the properties I'd like to be a PDF and link. (Or fake it to look like it) I know the properties of a class are primitives plus a few like DbList etc.
The table would have these headings:
Tracking Date | Description | PDF Link
At the bottom of the page I'd have an Add object form:
Tracking Date: Description: Attach PDF: [Add Button]
This is like the "Creating a FAQ Application" example, but with an attached file in the same form submit.
I'm wondering how one might solve this problem?
I'd make the "pdf" property of TrackingClass a String property that holds a relative attachment string reference. An absolute attachment string reference looks like this wiki:Space.Page@attachment but if you always store the attachments on the same page as the objects that refer to them then you can simply save the attachment file name (the last part of the reference) in the "pdf" property. As for creating the link, something like this should work: |=Tracking Date|=Description|=PDF Link #foreach($trackingObject in $doc.getObjects('YourSpace.TrackingClass')) |$trackingObject.getProperty('date').value|$trackingObject.getProperty('description').value|attach:$trackingObject.getProperty('pdf').value #end See http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax#HLinks (link to an attachment on the current or a different page). Hope this helps, Marius
Thanks, Scott _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users