Wedge

Public area => The Pub => Plugins => Topic started by: Dragooon on March 20th, 2012, 11:10 AM

Title: [Plugin] Improved attachments upload
Post by: Dragooon on March 20th, 2012, 11:10 AM
A quick little plugin, this takes advantage of modern browser's ability to upload via XHR(AJAX). Features :

- Supports multiple selection, drag and drop into attachments area
- Shows progress of the current upload
- Supports client side validation of attachments including file size

Note that these features will only work on modern browsers with support of XHR upload, for older browsers it will resort back to default behavior.

Thanks :)
Title: Re: Improved attachments upload
Post by: MultiformeIngegno on March 21st, 2012, 09:07 AM
Why don't have this in core (with a fallback to older browsers)? :)
Title: Re: Improved attachments upload
Post by: Antes on March 21st, 2012, 09:42 AM
Agree. It could be good if it in core with (Not working? Try simple uploader) -mode-
Title: Re: Improved attachments upload
Post by: Arantor on March 21st, 2012, 10:47 AM
As I understand it, it would need to be rewritten again to work with the attachment uploader currently in Wedge (which, you'll notice, is not the same one SMF has)
Title: Re: Improved attachments upload
Post by: Dragooon on March 21st, 2012, 02:21 PM
Quote from Arantor on March 21st, 2012, 10:47 AM
As I understand it, it would need to be rewritten again to work with the attachment uploader currently in Wedge (which, you'll notice, is not the same one SMF has)
The uploaders are fairly similar(This one is mostly based on the current one in Wedge) but I had to overwrite the current JS events to better fit the bill. But yeah, it will require some working to make use of the current Wedge functions. I find it better as a plugin anyway. Not everything should be in core by default :P
Posted: March 21st, 2012, 02:20 PM
Quote from Antes on March 21st, 2012, 09:42 AM
Agree. It could be good if it in core with (Not working? Try simple uploader) -mode-
In all honesty, "Not working? Try..." type things are the worst. It should not be left for the user to decide what to do. Why tease them with a feature which will not work. eh?
Title: Re: Improved attachments upload
Post by: Arantor on March 21st, 2012, 02:24 PM
I don't really have a problem with this being core, if someone wants to rewrite it (because I don't), but it doesn't bother me if we don't either, as I'm happy enough with the current attachments stuff, current bug with it notwithstanding.[1]
 1. It sometimes pushes things in reverse order. Eh, I'd deal with it in due course.
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on March 30th, 2012, 07:26 PM
I had a fairly good idea for this plugin that I forgot. Damn I need to take more notes.
Title: Re: [Plugin] Improved attachments upload
Post by: Arantor on March 30th, 2012, 07:30 PM
I know that feeling. I've forgotten a good many ideas that way.
Title: Re: [Plugin] Improved attachments upload
Post by: Nao on March 31st, 2012, 01:12 AM
I vote for core. With all my heart.
Title: Re: [Plugin] Improved attachments upload
Post by: Arantor on March 31st, 2012, 01:18 AM
I have no objections to it being core if someone wants to do the work necessary to integrate it with what we have, handle limits and so on. It's just not something I've been too concerned about; the core has something better than what SMF had, and it is more usable (even if it has one side bug) but this would make it awesome. I just don't have the brain power to implement it myself right now.
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on March 31st, 2012, 09:00 AM
Thanks :), I'd rather have it as a plugin now(Even if it becomes an official one), because I don't see it being much prettier(code wise) even if integrated into core itself. Plus I'm too lazy to do that ATM :P, although I'll try to take a look at it in a while.
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on March 31st, 2012, 02:10 PM
Now supports client side validation and I improved the drag and drop area.

Updated first post with screenshots.
Title: Re: [Plugin] Improved attachments upload
Post by: MultiformeIngegno on March 31st, 2012, 03:53 PM
Nice indeed! :cool: :cool:
Title: Re: [Plugin] Improved attachments upload
Post by: godboko71 on April 1st, 2012, 10:29 PM
Sexy plugin. Could leave it as plugin and include it later in core if its popular.
Title: Re: [Plugin] Improved attachments upload
Post by: Arantor on April 1st, 2012, 10:30 PM
We can indeed do that too :)
Title: Re: [Plugin] Improved attachments upload
Post by: live627 on June 10th, 2012, 03:52 AM
Quote from Antes on March 21st, 2012, 09:42 AM
Agree. It could be good if it in core with (Not working? Try simple uploader) -mode-
Would be better usability wise if a standard file input was shown and if JS determines if XMR upload is supported, replace with the drop elements.
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on June 10th, 2012, 09:34 AM
Quote from live627 on June 10th, 2012, 03:52 AM
Quote from Antes on March 21st, 2012, 09:42 AM
Agree. It could be good if it in core with (Not working? Try simple uploader) -mode-
Would be better usability wise if a standard file input was shown and if JS determines if XMR upload is supported, replace with the drop elements.
That's what the plugin does ATM.
Title: Re: [Plugin] Improved attachments upload
Post by: kiano on June 13th, 2012, 01:36 PM
guys, how can I download this plugin?
Title: Re: [Plugin] Improved attachments upload
Post by: ziycon on June 13th, 2012, 01:42 PM
Quote from kiano on June 13th, 2012, 01:36 PM
guys, how can I download this plugin?
Just curious as to what you're looking for and what you intend to do as Wedge hasn't even been released yet?
Title: Re: [Plugin] Improved attachments upload
Post by: Nao on June 13th, 2012, 02:42 PM
Yeah, lol...

