forked from extern/egroupware
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
|
||||
* @package calendar
|
||||
* @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
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -135,11 +135,15 @@ class calendar_hooks
|
||||
|
||||
/**
|
||||
* 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(
|
||||
'day' => lang('Dayview'),
|
||||
'day4' => lang('Four days view'),
|
||||
@ -161,20 +165,10 @@ class calendar_hooks
|
||||
'5' => lang('Weekview without weekend'),
|
||||
'7' => lang('Weekview with weekend'),
|
||||
);
|
||||
|
||||
$mainpage = array(
|
||||
'1' => lang('Yes'),
|
||||
'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(
|
||||
'no' => lang('Never'),
|
||||
'add_cancel' => lang('on invitation / cancelation only'),
|
||||
@ -186,7 +180,7 @@ class calendar_hooks
|
||||
$update_formats = array(
|
||||
'none' => lang('None'),
|
||||
'extended' => lang('Extended'),
|
||||
'ical' => lang('iCal / rfc2445')
|
||||
'ical' => lang('iCal / rfc2445'),
|
||||
);
|
||||
$event_details = array(
|
||||
'to-fullname' => lang('Fullname of person to notify'),
|
||||
@ -238,19 +232,22 @@ class calendar_hooks
|
||||
'resources' => lang('resources'),
|
||||
'addressbook' => lang('addressbook')
|
||||
);
|
||||
$groups = $GLOBALS['egw']->accounts->membership($GLOBALS['egw_info']['user']['account_id']);
|
||||
$options = array('0' => lang('none'));
|
||||
if (is_array($groups))
|
||||
if (!$hook_data['setup']) // does not working on setup time
|
||||
{
|
||||
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(
|
||||
'type' => 'select',
|
||||
'label' => 'default calendar view',
|
||||
@ -258,7 +255,8 @@ class calendar_hooks
|
||||
'values' => $default,
|
||||
'help' => 'Which of calendar view do you want to see, when you start calendar ?',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 'week',
|
||||
),
|
||||
'days_in_weekview' => array(
|
||||
'type' => 'select',
|
||||
@ -267,7 +265,8 @@ class calendar_hooks
|
||||
'values' => $week_view,
|
||||
'help' => 'Do you want a weekview with or without weekend?',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> '7',
|
||||
),
|
||||
'multiple_weeks' => array(
|
||||
'type' => 'select',
|
||||
@ -276,7 +275,8 @@ class calendar_hooks
|
||||
'values' => $muliple_weeks,
|
||||
'help' => 'How many weeks should the multiple week view show?',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'forced'=> 3,
|
||||
),
|
||||
'mainscreen_showevents' => array(
|
||||
'type' => 'select',
|
||||
@ -285,16 +285,18 @@ class calendar_hooks
|
||||
'values' => $mainpage,
|
||||
'help' => 'Displays your default calendar view on the startpage (page you get when you enter eGroupWare or click on the homepage icon)?',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> true,
|
||||
),
|
||||
'weekdaystarts' => array(
|
||||
'type' => 'select',
|
||||
'label' => 'weekday starts on',
|
||||
'name' => 'weekdaystarts',
|
||||
'values' => $weekdaystarts,
|
||||
'values' => 'Monday',
|
||||
'help' => 'This day is shown as first day in the week or month view.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'forced' => 'Monday',
|
||||
),
|
||||
'workdaystarts' => array(
|
||||
'type' => 'select',
|
||||
@ -303,7 +305,8 @@ class calendar_hooks
|
||||
'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.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 9,
|
||||
),
|
||||
'workdayends' => array(
|
||||
'type' => 'select',
|
||||
@ -312,7 +315,8 @@ class calendar_hooks
|
||||
'values' => $times,
|
||||
'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 17,
|
||||
),
|
||||
'use_time_grid' => array(
|
||||
'type' => 'select',
|
||||
@ -321,7 +325,8 @@ class calendar_hooks
|
||||
'values' => $grid_views,
|
||||
'help' => 'For which views should calendar show distinct lines with a fixed time interval.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'forced' => 'all',
|
||||
),
|
||||
'interval' => array(
|
||||
'type' => 'select',
|
||||
@ -330,7 +335,8 @@ class calendar_hooks
|
||||
'values' => $intervals,
|
||||
'help' => 'How many minutes should each interval last?',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'interval'=> 30,
|
||||
),
|
||||
'defaultlength' => array(
|
||||
'type' => 'input',
|
||||
@ -340,7 +346,8 @@ class calendar_hooks
|
||||
'default' => '',
|
||||
'size' => 3,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 60,
|
||||
),
|
||||
'defaultresource_sel' => array(
|
||||
'type' => 'select',
|
||||
@ -350,6 +357,7 @@ class calendar_hooks
|
||||
'help' => 'Default type of resources application selected in the calendar particpants research form.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False,
|
||||
'forced' => 'addressbook',
|
||||
),
|
||||
'planner_start_with_group' => array(
|
||||
'type' => 'select',
|
||||
@ -358,7 +366,7 @@ class calendar_hooks
|
||||
'values' => $options,
|
||||
'help' => 'This group that is preselected when you enter the planner. You can change it in the planner anytime you want.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'planner_show_empty_rows' => array(
|
||||
'type' => 'select',
|
||||
@ -372,7 +380,8 @@ class calendar_hooks
|
||||
),
|
||||
'help' => 'Should the planner display an empty row for users or categories without any appointment.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'forced' => 'user',
|
||||
),
|
||||
'default_private' => array(
|
||||
'type' => 'check',
|
||||
@ -380,7 +389,8 @@ class calendar_hooks
|
||||
'name' => 'default_private',
|
||||
'help' => 'Should new events created as private by default ?',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'forced' => '0',
|
||||
),
|
||||
'receive_updates' => array(
|
||||
'type' => 'select',
|
||||
@ -389,7 +399,8 @@ class calendar_hooks
|
||||
'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.",
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 'time_change',
|
||||
),
|
||||
'update_format' => array(
|
||||
'type' => 'select',
|
||||
@ -398,7 +409,8 @@ class calendar_hooks
|
||||
'values' => $update_formats,
|
||||
'help' => 'Extended updates always include the complete event-details. iCal\'s can be imported by certain other calendar-applications.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'forced' => 'ical',
|
||||
),
|
||||
'notifyAdded' => array(
|
||||
'type' => 'notify',
|
||||
@ -410,7 +422,7 @@ class calendar_hooks
|
||||
'default' => '',
|
||||
'values' => $event_details,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'notifyCanceled' => array(
|
||||
'type' => 'notify',
|
||||
@ -423,7 +435,7 @@ class calendar_hooks
|
||||
'values' => $event_details,
|
||||
'subst_help' => False,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'notifyModified' => array(
|
||||
'type' => 'notify',
|
||||
@ -436,7 +448,7 @@ class calendar_hooks
|
||||
'values' => $event_details,
|
||||
'subst_help' => False,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'notifyDisinvited' => array(
|
||||
'type' => 'notify',
|
||||
@ -449,7 +461,7 @@ class calendar_hooks
|
||||
'values' => $event_details,
|
||||
'subst_help' => False,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'notifyResponse' => array(
|
||||
'type' => 'notify',
|
||||
@ -462,7 +474,7 @@ class calendar_hooks
|
||||
'values' => $event_details,
|
||||
'subst_help' => False,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'notifyAlarm' => array(
|
||||
'type' => 'notify',
|
||||
@ -475,7 +487,7 @@ class calendar_hooks
|
||||
'values' => $event_details,
|
||||
'subst_help' => False,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'freebusy' => array(
|
||||
'type' => 'check',
|
||||
@ -494,9 +506,8 @@ class calendar_hooks
|
||||
'name' => 'freebusy_pw',
|
||||
'help' => 'If you dont set a password here, the information is available to everyone, who knows the URL!!!',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class preferences_hooks
|
||||
);
|
||||
|
||||
$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)
|
||||
{
|
||||
@ -110,6 +110,12 @@ class preferences_hooks
|
||||
'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(
|
||||
'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.',
|
||||
'size' => 3,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default' => 15,
|
||||
),
|
||||
'template_set' => array(
|
||||
'type' => 'select',
|
||||
@ -128,7 +135,8 @@ class preferences_hooks
|
||||
'values' => $_templates,
|
||||
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default' => 'idots',
|
||||
),
|
||||
'theme' => array(
|
||||
'type' => 'select',
|
||||
@ -137,7 +145,8 @@ class preferences_hooks
|
||||
'values' => $_themes,
|
||||
'help' => 'A theme defines the colors and fonts used by the template.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default' => 'idots',
|
||||
),
|
||||
'navbar_format' => array(
|
||||
'type' => 'select',
|
||||
@ -146,7 +155,8 @@ class preferences_hooks
|
||||
'values' => $navbar_format,
|
||||
'help' => 'You can show the applications as icons only, icons with app-name or both.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 'icons_and_text',
|
||||
),
|
||||
'link_list_format' => array(
|
||||
'type' => 'select',
|
||||
@ -155,7 +165,7 @@ class preferences_hooks
|
||||
'values' => $link_list_format,
|
||||
'help' => 'You can show the linked entries with icons only, icons with app-name or both.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'link_list_thumbnail' => array(
|
||||
'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.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'tz' => array(
|
||||
'type' => 'select',
|
||||
@ -176,7 +186,8 @@ class preferences_hooks
|
||||
'values' => $tzs,
|
||||
'help' => 'Please select your timezone.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> date_default_timezone_get(),
|
||||
),
|
||||
'tz_selection' => array(
|
||||
'type' => 'multiselect',
|
||||
@ -185,7 +196,7 @@ class preferences_hooks
|
||||
'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
|
||||
'admin' => False,
|
||||
),
|
||||
'dateformat' => array(
|
||||
'type' => 'select',
|
||||
@ -194,7 +205,8 @@ class preferences_hooks
|
||||
'values' => $date_formats,
|
||||
'help' => 'How should eGroupWare display dates for you.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> $lang == 'en' ? 'Y/m/d' : 'd.m.Y',
|
||||
),
|
||||
'timeformat' => array(
|
||||
'type' => 'select',
|
||||
@ -203,7 +215,8 @@ class preferences_hooks
|
||||
'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
|
||||
'admin' => False,
|
||||
'default'=> 24,
|
||||
),
|
||||
'country' => array(
|
||||
'type' => 'select',
|
||||
@ -212,7 +225,8 @@ class preferences_hooks
|
||||
'values' => ExecMethod('phpgwapi.country.countries'),
|
||||
'help' => 'In which country are you. This is used to set certain defaults for you.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> strtoupper($country),
|
||||
),
|
||||
'lang' => array(
|
||||
'type' => 'select',
|
||||
@ -221,7 +235,8 @@ class preferences_hooks
|
||||
'values' => $langs,
|
||||
'help' => 'Select the language of texts and messages within eGroupWare.<br>Some languages may not contain all messages, in that case you will see an english message.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> $lang,
|
||||
),
|
||||
'spellchecker_lang' => array(
|
||||
'type' => 'select',
|
||||
@ -230,7 +245,8 @@ class preferences_hooks
|
||||
'values' => $langs,
|
||||
'help' => 'Select the language of the spellchecker integrated into the rich text editor.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> $lang,
|
||||
),
|
||||
'rte_enter_mode' => array(
|
||||
'type' => 'select',
|
||||
@ -239,7 +255,8 @@ class preferences_hooks
|
||||
'values' => $html_enter_mode,
|
||||
'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 'br',
|
||||
),
|
||||
'rte_skin' => array(
|
||||
'type' => 'select',
|
||||
@ -248,7 +265,8 @@ class preferences_hooks
|
||||
'values' => $rich_text_editor_skins,
|
||||
'help' => 'Select the theme (visualization) of the rich text editor.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 'office2003',
|
||||
),
|
||||
'show_currentusers' => array(
|
||||
'type' => 'check',
|
||||
@ -256,7 +274,7 @@ class preferences_hooks
|
||||
'name' => 'show_currentusers',
|
||||
'help' => 'Should the number of active sessions be displayed for you all the time.',
|
||||
'xmlrpc' => False,
|
||||
'admin' => True
|
||||
'admin' => True,
|
||||
),
|
||||
'default_app' => array(
|
||||
'type' => 'select',
|
||||
@ -265,7 +283,8 @@ class preferences_hooks
|
||||
'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).",
|
||||
'xmlrpc' => False,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> 'calendar',
|
||||
),
|
||||
'currency' => array(
|
||||
'type' => 'input',
|
||||
@ -273,7 +292,8 @@ class preferences_hooks
|
||||
'name' => 'currency',
|
||||
'help' => 'Which currency symbol or name should be used in eGroupWare.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> $lang == 'en' ? '$' : 'EUR',
|
||||
),
|
||||
'account_selection' => array(
|
||||
'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.'),
|
||||
'run_lang' => false,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'account_display' => array(
|
||||
'type' => 'select',
|
||||
@ -293,7 +313,7 @@ class preferences_hooks
|
||||
'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
|
||||
'admin' => False,
|
||||
),
|
||||
'show_help' => array(
|
||||
'type' => 'check',
|
||||
@ -301,7 +321,8 @@ class preferences_hooks
|
||||
'name' => 'show_help',
|
||||
'help' => 'Should this help messages shown up always, when you enter the preferences or only on request.',
|
||||
'xmlrpc' => False,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
'default'=> True,
|
||||
),
|
||||
'enable_dragdrop' => array(
|
||||
'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 '.
|
||||
'drag and drop, it will be disabled automatically. This feature is experimental at the moment.',
|
||||
'xmlrpc' => False,
|
||||
'admin' => False
|
||||
'admin' => False,
|
||||
),
|
||||
'csv_charset' => array(
|
||||
'type' => 'select',
|
||||
|
@ -208,6 +208,7 @@
|
||||
continue;
|
||||
}
|
||||
}
|
||||
unset($valarray['default']); // not longer used as default, since we have default prefs
|
||||
switch($valarray['type'])
|
||||
{
|
||||
case 'section':
|
||||
|
@ -134,59 +134,6 @@ else
|
||||
}
|
||||
$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. */
|
||||
if(get_var('create_demo',Array('POST')))
|
||||
{
|
||||
|
@ -673,6 +673,76 @@ class setup
|
||||
$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
|
||||
*
|
||||
|
@ -366,6 +366,7 @@ class setup_process
|
||||
{
|
||||
$GLOBALS['egw_setup']->register_app($appname);
|
||||
$GLOBALS['egw_setup']->register_hooks($appname);
|
||||
$GLOBALS['egw_setup']->set_default_preferences($appname);
|
||||
}
|
||||
// Update the array values for return below
|
||||
$appdata['status'] = 'C';
|
||||
@ -398,6 +399,7 @@ class setup_process
|
||||
{
|
||||
$GLOBALS['egw_setup']->register_app($appname,$enabled);
|
||||
$GLOBALS['egw_setup']->register_hooks($appname);
|
||||
$GLOBALS['egw_setup']->set_default_preferences($appname);
|
||||
}
|
||||
$appdata['status'] = 'C';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user