diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index 052b0be5f8..387dffa34f 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -23,10 +23,10 @@ * e) footer * It replaces several methods in the common class and the diverse templates. * - * Existing apps either set $GLOBALS['egw_info']['flags']['noheader'] and call $GLOBALS['egw']->common->egw_header() and + * Existing apps either set $GLOBALS['egw_info']['flags']['noheader'] and call common::egw_header() and * (if $GLOBALS['egw_info']['flags']['nonavbar'] is true) parse_navbar() or it's done by the header.inc.php include. * The app's hook_sidebox then calls the public function display_sidebox(). - * And the app calls $GLOBALS['egw']->common->egw_footer(). + * And the app calls common::egw_footer(). * * This are the authors (and their copyrights) of the original egw_header, egw_footer methods of the common class: * This file written by Dan Kuykendall @@ -247,7 +247,7 @@ abstract class egw_framework } else { - $var['favicon_file'] = $GLOBALS['egw']->common->image('phpgwapi',$GLOBALS['egw_info']['server']['favicon_file']?$GLOBALS['egw_info']['server']['favicon_file']:'favicon.ico'); + $var['favicon_file'] = common::image('phpgwapi',$GLOBALS['egw_info']['server']['favicon_file']?$GLOBALS['egw_info']['server']['favicon_file']:'favicon.ico'); } return $this->_get_css()+array( @@ -259,7 +259,7 @@ abstract class egw_framework 'slider_effects' => $slider_effects, 'simple_show_hide' => $simple_show_hide, 'lang_code' => $lang_code, - 'charset' => $GLOBALS['egw']->translation->charset(), + 'charset' => translation::charset(), 'website_title' => strip_tags($GLOBALS['egw_info']['server']['site_title']. ($app ? " [$app]" : '')), 'body_tags' => self::_get_body_attribs(), 'java_script' => self::_get_js(), @@ -298,7 +298,7 @@ abstract class egw_framework if($GLOBALS['egw_info']['user']['lastpasswd_change'] == 0) { $api_messages = lang('You are required to change your password during your first login').'
'. - lang('Click this image on the navbar: %1',''); + lang('Click this image on the navbar: %1',''); } elseif($GLOBALS['egw_info']['user']['lastpasswd_change'] < time() - (86400*30)) { @@ -317,7 +317,7 @@ abstract class egw_framework } else { - $var['logo_file'] = $GLOBALS['egw']->common->image('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo'); + $var['logo_file'] = common::image('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo'); } $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; @@ -337,12 +337,23 @@ abstract class egw_framework */ protected static function _user_time_info() { - $now = time(); - $user_info = ''.$GLOBALS['egw']->common->display_fullname() .''. ' - ' - . lang($GLOBALS['egw']->common->show_date($now,'l')) . ' ' - . $GLOBALS['egw']->common->show_date($now,$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']); + $now = new egw_time(); + $user_info = ''.common::display_fullname() .''. ' - ' . lang($now->format('l')) . ' ' . $now->format(true); - return $user_info; + $tz = explode(',',$GLOBALS['egw_info']['user']['preferences']['common']['tz']); + $tz_selection = explode(',',$GLOBALS['egw_info']['user']['preferences']['common']['tz_selection']); + if (count($tz_selection) > 1) + { + if (!in_array($tz,$tz_selection)) $tz_selection = array_merge((array)$tz,$tz_selection); + $tz_selection = array_combine($tz_selection,$tz_selection); + foreach($tz_selection as $name => &$label) + { + $label = str_replace(array('_','/'),array(' ',' / '),$label); + } + $user_info .= html::form(html::select('tz',$tz,$tz_selection,true,' onchange="this.form.submit();"'),array(), + '/index.php','','tz_selection',' style="display: inline;"','GET'); + } + return $user_info; } /** @@ -354,7 +365,7 @@ abstract class egw_framework { if( $GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers']) { - $current_users = '' . + $current_users = '' . lang('Current users') . ': ' . $GLOBALS['egw']->session->session_count() . ''; return $current_users; } @@ -373,7 +384,7 @@ abstract class egw_framework $options = array(lang('Add').' ...'); foreach($apps as $app => $label) { - $link = $GLOBALS['egw']->link('/index.php',egw_link::add($app,$GLOBALS['egw_info']['flags']['currentapp'],$GLOBALS['egw_info']['flags']['currentid'])+ + $link = egw::link('/index.php',egw_link::add($app,$GLOBALS['egw_info']['flags']['currentapp'],$GLOBALS['egw_info']['flags']['currentid'])+ (is_array($GLOBALS['egw_info']['flags']['quick_add']) ? $GLOBALS['egw_info']['flags']['quick_add'] : array())); if (($popup = egw_link::is_popup($app,'add'))) { @@ -432,7 +443,7 @@ abstract class egw_framework $index = '/index.php?menuaction='.$data['index']; } } - return $GLOBALS['egw']->link($index,$GLOBALS['egw_info']['flags']['params'][$app]); + return egw::link($index,$GLOBALS['egw_info']['flags']['params'][$app]); } /** @@ -496,13 +507,13 @@ abstract class egw_framework $icon_app = isset($data['icon_app']) ? $data['icon_app'] : $app; if ($app != $GLOBALS['egw_info']['flags']['currentapp']) { - $apps[$app]['icon'] = $GLOBALS['egw']->common->image($icon_app,Array($icon,'nonav')); - $apps[$app]['icon_hover'] = $GLOBALS['egw']->common->image_on($icon_app,Array($icon,'nonav'),'-over'); + $apps[$app]['icon'] = common::image($icon_app,Array($icon,'nonav')); + $apps[$app]['icon_hover'] = common::image_on($icon_app,Array($icon,'nonav'),'-over'); } else { - $apps[$app]['icon'] = $GLOBALS['egw']->common->image_on($icon_app,Array($icon,'nonav'),'-over'); - $apps[$app]['icon_hover'] = $GLOBALS['egw']->common->image($icon_app,Array($icon,'nonav')); + $apps[$app]['icon'] = common::image_on($icon_app,Array($icon,'nonav'),'-over'); + $apps[$app]['icon_hover'] = common::image($icon_app,Array($icon,'nonav')); } } } @@ -526,14 +537,14 @@ abstract class egw_framework // We handle this here becuase its special $apps['about']['title'] = lang('About %1',$app_title); - $apps['about']['url'] = $GLOBALS['egw']->link('/about.php','app='.$app); - $apps['about']['icon'] = $GLOBALS['egw']->common->image('phpgwapi',Array('about','nonav')); - $apps['about']['icon_hover'] = $GLOBALS['egw']->common->image_on('phpgwapi',Array('about','nonav'),'-over'); + $apps['about']['url'] = egw::link('/about.php','app='.$app); + $apps['about']['icon'] = common::image('phpgwapi',Array('about','nonav')); + $apps['about']['icon_hover'] = common::image_on('phpgwapi',Array('about','nonav'),'-over'); $apps['logout']['title'] = lang('Logout'); - $apps['logout']['url'] = $GLOBALS['egw']->link('/logout.php'); - $apps['logout']['icon'] = $GLOBALS['egw']->common->image('phpgwapi',Array('logout','nonav')); - $apps['logout']['icon_hover'] = $GLOBALS['egw']->common->image_on('phpgwapi',Array('logout','nonav'),'-over'); + $apps['logout']['url'] = egw::link('/logout.php'); + $apps['logout']['icon'] = common::image('phpgwapi',Array('logout','nonav')); + $apps['logout']['icon_hover'] = common::image_on('phpgwapi',Array('logout','nonav'),'-over'); return $apps; } @@ -651,7 +662,7 @@ abstract class egw_framework { require_once(EGW_SERVER_ROOT.'/phpgwapi/inc/xajax.inc.php'); - $xajax = new xajax($GLOBALS['egw']->link('/xajax.php'), 'xajax_', $GLOBALS['egw']->translation->charset()); + $xajax = new xajax(egw::link('/xajax.php'), 'xajax_', translation::charset()); $xajax->waitCursorOff(); $xajax->registerFunction("doXMLHTTP"); diff --git a/phpgwapi/inc/class.egw_time.inc.php b/phpgwapi/inc/class.egw_time.inc.php index 15b1dcc832..adfeda39a8 100644 --- a/phpgwapi/inc/class.egw_time.inc.php +++ b/phpgwapi/inc/class.egw_time.inc.php @@ -311,19 +311,21 @@ class egw_time extends DateTime * Setter for user timezone, should be called after reading user preferences * * @param string $tz timezone, eg. 'Europe/Berlin' or 'UTC' - * @param string $dateformat eg. 'Y-m-d' or 'd.m.Y' - * @param string|int $timeformat integer 12, 24, or format string eg. 'H:i' + * @param string $dateformat='' eg. 'Y-m-d' or 'd.m.Y' + * @param string|int $timeformat='' integer 12, 24, or format string eg. 'H:i' * @throws egw_exception_wrong_userinput if invalid $tz parameter * @return DateTimeZone */ - public static function setUserPrefs($tz,$dateformat,$timeformat) + public static function setUserPrefs($tz,$dateformat='',$timeformat='') { + //echo "

".__METHOD__."('$tz','$dateformat','$timeformat') ".function_backtrace()."

\n"; if (!empty($dateformat)) self::$user_dateformat = $dateformat; switch($timeformat) { - case '24': case '': + break; + case '24': self::$user_timeformat = 'H:i'; break; case '12': @@ -377,6 +379,54 @@ class egw_time extends DateTime self::$user_timezone = clone(self::$server_timezone); } } + + /** + * Return "beautified" timezone list: + * - no depricated timezones + * - return UTC and oceans at the end + * - if (user lang is a european language), move Europe to top + * + * @return array continent|ocean => array(tz-name => tz-label incl. current time) + */ + public static function getTimezones() + { + // prepare list of timezones from php, ignoring depricated ones and sort as follows + $tzs = array( + 'Africa' => array(), // Contients + 'America' => array(), + 'Asia' => array(), + 'Australia' => array(), + 'Europe' => array(), + 'Atlantic' => array(), // Oceans + 'Pacific' => array(), + 'Indian' => array(), + 'Antarctica' => array(), // Poles + 'Arctic' => array(), + 'UTC' => array('UTC' => 'UTC'), + ); + foreach(DateTimeZone::listIdentifiers() as $name) + { + list($continent,$rest) = explode('/',$name,2); + if (!isset($tzs[$continent])) continue; // old depricated timezones + $datetime = new egw_time('now',new DateTimeZone($name)); + $tzs[$continent][$name] = str_replace(array('_','/'),array(' ',' / '),$name).'   '.$datetime->format(); + unset($datetime); + } + foreach($tzs as $continent => &$data) + { + natcasesort($data); // sort cities + } + unset($data); + + // if user lang or installed langs contain a european language --> move Europe to top of tz list + $langs = $GLOBALS['egw']->translation->get_installed_langs(); + if (array_intersect(array($GLOBALS['egw_info']['user']['preferences']['common']['lang'])+array_keys($langs), + array('de','fr','it','nl','bg','ca','cs','da','el','es-es','et','eu','fi','hr','hu','lt','no','pl','pt','sk','sl','sv','tr','uk'))) + { + $tzs = array_merge(array('Europe' => $tzs['Europe']),$tzs); + } + return $tzs; + } } egw_time::init(); diff --git a/preferences/inc/class.preferences_hooks.inc.php b/preferences/inc/class.preferences_hooks.inc.php new file mode 100644 index 0000000000..24ff3af605 --- /dev/null +++ b/preferences/inc/class.preferences_hooks.inc.php @@ -0,0 +1,359 @@ + $value) + { + $_templates[$var] = $templates[$var]['title']; + } + + $themes = common::list_themes(); + foreach($themes as $value) + { + $_themes[$value] = $value; + } + + $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') + ); + + $langs = translation::get_installed_langs(); + + $tzs = egw_time::getTimezones(); + + $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', + 'd-M-Y' => 'd-M-Y' + ); + + $time_formats = array( + '12' => lang('12 hour'), + '24' => lang('24 hour') + ); + + $html_enter_mode = array( + 'p' => lang('p: Paragraph'), + 'div' => lang('div'), + 'br' => lang('br') + ); + + $rich_text_editor_skins = array( + 'default' => lang ('Default theme'), + 'office2003' => lang ('Office 2003 theme'), + 'silver' => lang ('Silver theme') + ); + + $user_apps = array(); + foreach($GLOBALS['egw_info']['user']['apps'] as $app => $data) + { + if($GLOBALS['egw_info']['apps'][$app]['status'] != 2 && $app) + { + $user_apps[$app] = $GLOBALS['egw_info']['apps'][$app]['title'] ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app); + } + } + + $account_sels = array( + 'selectbox' => lang('Selectbox'), + 'primary_group' => lang('Selectbox with primary group and search'), + 'popup' => lang('Popup with 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'), + ); + + // Settings array for this app + $settings = array( + '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.
To many slow down the page display, to less will cost you the overview.', + 'size' => 3, + 'xmlrpc' => True, + 'admin' => False + ), + 'template_set' => array( + 'type' => 'select', + 'label' => 'Interface/Template Selection', + 'name' => 'template_set', + 'values' => $_templates, + 'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.', + 'xmlrpc' => True, + 'admin' => False + ), + 'theme' => array( + 'type' => 'select', + 'label' => 'Theme (colors/fonts) Selection', + 'name' => 'theme', + 'values' => $_themes, + 'help' => 'A theme defines the colors and fonts used by the template.', + 'xmlrpc' => True, + 'admin' => False + ), + '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 + ), + 'link_list_format' => array( + 'type' => 'select', + '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.', + 'xmlrpc' => True, + 'admin' => False + ), + 'link_list_thumbnail' => array( + 'type' => 'select', + 'label' => 'Display thumbnails for linked images', + 'name' => 'link_list_thumbnail', + 'values' => array( + '1' => lang('Yes'), + '0' => lang('No'), + ), + '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 + ), + 'tz' => array( + 'type' => 'select', + 'label' => 'Time zone', + 'name' => 'tz', + 'values' => $tzs, + 'help' => 'Please select your timezone.', + 'xmlrpc' => True, + 'admin' => False + ), + 'tz_selection' => array( + 'type' => 'multiselect', + 'label' => 'Permanent time zone selection', + 'name' => 'tz_selection', + 'values' => call_user_func_array('array_merge',$tzs), // only flat arrays supported + '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, + 'admin' => False + ), + 'dateformat' => array( + 'type' => 'select', + 'label' => 'Date format', + 'name' => 'dateformat', + 'values' => $date_formats, + 'help' => 'How should eGroupWare display dates for you.', + 'xmlrpc' => True, + 'admin' => False + ), + '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, + 'admin' => False + ), + 'country' => array( + 'type' => 'select', + 'label' => 'Country', + 'name' => 'country', + 'values' => ExecMethod('phpgwapi.country.countries'), + 'help' => 'In which country are you. This is used to set certain defaults for you.', + 'xmlrpc' => True, + 'admin' => False + ), + 'lang' => array( + 'type' => 'select', + 'label' => 'Language', + 'name' => 'lang', + 'values' => $langs, + 'help' => 'Select the language of texts and messages within eGroupWare.
Some languages may not contain all messages, in that case you will see an english message.', + 'xmlrpc' => True, + 'admin' => False + ), + 'spellchecker_lang' => array( + 'type' => 'select', + 'label' => 'Spellchecker language', + 'name' => 'spellchecker_lang', + 'values' => $langs, + 'help' => 'Select the language of the spellchecker integrated into the rich text editor.', + 'xmlrpc' => True, + 'admin' => False + ), + 'rte_enter_mode' => array( + 'type' => 'select', + 'label' => 'Rich text editor enter mode', + 'name' => 'rte_enter_mode', + 'values' => $html_enter_mode, + 'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.', + 'xmlrpc' => True, + 'admin' => False + ), + 'rte_skin' => array( + 'type' => 'select', + 'label' => 'Rich text editor theme', + 'name' => 'rte_skin', + 'values' => $rich_text_editor_skins, + 'help' => 'Select the theme (visualization) of the rich text editor.', + 'xmlrpc' => True, + 'admin' => False + ), + 'show_currentusers' => array( + '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 + ), + 'default_app' => array( + 'type' => 'select', + 'label' => 'Default application', + 'name' => 'default_app', + 'values' => $user_apps, + 'help' => "The default application will be started when you enter eGroupWare or click on the homepage icon.
You can also have more than one application showing up on the homepage, if you don't choose a specific application here (has to be configured in the preferences of each application).", + 'xmlrpc' => False, + 'admin' => False + ), + 'currency' => array( + 'type' => 'input', + 'label' => 'Currency', + 'name' => 'currency', + 'help' => 'Which currency symbol or name should be used in eGroupWare.', + 'xmlrpc' => True, + 'admin' => False + ), + '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.').' '. + lang('The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.'), + 'run_lang' => false, + 'xmlrpc' => True, + 'admin' => False + ), + '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 + ), + 'show_help' => array( + 'type' => 'check', + 'label' => 'Show helpmessages by default', + 'name' => 'show_help', + 'help' => 'Should this help messages shown up always, when you enter the preferences or only on request.', + 'xmlrpc' => False, + 'admin' => False + ), + 'enable_dragdrop' => array( + 'type' => 'check', + 'label' => 'Enable drag and drop functionality (experimental)', + 'name' => 'enable_dragdrop', + 'help' => 'Enables or disables drag and drop functions in all applications. If the browser does not support '. + 'drag and drop, it will be disabled automatically. This feature is experimental at the moment.', + 'xmlrpc' => False, + 'admin' => False + ), + 'csv_charset' => array( + 'type' => 'select', + 'label' => 'Charset for the CSV export', + 'name' => 'csv_charset', + 'values' => translation::get_installed_charsets()+array('utf-8' => 'utf-8 (Unicode)'), + 'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.', + 'xmlrpc' => True, + 'admin' => false, + ), + ); + // disable thumbnails, if no size configured by admin + if (!$GLOBALS['egw_info']['server']['link_list_thumbnail']) unset($settings['link_list_thumbnail']); + + return $settings; + } + + /** + * Hook to return preferences menu items + * + * @param string|array $hook_data + */ + public static function preferences($hook_data) + { + if (!$GLOBALS['egw']->acl->check('nopasswordchange',1)) + { + $file['Change your Password'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uipassword.change'); + } + $file['common preferences'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=preferences'); + + display_section('preferences',$file); + } + + /** + * Hook called when a user gets deleted, to delete his preferences + * + * @param string|array $hook_data + */ + public static function deleteaccount($hook_data) + { + if((int)$GLOBALS['hook_values']['account_id'] > 0) + { + $GLOBALS['egw']->preferences->delete_user($GLOBALS['hook_values']['account_id']); + } + } +} diff --git a/preferences/inc/hook_deleteaccount.inc.php b/preferences/inc/hook_deleteaccount.inc.php deleted file mode 100755 index ad7ed9a351..0000000000 --- a/preferences/inc/hook_deleteaccount.inc.php +++ /dev/null @@ -1,19 +0,0 @@ - * - * -------------------------------------------- * - * This program is free software; you can redistribute it and/or modify it * - * under the terms of the GNU General Public License as published by the * - * Free Software Foundation; either version 2 of the License, or (at your * - * option) any later version. * - \**************************************************************************/ - - /* $Id$ */ - - // Delete all prefs of a user - if((int)$GLOBALS['hook_values']['account_id'] > 0) - { - $GLOBALS['egw']->preferences->delete_user($GLOBALS['hook_values']['account_id']); - } diff --git a/preferences/inc/hook_preferences.inc.php b/preferences/inc/hook_preferences.inc.php deleted file mode 100644 index 16002c2991..0000000000 --- a/preferences/inc/hook_preferences.inc.php +++ /dev/null @@ -1,22 +0,0 @@ - * - * -------------------------------------------- * - * This program is free software; you can redistribute it and/or modify it * - * under the terms of the GNU General Public License as published by the * - * Free Software Foundation; either version 2 of the License, or (at your * - * option) any later version. * - \**************************************************************************/ - - /* $Id$ */ - - if (!$GLOBALS['egw']->acl->check('nopasswordchange',1)) - { - $file['Change your Password'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uipassword.change'); - } - $file['common preferences'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=preferences'); - - display_section('preferences',$file); -?> diff --git a/preferences/inc/hook_settings.inc.php b/preferences/inc/hook_settings.inc.php deleted file mode 100755 index bc65125a3f..0000000000 --- a/preferences/inc/hook_settings.inc.php +++ /dev/null @@ -1,365 +0,0 @@ -common->list_templates(); -foreach($templates as $var => $value) -{ - $_templates[$var] = $templates[$var]['title']; -} - -$themes = $GLOBALS['egw']->common->list_themes(); -foreach($themes as $value) -{ - $_themes[$value] = $value; -} - -$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') -); - -$format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']; -$format = ($format ? $format : 'Y/m/d') . ', '; -if($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12') -{ - $format .= 'h:i a'; -} -else -{ - $format .= 'H:i'; -} -/* -for($i = -23.5; $i < 24.0; $i += 0.5) -{ - $t = time() + round($i * 3600); - $tz_offset[(string)$i] = sprintf('%3.1lf',$i) . ' ' . lang('hours').': ' . date($format,$t); -} -*/ -// prepare list of timezones from php, ignoring depricated ones and sort as follows -$tzs = array( - 'Africa' => array(), // Contients - 'America' => array(), - 'Asia' => array(), - 'Australia' => array(), - 'Europe' => array(), - 'Atlantic' => array(), // Oceans - 'Pacific' => array(), - 'Indian' => array(), - 'Antarctica' => array(), // Poles - 'Arctic' => array(), - 'UTC' => array('UTC' => 'UTC'), -); -foreach(DateTimeZone::listIdentifiers() as $name) -{ - list($continent,$rest) = explode('/',$name,2); - if (!isset($tzs[$continent])) continue; // old depricated timezones - $datetime = new DateTime('now',new DateTimeZone($name)); - $tzs[$continent][$name] = str_replace(array('_','/'),array(' ',' / '),$name).'   '.$datetime->format($format); - unset($datetime); -} -foreach($tzs as $continent => &$data) -{ - natcasesort($data); // sort cities -} -unset($data); - -// if user lang or installed langs contain a european language --> move Europe to top of tz list -$langs = $GLOBALS['egw']->translation->get_installed_langs(); -if (array_intersect(array($GLOBALS['egw_info']['user']['preferences']['common']['lang'])+array_keys($langs), - array('de','fr','it','nl','bg','ca','cs','da','el','es-es','et','eu','fi','hr','hu','lt','no','pl','pt','sk','sl','sv','tr','uk'))) -{ - $tzs = array_merge(array('Europe' => $tzs['Europe']),$tzs); -} - -$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', - 'd-M-Y' => 'd-M-Y' -); - -$time_formats = array( - '12' => lang('12 hour'), - '24' => lang('24 hour') -); - -$html_enter_mode = array( - 'p' => lang('p: Paragraph'), - 'div' => lang('div'), - 'br' => lang('br') -); - -$rich_text_editor_skins = array( - 'default' => lang ('Default theme'), - 'office2003' => lang ('Office 2003 theme'), - 'silver' => lang ('Silver theme') -); - -$user_apps = array(); -foreach($GLOBALS['egw_info']['user']['apps'] as $app => $data) -{ - if($GLOBALS['egw_info']['apps'][$app]['status'] != 2 && $app) - { - $user_apps[$app] = $GLOBALS['egw_info']['apps'][$app]['title'] ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app); - } -} - -$account_sels = array( - 'selectbox' => lang('Selectbox'), - 'primary_group' => lang('Selectbox with primary group and search'), - 'popup' => lang('Popup with 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'), -); - -/* Settings array for this app */ -$GLOBALS['settings'] = array( - '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.
To many slow down the page display, to less will cost you the overview.', - 'size' => 3, - 'xmlrpc' => True, - 'admin' => False - ), - 'template_set' => array( - 'type' => 'select', - 'label' => 'Interface/Template Selection', - 'name' => 'template_set', - 'values' => $_templates, - 'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.', - 'xmlrpc' => True, - 'admin' => False - ), - 'theme' => array( - 'type' => 'select', - 'label' => 'Theme (colors/fonts) Selection', - 'name' => 'theme', - 'values' => $_themes, - 'help' => 'A theme defines the colors and fonts used by the template.', - 'xmlrpc' => True, - 'admin' => False - ), - '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 - ), - 'link_list_format' => array( - 'type' => 'select', - '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.', - 'xmlrpc' => True, - 'admin' => False - ), - 'link_list_thumbnail' => array( - 'type' => 'select', - 'label' => 'Display thumbnails for linked images', - 'name' => 'link_list_thumbnail', - 'values' => array( - '1' => lang('Yes'), - '0' => lang('No'), - ), - '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 - ), -/* - 'tz_offset' => array( - 'type' => 'select', - 'label' => 'Time zone offset', - 'name' => 'tz_offset', - 'values' => $tz_offset, - 'help' => 'How many hours are you in front or after the timezone of the server.
If you are in the same time zone as the server select 0 hours, else select your locale date and time.', - 'xmlrpc' => True, - 'admin' => False - ), -*/ - 'tz' => array( - 'type' => 'select', - 'label' => 'Time zone', - 'name' => 'tz', - 'values' => $tzs, - 'help' => 'Please select your timezone.', - 'xmlrpc' => True, - 'admin' => False - ), - 'dateformat' => array( - 'type' => 'select', - 'label' => 'Date format', - 'name' => 'dateformat', - 'values' => $date_formats, - 'help' => 'How should eGroupWare display dates for you.', - 'xmlrpc' => True, - 'admin' => False - ), - '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, - 'admin' => False - ), - 'country' => array( - 'type' => 'select', - 'label' => 'Country', - 'name' => 'country', - 'values' => ExecMethod('phpgwapi.country.countries'), - 'help' => 'In which country are you. This is used to set certain defaults for you.', - 'xmlrpc' => True, - 'admin' => False - ), - 'lang' => array( - 'type' => 'select', - 'label' => 'Language', - 'name' => 'lang', - 'values' => $langs, - 'help' => 'Select the language of texts and messages within eGroupWare.
Some languages may not contain all messages, in that case you will see an english message.', - 'xmlrpc' => True, - 'admin' => False - ), - 'spellchecker_lang' => array( - 'type' => 'select', - 'label' => 'Spellchecker language', - 'name' => 'spellchecker_lang', - 'values' => $langs, - 'help' => 'Select the language of the spellchecker integrated into the rich text editor.', - 'xmlrpc' => True, - 'admin' => False - ), - 'rte_enter_mode' => array( - 'type' => 'select', - 'label' => 'Rich text editor enter mode', - 'name' => 'rte_enter_mode', - 'values' => $html_enter_mode, - 'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.', - 'xmlrpc' => True, - 'admin' => False - ), - 'rte_skin' => array( - 'type' => 'select', - 'label' => 'Rich text editor theme', - 'name' => 'rte_skin', - 'values' => $rich_text_editor_skins, - 'help' => 'Select the theme (visualization) of the rich text editor.', - 'xmlrpc' => True, - 'admin' => False - ), - 'show_currentusers' => array( - '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 - ), - 'default_app' => array( - 'type' => 'select', - 'label' => 'Default application', - 'name' => 'default_app', - 'values' => $user_apps, - 'help' => "The default application will be started when you enter eGroupWare or click on the homepage icon.
You can also have more than one application showing up on the homepage, if you don't choose a specific application here (has to be configured in the preferences of each application).", - 'xmlrpc' => False, - 'admin' => False - ), - 'currency' => array( - 'type' => 'input', - 'label' => 'Currency', - 'name' => 'currency', - 'help' => 'Which currency symbol or name should be used in eGroupWare.', - 'xmlrpc' => True, - 'admin' => False - ), - '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.').' '. - lang('The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.'), - 'run_lang' => false, - 'xmlrpc' => True, - 'admin' => False - ), - '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 - ), - 'show_help' => array( - 'type' => 'check', - 'label' => 'Show helpmessages by default', - 'name' => 'show_help', - 'help' => 'Should this help messages shown up always, when you enter the preferences or only on request.', - 'xmlrpc' => False, - 'admin' => False - ), - 'enable_dragdrop' => array( - 'type' => 'check', - 'label' => 'Enable drag and drop functionality (experimental)', - 'name' => 'enable_dragdrop', - 'help' => 'Enables or disables drag and drop functions in all applications. If the browser does not support '. - 'drag and drop, it will be disabled automatically. This feature is experimental at the moment.', - 'xmlrpc' => False, - 'admin' => False - ), - 'csv_charset' => array( - 'type' => 'select', - 'label' => 'Charset for the CSV export', - 'name' => 'csv_charset', - 'values' => $GLOBALS['egw']->translation->get_installed_charsets()+array('utf-8' => 'utf-8 (Unicode)'), - 'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.', - 'xmlrpc' => True, - 'admin' => false, - ), -); -// disable thumbnails, if no size configured by admin -if (!$GLOBALS['egw_info']['server']['link_list_thumbnail']) unset($GLOBALS['settings']['link_list_thumbnail']); diff --git a/preferences/setup/setup.inc.php b/preferences/setup/setup.inc.php index 504a06242d..6cfe1ec427 100755 --- a/preferences/setup/setup.inc.php +++ b/preferences/setup/setup.inc.php @@ -11,17 +11,16 @@ $setup_info['preferences']['name'] = 'preferences'; $setup_info['preferences']['title'] = 'Preferences'; -$setup_info['preferences']['version'] = '1.6'; +$setup_info['preferences']['version'] = '1.7'; $setup_info['preferences']['app_order'] = 1; $setup_info['preferences']['tables'] = ''; $setup_info['preferences']['enable'] = 2; /* The hooks this app includes, needed for hooks registration */ -$setup_info['preferences']['hooks'][] = 'deleteaccount'; -$setup_info['preferences']['hooks'][] = 'config'; -$setup_info['preferences']['hooks'][] = 'preferences'; -$setup_info['preferences']['hooks'][] = 'settings'; -$setup_info['preferences']['hooks']['edit_user'] = 'preferences.uisettings.edit_user'; +$setup_info['preferences']['hooks']['deleteaccount'] = 'preferences_hooks::deleteaccount'; +$setup_info['preferences']['hooks']['preferences'] = 'preferences_hooks::preferences'; +$setup_info['preferences']['hooks']['settings'] = 'preferences_hooks::settings'; +$setup_info['preferences']['hooks']['edit_user'] = 'preferences.uisettings.edit_user'; /* Dependencies for this app to work */ $setup_info['preferences']['depends'][] = array(