mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
change default font unit for new installs to "pt" and fixed not set font-size in email
This commit is contained in:
parent
f158a8c5d2
commit
0c11206d91
@ -49,10 +49,32 @@ class egw_ckeditor_config
|
|||||||
72 => '72',
|
72 => '72',
|
||||||
);
|
);
|
||||||
public static $font_unit_options = array(
|
public static $font_unit_options = array(
|
||||||
'px' => 'px: display pixels',
|
|
||||||
'pt' => 'pt: points (1/72 inch)',
|
'pt' => 'pt: points (1/72 inch)',
|
||||||
|
'px' => 'px: display pixels',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get font size from preferences
|
||||||
|
*
|
||||||
|
* @param array $prefs=null default $GLOBALS['egw_info']['user']['preferences']
|
||||||
|
* @param string &$size=null on return just size, without unit
|
||||||
|
* @param string &$unit=null on return just unit
|
||||||
|
* @return string font-size including unit
|
||||||
|
*/
|
||||||
|
public static function font_size_from_prefs(array $prefs=null, &$size=null, &$unit=null)
|
||||||
|
{
|
||||||
|
if (is_null($prefs)) $prefs = $GLOBALS['egw_info']['user']['preferences'];
|
||||||
|
|
||||||
|
$size = $prefs['common']['rte_font_size'];
|
||||||
|
$unit = $prefs['common']['rte_font_unit'];
|
||||||
|
if (substr($size, -2) == 'px')
|
||||||
|
{
|
||||||
|
$unit = 'px';
|
||||||
|
$size = (string)(int)$size;
|
||||||
|
}
|
||||||
|
return $size.$unit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read language and country settings for the ckeditor and store them in static
|
* Read language and country settings for the ckeditor and store them in static
|
||||||
* variables
|
* variables
|
||||||
|
@ -546,7 +546,7 @@ class html
|
|||||||
|
|
||||||
// User preferences
|
// User preferences
|
||||||
$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
|
$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
|
||||||
$font_size = (string)(int)$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'];
|
$font_size = egw_ckeditor_config::font_size_from_prefs();
|
||||||
|
|
||||||
// we need to enable double encoding here, as ckEditor has to undo one level of encoding
|
// we need to enable double encoding here, as ckEditor has to undo one level of encoding
|
||||||
// otherwise < and > chars eg. from html markup entered in regular (not source) input, will turn into html!
|
// otherwise < and > chars eg. from html markup entered in regular (not source) input, will turn into html!
|
||||||
|
@ -97,20 +97,23 @@ class preferences_hooks
|
|||||||
list(,$country) = explode('-',$lang);
|
list(,$country) = explode('-',$lang);
|
||||||
if (empty($country)) $country = $lang;
|
if (empty($country)) $country = $lang;
|
||||||
}
|
}
|
||||||
// check for old rte_font_size pref including px and remove unit, px is default unit anyway
|
// check for old rte_font_size pref including px and split it in size and unit
|
||||||
if (substr($GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'], -2) == 'px')
|
if (!isset($GLOBALS['egw_setup']) &&
|
||||||
|
substr($GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'], -2) == 'px')
|
||||||
{
|
{
|
||||||
$prefs = new preferences($GLOBALS['egw_info']['user']['account_id']);
|
$prefs = $GLOBALS['egw']->preferences;
|
||||||
foreach(array('user','default','forced') as $type)
|
foreach(array('user','default','forced') as $type)
|
||||||
{
|
{
|
||||||
if (substr($prefs->{$type}['common']['rte_font_size'], -2) == 'px')
|
if (substr($prefs->{$type}['common']['rte_font_size'], -2) == 'px')
|
||||||
{
|
{
|
||||||
$prefs->{$type}['common']['rte_font_size'] = (string)(int)$prefs->{$type}['common']['rte_font_size'];
|
egw_ckeditor_config::font_size_from_prefs($prefs->{$type}, $prefs->{$type}['common']['rte_font_size'],
|
||||||
|
$prefs->{$type}['common']['rte_font_unit']);
|
||||||
$prefs->save_repository(false, $type);
|
$prefs->save_repository(false, $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'] =
|
egw_ckeditor_config::font_size_from_prefs($GLOBALS['egw_info']['user']['preferences'],
|
||||||
(string)(int)$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'];
|
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'],
|
||||||
|
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_unit']);
|
||||||
}
|
}
|
||||||
// Settings array for this app
|
// Settings array for this app
|
||||||
$settings = array(
|
$settings = array(
|
||||||
@ -372,7 +375,7 @@ class preferences_hooks
|
|||||||
'name' => 'rte_font_unit',
|
'name' => 'rte_font_unit',
|
||||||
'values' => array_map('lang', egw_ckeditor_config::$font_unit_options),
|
'values' => array_map('lang', egw_ckeditor_config::$font_unit_options),
|
||||||
'help' => 'Unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing.',
|
'help' => 'Unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing.',
|
||||||
'default'=> 'px',
|
'default'=> 'pt',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false
|
'admin' => false
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user