mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 09:23:28 +01:00
All EGroupware apps can now set default and forced preferences on
installation time --> nice user experience and cleaner look (by hiding exotic prefs by focing them to a usual value): - settings returned from settings hook can contain values for keys 'default' or 'forced' - if settings hook require part of api or application, which are not available during installation time: use a method hook (instead of an old $app/inc/hook_settings.inc.php file), and check if $hook_param['setup'] is true - default prefs created so far in setup/admin_account.php got removed - common prefs in preferences_hooks::settings() got reworked to set default and forced prefs - calendar prefs in calendar_hooks::settings() got reworked to set default and forced prefs --> I will rework prefs of all our (default) applications according to a best practice list of Stylite consultants
This commit is contained in:
parent
fe6c8fd226
commit
5408924afb
@ -5,7 +5,7 @@
|
|||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @package calendar
|
* @package calendar
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @copyright (c) 2004-8 by RalfBecker-At-outdoor-training.de
|
* @copyright (c) 2004-9 by RalfBecker-At-outdoor-training.de
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@ -135,11 +135,15 @@ class calendar_hooks
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calendar preferences
|
* Calendar preferences
|
||||||
|
*
|
||||||
|
* @param array $hook_data
|
||||||
*/
|
*/
|
||||||
static function settings()
|
static function settings($hook_data)
|
||||||
{
|
{
|
||||||
ExecMethod('calendar.calendar_bo.check_set_default_prefs');
|
if (!$hook_data['setup']) // does not work on setup time
|
||||||
|
{
|
||||||
|
ExecMethod('calendar.calendar_bo.check_set_default_prefs');
|
||||||
|
}
|
||||||
$default = array(
|
$default = array(
|
||||||
'day' => lang('Dayview'),
|
'day' => lang('Dayview'),
|
||||||
'day4' => lang('Four days view'),
|
'day4' => lang('Four days view'),
|
||||||
@ -161,20 +165,10 @@ class calendar_hooks
|
|||||||
'5' => lang('Weekview without weekend'),
|
'5' => lang('Weekview without weekend'),
|
||||||
'7' => lang('Weekview with weekend'),
|
'7' => lang('Weekview with weekend'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$mainpage = array(
|
$mainpage = array(
|
||||||
'1' => lang('Yes'),
|
'1' => lang('Yes'),
|
||||||
'0' => lang('No'),
|
'0' => lang('No'),
|
||||||
);
|
);
|
||||||
/*
|
|
||||||
$summary = array(
|
|
||||||
'no' => lang('Never'),
|
|
||||||
'daily' => lang('Daily'),
|
|
||||||
'weekly' => lang('Weekly')
|
|
||||||
);
|
|
||||||
create_select_box('Receive summary of appointments','summary',$summary,
|
|
||||||
'Do you want to receive a regulary summary of your appointsments via email?<br>The summary is sent to your standard email-address on the morning of that day or on Monday for weekly summarys.<br>It is only sent when you have any appointments on that day or week.');
|
|
||||||
*/
|
|
||||||
$updates = array(
|
$updates = array(
|
||||||
'no' => lang('Never'),
|
'no' => lang('Never'),
|
||||||
'add_cancel' => lang('on invitation / cancelation only'),
|
'add_cancel' => lang('on invitation / cancelation only'),
|
||||||
@ -186,7 +180,7 @@ class calendar_hooks
|
|||||||
$update_formats = array(
|
$update_formats = array(
|
||||||
'none' => lang('None'),
|
'none' => lang('None'),
|
||||||
'extended' => lang('Extended'),
|
'extended' => lang('Extended'),
|
||||||
'ical' => lang('iCal / rfc2445')
|
'ical' => lang('iCal / rfc2445'),
|
||||||
);
|
);
|
||||||
$event_details = array(
|
$event_details = array(
|
||||||
'to-fullname' => lang('Fullname of person to notify'),
|
'to-fullname' => lang('Fullname of person to notify'),
|
||||||
@ -238,19 +232,22 @@ class calendar_hooks
|
|||||||
'resources' => lang('resources'),
|
'resources' => lang('resources'),
|
||||||
'addressbook' => lang('addressbook')
|
'addressbook' => lang('addressbook')
|
||||||
);
|
);
|
||||||
$groups = $GLOBALS['egw']->accounts->membership($GLOBALS['egw_info']['user']['account_id']);
|
if (!$hook_data['setup']) // does not working on setup time
|
||||||
$options = array('0' => lang('none'));
|
|
||||||
if (is_array($groups))
|
|
||||||
{
|
{
|
||||||
foreach($groups as $group)
|
$groups = $GLOBALS['egw']->accounts->membership($GLOBALS['egw_info']['user']['account_id']);
|
||||||
|
$options = array('0' => lang('none'));
|
||||||
|
if (is_array($groups))
|
||||||
{
|
{
|
||||||
$options[$group['account_id']] = $GLOBALS['egw']->common->grab_owner_name($group['account_id']);
|
foreach($groups as $group)
|
||||||
|
{
|
||||||
|
$options[$group['account_id']] = $GLOBALS['egw']->common->grab_owner_name($group['account_id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']);
|
||||||
|
$freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is %1.','<a href="'.$freebusy_url.'" target="_blank">'.$freebusy_url.'</a>');
|
||||||
}
|
}
|
||||||
$freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']);
|
|
||||||
$freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is %1.','<a href="'.$freebusy_url.'" target="_blank">'.$freebusy_url.'</a>');
|
|
||||||
|
|
||||||
$GLOBALS['settings'] = array(
|
return array(
|
||||||
'defaultcalendar' => array(
|
'defaultcalendar' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'default calendar view',
|
'label' => 'default calendar view',
|
||||||
@ -258,7 +255,8 @@ class calendar_hooks
|
|||||||
'values' => $default,
|
'values' => $default,
|
||||||
'help' => 'Which of calendar view do you want to see, when you start calendar ?',
|
'help' => 'Which of calendar view do you want to see, when you start calendar ?',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 'week',
|
||||||
),
|
),
|
||||||
'days_in_weekview' => array(
|
'days_in_weekview' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -267,7 +265,8 @@ class calendar_hooks
|
|||||||
'values' => $week_view,
|
'values' => $week_view,
|
||||||
'help' => 'Do you want a weekview with or without weekend?',
|
'help' => 'Do you want a weekview with or without weekend?',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> '7',
|
||||||
),
|
),
|
||||||
'multiple_weeks' => array(
|
'multiple_weeks' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -276,7 +275,8 @@ class calendar_hooks
|
|||||||
'values' => $muliple_weeks,
|
'values' => $muliple_weeks,
|
||||||
'help' => 'How many weeks should the multiple week view show?',
|
'help' => 'How many weeks should the multiple week view show?',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'forced'=> 3,
|
||||||
),
|
),
|
||||||
'mainscreen_showevents' => array(
|
'mainscreen_showevents' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -285,16 +285,18 @@ class calendar_hooks
|
|||||||
'values' => $mainpage,
|
'values' => $mainpage,
|
||||||
'help' => 'Displays your default calendar view on the startpage (page you get when you enter eGroupWare or click on the homepage icon)?',
|
'help' => 'Displays your default calendar view on the startpage (page you get when you enter eGroupWare or click on the homepage icon)?',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> true,
|
||||||
),
|
),
|
||||||
'weekdaystarts' => array(
|
'weekdaystarts' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'weekday starts on',
|
'label' => 'weekday starts on',
|
||||||
'name' => 'weekdaystarts',
|
'name' => 'weekdaystarts',
|
||||||
'values' => $weekdaystarts,
|
'values' => 'Monday',
|
||||||
'help' => 'This day is shown as first day in the week or month view.',
|
'help' => 'This day is shown as first day in the week or month view.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'forced' => 'Monday',
|
||||||
),
|
),
|
||||||
'workdaystarts' => array(
|
'workdaystarts' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -303,7 +305,8 @@ class calendar_hooks
|
|||||||
'values' => $times,
|
'values' => $times,
|
||||||
'help' => 'This defines the start of your dayview. Events before this time, are shown above the dayview.<br>This time is also used as a default starttime for new events.',
|
'help' => 'This defines the start of your dayview. Events before this time, are shown above the dayview.<br>This time is also used as a default starttime for new events.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 9,
|
||||||
),
|
),
|
||||||
'workdayends' => array(
|
'workdayends' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -312,7 +315,8 @@ class calendar_hooks
|
|||||||
'values' => $times,
|
'values' => $times,
|
||||||
'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.',
|
'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 17,
|
||||||
),
|
),
|
||||||
'use_time_grid' => array(
|
'use_time_grid' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -321,7 +325,8 @@ class calendar_hooks
|
|||||||
'values' => $grid_views,
|
'values' => $grid_views,
|
||||||
'help' => 'For which views should calendar show distinct lines with a fixed time interval.',
|
'help' => 'For which views should calendar show distinct lines with a fixed time interval.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'forced' => 'all',
|
||||||
),
|
),
|
||||||
'interval' => array(
|
'interval' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -330,7 +335,8 @@ class calendar_hooks
|
|||||||
'values' => $intervals,
|
'values' => $intervals,
|
||||||
'help' => 'How many minutes should each interval last?',
|
'help' => 'How many minutes should each interval last?',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'interval'=> 30,
|
||||||
),
|
),
|
||||||
'defaultlength' => array(
|
'defaultlength' => array(
|
||||||
'type' => 'input',
|
'type' => 'input',
|
||||||
@ -340,7 +346,8 @@ class calendar_hooks
|
|||||||
'default' => '',
|
'default' => '',
|
||||||
'size' => 3,
|
'size' => 3,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 60,
|
||||||
),
|
),
|
||||||
'defaultresource_sel' => array(
|
'defaultresource_sel' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -350,6 +357,7 @@ class calendar_hooks
|
|||||||
'help' => 'Default type of resources application selected in the calendar particpants research form.',
|
'help' => 'Default type of resources application selected in the calendar particpants research form.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False,
|
'admin' => False,
|
||||||
|
'forced' => 'addressbook',
|
||||||
),
|
),
|
||||||
'planner_start_with_group' => array(
|
'planner_start_with_group' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -358,7 +366,7 @@ class calendar_hooks
|
|||||||
'values' => $options,
|
'values' => $options,
|
||||||
'help' => 'This group that is preselected when you enter the planner. You can change it in the planner anytime you want.',
|
'help' => 'This group that is preselected when you enter the planner. You can change it in the planner anytime you want.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'planner_show_empty_rows' => array(
|
'planner_show_empty_rows' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -372,7 +380,8 @@ class calendar_hooks
|
|||||||
),
|
),
|
||||||
'help' => 'Should the planner display an empty row for users or categories without any appointment.',
|
'help' => 'Should the planner display an empty row for users or categories without any appointment.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'forced' => 'user',
|
||||||
),
|
),
|
||||||
'default_private' => array(
|
'default_private' => array(
|
||||||
'type' => 'check',
|
'type' => 'check',
|
||||||
@ -380,7 +389,8 @@ class calendar_hooks
|
|||||||
'name' => 'default_private',
|
'name' => 'default_private',
|
||||||
'help' => 'Should new events created as private by default ?',
|
'help' => 'Should new events created as private by default ?',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'forced' => '0',
|
||||||
),
|
),
|
||||||
'receive_updates' => array(
|
'receive_updates' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -389,7 +399,8 @@ class calendar_hooks
|
|||||||
'values' => $updates,
|
'values' => $updates,
|
||||||
'help' => "Do you want to be notified about new or changed appointments? You be notified about changes you make yourself.<br>You can limit the notifications to certain changes only. Each item includes all the notification listed above it. All modifications include changes of title, description, participants, but no participant responses. If the owner of an event requested any notifcations, he will always get the participant responses like acceptions and rejections too.",
|
'help' => "Do you want to be notified about new or changed appointments? You be notified about changes you make yourself.<br>You can limit the notifications to certain changes only. Each item includes all the notification listed above it. All modifications include changes of title, description, participants, but no participant responses. If the owner of an event requested any notifcations, he will always get the participant responses like acceptions and rejections too.",
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 'time_change',
|
||||||
),
|
),
|
||||||
'update_format' => array(
|
'update_format' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -398,7 +409,8 @@ class calendar_hooks
|
|||||||
'values' => $update_formats,
|
'values' => $update_formats,
|
||||||
'help' => 'Extended updates always include the complete event-details. iCal\'s can be imported by certain other calendar-applications.',
|
'help' => 'Extended updates always include the complete event-details. iCal\'s can be imported by certain other calendar-applications.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'forced' => 'ical',
|
||||||
),
|
),
|
||||||
'notifyAdded' => array(
|
'notifyAdded' => array(
|
||||||
'type' => 'notify',
|
'type' => 'notify',
|
||||||
@ -410,7 +422,7 @@ class calendar_hooks
|
|||||||
'default' => '',
|
'default' => '',
|
||||||
'values' => $event_details,
|
'values' => $event_details,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'notifyCanceled' => array(
|
'notifyCanceled' => array(
|
||||||
'type' => 'notify',
|
'type' => 'notify',
|
||||||
@ -423,7 +435,7 @@ class calendar_hooks
|
|||||||
'values' => $event_details,
|
'values' => $event_details,
|
||||||
'subst_help' => False,
|
'subst_help' => False,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'notifyModified' => array(
|
'notifyModified' => array(
|
||||||
'type' => 'notify',
|
'type' => 'notify',
|
||||||
@ -436,7 +448,7 @@ class calendar_hooks
|
|||||||
'values' => $event_details,
|
'values' => $event_details,
|
||||||
'subst_help' => False,
|
'subst_help' => False,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'notifyDisinvited' => array(
|
'notifyDisinvited' => array(
|
||||||
'type' => 'notify',
|
'type' => 'notify',
|
||||||
@ -449,7 +461,7 @@ class calendar_hooks
|
|||||||
'values' => $event_details,
|
'values' => $event_details,
|
||||||
'subst_help' => False,
|
'subst_help' => False,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'notifyResponse' => array(
|
'notifyResponse' => array(
|
||||||
'type' => 'notify',
|
'type' => 'notify',
|
||||||
@ -462,7 +474,7 @@ class calendar_hooks
|
|||||||
'values' => $event_details,
|
'values' => $event_details,
|
||||||
'subst_help' => False,
|
'subst_help' => False,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'notifyAlarm' => array(
|
'notifyAlarm' => array(
|
||||||
'type' => 'notify',
|
'type' => 'notify',
|
||||||
@ -475,7 +487,7 @@ class calendar_hooks
|
|||||||
'values' => $event_details,
|
'values' => $event_details,
|
||||||
'subst_help' => False,
|
'subst_help' => False,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'freebusy' => array(
|
'freebusy' => array(
|
||||||
'type' => 'check',
|
'type' => 'check',
|
||||||
@ -494,9 +506,8 @@ class calendar_hooks
|
|||||||
'name' => 'freebusy_pw',
|
'name' => 'freebusy_pw',
|
||||||
'help' => 'If you dont set a password here, the information is available to everyone, who knows the URL!!!',
|
'help' => 'If you dont set a password here, the information is available to everyone, who knows the URL!!!',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class preferences_hooks
|
|||||||
);
|
);
|
||||||
|
|
||||||
$user_apps = array();
|
$user_apps = array();
|
||||||
foreach($GLOBALS['egw_info']['user']['apps'] as $app => $data)
|
foreach((array)$GLOBALS['egw_info']['user']['apps'] as $app => $data)
|
||||||
{
|
{
|
||||||
if($GLOBALS['egw_info']['apps'][$app]['status'] != 2 && $app)
|
if($GLOBALS['egw_info']['apps'][$app]['status'] != 2 && $app)
|
||||||
{
|
{
|
||||||
@ -110,6 +110,12 @@ class preferences_hooks
|
|||||||
'all' => '['.lang('username').'] '.lang('Lastname').','.lang('Firstname'),
|
'all' => '['.lang('username').'] '.lang('Lastname').','.lang('Firstname'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($hook_data['setup']) // called via setup
|
||||||
|
{
|
||||||
|
$lang = get_var('ConfigLang',Array('POST','COOKIE'),'en');
|
||||||
|
list(,$country) = explode('-',$lang);
|
||||||
|
if (empty($country)) $country = $lang;
|
||||||
|
}
|
||||||
// Settings array for this app
|
// Settings array for this app
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'maxmatchs' => array(
|
'maxmatchs' => array(
|
||||||
@ -119,7 +125,8 @@ class preferences_hooks
|
|||||||
'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.',
|
'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,
|
'size' => 3,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default' => 15,
|
||||||
),
|
),
|
||||||
'template_set' => array(
|
'template_set' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -128,7 +135,8 @@ class preferences_hooks
|
|||||||
'values' => $_templates,
|
'values' => $_templates,
|
||||||
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.',
|
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default' => 'idots',
|
||||||
),
|
),
|
||||||
'theme' => array(
|
'theme' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -137,7 +145,8 @@ class preferences_hooks
|
|||||||
'values' => $_themes,
|
'values' => $_themes,
|
||||||
'help' => 'A theme defines the colors and fonts used by the template.',
|
'help' => 'A theme defines the colors and fonts used by the template.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default' => 'idots',
|
||||||
),
|
),
|
||||||
'navbar_format' => array(
|
'navbar_format' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -146,7 +155,8 @@ class preferences_hooks
|
|||||||
'values' => $navbar_format,
|
'values' => $navbar_format,
|
||||||
'help' => 'You can show the applications as icons only, icons with app-name or both.',
|
'help' => 'You can show the applications as icons only, icons with app-name or both.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 'icons_and_text',
|
||||||
),
|
),
|
||||||
'link_list_format' => array(
|
'link_list_format' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -155,7 +165,7 @@ class preferences_hooks
|
|||||||
'values' => $link_list_format,
|
'values' => $link_list_format,
|
||||||
'help' => 'You can show the linked entries with icons only, icons with app-name or both.',
|
'help' => 'You can show the linked entries with icons only, icons with app-name or both.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'link_list_thumbnail' => array(
|
'link_list_thumbnail' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -167,7 +177,7 @@ class preferences_hooks
|
|||||||
),
|
),
|
||||||
'help' => 'Images linked to an entry can be displayed as thumbnails. You can turn this off to speed up page display.',
|
'help' => 'Images linked to an entry can be displayed as thumbnails. You can turn this off to speed up page display.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'tz' => array(
|
'tz' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -176,7 +186,8 @@ class preferences_hooks
|
|||||||
'values' => $tzs,
|
'values' => $tzs,
|
||||||
'help' => 'Please select your timezone.',
|
'help' => 'Please select your timezone.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> date_default_timezone_get(),
|
||||||
),
|
),
|
||||||
'tz_selection' => array(
|
'tz_selection' => array(
|
||||||
'type' => 'multiselect',
|
'type' => 'multiselect',
|
||||||
@ -185,7 +196,7 @@ class preferences_hooks
|
|||||||
'values' => call_user_func_array('array_merge',$tzs), // only flat arrays supported
|
'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.',
|
'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,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'dateformat' => array(
|
'dateformat' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -194,7 +205,8 @@ class preferences_hooks
|
|||||||
'values' => $date_formats,
|
'values' => $date_formats,
|
||||||
'help' => 'How should eGroupWare display dates for you.',
|
'help' => 'How should eGroupWare display dates for you.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> $lang == 'en' ? 'Y/m/d' : 'd.m.Y',
|
||||||
),
|
),
|
||||||
'timeformat' => array(
|
'timeformat' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -203,7 +215,8 @@ class preferences_hooks
|
|||||||
'values' => $time_formats,
|
'values' => $time_formats,
|
||||||
'help' => 'Do you prefer a 24 hour time format, or a 12 hour one with am/pm attached.',
|
'help' => 'Do you prefer a 24 hour time format, or a 12 hour one with am/pm attached.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 24,
|
||||||
),
|
),
|
||||||
'country' => array(
|
'country' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -212,7 +225,8 @@ class preferences_hooks
|
|||||||
'values' => ExecMethod('phpgwapi.country.countries'),
|
'values' => ExecMethod('phpgwapi.country.countries'),
|
||||||
'help' => 'In which country are you. This is used to set certain defaults for you.',
|
'help' => 'In which country are you. This is used to set certain defaults for you.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> strtoupper($country),
|
||||||
),
|
),
|
||||||
'lang' => array(
|
'lang' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -221,7 +235,8 @@ class preferences_hooks
|
|||||||
'values' => $langs,
|
'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.',
|
'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,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> $lang,
|
||||||
),
|
),
|
||||||
'spellchecker_lang' => array(
|
'spellchecker_lang' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -230,7 +245,8 @@ class preferences_hooks
|
|||||||
'values' => $langs,
|
'values' => $langs,
|
||||||
'help' => 'Select the language of the spellchecker integrated into the rich text editor.',
|
'help' => 'Select the language of the spellchecker integrated into the rich text editor.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> $lang,
|
||||||
),
|
),
|
||||||
'rte_enter_mode' => array(
|
'rte_enter_mode' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -239,7 +255,8 @@ class preferences_hooks
|
|||||||
'values' => $html_enter_mode,
|
'values' => $html_enter_mode,
|
||||||
'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.',
|
'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 'br',
|
||||||
),
|
),
|
||||||
'rte_skin' => array(
|
'rte_skin' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -248,7 +265,8 @@ class preferences_hooks
|
|||||||
'values' => $rich_text_editor_skins,
|
'values' => $rich_text_editor_skins,
|
||||||
'help' => 'Select the theme (visualization) of the rich text editor.',
|
'help' => 'Select the theme (visualization) of the rich text editor.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 'office2003',
|
||||||
),
|
),
|
||||||
'show_currentusers' => array(
|
'show_currentusers' => array(
|
||||||
'type' => 'check',
|
'type' => 'check',
|
||||||
@ -256,7 +274,7 @@ class preferences_hooks
|
|||||||
'name' => 'show_currentusers',
|
'name' => 'show_currentusers',
|
||||||
'help' => 'Should the number of active sessions be displayed for you all the time.',
|
'help' => 'Should the number of active sessions be displayed for you all the time.',
|
||||||
'xmlrpc' => False,
|
'xmlrpc' => False,
|
||||||
'admin' => True
|
'admin' => True,
|
||||||
),
|
),
|
||||||
'default_app' => array(
|
'default_app' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -265,7 +283,8 @@ class preferences_hooks
|
|||||||
'values' => $user_apps,
|
'values' => $user_apps,
|
||||||
'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).",
|
'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,
|
'xmlrpc' => False,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> 'calendar',
|
||||||
),
|
),
|
||||||
'currency' => array(
|
'currency' => array(
|
||||||
'type' => 'input',
|
'type' => 'input',
|
||||||
@ -273,7 +292,8 @@ class preferences_hooks
|
|||||||
'name' => 'currency',
|
'name' => 'currency',
|
||||||
'help' => 'Which currency symbol or name should be used in eGroupWare.',
|
'help' => 'Which currency symbol or name should be used in eGroupWare.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> $lang == 'en' ? '$' : 'EUR',
|
||||||
),
|
),
|
||||||
'account_selection' => array(
|
'account_selection' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -284,7 +304,7 @@ class preferences_hooks
|
|||||||
lang('The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.'),
|
lang('The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.'),
|
||||||
'run_lang' => false,
|
'run_lang' => false,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'account_display' => array(
|
'account_display' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -293,7 +313,7 @@ class preferences_hooks
|
|||||||
'values' => $account_display,
|
'values' => $account_display,
|
||||||
'help' => 'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.',
|
'help' => 'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'show_help' => array(
|
'show_help' => array(
|
||||||
'type' => 'check',
|
'type' => 'check',
|
||||||
@ -301,7 +321,8 @@ class preferences_hooks
|
|||||||
'name' => 'show_help',
|
'name' => 'show_help',
|
||||||
'help' => 'Should this help messages shown up always, when you enter the preferences or only on request.',
|
'help' => 'Should this help messages shown up always, when you enter the preferences or only on request.',
|
||||||
'xmlrpc' => False,
|
'xmlrpc' => False,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
|
'default'=> True,
|
||||||
),
|
),
|
||||||
'enable_dragdrop' => array(
|
'enable_dragdrop' => array(
|
||||||
'type' => 'check',
|
'type' => 'check',
|
||||||
@ -310,7 +331,7 @@ class preferences_hooks
|
|||||||
'help' => 'Enables or disables drag and drop functions in all applications. If the browser does not support '.
|
'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.',
|
'drag and drop, it will be disabled automatically. This feature is experimental at the moment.',
|
||||||
'xmlrpc' => False,
|
'xmlrpc' => False,
|
||||||
'admin' => False
|
'admin' => False,
|
||||||
),
|
),
|
||||||
'csv_charset' => array(
|
'csv_charset' => array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
|
@ -208,6 +208,7 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unset($valarray['default']); // not longer used as default, since we have default prefs
|
||||||
switch($valarray['type'])
|
switch($valarray['type'])
|
||||||
{
|
{
|
||||||
case 'section':
|
case 'section':
|
||||||
|
@ -134,59 +134,6 @@ else
|
|||||||
}
|
}
|
||||||
$GLOBALS['egw_setup']->add_acl($apps,'run',$admingroupid);
|
$GLOBALS['egw_setup']->add_acl($apps,'run',$admingroupid);
|
||||||
|
|
||||||
// give admin access to default apps, not yet set for the default group
|
|
||||||
function insert_default_prefs($accountid)
|
|
||||||
{
|
|
||||||
$lang = get_var('ConfigLang',Array('POST','COOKIE'),'en');
|
|
||||||
list(,$country) = explode('-',$lang);
|
|
||||||
if (empty($country)) $country = $lang;
|
|
||||||
|
|
||||||
$defaultprefs = array(
|
|
||||||
'common' => array(
|
|
||||||
'maxmatchs' => 15,
|
|
||||||
'template_set' => 'idots',
|
|
||||||
'theme' => 'idots',
|
|
||||||
'navbar_format' => 'icons',
|
|
||||||
'tz' => date_default_timezone_get(),
|
|
||||||
'dateformat' => $lang == 'en' ? 'Y/m/d' : 'd.m.Y',
|
|
||||||
'timeformat' => '24',
|
|
||||||
'lang' => $lang,
|
|
||||||
'spellchecker_lang' => $lang,
|
|
||||||
'country' => strtoupper($country),
|
|
||||||
'default_app' => 'calendar',
|
|
||||||
'currency' => $lang == 'en' ? '$' : 'EUR',
|
|
||||||
'show_help' => True,
|
|
||||||
'max_icons' => 12,
|
|
||||||
),
|
|
||||||
'calendar' => array(
|
|
||||||
'workdaystarts' => 9,
|
|
||||||
'workdayends' => 17,
|
|
||||||
'weekdaystarts' => 'Monday',
|
|
||||||
'defaultcalendar' => 'day',
|
|
||||||
'planner_start_with_group' => $GLOBALS['defaultgroupid'],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($defaultprefs as $app => $prefs)
|
|
||||||
{
|
|
||||||
// only insert them, if they not already exist
|
|
||||||
$GLOBALS['egw_setup']->db->select($GLOBALS['egw_setup']->prefs_table,'*',array(
|
|
||||||
'preference_owner' => $accountid,
|
|
||||||
'preference_app' => $app,
|
|
||||||
),__LINE__,__FILE__);
|
|
||||||
if (!$GLOBALS['egw_setup']->db->next_record())
|
|
||||||
{
|
|
||||||
$GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->prefs_table,array(
|
|
||||||
'preference_value' => serialize($prefs)
|
|
||||||
),array(
|
|
||||||
'preference_owner' => $accountid,
|
|
||||||
'preference_app' => $app,
|
|
||||||
),__LINE__,__FILE__);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
insert_default_prefs(-2); // -2 = default prefs
|
|
||||||
|
|
||||||
/* Creation of the demo accounts is optional - the checkbox is on by default. */
|
/* Creation of the demo accounts is optional - the checkbox is on by default. */
|
||||||
if(get_var('create_demo',Array('POST')))
|
if(get_var('create_demo',Array('POST')))
|
||||||
{
|
{
|
||||||
|
@ -673,6 +673,76 @@ class setup
|
|||||||
$this->hooks->register_hooks($appname,$setup_info[$appname]['hooks']);
|
$this->hooks->register_hooks($appname,$setup_info[$appname]['hooks']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup default and forced preferences, when an application gets installed
|
||||||
|
*
|
||||||
|
* @param string $appname
|
||||||
|
* @return boolean false app not found or no hook settings, true settings found and defaull & forced prefs stored, if there are any defined
|
||||||
|
*/
|
||||||
|
function set_default_preferences($appname)
|
||||||
|
{
|
||||||
|
$setup_info = $GLOBALS['setup_info'][$appname];
|
||||||
|
|
||||||
|
if (!isset($setup_info) || !isset($setup_info['hooks']))
|
||||||
|
{
|
||||||
|
return false; // app not found or no hook
|
||||||
|
}
|
||||||
|
$GLOBALS['settings'] = array();
|
||||||
|
if (isset($setup_info['hooks']['settings']))
|
||||||
|
{
|
||||||
|
$settings = ExecMethod($setup_info['hooks']['settings'],array('location' => 'settings','setup' => true));
|
||||||
|
}
|
||||||
|
elseif(in_array('settings',$setup_info['hooks']) && file_exists($file = EGW_INCLUDE_ROOT.'/'.$appname.'/inc/hook_settings.inc.php'))
|
||||||
|
{
|
||||||
|
include_once($file);
|
||||||
|
}
|
||||||
|
if (!isset($settings) || !is_array($settings))
|
||||||
|
{
|
||||||
|
$settings = $GLOBALS['settings']; // old file hook or not updated new hook
|
||||||
|
}
|
||||||
|
if (!is_array($settings) || !count($settings))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// include idots template prefs for (common) preferences
|
||||||
|
if ($appname == 'preferences' && file_exists($file = EGW_INCLUDE_ROOT.'/phpgwapi/templates/idots/hook_settings.inc.php'))
|
||||||
|
{
|
||||||
|
$GLOBALS['settings'] = array();
|
||||||
|
include_once($file);
|
||||||
|
if ($GLOBALS['settings']) $settings = array_merge($settings,$GLOBALS['settings']);
|
||||||
|
}
|
||||||
|
$default = $forced = array();
|
||||||
|
foreach($settings as $name => $setting)
|
||||||
|
{
|
||||||
|
if (isset($setting['default']))
|
||||||
|
{
|
||||||
|
$default[$name] = (string)$setting['default'];
|
||||||
|
}
|
||||||
|
if (isset($setting['forced']))
|
||||||
|
{
|
||||||
|
$forced[$name] = (string)$setting['forced'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// store default/forced preferences, if any found
|
||||||
|
foreach(array(
|
||||||
|
preferences::DEFAULT_ID => $default,
|
||||||
|
preferences::FORCED_ID => $forced,
|
||||||
|
) as $owner => $prefs)
|
||||||
|
{
|
||||||
|
if ($prefs)
|
||||||
|
{
|
||||||
|
$this->db->insert($this->prefs_table,array(
|
||||||
|
'preference_value' => serialize($prefs),
|
||||||
|
),array(
|
||||||
|
'preference_owner' => $owner,
|
||||||
|
'preference_app' => $appname == 'preferences' ? 'common' : $appname,
|
||||||
|
),__LINE__,__FILE__);
|
||||||
|
//error_log(__METHOD__."('$appname') storing ".($owner==preferences::DEFAULT_ID?'default':'forced')." prefs=".array2string($prefs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an application's hooks
|
* Update an application's hooks
|
||||||
*
|
*
|
||||||
|
@ -366,6 +366,7 @@ class setup_process
|
|||||||
{
|
{
|
||||||
$GLOBALS['egw_setup']->register_app($appname);
|
$GLOBALS['egw_setup']->register_app($appname);
|
||||||
$GLOBALS['egw_setup']->register_hooks($appname);
|
$GLOBALS['egw_setup']->register_hooks($appname);
|
||||||
|
$GLOBALS['egw_setup']->set_default_preferences($appname);
|
||||||
}
|
}
|
||||||
// Update the array values for return below
|
// Update the array values for return below
|
||||||
$appdata['status'] = 'C';
|
$appdata['status'] = 'C';
|
||||||
@ -398,6 +399,7 @@ class setup_process
|
|||||||
{
|
{
|
||||||
$GLOBALS['egw_setup']->register_app($appname,$enabled);
|
$GLOBALS['egw_setup']->register_app($appname,$enabled);
|
||||||
$GLOBALS['egw_setup']->register_hooks($appname);
|
$GLOBALS['egw_setup']->register_hooks($appname);
|
||||||
|
$GLOBALS['egw_setup']->set_default_preferences($appname);
|
||||||
}
|
}
|
||||||
$appdata['status'] = 'C';
|
$appdata['status'] = 'C';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user