Update of preferences app to work as a multi-tiered application and via xml-rpc

This commit is contained in:
Miles Lott 2005-07-23 09:44:46 +00:00
parent 5cbbbb7d29
commit 2c2bc0beb3
21 changed files with 1873 additions and 539 deletions

View File

@ -14,9 +14,9 @@
// Only Modify the $file and $title variables..... // Only Modify the $file and $title variables.....
$title = $appname; $title = $appname;
$file = array( $file = array(
'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname), 'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $appname),
'Grant Access' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
'Edit Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app='.$appname.'&cats_level=True&global_cats=True') 'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app='.$appname.'&cats_level=True&global_cats=True')
); );
//Do not modify below this line //Do not modify below this line
display_section($appname,$title,$file); display_section($appname,$title,$file);

View File

@ -20,7 +20,7 @@
{ {
$GLOBALS['egw']->jscalendar = CreateObject('phpgwapi.jscalendar'); $GLOBALS['egw']->jscalendar = CreateObject('phpgwapi.jscalendar');
} }
ExecMethod('calendar.bocal.check_set_default_prefs'); ExecMethod('calendar.bocalendar.check_set_default_prefs');
$default = array( $default = array(
'day' => lang('Daily'), 'day' => lang('Daily'),
@ -30,18 +30,11 @@
'planner_cat' => lang('Planner by category'), 'planner_cat' => lang('Planner by category'),
'planner_user' => lang('Planner by user'), 'planner_user' => lang('Planner by user'),
); );
create_select_box('default calendar view','defaultcalendar',$default,
'Which of calendar view do you want to see, when you start calendar ?');
/* Select list with number of day by week */ /* Select list with number of day by week */
$week_view = array( $week_view = array(
'5' => lang('Weekview without weekend'), '5' => lang('Weekview without weekend'),
'7' => lang('Weekview including weekend'), '7' => lang('Weekview including weekend'),
); );
create_select_box('default week view', 'days_in_weekview', $week_view, 'Do you want a weekview with or without weekend?');
/* Selection of list for home page is different from default calendar, /* Selection of list for home page is different from default calendar,
since the decision for the front page is different for the decision since the decision for the front page is different for the decision
for the main calendar page. But the list could be added to the for the main calendar page. But the list could be added to the
@ -51,9 +44,6 @@
'0' => lang('No'), '0' => lang('No'),
'2' => lang('No').' - '.lang('show list of upcoming events'), '2' => lang('No').' - '.lang('show list of upcoming events'),
); );
create_select_box('show default view on main screen','mainscreen_showevents',$mainpage,
'Displays your default calendar view on the startpage (page you get when you enter eGroupWare or click on the homepage icon)?');
unset($mainpage);
/* /*
$summary = array( $summary = array(
'no' => lang('Never'), 'no' => lang('Never'),
@ -71,17 +61,11 @@
'modifications' => lang('on all modification, but responses'), 'modifications' => lang('on all modification, but responses'),
'responses' => lang('on participant responses too') 'responses' => lang('on participant responses too')
); );
create_select_box('Receive email updates','receive_updates',$updates,
"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.");
$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')
); );
create_select_box('Format of event updates','update_format',$update_formats,
'Extended updates always include the complete event-details. iCal\'s can be imported by certain other calendar-applications.');
$event_details = array( $event_details = array(
'to-fullname' => lang('Fullname of person to notify'), 'to-fullname' => lang('Fullname of person to notify'),
'to-firstname'=> lang('Firstname of person to notify'), 'to-firstname'=> lang('Firstname of person to notify'),
@ -100,42 +84,17 @@
'action' => lang('Action that caused the notify: Added, Canceled, Accepted, Rejected, ...'), 'action' => lang('Action that caused the notify: Added, Canceled, Accepted, Rejected, ...'),
'link' => lang('Link to view the event'), 'link' => lang('Link to view the event'),
); );
create_notify('Notification messages for added events ','notifyAdded',5,50,
'This message is sent to every participant of events you own, who has requested notifcations about new events.<br>You can use certain variables which get substituted with the data of the event. The first line is the subject of the email.',
'',$event_details);
create_notify('Notification messages for canceled events ','notifyCanceled',5,50,
'This message is sent for canceled or deleted events.','',$event_details,False);
create_notify('Notification messages for modified events ','notifyModified',5,50,
'This message is sent for modified or moved events.','',$event_details,False);
create_notify('Notification messages for your responses ','notifyResponse',5,50,
'This message is sent when you accept, tentative accept or reject an event.',
'',$event_details,False);
create_notify('Notification messages for your alarms','notifyAlarm',5,50,
'This message is sent when you set an Alarm for a certain event. Include all information you might need.',
'',$event_details,False);
create_check_box('Show invitations you rejected','show_rejected',
'Should invitations you rejected still be shown in your calendar ?<br>You can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar!');
create_check_box('Display status of events','display_status',
'Should the status of the event-participants (accept, reject, ...) be shown in brakets after each participants name ?');
$weekdaystarts = array( $weekdaystarts = array(
'Monday' => lang('Monday'), 'Monday' => lang('Monday'),
'Sunday' => lang('Sunday'), 'Sunday' => lang('Sunday'),
'Saturday' => lang('Saturday') 'Saturday' => lang('Saturday')
); );
create_select_box('weekday starts on','weekdaystarts',$weekdaystarts,
'This day is shown as first day in the week or month view.');
for ($i=0; $i < 24; ++$i) for ($i=0; $i < 24; ++$i)
{ {
$options[$i] = $GLOBALS['egw']->common->formattime($i,'00'); $options[$i] = $GLOBALS['egw']->common->formattime($i,'00');
} }
create_select_box('work day starts on','workdaystarts',$options,
'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.');
create_select_box('work day ends on','workdayends',$options,
'This defines the end of your dayview. Events after this time, are shown below the dayview.');
$intervals = array( $intervals = array(
5 => '5', 5 => '5',
10 => '10', 10 => '10',
@ -145,11 +104,6 @@
45 => '45', 45 => '45',
60 => '60' 60 => '60'
); );
create_select_box('Intervals in day view','interval',$intervals,
'Defines the size in minutes of the lines in the day view.');
create_input_box('default appointment length (in minutes)','defaultlength',
'Default length of newly created events. The length is in minutes, eg. 60 for 1 hour.','',3);
$groups = $GLOBALS['egw']->accounts->membership($GLOBALS['egw_info']['user']['account_id']); $groups = $GLOBALS['egw']->accounts->membership($GLOBALS['egw_info']['user']['account_id']);
$options = array(-1 => lang('none')); $options = array(-1 => lang('none'));
if (is_array($groups)) if (is_array($groups))
@ -159,18 +113,12 @@
$options[$group['account_id']] = $GLOBALS['egw']->common->grab_owner_name($group['account_id']); $options[$group['account_id']] = $GLOBALS['egw']->common->grab_owner_name($group['account_id']);
} }
} }
create_select_box('Preselected group for entering the planner','planner_start_with_group',$options,
'This group that is preselected when you enter the planner. You can change it in the planner anytime you want.');
$planner_intervals = array( $planner_intervals = array(
1 => '1', 1 => '1',
2 => '2', 2 => '2',
3 => '3', 3 => '3',
4 => '4', 4 => '4',
); );
create_select_box('Intervals per day in planner view','planner_intervals_per_day',
$planner_intervals,'Specifies the the number of intervals shown in the planner view.');
$defaultfilter = array( $defaultfilter = array(
'all' => lang('all'), 'all' => lang('all'),
'private' => lang('private only'), 'private' => lang('private only'),
@ -180,26 +128,252 @@
// 'private+group' => lang('private and group public'), // 'private+group' => lang('private and group public'),
// 'public+group' => lang('global public and group public') // 'public+group' => lang('global public and group public')
); );
create_select_box('Default calendar filter','defaultfilter',$defaultfilter,
'Which events do you want to see when you enter the calendar.');
create_check_box('Set new events to private','default_private',
'Should new events created as private by default ?');
/* not used at the moment
create_check_box('Print the mini calendars','display_minicals',
'Should the mini calendars by printed / displayed in the printer friendly views ?');
create_check_box('Print calendars in black & white','print_black_white',
'Should the printer friendly view be in black & white or in color (as in normal view)?');
*/
$freebusy_url = $GLOBALS['egw_info']['server']['webserver_url'].'/calendar/freebusy.php?user='.$GLOBALS['egw_info']['user']['account_lid'].'&password='.$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']; $freebusy_url = $GLOBALS['egw_info']['server']['webserver_url'].'/calendar/freebusy.php?user='.$GLOBALS['egw_info']['user']['account_lid'].'&password='.$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw'];
if ($freebusy_url[0] == '/') if ($freebusy_url[0] == '/')
{ {
$freebusy_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$freebusy_url; $freebusy_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$freebusy_url;
} }
$freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is %1.','<a href="'.$freebusy_url.'" target="_blank">'.$freebusy_url.'</a>'); $freebusy_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>');
create_check_box('Make freebusy information available to not loged in persons?','freebusy',
$freebusy_help,'',False); $GLOBALS['settings'] = array(
create_input_box('Password for not loged in users to your freebusy information?','freebusy_pw', 'defaultcalendar' => array(
'If you dont set a password here, the information is available to everyone, who knows the URL!!!'); 'type' => 'select',
'label' => 'default calendar view',
'name' => 'defaultcalendar',
'values' => $default,
'help' => 'Which of calendar view do you want to see, when you start calendar ?',
'xmlrpc' => True,
'admin' => False
),
'days_in_weekview' => array(
'type' => 'select',
'label' => 'default week view',
'name' => 'days_in_weekview',
'values' => $week_view,
'help' => 'Do you want a weekview with or without weekend?',
'xmlrpc' => True,
'admin' => False
),
'mainscreen_showevents' => array(
'type' => 'select',
'label' => 'show default view on main screen',
'name' => 'mainscreen_showevents',
'values' => $mainpage,
'help' => 'Displays your default calendar view on the startpage (page you get when you enter eGroupWare or click on the homepage icon)?',
'xmlrpc' => True,
'admin' => False
),
'receive_updates' => array(
'type' => 'select',
'label' => 'Receive email updates',
'name' => 'receive_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.",
'xmlrpc' => True,
'admin' => False
),
'update_format' => array(
'type' => 'select',
'label' => 'Format of event updates',
'name' => 'update_format',
'values' => $update_formats,
'help' => 'Extended updates always include the complete event-details. iCal\'s can be imported by certain other calendar-applications.',
'xmlrpc' => True,
'admin' => False
),
'notifyAdded' => array(
'type' => 'notify',
'label' => 'Notification messages for added events ',
'name' => 'notifyAdded',
'rows' => 5,
'cols' => 50,
'help' => 'This message is sent to every participant of events you own, who has requested notifcations about new events.<br>You can use certain variables which get substituted with the data of the event. The first line is the subject of the email.',
'default' => '',
'values' => $event_details,
'xmlrpc' => True,
'admin' => False
),
'notifyCanceled' => array(
'type' => 'notify',
'label' => 'Notification messages for canceled events ',
'name' => 'notifyCanceled',
'rows' => 5,
'cols' => 50,
'help' => 'This message is sent for canceled or deleted events.',
'default' => '',
'values' => $event_details,
'subst_help' => False,
'xmlrpc' => True,
'admin' => False
),
'notifyModified' => array(
'type' => 'notify',
'Notification messages for modified events ',
'notifyModified',
'rows' => 5,
'cols' => 50,
'help' => 'This message is sent for modified or moved events.',
'default' => '',
'values' => $event_details,
'subst_help' => False,
'xmlrpc' => True,
'admin' => False
),
'notifyResponse' => array(
'type' => 'notify',
'label' => 'Notification messages for your responses ',
'name' => 'notifyResponse',
'rows' => 5,
'cols' => 50,
'help' => 'This message is sent when you accept, tentative accept or reject an event.',
'default' => '',
'values' => $event_details,
'subst_help' => False,
'xmlrpc' => True,
'admin' => False
),
'notifyAlarm' => array(
'type' => 'notify',
'label' => 'Notification messages for your alarms',
'name' => 'notifyAlarm',
'rows' => 5,
'cols' => 50,
'help' => 'This message is sent when you set an Alarm for a certain event. Include all information you might need.',
'default' => '',
'values' => $event_details,
'subst_help' => False,
'xmlrpc' => True,
'admin' => False
),
'show_rejected' => array(
'type' => 'check',
'label' => 'Show invitations you rejected',
'name' => 'show_rejected',
'help' => 'Should invitations you rejected still be shown in your calendar ?<br>You can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar!'
),
'display_status' => array(
'type' => 'check',
'label' => 'Display status of events',
'name' => 'display_status',
'help' => 'Should the status of the event-participants (accept, reject, ...) be shown in brakets after each participants name ?',
'xmlrpc' => True,
'admin' => False
),
'weekdaystarts' => array(
'type' => 'select',
'label' => 'weekday starts on',
'name' => 'weekdaystarts',
'values' => $weekdaystarts,
'help' => 'This day is shown as first day in the week or month view.',
'xmlrpc' => True,
'admin' => False
),
'workdaystarts' => array(
'type' => 'select',
'label' => 'work day starts on',
'name' => 'workdaystarts',
'values' => $options,
'help' => 'This defines the start of your dayview. Events before this time, are shown above the dayview.<br>This time is also used as a default starttime for new events.',
'xmlrpc' => True,
'admin' => False
),
'workdayends' => array(
'type' => 'select',
'label' => 'work day ends on',
'name' => 'workdayends',
'values' => $options,
'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.',
'xmlrpc' => True,
'admin' => False
),
'interval' => array(
'type' => 'select',
'label' => 'Intervals in day view',
'name' => 'interval',
'values' => $intervals,
'help' => 'Defines the size in minutes of the lines in the day view.',
'xmlrpc' => True,
'admin' => False
),
'defaultlength' => array(
'type' => 'input',
'label' => 'default appointment length (in minutes)',
'name' => 'defaultlength',
'help' => 'Default length of newly created events. The length is in minutes, eg. 60 for 1 hour.',
'default' => '',
'size' => 3,
'xmlrpc' => True,
'admin' => False
),
'planner_start_with_group' => array(
'type' => 'select',
'label' => 'Preselected group for entering the planner',
'name' => 'planner_start_with_group',
'values' => $options,
'help' => 'This group that is preselected when you enter the planner. You can change it in the planner anytime you want.',
'xmlrpc' => True,
'admin' => False
),
'planner_intervals_per_day' => array(
'type' => 'select',
'label' => 'Intervals per day in planner view',
'name' => 'planner_intervals_per_day',
'values' => $planner_intervals,
'help' => 'Specifies the the number of intervals shown in the planner view.',
'xmlrpc' => True,
'admin' => False
),
'defaultfilter' => array(
'type' => 'select',
'label' => 'Default calendar filter',
'name' => 'defaultfilter',
'values' => $defaultfilter,
'help' => 'Which events do you want to see when you enter the calendar.',
'xmlrpc' => True,
'admin' => False
),
'default_private' => array(
'type' => 'check',
'label' => 'Set new events to private',
'name' => 'default_private',
'help' => 'Should new events created as private by default ?',
'xmlrpc' => True,
'admin' => False
),
/* not used at the moment
'display_minicals' => array(
'type' => 'check',
'label' => 'Print the mini calendars',
'name' => 'display_minicals',
'help' => 'Should the mini calendars by printed / displayed in the printer friendly views ?',
'xmlrpc' => True,
'admin' => False
),
'print_black_white' => array(
'type' => 'check',
'label' => 'Print calendars in black & white',
'name' => 'print_black_white',
'help' => 'Should the printer friendly view be in black & white or in color (as in normal view)?',
'xmlrpc' => True,
'admin' => False
),
*/
'freebusy' => array(
'type' => 'select',
'label' => 'Make freebusy information available to not loged in persons?',
'name' => 'freebusy',
'help' => $freebusy_help,
'default' => '',
'subst_help' => False,
'xmlrpc' => True,
'admin' => False
),
'freebusy_pw' => array(
'type' => 'input',
'label' => 'Password for not loged in users to your freebusy information?',
'name' => 'freebusy_pw',
'help' => 'If you dont set a password here, the information is available to everyone, who knows the URL!!!',
'xmlrpc' => True,
'admin' => False
)
);

