Backporting default+forced prefs for all apps

This commit is contained in:
Ralf Becker 2009-10-19 18:24:49 +00:00
parent 1cbeed4c67
commit 10f92d5ecc
22 changed files with 1180 additions and 1091 deletions

View File

@ -105,8 +105,11 @@ class addressbook_hooks
/** /**
* populates $settings for the preferences * populates $settings for the preferences
*
* @param array|string $hook_data
* @return array
*/ */
static function settings() static function settings($hook_data)
{ {
$settings = array(); $settings = array();
$settings['add_default'] = array( $settings['add_default'] = array(
@ -114,11 +117,11 @@ class addressbook_hooks
'label' => 'Default addressbook for adding contacts', 'label' => 'Default addressbook for adding contacts',
'name' => 'add_default', 'name' => 'add_default',
'help' => 'Which addressbook should be selected when adding a contact AND you have no add rights to the current addressbook.', 'help' => 'Which addressbook should be selected when adding a contact AND you have no add rights to the current addressbook.',
'values' => ExecMethod('addressbook.addressbook_ui.get_addressbooks',EGW_ACL_ADD), 'values' => !$hook_data['setup'] ? ExecMethod('addressbook.addressbook_ui.get_addressbooks',EGW_ACL_ADD) : array(),
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => False, 'admin' => False,
); );
if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes') if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes') // calendar config
{ {
$settings['mainscreen_showbirthdays'] = array( $settings['mainscreen_showbirthdays'] = array(
'type' => 'select', 'type' => 'select',
@ -134,6 +137,7 @@ class addressbook_hooks
), ),
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => False, 'admin' => False,
'default'=> 3,
); );
} }
$settings['no_auto_hide'] = array( $settings['no_auto_hide'] = array(
@ -143,6 +147,7 @@ class addressbook_hooks
'help' => 'Should the columns photo and home address always be displayed, even if they are empty.', 'help' => 'Should the columns photo and home address always be displayed, even if they are empty.',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => false, 'admin' => false,
'forced' => false,
); );
// CSV Export // CSV Export
$settings['csv_fields'] = array( $settings['csv_fields'] = array(
@ -157,15 +162,17 @@ class addressbook_hooks
'help' => 'Which fields should be exported. All means every field stored in the addressbook incl. the custom fields. The business or home address only contains name, company and the selected address.', 'help' => 'Which fields should be exported. All means every field stored in the addressbook incl. the custom fields. The business or home address only contains name, company and the selected address.',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => false, 'admin' => false,
'default'=> 'business',
); );
$settings['csv_charset'] = array( $settings['csv_charset'] = array(
'type' => 'select', 'type' => 'select',
'label' => 'Charset for the CSV export', 'label' => 'Charset for the CSV export',
'name' => 'csv_charset', 'name' => 'csv_charset',
'values' => $GLOBALS['egw']->translation->get_installed_charsets()+array('utf-8' => 'utf-8 (Unicode)'), 'values' => translation::get_installed_charsets(),
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.', 'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => false, 'admin' => false,
'default'=> 'iso-8859-1',
); );
if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap') if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
@ -177,6 +184,7 @@ class addressbook_hooks
'help' => 'Do you want a private addressbook, which can not be viewed by users, you grant access to your personal addressbook?', 'help' => 'Do you want a private addressbook, which can not be viewed by users, you grant access to your personal addressbook?',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => False, 'admin' => False,
'forced' => false,
); );
} }
$settings['link_title'] = array( $settings['link_title'] = array(
@ -193,6 +201,7 @@ class addressbook_hooks
'help' => 'What should links to the addressbook display in other applications. Empty values will be left out. You need to log in anew, if you change this setting!', 'help' => 'What should links to the addressbook display in other applications. Empty values will be left out. You need to log in anew, if you change this setting!',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => false, 'admin' => false,
'default'=> 'org_name: n_family, n_given',
); );
$settings['addr_format'] = array( $settings['addr_format'] = array(
'type' => 'select', 'type' => 'select',
@ -205,6 +214,7 @@ class addressbook_hooks
'help' => 'Which address format should the addressbook use for countries it does not know the address format. If the address format of a country is known, it uses it independent of this setting.', 'help' => 'Which address format should the addressbook use for countries it does not know the address format. If the address format of a country is known, it uses it independent of this setting.',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => false, 'admin' => false,
'default'=> 'postcode_city',
); );
$settings['fileas_default'] = array( $settings['fileas_default'] = array(
'type' => 'select', 'type' => 'select',
@ -214,6 +224,7 @@ class addressbook_hooks
'help' => 'Default format for fileas, eg. for new entries.', 'help' => 'Default format for fileas, eg. for new entries.',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => false, 'admin' => false,
'default'=> 'org_name: n_family, n_given',
); );
$settings['hide_accounts'] = array( $settings['hide_accounts'] = array(
'type' => 'check', 'type' => 'check',
@ -222,6 +233,7 @@ class addressbook_hooks
'help' => 'Hides accounts completly from the adressbook.', 'help' => 'Hides accounts completly from the adressbook.',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => false, 'admin' => false,
'default'=> false,
); );
$settings['distributionListPreferredMail'] = array( $settings['distributionListPreferredMail'] = array(
'type' => 'select', 'type' => 'select',
@ -233,7 +245,8 @@ class addressbook_hooks
), ),
'help' => 'Defines which email address (business or home) to use as the preferred one for distribution lists in mail.', 'help' => 'Defines which email address (business or home) to use as the preferred one for distribution lists in mail.',
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => False 'admin' => False,
'forced'=> 'email',
); );
if ($GLOBALS['egw_info']['user']['apps']['filemanager']) if ($GLOBALS['egw_info']['user']['apps']['filemanager'])
{ {

View File

@ -1780,41 +1780,32 @@ class calendar_bo
$GLOBALS['egw']->session->appsession('default_prefs_set','calendar','set'); $GLOBALS['egw']->session->appsession('default_prefs_set','calendar','set');
$default_prefs =& $GLOBALS['egw']->preferences->default['calendar']; $default_prefs =& $GLOBALS['egw']->preferences->default['calendar'];
$forced_prefs =& $GLOBALS['egw']->preferences->forced['calendar'];
if (!($planner_start_with_group = $GLOBALS['egw']->accounts->name2id('Default'))) if (!($planner_start_with_group = $GLOBALS['egw']->accounts->name2id('Default')))
{ {
$planner_start_with_group = '0'; $planner_start_with_group = '0';
} }
$subject = lang('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n"; $subject = lang('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n";
$defaults = array( $values = array(
'defaultcalendar' => 'week', 'notifyAdded' => $subject . lang ('You have a meeting scheduled for %1','$$startdate$$'),
'mainscreen_showevents' => '0', 'notifyCanceled' => $subject . lang ('Your meeting scheduled for %1 has been canceled','$$startdate$$'),
'summary' => 'no', 'notifyModified' => $subject . lang ('Your meeting that had been scheduled for %1 has been rescheduled to %2','$$olddate$$','$$startdate$$'),
'receive_updates' => 'no', 'notifyDisinvited'=> $subject . lang ('You have been disinvited from the meeting at %1','$$startdate$$'),
'update_format' => 'extended', 'notifyResponse' => $subject . lang ('On %1 %2 %3 your meeting request for %4','$$date$$','$$fullname$$','$$action$$','$$startdate$$'),
'notifyAdded' => $subject . lang ('You have a meeting scheduled for %1','$$startdate$$'), 'notifyAlarm' => lang('Alarm for %1 at %2 in %3','$$title$$','$$startdate$$','$$location$$')."\n".lang ('Here is your requested alarm.'),
'notifyCanceled' => $subject . lang ('Your meeting scheduled for %1 has been canceled','$$startdate$$'), 'planner_start_with_group' => $planner_start_with_group,
'notifyModified' => $subject . lang ('Your meeting that had been scheduled for %1 has been rescheduled to %2','$$olddate$$','$$startdate$$'), 'interval' => 30,
'notifyDisinvited'=> $subject . lang ('You have been disinvited from the meeting at %1','$$startdate$$'),
'notifyResponse' => $subject . lang ('On %1 %2 %3 your meeting request for %4','$$date$$','$$fullname$$','$$action$$','$$startdate$$'),
'notifyAlarm' => lang('Alarm for %1 at %2 in %3','$$title$$','$$startdate$$','$$location$$')."\n".lang ('Here is your requested alarm.'),
'show_rejected' => '0',
'display_status' => '1',
'weekdaystarts' => 'Monday',
'workdaystarts' => '9',
'workdayends' => '17',
'interval' => '30',
'defaultlength' => '60',
'planner_start_with_group' => $planner_start_with_group,
'defaultfilter' => 'all',
'default_private' => '0',
'defaultresource_sel' => 'resources',
); );
foreach($defaults as $var => $default) foreach($values as $var => $default)
{ {
if (!isset($default_prefs[$var]) || (string)$default_prefs[$var] == '') $type = substr($var,0,6) == 'notify' ? 'forced' : 'default';
// only set, if neither default nor forced pref exists
if ((!isset($default_prefs[$var]) || (string)$default_prefs[$var] === '') && (!isset($forced_prefs[$var]) || (string)$forced_prefs[$var] === ''))
{ {
$GLOBALS['egw']->preferences->add('calendar',$var,$default,'default'); $GLOBALS['egw']->preferences->add('calendar',$var,$default,'default'); // always store default, even if we have a forced too
if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced');
$this->cal_prefs[$var] = $default; $this->cal_prefs[$var] = $default;
$need_save = True; $need_save = True;
} }
@ -1822,6 +1813,7 @@ class calendar_bo
if ($need_save) if ($need_save)
{ {
$GLOBALS['egw']->preferences->save_repository(False,'default'); $GLOBALS['egw']->preferences->save_repository(False,'default');
$GLOBALS['egw']->preferences->save_repository(False,'forced');
} }
} }

View File

@ -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,28 +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>');
} }
$defaultfilter = array(
'all' => lang('all'),
'private' => lang('private only'),
// 'public' => lang('global public only'),
// 'group' => lang('group public only'),
// 'private+public' => lang('private and global public'),
// 'private+group' => lang('private and group public'),
// 'public+group' => lang('global public and group public')
);
$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',
@ -267,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',
@ -276,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',
@ -285,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',
@ -294,7 +285,8 @@ 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'=> '1',
), ),
'show_rejected' => array( 'show_rejected' => array(
'type' => 'check', 'type' => 'check',
@ -306,10 +298,11 @@ class calendar_hooks
'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',
@ -318,7 +311,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',
@ -327,7 +321,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'=> 18,
), ),
'use_time_grid' => array( 'use_time_grid' => array(
'type' => 'select', 'type' => 'select',
@ -336,7 +331,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',
@ -345,7 +341,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,
'default'=> 30,
), ),
'defaultlength' => array( 'defaultlength' => array(
'type' => 'input', 'type' => 'input',
@ -355,7 +352,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',
@ -365,6 +363,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',
@ -373,7 +372,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',
@ -387,7 +386,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',
@ -395,7 +395,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',
@ -404,7 +405,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',
@ -413,7 +415,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',
@ -425,7 +428,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',
@ -438,7 +441,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',
@ -451,7 +454,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',
@ -460,11 +463,10 @@ class calendar_hooks
'rows' => 5, 'rows' => 5,
'cols' => 50, 'cols' => 50,
'help' => 'This message is sent to disinvited participants.', 'help' => 'This message is sent to disinvited participants.',
'default' => '',
'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',
@ -473,11 +475,10 @@ class calendar_hooks
'rows' => 5, 'rows' => 5,
'cols' => 50, 'cols' => 50,
'help' => 'This message is sent when you accept, tentative accept or reject an event.', 'help' => 'This message is sent when you accept, tentative accept or reject an event.',
'default' => '',
'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',
@ -486,11 +487,10 @@ class calendar_hooks
'rows' => 5, 'rows' => 5,
'cols' => 50, 'cols' => 50,
'help' => 'This message is sent when you set an Alarm for a certain event. Include all information you might need.', 'help' => 'This message is sent when you set an Alarm for a certain event. Include all information you might need.',
'default' => '',
'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',
@ -498,10 +498,10 @@ class calendar_hooks
'name' => 'freebusy', 'name' => 'freebusy',
'help' => $freebusy_help, 'help' => $freebusy_help,
'run_lang' => false, 'run_lang' => false,
'default' => '',
'subst_help' => False, 'subst_help' => False,
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => False, 'admin' => False,
'forced' => false,
), ),
'freebusy_pw' => array( 'freebusy_pw' => array(
'type' => 'input', 'type' => 'input',
@ -509,9 +509,9 @@ 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,
'forced' => 'no'
) )
); );
return true;
} }
} }

