Add add_popup() method to make possible to register popup from a plugin.

It was possible with show_popup(), however sometimes it is needed
to register a popup before show_popup() is being used.
pull/66/head^2
Aleksander Machniak 11 years ago
parent 76a98da33e
commit 443b92a7ee

@ -38,6 +38,7 @@ function rcube_mail_ui()
this.init_tabs = init_tabs;
this.show_about = show_about;
this.show_popup = show_popup;
this.add_popup = add_popup;
this.set_searchmod = set_searchmod;
this.show_uploadform = show_uploadform;
this.show_header_row = show_header_row;
@ -429,6 +430,18 @@ function rcube_mail_ui()
}
/**
* Register a popup menu
*/
function add_popup(popup, config)
{
var obj = popups[popup] = $('#'+popup);
obj.appendTo(document.body); // move it to top for proper absolute positioning
if (obj.length)
popupconfig[popup] = $.extend(popupconfig[popup] || {}, config || {});
}
/**
* Trigger for popup menus
*/
@ -436,7 +449,7 @@ function rcube_mail_ui()
{
// auto-register menu object
if (config || !popupconfig[popup])
popupconfig[popup] = $.extend(popupconfig[popup] || {}, config);
add_popup(popup, config);
var visible = show_popupmenu(popup, show),
config = popupconfig[popup];

Loading…
Cancel
Save