View File

@ -15,8 +15,7 @@
// Only Modify the $file and $title variables..... // Only Modify the $file and $title variables.....
$title = $appname; $title = $appname;
$file = Array( $file = Array(
// 'Preferences Old' => $GLOBALS['phpgw']->link('/filemanager/preferences.php'), 'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $appname)
'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname)
); );
//Do not modify below this line //Do not modify below this line
display_section($appname,$title,$file); display_section($appname,$title,$file);

View File

@ -10,6 +10,8 @@
* option) * * option) *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */
//ExecMethod('filemanager.bofilemanager.check_set_default_prefs'); //ExecMethod('filemanager.bofilemanager.check_set_default_prefs');
/*create_section('TESTING'); /*create_section('TESTING');
@ -17,7 +19,15 @@
create_check_box('Use new experimental Filemanager?','experimental_new_code','The future filemanager, now for TESTING PURPOSES ONLY, please send bugreports'); create_check_box('Use new experimental Filemanager?','experimental_new_code','The future filemanager, now for TESTING PURPOSES ONLY, please send bugreports');
*/ */
create_section('Display attributes'); settype($GLOBALS['settings'],'array');
$GLOBALS['settings']['display_attrs'] = array(
'type' => 'section',
'title' => 'Display attributes',
'name' => 'display_attrs',
'xmlrpc' => True,
'admin' => False
);
$file_attributes = Array( $file_attributes = Array(
'name' => 'File Name', 'name' => 'File Name',
@ -34,12 +44,24 @@
'version' => 'Version' 'version' => 'Version'
); );
while (list ($key, $value) = each ($file_attributes)) foreach($file_attributes as $key => $value)
{ {
create_check_box($value,$key); $GLOBALS['settings'][$key] = array(
'type' => 'check',
'label' => "$value",
'name' => $key,
'xmlrpc' => True,
'admin' => False
);
} }
create_section('Other settings'); $GLOBALS['settings']['other_settings'] = array(
'type' => 'section',
'title' => 'Other settings',
'name' => 'other_settings',
'xmlrpc' => True,
'admin' => False
);
$other_checkboxes = array ( $other_checkboxes = array (
"viewinnewwin" => "View documents in new window", "viewinnewwin" => "View documents in new window",
@ -49,17 +71,29 @@
"dotfiles" => "Show .files", "dotfiles" => "Show .files",
); );
while (list ($key, $value) = each ($other_checkboxes)) foreach($other_checkboxes as $key => $value)
{ {
create_check_box($value,$key); $GLOBALS['settings'][$key] = array(
'type' => 'check',
'label' => "$value",
'name' => $key,
'xmlrpc' => True,
'admin' => False
);
} }
$upload_boxes = array( $upload_boxes = array(
"1"=>"1", '1' => '1',
"5"=>"5", '5' => '5',
"10"=>"10", '10' => '10',
"20"=>"20", '20' => '20',
"30"=>"30" '30' => '30'
); );
create_select_box('Default number of upload fields to show','show_upload_boxes',$upload_boxes); $GLOBALS['settings']['show_upload_boxes'] = array(
'label' => 'Default number of upload fields to show',
'name' => 'show_upload_boxes',
'values' => $upload_boxes,
'xmlrpc' => True,
'admin' => False
);

