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',
|
||||
);
|
||||
public static $font_unit_options = array(
|
||||
'px' => 'px: display pixels',
|
||||
'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
|
||||
* variables
|
||||
|
@ -546,7 +546,7 @@ class html
|
||||
|
||||
// User preferences
|
||||
$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
|
||||
// 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);
|
||||
if (empty($country)) $country = $lang;
|
||||
}
|
||||
// check for old rte_font_size pref including px and remove unit, px is default unit anyway
|
||||
if (substr($GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'], -2) == 'px')
|
||||
// check for old rte_font_size pref including px and split it in size and unit
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'] =
|
||||
(string)(int)$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'];
|
||||
egw_ckeditor_config::font_size_from_prefs($GLOBALS['egw_info']['user']['preferences'],
|
||||
$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(
|
||||
@ -372,7 +375,7 @@ class preferences_hooks
|
||||
'name' => 'rte_font_unit',
|
||||
'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.',
|
||||
'default'=> 'px',
|
||||
'default'=> 'pt',
|
||||
'xmlrpc' => True,
|
||||
'admin' => false
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user