|Status:||closed (won't fix)|
|Issue tags:||Media Sprint 2011|
The media browser has great need of code trimming. The implementation in 7.x-1.x-dev has several issues. The major ones I would like to see fixed are in the following list:
- The media dialog launches to hold an iframe with several tabbed forms within. This creates a suboptimal situation where we are trying to pass events and data to and from the iframe. The implementation is hacky and overly complicated. The most egregious example of this is the code that adds fake submit and cancel buttons that then pass events out of the iframe and click the okay and cancel buttons that are created as part of the jQuery dialog.
- The code that creates and displays the listings of media at admin/content/media and within the library tab should be the same. We have two separate implementations and UX for selecting pieces of media. This is an unnecessary redundancy of code.
- Implementing a media browser plugin requires that all functionality be handled by the implementing plugin.
Of these two things, I think that the first is the biggest issue. The complexity of media.popups.js and media.browser.js makes it very difficult to make changes and improvements to the browser. The following is what I would propose as fixes for the current implementation.
- Rather than calling an iframe inside of a jQuery dialog. Use Drupal's AJAX system to return settings and content to be placed within the jQuery dialog.
- Transition the implementation of the browser from functions with callback arguments to an event based system
- Simplify media browser plugin implementation so that it can be extended more easily. This ties into the JS side having an event based system.
- Alter the media listings so that they are reusable.
- Re-implement the library plugin in such as way as it is able to use any of the media listing displays