View File

@ -25,9 +25,12 @@
$menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); $menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
$file = Array( $file = Array(
array('','text'=>'Filemanager Preferences','link'=>$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=filemanager')), array(
'',
'text' => 'Filemanager Preferences',
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=filemanager')
)
); );
display_sidebox($appname,$menu_title,$file); display_sidebox($appname,$menu_title,$file);
} }
?> ?>

View File

@ -9,8 +9,7 @@
* Free Software Foundation; version 2 of the License. * * Free Software Foundation; version 2 of the License. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */
create_section('Home');
$prev_img = Array( $prev_img = Array(
'no' => lang('Never'), 'no' => lang('Never'),
@ -18,20 +17,34 @@
'yes' => lang('Yes') 'yes' => lang('Yes')
); );
create_select_box('Preview thumbs or images in form','prev_img',$prev_img,"When you choose 'Never', only links to the images are displayed; when you choose 'Only if thumnails exists' previews are shown if an thumbnail of the image exists; if you choose 'Yes' all images are shown");
$max_prev=array( $max_prev=array(
"1"=>"1", '1' => '1',
"2"=>"2", '2' => '2',
"3"=>"3", '3' => '3',
"4"=>"4", '4' => '4',
"5"=>"5", '5' => '5',
"10"=>"10", '10' => '10',
"20"=>"20", '20' => '20',
"30"=>"30", '30' => '30',
"-1"=>lang("No max. number") '-1' => lang('No max. number')
); );
/* Settings array for this app */
$GLOBALS['settings'] = array(
'prefssection' => array(
'type' => 'section',
'title' => 'Home',
'xmlrpc' => False,
'admin' => False
),
'prev_img' => array(
'type' => 'select',
'label' => 'Preview thumbs or images in form',
'name' => 'prev_img',
'values' => $prev_img,
'help' => "When you choose 'Never', only links to the images are displayed; when you choose 'Only if thumnails exists' previews are shown if an thumbnail of the image exists; if you choose 'Yes' all images are shown",
'xmlrpc' => False,
'admin' => False
)
);
?> ?>

View File

@ -41,7 +41,7 @@ class admin_prefs_sidebox_hooks
if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin') if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
{ {
$file = array( $file = array(
'Preferences' => $GLOBALS['egw']->link('/preferences/preferences.php','appname='.$appname), 'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname),
'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True') 'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
); );

View File

@ -12,43 +12,86 @@
/* $Id$ */ /* $Id$ */
/* Setup some values to fill the array of this app's settings below */
$show_entries = array( $show_entries = array(
0 => lang('No'), 0 => lang('No'),
1 => lang('Yes'), 1 => lang('Yes'),
2 => lang('Yes').' - '.lang('show list of upcoming entries'), 2 => lang('Yes').' - '.lang('show list of upcoming entries'),
); );
create_select_box('Show open entries: Tasks/Calls/Notes on main screen','homeShowEvents',$show_entries,
'Should InfoLog display your open entries - not finished tasks, phonecalls or notes - on the main screen. Works only if you dont selected an application for the main screen (in your preferences).');
unset($show_entries); unset($show_entries);
create_input_box('Max number of entries to display on the main screen','mainscreen_maxshow',
'Only up to this number of entries are displayed on the main screen.','10',3);
$ui =& CreateObject('infolog.uiinfolog'); // need some labels from $ui =& CreateObject('infolog.uiinfolog'); // need some labels from
foreach($ui->filters as $key => $label) foreach($ui->filters as $key => $label)
{ {
$filters[$key] = lang($label); $filters[$key] = lang($label);
} }
unset($ui); unset($ui);
create_select_box('Default Filter for InfoLog','defaultFilter',$filters,
'This is the filter InfoLog uses when you enter the application. Filters limit the entries to show in the actual view. There are filters to show only finished, still open or futures entries of yourself or all users.');
unset($filters);
create_check_box('List no Subs/Childs','listNoSubs',
'Should InfoLog show Subtasks, -calls or -notes in the normal view or not. You can always view the Subs via there parent.');
/*
create_check_box('Show full usernames','longNames',
'Should InfoLog use full names (surname and familyname) or just the loginnames.');
*/
$show_links = array( $show_links = array(
'all' => lang('all links and attachments'), 'all' => lang('all links and attachments'),
'links' => lang('only the links'), 'links' => lang('only the links'),
'attach' => lang('only the attachments'), 'attach' => lang('only the attachments'),
'none' => lang('no links or attachments'), 'none' => lang('no links or attachments')
'no_describtion' => lang('no describtion, links or attachments'),
); );
create_select_box('Show in the InfoLog list','show_links',$show_links,
'Should InfoLog show the links to other applications and/or the file-attachments in the InfoLog list (normal view when u enter InfoLog).');
unset($show_links);
create_check_box('Never hide search and filters','never_hide','If not set, the line with search and filters is hidden for less entries then "max matches per page" (as defined in your common preferences).'); /* Settings array for this app */
$GLOBALS['settings'] = array(
'homeShowEvents' => array(
'type' => 'select',
'label' => 'Show open entries: Tasks/Calls/Notes on main screen',
'name' => 'homeShowEvents',
'values' => $show_entries,
'help' => 'Should InfoLog display your open entries - not finished tasks, phonecalls or notes - on the main screen. Works only if you dont selected an application for the main screen (in your preferences).',
'xmlrpc' => True,
'admin' => False
),
'mainscreen_maxshow' => array(
'type' => 'input',
'label' => 'Max number of entries to display on the main screen',
'name' => 'mainscreen_maxshow',
'size' => 3,
'maxsize' => 10,
'help' => 'Only up to this number of entries are displayed on the main screen.',
'xmlrpc' => True,
'admin' => False
),
'defaultFilter' => array(
'type' => 'select',
'label' => 'Default Filter for InfoLog',
'name' => 'defaultFilter',
'values' => $filters,
'help' => 'This is the filter InfoLog uses when you enter the application. Filters limit the entries to show in the actual view. There are filters to show only finished, still open or futures entries of yourself or all users.',
'xmlrpc' => True,
'admin' => False
),
'listNoSubs' => array(
'type' => 'check',
'label' => 'List no Subs/Childs',
'name' => 'listNoSubs',
'help' => 'Should InfoLog show Subtasks, -calls or -notes in the normal view or not. You can always view the Subs via there parent.',
'xmlrpc' => True,
'admin' => False
),
/* 'longNames' => array(
'type' => 'check',
'label' => 'Show full usernames',
'name' => 'longNames',
'help' => 'Should InfoLog use full names (surname and familyname) or just the loginnames.',
'xmlrpc' => True,
'admin' => False
),
*/
'show_links' => array(
'type' => 'select',
'label' => 'Show in the InfoLog list',
'name' => 'show_links',
'values' => $show_links,
'help' => 'Should InfoLog show the links to other applications and/or the file-attachments in the InfoLog list (normal view when u enter Inf
oLog).',
'xmlrpc' => True,
'admin' => False
)
);
unset($show_entries);
unset($filters);
unset($show_links);

View File

@ -10,58 +10,63 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
create_section('Preferences for the idots template set');
$start_and_logout_icons = array( $start_and_logout_icons = array(
'yes' => lang('yes'), 'yes' => lang('yes'),
'no' => lang('no') 'no' => lang('no')
); );
create_select_box(
'Show home and logout button in main application bar?',
'start_and_logout_icons',
$start_and_logout_icons,
'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.'
);
create_input_box(
'Max number of icons in navbar',
'max_icons',
'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.','',3
);
create_check_box(
'Autohide Sidebox menu\'s',
'auto_hide_sidebox',
'Automatically hide the Sidebox menu\'s?'
);
$click_or_onmouseover = array( $click_or_onmouseover = array(
'click' => lang('Click'), 'click' => lang('Click'),
'onmouseover' => lang('On Mouse Over') 'onmouseover' => lang('On Mouse Over')
); );
create_select_box( $GLOBALS['settings'] = array(
'Click or Mouse Over to show menus', 'templ' => array(
'click_or_onmouseover', 'type' => 'section',
$click_or_onmouseover, 'title' => 'Preferences for the idots template set'
'Click or Mouse Over to show menus?' ),
); 'start_and_logout_icons' => array(
'type' => 'select',
create_check_box( 'label' => 'Show home and logout button in main application bar?',
'Disable slider effects', 'name' => 'start_and_logout_icons',
'disable_slider_effects', 'values' => $start_and_logout_icons,
'Disable the animated slider effects when showing or hiding menus in the page? Opera and Konqueror users will probably must want this.' 'help' => 'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.'
); ),
'max_icons' => array(
create_check_box( 'type' => 'input',
'Disable Internet Explorer png-image-bugfix', 'label' => 'Max number of icons in navbar',
'disable_pngfix', 'name' => 'max_icons',
'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?' '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.','',3
); ),
'auto_hide_sidebox' => array(
create_check_box( 'type' => 'check',
'Show page generation time', 'label' => 'Autohide Sidebox menu\'s',
'show_generation_time', 'name' => 'auto_hide_sidebox',
'Show page generation time on the bottom of the page?' 'help' => 'Automatically hide the Sidebox menu\'s?'
),
'click_or_onmouseover' => array(
'type' => 'select',
'label' => 'Click or Mouse Over to show menus',
'name' => 'click_or_onmouseover',
'values' => $click_or_onmouseover,
'help' => 'Click or Mouse Over to show menus?'
),
'disable_slider_effects' => array(
'type' => 'check',
'label' => '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.'
),
'disable_pngfix' => array(
'type' => 'check',
'label' => 'Disable Internet Explorer png-image-bugfix',
'name' => 'disable_pngfix',
'help' => 'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?'
),
'show_generation_time' => array(
'type' => 'check',
'label' => 'Show page generation time',
'name' => 'show_generation_time',
'help' => 'Show page generation time on the bottom of the page?'
)
); );

