2009-10-12 11:41:46 +02:00
< ? php
/**
* EGroupware - Preferences hooks
*
* @ link http :// www . egroupware . org
* @ license http :// opensource . org / licenses / gpl - license . php GPL - GNU General Public License
* @ package preferences
* @ version $Id $
*/
2016-04-30 19:16:36 +02:00
use EGroupware\Api ;
use EGroupware\Api\Framework ;
use EGroupware\Api\Egw ;
2009-10-12 11:41:46 +02:00
/**
* Static hooks for preferences class
*/
class preferences_hooks
{
/**
* Hook return common preferences settings
*
* @ param string | array $hook_data
* @ return array
*/
static public function settings ( $hook_data )
{
2023-04-17 17:28:27 +02:00
$select_multiple_close = array (
2023-04-18 16:51:21 +02:00
'open' => lang ( 'Stay open' ),
'close_email' => lang ( 'Stay open, but not for email' ),
'close' => lang ( 'Close after selection' )
2023-04-17 17:28:27 +02:00
);
2009-10-12 11:41:46 +02:00
$navbar_format = array (
'icons' => lang ( 'Icons only' ),
'icons_and_text' => lang ( 'Icons and text' ),
'text' => lang ( 'Text only' )
);
$link_list_format = array (
'icons' => lang ( 'Icons only' ),
'icons_and_text' => lang ( 'Icons and text' ),
'text' => lang ( 'Text only' )
);
2009-10-19 20:17:59 +02:00
if ( ! $hook_data [ 'setup' ])
{
2016-04-30 19:16:36 +02:00
$langs = Api\Translation :: get_installed_langs ();
2009-10-19 22:45:23 +02:00
2022-12-14 22:34:46 +01:00
$tz_list = Api\DateTime :: getTimezones ();
// Format for select
$format = function ( $key , $value ) use ( & $format , & $tzs )
{
if ( is_array ( $value ))
{
$value = [
'label' => $key ,
'value' => array_map ( $format , array_keys ( $value ), array_values ( $value ))
];
}
else
{
$value = [ 'label' => $value , 'value' => $key ];
}
return $value ;
};
$tzs = array_map ( $format , array_keys ( $tz_list ), array_values ( $tz_list ));
2009-10-19 20:17:59 +02:00
}
2009-10-12 11:41:46 +02:00
$date_formats = array (
'd.m.Y' => 'd.m.Y' ,
'Y-m-d' => 'Y-m-d' ,
'm/d/Y' => 'm/d/Y' ,
'm-d-Y' => 'm-d-Y' ,
'm.d.Y' => 'm.d.Y' ,
'Y/d/m' => 'Y/d/m' ,
'Y-d-m' => 'Y-d-m' ,
'Y.d.m' => 'Y.d.m' ,
'Y/m/d' => 'Y/m/d' ,
'Y.m.d' => 'Y.m.d' ,
'd/m/Y' => 'd/m/Y' ,
'd-m-Y' => 'd-m-Y' ,
2017-11-21 18:07:03 +01:00
'd-M-Y' => 'd-M-Y'
2009-10-12 11:41:46 +02:00
);
$time_formats = array (
'12' => lang ( '12 hour' ),
'24' => lang ( '24 hour' )
);
$account_sels = array (
'selectbox' => lang ( 'Selectbox' ),
'primary_group' => lang ( 'Selectbox with primary group and search' ),
'groupmembers' => lang ( 'Selectbox with groupmembers' ),
'none' => lang ( 'No user-selection at all' ),
);
$account_display = array (
'firstname' => lang ( 'Firstname' ) . ' ' . lang ( 'Lastname' ),
'lastname' => lang ( 'Lastname' ) . ', ' . lang ( 'Firstname' ),
'username' => lang ( 'username' ),
'firstall' => lang ( 'Firstname' ) . ' ' . lang ( 'Lastname' ) . ' [' . lang ( 'username' ) . ']' ,
'lastall' => lang ( 'Lastname' ) . ', ' . lang ( 'Firstname' ) . ' [' . lang ( 'username' ) . ']' ,
'allfirst' => '[' . lang ( 'username' ) . '] ' . lang ( 'Firstname' ) . ' ' . lang ( 'Lastname' ),
'all' => '[' . lang ( 'username' ) . '] ' . lang ( 'Lastname' ) . ',' . lang ( 'Firstname' ),
2019-01-09 18:41:24 +01:00
'firstgroup' => lang ( 'Firstname' ) . ' ' . lang ( 'Lastname' ) . ' (' . lang ( 'primary group' ) . ')' ,
'lastgroup' => lang ( 'Lastname' ) . ', ' . lang ( 'Firstname' ) . ' (' . lang ( 'primary group' ) . ')' ,
2020-05-04 09:25:32 +02:00
'firstinital' => lang ( 'Firstname' ) . ' ' . lang ( 'Initial' ),
'firstid' => lang ( 'Firstname' ) . ' [' . lang ( 'ID' ) . ']' ,
2009-10-12 11:41:46 +02:00
);
2009-10-18 14:57:30 +02:00
if ( $hook_data [ 'setup' ]) // called via setup
{
2014-06-25 15:16:19 +02:00
$lang = setup :: get_lang ();
2009-10-18 14:57:30 +02:00
}
2016-05-27 17:31:08 +02:00
if ( empty ( $lang )) $lang = 'en' ;
2016-05-04 18:51:29 +02:00
list (, $country ) = explode ( '-' , $lang );
2016-05-06 13:07:42 +02:00
if ( empty ( $country ) && class_exists ( 'Locale' )) $country = Locale :: getRegion ( Locale :: getDefault ());
2016-05-04 18:51:29 +02:00
if ( empty ( $country )) $country = 'de' ;
2016-10-06 18:30:37 +02:00
2013-02-21 14:19:15 +01:00
// 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' )
2013-02-21 12:32:46 +01:00
{
2013-02-21 14:19:15 +01:00
$prefs = $GLOBALS [ 'egw' ] -> preferences ;
2013-02-21 12:32:46 +01:00
foreach ( array ( 'user' , 'default' , 'forced' ) as $type )
{
if ( substr ( $prefs -> { $type }[ 'common' ][ 'rte_font_size' ], - 2 ) == 'px' )
{
2019-01-25 12:41:13 +01:00
Api\Etemplate\Widget\HtmlArea :: font_size_from_prefs ( $prefs -> { $type }, $prefs -> { $type }[ 'common' ][ 'rte_font_size' ],
2013-02-21 14:19:15 +01:00
$prefs -> { $type }[ 'common' ][ 'rte_font_unit' ]);
2013-02-21 12:32:46 +01:00
$prefs -> save_repository ( false , $type );
}
}
2019-01-25 12:41:13 +01:00
Api\Etemplate\Widget\HtmlArea :: font_size_from_prefs ( $GLOBALS [ 'egw_info' ][ 'user' ][ 'preferences' ],
2013-02-21 14:19:15 +01:00
$GLOBALS [ 'egw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'rte_font_size' ],
$GLOBALS [ 'egw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'rte_font_unit' ]);
2013-02-21 12:32:46 +01:00
}
2019-01-09 18:41:24 +01:00
2018-11-28 18:06:20 +01:00
if ( ! $GLOBALS [ 'egw_info' ][ 'user' ][ 'preferences' ][ 'common' ][ 'rte_toolbar' ])
{
$GLOBALS [ 'egw' ] -> preferences -> add ( 'common' , 'rte_toolbar' , 'fontselect,fontsizeselect,bold,italic,forecolor,backcolor,' .
'alignleft,aligncenter,alignright,alignjustify,numlist,bullist' .
',outdent,indent,link,image' , 'user' );
$GLOBALS [ 'egw' ] -> preferences -> save_repository ( true );
}
2019-09-10 09:29:33 +02:00
// do NOT query widgets from setup / installation, it fails with an exception
$font_options = $font_unit_options = $font_size_options = [];
if ( ! isset ( $GLOBALS [ 'egw_setup' ]))
{
$font_options = Api\Etemplate\Widget\HtmlArea :: $font_options ;
$font_unit_options = Api\Etemplate\Widget\HtmlArea :: $font_unit_options ;
$font_size_options = Api\Etemplate\Widget\HtmlArea :: $font_size_options ;
}
2022-09-26 16:40:01 +02:00
$textsize = array (
2022-12-08 13:17:00 +01:00
'10' => lang ( 'x-small' ),
'12' => lang ( 'small' ),
'14' => lang ( 'standard' ),
'16' => lang ( 'large' ),
2022-12-09 12:31:10 +01:00
'20' => lang ( 'x-large' )
2022-09-26 16:40:01 +02:00
);
2009-10-12 11:41:46 +02:00
// Settings array for this app
$settings = array (
2012-12-04 23:21:59 +01:00
array (
'type' => 'section' ,
'title' => 'Look & feel'
),
2009-10-12 11:41:46 +02:00
'maxmatchs' => array (
'type' => 'input' ,
'label' => 'Max matches per page' ,
'name' => 'maxmatchs' ,
'help' => 'Any listing in eGW will show you this number of entries or lines per page.<br>To many slow down the page display, to less will cost you the overview.' ,
'size' => 3 ,
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
2014-06-25 15:16:19 +02:00
'forced' => 20 , // hidden as not used in eTemplate2
2009-10-12 11:41:46 +02:00
),
2022-09-26 16:40:01 +02:00
'textsize' => array (
'type' => 'select' ,
'label' => 'Set content size' ,
'no_lang' => true ,
'name' => 'textsize' ,
'help' => lang ( 'It sets content size (text only) according to selected size.' ),
'xmlrpc' => True ,
'values' => $textsize ,
2022-12-08 13:17:00 +01:00
'default' => '14' ,
2022-09-26 16:40:01 +02:00
'admin' => False ,
2023-03-16 16:25:48 +01:00
'reload' => true
2022-09-26 16:40:01 +02:00
),
2020-08-07 17:19:06 +02:00
'lazy-update' => array (
'type' => 'select' ,
2020-08-10 09:27:15 +02:00
'label' => 'How to update lists' ,
2020-08-07 17:19:06 +02:00
'name' => 'lazy-update' ,
2020-08-10 09:27:15 +02:00
'values' => [
'lazy' => lang ( 'Fast' ),
'exact' => lang ( 'Exact' ),
],
'help' => 'Fast update add new entries always top of the list and updates existing ones in place, unless list is sorted by last modified. Exact updates do a full refresh, if the list is not sorted by last modified.' ,
2020-08-07 17:19:06 +02:00
'default' => 'lazy'
),
2023-04-17 17:28:27 +02:00
'template_set' => array (
2009-10-12 11:41:46 +02:00
'type' => 'select' ,
'label' => 'Interface/Template Selection' ,
'name' => 'template_set' ,
2016-04-30 19:16:36 +02:00
'values' => Framework :: list_templates (),
2009-10-12 11:41:46 +02:00
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.' ,
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
2014-06-25 15:16:19 +02:00
'forced' => file_exists ( EGW_SERVER_ROOT . '/pixelegg' ) ? 'pixelegg' : 'idots' ,
2023-03-16 16:25:48 +01:00
'reload' => true
2009-10-12 11:41:46 +02:00
),
2023-04-17 17:28:27 +02:00
'theme' => array (
2009-10-12 11:41:46 +02:00
'type' => 'select' ,
'label' => 'Theme (colors/fonts) Selection' ,
'name' => 'theme' ,
2013-05-03 15:08:08 +02:00
'values' => ! $hook_data [ 'setup' ] ? $GLOBALS [ 'egw' ] -> framework -> list_themes () : array (),
2009-10-12 11:41:46 +02:00
'help' => 'A theme defines the colors and fonts used by the template.' ,
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
2023-04-17 17:28:27 +02:00
'forced' => file_exists ( EGW_SERVER_ROOT . '/pixelegg' ) ? 'pixelegg' : 'idots' ,
2023-03-16 16:25:48 +01:00
'reload' => true
2009-10-12 11:41:46 +02:00
),
2023-04-17 17:28:27 +02:00
'darkmode' => array (
'type' => 'select' ,
'label' => 'Dark mode theme' ,
'name' => 'darkmode' ,
'values' => array ( '0' => 'off' , '1' => 'on' , '2' => 'auto' ),
'help' => 'Dark mode theme' ,
'admin' => False ,
2020-12-15 20:24:25 +01:00
'default' => '0'
),
2023-04-17 17:28:27 +02:00
'audio_effect' => array (
'type' => 'select' ,
'label' => 'Audio effect' ,
'name' => 'audio_effect' ,
'values' => array ( '0' => lang ( 'Disable' ), '1' => lang ( 'Enable' )),
'help' => 'Audio effect enables|disables sound effects used in the theme' ,
'xmlrpc' => True ,
'admin' => False ,
2019-05-06 16:04:13 +02:00
'default' => '0' ,
2014-12-15 11:00:57 +01:00
),
2023-04-17 17:28:27 +02:00
'navbar_format' => array (
'type' => 'select' ,
'label' => 'Show navigation bar as' ,
'name' => 'navbar_format' ,
'values' => $navbar_format ,
'help' => 'You can show the applications as icons only, icons with app-name or both.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => 'icons_and_text' ,
),
'link_list_format' => array (
2009-10-12 11:41:46 +02:00
'type' => 'select' ,
2023-04-17 17:28:27 +02:00
'label' => 'Show links between eGroupWare aps as' ,
'name' => 'link_list_format' ,
'values' => $link_list_format ,
'help' => 'You can show the linked entries with icons only, icons with app-name or both.' ,
2009-10-12 11:41:46 +02:00
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
2023-04-17 17:28:27 +02:00
'forced' => 'icons' ,
2009-10-12 11:41:46 +02:00
),
2023-04-17 17:28:27 +02:00
'select_multiple_close' => array (
'type' => 'select' ,
'label' => 'Keep list open for selecting multiple' ,
'name' => 'select_multiple_close' ,
'values' => $select_multiple_close ,
'help' => 'When you can select multiple options, should the option list stay open until you close it, or close after you pick an option.' ,
'default' => 'open'
2009-10-12 11:41:46 +02:00
),
2023-04-17 17:28:27 +02:00
'link_list_thumbnail' => array (
'type' => 'select' ,
'label' => 'Display thumbnails for linked images' ,
'name' => 'link_list_thumbnail' ,
'values' => array (
'1' => lang ( 'Yes' ),
'0' => lang ( 'No' ),
2009-10-12 11:41:46 +02:00
),
2023-04-17 17:28:27 +02:00
'help' => 'Images linked to an entry can be displayed as thumbnails. You can turn this off to speed up page display.' ,
'xmlrpc' => True ,
'admin' => False ,
'forced' => '1' ,
2009-10-12 11:41:46 +02:00
),
2023-04-17 17:28:27 +02:00
'select_mode' => array (
'type' => 'select' ,
'label' => 'Select additional lines in lists by' ,
'name' => 'select_mode' ,
'values' => array (
2011-06-15 17:59:13 +02:00
'EGW_SELECTMODE_DEFAULT' => lang ( 'holding Ctrl/Cmd key and click on the line' ),
'EGW_SELECTMODE_TOGGLE' => lang ( 'just clicking on the line, like a checkbox' ),
2011-06-15 17:50:16 +02:00
),
2023-04-17 17:28:27 +02:00
'help' => 'If a line is already selected, further lines get either selected by holding Ctrl/Cmd key and clicking on them (to not unselect the current selected line), or by just clicking on them as for a checkbox. If no line is selected clicking on one allways selects it. Holding down Shift key selects everything between current select line and the one clicked.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => 'EGW_SELECTMODE_DEFAULT' ,
2011-06-15 17:50:16 +02:00
),
2023-04-17 17:28:27 +02:00
'account_selection' => array (
'type' => 'select' ,
'label' => 'How do you like to select accounts' ,
'name' => 'account_selection' ,
'values' => $account_sels ,
'help' => lang ( 'The selectbox shows all available users (can be very slow on big installs with many users). The popup can search users by name or group.' ) . ' ' .
2012-12-04 23:21:59 +01:00
lang ( 'The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.' ),
'run_lang' => false ,
2023-04-17 17:28:27 +02:00
'xmlrpc' => True ,
'admin' => False ,
'default' => 'selectbox'
2012-12-04 23:21:59 +01:00
),
2023-04-17 17:28:27 +02:00
'account_display' => array (
'type' => 'select' ,
'label' => 'How do you like to display accounts' ,
'name' => 'account_display' ,
'values' => $account_display ,
'help' => 'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => 'lastname' ,
2012-12-04 23:21:59 +01:00
),
2023-04-17 17:28:27 +02:00
'show_currentusers' => array (
2012-12-04 23:21:59 +01:00
'type' => 'check' ,
'label' => 'Show number of current users' ,
'name' => 'show_currentusers' ,
'help' => 'Should the number of active sessions be displayed for you all the time.' ,
'xmlrpc' => False ,
'admin' => True ,
'forced' => true ,
),
2023-04-17 17:28:27 +02:00
'scroll_area' => array (
2019-09-24 11:41:06 +02:00
'type' => 'select' ,
'label' => 'Applications list scroll area' ,
'name' => 'scroll_area' ,
'values' => array ( '0' => lang ( 'Disable' ), '1' => lang ( 'Enable' )),
'help' => 'Make applications list scrollable with up/down scroll buttons (usefull for users working with mouse with no scrollwheel)' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => '0' ,
),
2012-12-04 23:21:59 +01:00
array (
'type' => 'section' ,
'title' => 'Formatting & general settings'
),
'lang' => array (
'type' => 'select' ,
'label' => 'Language' ,
'name' => 'lang' ,
'values' => $langs ,
'help' => 'Select the language of texts and messages within eGroupWare.<br>Some languages may not contain all messages, in that case you will see an english message.' ,
'xmlrpc' => True ,
'admin' => False ,
'default' => $lang ,
2023-03-16 16:25:48 +01:00
'reload' => true
2012-12-04 23:21:59 +01:00
),
'country' => array (
2022-07-13 18:52:11 +02:00
'type' => 'et2-select-country' ,
'label' => 'Country' ,
'name' => 'country' ,
'help' => 'In which country are you. This is used to set certain defaults for you.' ,
'xmlrpc' => True ,
'admin' => False ,
'values' => array (),
'default' => strtoupper ( $country ),
'attributes' => array (
2018-09-18 10:46:36 +02:00
'tags' => true
)
2012-12-04 23:21:59 +01:00
),
2009-10-12 11:41:46 +02:00
'tz' => array (
'type' => 'select' ,
'label' => 'Time zone' ,
'name' => 'tz' ,
'values' => $tzs ,
'help' => 'Please select your timezone.' ,
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
'default' => date_default_timezone_get (),
2023-01-01 16:38:20 +01:00
'attributes' => array (
'search' => true
)
2009-10-12 11:41:46 +02:00
),
'tz_selection' => array (
'type' => 'multiselect' ,
'label' => 'Permanent time zone selection' ,
'name' => 'tz_selection' ,
2022-12-20 23:49:10 +01:00
'values' => $tzs ,
2009-10-12 11:41:46 +02:00
'help' => 'Please select timezones, you want to be able to quickly switch between. Switch is NOT shown, if less then two are selected.' ,
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
2009-10-19 19:04:11 +02:00
'forced' => date_default_timezone_get (),
2023-01-01 16:38:20 +01:00
'attributes' => array (
'search' => true
)
2009-10-12 11:41:46 +02:00
),
'dateformat' => array (
'type' => 'select' ,
'label' => 'Date format' ,
'name' => 'dateformat' ,
'values' => $date_formats ,
'help' => 'How should eGroupWare display dates for you.' ,
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
'default' => $lang == 'en' ? 'Y/m/d' : 'd.m.Y' ,
2009-10-12 11:41:46 +02:00
),
'timeformat' => array (
'type' => 'select' ,
'label' => 'Time format' ,
'name' => 'timeformat' ,
'values' => $time_formats ,
'help' => 'Do you prefer a 24 hour time format, or a 12 hour one with am/pm attached.' ,
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
'default' => 24 ,
2009-10-12 11:41:46 +02:00
),
2012-12-04 23:21:59 +01:00
'number_format' => array (
2009-10-12 11:41:46 +02:00
'type' => 'select' ,
2012-12-04 23:21:59 +01:00
'label' => 'Number format' ,
'name' => 'number_format' ,
'values' => array (
'.' => '1234.56' ,
',' => '1234,56' ,
'.,' => '1,234.56' ,
',.' => '1.234,56' ,
'. ' => '1 234.56' ,
', ' => '1 234,56' ,
),
'help' => 'Thousands separator is only used for displaying and not for editing numbers.' ,
'xmlrpc' => True ,
'admin' => false ,
'default' => '.' ,
),
'currency' => array (
'type' => 'input' ,
'label' => 'Currency' ,
'name' => 'currency' ,
'help' => 'Which currency symbol or name should be used in eGroupWare.' ,
2009-10-12 11:41:46 +02:00
'xmlrpc' => True ,
2009-10-18 14:57:30 +02:00
'admin' => False ,
2012-12-04 23:21:59 +01:00
'default' => $lang == 'en' ? '$' : 'EUR' ,
2009-10-12 11:41:46 +02:00
),
2012-12-04 23:21:59 +01:00
'csv_charset' => array (
2009-10-12 11:41:46 +02:00
'type' => 'select' ,
2012-12-04 23:21:59 +01:00
'label' => 'Charset for the CSV export/import' ,
'name' => 'csv_charset' ,
2016-04-30 19:16:36 +02:00
'values' => Api\Translation :: get_installed_charsets (),
2012-12-04 23:21:59 +01:00
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.' ,
2009-10-12 11:41:46 +02:00
'xmlrpc' => True ,
2012-12-04 23:21:59 +01:00
'admin' => false ,
'default' => 'iso-8859-1' ,
),
array (
'type' => 'section' ,
'title' => 'Text editor settings'
),
'rte_font' => array (
'type' => 'select' ,
'label' => 'Default font' ,
'name' => 'rte_font' ,
2019-09-10 09:29:33 +02:00
'values' => $font_options ,
2012-12-04 23:21:59 +01:00
'help' => 'Automatically start with this font' ,
'xmlrpc' => True ,
2014-04-24 15:03:45 +02:00
'admin' => false ,
'default' => 'arial, helvetica, sans-serif'
2012-12-04 23:21:59 +01:00
),
2013-02-21 12:32:46 +01:00
'rte_font_unit' => array (
'type' => 'select' ,
'label' => 'Font size unit' ,
'name' => 'rte_font_unit' ,
2019-09-10 09:29:33 +02:00
'values' => array_map ( 'lang' , $font_unit_options ),
2013-02-21 12:32:46 +01:00
'help' => 'Unit of displayed font sizes: either "px" as used eg. for web-pages or "pt" as used in text processing.' ,
2013-02-21 14:19:15 +01:00
'default' => 'pt' ,
2013-02-21 12:32:46 +01:00
'xmlrpc' => True ,
2014-04-24 15:03:45 +02:00
'admin' => false ,
'default' => 'pt'
2013-02-21 12:32:46 +01:00
),
2012-12-04 23:21:59 +01:00
'rte_font_size' => array (
'type' => 'select' ,
'label' => 'Default font size' ,
'name' => 'rte_font_size' ,
2019-09-10 09:29:33 +02:00
'values' => $font_size_options ,
2012-12-04 23:21:59 +01:00
'help' => 'Automatically start with this font size' ,
'xmlrpc' => True ,
2014-04-24 15:03:45 +02:00
'admin' => false ,
'default' => '10'
2009-10-12 11:41:46 +02:00
),
2019-10-09 16:22:23 +02:00
'rte_formatblock' => array (
'type' => 'select' ,
'label' => 'Default format block' ,
'name' => 'rte_formatblock' ,
'values' => array (
'p' => lang ( " Paragraph " ),
2019-10-16 15:30:33 +02:00
'h1' => lang ( " Heading %1 " , '1' ),
'h2' => lang ( " Heading %1 " , '2' ),
'h3' => lang ( " Heading %1 " , '3' ),
'h4' => lang ( " Heading %1 " , '4' ),
'h5' => lang ( " Heading %1 " , '5' ),
'h6' => lang ( " Heading %1 " , '6' ),
2019-12-05 16:04:40 +01:00
'pre' => lang ( " Preformatted " ),
2022-09-12 10:04:42 +02:00
'customparagraph' => lang ( " Small Paragraph " )
2019-10-09 16:22:23 +02:00
),
2022-09-12 10:04:42 +02:00
'help' => 'Automatically start with this format block. Small Paragraph adds less line space between new lines.' ,
2019-10-09 16:22:23 +02:00
'xmlrpc' => True ,
'admin' => false ,
'default' => 'p'
),
2018-10-22 12:37:45 +02:00
'rte_menubar' => array (
2009-10-12 11:41:46 +02:00
'type' => 'select' ,
2018-10-22 12:37:45 +02:00
'label' => 'Enable menubar' ,
'name' => 'rte_menubar' ,
'values' => array (
'1' => lang ( 'Yes' ),
'0' => lang ( 'No' ),
),
'help' => 'Enable/Disable menubar from top of the editor.' ,
2009-10-12 11:41:46 +02:00
'xmlrpc' => True ,
2018-10-22 12:37:45 +02:00
'admin' => '1' ,
'default' => '1' ,
2009-10-12 11:41:46 +02:00
),
2018-10-24 14:48:19 +02:00
'rte_toolbar' => array (
2022-07-14 21:22:48 +02:00
'type' => 'taglist' ,
'label' => 'Enabled features in toolbar' ,
'name' => 'rte_toolbar' ,
'values' => Api\Etemplate\Widget\HtmlArea :: get_toolbar_as_selOptions (),
'help' => 'You may select features to be enabled in toolbar. Selecting any of the tools from here means seleted "Feature of the editor" preference would be ignored.' ,
'admin' => true
2018-10-24 14:48:19 +02:00
)
2009-10-12 11:41:46 +02:00
);
// disable thumbnails, if no size configured by admin
if ( ! $GLOBALS [ 'egw_info' ][ 'server' ][ 'link_list_thumbnail' ]) unset ( $settings [ 'link_list_thumbnail' ]);
return $settings ;
}
/**
* Hook called when a user gets deleted , to delete his preferences
*
2010-01-27 06:44:31 +01:00
* @ param string | array $data
2009-10-12 11:41:46 +02:00
*/
2010-01-27 06:44:31 +01:00
public static function deleteaccount ( $data )
2009-10-12 11:41:46 +02:00
{
2010-01-27 06:44:31 +01:00
$account_id = ( int ) $data [ 'account_id' ];
if ( $account_id > 0 ) // user
{
$GLOBALS [ 'egw' ] -> preferences -> delete_user ( $account_id );
}
elseif ( $account_id < 0 ) // group
2009-10-12 11:41:46 +02:00
{
2010-01-27 06:44:31 +01:00
$GLOBALS [ 'egw' ] -> preferences -> delete_group ( $account_id );
2009-10-12 11:41:46 +02:00
}
}
2013-05-11 10:51:06 +02:00
/**
* Preferences link to Admin >> Edit user
*/
public static function edit_user ()
{
global $menuData ;
$menuData [] = array (
2014-04-01 17:49:08 +02:00
'description' => 'Preferences' ,
'url' => '/index.php' ,
'extradata' => 'menuaction=preferences.preferences_settings.index' ,
2017-04-18 14:57:04 +02:00
'popup' => '1200x600' ,
2013-05-11 10:51:06 +02:00
);
}
2013-10-02 18:29:08 +02:00
/**
* hooks to build sidebox - menu plus the admin and preferences sections
*
* @ param string | array $args hook args
*/
static function admin ( $args )
{
2014-04-01 17:49:08 +02:00
unset ( $args ); // unused, but required by function signature
2013-10-02 18:29:08 +02:00
$appname = 'preferences' ;
$file = Array (
2016-04-30 19:16:36 +02:00
'Site configuration' => Egw :: link ( '/index.php' , 'menuaction=admin.admin_config.index&appname=' . $appname . '&ajax=true' ),
2013-10-02 18:29:08 +02:00
);
display_section ( $appname , $file );
}
2022-09-12 10:04:42 +02:00
}