Gossamer Forum
Quote Reply
Attachment Plugin
I am working on an "Attachment" plugin for my site, which will allow you to attach files/images to links.

Key Features
- easy to install: just install the plugin, add some lines to the templates, and the plugin will do the rest
- unlimited number of attachments per link (admin can set a limit, though)
- users can upload/delete attachments
- admin can upload/edit/delete attachments
- attachments can be "normal" or "public"
- "normal" attachements are stored in a place where only Links SQL has access, so that you can effectively control who can view them (e.g. only registered users)
- "public" attachments are stored in a place where they are accessible through http. This is useful for e.g. public images.

I have attached some screenshot of the user side and the admin side (my site is still under developments, so there is no live testing ground).

I would like to hear if anyone is interested in such a plugin. Also comments/feature requests/remarks are welcome.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
Hi Yogi,

This looks very interesting for sites that are using detailed pages. It really expands the capabilities of the system. Nice job!

If a person wanted to control the attachements in a secure area (Requiring a password) could that be done? I was thinking here about people wanting to have downloads controlled for sales reasons as well as just knowing who, what and when.

What fortmats are being allowed as attachments? I noticed images and PDF files. Any others?

Could a person place a release between the user and the attachment? (This way a disclosure and acceptance could be done prior to viewing or fownloading). I could see something like this as being useful for a photography site or an artists site.

I really like this plugin though. It adds an all new demension to Links SQL. Nice work!Smile
Quote Reply
Re: [Teambldr] Attachment Plugin In reply to
The permissions for viewing attachments are set globally at the moment. This means that you can allow e.g.only registered users to view/download attachments. You can also allow everybody to view everything if you want to.

One could think of implementing the permissions this on a per attachment/per user basis, let me think about this for a while. It would certainly take some additional work.

You could achieve this by placing the attachments in a directory secured by a .htaccess file. Then you could to manage users/passwords outside of Links SQL.

You can upload any file format you like, the admin can set filters (as in GForum. In fact, the code is modelled after Jason's GForum file upload code...)

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
Thanks Ivan.

Would something like this be possible:

Upload:
User doing upload chooses - Available to everyone - Available to registered users - Available with approval from owner only

Then when a user trys to access:

Available to Everyone - Anyone can view
Available to Registered Users - Only registered and above can view
Available with approval from Link Owner - The user contacts the owner and gets a password



Does that make sense?

Cool
Quote Reply
Re: [Teambldr] Attachment Plugin In reply to
Hi Brian

yes it does make sense.

1) and 2) are easily possible (it's already there, you only have to put a select box on the add/modify page).

3) is more difficult, but also possible. One could save every attachment with a password, and you would be asked for this password if you wanted to access the link. Same password for everybody.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
You are using a slightly different approach than I was/am using.

I got sidetracked on the upload/attachments issue, but I think everyone will appreciate this diversion ;)

There are a lot of issues to work out in handling attachments, and multiple attachments :) It's not as easy as it might appear.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Attachment Plugin In reply to
Thanks for your feedback. I was aware that you were doing something similar, but since I need this for my own site, I just developped my own. Wink

Quote:
There are a lot of issues to work out in handling attachments, and multiple attachments :) It's not as easy as it might appear.

Yes I know... But I have got it working quite stable, and I am thoroughly testing it on my site at the moment.

I think the way Jason implemented it in this forum is very clever: you upload one attachment at a time. The file is stored at a temporary place, and the information about the file in a temporary table. When the post (or link in my case) is added/modified, the file is copied to the permanent location. Entries which are older than a day are deleted from the temporary table, and with them the corresponding uploaded files (which are files that were uploaded, but the post/link was never submitted...).

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
Hi,

It really gets more complicated than that :)

When you start modifying Links and deciding how to decide about attachments -- remember, there is no built-in security on that, so attachments on disk don't know they've been modified. The handling is *very* different from static to dynamic sites as well.

I had the system working for single and multiple uploads, and had starting working out a "toggle" type system for doing modifications. In looking back over the code, I had made some deep progress, but there were still problems with handling modify requests (it was using 3 flags, I think at that point) and dealing with the differences in static vs dynamic sites.

Granted... the template parser has been upgraded significantly since then, so some things are easier, but still tracking and dealing with the attachments is a problem.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Attachment Plugin In reply to
No, the attachments on disk don't know that they have been modified, but I know, because I keep track about modifications in the database.

