mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
cant completly remove egw_framework::set_on* methods, as they are still in use
This commit is contained in:
parent
2c40992428
commit
aa2275ace8
@ -359,6 +359,40 @@ abstract class Framework extends Framework\Extra
|
|||||||
return $var;
|
return $var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Body tags for onLoad, onUnload and onResize
|
||||||
|
*
|
||||||
|
* @deprecated since 14.1 use app.js et2_ready method instead to execute code or bind a handler (CSP will stop onXXX attributes!)
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $body_tags = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds on(Un)Load= attributes to the body tag of a page
|
||||||
|
*
|
||||||
|
* Can only be set via egw_framework::set_on* methods.
|
||||||
|
*
|
||||||
|
* @deprecated since 14.1 use app.js et2_ready method instead to execute code or bind a handler (CSP will stop onXXX attributes!)
|
||||||
|
* @returns string the attributes to be used
|
||||||
|
*/
|
||||||
|
static public function _get_body_attribs()
|
||||||
|
{
|
||||||
|
$js = '';
|
||||||
|
foreach(self::$body_tags as $what => $data)
|
||||||
|
{
|
||||||
|
if (!empty($data))
|
||||||
|
{
|
||||||
|
if($what == 'onLoad')
|
||||||
|
{
|
||||||
|
$js .= 'onLoad="egw_LAB.wait(function() {'. htmlspecialchars($data).'})"';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$js .= ' '.$what.'="' . htmlspecialchars($data) . '"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $js;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get header as array to eg. set as vars for a template (from idots' head.inc.php)
|
* Get header as array to eg. set as vars for a template (from idots' head.inc.php)
|
||||||
*
|
*
|
||||||
@ -419,6 +453,7 @@ abstract class Framework extends Framework\Extra
|
|||||||
'lang_code' => $lang_code,
|
'lang_code' => $lang_code,
|
||||||
'charset' => Translation::charset(),
|
'charset' => Translation::charset(),
|
||||||
'website_title' => $site_title,
|
'website_title' => $site_title,
|
||||||
|
'body_tags' => self::_get_body_attribs(),
|
||||||
'java_script' => self::_get_js($extra),
|
'java_script' => self::_get_js($extra),
|
||||||
'meta_robots' => $robots,
|
'meta_robots' => $robots,
|
||||||
'dir_code' => lang('language_direction_rtl') != 'rtl' ? '' : ' dir="rtl"',
|
'dir_code' => lang('language_direction_rtl') != 'rtl' ? '' : ' dir="rtl"',
|
||||||
|
@ -120,7 +120,15 @@ abstract class egw_framework extends Api\Framework
|
|||||||
*/
|
*/
|
||||||
static function set_onload($code='',$replace=false)
|
static function set_onload($code='',$replace=false)
|
||||||
{
|
{
|
||||||
unset($code, $replace);
|
if ($replace || empty(self::$body_tags['onLoad']))
|
||||||
|
{
|
||||||
|
self::$body_tags['onLoad'] = $code;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self::$body_tags['onLoad'] .= $code;
|
||||||
|
}
|
||||||
|
return self::$body_tags['onLoad'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,7 +141,15 @@ abstract class egw_framework extends Api\Framework
|
|||||||
*/
|
*/
|
||||||
static function set_onunload($code='',$replace=false)
|
static function set_onunload($code='',$replace=false)
|
||||||
{
|
{
|
||||||
unset($code, $replace);
|
if ($replace || empty(self::$body_tags['onUnload']))
|
||||||
|
{
|
||||||
|
self::$body_tags['onUnload'] = $code;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self::$body_tags['onUnload'] .= $code;
|
||||||
|
}
|
||||||
|
return self::$body_tags['onUnload'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +162,15 @@ abstract class egw_framework extends Api\Framework
|
|||||||
*/
|
*/
|
||||||
static function set_onbeforeunload($code='',$replace=false)
|
static function set_onbeforeunload($code='',$replace=false)
|
||||||
{
|
{
|
||||||
unset($code, $replace);
|
if ($replace || empty(self::$body_tags['onBeforeUnload']))
|
||||||
|
{
|
||||||
|
self::$body_tags['onBeforeUnload'] = $code;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self::$body_tags['onBeforeUnload'] .= $code;
|
||||||
|
}
|
||||||
|
return self::$body_tags['onBeforeUnload'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,7 +183,15 @@ abstract class egw_framework extends Api\Framework
|
|||||||
*/
|
*/
|
||||||
static function set_onresize($code='',$replace=false)
|
static function set_onresize($code='',$replace=false)
|
||||||
{
|
{
|
||||||
unset($code, $replace);
|
if ($replace || empty(self::$body_tags['onResize']))
|
||||||
|
{
|
||||||
|
self::$body_tags['onResize'] = $code;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self::$body_tags['onResize'] .= $code;
|
||||||
|
}
|
||||||
|
return self::$body_tags['onResize'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user