* Preferences/all apps: allow to specify font size unit of richtext editor: either "px" display pixels or "pt" as used in word processing

This commit is contained in:
Ralf Becker 2013-02-21 11:32:46 +00:00
parent ef1756438e
commit f158a8c5d2
5 changed files with 63 additions and 19 deletions

View File

@ -31,24 +31,27 @@ class egw_ckeditor_config
'Verdana, Geneva, sans-serif' => 'Verdana'
);
public static $font_size_options = array(
'8px' => '8',
'9px' => '9',
'10px' => '10',
'11px' => '11',
'12px' => '12',
'14px' => '14',
'16px' => '16',
'18px' => '18',
'20px' => '20',
'22px' => '22',
'24px' => '24',
'26px' => '26',
'28px' => '28',
'36px' => '36',
'48px' => '48',
'72px' => '72'
8 => '8',
9 => '9',
10 => '10',
11 => '11',
12 => '12',
14 => '14',
16 => '16',
18 => '18',
20 => '20',
22 => '22',
24 => '24',
26 => '26',
28 => '28',
36 => '36',
48 => '48',
72 => '72',
);
public static $font_unit_options = array(
'px' => 'px: display pixels',
'pt' => 'pt: points (1/72 inch)',
);
/**
* Read language and country settings for the ckeditor and store them in static
@ -197,6 +200,14 @@ class egw_ckeditor_config
$config['language'] = self::get_lang();
$config['enterMode'] = self::get_enter_mode();
$config['skin'] = self::get_skin();
$config['fontSize_sizes'] = '';
$unit = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font_unit'];
if (empty($unit)) $unit = 'px';
foreach(self::$font_size_options as $k => $v)
{
$config['fontSize_sizes'] .= $v.'/'.$k.$unit.';';
}
}
/**

View File

@ -546,7 +546,7 @@ class html
// User preferences
$font = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font'];
+ $font_size = $GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'];
$font_size = (string)(int)$GLOBALS['egw_info']['user']['preferences']['common']['rte_font_size'];
// 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!

View File

@ -97,6 +97,21 @@ 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')
{
$prefs = new preferences($GLOBALS['egw_info']['user']['account_id']);
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'];
$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'];
}
// Settings array for this app
$settings = array(
array(
@ -351,6 +366,16 @@ class preferences_hooks
'xmlrpc' => True,
'admin' => false
),
'rte_font_unit' => array(
'type' => 'select',
'label' => 'Font size unit',
'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',
'xmlrpc' => True,
'admin' => false
),
'rte_font_size' => array(
'type' => 'select',
'label' => 'Default font size',

View File

@ -44,6 +44,7 @@ enter your new password preferences de Neues Passwort eingeben
enter your old password preferences de Altes Passwort eingeben
failed to change password. please contact your administrator. preferences de Passwortänderung fehlgeschlagen. Bitte kontaktieren Sie Ihren Administrator!
features of the editor preferences de Funktionsauswahl des Editors
font size unit preferences de Einheit der Schriftgröße
forced preferences preferences de Erzwungene Einstellungen
formatting & general settings preferences de Formatierung & allgemeine Einstellungen
help off preferences de Keine Hilfe
@ -81,6 +82,8 @@ please select timezones, you want to be able to quickly switch between. switch i
please select your timezone. preferences de Bitte wählen Sie Ihre Zeitzone
please, select a new theme preferences de Bitte ein neues Schema wählen
popup with search preferences de Pop-up mit Suche
pt: points (1/72 inch) preferences de pt: Punkt (1/72 Inch)
px: display pixels preferences de px: Bildschirmpixel
re-enter your password preferences de Neues Passwort wiederholen
read prefs for the specified application. preferences de Liest Einstellungen von den ausgewählten Anwendungen.
rich text editor enter mode preferences de Zeilenumbruchmodus des Editors
@ -119,6 +122,7 @@ theme (colors/fonts) selection preferences de Auswahl des Themas (Farben/Schrift
this server is located in the %1 timezone preferences de Der Server befindet sich in der Zeitzone %1
thousands separator is only used for displaying and not for editing numbers. preferences de Tausender Trennzeichen werden nur zur Anzeige benutzt, aber nicht, zum bearbeiten von Zahlen.
time format preferences de Zeitformat
unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing. preferences de Einzeit für angezeigte Schriftgrößen: entweder "px" wie z.B. bei Webseiten verwendet oder "pt" wie in der Textverarbeitung üblich
use default preferences de Vorgabe benutzen
users choice preferences de Benutzerauswahl
when you say yes the home and logout buttons are presented as applications in the main top applcation bar. preferences de Wenn Sie hier Ja auswählen, werden in der Hauptnavigationsleiste oben zusätzlich Buttons für die Startseite und zum Abmelden angezeigt.

View File

@ -44,6 +44,7 @@ enter your new password preferences en Enter new password
enter your old password preferences en Enter old password
failed to change password. please contact your administrator. preferences en Failed to change password. Contact your administrator.
features of the editor preferences en Features of the editor
font size unit preferences en Font size unit
forced preferences preferences en Forced preferences
formatting & general settings preferences en Formatting & general settings
help off preferences en Help off
@ -81,6 +82,8 @@ please select timezones, you want to be able to quickly switch between. switch i
please select your timezone. preferences en Select your time zone.
please, select a new theme preferences en Select a new theme
popup with search preferences en Popup with search
pt: points (1/72 inch) preferences en pt: points (1/72 inch)
px: display pixels preferences en px: display pixels
re-enter your password preferences en Re-enter your password
read prefs for the specified application. preferences en Read preferences for the specified application.
rich text editor enter mode preferences en Rich text editor enter mode
@ -119,6 +122,7 @@ theme (colors/fonts) selection preferences en Theme
this server is located in the %1 timezone preferences en This server is located in the %1 time zone
thousands separator is only used for displaying and not for editing numbers. preferences en Thousands separator is only used for displaying and not for editing numbers.
time format preferences en Time format
unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing. preferences en Unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing.
use default preferences en Use default
users choice preferences en Users choice
when you say yes the home and logout buttons are presented as applications in the main top applcation bar. preferences en Show Home and Logout buttons as applications in the top bar.