There are different configuration options, they way I use it at my site is:

1) a user can upload attachments, when adding/modifying a link. They are automatically marked "is_validated = 0" and cannot be accessed by users.
2) the admin validates the link, and also the attachments, i.e. "is_validated = 1"
3) a user can delete attachments, they will be marked "delete_requested = 1", but they will still be visible, until the admin actually deletes them. (this is only for attachments that have at some point been accepted by the admin, if a user uploads and deletes an attachment before submitting the link, the attachment is deleted straight away). This is the advantage of having two tables....
4) users can only access the attachments that are validated.
5) attachments can only be accessed through the link on the "detailed page", and for this, you need an id and a string of digits and number, 32 units long. That should possibly prevent somebody form downloading all of them .

Why should the handling be different between static and dynamic pages?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
Hi Yogi,



Sounds well thought out and a very functional design.

Let me know when it becomes available please.



Thanks!
Quote Reply
Re: [yogi] Attachment Plugin In reply to
re: static/dyamic:

Brief example. The admin validates or authorizes a modification in a link, and a modification in the attachment, or a deleted attachment. This is *not* reflected in a static site until a rebuild. The permutations of this get somewhat messy, it just depends on how far you want to take it.

Also, for instance, I was also allowing the possiblity of an admin allowing users to modify, add or change attachments to links that were validated, and if you think about that, there are 5 or 6 permutations of that scenario alone :)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Attachment Plugin In reply to
Yes, it's true that modifications to the attachments are not reflected on a static site until you do a rebuild, but that's the same with links. I don't think that's a problem.

On my site, everything visitors see is admin validated (which is a sensible thing I think), and the pages are static (which is yet another sensible thing...).

I have however also thought about other setups, because I know that not everybody has the same setup as I do:

1) If you let users modify the attachments without admin validation, you have to be more careful, of course. Then you will have to make a difference between static and dynamic pages (OK, so you are right, there is a difference).

2) There will be many variants, depending on whether your pages are only dynamic, only static, or mixed. Only dynamic, or only static are no problem (you reflect the changes immediately on dynamic pages, and with the next build with static pages).

3) Mixed pages are more of a problem. You basically have two options: either add/delete the attachments right away, (so that they will be visible for dynamic pages only until your next rebuild) or wait with adding/deleting them until the next rebuild (at the cost of dynamic pages which are not completely up to date). You have to compromise there....

BTW, the plugin at the moment does not support users to edit the attachment descriptions. Once it's uploaded they can either keep it or delete it and upload it with a new description.

Do many people use mixed dynamic/static setups? I would imagine that people use either of them, but I'd like to learn if this is not so. I'd also like to know the reasons for using a mixed setup.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [Teambldr] Attachment Plugin In reply to
The Attachment plugin is (almost) ready for release!

