first step for real timezones in EGroupware

This commit is contained in:
Ralf Becker 2009-10-06 06:45:28 +00:00
parent 1353ae511a
commit 610b629325
3 changed files with 429 additions and 350 deletions

View File

@ -204,6 +204,8 @@ class egw extends egw_minimal
// init the translation class, necessary as own wakeup would run before our's // init the translation class, necessary as own wakeup would run before our's
translation::init(); translation::init();
$this->unset_datetime();
// verify the session // verify the session
$GLOBALS['egw']->verify_session(); $GLOBALS['egw']->verify_session();
$GLOBALS['egw']->check_app_rights(); $GLOBALS['egw']->check_app_rights();
@ -211,6 +213,14 @@ class egw extends egw_minimal
$this->load_optional_classes(); $this->load_optional_classes();
} }
/**
* Unsetting datetime object, so time gets updated
*/
function unset_datetime()
{
unset($this->datetime);
}
/** /**
* load optional classes by mentioning them in egw_info[flags][enable_CLASS_class] => true * load optional classes by mentioning them in egw_info[flags][enable_CLASS_class] => true
* *

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* eGroupWare API - Preferences * eGroupWare API - Preferences
* *
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Joseph Engo <jengo@phpgroupware.org> * @author Joseph Engo <jengo@phpgroupware.org>
* @author Mark Peters <skeeter@phpgroupware.org> * @author Mark Peters <skeeter@phpgroupware.org>
@ -15,7 +15,7 @@
/** /**
* preferences class used for setting application preferences * preferences class used for setting application preferences
* *
* the prefs are read into 4 arrays: * the prefs are read into 4 arrays:
* $data the effective prefs used everywhere in phpgw, they are merged from the other 3 arrays * $data the effective prefs used everywhere in phpgw, they are merged from the other 3 arrays
* $user the stored user prefs, only used for manipulating and storeing the user prefs * $user the stored user prefs, only used for manipulating and storeing the user prefs
* $default the default preferences, always used when the user has no own preference set * $default the default preferences, always used when the user has no own preference set
@ -34,17 +34,17 @@ class preferences
*/ */
var $account_type; var $account_type;
/** /**
* effectiv user prefs, used by all apps * effectiv user prefs, used by all apps
* @var array * @var array
*/ */
var $data = array(); var $data = array();
/** /**
* set user prefs for saveing (no defaults/forced prefs merged) * set user prefs for saveing (no defaults/forced prefs merged)
* @var array * @var array
*/ */
var $user = array(); var $user = array();
/** /**
* default prefs * default prefs
* @var array * @var array
*/ */
var $default = array(); var $default = array();
@ -59,7 +59,7 @@ class preferences
*/ */
var $session = array(); var $session = array();
/** /**
* @var egw_db * @var egw_db
*/ */
var $db; var $db;
/** /**
@ -116,7 +116,7 @@ class preferences
} }
return str_replace($replace,$with,$msg); return str_replace($replace,$with,$msg);
} }
/** /**
* replaces the english key's with translated ones, or if $un_lang the opposite * replaces the english key's with translated ones, or if $un_lang the opposite
* *
@ -313,11 +313,36 @@ class preferences
echo 'user<pre>'; print_r($this->user); echo "</pre>\n"; echo 'user<pre>'; print_r($this->user); echo "</pre>\n";
echo 'forced<pre>'; print_r($this->forced); echo "</pre>\n"; echo 'forced<pre>'; print_r($this->forced); echo "</pre>\n";
echo 'default<pre>'; print_r($this->default); echo "</pre>\n"; echo 'default<pre>'; print_r($this->default); echo "</pre>\n";
echo 'effectiv<pre>'; print_r($this->data); echo "</pre>\n"; echo 'effectiv<pre>'; print_r($this->data); echo "</pre>\n";
} }
$this->check_set_tz_offset();
return $this->data; return $this->data;
} }
/**
* Checking new timezoen ('tz') pref and setting old tz_offset pref from it
*
*/
function check_set_tz_offset()
{
$prefs =& $this->data['common'];
if (isset($prefs['tz']))
{
$GLOBALS['egw']->datetimezone = new DateTimeZone($prefs['tz']);
$server_offset = date('Z');
$GLOBALS['egw']->datetime_now = new DateTime('now',$GLOBALS['egw']->datetimezone);
$utc_offset = $GLOBALS['egw']->datetime_now->getOffset();
$user_now = $GLOBALS['egw']->datetime_now->format('Y-m-d H:i:s e (T)');
$GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'] = $prefs['tz_offset'] = ($utc_offset - $server_offset)/3600;
//echo "<p>".__METHOD__."() tz='{$prefs['tz']}'=$utc_offset=$user_now, server=date('Z')=$server_offset --> $prefs[tz_offset]</p>\n";
$GLOBALS['egw']->unset_datetime(); // to force an update
}
}
/** /**
* read preferences from repository and stores in an array * read preferences from repository and stores in an array
* *
@ -452,7 +477,7 @@ class preferences
reset ($this->data); reset ($this->data);
return $this->data; return $this->data;
} }
/** /**
* delete all prefs of a given user * delete all prefs of a given user
* *
@ -653,41 +678,41 @@ class preferences
$GLOBALS['egw_info']['user']['preferences'] = array(); $GLOBALS['egw_info']['user']['preferences'] = array();
} }
/* This takes care of new users who don't have proper default prefs setup */ /* This takes care of new users who don't have proper default prefs setup */
if (!isset($GLOBALS['egw_info']['flags']['nocommon_preferences']) || if (!isset($GLOBALS['egw_info']['flags']['nocommon_preferences']) ||
!$GLOBALS['egw_info']['flags']['nocommon_preferences']) !$GLOBALS['egw_info']['flags']['nocommon_preferences'])
{ {
$preferences_update = False; $preferences_update = False;
if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']) || if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']) ||
!$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs']) !$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'])
{ {
$this->add('common','maxmatchs',15); $this->add('common','maxmatchs',15);
$preferences_update = True; $preferences_update = True;
} }
if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['theme']) || if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
!$GLOBALS['egw_info']['user']['preferences']['common']['theme']) !$GLOBALS['egw_info']['user']['preferences']['common']['theme'])
{ {
$this->add('common','theme','default'); $this->add('common','theme','default');
$preferences_update = True; $preferences_update = True;
} }
if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) || if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['template_set']) ||
!$GLOBALS['egw_info']['user']['preferences']['common']['template_set']) !$GLOBALS['egw_info']['user']['preferences']['common']['template_set'])
{ {
$this->add('common','template_set','default'); $this->add('common','template_set','default');
$preferences_update = True; $preferences_update = True;
} }
if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['dateformat']) || if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['dateformat']) ||
!$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']) !$GLOBALS['egw_info']['user']['preferences']['common']['dateformat'])
{ {
$this->add('common','dateformat','m/d/Y'); $this->add('common','dateformat','m/d/Y');
$preferences_update = True; $preferences_update = True;
} }
if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']) || if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']) ||
!$GLOBALS['egw_info']['user']['preferences']['common']['timeformat']) !$GLOBALS['egw_info']['user']['preferences']['common']['timeformat'])
{ {
$this->add('common','timeformat',12); $this->add('common','timeformat',12);
$preferences_update = True; $preferences_update = True;
} }
if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['lang']) || if (!isset($GLOBALS['egw_info']['user']['preferences']['common']['lang']) ||
!$GLOBALS['egw_info']['user']['preferences']['common']['lang']) !$GLOBALS['egw_info']['user']['preferences']['common']['lang'])
{ {
$this->add('common','lang',$GLOBALS['egw']->common->getPreferredLanguage()); $this->add('common','lang',$GLOBALS['egw']->common->getPreferredLanguage());
@ -712,8 +737,8 @@ class preferences
* mail server of type pop3, pop3s, imap, imaps users value from * mail server of type pop3, pop3s, imap, imaps users value from
* $phpgw_info['user']['preferences']['email']['mail_port']. * $phpgw_info['user']['preferences']['email']['mail_port'].
* if that value is not set, it generates a default port for the given $server_type. * if that value is not set, it generates a default port for the given $server_type.
* Someday, this *MAY* be * Someday, this *MAY* be
* (a) a se4rver wide admin setting, or * (a) a se4rver wide admin setting, or
* (b)user custom preference * (b)user custom preference
* Until then, simply set the port number based on the mail_server_type, thereof * Until then, simply set the port number based on the mail_server_type, thereof
* ONLY call this function AFTER ['email']['mail_server_type'] has been set. * ONLY call this function AFTER ['email']['mail_server_type'] has been set.
@ -757,7 +782,7 @@ class preferences
$port_number = 993; $port_number = 993;
break; break;
case 'imap': case 'imap':
// IMAP normal connection, No SSL // IMAP normal connection, No SSL
default: default:
// UNKNOWN SERVER in Preferences, return a // UNKNOWN SERVER in Preferences, return a
// default value that is likely to work // default value that is likely to work
@ -794,8 +819,8 @@ class preferences
/** /**
* returns the custom email-address (if set) or generates a default one * returns the custom email-address (if set) or generates a default one
* *
* This will generate the appropriate email address used as the "From:" * This will generate the appropriate email address used as the "From:"
* email address when the user sends email, the localpert * part. The "personal" * email address when the user sends email, the localpert * part. The "personal"
* part is generated elsewhere. * part is generated elsewhere.
* In the absence of a custom ['email']['address'], this function should be used to set it. * In the absence of a custom ['email']['address'], this function should be used to set it.
* *
@ -836,9 +861,9 @@ class preferences
* $GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->create_email_preferences(); * $GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->create_email_preferences();
* which fills an array based at: * which fills an array based at:
* $GLOBALS['egw_info']['user']['preferences']['email'][prefs_are_elements_here] * $GLOBALS['egw_info']['user']['preferences']['email'][prefs_are_elements_here]
* Reading the raw preference DB data and comparing to the email preference schema defined in * Reading the raw preference DB data and comparing to the email preference schema defined in
* /email/class.bopreferences.inc.php (see discussion there and below) to create default preference values * /email/class.bopreferences.inc.php (see discussion there and below) to create default preference values
* for the in the ['email'][] pref data array in cases where the user has not supplied * for the in the ['email'][] pref data array in cases where the user has not supplied
* a preference value for any particular preference item available to the user. * a preference value for any particular preference item available to the user.
* @access Public * @access Public
*/ */
@ -878,7 +903,7 @@ class preferences
// prefs are actually a sub-element of the main email prefs // prefs are actually a sub-element of the main email prefs
// at location [email][ex_accounts][X][...pref names] => pref values // at location [email][ex_accounts][X][...pref names] => pref values
// make this look like "prefs[email] so the code below code below will do its job transparently // make this look like "prefs[email] so the code below code below will do its job transparently
// obtain the desired sub-array of extra account prefs // obtain the desired sub-array of extra account prefs
$sub_prefs = array(); $sub_prefs = array();
$sub_prefs['email'] = $prefs['email']['ex_accounts'][$acctnum]; $sub_prefs['email'] = $prefs['email']['ex_accounts'][$acctnum];
@ -893,7 +918,7 @@ class preferences
// Default Preferences info that is: // Default Preferences info that is:
// (a) not controlled by email prefs itself (mostly api and/or server level stuff) // (a) not controlled by email prefs itself (mostly api and/or server level stuff)
// (b) too complicated to be described in the email prefs data array instructions // (b) too complicated to be described in the email prefs data array instructions
// --- [server][mail_server_type] --- // --- [server][mail_server_type] ---
// Set API Level Server Mail Type if not defined // Set API Level Server Mail Type if not defined
// if for some reason the API didnot have a mail server type set during initialization // if for some reason the API didnot have a mail server type set during initialization
@ -960,11 +985,11 @@ class preferences
// --- make the schema-based pref data for this user --- // --- make the schema-based pref data for this user ---
// user defined values and/or user specified custom email prefs are read from the // user defined values and/or user specified custom email prefs are read from the
// prefs DB with mininal manipulation of the data. Currently the only change to // prefs DB with mininal manipulation of the data. Currently the only change to
// users raw data is related to reversing the encoding of "database un-friendly" chars // users raw data is related to reversing the encoding of "database un-friendly" chars
// which itself may become unnecessary if and when the database handlers can reliably // which itself may become unnecessary if and when the database handlers can reliably
// take care of this for us. Of course, password data requires special decoding, // take care of this for us. Of course, password data requires special decoding,
// but the password in the array [email][paswd] should be left in encrypted form // but the password in the array [email][paswd] should be left in encrypted form
// and only decrypted seperately when used to login in to an email server. // and only decrypted seperately when used to login in to an email server.
// --- generating a default value if necessary --- // --- generating a default value if necessary ---
@ -983,7 +1008,7 @@ class preferences
// default value for a particular preference if one is needed (i.e. if no user custom // default value for a particular preference if one is needed (i.e. if no user custom
// email preference exists that should override that default value, in which case we // email preference exists that should override that default value, in which case we
// do not even need to obtain such a default value as described in ['init_default'] anyway). // do not even need to obtain such a default value as described in ['init_default'] anyway).
// --- loop thru $avail_pref_array and process each pref item --- // --- loop thru $avail_pref_array and process each pref item ---
$c_prefs = count($avail_pref_array); $c_prefs = count($avail_pref_array);
for($i=0;$i<$c_prefs;$i++) for($i=0;$i<$c_prefs;$i++)
@ -994,7 +1019,7 @@ class preferences
// --- is there a value in the DB for this preference item --- // --- is there a value in the DB for this preference item ---
// if the prefs DB has no value for this defined available preference, we must make one. // if the prefs DB has no value for this defined available preference, we must make one.
// This occurs if (a) this is user's first login, or (b) this is a custom pref which the user // This occurs if (a) this is user's first login, or (b) this is a custom pref which the user
// has not overriden, do a default (non-custom) value is needed. // has not overriden, do a default (non-custom) value is needed.
if (!isset($prefs['email'][$this_avail_pref['id']])) if (!isset($prefs['email'][$this_avail_pref['id']]))
{ {
@ -1034,7 +1059,7 @@ class preferences
} }
else else
{ {
// opposite of boolean not_set = string "True" which simply sets a // opposite of boolean not_set = string "True" which simply sets a
// value it exists in the users session [email][] preference array // value it exists in the users session [email][] preference array
$prefs['email'][$this_avail_pref['id']] = 'True'; $prefs['email'][$this_avail_pref['id']] = 'True';
} }
@ -1058,7 +1083,7 @@ class preferences
// INIT_NO_FILL // INIT_NO_FILL
elseif ($set_proc[0] == 'init_no_fill') elseif ($set_proc[0] == 'init_no_fill')
{ {
// we have an available preference item that we may NOT fill with a default // we have an available preference item that we may NOT fill with a default
// value. Only the user may supply a value for this pref item. // value. Only the user may supply a value for this pref item.
print_debug('* handle "init_no_fill" set_proc:', serialize($set_proc),'api'); print_debug('* handle "init_no_fill" set_proc:', serialize($set_proc),'api');
// we are FORBADE from filling this at this time! // we are FORBADE from filling this at this time!
@ -1066,7 +1091,7 @@ class preferences
// varEVAL // varEVAL
elseif ($set_proc[0] == 'varEVAL') elseif ($set_proc[0] == 'varEVAL')
{ {
// similar to "function" but used for array references, the string in $set_proc[1] // similar to "function" but used for array references, the string in $set_proc[1]
// represents code which typically is an array referencing a system/api property // represents code which typically is an array referencing a system/api property
print_debug('* handle "GLOBALS" set_proc:', serialize($set_proc),'api'); print_debug('* handle "GLOBALS" set_proc:', serialize($set_proc),'api');
$evaled = ''; $evaled = '';
@ -1092,8 +1117,8 @@ class preferences
/// here until the next OFFICIAL submit email prefs function, where it /// here until the next OFFICIAL submit email prefs function, where it
// will again get this preparation before being written to the database. // will again get this preparation before being written to the database.
// NOTE: if database de-fanging is eventually handled deeper in the // NOTE: if database de-fanging is eventually handled deeper in the
// preferences class, then the following code would become depreciated // preferences class, then the following code would become depreciated
// and should be removed in that case. // and should be removed in that case.
if (($this_avail_pref['type'] == 'user_string') && if (($this_avail_pref['type'] == 'user_string') &&
(stristr($this_avail_pref['write_props'], 'no_db_defang') == False)) (stristr($this_avail_pref['write_props'], 'no_db_defang') == False))
@ -1107,7 +1132,7 @@ class preferences
} }
// users preferences are now established to known structured values... // users preferences are now established to known structured values...
// SANITY CHECK // SANITY CHECK
// --- [email][use_trash_folder] --- // --- [email][use_trash_folder] ---
// --- [email][use_sent_folder] --- // --- [email][use_sent_folder] ---
// is it possible to use Trash and Sent folders - i.e. using IMAP server // is it possible to use Trash and Sent folders - i.e. using IMAP server
@ -1127,7 +1152,7 @@ class preferences
// DEBUG : force some settings to test stuff // DEBUG : force some settings to test stuff
//$prefs['email']['p_persistent'] = 'True'; //$prefs['email']['p_persistent'] = 'True';
print_debug('class.preferences: $acctnum: ['.$acctnum.'] ; create_email_preferences: $prefs[email]', $prefs['email'],'api'); print_debug('class.preferences: $acctnum: ['.$acctnum.'] ; create_email_preferences: $prefs[email]', $prefs['email'],'api');
print_debug('class.preferences: create_email_preferences: LEAVING', 'messageonly','api'); print_debug('class.preferences: create_email_preferences: LEAVING', 'messageonly','api');
return $prefs; return $prefs;

View File

@ -1,321 +1,365 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare - Preferences * * EGroupware - Preferences
* http://www.egroupware.org * *
* -------------------------------------------- * * @link http://www.egroupware.org
* This program is free software; you can redistribute it and/or modify it * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* under the terms of the GNU General Public License as published by the * * @package preferences
* Free Software Foundation; either version 2 of the License, or (at your * * @version $Id$
* option) any later version. * */
\**************************************************************************/
/* $Id$ */ /* Setup some values to fill the array of this app's settings below */
$templates = $GLOBALS['egw']->common->list_templates();
foreach($templates as $var => $value)
{
$_templates[$var] = $templates[$var]['title'];
}
/* Setup some values to fill the array of this app's settings below */ $themes = $GLOBALS['egw']->common->list_themes();
$templates = $GLOBALS['egw']->common->list_templates(); foreach($themes as $value)
foreach($templates as $var => $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).' &nbsp; '.$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)
{ {
$_templates[$var] = $templates[$var]['title']; $user_apps[$app] = $GLOBALS['egw_info']['apps'][$app]['title'] ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app);
} }
}
$themes = $GLOBALS['egw']->common->list_themes(); $account_sels = array(
foreach($themes as $value) 'selectbox' => lang('Selectbox'),
{ 'primary_group' => lang('Selectbox with primary group and search'),
$_themes[$value] = $value; 'popup' => lang('Popup with search'),
} 'groupmembers' => lang('Selectbox with groupmembers'),
'none' => lang('No user-selection at all'),
);
$navbar_format = array( $account_display = array(
'icons' => lang('Icons only'), 'firstname' => lang('Firstname'). ' '.lang('Lastname'),
'icons_and_text' => lang('Icons and text'), 'lastname' => lang('Lastname').', '.lang('Firstname'),
'text' => lang('Text only') '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'),
);
$link_list_format = array( /* Settings array for this app */
'icons' => lang('Icons only'), $GLOBALS['settings'] = array(
'icons_and_text' => lang('Icons and text'), 'maxmatchs' => array(
'text' => lang('Text only') 'type' => 'input',
); 'label' => 'Max matches per page',
'name' => 'maxmatchs',
$format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']; '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.',
$format = ($format ? $format : 'Y/m/d') . ', '; 'size' => 3,
if($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12') 'xmlrpc' => True,
{ 'admin' => False
$format .= 'h:i a'; ),
} 'template_set' => array(
else 'type' => 'select',
{ 'label' => 'Interface/Template Selection',
$format .= 'H:i'; 'name' => 'template_set',
} 'values' => $_templates,
for($i = -23.5; $i < 24.0; $i += 0.5) 'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.',
{ 'xmlrpc' => True,
$t = time() + round($i * 3600); 'admin' => False
$tz_offset[(string)$i] = sprintf('%3.1lf',$i) . ' ' . lang('hours').': ' . date($format,$t); ),
} 'theme' => array(
'type' => 'select',
$date_formats = array( 'label' => 'Theme (colors/fonts) Selection',
'm/d/Y' => 'm/d/Y', 'name' => 'theme',
'm-d-Y' => 'm-d-Y', 'values' => $_themes,
'm.d.Y' => 'm.d.Y', 'help' => 'A theme defines the colors and fonts used by the template.',
'Y/d/m' => 'Y/d/m', 'xmlrpc' => True,
'Y-d-m' => 'Y-d-m', 'admin' => False
'Y.d.m' => 'Y.d.m', ),
'Y/m/d' => 'Y/m/d', 'navbar_format' => array(
'Y-m-d' => 'Y-m-d', 'type' => 'select',
'Y.m.d' => 'Y.m.d', 'label' => 'Show navigation bar as',
'd/m/Y' => 'd/m/Y', 'name' => 'navbar_format',
'd-m-Y' => 'd-m-Y', 'values' => $navbar_format,
'd.m.Y' => 'd.m.Y', 'help' => 'You can show the applications as icons only, icons with app-name or both.',
'd-M-Y' => 'd-M-Y' 'xmlrpc' => True,
); 'admin' => False
),
$time_formats = array( 'link_list_format' => array(
'12' => lang('12 hour'), 'type' => 'select',
'24' => lang('24 hour') 'label' => 'Show links between eGroupWare aps as',
); 'name' => 'link_list_format',
'values' => $link_list_format,
$html_enter_mode = array( 'help' => 'You can show the linked entries with icons only, icons with app-name or both.',
'p' => lang('p: Paragraph'), 'xmlrpc' => True,
'div' => lang('div'), 'admin' => False
'br' => lang('br') ),
); 'link_list_thumbnail' => array(
'type' => 'select',
$rich_text_editor_skins = array( 'label' => 'Display thumbnails for linked images',
'default' => lang ('Default theme'), 'name' => 'link_list_thumbnail',
'office2003' => lang ('Office 2003 theme'), 'values' => array(
'silver' => lang ('Silver theme') '1' => lang('Yes'),
); '0' => lang('No'),
$langs = $GLOBALS['egw']->translation->get_installed_langs();
$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.<br>To many slow down the page display, to less will cost you the overview.',
'size' => 3,
'xmlrpc' => True,
'admin' => False
), ),
'template_set' => array( 'help' => 'Images linked to an entry can be displayed as thumbnails. You can turn this off to speed up page display.',
'type' => 'select', 'xmlrpc' => True,
'label' => 'Interface/Template Selection', 'admin' => False
'name' => 'template_set', ),
'values' => $_templates, /*
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.', 'tz_offset' => array(
'xmlrpc' => True, 'type' => 'select',
'admin' => False 'label' => 'Time zone offset',
), 'name' => 'tz_offset',
'theme' => array( 'values' => $tz_offset,
'type' => 'select', 'help' => 'How many hours are you in front or after the timezone of the server.<br>If you are in the same time zone as the server select 0 hours, else select your locale date and time.',
'label' => 'Theme (colors/fonts) Selection', 'xmlrpc' => True,
'name' => 'theme', 'admin' => False
'values' => $_themes, ),
'help' => 'A theme defines the colors and fonts used by the template.', */
'xmlrpc' => True, 'tz' => array(
'admin' => False 'type' => 'select',
), 'label' => 'Time zone',
'navbar_format' => array( 'name' => 'tz',
'type' => 'select', 'values' => $tzs,
'label' => 'Show navigation bar as', 'help' => 'Please select your timezone.',
'name' => 'navbar_format', 'xmlrpc' => True,
'values' => $navbar_format, 'admin' => False
'help' => 'You can show the applications as icons only, icons with app-name or both.', ),
'xmlrpc' => True, 'dateformat' => array(
'admin' => False 'type' => 'select',
), 'label' => 'Date format',
'link_list_format' => array( 'name' => 'dateformat',
'type' => 'select', 'values' => $date_formats,
'label' => 'Show links between eGroupWare aps as', 'help' => 'How should eGroupWare display dates for you.',
'name' => 'link_list_format', 'xmlrpc' => True,
'values' => $link_list_format, 'admin' => False
'help' => 'You can show the linked entries with icons only, icons with app-name or both.', ),
'xmlrpc' => True, 'timeformat' => array(
'admin' => False 'type' => 'select',
), 'label' => 'Time format',
'link_list_thumbnail' => array( 'name' => 'timeformat',
'type' => 'select', 'values' => $time_formats,
'label' => 'Display thumbnails for linked images', 'help' => 'Do you prefer a 24 hour time format, or a 12 hour one with am/pm attached.',
'name' => 'link_list_thumbnail', 'xmlrpc' => True,
'values' => array( 'admin' => False
'1' => lang('Yes'), ),
'0' => lang('No'), 'country' => array(
), 'type' => 'select',
'help' => 'Images linked to an entry can be displayed as thumbnails. You can turn this off to speed up page display.', 'label' => 'Country',
'xmlrpc' => True, 'name' => 'country',
'admin' => False 'values' => ExecMethod('phpgwapi.country.countries'),
), 'help' => 'In which country are you. This is used to set certain defaults for you.',
'tz_offset' => array( 'xmlrpc' => True,
'type' => 'select', 'admin' => False
'label' => 'Time zone offset', ),
'name' => 'tz_offset', 'lang' => array(
'values' => $tz_offset, 'type' => 'select',
'help' => 'How many hours are you in front or after the timezone of the server.<br>If you are in the same time zone as the server select 0 hours, else select your locale date and time.', 'label' => 'Language',
'xmlrpc' => True, 'name' => 'lang',
'admin' => False '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.',
'dateformat' => array( 'xmlrpc' => True,
'type' => 'select', 'admin' => False
'label' => 'Date format', ),
'name' => 'dateformat', 'spellchecker_lang' => array(
'values' => $date_formats, 'type' => 'select',
'help' => 'How should eGroupWare display dates for you.', 'label' => 'Spellchecker language',
'xmlrpc' => True, 'name' => 'spellchecker_lang',
'admin' => False 'values' => $langs,
), 'help' => 'Select the language of the spellchecker integrated into the rich text editor.',
'timeformat' => array( 'xmlrpc' => True,
'type' => 'select', 'admin' => False
'label' => 'Time format', ),
'name' => 'timeformat', 'rte_enter_mode' => array(
'values' => $time_formats, 'type' => 'select',
'help' => 'Do you prefer a 24 hour time format, or a 12 hour one with am/pm attached.', 'label' => 'Rich text editor enter mode',
'xmlrpc' => True, 'name' => 'rte_enter_mode',
'admin' => False 'values' => $html_enter_mode,
), 'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.',
'country' => array( 'xmlrpc' => True,
'type' => 'select', 'admin' => False
'label' => 'Country', ),
'name' => 'country', 'rte_skin' => array(
'values' => ExecMethod('phpgwapi.country.countries'), 'type' => 'select',
'help' => 'In which country are you. This is used to set certain defaults for you.', 'label' => 'Rich text editor theme',
'xmlrpc' => True, 'name' => 'rte_skin',
'admin' => False 'values' => $rich_text_editor_skins,
), 'help' => 'Select the theme (visualization) of the rich text editor.',
'lang' => array( 'xmlrpc' => True,
'type' => 'select', 'admin' => False
'label' => 'Language', ),
'name' => 'lang', 'show_currentusers' => array(
'values' => $langs, 'type' => 'check',
'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.', 'label' => 'Show number of current users',
'xmlrpc' => True, 'name' => 'show_currentusers',
'admin' => False 'help' => 'Should the number of active sessions be displayed for you all the time.',
), 'xmlrpc' => False,
'spellchecker_lang' => array( 'admin' => True
'type' => 'select', ),
'label' => 'Spellchecker language', 'default_app' => array(
'name' => 'spellchecker_lang', 'type' => 'select',
'values' => $langs, 'label' => 'Default application',
'help' => 'Select the language of the spellchecker integrated into the rich text editor.', 'name' => 'default_app',
'xmlrpc' => True, 'values' => $user_apps,
'admin' => False 'help' => "The default application will be started when you enter eGroupWare or click on the homepage icon.<br>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,
'rte_enter_mode' => array( 'admin' => False
'type' => 'select', ),
'label' => 'Rich text editor enter mode', 'currency' => array(
'name' => 'rte_enter_mode', 'type' => 'input',
'values' => $html_enter_mode, 'label' => 'Currency',
'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.', 'name' => 'currency',
'xmlrpc' => True, 'help' => 'Which currency symbol or name should be used in eGroupWare.',
'admin' => False 'xmlrpc' => True,
), 'admin' => False
'rte_skin' => array( ),
'type' => 'select', 'account_selection' => array(
'label' => 'Rich text editor theme', 'type' => 'select',
'name' => 'rte_skin', 'label' => 'How do you like to select accounts',
'values' => $rich_text_editor_skins, 'name' => 'account_selection',
'help' => 'Select the theme (visualization) of the rich text editor.', 'values' => $account_sels,
'xmlrpc' => True, '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.').' '.
'admin' => False lang('The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.'),
), 'run_lang' => false,
'show_currentusers' => array( 'xmlrpc' => True,
'type' => 'check', 'admin' => False
'label' => 'Show number of current users', ),
'name' => 'show_currentusers', 'account_display' => array(
'help' => 'Should the number of active sessions be displayed for you all the time.', 'type' => 'select',
'xmlrpc' => False, 'label' => 'How do you like to display accounts',
'admin' => True 'name' => 'account_display',
), 'values' => $account_display,
'default_app' => array( 'help' => 'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.',
'type' => 'select', 'xmlrpc' => True,
'label' => 'Default application', 'admin' => False
'name' => 'default_app', ),
'values' => $user_apps, 'show_help' => array(
'help' => "The default application will be started when you enter eGroupWare or click on the homepage icon.<br>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).", 'type' => 'check',
'xmlrpc' => False, 'label' => 'Show helpmessages by default',
'admin' => False 'name' => 'show_help',
), 'help' => 'Should this help messages shown up always, when you enter the preferences or only on request.',
'currency' => array( 'xmlrpc' => False,
'type' => 'input', 'admin' => False
'label' => 'Currency', ),
'name' => 'currency', 'enable_dragdrop' => array(
'help' => 'Which currency symbol or name should be used in eGroupWare.', 'type' => 'check',
'xmlrpc' => True, 'label' => 'Enable drag and drop functionality (experimental)',
'admin' => False 'name' => 'enable_dragdrop',
), 'help' => 'Enables or disables drag and drop functions in all applications. If the browser does not support '.
'account_selection' => array( 'drag and drop, it will be disabled automatically. This feature is experimental at the moment.',
'type' => 'select', 'xmlrpc' => False,
'label' => 'How do you like to select accounts', 'admin' => False
'name' => 'account_selection', ),
'values' => $account_sels, 'csv_charset' => array(
'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.').' '. 'type' => 'select',
lang('The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.'), 'label' => 'Charset for the CSV export',
'run_lang' => false, 'name' => 'csv_charset',
'xmlrpc' => True, 'values' => $GLOBALS['egw']->translation->get_installed_charsets()+array('utf-8' => 'utf-8 (Unicode)'),
'admin' => False 'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
), 'xmlrpc' => True,
'account_display' => array( 'admin' => false,
'type' => 'select', ),
'label' => 'How do you like to display accounts', );
'name' => 'account_display', // disable thumbnails, if no size configured by admin
'values' => $account_display, if (!$GLOBALS['egw_info']['server']['link_list_thumbnail']) unset($GLOBALS['settings']['link_list_thumbnail']);
'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']);