Silly as it sounds, though... How can I download this plugin?
What, we sure could use it on wedge.org itself... :lol:
Title: Re: [Plugin] Improved attachments upload
Post by: Norodo on June 13th, 2012, 02:49 PM
Guys, guys.

If we can get our hands on this plugin, maybe we can create a GUI interface using visual basic to get our hands on the Wedge sourcecode!
www.youtube.com/watch?v=hkDD03yeLnU(http://www.youtube.com/watch?v=hkDD03yeLnU)
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on December 3rd, 2012, 08:40 PM
Uploaded this to AeMe as well, after adding a little fix to prevent form submission during upload (translation required here Nao :P). Again, this has the full potential to kill your cat. Don't blame me.
Title: Re: [Plugin] Improved attachments upload
Post by: Powerbob on December 4th, 2012, 03:46 AM
Very nice, like this a lot :cool:
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on March 9th, 2013, 09:46 AM
Quote from Plugin revs
Dragooon, I'm still waiting for your approval to change the author ID to Wedgeward
Nobody told me about this? I didn't even know there was an alternative copy of this plugin in Wedge's plugin repository :P. I don't mind the author ID change, but there has to be a better way to maintain the repository. Can't it be some sort of svn:external with the master in my GitHub account?
Title: Re: [Plugin] Improved attachments upload
Post by: kimikelku on March 9th, 2013, 06:20 PM
It gives a friendly interface and thats always good. :)
Title: Re: [Plugin] Improved attachments upload
Post by: Arantor on March 9th, 2013, 10:48 PM
/mebangs the core feature drum :P
Trouble with making things into core features is that I'm not a fan of 'core plugins' and that prevents easy linkage back to repos.
Title: Re: [Plugin] Improved attachments upload
Post by: live627 on March 9th, 2013, 11:47 PM
Remember the bug where a selected word in the posting box being dragged would trigger this plugin's event?  That's why it was removed from this site...

BTW, whatever became of the ambitious dream to replace attachments with media items?
Title: Re: [Plugin] Improved attachments upload
Post by: Arantor on March 9th, 2013, 11:53 PM
Sure I remember that. I'm still convinced it's ultimately not a blocker for it being a core feature, but simply that the selector is not as selective as it should be about grabbing events.

Mostly I think Nao and I have been quietly hoping the other will have a sudden idea on how to solve the architectural issues that come out of it but I think that in the end I'll just have to go in and do it. There is one aspect to it that is rather awkward to solve but not unsolvable, it's just figuring out how to do it without breaking the crap out of everything.
Title: Re: [Plugin] Improved attachments upload
Post by: live627 on March 10th, 2013, 12:18 AM
Quote from Arantor on March 9th, 2013, 11:53 PM
Sure I remember that. I'm still convinced it's ultimately not a blocker for it being a core feature, but simply that the selector is not as selective as it should be about grabbing events.
If only drag events let us see if any files are being dragged, then such would be easier.
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on March 10th, 2013, 06:57 AM
Quote from live627 on March 9th, 2013, 11:47 PM
Remember the bug where a selected word in the posting box being dragged would trigger this plugin's event?  That's why it was removed from this site...

