forked from extern/egroupware
new API method egw_framework::popup($link, $target="_blank", $popup="640x480") to open a popup independent of running a regular or a JSON request
This commit is contained in:
parent
c0d85eb33e
commit
ff00c695ca
@ -289,6 +289,28 @@ abstract class egw_framework
|
||||
self::$extra['message'] = func_get_args();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a popup independent if we run as json or regular request
|
||||
*
|
||||
* @param string $link
|
||||
* @param string $target
|
||||
* @param string $popup
|
||||
*/
|
||||
public static function popup($link, $target='_blank', $popup='640x480')
|
||||
{
|
||||
// default params are not returned by func_get_args!
|
||||
$args = func_get_args()+array(null, '_blank', '640x480');
|
||||
|
||||
if (egw_json_request::isJSONRequest())
|
||||
{
|
||||
egw_json_response::get()->apply('egw.open_link', $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
self::$extra['popup'] = $args;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close (popup) window, use to replace egw_framework::onload('window.close()') in a content security save way
|
||||
*
|
||||
|
@ -177,6 +177,14 @@
|
||||
|
||||
window.egw_LAB.script(include).wait(function()
|
||||
{
|
||||
// call egw.open_link, if popup attr specified
|
||||
var egw_popup = egw_script.getAttribute('data-popup');
|
||||
if (egw_popup)
|
||||
{
|
||||
egw_popup = JSON.parse(egw_popup) || [];
|
||||
egw.open_link.apply(egw, egw_popup);
|
||||
}
|
||||
|
||||
if(console.timelineEnd) console.timelineEnd("egw");
|
||||
var end_time = (new Date).getTime();
|
||||
var gen_time_div = $j('#divGenTime_'+window.egw_appName);
|
||||
|
Loading…
Reference in New Issue
Block a user