Features:

  • User/Administrator can attach files to links. The attachments can be images, but also any other sort of files.

  • Users can easily upload/delete attachments when adding and modifying links.

  • Admin may set filters, to prevent certain files from being uploaded (e.g. *.exe files), or to allow only certain content types (e.g. image/* if you only want to upload images).

  • Admin may put restrictions on who may upload attachments (everyone, registered users, editors, administrators).

  • Admin may validate attachments (same rules as for validating links).

  • Admin can set maximal size per attachment, maximal number of attachments per link, maximal total number of attachments, maximal total size of attachments.

  • Attachments can be stored "privately", and the admin can control access to attachements (everyone, or only registerd users).

  • Attachments can be stored "publicly", to reduce server load (this is useful for public images that are accessed directly, i.e. not through the script).

  • Attachments are only accessible with a special unique key (which is different for every attachment). This prevents malicious users from automated downloading all your attachments.



The plugin can be useful for attaching files to a link (I will use it forattaching registration forms and leaflets for yoga workshops), but also for storing e.g. images with a link.

I have tested it thoroughly, but before I release it, it would be great if somebody (one or two persons) could help testing it. If you are interested, contact me by email or PM (indicating your website, etc, so that I know where I can find you). Thanks.

If no major bugs are found, I will release the plugin in a few days. The price of the plugin will be USD 50.

Comments/suggestions are welcome as usual.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
Hi Ivan,

I wanted to throw out a couple potential uses and see if I have it straight for use.

* Attach images to a link that are associated to the link. Such as a specific models link where the model could attach pics from their portfolio for public viewing.

* Sites that have a link can upload a banner and attach it to the link for users to download and attach to thier site with.

* An event link could attach a registration form to their link to allow users the ability to download thier registration form. Print it, fill it out and fax it in.

* and more...

How does the link appear with the attachment? Is it a HL like the "review this link" tag?

Thanks in advance!Wink
Quote Reply
Re: [Teambldr] Attachment Plugin In reply to
Hi Brian

1. Yes, possible.
2. Yes, possible.
3. Yes, possible.
4. much more, yes....

As an admin, you can decide if all attachments should be "normal", or "public". Or you can just set a default, and let the user decide.

How the link appears is completely up to you, it's template based. Technically speaking, on the link.html and detailed.html templates, you get a loop "link_attachments" (with all the attachments a user is allowed to view, not the forbidden ones), and you can display the information in whichever way you want. The plugin comes with a simple template for displaying the attachments (see screenshot in the first post of this thread).

Does that answer your questions?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
Yes Ivan...Thanks!



This sounds VERY interesting for sure.

The layout looks to be very flexible as well so customization seems to be wide open.

Nice work!

I am thinking about which sites this product may apply to in my stable. It seems that a site running detail pages would really see this as a nice add on. I currently only have 2 sites running detail pages.

I see this is really a neat add on to an events calendar site that would allow the listing agent the ability to attach their conference registration form, event brochure, schedule of events, etc... with their link. As well a site could create their own HTML advertisment page and attach it to their link.

Can the link owner create a password protected link as well? Such as a download site? Just another thought!Cool
Quote Reply
Re: [Teambldr] Attachment Plugin In reply to
In Reply To:
Can the link owner create a password protected link as well? Such as a download site? Just another thought!Cool

I knew you would ask that Wink. It's not possible at the moment, but if you buy the plugin for two of your sites, I could add it in.

The user could specify a password for a link, and people are asked for the password if the want to view/download the attachment. The user is responsible for giving out the password, but this would also mean that people would have to somehow get in contact with the link owner to get to know the password.

A different solution would be to allow the link owner to add registered users to a list of people who can download the attachment. This would be more work, but it would also be cleaner in a way. What would be the best solution: have a download list per link (such that if a user is on the list, they can download all attachments if the link), or per attachment?

Tell me more about the specific situation you would want to use this for.

EDIT: what would be easier is to set this up site-wide, i.e. the admin can have a list of which users may download attachments, or have a rule that only users with e.g. "hasPaid = yes" can download the attachments. This would be much (as in MUCH) easier than both the above.

Ivan
-----
Iyengar Yoga Resources / GT Plugins

Last edited by:

yogi: Aug 18, 2002, 7:22 AM
Quote Reply
Re: [yogi] Attachment Plugin In reply to
On a dating site I recently saw they used a permission system that allowed the listing owner the ability to control who saw thier pictures. Permission is given by the user asking for permission from the link owner and the link owner just clicks a check box that allows the user access to their pictures.

This is like a "group" that the new user is added to when the link owner allows access.Smile
Quote Reply
Re: [Teambldr] Attachment Plugin In reply to
So basically, there would be a link next to every attachment (or link) that a registerd user can click. It would bring them to a special page, where they could fill in reasons etc.

The system would notify the link owner that someone wants to see their attachments, and the link owner then goes to a special page, where they can decide whether to give access to the user or not.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
With the site I spoke of they had one link that stated "Ask for permission to view photos".

You select that link and it brings up a box for communications that allows them to write in a personal message to the link owner. It is then sent via email to the link owner.

The link owner receives the email and then goes to a page that has the links "Allow Access, Deny Access". They slelect the link they find more accurate and then an email reply is sent to the user that asked for permission. This will state "X Link Owner has given you permission to view X Link onwers photos" or "X Link Owner has denied you access to their photos".

Make sense?Crazy
Quote Reply
Re: [Teambldr] Attachment Plugin In reply to
Yes, makes perfect sense.

Are you saying that this is the thing you need also for yourself, or are you just thinking about what could be done in general with this plugin?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Attachment Plugin In reply to
I think that this kind of permissions system is what I will be using on my dating site as well