View File

@ -10,58 +10,81 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
create_section('Preferences for the idots template set');
$start_and_logout_icons = array( $start_and_logout_icons = array(
'yes' => lang('yes'), 'yes' => lang('yes'),
'no' => lang('no') 'no' => lang('no')
); );
create_select_box(
'Show home and logout button in main application bar?',
'start_and_logout_icons',
$start_and_logout_icons,
'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.'
);
create_input_box(
'Max number of icons in navbar',
'max_icons',
'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.','',3
);
create_check_box(
'Autohide Sidebox menu\'s',
'auto_hide_sidebox',
'Automatically hide the Sidebox menu\'s?'
);
$click_or_onmouseover = array( $click_or_onmouseover = array(
'click' => lang('Click'), 'click' => lang('Click'),
'onmouseover' => lang('On Mouse Over') 'onmouseover' => lang('On Mouse Over')
); );
create_select_box( $GLOBALS['settings'] = array(
'Click or Mouse Over to show menus', 'prefssection' => array(
'click_or_onmouseover', 'type' => 'section',
$click_or_onmouseover, 'title' => 'Preferences for the idots template set',
'Click or Mouse Over to show menus?' 'xmlrpc' => False,
); 'admin' => False
),
create_check_box( 'start_and_logout_icons' => array(
'Disable slider effects', 'type' => 'select',
'disable_slider_effects', 'label' => 'Show home and logout button in main application bar?',
'Disable the animated slider effects when showing or hiding menus in the page? Opera and Konqueror users will probably must want this.' 'name' => 'start_and_logout_icons',
); 'values' => $start_and_logout_icons,
'help' => 'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.',
create_check_box( 'xmlrpc' => False,
'Disable Internet Explorer png-image-bugfix', 'admin' => False
'disable_pngfix', ),
'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?' 'max_icons' => array(
); 'type' => 'input',
'label' => 'Max number of icons in navbar',
create_check_box( 'name' => 'max_icons',
'Show page generation time', '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.',
'show_generation_time', 'default' => '',
'Show page generation time on the bottom of the page?' 'size' => 3,
'xmlrpc' => False,
'admin' => False
),
'auto_hide_sidebox' => array(
'type' => 'check',
'label' => 'Autohide Sidebox menu\'s',
'name' => 'auto_hide_sidebox',
'help' => 'Automatically hide the Sidebox menu\'s?',
'xmlrpc' => False,
'admin' => False
),
'click_or_onmouseover' => array(
'type' => 'select',
'label' => 'Click or Mouse Over to show menus',
'name' => 'click_or_onmouseover',
'values' => $click_or_onmouseover,
'help' => 'Click or Mouse Over to show menus?',
'xmlrpc' => False,
'admin' => False
),
'disable_slider_effects' => array(
'type' => 'check',
'label' => '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.',
'xmlrpc' => False,
'admin' => False
),
'disable_pngfix' => array(
'type' => 'check',
'label' => 'Disable Internet Explorer png-image-bugfix',
'name' => 'disable_pngfix',
'help' => 'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?',
'xmlrpc' => False,
'admin' => False
),
'show_generation_time' => array(
'type' => 'check',
'label' => 'Show page generation time',
'name' => 'show_generation_time',
'help' => 'Show page generation time on the bottom of the page?',
'xmlrpc' => False,
'admin' => False
)
); );

View File

@ -10,33 +10,18 @@
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */
create_section('Preferences for the idots2 template set');
$clock_show = array( $clock_show = array(
'yes' => lang('yes'), 'yes' => lang('yes'),
'no' => lang('no') 'no' => lang('no')
); );
create_select_box(
'Show clock?',
'clock_show',
$clock_show,
'Would you like to display a clock on the right corner in the taskbar?'
);
$clock_min = array( $clock_min = array(
'minute' => lang('minute'), 'minute' => lang('minute'),
'second' => lang('second') 'second' => lang('second')
); );
create_select_box(
'Update the clock per minute or per second',
'clock_min',
$clock_min,
'If the clock is enabled would you like it to update it every second or every minute?'
);
$files = Array(); $files = Array();
$dir = '../phpgwapi/templates/idots2/images/backgrounds'; $dir = '../phpgwapi/templates/idots2/images/backgrounds';
@ -51,27 +36,57 @@
} }
closedir($dh); closedir($dh);
create_select_box(
'Choose a background image.',
'files',
$files,
'If there are some images in the background folder you can choose the one you would like to see.'
);
$bckStyle = array( $bckStyle = array(
'centered' => lang('centered'), 'centered' => lang('centered'),
'tiled' => lang('tiled'), 'tiled' => lang('tiled'),
'stretched' => lang('stretched') 'stretched' => lang('stretched')
); );
create_select_box( $showLogo = array(
'yes' => lang('yes'),
'no' => lang('no')
);
$back_icons = array(
'yes' => lang('yes'),
'no' => lang('no')
);
$GLOBALS['settings'] = array(
'templ' => array(
'type' => 'section',
'Preferences for the idots2 template set'
),
'clock_show' => array(
'type' => 'select',
'Show clock?',
'clock_show',
$clock_show,
'Would you like to display a clock on the right corner in the taskbar?'
),
'clock_min' => array(
'type' => 'select',
'Update the clock per minute or per second',
'clock_min',
$clock_min,
'If the clock is enabled would you like it to update it every second or every minute?'
),
'files' => array(
'type' => 'select',
'Choose a background image.',
'files',
$files,
'If there are some images in the background folder you can choose the one you would like to see.'
),
'bckStyle' => array(
'type' => 'select',
'Choose a background style.', 'Choose a background style.',
'bckStyle', 'bckStyle',
$bckStyle, $bckStyle,
'What style would you like the image to have?' 'What style would you like the image to have?'
); ),
'bgcolor' => array(
create_input_box( 'type' => 'input',
'Choose a background color', 'Choose a background color',
'bgcolor', 'bgcolor',
'What color should all the blank space on the desktop have', 'What color should all the blank space on the desktop have',
@ -80,20 +95,16 @@
7, 7,
'', '',
false false
); ),
'showLogo' => array(
$showLogo = array( 'type' => 'select',
'yes' => lang('yes'),
'no' => lang('no')
);
create_select_box(
'Show logo\'s on the desktop.', 'Show logo\'s on the desktop.',
'showLogo', 'showLogo',
$showLogo, $showLogo,
'Show the logo\'s of eGroupware and x-desktop on the desktop.' 'Show the logo\'s of eGroupware and x-desktop on the desktop.'
); ),
create_input_box( 'bgcolor_icons' => array(
'type' => 'input',
'Choose a background color for the icons', 'Choose a background color for the icons',
'bgcolor_icons', 'bgcolor_icons',
'', '',
@ -102,20 +113,16 @@
7, 7,
'', '',
false false
); ),
'back_icons' => array(
$back_icons = array( 'type' => 'select',
'yes' => lang('yes'),
'no' => lang('no')
);
create_select_box(
'Transparant bg for the icons?', 'Transparant bg for the icons?',
'back_icons', 'back_icons',
$back_icons, $back_icons,
'' ''
); ),
create_input_box( 'textcolor_icons' => array(
'type' => 'input',
'Choose a text color for the icons', 'Choose a text color for the icons',
'textcolor_icons', 'textcolor_icons',
'', '',
@ -124,15 +131,15 @@
7, 7,
'', '',
false false
); ),
'show_generation_time' => array(
create_check_box( 'type' => 'check',
'Show page generation time?', 'Show page generation time?',
'show_generation_time', 'show_generation_time',
'Would you like to display the page generation time at the bottom of every window?' 'Would you like to display the page generation time at the bottom of every window?'
); ),
'scrWidth' => array(
create_input_box( 'type' => 'input',
'Default width for the windows', 'Default width for the windows',
'scrWidth', 'scrWidth',
'Select the default width for the application windows', 'Select the default width for the application windows',
@ -141,9 +148,9 @@
'', '',
'', '',
false false
); ),
'scrHeight' => array(
create_input_box( 'type' => 'input',
'Default height for the windows', 'Default height for the windows',
'scrHeight', 'scrHeight',
'Select the default height for the application windows', 'Select the default height for the application windows',
@ -152,6 +159,5 @@
'', '',
'', '',
false false
)
); );

View File

