PermaLink XPages Multi Attachments Custom Control - on OpenNTF.org05/06/2009 06:10 AM
Domino 8.5
I updated my sample Multi Attachment custom control to now accept configuration parameters so it is easier to reuse the control in different applications.  The updated application can be downloaded from OpenNTF.org by clicking here.  

I decided to make the control easy to drag and drop onto any XPage after speaking with Niklas Heidloff from IBM.  He was filling me in on all the changes coming soon to OpenNTF.org and I felt it was important to contribute to the efforts that are underway.  

About the Multi Attachment Custom Control
This custom control uses a central attachment repository db for all the attachments for your application.  It allows the user to add as many attachments to a document as they want by clicking the "Add New Upload" button .  Each attachment is a separate document in the attachment repository and is linked back to the document using the document's universalID.  The custom control uses a repeat control to repeat a description and download control for each attachment.

The parameters I added allow you to specify the location and name of the repository database as well as control the various features of the file download control.  The repository contains a single view and form.  You can place that view and form into any database to create the repository.

Here's a screen shot of the custom control being used on an XPage that tracks Project information:

Image:John's Blog - XPages Multi Attachments Custom Control - on OpenNTF.org

Here's a screen shot showing the parameters:

Image:John's Blog - XPages Multi Attachments Custom Control - on OpenNTF.org

Descriptions of the available parameters
Parameter Description Type
fileUploadDbName The db name that will store the attachments.  Include the full path from the Notes data directory. string
hideIfNoAttachments Controls the visibility of the download control if there are no attachments boolean
showCreatedDate Controls the visibility of the column for Creation date boolean
showModifiedDate Controls the visibility of the column for Modified date boolean
showSize Controls the visibility of the column for Attachment size boolean
showType Controls the visibility of the column for Attachment tyope boolean



You can download the control here: http://www.openntf.org/Projects/pmt.nsf/ProjectLookup/XPages%20Multi%20Attachment%20Custom%20Control.

You can read more about how the control was built by clicking here: http://www.jmackey.net/groupwareinc/johnblog/johnblog.nsf/d6plinks/GROC-7G3GF7

Please feel free to contact me if you have any issues or questions.....

-John


Technorati:
This page has been accessed 1479 times. .
Comments :v

1. Steve Smillie05/07/2009 07:18:14 AM


This looks great. I will be giving it a try.

Will this control work in a Tabbed Panel Control?

I was trying to use the built in upload control and in my testing it would not upload the attachment if you switched to another tab before saving. It was fine if you saved while that Tab was open.




2. Steve Smillie05/07/2009 09:22:51 AM


Just saw the Lotus 8.5 forums the talk about Tabbed Panel issues. Probably my problem with the standard controls.

Still like the idea of this one better.

Another thought:
Are the attachments secured in the Repository DB. I would hate for someone to find a way to browse that db and get access to attachments they wouldn't have access to if the db/documents they are from had security.




3. John Mackey05/07/2009 09:47:57 AM
Homepage: http://www.jmackey.net


@Steve, yes I do believe the issue you are experiencing is due to the bug in the tabbed panels. I do not have a workaround for that.

As far as security, it would be easy to add Readers fields to the repository form. Currently XPages JS runs as the current user, so we are inserting the attachments with the current users' rights and the user has to have access to the repository db. So the first line of security would be the ACL and group access, 2nd could be Readers fields.




4. Rish05/14/2009 08:51:12 PM


Hi John, I am new to x-pages. Do I need Domino 8.5 server to run my x-page application ?

Rish




5. Tony Elliott10/13/2009 12:32:56 PM


Hi John,

I just upgraded my dev server to 8.5.1 and this control stopped working. Clicking on the "Add New Upload" button, creates a new copy of the existing document and never shows an upload control in the repeat control. Have you experienced this yet?




6. Antonio05/31/2010 12:14:53 PM


Hi John:

I have a question about if is possible to control the files's size when it is upload, I did an example an upload a file with empty size ( 0 kb ) and when I submit the document permit me to do this, but when I open again the document in read mode is not attached because is deleted automaticcally ( same case for the documents greater than 1024 kb ), I would like to control this when the files is being upload. Do you have any axample about it ( if is possible to do it ) ? I really aprreciate your help.

Thanks in advance.




Search
Partner with us
Need help on your XPages projects?

Talk to the experts! Read more...
XPage Examples
By Category
About Me
Downloads
My Links
Monthly Archive
Powered by
Blogsphere
Lotus Domino ND7 RSS News Feed RSS Comments Feed Geo URL netcraft RSS Validator Lotus Geek Chris. A. Brandlehner OpenNTF BlogSphere