BTW, whatever became of the ambitious dream to replace attachments with media items?
That stupid ass bug isn't fixed yet? I swear I fixed it months ago...its a pretty simple fix.
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on March 10th, 2013, 08:13 AM
And fixed(https://github.com/Dragooon/MultiAttach/commit/eb7b58e7c5f69edc7453a34749e3594ac7c3e057) (lightly tested, didn't do a cross browser test), also merged the changes Nao did in Plugin repository
Quote from live627 on March 10th, 2013, 12:18 AM
Quote from Arantor on March 9th, 2013, 11:53 PM
Sure I remember that. I'm still convinced it's ultimately not a blocker for it being a core feature, but simply that the selector is not as selective as it should be about grabbing events.
If only drag events let us see if any files are being dragged, then such would be easier.
You can, actually (see my commit above), it's slightly more awkward since you can't directly access files object while the element is being dragged.
Title: Re: [Plugin] Improved attachments upload
Post by: Nao on March 11th, 2013, 04:49 PM
Quote from Dragooon on March 9th, 2013, 09:46 AM
Quote from Plugin revs
Dragooon, I'm still waiting for your approval to change the author ID to Wedgeward
Nobody told me about this?
I mentioned it in another topic...
Well, the plugin isn't "public" yet, so I didn't bother to ask you too much.
Quote from Dragooon on March 9th, 2013, 09:46 AM
I didn't even know there was an alternative copy of this plugin in Wedge's plugin repository :P.
I renamed it several times.
Quote from Dragooon on March 9th, 2013, 09:46 AM
I don't mind the author ID change, but there has to be a better way to maintain the repository. Can't it be some sort of svn:external with the master in my GitHub account?
I wouldn't know how to use externals or whatever... :^^;:
Posted: March 11th, 2013, 04:49 PM
Quote from live627 on March 9th, 2013, 11:47 PM
Remember the bug where a selected word in the posting box being dragged would trigger this plugin's event?  That's why it was removed from this site...
I didn't remove nothing from no site, sir! Or did I..?
I don't even know what bug you're talking about.
Quote
BTW, whatever became of the ambitious dream to replace attachments with media items?
Ahh.......................................
Title: Re: [Plugin] Improved attachments upload
Post by: Arantor on March 11th, 2013, 04:51 PM
And even if it does become a core feature, it won't work nicely through externals because core feature implies not being bridged through the plugin manager... so it would need to be a separate tree anyway.
Quote
I don't even know what bug you're talking about.
There was certainly a bug with it affecting events and at least once it was disabled for that reason.

It is currently disabled but there's other reasons why that might be (as other plugins are also disabled without any reason I'm aware of for that)
Title: Re: [Plugin] Improved attachments upload
Post by: Nao on March 11th, 2013, 04:53 PM
Hmm, didn't get a "new post" warning when sending the last one, even though I'd posted another... Maybe because it was one of mine..?
Quote from Arantor on March 9th, 2013, 11:53 PM
Sure I remember that. I'm still convinced it's ultimately not a blocker for it being a core feature, but simply that the selector is not as selective as it should be about grabbing events.
(Eh..?!)
Quote
Mostly I think Nao and I have been quietly hoping the other will have a sudden idea on how to solve the architectural issues that come out of it but I think that in the end I'll just have to go in and do it. There is one aspect to it that is rather awkward to solve but not unsolvable, it's just figuring out how to do it without breaking the crap out of everything.
The reason that topics don't use AeMe for attachments is, errr... It's not an *architectural* issue (what's to be afraid of? Creating a generic "Attachments" album where all attachments will go..? Adding a feature to keep track of all topics that make mention of an item? I also wanted to code that one anyway...), it's more that I'm a perfectly reasonable man, and the days I spent on AeMe were crazy, and I did a lot on it, and I know that even after I did all that, there were still tons of bugs, and I was weary of moving the bugs to the attachment system.
But really, the real reason, in reality, is really that, really, I'm super-fucking lazy and I try to focus on features that require less than a week to implement... And this one... It even requires writing a converter!! Eh!! And I'm not going to ask TE to do it... :^^;:
Title: Re: [Plugin] Improved attachments upload
Post by: Arantor on March 11th, 2013, 04:59 PM
Quote
Hmm, didn't get a "new post" warning when sending the last one, even though I'd posted another... Maybe because it was one of mine..?
Hmm, it should still have warned. Something is very much amiss.
Quote
(Eh..?!)
There's a bug report somewhere around here of someone using the select+drag of text to move it around, except the event was captured by the drag 'n' drop.
Quote
It's not an *architectural* issue (what's to be afraid of? Creating a generic "Attachments" album where all attachments will go..?
The problem that I mention isn't that at all, I wouldn't mind but I have mentioned it multiple times now.

If you have an attachments system like that, you need to be able to reference the topic it came from, not so much for 'which topics use this' but 'can the person see this attachment'. Would really suck if attachments could be leeched without having proper board access.

Right now, access to a given file is based on its album. But that doesn't work for attachments whose access rights are implicitly different. Thus you need to be able to indicate where a given media item is supposed to get its authentication from, be that an album or thread access. Or, indeed, anything else you care to think of, e.g. helpdesk attachments.

I did suggest one method of doing this but you weren't very keen on it.
Title: Re: [Plugin] Improved attachments upload
Post by: Nao on March 11th, 2013, 05:20 PM
And I didn't get a warning for that post either...

Although I just got one for your latest, but it's because you posted it before I hit the Reply button, so I had the warning at post time, not post2 time, basically.
This needs fixing, because it will make people miss on posts, as they're expecting to be told when someone posted in the meantime...
Quote from Arantor on March 11th, 2013, 04:51 PM
There was certainly a bug with it affecting events and at least once it was disabled for that reason.
Probably some discussion I missed. Did that happen after I restored your admin access, maybe..? Otherwise it must be a very old discussion, and I remember having the plugin enabled here...
Quote
It is currently disabled but there's other reasons why that might be (as other plugins are also disabled without any reason I'm aware of for that)
It got disabled when I changed its name, but I'm pretty sure I re-enabled it...
Posted: March 11th, 2013, 05:14 PM
Quote from Arantor on March 11th, 2013, 04:59 PM
Hmm, it should still have warned. Something is very much amiss.
That 'last' param in the URL... Is it only checked against correctly...?
Quote
The problem that I mention isn't that at all, I wouldn't mind but I have mentioned it multiple times now.
Oh, don't talk down to your elders! I'm young enough to remember things! Well, at least part of the things! What was I talking about, already..?
Quote
If you have an attachments system like that, you need to be able to reference the topic it came from, not so much for 'which topics use this' but 'can the person see this attachment'.
I'm of the opinion that this should be done at post time... i.e. if you post an attachment from within a certain topic, get the topic, then the board, get its group list, attach these groups to the item's permissions.
Hmm, does that imply creating a new album on the fly, matching these..? I don't know. I don't remember if AeMe has a setting to fine-tune permissions per-item. I'M NOT OLD!!! I'm just rusty.
Quote
Would really suck if attachments could be leeched without having proper board access.
Well, in some situations I suppose you wouldn't mind...
Quote
Right now, access to a given file is based on its album. But that doesn't work for attachments whose access rights are implicitly different. Thus you need to be able to indicate where a given media item is supposed to get its authentication from, be that an album or thread access.
Or we could just store the id_board in the item table, yeah, and do a {query_see_board} on that.
Quote
I did suggest one method of doing this but you weren't very keen on it.
I don't rem....I'm not old!!
Title: Re: [Plugin] Improved attachments upload
Post by: Arantor on March 11th, 2013, 05:26 PM
Quote
Did that happen after I restored your admin access, maybe..? Otherwise it must be a very old discussion, and I remember having the plugin enabled here...
Dunno, not sure.
Quote
It got disabled when I changed its name, but I'm pretty sure I re-enabled it...
Others are disabled, e.g. Users Online Today.
Quote
That 'last' param in the URL... Is it only checked against correctly...?
It should be a num_replies parameter?
Quote
Oh, don't talk down to your elders! I'm young enough to remember things! Well, at least part of the things! What was I talking about, already..?
I guess it's just one of my bugbears that I've gone on about it at times and don't see a solution other than what I'd proposed but you weren't keen on it.
Quote
Well, in some situations I suppose you wouldn't mind...
In some you wouldn't, true, but in those cases the board would be set up to show attachments to guests, i.e. you'd intended to make it the case.
Quote
I'm of the opinion that this should be done at post time... i.e. if you post an attachment from within a certain topic, get the topic, then the board, get its group list, attach these groups to the item's permissions.
Eeek, no. What if you later want to change permissions? You'd have to update all the related items.
Quote
Or we could just store the id_board in the item table, yeah, and do a {query_see_board} on that.
Which is 50% of what I originally suggested.

We would need two columns: type and contextual id. For album items, this would be 'album' and the album id. For regular attachments this would be 'board' and the board id. Or topic id, actually, since there's per-topic privacy.

Then in the file server, you'd fetch the item, figure out what it wants to do to authenticate, check it, and if all good, serve it. The trick is making it extensible.

I don't remember why you weren't keen on it though.
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on March 12th, 2013, 08:53 AM
Bug, I can't get the drop area to appear after dropping my first item. Will have a look at it in a while.
Title: Re: [Plugin] Improved attachments upload
Post by: Nao on March 12th, 2013, 09:48 AM
I installed your copy yesterday, but didn't look into it I have to admit.
Title: Re: [Plugin] Improved attachments upload
Post by: Dragooon on March 12th, 2013, 10:50 AM
Quote from Nao on March 12th, 2013, 09:48 AM
I installed your copy yesterday, but didn't look into it I have to admit.
It's also present in previous svn version without any of my changes.