Drupal Association members fund grants that make connections all over the world.
This patch is a rethinking of. This time I am attempting to do only what is described in the title - to add modal dialogs to confirmation pages and popup for filter tips and help. The code is a stripped down version of my Drupal 6 Popups API module, but is much less ambitious than that module. While the Popups API attempts to solve the general problem of ajax forms, this patch skirts the issue entirely. Most importantly, this patch works today, as is, without requiring any changes to the Drupal 7 rendering pipeline, or the inclusion of new jQuery libraries.
What this patch provides:
* A simple technique for putting info pages into modal popups, and confirmation pages into modal dialogs.
** Add "drupal_add_popup()" call to page, and set class="popup" for info pages and class="popup-confirm" for confirmation pages.
* Confirmations dialogs on delete of Blocks, Menus, Content Types, URL aliases and Text formats.
* Modal popups for "More help" links, and "More information about formatting options"
* A working solution with a simple logic flow that can be understood by non-ajax experts.
* A themable dialog or message box. The xhtml can be crafted using the standard Drupal theming system. The look and feel can be adjusted in a theme's css files.
* A starting point.
Limitations of this patch:
* It does not attempt handle general ajax form submission. This is a fascinating problem. The d6 Popups API has some of it solved. Nedjo and quicksketch have proposals in place that should solve other parts. I have a couple of half worked out patches. It is a big issue and might not get solved for Drupal 7.
* It does not use json. Which means that the full page is rendered, sent over the wire, and then all but the needed parts are thrown away. This is inefficient, but can be improved when lands.
* It does not warn you if are about to lose your work. The older version of this patch could offer to save your work for you before opening up a destructive popup.
* It does not call attachBehaviors on the ajax loaded content in the dialog box.
* It does not do ajax reloading of the current page. Instead it reload the entire page. Again, this is worth revisting when lands.
* It only works as-is with the Stark theme. It requires the id="page-title" for the page title, and id="content-content" for the page's content, which is the semantics declared in modules/system/page.tpl.php. I will be following up with patches to bring the other core themes into compliance.
* The default popup is not particularly attractive. I was advised on the last iteration of this patch to leave the styling to the themes. However, I found the uptake of the d6 Popups module increased substantially when I made the default look sexier, so I am conflicted.
* It does not solve . This patch only works on links, not submit buttons. However I believe this would get us 80% of the way.
* I have been keeping half and eye on , and, ironically, it looks like there is an emerging consensus to use the term "popup" to mean an old school popup window. In that case I will need to rename the functionality in this patch. There has already been a bunch of bikeshedding on this topic, but so it goes. I'd use "lightbox", but that might not be nice for the people maintaining the existing lightbox modules. So I am leaning towards a completely new term, like "ajaxbox".
* This patch does not use jQuery UI, again in an effort to avoid controversy. Interestingly Rob Loach has proposed creating a jQueryUI skin for the d6 module.
Note: The two image files go in the misc folder.
Note2: In case you missed it above, you will need to test with the stark theme.
Failed: 10876 passes, 13 fails, 0 exceptions View
Passed: 10889 passes, 0 fails, 0 exceptions View