add onbeforeunload as action

This commit is contained in:
Klaus Leithoff 2012-03-21 08:25:17 +00:00
parent 61474e73c4
commit 3abeb7c464

View File

@ -1098,6 +1098,26 @@ abstract class egw_framework
return self::$body_tags['onUnload'];
}
/**
* Sets an onBeforeUnload action for a page
*
* @param string $code='' javascript to be used
* @param boolean $replace=false false: append to existing, true: replace existing tag
* @return string content of onXXX tag after adding code
*/
static function set_onbeforeunload($code='',$replace=false)
{
if ($replace || empty(self::$body_tags['onBeforeUnload']))
{
self::$body_tags['onBeforeUnload'] = $code;
}
else
{
self::$body_tags['onBeforeUnload'] .= $code;
}
return self::$body_tags['onBeforeUnload'];
}
/**
* Sets an onResize action for a page
*