@ -10,7 +10,13 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
create_section('Preferences for the idots template set');
$click_or_onmouseover = array(
'click' => lang('Click'),
'onmouseover' => lang('On Mouse Over')
);
create_section('Preferences for the jerryr template set');
create_input_box( create_input_box(
'Max number of icons in navbar', 'Max number of icons in navbar',
@ -24,11 +30,6 @@
'Automatically hide the Sidebox menu\'s?' 'Automatically hide the Sidebox menu\'s?'
); );
$click_or_onmouseover = array(
'click' => lang('Click'),
'onmouseover' => lang('On Mouse Over')
);
create_select_box( create_select_box(
'Click or Mouse Over to show menus', 'Click or Mouse Over to show menus',
'click_or_onmouseover', 'click_or_onmouseover',

View File

@ -10,58 +10,63 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
create_section('Preferences for the idots template set');
$start_and_logout_icons = array( $start_and_logout_icons = array(
'yes' => lang('yes'), 'yes' => lang('yes'),
'no' => lang('no') 'no' => lang('no')
); );
create_select_box(
'Show home and logout button in main application bar?',
'start_and_logout_icons',
$start_and_logout_icons,
'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.'
);
create_input_box(
'Max number of icons in navbar',
'max_icons',
'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.','',3
);
create_check_box(
'Autohide Sidebox menu\'s',
'auto_hide_sidebox',
'Automatically hide the Sidebox menu\'s?'
);
$click_or_onmouseover = array( $click_or_onmouseover = array(
'click' => lang('Click'), 'click' => lang('Click'),
'onmouseover' => lang('On Mouse Over') 'onmouseover' => lang('On Mouse Over')
); );
create_select_box( $GLOBALS['settings'] = array(
'Click or Mouse Over to show menus', 'prismapref' => array(
'click_or_onmouseover', 'type' => 'section',
'title' => 'Preferences for the idots template set'
),
'start_and_logout_icons' => array(
'type' => 'select',
'label' => 'Show home and logout button in main application bar?',
'name' => 'start_and_logout_icons',
'values' => $start_and_logout_icons,
'help' => 'When you say yes the home and logout buttons are presented as applications in the main top applcation bar.'
),
'max_icons' => array(
'type' => 'input',
'label' => 'Max number of icons in navbar',
'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.','',3
),
'auto_hide_sidebox' => array(
'type' => 'check',
'label' => 'Autohide Sidebox menu\'s',
'name' => 'auto_hide_sidebox',
'help' => 'Automatically hide the Sidebox menu\'s?'
),
'click_or_onmouseover' => array(
'type' => 'select',
'label' => 'Click or Mouse Over to show menus',
'name' => 'click_or_onmouseover',
$click_or_onmouseover, $click_or_onmouseover,
'Click or Mouse Over to show menus?' 'help' => 'Click or Mouse Over to show menus?'
); ),
'click_or_onmouseover' => array(
create_check_box( 'type' => 'check',
'Disable slider effects', 'label' => 'Disable slider effects',
'disable_slider_effects', 'name' => 'disable_slider_effects',
'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.'
); ),
'disable_pngfix' => array(
create_check_box( 'type' => 'check',
'Disable Internet Explorer png-image-bugfix', 'label' => 'Disable Internet Explorer png-image-bugfix',
'disable_pngfix', 'name' => 'disable_pngfix',
'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?'
); ),
'show_generation_time' => array(
create_check_box( 'type' => 'check',
'Show page generation time', 'label' => 'Show page generation time',
'show_generation_time', 'name' => 'show_generation_time',
'Show page generation time on the bottom of the page?' 'help' => 'Show page generation time on the bottom of the page?'
)
); );

View File

@ -19,92 +19,8 @@
); );
include('../header.inc.php'); include('../header.inc.php');
$n_passwd = $_POST['n_passwd']; $obj = CreateObject('preferences.uichangepassword');
$n_passwd_2 = $_POST['n_passwd_2']; $obj->index();
$o_passwd_2 = $_POST['o_passwd_2'];
if(!$GLOBALS['egw']->acl->check('changepassword', 1) || $_POST['cancel']) $GLOBALS['phpgw']->common->phpgw_footer();
{
$GLOBALS['egw']->redirect_link('/preferences/index.php');
$GLOBALS['egw']->common->phpgw_exit();
}
$GLOBALS['egw']->template->set_file(array(
'form' => 'changepassword.tpl'
));
$GLOBALS['egw']->template->set_var('lang_enter_password',lang('Enter your new password'));
$GLOBALS['egw']->template->set_var('lang_reenter_password',lang('Re-enter your password'));
$GLOBALS['egw']->template->set_var('lang_enter_old_password',lang('Enter your old password'));
$GLOBALS['egw']->template->set_var('lang_change',lang('Change'));
$GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/preferences/changepassword.php'));
if ($GLOBALS['egw_info']['server']['auth_type'] != 'ldap')
{
$GLOBALS['egw']->template->set_var('sql_message',lang('note: This feature does *not* change your email password. This will '
. 'need to be done manually.'));
}
if ($_POST['change'])
{
$o_passwd = $GLOBALS['egw_info']['user']['passwd'];
if ($o_passwd != $o_passwd_2)
{
$errors[] = lang('The old password is not correct');
}
if ($n_passwd != $n_passwd_2)
{
$errors[] = lang('The two passwords are not the same');
}
if (! $n_passwd)
{
$errors[] = lang('You must enter a password');
}
if(is_array($errors))
{
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['egw']->template->set_var('messages',$GLOBALS['egw']->common->error_list($errors));
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_exit(True);
}
$passwd_changed = $GLOBALS['egw']->auth->change_password($o_passwd, $n_passwd);
if(!$passwd_changed)
{
$errors[] = lang('Failed to change password. Please contact your administrator.');
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['egw']->template->set_var('messages',$GLOBALS['egw']->common->error_list($errors));
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_exit(True);
}
else
{
$GLOBALS['egw']->session->appsession('password','phpgwapi',base64_encode($n_passwd));
$GLOBALS['egw_info']['user']['passwd'] = $n_passwd;
$GLOBALS['hook_values']['account_id'] = $GLOBALS['egw_info']['user']['account_id'];
$GLOBALS['hook_values']['old_passwd'] = $o_passwd;
$GLOBALS['hook_values']['new_passwd'] = $n_passwd;
// called for every app now, not only for the ones enabled for the user
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
'location' => 'changepassword',
),False,True);
$GLOBALS['egw']->redirect_link('/preferences/index.php','cd=18');
}
}
else
{
$GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_footer();
}
?> ?>

View File

@ -0,0 +1,74 @@
<?php
/**************************************************************************\
* eGroupWare - preferences *
* 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$ */
class bochangepassword
{
var $public_functions = array(
'changepass' => True
);
var $xml_functions = array();
var $xmlrpc_methods = array();
var $soap_functions = array(
'changepass' => array(
'in' => array('string','string'),
'out' => array('boolean')
)
);
var $debug = False;
function changepass($old,$new)
{
return $GLOBALS['egw']->auth->change_password($old, $new);
}
function list_methods($_type='xmlrpc')
{
/*
This handles introspection or discovery by the logged in client,
in which case the input might be an array. The server always calls
this function to fill the server dispatch map using a string.
*/
if(is_array($_type))
{
$_type = $_type['type'] ? $_type['type'] : $_type[0];
}
switch($_type)
{
case 'xmlrpc':
$xml_functions = array(
'changepass' => array(
'function' => 'changepass',
'signature' => array(array(xmlrpcBoolean,xmlrpcString,xmlrcpString)),
'docstring' => lang('Change a user password by passing the old and new passwords. Returns TRUE on success, FALSE on failure.')
),
'list_methods' => array(
'function' => 'list_methods',
'signature' => array(array(xmlrpcStruct,xmlrpcString)),
'docstring' => lang('Read this list of methods.')
)
);
return $xml_functions;
break;
case 'soap':
return $this->soap_functions;
break;
default:
return array();
break;
}
}
}
?>

View File

