Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Would be nice, if users can use IMCE for file browsing instead of default media browser.
Here is a patch to add IMCE integration to media browser. You can choose between original media browser and IMCE.
The second little patch just add a "cancel" icon to IMCE (1.3 or dev). BTW: Everything work without the cancel icon.
Comment | File | Size | Author |
---|---|---|---|
#10 | media-7.x-1.x-dev.2011-MAY-26-IMCE-2.patch | 20.86 KB | szaszg |
#8 | media-7.x-1.x-dev.2011-MAY-26-IMCE-1.patch | 22.12 KB | szaszg |
#7 | media-7.x-1.x-dev.2011-MAY-26-IMCE.patch | 24.21 KB | szaszg |
#4 | media-7.x-1.x-dev.2011-MAY-10-IMCE.patch | 23.61 KB | szaszg |
#1 | media-7.x-1.x-dev.2011-Apr-11-IMCE_2.patch | 7.54 KB | szaszg |
Comments
Comment #1
szaszg CreditAttribution: szaszg commentedHere is a new, cleaner better patch for the 7.x-1.x-dev 2011-Apr-11...
Comment #2
JacobSingh CreditAttribution: JacobSingh commentedOn the whole, this is good code. I've made a few comments below.
Architecturally though, I don't think this is the right approach. @james.elliott is reworking a lot of the bad JS in the media browser code to make it easier to work with, and I think as part of that he's going to consider how to support different browsers.
We're looking at creating a views based browser for instance, although this would only affect the library tab, not every tab. Still, if we are going to support more than one option for browsers, we should make that a pluggable hook, not hardcode "use_imce" in various places. Perhaps as a start to get this in so people can use it, we could build two patches.
One would be a new module in the contrib directory "media_imce" which would contain all the code you've put in here. And the other would be patches to media which would allow the user to pick a browser to use. I think this means a variable to set the default browser site wide and a setting at the element level to choose the browser. So:
The default would be site wide set to a variable, but depending on where the element was added it could choose a specific browser.
Thoughts?
Patch should start inside the media module directory.
Is this going to work with different themes?
Powered by Dreditor.
Comment #3
JacobSingh CreditAttribution: JacobSingh commentedComment #4
szaszg CreditAttribution: szaszg commentedHere is a new reworked patch:
- new "sub" module `media_imce'
- new hook in media.api.php: hook_media_browser_info()
- media_browser_build_media_item() go into `media.module' in order to "sub" modules can use it
- media_media_browser_info() and media_browser_media_callback() implemented in `media.module'
- radio input for selecting media browser (site wide) in `includes/media.admin.inc' (this use the hook...)
- in `includes/media.browser.inc' media_browser_js() now include the selected browser settings and js file (this use the callback...)
- the (builtin/default) browser popup code removed from `js/media.popups.js'
- the (builtin/default) browser popup code inserted into `js/media.popups.media.js'
Comment #5
szaszg CreditAttribution: szaszg commented"Is this going to work with different themes?" -- I think so, because this set the IFRAME width where IMCE pop ups. If we leave the IFRAME width as is than IMCE's scroll bar at the right shown only partially.
Comment #6
aaron CreditAttribution: aaron commentedthis is awesome, thanks szaszg! it's definitely been a goal of the project since the beginning to have media allow for pluggable browsers. it's great to see a push in that direction, with a usable alternative!
Comment #7
szaszg CreditAttribution: szaszg commentedHere is a patch for current dev.
Comment #8
szaszg CreditAttribution: szaszg commentedHere is an updated patch for current dev.
Comment #9
aspilicious CreditAttribution: aspilicious commentedLook again at the coding standards and try to remove tabs, white spaces, "no newline at end of file" warnings.
You should try dreditor (in combination with firefox and chrome) to checkout your patch in here.
Comment #10
szaszg CreditAttribution: szaszg commented"... try to remove tabs, white spaces, "no newline at end of file" warnings." sorry, but how can i do it exactly?
Tabs??? There is no any tab in the whole media/media_imce code.
In the patch the tabs came from the diff itself, because it separate header elements with tabs... what is the problem????
This patch isn't a "cosmetic" patch of the code, so i do not think I have to trim the "original" code... and I try to avoid "tabs" and "extra" spaces in my code already.
The "no newline at end of file" warning came from the "original" code because the original "media.api.php" file has no newline at the end... so i can do nothing with it.
"You should try dreditor" .. sorry, but dreditor only for drupal 6.x and i use drupal 7.x.
So I try 'coder' on my patch and this report only 9 "error": 7 with severity minor and 2 with normal. One of the normal is a total miss, because the whole thing is in a comment and 'coder' talk something about string concatenation. Most of the errors came from the "original" code (this false error too), so after fixing, 4 minor and 1 normal "error" left.
Just to compare my patch and the "original" code: 'coder' found 12 error with critical severity and about 60 with normal severity in the original media module code...
Here is a revisited patch:
Comment #11
Vasu CreditAttribution: Vasu commented+1
Comment #12
aspilicious CreditAttribution: aspilicious commentedDreditor is an chrome and firefox extension, if you install it there will be a review button next to your uploaded patch if you click it you get red warnings when you did something wrong like using trailing whitespaces.
As it is a browser extension it doesn't matter what kinda version of drupal you're using :)
Comment #13
arthurf CreditAttribution: arthurf commented@szaszg since media 7.x-2.x is going to have some significant rewrites to the browser and surrounding JS should we hold on this patch until that gets worked out?
Comment #14
szaszg CreditAttribution: szaszg commentedUhum... I created a sandbox module (http://drupal.org/sandbox/szaszg/1296442) which provides a Media browser plugin with IMCE.
Comment #15
CarbonPig CreditAttribution: CarbonPig commentedsubscribe
Comment #16
michiellucas CreditAttribution: michiellucas commentedwhen installing the sandbox module i get following error
Fatal error: Class 'MediaBrowserPlugin' not found in /www/sites/all/modules/contrib/media_browser__imce/media_imce.module on line 53
Using latest release of media
Comment #17
jisuo CreditAttribution: jisuo commentedIs there any update on this integration?
Comment #18
mgiffordPing... Been over a year now, can we assume this isn't getting in the next release?
Comment #19
sonicthoughts CreditAttribution: sonicthoughts commentedbummer - made sense.
Comment #20
lesleyfernandes CreditAttribution: lesleyfernandes commentedsubscribe
Comment #21
mgiffordGenerally folks are encouraged to Follow rather than "subscribe".
Anyways, it's been a while now. I do wonder if the bots have been engaged in doing an automated review.
The last release was from 2014-Jan-08 so it's over due for a new stable release.
Comment #30
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team