View File

@ -0,0 +1,515 @@
<?php
/**
* FelamiMail - admin, preferences and sidebox-menus and other hooks
*
* @link http://www.egroupware.org
* @package felamimail
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
* Class containing admin, preferences and sidebox-menus and other hooks
*/
class felamimail_hooks
{
/**
* Settings hook
*
* @param array|string $hook_data
*/
static function settings($hook_data)
{
if (!$hook_data['setup']) // does not work on setup time
{
$folderList = array();
$this->bofelamimail =& CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
if($this->bofelamimail->openConnection()) {
$folderObjects = $this->bofelamimail->getFolderObjects(true, false);
foreach($folderObjects as $folderName => $folderInfo) {
#_debug_array($folderData);
$folderList[$folderName] = $folderInfo->displayName;
}
$this->bofelamimail->closeConnection();
}
$availableAutoFolders['none'] = lang('none, create all');
foreach($this->bofelamimail->autoFolders as $aname) {
$availableAutoFolders[$aname] = lang($aname);
}
$felamimailConfig = config::read('felamimail');
}
$refreshTime = array(
'0' => lang('disabled'),
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
'15' => '15',
'20' => '20',
'30' => '30'
);
$no_yes = array(
'0' => lang('no'),
'1' => lang('yes')
);
$prefAllowManageFolders = $no_yes;
$forwardOptions = array(
'asmail' => lang('forward as attachment'),
'inline' => lang('forward inline'),
);
$sortOrder = array(
'0' => lang('date(newest first)'),
'1' => lang('date(oldest first)'),
'3' => lang('from(A->Z)'),
'2' => lang('from(Z->A)'),
'5' => lang('subject(A->Z)'),
'4' => lang('subject(Z->A)'),
'7' => lang('size(0->...)'),
'6' => lang('size(...->0)')
);
$selectOptions = array(
'0' => lang('no'),
'1' => lang('yes'),
'2' => lang('yes') . ' - ' . lang('small view')
);
$newWindowOptions = array(
'1' => lang('only one window'),
'2' => lang('allways a new window'),
);
$deleteOptions = array(
'move_to_trash' => lang('move to trash'),
'mark_as_deleted' => lang('mark as deleted'),
'remove_immediately' => lang('remove immediately')
);
$composeOptions = array(
'html' => lang('html'),
'text' => lang('text/plain'),
);
$htmlOptions = array(
'never_display' => lang('never display html emails'),
'only_if_no_text' => lang('display only when no plain text is available'),
'always_display' => lang('always show html emails'),
);
$rowOrderStyle = array(
'felamimail' => lang('FeLaMiMail'),
'outlook' => 'Outlook',
);
$trashOptions = array_merge(
array(
'none' => lang("Don't use Trash")
),
$folderList
);
$sentOptions = array_merge(
array(
'none' => lang("Don't use Sent")
),
$folderList
);
$draftOptions = array_merge(
array(
'none' => lang("Don't use draft folder")
),
$folderList
);
$templateOptions = array_merge(
array(
'none' => lang("Don't use template folder")
),
$folderList
);
// modify folderlist, add a none entry, to be able to force the regarding settings, if no folders apply
$folderList['none'] = lang('no folders');
/* Settings array for this app */
return array(
'refreshTime' => array(
'type' => 'select',
'label' => 'Refresh time in minutes',
'name' => 'refreshTime',
'values' => $refreshTime,
'xmlrpc' => True,
'admin' => False,
'forced'=> 5,
),
'prefaskformove' => array(
'type' => 'select',
'label' => 'Do you want to be asked for confirmation before moving selected messages to another folder?',
'name' => 'prefaskformove',
'values' => $no_yes,
'xmlrpc' => True,
'admin' => False,
'forced' => '1',
),
'prefpreventmanagefolders' => array(
'type' => 'select',
'label' => 'Do you want to prevent the managing of folders (creation, accessrights AND subscribtion)?',
'name' => 'prefpreventmanagefolders',
'values' => $prefAllowManageFolders,
'xmlrpc' => True,
'admin' => False,
'forced' => '0',
),
'prefpreventforwarding' => array(
'type' => 'select',
'label' => 'Do you want to prevent the editing/setup for forwarding of mails via settings (, even if SIEVE is enabled)?',
'name' => 'prefpreventforwarding',
'values' => $no_yes,
'xmlrpc' => True,
'admin' => False,
'forced' => '0',
),
'prefpreventnotificationformailviaemail' => array(
'type' => 'select',
'label' => 'Do you want to prevent the editing/setup of notification by mail to other emailadresses if emails arrive (, even if SIEVE is enabled)?',
'name' => 'prefpreventnotificationformailviaemail',
'values' => $no_yes,
'xmlrpc' => True,
'admin' => False,
'forced' => '1',
),
'prefpreventeditfilterrules' => array(
'type' => 'select',
'label' => 'Do you want to prevent the editing/setup of filter rules (, even if SIEVE is enabled)?',
'name' => 'prefpreventeditfilterrules',
'values' => $no_yes,
'xmlrpc' => True,
'admin' => False,
'forced' => '0',
),
'prefpreventabsentnotice' => array(
'type' => 'select',
'label' => 'Do you want to prevent the editing/setup of the absent/vacation notice (, even if SIEVE is enabled)?',
'name' => 'prefpreventabsentnotice',
'values' => $no_yes,
'xmlrpc' => True,
'admin' => False,
'forced' => '0',
),
'notavailableautofolders' => array(
'type' => 'multiselect',
'label' => 'which folders - in general - should NOT be automatically created, if not existing',
'name' => 'notavailableautofolders',
'values' => $availableAutoFolders,
'xmlrpc' => True,
'admin' => False,
'forced' => 'none',
),
'sortOrder' => array(
'type' => 'select',
'label' => 'Default sorting order',
'name' => 'sortOrder',
'values' => $sortOrder,
'xmlrpc' => True,
'admin' => False,
'default'=> '0', // newest first
),
'rowOrderStyle' => array(
'type' => 'select',
'label' => 'row order style',
'name' => 'rowOrderStyle',
'values' => $rowOrderStyle,
'xmlrpc' => True,
'admin' => False,
'default'=> 'felamimail',
),
'message_forwarding' => array(
'type' => 'select',
'label' => 'how to forward messages',
'name' => 'message_forwarding',
'values' => $forwardOptions,
'xmlrpc' => True,
'admin' => False,
'default'=> 'asmail',
),
'mainscreen_showmail' => array(
'type' => 'select',
'label' => 'show new messages on main screen',
'name' => 'mainscreen_showmail',
'values' => $selectOptions,
'xmlrpc' => True,
'admin' => False,
'default'=> '2',
),
'mainscreen_showfolders' => array(
'type' => 'multiselect',
'label' => 'if shown, which folders should appear on main screen',
'name' => 'mainscreen_showfolders',
'values' => $folderList,
'xmlrpc' => True,
'admin' => False,
),
'messages_showassent_0' => array(
'type' => 'multiselect',
'label' => 'which folders (additional to the Sent Folder) should be displayed using the Sent Folder View Schema',
'name' => 'messages_showassent_0',
'values' => $folderList,
'xmlrpc' => True,
'admin' => False,
'forced' => 'none',
),
'notify_folders' => array(
'type' => 'multiselect',
'label' => 'notify when new mails arrive on these folders',
'name' => 'notify_folders',
'values' => $folderList,
'xmlrpc' => True,
'admin' => False,
),
'message_newwindow' => array(
'type' => 'select',
'label' => 'display messages in multiple windows',
'name' => 'message_newwindow',
'values' => $newWindowOptions,
'xmlrpc' => True,
'admin' => False,
'forced' => '1',
),
'deleteOptions' => array(
'type' => 'select',
'label' => 'when deleting messages',
'name' => 'deleteOptions',
'values' => $deleteOptions,
'xmlrpc' => True,
'admin' => False,
'default'=> 'move_to_trash',
),
'composeOptions' => array(
'type' => 'select',
'label' => 'start new messages with mime type plain/text or html?',
'name' => 'composeOptions',
'values' => $composeOptions,
'xmlrpc' => True,
'admin' => False,
'default'=> 'html',
),
'htmlOptions' => array(
'type' => 'select',
'label' => 'display of html emails',
'name' => 'htmlOptions',
'values' => $htmlOptions,
'xmlrpc' => True,
'admin' => False,
'forced' => 'only_if_no_text',
),
'allowExternalIMGs' => array(
'type' => 'check',
'label' => 'allow images from external sources in html emails',
'name' => 'allowExternalIMGs',
'xmlrpc' => True,
'admin' => True,
'forced' => true,
),
'trashFolder' => array(
'type' => 'select',
'label' => 'trash folder',
'name' => 'trashFolder',
'values' => $trashOptions,
'xmlrpc' => True,
'admin' => False,
),
'sentFolder' => array(
'type' => 'select',
'label' => 'sent folder',
'name' => 'sentFolder',
'values' => $sentOptions,
'xmlrpc' => True,
'admin' => False,
),
'draftFolder' => array(
'type' => 'select',
'label' => 'draft folder',
'name' => 'draftFolder',
'values' => $draftOptions,
'xmlrpc' => True,
'admin' => False,
),
'templateFolder' => array(
'type' => 'select',
'label' => 'template folder',
'name' => 'templateFolder',
'values' => $templateOptions,
'xmlrpc' => True,
'admin' => False,
),
'sieveScriptName' => array(
'type' => 'input',
'label' => 'sieve script name',
'name' => 'sieveScriptName',
'xmlrpc' => True,
'admin' => False,
'forced' => 'felamimail',
),
);
}
/**
* Preferences hook
*
* @param array|string $hook_data
*/
static function preferences($hook_data)
{
// Only Modify the $file and $title variables.....
$title = $appname = 'felamimail';
$mailPreferences = ExecMethod('felamimail.bopreferences.getPreferences');
$file['Preferences'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $appname);
if($mailPreferences->userDefinedAccounts) {
$linkData = array
(
'menuaction' => 'felamimail.uipreferences.listAccountData',
);
$file['Manage eMail Accounts and Identities'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
if(empty($mailPreferences->preferences['prefpreventmanagefolders']) || $mailPreferences->preferences['prefpreventmanagefolders'] == 0) {
$file['Manage Folders'] = $GLOBALS['egw']->link('/index.php','menuaction=felamimail.uipreferences.listFolder');
}
if (is_object($mailPreferences))
{
$icServer = $mailPreferences->getIncomingServer(0);
if($icServer->enableSieve) {
if(empty($mailPreferences->preferences['prefpreventeditfilterrules']) || $mailPreferences->preferences['prefpreventeditfilterrules'] == 0)
$file['filter rules'] = $GLOBALS['egw']->link('/index.php', 'menuaction=felamimail.uisieve.listRules');
if(empty($mailPreferences->preferences['prefpreventabsentnotice']) || $mailPreferences->preferences['prefpreventabsentnotice'] == 0)
$file['vacation notice'] = $GLOBALS['egw']->link('/index.php','menuaction=felamimail.uisieve.editVacation');
}
}
//Do not modify below this line
display_section($appname,$title,$file);
}
/**
* Sidebox menu hook
*
* @param array|string $hook_data
*/
static function sidebox_menu($hook_data)
{
$appname = 'felamimail';
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
$preferences = ExecMethod('felamimail.bopreferences.getPreferences');
$linkData = array(
'menuaction' => 'felamimail.uicompose.compose'
);
$file = array(
array(
'text' => '<a class="textSidebox" href="'. htmlspecialchars($GLOBALS['egw']->link('/index.php', $linkData)).'" target="_blank" onclick="egw_openWindowCentered(\''.$GLOBALS['egw']->link('/index.php', $linkData).'\',\''.lang('compose').'\',700,750); return false;">'.lang('compose'),
'no_lang' => true,
),
);
if($preferences->preferences['deleteOptions'] == 'move_to_trash')
{
$file += Array(
'_NewLine_' => '', // give a newline
'empty trash' => "javascript:emptyTrash();",
);
}
if($preferences->preferences['deleteOptions'] == 'mark_as_deleted')
{
$file += Array(
'_NewLine_' => '', // give a newline
'compress folder' => "javascript:compressFolder();",
);
}
display_sidebox($appname,$menu_title,$file);
if ($GLOBALS['egw_info']['user']['apps']['preferences'])
{
#$mailPreferences = ExecMethod('felamimail.bopreferences.getPreferences');
$menu_title = lang('Preferences');
$file = array(
'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=felamimail'),
);
if($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) {
$linkData = array (
'menuaction' => 'felamimail.uipreferences.listAccountData',
);
$file['Manage eMail Accounts and Identities'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
if($preferences->ea_user_defined_signatures) {
$linkData = array (
'menuaction' => 'felamimail.uipreferences.listSignatures',
);
$file['Manage Signatures'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
if(empty($preferences->preferences['prefpreventmanagefolders']) || $preferences->preferences['prefpreventmanagefolders'] == 0) {
$file['Manage Folders'] = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'felamimail.uipreferences.listFolder'));
}
$icServer = $preferences->getIncomingServer(0);
if(is_a($icServer, 'defaultimap')) {
if($icServer->enableSieve)
{
$linkData = array
(
'menuaction' => 'felamimail.uisieve.listRules',
);
if(empty($preferences->preferences['prefpreventeditfilterrules']) || $preferences->preferences['prefpreventeditfilterrules'] == 0)
$file['filter rules'] = $GLOBALS['egw']->link('/index.php',$linkData);
$linkData = array
(
'menuaction' => 'felamimail.uisieve.editVacation',
);
if(empty($preferences->preferences['prefpreventabsentnotice']) || $preferences->preferences['prefpreventabsentnotice'] == 0)
{
$file['vacation notice'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
if((empty($preferences->preferences['prefpreventnotificationformailviaemail']) ||
$preferences->preferences['prefpreventnotificationformailviaemail'] == 0) &&
(empty($preferences->preferences['prefpreventforwarding']) ||
$preferences->preferences['prefpreventforwarding'] == 0) )
{
$file['email notification'] = $GLOBALS['egw']->link('/index.php','menuaction=felamimail.uisieve.editEmailNotification'); //Added email notifications
}
}
}
$ogServer = $preferences->getOutgoingServer(0);
if(is_a($ogServer, 'defaultsmtp')) {
if($ogServer->editForwardingAddress)
{
$linkData = array
(
'menuaction' => 'felamimail.uipreferences.editForwardingAddress',
);
if(empty($preferences->preferences['prefpreventforwarding']) || $preferences->preferences['prefpreventforwarding'] == 0)
$file['Forwarding'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
}
display_sidebox($appname,$menu_title,$file);
}
}
}

View File

@ -1,30 +0,0 @@
<?php
/**************************************************************************\
* eGroupWare *
* http://www.egroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
{
##
#
# There is nothing to configure in FeLaMiMail anymore
#
##
// Only Modify the $file and $title variables.....
# $title = $appname;
# $file = Array(
# 'Site Configuration' => $GLOBALS['egw']->link('/index.php','menuaction=felamimail.uifelamimail.hookAdmin')
# );
//Do not modify below this line
# display_section($appname,$title,$file);
}
?>

View File

@ -1,42 +0,0 @@
<?php
/**************************************************************************\
* FeLaMiMail *
* http://www.egroupware.org *
* Written by Lars Kneschke <lars@kneschke.de> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; version 2 of the License. *
\**************************************************************************/
/* $Id$ */
{
// Only Modify the $file and $title variables.....
$title = $appname;
$mailPreferences = ExecMethod('felamimail.bopreferences.getPreferences');
$file['Preferences'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $appname);
if($mailPreferences->userDefinedAccounts) {
$linkData = array
(
'menuaction' => 'felamimail.uipreferences.listAccountData',
);
$file['Manage eMail Accounts and Identities'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
if(empty($mailPreferences->preferences['prefpreventmanagefolders']) || $mailPreferences->preferences['prefpreventmanagefolders'] == 0) {
$file['Manage Folders'] = $GLOBALS['egw']->link('/index.php','menuaction=felamimail.uipreferences.listFolder');
}
if (is_object($mailPreferences))
{
$icServer = $mailPreferences->getIncomingServer(0);
if($icServer->enableSieve) {
$file['filter rules'] = $GLOBALS['egw']->link('/index.php', 'menuaction=felamimail.uisieve.listRules');
$file['vacation notice'] = $GLOBALS['egw']->link('/index.php','menuaction=felamimail.uisieve.editVacation');
}
}
//Do not modify below this line
display_section($appname,$title,$file);
}

View File

@ -1,306 +0,0 @@
<?php
/**************************************************************************\
* eGroupWare - Preferences *
* http://www.egroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$folderList = array();
$this->bofelamimail =& CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
if($this->bofelamimail->openConnection()) {
$folderObjects = $this->bofelamimail->getFolderObjects(true, false);
foreach($folderObjects as $folderName => $folderInfo) {
#_debug_array($folderData);
$folderList[$folderName] = $folderInfo->displayName;
}
$this->bofelamimail->closeConnection();
}
foreach($this->bofelamimail->autoFolders as $aname) {
$availableAutoFolders[$aname] = lang($aname);
}
$config =& CreateObject('phpgwapi.config','felamimail');
$config->read_repository();
$felamimailConfig = $config->config_data;
unset($config);
$refreshTime = array(
'0' => lang('disabled'),
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
'15' => '15',
'20' => '20',
'30' => '30'
);
$prefAskForMove = array(
'0' => lang('no'),
'1' => lang('yes')
);
$prefAllowManageFolders = $prefAskForMove;
$forwardOptions = array(
'asmail' => lang('forward as attachment'),
'inline' => lang('forward inline'),
);
$sortOrder = array(
'0' => lang('date(newest first)'),
'1' => lang('date(oldest first)'),
'3' => lang('from(A->Z)'),
'2' => lang('from(Z->A)'),
'5' => lang('subject(A->Z)'),
'4' => lang('subject(Z->A)'),
'7' => lang('size(0->...)'),
'6' => lang('size(...->0)')
);
$selectOptions = array(
'0' => lang('no'),
'1' => lang('yes'),
'2' => lang('yes') . ' - ' . lang('small view')
);
$newWindowOptions = array(
'1' => lang('only one window'),
'2' => lang('allways a new window'),
);
$deleteOptions = array(
'move_to_trash' => lang('move to trash'),
'mark_as_deleted' => lang('mark as deleted'),
'remove_immediately' => lang('remove immediately')
);
$composeOptions = array(
'html' => lang('html'),
'text' => lang('text/plain'),
);
$htmlOptions = array(
'never_display' => lang('never display html emails'),
'only_if_no_text' => lang('display only when no plain text is available'),
'always_display' => lang('always show html emails'),
);
$rowOrderStyle = array(
'felamimail' => lang('FeLaMiMail'),
'outlook' => 'Outlook',
);
$trashOptions = array_merge(
array(
'none' => lang("Don't use Trash")
),
$folderList
);
$sentOptions = array_merge(
array(
'none' => lang("Don't use Sent")
),
$folderList
);
$draftOptions = array_merge(
array(
'none' => lang("Don't use draft folder")
),
$folderList
);
$templateOptions = array_merge(
array(
'none' => lang("Don't use template folder")
),
$folderList
);
/* Settings array for this app */
$GLOBALS['settings'] = array(
'refreshTime' => array(
'type' => 'select',
'label' => 'Refresh time in minutes',
'name' => 'refreshTime',
'values' => $refreshTime,
'xmlrpc' => True,
'admin' => False
),
'prefaskformove' => array(
'type' => 'select',
'label' => 'Do you want to be asked for confirmation before moving selected messages to another folder?',
'name' => 'prefaskformove',
'values' => $prefAskForMove,
'xmlrpc' => True,
'admin' => False
),
'prefpreventmanagefolders' => array(
'type' => 'select',
'label' => 'Do you want to prevent the managing of folders (creation, accessrights AND subscribtion)?',
'name' => 'prefpreventmanagefolders',
'values' => $prefAllowManageFolders,
'xmlrpc' => True,
'admin' => False
),
'notavailableautofolders' => array(
'type' => 'multiselect',
'label' => 'which folders - in general - should NOT be automatically created, if not existing',
'name' => 'notavailableautofolders',
'values' => $availableAutoFolders,
'xmlrpc' => True,
'admin' => False
),
'sortOrder' => array(
'type' => 'select',
'label' => 'Default sorting order',
'name' => 'sortOrder',
'values' => $sortOrder,
'xmlrpc' => True,
'admin' => False
),
'rowOrderStyle' => array(
'type' => 'select',
'label' => 'row order style',
'name' => 'rowOrderStyle',
'values' => $rowOrderStyle,
'xmlrpc' => True,
'admin' => False
),
'message_forwarding' => array(
'type' => 'select',
'label' => 'how to forward messages',
'name' => 'message_forwarding',
'values' => $forwardOptions,
'xmlrpc' => True,
'admin' => False
),
'mainscreen_showmail' => array(
'type' => 'select',
'label' => 'show new messages on main screen',
'name' => 'mainscreen_showmail',
'values' => $selectOptions,
'xmlrpc' => True,
'admin' => False
),
'mainscreen_showfolders' => array(
'type' => 'multiselect',
'label' => 'if shown, which folders should appear on main screen',
'name' => 'mainscreen_showfolders',
'values' => $folderList,
'xmlrpc' => True,
'admin' => False
),
'messages_showassent_0' => array(
'type' => 'multiselect',
'label' => 'which folders (additional to the Sent Folder) should be displayed using the Sent Folder View Schema',
'name' => 'messages_showassent_0',
'values' => $folderList,
'xmlrpc' => True,
'admin' => False
),
'notify_folders' => array(
'type' => 'multiselect',
'label' => 'notify when new mails arrive on these folders',
'name' => 'notify_folders',
'values' => $folderList,
'xmlrpc' => True,
'admin' => False
),
'message_newwindow' => array(
'type' => 'select',
'label' => 'display messages in multiple windows',
'name' => 'message_newwindow',
'values' => $newWindowOptions,
'xmlrpc' => True,
'admin' => False
),
'deleteOptions' => array(
'type' => 'select',
'label' => 'when deleting messages',
'name' => 'deleteOptions',
'values' => $deleteOptions,
'xmlrpc' => True,
'admin' => False
),
'composeOptions' => array(
'type' => 'select',
'label' => 'start new messages with mime type plain/text or html?',
'name' => 'composeOptions',
'values' => $composeOptions,
'xmlrpc' => True,
'admin' => False
),
'htmlOptions' => array(
'type' => 'select',
'label' => 'display of html emails',
'name' => 'htmlOptions',
'values' => $htmlOptions,
'xmlrpc' => True,
'admin' => False
),
'allowExternalIMGs' => array(
'type' => 'check',
'label' => 'allow images from external sources in html emails',
'name' => 'allowExternalIMGs',
'xmlrpc' => True,
'admin' => True
),
'trashFolder' => array(
'type' => 'select',
'label' => 'trash folder',
'name' => 'trashFolder',
'values' => $trashOptions,
'xmlrpc' => True,
'admin' => False
),
'sentFolder' => array(
'type' => 'select',
'label' => 'sent folder',
'name' => 'sentFolder',
'values' => $sentOptions,
'xmlrpc' => True,
'admin' => False
),
'draftFolder' => array(
'type' => 'select',
'label' => 'draft folder',
'name' => 'draftFolder',
'values' => $draftOptions,
'xmlrpc' => True,
'admin' => False
),
'templateFolder' => array(
'type' => 'select',
'label' => 'template folder',
'name' => 'templateFolder',
'values' => $templateOptions,
'xmlrpc' => True,
'admin' => False
),
'sieveScriptName' => array(
'type' => 'input',
'label' => 'sieve script name',
'name' => 'sieveScriptName',
'xmlrpc' => True,
'admin' => False
)
);
?>

View File

@ -1,140 +1,12 @@
<?php <?php
{ /**
/**************************************************************************\ * FelamiMail - easing migration to new hooks
* eGroupWare - Calendar's Sidebox-Menu for idots-template * *
* http://www.egroupware.org * * @link http://www.egroupware.org
* Written by Pim Snel <pim@lingewoud.nl> * * @package felamimail
* -------------------------------------------- * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* This program is free software; you can redistribute it and/or modify it * * @version $Id$
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
/*
This hookfile is for generating an app-specific side menu used in the idots
template set.
$menu_title speaks for itself
$file is the array with link to app functions
display_sidebox can be called as much as you like
*/ */
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); ExecMethod('phpgwapi.hooks.register_all_hooks');
$preferences = ExecMethod('felamimail.bopreferences.getPreferences'); felamimail_hooks::sidebox_menu(array('location' => 'sidebox_menu'));
$linkData = array
(
'menuaction' => 'felamimail.uicompose.compose'
);
$file = array(
array(
'text' => '<a class="textSidebox" href="'. htmlspecialchars($GLOBALS['egw']->link('/index.php', $linkData)).'" target="_blank" onclick="egw_openWindowCentered(\''.$GLOBALS['egw']->link('/index.php', $linkData).'\',\''.lang('compose').'\',700,750); return false;">'.lang('compose'),
'no_lang' => true,
),
);
# $linkData = array
# (
# 'menuaction' => 'felamimail.uifelamimail.importMessage'
# );
# $file += array(
# 'import' => array(
# 'text' => '<a class="textSidebox" href="'. htmlspecialchars($GLOBALS['egw']->link('/index.php', $linkData)).'" target="_blank" onclick="egw_openWindowCentered(\''.$GLOBALS['egw']->link('/index.php', $linkData).'\',\''.lang('import').'\',550,100); return false;">'.lang('Import Mail'),
# 'no_lang' => true,
# ),
# );
if($preferences->preferences['deleteOptions'] == 'move_to_trash')
{
$file += Array(
'_NewLine_' => '', // give a newline
'empty trash' => "javascript:emptyTrash();",
);
}
if($preferences->preferences['deleteOptions'] == 'mark_as_deleted')
{
$file += Array(
'_NewLine_' => '', // give a newline
'compress folder' => "javascript:compressFolder();",
);
}
display_sidebox($appname,$menu_title,$file);
if ($GLOBALS['egw_info']['user']['apps']['preferences'])
{
#$mailPreferences = ExecMethod('felamimail.bopreferences.getPreferences');
$menu_title = lang('Preferences');
$file = array(
'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=felamimail'),
);
if($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) {
$linkData = array (
'menuaction' => 'felamimail.uipreferences.listAccountData',
);
$file['Manage eMail Accounts and Identities'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
if($preferences->ea_user_defined_signatures) {
$linkData = array (
'menuaction' => 'felamimail.uipreferences.listSignatures',
);
$file['Manage Signatures'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
if(empty($preferences->preferences['prefpreventmanagefolders']) || $preferences->preferences['prefpreventmanagefolders'] == 0) {
$file['Manage Folders'] = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'felamimail.uipreferences.listFolder'));
}
$icServer = $preferences->getIncomingServer(0);
if(is_a($icServer, 'defaultimap')) {
if($icServer->enableSieve)
{
$linkData = array
(
'menuaction' => 'felamimail.uisieve.listRules',
);
$file['filter rules'] = $GLOBALS['egw']->link('/index.php',$linkData);
$linkData = array
(
'menuaction' => 'felamimail.uisieve.editVacation',
);
$file['vacation notice'] = $GLOBALS['egw']->link('/index.php',$linkData);
$file['email notification'] = $GLOBALS['egw']->link('/index.php','menuaction=felamimail.uisieve.editEmailNotification'); //Added email notifications
}
}
$ogServer = $preferences->getOutgoingServer(0);
if(is_a($ogServer, 'defaultsmtp')) {
if($ogServer->editForwardingAddress)
{
$linkData = array
(
'menuaction' => 'felamimail.uipreferences.editForwardingAddress',
);
$file['Forwarding'] = $GLOBALS['egw']->link('/index.php',$linkData);
}
}
display_sidebox($appname,$menu_title,$file);
}
/* if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$menu_title = lang('Administration');
$file = Array(
'Configuration' => $GLOBALS['egw']->link('/index.php','menuaction=felamimail.uifelamimail.hookAdmin')
);
display_sidebox($appname,$menu_title,$file);
} */
}
?>

View File

@ -26,11 +26,10 @@ $setup_info['felamimail']['maintainer_email'] = 'kl@leithoff.net';
$setup_info['felamimail']['tables'] = array('egw_felamimail_displayfilter','egw_felamimail_accounts','egw_felamimail_signatures'); $setup_info['felamimail']['tables'] = array('egw_felamimail_displayfilter','egw_felamimail_accounts','egw_felamimail_signatures');
/* The hooks this app includes, needed for hooks registration */ /* The hooks this app includes, needed for hooks registration */
$setup_info['felamimail']['hooks'][] = 'preferences'; $setup_info['felamimail']['hooks']['preferences'] = 'felamimail_hooks::preferences';
#$setup_info['felamimail']['hooks'][] = 'admin'; $setup_info['felamimail']['hooks']['settings'] = 'felamimail_hooks::settings';
$setup_info['felamimail']['hooks'][] = 'settings';
$setup_info['felamimail']['hooks'][] = 'home'; $setup_info['felamimail']['hooks'][] = 'home';
$setup_info['felamimail']['hooks'][] = 'sidebox_menu'; $setup_info['felamimail']['hooks']['sidebox_menu'] = 'felamimail_hooks::sidebox_menu';
$setup_info['felamimail']['hooks'][] = 'notifywindow'; $setup_info['felamimail']['hooks'][] = 'notifywindow';
$setup_info['felamimail']['hooks']['addaccount'] = 'felamimail.bofelamimail.addAccount'; $setup_info['felamimail']['hooks']['addaccount'] = 'felamimail.bofelamimail.addAccount';
$setup_info['felamimail']['hooks']['deleteaccount'] = 'felamimail.bofelamimail.deleteAccount'; $setup_info['felamimail']['hooks']['deleteaccount'] = 'felamimail.bofelamimail.deleteAccount';

View File

@ -113,15 +113,8 @@ class filemanager_hooks
$config = config::read(self::$appname); $config = config::read(self::$appname);
if (!empty($config['max_folderlinks'])) self::$foldercount = (int)$config['max_folderlinks']; if (!empty($config['max_folderlinks'])) self::$foldercount = (int)$config['max_folderlinks'];
$upload_boxes = array(
'1' => '1',
'5' => '5',
'10' => '10',
'20' => '20',
'30' => '30'
);
$yes_no = array( $yes_no = array(
'no' => lang('No'), 'no' => lang('No'),
'yes' => lang('Yes') 'yes' => lang('Yes')
); );
@ -133,17 +126,17 @@ class filemanager_hooks
'label' => lang('Show link to filemanagers basedirectory (/) in side box menu?'), 'label' => lang('Show link to filemanagers basedirectory (/) in side box menu?'),
'help' => lang('Default behavior is NO. The link will not be shown, but you are still able to navigate to this location, or configure this paricular location as startfolder or folderlink.'), 'help' => lang('Default behavior is NO. The link will not be shown, but you are still able to navigate to this location, or configure this paricular location as startfolder or folderlink.'),
'xmlrpc' => True, 'xmlrpc' => True,
'amin' => False 'admin' => False,
'default' => 'no',
), ),
'startfolder' => array( 'startfolder' => array(
'type' => 'input', 'type' => 'input',
'name' => 'startfolder', 'name' => 'startfolder',
'size' => 60, 'size' => 60,
'default' => '',
'label' => lang('Enter the complete VFS path to specify your desired start folder.'), 'label' => lang('Enter the complete VFS path to specify your desired start folder.'),
'help' => lang('The default start folder is your personal Folder. The default is used, if you leave this empty, the path does not exist or you lack the neccessary access permissions.'), 'help' => lang('The default start folder is your personal Folder. The default is used, if you leave this empty, the path does not exist or you lack the neccessary access permissions.'),
'xmlrpc' => True, 'xmlrpc' => True,
'amin' => False 'admin' => False,
), ),
); );
for ($i=1; $i <= self::$foldercount; $i++) for ($i=1; $i <= self::$foldercount; $i++)
@ -155,7 +148,7 @@ class filemanager_hooks
'default' => '', 'default' => '',
'label' => lang('Enter the complete VFS path to specify a fast access link to a folder').' ('.$i.').', 'label' => lang('Enter the complete VFS path to specify a fast access link to a folder').' ('.$i.').',
'xmlrpc' => True, 'xmlrpc' => True,
'amin' => False 'admin' => False
); );
} }
return $settings; return $settings;

View File

@ -23,6 +23,15 @@
*/ */
class preferences class preferences
{ {
/**
* account_id for default prefs
*/
const DEFAULT_ID = -2;
/**
* account_id for forced prefs
*/
const FORCED_ID = -1;
/** /**
* account the class is instanciated for * account the class is instanciated for
* @var int * @var int
@ -69,11 +78,14 @@ class preferences
var $table = 'egw_preferences'; var $table = 'egw_preferences';
var $values,$vars; // standard notify substitues, will be set by standard_substitues() var $values,$vars; // standard notify substitues, will be set by standard_substitues()
#var $debug = false;
/** /**
* Standard constructor for setting $this->account_id * Contstructor
*
* @param int|string $account_id=''
* @return preferences
*/ */
function preferences($account_id = '') function __construct($account_id = '')
{ {
if (is_object($GLOBALS['egw']->db)) if (is_object($GLOBALS['egw']->db))
{ {
@ -87,6 +99,18 @@ class preferences
$this->account_id = get_account_id($account_id); $this->account_id = get_account_id($account_id);
} }
/**
* Old PHP4 contstructor
*
* @param int|string $account_id=''
* @return preferences
* @deprecated
*/
function preferences($account_id = '')
{
self::__construct();
}
/**************************************************************************\ /**************************************************************************\
* These are the standard $this->account_id specific functions * * These are the standard $this->account_id specific functions *
\**************************************************************************/ \**************************************************************************/
@ -255,10 +279,10 @@ class preferences
} }
switch($row['preference_owner']) switch($row['preference_owner'])
{ {
case -1: // forced case self::FORCED_ID:
$this->forced[$app] = $value; $this->forced[$app] = $value;
break; break;
case -2: // default case self::DEFAULT_ID:
$this->default[$app] = $value; $this->default[$app] = $value;
break; break;
default: // user default: // user
@ -555,11 +579,11 @@ class preferences
switch($type) switch($type)
{ {
case 'forced': case 'forced':
$account_id = -1; $account_id = self::FORCED_ID;
$prefs = &$this->forced; $prefs = &$this->forced;
break; break;
case 'default': case 'default':
$account_id = -2; $account_id = self::DEFAULT_ID;
$prefs = &$this->default; $prefs = &$this->default;
break; break;
default: default:

View File

@ -29,7 +29,7 @@
'type' => 'section', 'type' => 'section',
'title' => 'Preferences for the idots template set', 'title' => 'Preferences for the idots template set',
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
), ),
'show_general_menu' => array( 'show_general_menu' => array(
'type' => 'select', 'type' => 'select',
@ -38,7 +38,8 @@
'values' => $top_menu, 'values' => $top_menu,
'help' => 'Where and how will the egroupware links like preferences, about and logout be displayed.', 'help' => 'Where and how will the egroupware links like preferences, about and logout be displayed.',
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
'forced' => 'topmenu',
), ),
'start_and_logout_icons' => array( 'start_and_logout_icons' => array(
'type' => 'select', 'type' => 'select',
@ -47,17 +48,18 @@
'values' => $yes_no, 'values' => $yes_no,
'help' => 'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.', 'help' => 'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.',
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
'forced' => 'yes',
), ),
'max_icons' => array( 'max_icons' => array(
'type' => 'input', 'type' => 'input',
'label' => 'Max number of icons in navbar', 'label' => 'Max number of icons in navbar',
'name' => 'max_icons', 'name' => 'max_icons',
'help' => 'How many icons should be shown in the navbar (top of the page). Additional icons go into a kind of pulldown menu, callable by the icon on the far right side of the navbar.', 'help' => 'How many icons should be shown in the navbar (top of the page). Additional icons go into a kind of pulldown menu, callable by the icon on the far right side of the navbar.',
'default' => '',
'size' => 3, 'size' => 3,
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
'forced' => 12,
), ),
'auto_hide_sidebox' => array( 'auto_hide_sidebox' => array(
'type' => 'check', 'type' => 'check',
@ -65,7 +67,8 @@
'name' => 'auto_hide_sidebox', 'name' => 'auto_hide_sidebox',
'help' => 'Automatically hide the Sidebox menu\'s?', 'help' => 'Automatically hide the Sidebox menu\'s?',
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
'default' => true,
), ),
'click_or_onmouseover' => array( 'click_or_onmouseover' => array(
'type' => 'select', 'type' => 'select',
@ -74,7 +77,8 @@
'values' => $click_or_onmouseover, 'values' => $click_or_onmouseover,
'help' => 'Click or Mouse Over to show menus?', 'help' => 'Click or Mouse Over to show menus?',
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
'forced' => 'click',
), ),
'disable_slider_effects' => array( 'disable_slider_effects' => array(
'type' => 'check', 'type' => 'check',
@ -82,7 +86,8 @@
'name' => 'disable_slider_effects', 'name' => 'disable_slider_effects',
'help' => 'Disable the animated slider effects when showing or hiding menus in the page? Opera and Konqueror users will probably must want this.', 'help' => 'Disable the animated slider effects when showing or hiding menus in the page? Opera and Konqueror users will probably must want this.',
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
'forced' => false,
), ),
'disable_pngfix' => array( 'disable_pngfix' => array(
'type' => 'check', 'type' => 'check',
@ -90,7 +95,8 @@
'name' => 'disable_pngfix', 'name' => 'disable_pngfix',
'help' => 'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?', 'help' => 'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?',
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
'forced' => false,
), ),
'show_generation_time' => array( 'show_generation_time' => array(
'type' => 'check', 'type' => 'check',
@ -98,6 +104,7 @@
'name' => 'show_generation_time', 'name' => 'show_generation_time',
'help' => 'Show page generation time on the bottom of the page?', 'help' => 'Show page generation time on the bottom of the page?',
'xmlrpc' => False, 'xmlrpc' => False,
'admin' => False 'admin' => False,
'forced' => false,
) )
); );

View File

@ -0,0 +1,393 @@
<?php
/**
* EGroupware - Preferences hooks
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package preferences
* @version $Id$
*/
/**
* Static hooks for preferences class
*/
class preferences_hooks
{
/**
* Hook return common preferences settings
*
* @param string|array $hook_data
* @return array
*/
static public function settings($hook_data)
{
// Setup some values to fill the array of this app's settings below
$templates = common::list_templates();
foreach($templates as $var => $value)
{
$_templates[$var] = $templates[$var]['title'];
}
$themes = common::list_themes();
foreach($themes as $value)
{
$_themes[$value] = $value;
}
$navbar_format = array(
'icons' => lang('Icons only'),
'icons_and_text' => lang('Icons and text'),
'text' => lang('Text only')
);
$link_list_format = array(
'icons' => lang('Icons only'),
'icons_and_text' => lang('Icons and text'),
'text' => lang('Text only')
);
$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);
}
if (!$hook_data['setup'])
{
$langs = translation::get_installed_langs();
}
$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((array)$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'),
);
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(
'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,
'default' => 20,
),
'template_set' => array(
'type' => 'select',
'label' => 'Interface/Template Selection',
'name' => 'template_set',
'values' => $_templates,
'help' => 'A template defines the layout of eGroupWare and it contains icons for each application.',
'xmlrpc' => True,
'admin' => False,
'forced' => 'idots',
),
'theme' => array(
'type' => 'select',
'label' => 'Theme (colors/fonts) Selection',
'name' => 'theme',
'values' => $_themes,
'help' => 'A theme defines the colors and fonts used by the template.',
'xmlrpc' => True,
'admin' => False,
'forced' => 'idots',
),
'navbar_format' => array(
'type' => 'select',
'label' => 'Show navigation bar as',
'name' => 'navbar_format',
'values' => $navbar_format,
'help' => 'You can show the applications as icons only, icons with app-name or both.',
'xmlrpc' => True,
'admin' => False,
'default'=> 'icons_and_text',
),
'link_list_format' => array(
'type' => 'select',
'label' => 'Show links between eGroupWare aps as',
'name' => 'link_list_format',
'values' => $link_list_format,
'help' => 'You can show the linked entries with icons only, icons with app-name or both.',
'xmlrpc' => True,
'admin' => False,
'forced' => 'icons',
),
'link_list_thumbnail' => array(
'type' => 'select',
'label' => 'Display thumbnails for linked images',
'name' => 'link_list_thumbnail',
'values' => array(
'1' => lang('Yes'),
'0' => lang('No'),
),
'help' => 'Images linked to an entry can be displayed as thumbnails. You can turn this off to speed up page display.',
'xmlrpc' => True,
'admin' => False,
'forced' => '1',
),
'tz_offset' => array(
'type' => 'select',
'label' => 'Time zone offset',
'name' => 'tz_offset',
'values' => $tz_offset,
'help' => 'How many hours are you in front or after the timezone of the server.<br>If you are in the same time zone as the server select 0 hours, else select your locale date and time.',
'xmlrpc' => True,
'admin' => False,
'default'=> 0,
),
'dateformat' => array(
'type' => 'select',
'label' => 'Date format',
'name' => 'dateformat',
'values' => $date_formats,
'help' => 'How should eGroupWare display dates for you.',
'xmlrpc' => True,
'admin' => False,
'default'=> $lang == 'en' ? 'Y/m/d' : 'd.m.Y',
),
'timeformat' => array(
'type' => 'select',
'label' => 'Time format',
'name' => 'timeformat',
'values' => $time_formats,
'help' => 'Do you prefer a 24 hour time format, or a 12 hour one with am/pm attached.',
'xmlrpc' => True,
'admin' => False,
'default'=> 24,
),
'country' => array(
'type' => 'select',
'label' => 'Country',
'name' => 'country',
'values' => ExecMethod('phpgwapi.country.countries'),
'help' => 'In which country are you. This is used to set certain defaults for you.',
'xmlrpc' => True,
'admin' => False,
'default'=> strtoupper($country),
),
'lang' => array(
'type' => 'select',
'label' => 'Language',
'name' => 'lang',
'values' => $langs,
'help' => 'Select the language of texts and messages within eGroupWare.<br>Some languages may not contain all messages, in that case you will see an english message.',
'xmlrpc' => True,
'admin' => False,
'default'=> $lang,
),
'spellchecker_lang' => array(
'type' => 'select',
'label' => 'Spellchecker language',
'name' => 'spellchecker_lang',
'values' => $langs,
'help' => 'Select the language of the spellchecker integrated into the rich text editor.',
'xmlrpc' => True,
'admin' => False,
'default'=> $lang,
),
'rte_enter_mode' => array(
'type' => 'select',
'label' => 'Rich text editor enter mode',
'name' => 'rte_enter_mode',
'values' => $html_enter_mode,
'help' => 'Select how the rich text editor will generate the enter (linebreak) tag.',
'xmlrpc' => True,
'admin' => False,
'forced' => 'br',
),
'rte_skin' => array(
'type' => 'select',
'label' => 'Rich text editor theme',
'name' => 'rte_skin',
'values' => $rich_text_editor_skins,
'help' => 'Select the theme (visualization) of the rich text editor.',
'xmlrpc' => True,
'admin' => False,
'forced' => 'office2003',
),
'show_currentusers' => array(
'type' => 'check',
'label' => 'Show number of current users',
'name' => 'show_currentusers',
'help' => 'Should the number of active sessions be displayed for you all the time.',
'xmlrpc' => False,
'admin' => True,
'forced' => true,
),
'default_app' => array(
'type' => 'select',
'label' => 'Default application',
'name' => 'default_app',
'values' => $user_apps,
'help' => "The default application will be started when you enter eGroupWare or click on the homepage icon.<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,
'default'=> '',
),
'currency' => array(
'type' => 'input',
'label' => 'Currency',
'name' => 'currency',
'help' => 'Which currency symbol or name should be used in eGroupWare.',
'xmlrpc' => True,
'admin' => False,
'default'=> $lang == 'en' ? '$' : 'EUR',
),
'account_selection' => array(
'type' => 'select',
'label' => 'How do you like to select accounts',
'name' => 'account_selection',
'values' => $account_sels,
'help' => lang('The selectbox shows all available users (can be very slow on big installs with many users). The popup can search users by name or group.').' '.
lang('The two last options limit the visibility of other users. Therefore they should be forced and apply NOT to administrators.'),
'run_lang' => false,
'xmlrpc' => True,
'admin' => False,
'default'=> 'primary_group'
),
'account_display' => array(
'type' => 'select',
'label' => 'How do you like to display accounts',
'name' => 'account_display',
'values' => $account_display,
'help' => 'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.',
'xmlrpc' => True,
'admin' => False,
'default'=> 'lastname',
),
'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,
'default'=> True,
),
'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,
'forced' => true,
),
'csv_charset' => array(
'type' => 'select',
'label' => 'Charset for the CSV export',
'name' => 'csv_charset',
'values' => translation::get_installed_charsets(),
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
'xmlrpc' => True,
'admin' => false,
'default'=> 'iso-8859-1',
),
);
// disable thumbnails, if no size configured by admin
if (!$GLOBALS['egw_info']['server']['link_list_thumbnail']) unset($settings['link_list_thumbnail']);
return $settings;
}
/**
* Hook to return preferences menu items
*
* @param string|array $hook_data
*/
public static function preferences($hook_data)
{
if (!$GLOBALS['egw']->acl->check('nopasswordchange',1))
{
$file['Change your Password'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uipassword.change');
}
$file['common preferences'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=preferences');
display_section('preferences',$file);
}
/**
* Hook called when a user gets deleted, to delete his preferences
*
* @param string|array $hook_data
*/
public static function deleteaccount($hook_data)
{
if((int)$GLOBALS['hook_values']['account_id'] > 0)
{
$GLOBALS['egw']->preferences->delete_user($GLOBALS['hook_values']['account_id']);
}
}
}

View File

@ -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':

View File

@ -1,19 +0,0 @@
<?php
/**************************************************************************\
* eGroupWare *
* http://www.egroupware.org *
* Written by Mark Peters <skeeter@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
// Delete all prefs of a user
if((int)$GLOBALS['hook_values']['account_id'] > 0)
{
$GLOBALS['egw']->preferences->delete_user($GLOBALS['hook_values']['account_id']);
}

View File

@ -1,22 +1,12 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare * * Preferences - easing migration to new hooks
* http://www.egroupware.org * *
* Written by Joseph Engo <jengo@phpgroupware.org> * * @link http://www.egroupware.org
* -------------------------------------------- * * @package preferences
* 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 * * @version $Id$
* Free Software Foundation; either version 2 of the License, or (at your * */
* option) any later version. *
\**************************************************************************/
/* $Id$ */ ExecMethod('phpgwapi.hooks.register_all_hooks');
preferences_hooks::preferences(array('location' => 'preferences'));
if (!$GLOBALS['egw']->acl->check('nopasswordchange',1))
{
$file['Change your Password'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uipassword.change');
}
$file['common preferences'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=preferences');
display_section('preferences',$file);
?>

View File

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

View File

@ -17,11 +17,10 @@ $setup_info['preferences']['tables'] = '';
$setup_info['preferences']['enable'] = 2; $setup_info['preferences']['enable'] = 2;
/* The hooks this app includes, needed for hooks registration */ /* The hooks this app includes, needed for hooks registration */
$setup_info['preferences']['hooks'][] = 'deleteaccount'; $setup_info['preferences']['hooks']['deleteaccount'] = 'preferences_hooks::deleteaccount';
$setup_info['preferences']['hooks'][] = 'config'; $setup_info['preferences']['hooks']['preferences'] = 'preferences_hooks::preferences';
$setup_info['preferences']['hooks'][] = 'preferences'; $setup_info['preferences']['hooks']['settings'] = 'preferences_hooks::settings';
$setup_info['preferences']['hooks'][] = 'settings'; $setup_info['preferences']['hooks']['edit_user'] = 'preferences.uisettings.edit_user';
$setup_info['preferences']['hooks']['edit_user'] = 'preferences.uisettings.edit_user';
/* Dependencies for this app to work */ /* Dependencies for this app to work */
$setup_info['preferences']['depends'][] = array( $setup_info['preferences']['depends'][] = array(

View File

@ -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_offset' => 0,
'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')))
{ {

View File

@ -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
* *

View File

@ -370,6 +370,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';
@ -402,6 +403,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';
} }

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de> * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package timesheet * @package timesheet
* @copyright (c) 2005-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de> * @copyright (c) 2005-9 by Ralf Becker <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$
*/ */
@ -21,6 +21,13 @@ if (!defined('TIMESHEET_APP'))
*/ */
class timesheet_hooks class timesheet_hooks
{ {
/**
* Instance of timesheet_bo class
*
* @var timesheet_bo
*/
static $timesheet_bo;
/** /**
* Hook called by link-class to include timesheet in the appregistry of the linkage * Hook called by link-class to include timesheet in the appregistry of the linkage
* *
@ -101,6 +108,10 @@ class timesheet_hooks
'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), 'Grant Access' => egw::link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
'Edit Categories' => egw::link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True') 'Edit Categories' => egw::link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
); );
// until we have more then one preference
if (is_null(self::$timesheet_bo)) self::$timesheet_bo = new timesheet_bo();
if (!self::$timesheet_bo->status_labels) unset($file['Preferences']);
if ($location == 'preferences') if ($location == 'preferences')
{ {
display_section($appname,$file); display_section($appname,$file);
@ -138,39 +149,18 @@ class timesheet_hooks
*/ */
static function settings() static function settings()
{ {
self::check_set_default_prefs(); if (is_null(self::$timesheet_bo)) self::$timesheet_bo = new timesheet_bo();
return true; // otherwise prefs say it cant find the file ;-) return array(
} 'predefined_status' => array(
'type' => 'select',
/** 'label' => 'Status of created timesheets',
* Check if reasonable default preferences are set and set them if not 'name' => 'predefined_status',
* 'values' => self::$timesheet_bo->status_labels,
* It sets a flag in the app-session-data to be called only once per session 'help' => 'Select the predefined status, when creating a new timesheet ',
*/ 'xmlrpc' => True,
static function check_set_default_prefs() 'admin' => False,
{ ),
if ($GLOBALS['egw']->session->appsession('default_prefs_set',TIMESHEET_APP))
{
return;
}
$GLOBALS['egw']->session->appsession('default_prefs_set',TIMESHEET_APP,'set');
$default_prefs =& $GLOBALS['egw']->preferences->default[TIMESHEET_APP];
$defaults = array(
); );
foreach($defaults as $var => $default)
{
if (!isset($default_prefs[$var]) || $default_prefs[$var] === '')
{
$GLOBALS['egw']->preferences->add(TIMESHEET_APP,$var,$default,'default');
$need_save = True;
}
}
if ($need_save)
{
$GLOBALS['egw']->preferences->save_repository(False,'default');
}
} }
} }