@ -0,0 +1,252 @@
<?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$ */
class bosettings
{
var $xmlrpc = False;
var $session_data = array();
var $settings = array();
var $prefs = array();
var $appname = '';
var $debug = False;
var $public_functions = array(
'_read' => True,
'process_array' => True
);
var $xml_functions = array();
var $xmlrpc_methods = array();
var $soap_functions = array(
'_read' => array(
'in' => array('int','int','struct','string','int'),
'out' => array('array')
),
'process_array' => array(
'in' => array('int','struct'),
'out' => array('array')
)
);
function bosettings($appname='')
{
$this->xmlrpc = @is_object($GLOBALS['server']) && $GLOBALS['server']->last_method;
$this->session_data = $GLOBALS['egw']->session->appsession('session_data','preferences');
if($appname)
{
$this->call_hook($appname);
}
}
function save_session($appname,$type,$show_help,$prefix)
{
$GLOBALS['egw']->session->appsession('session_data','preferences',array(
'type' => $type, // save our state in the app-session
'show_help' => $show_help,
'prefix' => $prefix,
'appname' => $appname // we use this to reset prefix on appname-change
));
}
function call_hook($appname)
{
$this->appname = $appname;
if(!$GLOBALS['egw']->hooks->single('settings',$this->appname))
{
return False;
}
$this->settings = array_merge($this->settings,$GLOBALS['settings']);
$GLOBALS['egw']->translation->add_app($this->appname);
if($this->appname != 'preferences')
{
$GLOBALS['egw']->translation->add_app('preferences'); // we need the prefs translations too
}
/* Remove ui-only settings */
if($this->xmlrpc)
{
foreach($this->settings as $key => $valarray)
{
if(!$valarray['xmlrpc'])
{
unset($this->settings[$key]);
}
}
}
else
{
/* Here we include the settings hook file for the current template, if it exists.
This is not handled by the hooks class and is only valid if not using xml-rpc.
*/
$tmpl_settings = EGW_TEMPLATE_DIR . '/hook_settings.inc.php';
if($this->appname == 'preferences' && file_exists($tmpl_settings))
{
include($tmpl_settings);
$this->settings = array_merge($this->settings,$GLOBALS['settings']);
}
}
if($this->debug)
{
// _debug_array($this->settings);
}
return True;
}
function _read($app,$prefix,$type='user')
{
switch($type) // set up some class vars to be used when processing the hooks
{
case 'forced':
$this->prefs = &$GLOBALS['egw']->preferences->forced[$this->check_app()];
break;
case 'default':
$this->prefs = &$GLOBALS['egw']->preferences->default[$this->check_app()];
break;
default:
$this->prefs = &$GLOBALS['egw']->preferences->user[$this->check_app()];
// use prefix if given in the url, used for email extra-accounts
if($prefix != '')
{
$prefix_arr = explode('/',$prefix);
foreach($prefix_arr as $pre)
{
$this->prefs = &$this->prefs[$pre];
}
}
}
if($this->debug)
{
echo 'Preferences array:' . "\n";
_debug_array($this->prefs);
}
}
function _write($appname,$prefix,$type='user')
{
}
function process_array(&$repository,$array,$notifies,$type,$prefix='')
{
//_debug_array($repository);
$appname = $this->check_app();
$prefs = &$repository[$appname];
if($prefix != '')
{
$prefix_arr = explode('/',$prefix);
foreach($prefix_arr as $pre)
{
$prefs = &$prefs[$pre];
}
}
unset($prefs['']);
//_debug_array($array);exit;
while(is_array($array) && list($var,$value) = each($array))
{
if(isset($value) && $value != '' && $value != '**NULL**')
{
if(is_array($value))
{
$value = $value['pw'];
if(empty($value))
{
continue; // dont write empty password-fields
}
}
$prefs[$var] = stripslashes($value);
if($notifies[$var]) // need to translate the key-words back
{
$prefs[$var] = $GLOBALS['egw']->preferences->lang_notify($prefs[$var],$notifies[$var],True);
}
}
else
{
unset($prefs[$var]);
}
}
//echo "prefix='$prefix', prefs=<pre>"; print_r($repository[$_appname]); echo "</pre>\n";
// the following hook can be used to verify the prefs
// if you return something else than False, it is treated as an error-msg and
// displayed to the user (the prefs are not saved)
//
if($error = $GLOBALS['egw']->hooks->single(array(
'location' => 'verify_settings',
'prefs' => $repository[$appname],
'prefix' => $prefix,
'type' => $type
),
$appname
))
{
return $error;
}
$GLOBALS['egw']->preferences->save_repository(True,$type);
return False;
}
function check_app()
{
if($this->appname == 'preferences')
{
return 'common';
}
else
{
return $this->appname;
}
}
/* TODO these need work */
function list_methods($_type='xmlrpc')
{
/*
This handles introspection or discovery by the logged in client,
in which case the input might be an array. The server always calls
this function to fill the server dispatch map using a string.
*/
if(is_array($_type))
{
$_type = $_type['type'] ? $_type['type'] : $_type[0];
}
switch($_type)
{
case 'xmlrpc':
$xml_functions = array(
'read' => array(
'function' => '_read',
'signature' => array(array(xmlrpcStruct,xmlrpcString,xmlrpcString,xmlrpcString)),
'docstring' => lang('Read prefs for the specified application.')
)
'write' => array(
'function' => 'process_array',
'signature' => array(array(xmlrpcStruct,xmlrpcStruct,xmlrpcStruct,xmlrpcStruct,xmlrpcString,xmlrpcString)),
'docstring' => lang('Write prefs for the specified application.')
)
);
return $xml_functions;
break;
case 'soap':
return $this->soap_functions;
break;
default:
return array();
break;
}
}
}

View File

@ -0,0 +1,118 @@
<?php
/**************************************************************************\
* eGroupWare - preferences *
* 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$ */
class uipassword
{
var $public_functions = array(
'change' => True
);
function uichangepassword()
{
$this->bo = CreateObject('preferences.bopassword');
}
function change()
{
$n_passwd = $_POST['n_passwd'];
$n_passwd_2 = $_POST['n_passwd_2'];
$o_passwd_2 = $_POST['o_passwd_2'];
if(!$GLOBALS['egw']->acl->check('changepassword', 1) || $_POST['cancel'])
{
$GLOBALS['egw']->redirect_link('/preferences/index.php');
$GLOBALS['egw']->common->phpgw_exit();
}
$GLOBALS['egw']->template->set_file(array(
'form' => 'changepassword.tpl'
));
$GLOBALS['egw']->template->set_var('lang_enter_password',lang('Enter your new password'));
$GLOBALS['egw']->template->set_var('lang_reenter_password',lang('Re-enter your password'));
$GLOBALS['egw']->template->set_var('lang_enter_old_password',lang('Enter your old password'));
$GLOBALS['egw']->template->set_var('lang_change',lang('Change'));
$GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=preferences.uichangepassword.change'));
if($GLOBALS['egw_info']['server']['auth_type'] != 'ldap')
{
$GLOBALS['egw']->template->set_var('sql_message',lang('note: This feature does *not* change your email password. This will '
. 'need to be done manually.'));
}
if($_POST['change'])
{
$o_passwd = $GLOBALS['egw_info']['user']['passwd'];
if($o_passwd != $o_passwd_2)
{
$errors[] = lang('The old password is not correct');
}
if($n_passwd != $n_passwd_2)
{
$errors[] = lang('The two passwords are not the same');
}
if(!$n_passwd)
{
$errors[] = lang('You must enter a password');
}
if(is_array($errors))
{
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['egw']->template->set_var('messages',$GLOBALS['egw']->common->error_list($errors));
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_exit(True);
}
$passwd_changed = $this->bo->changepass($o_passwd, $n_passwd);
if(!$passwd_changed)
{
$errors[] = lang('Failed to change password. Please contact your administrator.');
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['egw']->template->set_var('messages',$GLOBALS['egw']->common->error_list($errors));
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_exit(True);
}
else
{
$GLOBALS['egw']->session->appsession('password','phpgwapi',base64_encode($n_passwd));
$GLOBALS['egw_info']['user']['passwd'] = $n_passwd;
$GLOBALS['hook_values']['account_id'] = $GLOBALS['egw_info']['user']['account_id'];
$GLOBALS['hook_values']['old_passwd'] = $o_passwd;
$GLOBALS['hook_values']['new_passwd'] = $n_passwd;
// called for every app now, not only for the ones enabled for the user
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
'location' => 'changepassword',
),False,True);
$GLOBALS['egw']->redirect_link('/preferences/index.php','cd=18');
}
}
else
{
$GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_footer();
}
}
}
?>

View File

