Closed (fixed)
Project:
Media Browser Plus
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
11 Nov 2010 at 17:02 UTC
Updated:
28 Apr 2011 at 13:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
JacobSingh commentedSweet! This is a nice start.
Do you see how creating it as a field will make the code better? Make sure you look at EntityFieldQuery when coding up the filter part.
A couple quick nits:
This needs to be written... I'm a little concerned about the performance of effecting every media item as we update, let's think about this some more. Perhaps we don't need to to update it, and the query code will just assume the default if it is not set? Nah... better to set it.
If we do this here, we should probably do it for other fields created by this mod.
Comment #2
Sebastian.Buesing commentedHey,
well that was quick. Yeah the code really does look better like this. Glad you didn't find the tiny error I had in the first patch :-)
Comment #3
effulgentsia commentedYay, our first issue, and fellow contributor! Welcome, Sebastian!
Related to this, I added a meta issue: #969062: Decide on architectural approach to field management.
Comment #4
Sebastian.Buesing commentedHi,
ability to select folders and create/select tags is now included.
I couldn't test it for the multiple file upload form, since that doesn't work on my drupal install (7.0-dev). I was told that all one needs is the "Plupload integration module" enabled, but by doing so I get a new form whithout any means to add a file. The usual file upload input simply vanishes and is replaced by nothing. :-(
Comment #5
JacobSingh commentedPerhaps you didn't follow the install instructions? Plupload requires a 3rd party library. See the INSTALL.txt or README.txt. Also, might be good to file a ticket to write something which warned people about this.
-J
Comment #6
Sebastian.Buesing commentedHi,
works like a charm if you do this:
actually read the README and do as told:
To install Plupload:
1. Download plupload from http://plupload.com
2. Unzip it in this directory, should look like plupload/plupload
apply this patch to plupload:
http://drupal.org/files/issues/plupload-920038.patch
tagging and (whatever the act of putting sth in a folder is, "folderising" doesn't seem to be a word.) works great for multiple files. :-)
Greetings,
Sebastian
P.S.: Forgot to mention you need to manually resized the iframe using firebug to actually send the form, because otherwise you can't reach the submit button ;-)
Comment #7
Jackinloadup commentedSebastian just an FYI. Ine way i got around that iframe resize bug you mentioned was to switch to a different tab in the uploader, like web, then back to upload. I haven't investigated this bug yet. I'm pretty sure there is not an issue for it yet either.
I can't wait to try out the folders.
Thanks for all the hard work everyone!
Comment #8
JacobSingh commentedJames.elliot knows something about this, he's been working on it. We try to resize the window to fit its contents, and IE lags behind a bit in firing the event handler, or something like that.
Comment #9
JacobSingh commentedNice, I just tested this out! I see what you mean about the window resizing.
Here's the issue for that if someone has ideas:
#917684: plupload tab of media browser too short in IE
Fixing that is dependent really on committing this since it will make it look like poo. :(
In regards to the patch itself, a couple general things:
-- Read http://drupal.org/coding-standards
In particular, you're indentation settings in your IDE are wrong.
-- For the folder list, use an indented select list like the one provided by the taxonomy module. I don't know off the top of my head where to find this, but I think it is in options_field_widget_form();
This might be a bit of a complex approach, but if you can figure it out, it will provide a more consistent interface for this field. Maybe something with
field_attach_form('media', $fake_item_with_type_set, $form, $form_state);But just a WAG (Wild-Ass Guess).
Eventually, we'll probably want to build a custom interface since these type of select boxes are terrible for large hierarchies.
Best,
Jacob
Comment #10
JacobSingh commentedComment #11
james.elliott commentedI'm taking a fresh pass at #917684: plupload tab of media browser too short in IE so I wouldn't consider that blocking
Comment #12
Sebastian.Buesing commentedHi,
I have another patch for you guys to rip apart with constructive criticism:-)
This one is in a way still a working progress but already functional. I have added a drag and drop interface to the media grid view, which allows to drag media into different folders and load folder contents.
First off if you want to test this, you need to also unzip the appended zip archive in the mbp root directory.
The following functions
are a basicly some older functions I reused for drupal, but I'd still like some feedback on those, maybe their is also some internal stuff that could be better used instead.
Also I wasn't really sure how to handle an AJAX Request (for example the one I use to load the images) properly in Drupal and since I'm somewhat under pressure to finish this, I used the most drupal like way I could think of, that suited my need. However I'd love to take a second look and redo this part as well.
Another part is that I haven't had time to fully investigate is how to load/filter media, meaning that I'd love to know how load entities (i.e. media entities) and pass on a field value condition for the load. Of course I'll look myself for a solution, but since I'm on the road tomorrow maybe sb is faster :-)
That'll be all for now.
Greetings,
Sebastian
Comment #13
JacobSingh commentedWow! You've been busy. Btw, I just unblocked you I think on the window height issue.
I won't be able to look at this for a few days. Could you please try to start posting screenshots / mockups? For new features which impact the UI, it makes everyone's life easier if you can send up your plans visually before you start coding. Then if there is any discussion that needs to occur, it's not frustrating because you haven't already built the damn thing :)
I understand though that sometimes, you have to just start building it to know what it is eventually going to look like. At any rate, I'll get to this as soon as I can, and if you don't hear from me by Monday, please ping me.
Thanks!
Jacob
Comment #14
JacobSingh commentedBefore I review any further, please review the coding standards doc. It is GREAT you are contributing, and it pays off big time in the long run to get your addition into the module and not maintain a fork, but you've got to follow the conventions and use coder module. I know it's annoying, I've gotten this same lecture several times, but the people who gave it to me (although often rude and petty) were right in this regard.
I noticed right away using:
Curlies go on the same line.
And stuff like:
(indentation is set incorrectly).
Please take a moment (it won't take but 10minutes) to just check the indentation, spacing, etc and try to submit a clean patch.
NOTE: I will still review the functionality, etc anyway I'm not a stickler like some people, but I won't commit it till it's at least close.
Comment #15
Sebastian.Buesing commentedHi,
just wanted to tell you that your comments regarding coding style aren't falling on deaf ears. I actually spent a long time the other day trying to remove all none-drupal cs compliant lines. Guess I didn't find them all, my bad I'll recheck when I get a chance and reupload te patch.
Greetings,
Sebastian
Comment #16
luke_b commentedPeter has written a nice Drupal coding standard sniff for PHP_CodeSniffer which you can use with Eclipse, it will find all the (non-compliant) lines automatically. http://drupal.org/node/897116 Have a look!
Regards,
Luke
Comment #17
Sebastian.Buesing commentedHi Luke,
Peter and I already spent some time trying to get his clever little sniffer to work without success. I am in the process of rearanging my developement enviroment which might enable it to work in the future,but first I have to clean up this patch ;-)
Greetings,
Sebastian
Comment #18
Sebastian.Buesing commentedHi,
added 3 files, which sum up pretty much everything I did so far, except for the management of folders (add/edit/delete/sort) which is held back by some menu bug :-(, but so far you can just use the taxonomy interface.
I'll be making some UI Screeshots for some inteface discussion on the weekend and should also be able to work some more on filtering/pagination.
Note:
media-mbp-js-patch-1-2010-26-11-1710.patch (patch for the media module change js behaviour)
and the rest belongs to the mbp module. Zip is to be unzipp in the root of the module.
Greetings,
Sebastian
P.S.: I really looked a lot over this now in terms of coding principles. I sure hope I didn't overlook anything :-)
Comment #19
Sebastian.Buesing commentedHi,
created a function to replace the standard way to load media entities which didn't allow for filtering against field values. List view now allows to filter via folders. Paging however is still in progress.
use files:
- media-mbp-js-patch-1-2010-26-11-1710.patch
- media_browser_plus-1-2010-26-11-1710_additional_files.zip
from previous post to fully apply this patch.
Greetings,
Sebastian
Comment #20
james.elliott commentedThis is really starting to shape up.
There are some minor formatting issues in media_browser_plus.admin.js that I'm not too concerned about. (double indenting)
However, the structure in media_browser_plus.admin.js is fine as jQuery but Drupal handles its jQuery integration is a specific sense. Drupal has its own behavior system that will attach and detach behaviors on page load. jQuery(document).ready() is therefore unnecessary and contrary to the best practices for jQuery in Drupal. This is discussed partway down the page here http://drupal.org/node/756722
I would also recommend to move away from anonymous closures in your javascript. They make stack traces less descriptive and create a circular reference which can lead towards memory leaks and poor performance. This is discussed in the blog post here. http://blog.iconara.net/2006/04/17/wonderful-closures-evil-closures/
Comment #21
james.elliott commentedI'm also noticing that you use the each() function in jQuery when it is unnecessary.
This could just as easily be written like so
The toggleClass() will apply to all of the children, there is no need to use each() to iterate through them.
Comment #22
Sebastian.Buesing commentedHi,
tanks a lot for the feedback. I'll get on it on wednesday. Can't wait to use your input, because I agree thats its becoming quite the nice addition.
Greetings,
Sebastian
Comment #23
james.elliott commentedI did some work on this yesterday.
- I rewrote the Javascript to match Drupal's implementation and use the power of jQuery.
- I rewrote the AJAX callback for media_browser_plus_thumbnailsJSON() to be a page callback and not a form build operation
- I altered the CSS file to match Drupal's CSS style guide.
Comment #24
Sebastian.Buesing commentedHi,
thanks for the patch, but didn't you forget to add the js & css file, so one can actually test the changes you made to thoose or are they not quite finished?
Greetings,
Sebastian
Comment #25
james.elliott commentedDuh, I forgot to add the -N switch to my cvs diff.
New patch attached
Comment #26
Sebastian.Buesing commentedHi, I didn't go through the complete patch, but one thing that came to my mind from the start was that with your new media_browser_plus_thumbnailsJSON() code you might have a typo concerning your folder condition, which will load only the items with the folder id 1 and (scroll down)
secondly why not use the new function I provided to filter/load media?
like so:
I'll have a look at the rest later this evening or tomorrow, but I just wanted to point out this first obvious thing, since I wanted to know if you have a problem with the new function or if you just overlooked it.
Greetings,
Sebastian
Comment #27
Sebastian.Buesing commentedHi,
did find a few mistakes in your patch, changed them and merge the whole patch with my latest stable version. Enjoy and thanks again for the work you put in. I can really see the befinits of the changes you made to the Javacript code.
I tried the -N switch too with fakeadd, but the screwed up alot so once again I did had to add a zip file :-(, but I'll try again next time. ;-)
Greetings,
Sebastian
Comment #28
james.elliott commentedGood catch on the folder always being 1. I had used that for debugging and forgot to fix it before I rolled the patch. And I didn't realize you had added a media_browser_plus_load_multiple(). That looks promising.
I should have some time on wednesday to take a closer look at the state of the patch. I think I can even make a project branch so that we can commit the files there and no longer have to worry about the zip folder while still keeping the main branch viable.
Comment #29
Sebastian.Buesing commentedActually there were some more like that, but I rather just fixed them than point everyone out.
That would really be cool. If you need anything from me to make that work please let me know asap :-)
Comment #30
Sebastian.Buesing commentedHi,
my latest work including some improvements in the UI.
How is it comming with the project branch?
Greetings,
Sebastian
Comment #31
james.elliott commentedSorry about the delay, I've been completely swamped. I'm going to cut a branch today.
Comment #32
james.elliott commentedI cut a stable branch without your patch and then committed everything in #30 to HEAD for development
Comment #33
benanderson commentedsubscribe
Comment #34
benanderson commentedGreat work on this guys, thanks!
The UI enhancements are great, but the only thing I can't seem to get working is creating new folders. Right now "Media Root" is the only option. Am I missing something, or is this a known issue?
Comment #35
Sebastian.Buesing commentedHi,
you're not missing anything. Folder management is already developed but not yet in a patchable fashion. I'll try to add the latest state on next wednesday. For now you can manage your folders in the admin menu under structure -> taxonomy -> media folders.
Greetings
Sebastian
Comment #36
jonaswouters commentedsubscribing
Comment #37
camdarley commentedsubscribing
Comment #38
deepbluesolutions commentedready to help test once dev version can be rolled, good work on such a key feature
Comment #39
mrfree commented@sebastian using your patch I can create new folder and select one during media upload but I can't browse the library, I mean it's still a big repo that doesn't consider the taxonomy "Media Folder" structure
Comment #40
Sebastian.Buesing commentedHi,
have a look here:
http://drupal.org/node/1038062#comment-4113282
I guess that is what you want/mean?
Greetings,
Sebastian
Comment #41
mrfree commentedYup, exactly :)
But if I select an image, adds it to the basket and click on "continue with media basket selection" I simply return on the upload tab and nothing appears in the tinymce editor
Comment #42
Sebastian.Buesing commentedWell if you read the linked issue completely you'll notice I mentioned that this feature isn't working yet and I'm looking for help getting it done ;-).
Please continue the discussion of that feature in the linked issue ;-)
Comment #43
JacobSingh commentedYou'll need update functions for this to work on existing sites I think
Comment #44
vogre commentedThis is the version with working selection.
I added "select" button to bypass media basket.
Not sure if it is better than the version that Sebastian made.
Comment #45
vogre commentedActually I find your approach quite strange. Why don't you use the same technique for grid rendering as media_browser does? Rendering grid in js from JSON'ed media entities?
I had to make additional server call to get required data.
The other issue with Library Plus is lack of filtering by allowed media type.
Comment #46
Sebastian.Buesing commented@vogre:
thanks for your contribution. I haven't tested it yet, but I'm sure if you say it works it'll work :-)
As far as using JSON goes: It was intended from the start, but I wasn't that familiar with JS in the beginning as I am now and I'm happy to change the current loading method to use JSON the same way the current media library does. I think I'll have this up and running later today.
Once again thanks for helping and please criticise more to make this module even better ;-)
@Jacob:
Not sure what you mean with your post.
Comment #47
Sebastian.Buesing commentedHi,
I did finished it last minute (because I've to catch a bus in about 2 minutes). You'll find it here:
https://github.com/Buesing-Sebastian/Drupal---Media-Browser-Plus
Happy Testing ;-)
P.S.: Its not yet finished, but its working. I'll certainly make some improvements to the UI and add media_type support.
Comment #48
camdarley commentedFirst, thanks you very much. This is great!
There is a few issue i noticed:
- I can't delete medias. When i select medias and click "delete" the page reload, but nothing happen. The drupal's error log doesn't report anything.
- If there are medias in the media basket, when i click on "delete", the media basket's content start downloading.
- in "list" mode, media's deletion works
- if I click on the "list" view button, when i quit media overview's page, the button is on "list" mode when i come back, but the view is in thumbnail mode (not a big issue but that could be confusing)
- overlay positioning is wrong when i want to attach media to a field or to a wysiwyg editor. It's in the top left corner instead of page's center
That's all for now. (tested on Safari and Firefox)
Comment #49
Sebastian.Buesing commentedfixed in latest version
I'll have a look.
I tried to make the overlay a bit bigger but that feature is as you did see not quite perfected. Please upload a screenshot with browser(+version) if you run into an error like this please.
Comment #50
camdarley commentedI confirm that the first three issues are fixed with the latest version. Thanks !
About the position of the overlay, that's not a critical issue, but it's a strange behavior anyway.
I attached a screenshot: as you can see, the box is in the left top corner of the page. Before updating, it was at the absolute center. It's annoying when the image fields is at the bottom of the page because users have to scroll to the top to see the box.
Tested on Safari 5.0.3 and Firefox 3.6.14.
Comment #51
camdarley commentedComment #52
Sebastian.Buesing commentedHi,
I guess I used the absolute top position when I should have used the relative position the user has scrolled to. I'll fix this first thing tomorrow morning.
Comment #53
Sebastian.Buesing commentedHi,
should work on most (if not all) browser now in the current version. Tested on windows machine in chrome, ff, safari and IE8.
Comment #54
camdarley commentedHi,
Work perfectly well for me (Safari and Firefox). Great job! Thanks again.
Comment #55
james.elliott commentedThis is looking really good. I've created a "folders" branch in git to continue developing this.
One thing I did notice when taking a quick look was that this appears to no integrate properly with the plupload feature of the media module. There is some sort of JS error when adding files.
Comment #56
james.elliott commentedThe problem appears to have been an outdated version of plupload on my end. I'm going to mark this as "fixed". That way we can continue to improve this in smaller more easily tested, reviewed, and committed changes.
Comment #57
vogre commentedFolders branch is broken.
Missing 'include' directory, media_browser_plus.admin.inc media_browser_plus.folders.inc, etc
Also there is a bug in _media_browser_plus_has_unsorted_media function which prevents display of the Unsorted folder.
The correct code is:
function _media_browser_plus_has_unsorted_media(){
// loading media
$entity_controller = entity_get_controller('media');
$media_entities = $entity_controller->load(FALSE, array(), 0, 100);
Can't make a patch because there is no working version and i don't understand what repo and branch is active now:(
Comment #58
anavarreSubscribing
Comment #59
dmsmidtsub
Comment #60
Sebastian.Buesing commentedHi vogre,
does this error still occur when using this "branch":
https://github.com/Buesing-Sebastian/Drupal---Media-Browser-Plus
the function is more or less an relict of previous versions. Now there shouldn't be no more unsorted media, because all media is assigned to a folder via batch process on enabling the module. I'll remove it shortly.
Greetings,
Sebastian
Comment #62
jason.fisher commented+1
Comment #63
slashrsm commentedWhere is main development of this branch going on? On github or on "folders" branch here? Are there any plans for merge of this into master?
Comment #64
Sebastian.Buesing commentedhttp://drupal.org/node/1115438#comment-4393342 ;-)