@ -0,0 +1,569 @@
<?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$ */
class uisettings
{
var $public_functions = array('index' => True);
var $t;
var $list_shown = False;
var $show_help;
var $has_help;
var $prefix = '';
function uisettings()
{
$this->bo = CreateObject('preferences.bosettings');
if($GLOBALS['egw']->acl->check('run',1,'admin'))
{
/* Don't use a global variable for this ... */
define('HAS_ADMIN_RIGHTS',1);
}
}
function index()
{
if($_POST['cancel'])
{
$GLOBALS['egw']->redirect_link('/preferences/index.php');
}
$user = get_var('user',Array('POST'));
$forced = get_var('forced',Array('POST'));
$default = get_var('default',Array('POST'));
$this->t =& CreateObject('phpgwapi.Template',$GLOBALS['egw']->common->get_tpl_dir('preferences'));
$this->t->set_file(array(
'preferences' => 'preferences.tpl'
));
$this->t->set_block('preferences','list','lists');
$this->t->set_block('preferences','row','rowhandle');
$this->t->set_block('preferences','help_row','help_rowhandle');
$this->t->set_var(array('rowhandle' => '','help_rowhandle' => '','messages' => ''));
$this->prefix = get_var('prefix',array('GET'),$this->bo->session_data['appname'] == $_GET['appname'] ? $this->bo->session_data['prefix'] : '');
if($this->is_admin())
{
/* This is where we will keep track of our postion. */
/* Developers won't have to pass around a variable then */
$GLOBALS['type'] = get_var('type',Array('GET','POST'),$this->bo->session_data['type']);
if(empty($GLOBALS['type']))
{
$GLOBALS['type'] = 'user';
}
}
else
{
$GLOBALS['type'] = 'user';
}
$this->show_help = $this->bo->session_data['show_help'] != '' && $this->bo->session_data['appname'] == $_GET['appname']
? $this->bo->session_data['show_help']
: (int)$GLOBALS['egw_info']['user']['preferences']['common']['show_help'];
if($toggle_help = get_var('toggle_help','POST'))
{
$this->show_help = (int)(!$this->show_help);
}
$this->has_help = 0;
if($_POST['save'] || $_POST['apply'])
{
/* Don't use a switch here, we need to check some permissions durring the ifs */
if($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
{
$error = $this->bo->process_array($GLOBALS['egw']->preferences->user,$user,$this->bo->session_data['notifies'],$GLOBALS['type'],$this->prefix);
}
if($GLOBALS['type'] == 'default' && $this->is_admin())
{
$error = $this->bo->process_array($GLOBALS['egw']->preferences->default, $default,$this->bo->session_data['notifies'],$GLOBALS['type']);
}
if($GLOBALS['type'] == 'forced' && $this->is_admin())
{
$error = $this->bo->process_array($GLOBALS['egw']->preferences->forced, $forced,$this->bo->session_data['notifies'],$GLOBALS['type']);
}
if(!$this->is_admin() || $error)
{
$GLOBALS['egw']->redirect_link('/preferences/index.php');
}
if($GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences' && $user['show_help'] != '')
{
$this->show_help = $user['show_help']; // use it, if admin changes his help-prefs
}
if($_POST['save'])
{
$GLOBALS['egw']->redirect_link('/preferences/index.php');
}
}
// save our state in the app-session
$this->bo->save_session($_GET['appname'],$GLOBALS['type'],$this->show_help,$this->prefix);
// changes for the admin itself, should have immediate feedback ==> redirect
if(!$error && ($_POST['save'] || $_POST['apply']) && $GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences')
{
$GLOBALS['egw']->redirect_link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname']);
}
$this->t->set_var('messages',$error);
$this->t->set_var('action_url',$GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname']));
$this->t->set_var('th_bg', $GLOBALS['egw_info']['theme']['th_bg']);
$this->t->set_var('th_text',$GLOBALS['egw_info']['theme']['th_text']);
$this->t->set_var('row_on', $GLOBALS['egw_info']['theme']['row_on']);
$this->t->set_var('row_off',$GLOBALS['egw_info']['theme']['row_off']);
$this->bo->_read($this->check_app(),$this->prefix,$GLOBALS['type']);
//echo "prefs=<pre>"; print_r($this->bo->prefs); echo "</pre>\n";
$notifies = array();
if(!$this->bo->call_hook($_GET['appname']))
{
$this->t->set_block('preferences','form','formhandle'); // skip the form
$this->t->set_var('formhandle','');
$this->t->set_var('messages',lang('Error: There was a problem finding the preference file for %1 in %2',
$GLOBALS['egw_info']['navbar'][$_GET['appname']]['title'],
EGW_SERVER_ROOT . SEP . $_GET['appname'] . SEP . 'inc' . SEP . 'hook_settings.inc.php'
));
}
foreach($this->bo->settings as $key => $valarray)
{
if(!$this->is_admin())
{
if($valarray['admin'])
{
next;
}
}
switch($valarray['type'])
{
case 'section':
$this->create_section($valarray['title']);
break;
case 'input':
$this->create_input_box(
$valarray['label'],
$valarray['name'],
$valarray['help'],
$valarray['default'],
$valarray['size'],
$valarray['maxsize'],
$valarray['type'],
$valarray['run_lang'] // This needs to go away since xml-rpc should get correct lang
);
break;
case 'password':
$this->create_password_box(
$valarray['label'],
$valarray['name'],
$valarray['help'],
$valarray['size'],
$valarray['maxsize'],
$valarray['run_lang'] // This needs to go away since xml-rpc should get correct lang from bo
);
break;
case 'text':
$this->create_text_area(
$valarray['label'],
$valarray['name'],
$valarray['rows'],
$valarray['cols'],
$valarray['help'],
$valarray['default'],
$valarray['run_lang']
);
break;
case 'select':
$this->create_select_box(
$valarray['label'],
$valarray['name'],
$valarray['values'],
$valarray['help'],
$valarray['default']
);
break;
case 'check':
$this->create_check_box(
$valarray['label'],
$valarray['name'],
$valarray['help']
);
break;
case 'notify':
$this->create_notify(
$valarray['label'],
$valarray['name'],
$valarray['rows'],
$valarray['cols'],
$valarray['help'],
$valarray['default'],
$valarray['values'],
$valarray['subst_help']
);
@$notifies[$valarray['name']] = $valarray;
break;
}
}
$GLOBALS['egw_info']['flags']['app_header'] = $_GET['appname'] == 'preferences' ?
lang('Preferences') : lang('%1 - Preferences',$GLOBALS['egw_info']['apps'][$_GET['appname']]['title']);
$GLOBALS['egw']->common->egw_header();
echo parse_navbar();
// TODO - what is the purpose of this?
if(count($notifies)) // there have been notifies in the hook, we need to save in the session
{
$this->bo->save_session(
'type' => $GLOBALS['type'], // save our state in the app-session
'show_help' => $this->show_help,
'prefix' => $this->prefix,
'appname' => $_GET['appname'], // we use this to reset prefix on appname-change
'notifies' => $notifies
);
//_debug_array($notifies);
}
if($this->is_admin())
{
$tabs[] = array(
'label' => lang('Your preferences'),
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname'] . "&type=user")
);
$tabs[] = array(
'label' => lang('Default preferences'),
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname'] . "&type=default")
);
$tabs[] = array(
'label' => lang('Forced preferences'),
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname'] . "&type=forced")
);
switch($GLOBALS['type'])
{
case 'user': $selected = 0; break;
case 'default': $selected = 1; break;
case 'forced': $selected = 2; break;
}
$this->t->set_var('tabs',$GLOBALS['egw']->common->create_tabs($tabs,$selected));
}
$this->t->set_var('lang_save', lang('save'));
$this->t->set_var('lang_apply', lang('apply'));
$this->t->set_var('lang_cancel', lang('cancel'));
$this->t->set_var('show_help',(int)$this->show_help);
$this->t->set_var('help_button',$this->has_help ? '<input type="submit" name="toggle_help" value="'.
($this->show_help ? lang('help off') : lang('help')).'">' : '');
if(!$this->list_shown)
{
$this->show_list();
}
$this->t->pfp('phpgw_body','preferences');
//echo '<pre style="text-align: left;">'; print_r($GLOBALS['egw']->preferences->data); echo "</pre>\n";
$GLOBALS['egw']->common->egw_footer();
}
/* Make things a little easier to follow */
/* Some places we will need to change this if they're in common */
function check_app()
{
if($_GET['appname'] == 'preferences')
{
return 'common';
}
else
{
return $_GET['appname'];
}
}
function is_forced_value($_appname,$preference_name)
{
if(isset($GLOBALS['egw']->preferences->forced[$_appname][$preference_name]) && $GLOBALS['type'] != 'forced')
{
return True;
}
else
{
return False;
}
}
function create_password_box($label_name,$preference_name,$help='',$size='',$max_size='',$run_lang=True)
{
$_appname = $this->check_app();
if(is_forced_value($_appname,$preference_name))
{
return True;
}
$this->create_input_box($label_name,$preference_name.'][pw',$help,'',$size,$max_size,'password',$run_lang);
}
function create_input_box($label,$name,$help='',$default='',$size='',$max_size='',$type='',$run_lang=True)
{
$charSet = $GLOBALS['egw']->translation->charset();
$_appname = $this->check_app();
if($this->is_forced_value($_appname,$name))
{
return True;
}
if($type) // used to specify password
{
$options = " TYPE='$type'";
}
if($size)
{
$options .= " SIZE='$size'";
}
if($maxsize)
{
$options .= " MAXSIZE='$maxsize'";
}
if(isset($this->bo->prefs[$name]) || $GLOBALS['type'] != 'user')
{
$default = $this->bo->prefs[$name];
}
if($GLOBALS['type'] == 'user')
{
$def_text = !$GLOBALS['egw']->preferences->user[$_appname][$name] ? $GLOBALS['egw']->preferences->data[$_appname][$name] : $GLOBALS['egw']->preferences->default[$_appname][$name];
if(isset($notifies[$name])) // translate the substitution names
{
$def_text = $GLOBALS['egw']->preferences->lang_notify($def_text,$notifies[$name]);
}
$def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').':&nbsp;'.$def_text.'</font></i>' : '';
}
$this->t->set_var('row_value',"<input name=\"${GLOBALS[type]}[$name]\"value=\"".
@htmlspecialchars($default,ENT_COMPAT,$charSet)."\"$options>$def_text");
$this->t->set_var('row_name',lang($label));
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
$this->t->fp('rows',$this->process_help($help,$run_lang) ? 'help_row' : 'row',True);
}
function process_help($help,$run_lang=True)
{
if(!empty($help))
{
$this->has_help = True;
if($this->show_help)
{
$this->t->set_var('help_value',$run_lang ? lang($help) : $help);
return True;
}
}
return False;
}
function create_check_box($label,$name,$help='',$default='',$run_lang=True)
{
// checkboxes itself can't be use as they return nothing if uncheckt !!!
if($GLOBALS['type'] != 'user')
{
$default = ''; // no defaults for default or forced prefs
}
if(isset($this->bo->prefs[$name]))
{
$this->bo->prefs[$name] = (int)(!!$this->bo->prefs[$name]); // to care for '' and 'True'
}
return $this->create_select_box($label,$name,array(
'0' => lang('No'),
'1' => lang('Yes')
),$help,$default,$run_lang);
}
function create_option_string($selected,$values)
{
while(is_array($values) && list($var,$value) = each($values))
{
$s .= '<option value="' . $var . '"';
if("$var" == "$selected") // the "'s are necessary to force a string-compare
{
$s .= ' selected';
}
$s .= '>' . $value . '</option>';
}
return $s;
}
/* for creating different sections with a title */
function create_section($title='')
{
$this->t->set_var('row_value','');
$this->t->set_var('row_name','<span class="prefSection">'.lang($title).'</span>');
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
$this->t->fp('rows',$this->process_help($help) ? 'help_row' : 'row',True);
}
/* for creating different sections with a title */
function create_subsection($title='')
{
$this->t->set_var('row_value','');
$this->t->set_var('row_name','<span class="prefSubSection">'.lang($title).'</span>');
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
$this->t->fp('rows',$this->process_help($help) ? 'help_row' : 'row',True);
}
function create_select_box($label,$name,$values,$help='',$default='',$run_lang=True)
{
$_appname = $this->check_app();
if($this->is_forced_value($_appname,$name))
{
return True;
}
if(isset($this->bo->prefs[$name]) || $GLOBALS['type'] != 'user')
{
$default = $this->bo->prefs[$name];
}
switch($GLOBALS['type'])
{
case 'user':
$s = '<option value="">' . lang('Use default') . '</option>';
break;
case 'default':
$s = '<option value="">' . lang('No default') . '</option>';
break;
case 'forced':
$s = '<option value="**NULL**">' . lang('Users choice') . '</option>';
break;
}
$s .= $this->create_option_string($default,$values);
if($GLOBALS['type'] == 'user')
{
$def_text = $GLOBALS['egw']->preferences->default[$_appname][$name];
$def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').':&nbsp;'.$values[$def_text].'</font></i>' : '';
}
$this->t->set_var('row_value',"<select name=\"${GLOBALS[type]}[$name]\">$s</select>$def_text");
$this->t->set_var('row_name',lang($label));
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
$this->t->fp('rows',$this->process_help($help,$run_lang) ? 'help_row' : 'row',True);
}
/**
* creates text-area or inputfield with subtitution-variables
*
* @param $label untranslated label
* @param $name name of the pref
* @param $rows, $cols of the textarea or input-box ($rows==1)
* @param $help untranslated help-text
* @param $default default-value
* @param $vars2 array with extra substitution-variables of the form key => help-text
*/
function create_notify($label,$name,$rows,$cols,$help='',$default='',$vars2='',$subst_help=True,$run_lang=True)
{
$vars = $GLOBALS['egw']->preferences->vars;
if(is_array($vars2))
{
$vars += $vars2;
}
$this->bo->prefs[$name] = $GLOBALS['egw']->preferences->lang_notify($this->bo->prefs[$name],$vars);
$notifies[$name] = $vars; // this gets saved in the app_session for re-translation
$help = $help && $run_lang ? lang($help) : $help;
if($subst_help)
{
$help .= '<p><b>'.lang('Substitutions and their meanings:').'</b>';
foreach($vars as $var => $var_help)
{
$lname = ($lname = lang($var)) == $var.'*' ? $var : $lname;
$help .= "<br>\n".'<b>$$'.$lname.'$$</b>: '.$var_help;
}
$help .= "</p>\n";
}
if($row == 1)
{
$this->create_input_box($label,$name,$help,$default,$cols,'','',False);
}
else
{
$this->create_text_area($label,$name,$rows,$cols,$help,$default,False);
}
}
function create_text_area($label,$name,$rows,$cols,$help='',$default='',$run_lang=True)
{
$charSet = $GLOBALS['egw']->translation->charset();
$_appname = $this->check_app();
if($this->is_forced_value($_appname,$name))
{
return True;
}
if(isset($this->bo->prefs[$name]) || $GLOBALS['type'] != 'user')
{
$default = $this->bo->prefs[$name];
}
if($GLOBALS['type'] == 'user')
{
$def_text = !$GLOBALS['egw']->preferences->user[$_appname][$name] ? $GLOBALS['egw']->preferences->data[$_appname][$name] : $GLOBALS['egw']->preferences->default[$_appname][$name];
if(isset($notifies[$name])) // translate the substitution names
{
$def_text = $GLOBALS['egw']->preferences->lang_notify($def_text,$notifies[$name]);
}
$def_text = $def_text != '' ? '<br><i><font size="-1"><b>'.lang('default').'</b>:<br>'.nl2br($def_text).'</font></i>' : '';
}
$this->t->set_var('row_value',"<textarea rows=\"$rows\" cols=\"$cols\" name=\"${GLOBALS[type]}[$name]\">".
htmlentities($default,ENT_COMPAT,$charSet)."</textarea>$def_text");
$this->t->set_var('row_name',lang($label));
$GLOBALS['egw']->nextmatchs->template_alternate_row_color($this->t);
$this->t->fp('rows',$this->process_help($help,$run_lang) ? 'help_row' : 'row',True);
}
/* Makes the ifs a little nicer, plus ... this will change once the ACL manager is in place */
/* and is able to create less powerfull admins. This will handle the ACL checks for that (jengo) */
function is_admin()
{
if(HAS_ADMIN_RIGHTS == 1 && empty($this->prefix)) // tabs only without prefix
{
return True;
}
else
{
return False;
}
}
function show_list($header='&nbsp;')
{
$this->t->set_var('list_header',$header);
$this->t->parse('lists','list',$this->list_shown);
$this->t->set_var('rows','');
$this->list_shown = True;
}
}

View File

@ -14,9 +14,9 @@
if ($GLOBALS['egw']->acl->check('changepassword',1)) if ($GLOBALS['egw']->acl->check('changepassword',1))
{ {
$file['Change your Password'] = $GLOBALS['egw']->link('/preferences/changepassword.php'); $file['Change your Password'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uipassword.change');
} }
$file['change your settings'] = $GLOBALS['egw']->link('/preferences/preferences.php','appname=preferences'); $file['change your settings'] = $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=preferences');
display_section('preferences',$file); display_section('preferences',$file);
?> ?>

View File

@ -11,32 +11,24 @@
/* $Id$ */ /* $Id$ */
/* Setup some values to fill the array of this app's settings below */
$templates = $GLOBALS['egw']->common->list_templates(); $templates = $GLOBALS['egw']->common->list_templates();
while (list($var,$value) = each($templates)) foreach($templates as $var => $value)
{ {
$_templates[$var] = $templates[$var]['title']; $_templates[$var] = $templates[$var]['title'];
} }
$themes = $GLOBALS['egw']->common->list_themes(); $themes = $GLOBALS['egw']->common->list_themes();
while (list(,$value) = each($themes)) foreach($themes as $value)
{ {
$_themes[$value] = $value; $_themes[$value] = $value;
} }
create_input_box('Max matches per page','maxmatchs',
'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.','',3);
create_select_box('Interface/Template Selection','template_set',$_templates,
'A template defines the layout of eGroupWare and it contains icons for each application.');
create_select_box('Theme (colors/fonts) Selection','theme',$_themes,
'A theme defines the colors and fonts used by the template.');
$navbar_format = array( $navbar_format = array(
'icons' => lang('Icons only'), 'icons' => lang('Icons only'),
'icons_and_text' => lang('Icons and text'), 'icons_and_text' => lang('Icons and text'),
'text' => lang('Text only') 'text' => lang('Text only')
); );
create_select_box('Show navigation bar as','navbar_format',$navbar_format,
'You can show the applications as icons only, icons with app-name or both.');
$format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']; $format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'];
$format = ($format ? $format : 'Y/m/d') . ', '; $format = ($format ? $format : 'Y/m/d') . ', ';
@ -53,8 +45,6 @@
$t = time() + $i * 60*60; $t = time() + $i * 60*60;
$tz_offset[$i] = $i . ' ' . lang('hours').': ' . date($format,$t); $tz_offset[$i] = $i . ' ' . lang('hours').': ' . date($format,$t);
} }
create_select_box('Time zone offset','tz_offset',$tz_offset,
'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.');
$date_formats = array( $date_formats = array(
'm/d/Y' => 'm/d/Y', 'm/d/Y' => 'm/d/Y',
@ -71,52 +61,29 @@
'd.m.Y' => 'd.m.Y', 'd.m.Y' => 'd.m.Y',
'd-M-Y' => 'd-M-Y' 'd-M-Y' => 'd-M-Y'
); );
create_select_box('Date format','dateformat',$date_formats,
'How should eGroupWare display dates for you.');
$time_formats = array( $time_formats = array(
'12' => lang('12 hour'), '12' => lang('12 hour'),
'24' => lang('24 hour') '24' => lang('24 hour')
); );
create_select_box('Time format','timeformat',$time_formats,
'Do you prefer a 24 hour time format, or a 12 hour one with am/pm attached.');
$sbox = createobject('phpgwapi.sbox'); $sbox = createobject('phpgwapi.sbox');
create_select_box('Country','country',$sbox->country_array,
'In which country are you. This is used to set certain defaults for you.');
$langs = $GLOBALS['egw']->translation->get_installed_langs(); $langs = $GLOBALS['egw']->translation->get_installed_langs();
create_select_box('Language','lang',$langs,
'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.');
// preference.php handles this function foreach($GLOBALS['egw_info']['user']['apps'] as $app)
if (is_admin())
{
create_check_box('Show number of current users','show_currentusers',
'Should the number of active sessions be displayed for you all the time.');
}
reset($GLOBALS['egw_info']['user']['apps']);
while (list($app) = each($GLOBALS['egw_info']['user']['apps']))
{ {
$app = $app[0];
if($GLOBALS['egw_info']['apps'][$app]['status'] != 2 && $app) 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); $user_apps[$app] = $GLOBALS['egw_info']['apps'][$app]['title'] ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app);
} }
} }
create_select_box('Default application','default_app',$user_apps,
"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).");
create_input_box('Currency','currency',
'Which currency symbol or name should be used in eGroupWare.');
$account_sels = array( $account_sels = array(
'selectbox' => lang('Selectbox'), 'selectbox' => lang('Selectbox'),
'primary_group' => lang('Selectbox with primary group and search'), 'primary_group' => lang('Selectbox with primary group and search'),
'popup' => lang('Popup with search') 'popup' => lang('Popup with search')
); );
create_select_box('How do you like to select accounts','account_selection',$account_sels,
'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.');
$account_display = array( $account_display = array(
'firstname' => lang('Firstname'). ' '.lang('Lastname'), 'firstname' => lang('Firstname'). ' '.lang('Lastname'),
@ -126,8 +93,139 @@
'lastall' => lang('Lastname').', '.lang('Firstname').' ['.lang('username').']', 'lastall' => lang('Lastname').', '.lang('Firstname').' ['.lang('username').']',
'all' => '['.lang('username').'] '.lang('Lastname').', '.lang('Firstname') 'all' => '['.lang('username').'] '.lang('Lastname').', '.lang('Firstname')
); );
create_select_box('How do you like to display accounts','account_display',$account_display,
'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.');
create_check_box('Show helpmessages by default','show_help', /* Settings array for this app */
'Should this help messages shown up always, when you enter the preferences or only on request.'); $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
),
'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' => $sbox->country_array,
'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
),
'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' => '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.',
'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
)
);

View File

@ -18,7 +18,8 @@
<tr height="30" valign="bottom"> <tr height="30" valign="bottom">
<td align="left"> <td align="left">
<input type="submit" name="submit" value="{lang_submit}"> &nbsp; <input type="submit" name="save" value="{lang_save}"> &nbsp;
<input type="submit" name="apply" value="{lang_apply}"> &nbsp;
<input type="submit" name="cancel" value="{lang_cancel}"> <input type="submit" name="cancel" value="{lang_cancel}">
</td> </td>
<td align="right">&nbsp; {help_button}</td> <td align="right">&nbsp; {help_button}</td>