From 2c2bc0beb3937c2ff7cccda5fd028bf78b4b3b47 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Sat, 23 Jul 2005 09:44:46 +0000 Subject: [PATCH] Update of preferences app to work as a multi-tiered application and via xml-rpc --- calendar/inc/hook_preferences.inc.php | 6 +- calendar/inc/hook_settings.inc.php | 316 +++++++--- filemanager/inc/hook_preferences.inc.php | 3 +- filemanager/inc/hook_settings.inc.php | 64 +- filemanager/inc/hook_sidebox_menu.inc.php | 7 +- home/inc/hook_settings.inc.php | 61 +- .../class.admin_prefs_sidebox_hooks.inc.php | 2 +- infolog/inc/hook_settings.inc.php | 87 ++- .../templates/edge-it/hook_settings.inc.php | 97 +-- .../templates/idots/hook_settings.inc.php | 115 ++-- .../templates/idots2/hook_settings.inc.php | 246 ++++---- .../templates/jerryr/hook_settings.inc.php | 13 +- .../templates/prisma/hook_settings.inc.php | 97 +-- preferences/changepassword.php | 90 +-- preferences/inc/class.bopassword.inc.php | 74 +++ preferences/inc/class.bosettings.inc.php | 252 ++++++++ preferences/inc/class.uipassword.inc.php | 118 ++++ preferences/inc/class.uisettings.inc.php | 569 ++++++++++++++++++ preferences/inc/hook_preferences.inc.php | 4 +- preferences/inc/hook_settings.inc.php | 188 ++++-- preferences/templates/default/preferences.tpl | 3 +- 21 files changed, 1873 insertions(+), 539 deletions(-) create mode 100644 preferences/inc/class.bopassword.inc.php create mode 100644 preferences/inc/class.bosettings.inc.php create mode 100644 preferences/inc/class.uipassword.inc.php create mode 100755 preferences/inc/class.uisettings.inc.php diff --git a/calendar/inc/hook_preferences.inc.php b/calendar/inc/hook_preferences.inc.php index a2fcee751f..bff76bbb3f 100644 --- a/calendar/inc/hook_preferences.inc.php +++ b/calendar/inc/hook_preferences.inc.php @@ -14,9 +14,9 @@ // Only Modify the $file and $title variables..... $title = $appname; $file = array( - 'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname), - 'Grant Access' => $GLOBALS['phpgw']->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') + '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), + '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 display_section($appname,$title,$file); diff --git a/calendar/inc/hook_settings.inc.php b/calendar/inc/hook_settings.inc.php index da222d2c41..0f75e1d518 100644 --- a/calendar/inc/hook_settings.inc.php +++ b/calendar/inc/hook_settings.inc.php @@ -20,7 +20,7 @@ { $GLOBALS['egw']->jscalendar = CreateObject('phpgwapi.jscalendar'); } - ExecMethod('calendar.bocal.check_set_default_prefs'); + ExecMethod('calendar.bocalendar.check_set_default_prefs'); $default = array( 'day' => lang('Daily'), @@ -30,18 +30,11 @@ 'planner_cat' => lang('Planner by category'), '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 */ $week_view = array( '5' => lang('Weekview without 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, 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 @@ -51,9 +44,6 @@ '0' => lang('No'), '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( 'no' => lang('Never'), @@ -71,17 +61,11 @@ 'modifications' => lang('on all modification, but responses'), '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.
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( 'none' => lang('None'), 'extended' => lang('Extended'), '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( 'to-fullname' => lang('Fullname 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, ...'), '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.
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 ?
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( 'Monday' => lang('Monday'), 'Sunday' => lang('Sunday'), '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) { $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.
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( 5 => '5', 10 => '10', @@ -145,11 +104,6 @@ 45 => '45', 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']); $options = array(-1 => lang('none')); if (is_array($groups)) @@ -159,18 +113,12 @@ $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( 1 => '1', 2 => '2', 3 => '3', 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( 'all' => lang('all'), 'private' => lang('private only'), @@ -180,26 +128,252 @@ // 'private+group' => lang('private 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']; if ($freebusy_url[0] == '/') { $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.',''.$freebusy_url.''); - create_check_box('Make freebusy information available to not loged in persons?','freebusy', - $freebusy_help,'',False); - create_input_box('Password for not loged in users to your freebusy information?','freebusy_pw', - 'If you dont set a password here, the information is available to everyone, who knows the URL!!!'); + + $GLOBALS['settings'] = array( + 'defaultcalendar' => array( + '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.
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.
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 ?
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.
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 + ) + ); diff --git a/filemanager/inc/hook_preferences.inc.php b/filemanager/inc/hook_preferences.inc.php index f5aecfce77..0f5795f54f 100644 --- a/filemanager/inc/hook_preferences.inc.php +++ b/filemanager/inc/hook_preferences.inc.php @@ -15,8 +15,7 @@ // Only Modify the $file and $title variables..... $title = $appname; $file = Array( -// 'Preferences Old' => $GLOBALS['phpgw']->link('/filemanager/preferences.php'), - 'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname) + 'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $appname) ); //Do not modify below this line display_section($appname,$title,$file); diff --git a/filemanager/inc/hook_settings.inc.php b/filemanager/inc/hook_settings.inc.php index d5bdd124f7..1790cc8054 100644 --- a/filemanager/inc/hook_settings.inc.php +++ b/filemanager/inc/hook_settings.inc.php @@ -10,6 +10,8 @@ * option) * \**************************************************************************/ + /* $Id$ */ + //ExecMethod('filemanager.bofilemanager.check_set_default_prefs'); /*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_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( 'name' => 'File Name', @@ -34,12 +44,24 @@ '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 ( "viewinnewwin" => "View documents in new window", @@ -49,17 +71,29 @@ "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( - "1"=>"1", - "5"=>"5", - "10"=>"10", - "20"=>"20", - "30"=>"30" + $upload_boxes = array( + '1' => '1', + '5' => '5', + '10' => '10', + '20' => '20', + '30' => '30' + ); + + $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 ); - - create_select_box('Default number of upload fields to show','show_upload_boxes',$upload_boxes); diff --git a/filemanager/inc/hook_sidebox_menu.inc.php b/filemanager/inc/hook_sidebox_menu.inc.php index a68f2fc771..2c77767a41 100755 --- a/filemanager/inc/hook_sidebox_menu.inc.php +++ b/filemanager/inc/hook_sidebox_menu.inc.php @@ -25,9 +25,12 @@ $menu_title = $GLOBALS['phpgw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); $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); - } ?> diff --git a/home/inc/hook_settings.inc.php b/home/inc/hook_settings.inc.php index e858fa6128..1caf8f0295 100755 --- a/home/inc/hook_settings.inc.php +++ b/home/inc/hook_settings.inc.php @@ -8,30 +8,43 @@ * under the terms of the GNU General Public License as published by the * * Free Software Foundation; version 2 of the License. * \**************************************************************************/ - - - create_section('Home'); + + /* $Id$ */ - $prev_img = Array( - 'no' => lang('Never'), - 'only_tn' => lang('Only if thumnails exits'), - 'yes' => lang('Yes') - ); + $prev_img = Array( + 'no' => lang('Never'), + 'only_tn' => lang('Only if thumnails exits'), + '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( + '1' => '1', + '2' => '2', + '3' => '3', + '4' => '4', + '5' => '5', + '10' => '10', + '20' => '20', + '30' => '30', + '-1' => lang('No max. number') + ); - $max_prev=array( - "1"=>"1", - "2"=>"2", - "3"=>"3", - "4"=>"4", - "5"=>"5", - "10"=>"10", - "20"=>"20", - "30"=>"30", - "-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 + ) + ); +?> diff --git a/infolog/inc/class.admin_prefs_sidebox_hooks.inc.php b/infolog/inc/class.admin_prefs_sidebox_hooks.inc.php index 8cec3206f9..637ba54d5f 100644 --- a/infolog/inc/class.admin_prefs_sidebox_hooks.inc.php +++ b/infolog/inc/class.admin_prefs_sidebox_hooks.inc.php @@ -41,7 +41,7 @@ class admin_prefs_sidebox_hooks if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin') { $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), 'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True') ); diff --git a/infolog/inc/hook_settings.inc.php b/infolog/inc/hook_settings.inc.php index 46b64fb01f..2a9738866d 100644 --- a/infolog/inc/hook_settings.inc.php +++ b/infolog/inc/hook_settings.inc.php @@ -12,43 +12,86 @@ /* $Id$ */ + /* Setup some values to fill the array of this app's settings below */ $show_entries = array( 0 => lang('No'), 1 => lang('Yes'), 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); - 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 foreach($ui->filters as $key => $label) { $filters[$key] = lang($label); } 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( 'all' => lang('all links and attachments'), 'links' => lang('only the links'), 'attach' => lang('only the attachments'), - 'none' => lang('no links or attachments'), - 'no_describtion' => lang('no describtion, links or attachments'), + 'none' => lang('no 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).'); + + /* 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); - - 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).'); diff --git a/phpgwapi/templates/edge-it/hook_settings.inc.php b/phpgwapi/templates/edge-it/hook_settings.inc.php index e2ca6d8d49..4b64404cf5 100644 --- a/phpgwapi/templates/edge-it/hook_settings.inc.php +++ b/phpgwapi/templates/edge-it/hook_settings.inc.php @@ -10,58 +10,63 @@ \**************************************************************************/ /* $Id$ */ - create_section('Preferences for the idots template set'); $start_and_logout_icons = array( - 'yes' => lang('yes'), - 'no' => lang('no') + 'yes' => lang('yes'), + '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' => lang('Click'), 'onmouseover' => lang('On Mouse Over') ); - create_select_box( - 'Click or Mouse Over to show menus', - 'click_or_onmouseover', - $click_or_onmouseover, - 'Click or Mouse Over to show menus?' - ); - - create_check_box( - 'Disable slider effects', - '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.' - ); - - create_check_box( - 'Disable Internet Explorer png-image-bugfix', - 'disable_pngfix', - 'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?' - ); - - create_check_box( - 'Show page generation time', - 'show_generation_time', - 'Show page generation time on the bottom of the page?' + $GLOBALS['settings'] = array( + 'templ' => array( + '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', + '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?' + ) ); diff --git a/phpgwapi/templates/idots/hook_settings.inc.php b/phpgwapi/templates/idots/hook_settings.inc.php index e2ca6d8d49..2f0b2ac77a 100644 --- a/phpgwapi/templates/idots/hook_settings.inc.php +++ b/phpgwapi/templates/idots/hook_settings.inc.php @@ -10,58 +10,81 @@ \**************************************************************************/ /* $Id$ */ - create_section('Preferences for the idots template set'); $start_and_logout_icons = array( - 'yes' => lang('yes'), - 'no' => lang('no') + 'yes' => lang('yes'), + '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' => lang('Click'), 'onmouseover' => lang('On Mouse Over') ); - create_select_box( - 'Click or Mouse Over to show menus', - 'click_or_onmouseover', - $click_or_onmouseover, - 'Click or Mouse Over to show menus?' - ); - - create_check_box( - 'Disable slider effects', - '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.' - ); - - create_check_box( - 'Disable Internet Explorer png-image-bugfix', - 'disable_pngfix', - 'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?' - ); - - create_check_box( - 'Show page generation time', - 'show_generation_time', - 'Show page generation time on the bottom of the page?' + $GLOBALS['settings'] = array( + 'prefssection' => array( + 'type' => 'section', + 'title' => 'Preferences for the idots template set', + 'xmlrpc' => False, + 'admin' => False + ), + '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.', + 'xmlrpc' => False, + 'admin' => False + ), + '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.', + 'default' => '', + '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 + ) ); diff --git a/phpgwapi/templates/idots2/hook_settings.inc.php b/phpgwapi/templates/idots2/hook_settings.inc.php index aafe5cbe54..aa790bce1f 100755 --- a/phpgwapi/templates/idots2/hook_settings.inc.php +++ b/phpgwapi/templates/idots2/hook_settings.inc.php @@ -9,40 +9,25 @@ * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ - - - create_section('Preferences for the idots2 template set'); - + + /* $Id$ */ + $clock_show = array( '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( 'minute' => lang('minute'), '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(); $dir = '../phpgwapi/templates/idots2/images/backgrounds'; - + $dh = opendir($dir); $files['none'] = "none"; - while (false !== ($filename = readdir($dh))) + while(false !== ($filename = readdir($dh))) { if(strlen($filename) > 3) { @@ -50,108 +35,129 @@ } } 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( - 'centered' => lang('centered'), - 'tiled' => lang('tiled'), - 'stretched' => lang('stretched') + 'centered' => lang('centered'), + 'tiled' => lang('tiled'), + 'stretched' => lang('stretched') ); - - create_select_box( - 'Choose a background style.', - 'bckStyle', - $bckStyle, - 'What style would you like the image to have?' - ); - - create_input_box( - 'Choose a background color', - 'bgcolor', - 'What color should all the blank space on the desktop have', - '#FFFFFF', - 7, - 7, - '', - false - ); - + $showLogo = array( - 'yes' => lang('yes'), - 'no' => lang('no') + 'yes' => lang('yes'), + 'no' => lang('no') ); - - create_select_box( - 'Show logo\'s on the desktop.', - 'showLogo', - $showLogo, - 'Show the logo\'s of eGroupware and x-desktop on the desktop.' - ); - create_input_box( - 'Choose a background color for the icons', - 'bgcolor_icons', - '', - '#FFFFFF', - 7, - 7, - '', - false - ); - + $back_icons = array( - 'yes' => lang('yes'), - 'no' => lang('no') - ); - - create_select_box( - 'Transparant bg for the icons?', - 'back_icons', - $back_icons, - '' - ); - create_input_box( - 'Choose a text color for the icons', - 'textcolor_icons', - '', - '#FFFFFF', - 7, - 7, - '', - false + 'yes' => lang('yes'), + 'no' => lang('no') ); - create_check_box( - 'Show page generation time?', - 'show_generation_time', - 'Would you like to display the page generation time at the bottom of every window?' + $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.', + 'bckStyle', + $bckStyle, + 'What style would you like the image to have?' + ), + 'bgcolor' => array( + 'type' => 'input', + 'Choose a background color', + 'bgcolor', + 'What color should all the blank space on the desktop have', + '#FFFFFF', + 7, + 7, + '', + false + ), + 'showLogo' => array( + 'type' => 'select', + 'Show logo\'s on the desktop.', + 'showLogo', + $showLogo, + 'Show the logo\'s of eGroupware and x-desktop on the desktop.' + ), + 'bgcolor_icons' => array( + 'type' => 'input', + 'Choose a background color for the icons', + 'bgcolor_icons', + '', + '#FFFFFF', + 7, + 7, + '', + false + ), + 'back_icons' => array( + 'type' => 'select', + 'Transparant bg for the icons?', + 'back_icons', + $back_icons, + '' + ), + 'textcolor_icons' => array( + 'type' => 'input', + 'Choose a text color for the icons', + 'textcolor_icons', + '', + '#FFFFFF', + 7, + 7, + '', + false + ), + 'show_generation_time' => array( + 'type' => 'check', + 'Show page generation time?', + 'show_generation_time', + 'Would you like to display the page generation time at the bottom of every window?' + ), + 'scrWidth' => array( + 'type' => 'input', + 'Default width for the windows', + 'scrWidth', + 'Select the default width for the application windows', + '', + '', + '', + '', + false + ), + 'scrHeight' => array( + 'type' => 'input', + 'Default height for the windows', + 'scrHeight', + 'Select the default height for the application windows', + '', + '', + '', + '', + false + ) ); - - create_input_box( - 'Default width for the windows', - 'scrWidth', - 'Select the default width for the application windows', - '', - '', - '', - '', - false - ); - - create_input_box( - 'Default height for the windows', - 'scrHeight', - 'Select the default height for the application windows', - '', - '', - '', - '', - false - ); - - diff --git a/phpgwapi/templates/jerryr/hook_settings.inc.php b/phpgwapi/templates/jerryr/hook_settings.inc.php index 974c36f1fb..bbd552be43 100644 --- a/phpgwapi/templates/jerryr/hook_settings.inc.php +++ b/phpgwapi/templates/jerryr/hook_settings.inc.php @@ -10,7 +10,13 @@ \**************************************************************************/ /* $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( 'Max number of icons in navbar', @@ -24,11 +30,6 @@ 'Automatically hide the Sidebox menu\'s?' ); - $click_or_onmouseover = array( - 'click' => lang('Click'), - 'onmouseover' => lang('On Mouse Over') - ); - create_select_box( 'Click or Mouse Over to show menus', 'click_or_onmouseover', diff --git a/phpgwapi/templates/prisma/hook_settings.inc.php b/phpgwapi/templates/prisma/hook_settings.inc.php index e2ca6d8d49..20b9ff502a 100644 --- a/phpgwapi/templates/prisma/hook_settings.inc.php +++ b/phpgwapi/templates/prisma/hook_settings.inc.php @@ -10,58 +10,63 @@ \**************************************************************************/ /* $Id$ */ - create_section('Preferences for the idots template set'); $start_and_logout_icons = array( - 'yes' => lang('yes'), - 'no' => lang('no') + 'yes' => lang('yes'), + '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' => lang('Click'), 'onmouseover' => lang('On Mouse Over') ); - create_select_box( - 'Click or Mouse Over to show menus', - 'click_or_onmouseover', - $click_or_onmouseover, - 'Click or Mouse Over to show menus?' - ); - - create_check_box( - 'Disable slider effects', - '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.' - ); - - create_check_box( - 'Disable Internet Explorer png-image-bugfix', - 'disable_pngfix', - 'Disable the execution a bugfixscript for Internet Explorer 5.5 and higher to show transparency in PNG-images?' - ); - - create_check_box( - 'Show page generation time', - 'show_generation_time', - 'Show page generation time on the bottom of the page?' + $GLOBALS['settings'] = array( + 'prismapref' => array( + '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, + 'help' => 'Click or Mouse Over to show menus?' + ), + 'click_or_onmouseover' => 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?' + ) ); diff --git a/preferences/changepassword.php b/preferences/changepassword.php index fc4f5e797b..fbba5fbb78 100755 --- a/preferences/changepassword.php +++ b/preferences/changepassword.php @@ -19,92 +19,8 @@ ); include('../header.inc.php'); - $n_passwd = $_POST['n_passwd']; - $n_passwd_2 = $_POST['n_passwd_2']; - $o_passwd_2 = $_POST['o_passwd_2']; + $obj = CreateObject('preferences.uichangepassword'); + $obj->index(); - 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('/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(); - } + $GLOBALS['phpgw']->common->phpgw_footer(); ?> diff --git a/preferences/inc/class.bopassword.inc.php b/preferences/inc/class.bopassword.inc.php new file mode 100644 index 0000000000..9bf6d68b0c --- /dev/null +++ b/preferences/inc/class.bopassword.inc.php @@ -0,0 +1,74 @@ + * + * -------------------------------------------- * + * 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; + } + } + } +?> diff --git a/preferences/inc/class.bosettings.inc.php b/preferences/inc/class.bosettings.inc.php new file mode 100644 index 0000000000..5109fad56d --- /dev/null +++ b/preferences/inc/class.bosettings.inc.php @@ -0,0 +1,252 @@ + 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=
"; print_r($repository[$_appname]); echo "
\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; + } + } + } diff --git a/preferences/inc/class.uipassword.inc.php b/preferences/inc/class.uipassword.inc.php new file mode 100644 index 0000000000..9cc1d4b8bd --- /dev/null +++ b/preferences/inc/class.uipassword.inc.php @@ -0,0 +1,118 @@ + * + * -------------------------------------------- * + * 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(); + } + } + } +?> diff --git a/preferences/inc/class.uisettings.inc.php b/preferences/inc/class.uisettings.inc.php new file mode 100755 index 0000000000..7dc791ae42 --- /dev/null +++ b/preferences/inc/class.uisettings.inc.php @@ -0,0 +1,569 @@ + 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=
"; print_r($this->bo->prefs); echo "
\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 ? '' : ''); + + if(!$this->list_shown) + { + $this->show_list(); + } + $this->t->pfp('phpgw_body','preferences'); + + //echo '
'; print_r($GLOBALS['egw']->preferences->data); echo "
\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 != '' ? ' '.lang('default').': '.$def_text.'' : ''; + } + $this->t->set_var('row_value',"$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 .= ''; + break; + case 'default': + $s = ''; + break; + case 'forced': + $s = ''; + break; + } + $s .= $this->create_option_string($default,$values); + if($GLOBALS['type'] == 'user') + { + $def_text = $GLOBALS['egw']->preferences->default[$_appname][$name]; + $def_text = $def_text != '' ? ' '.lang('default').': '.$values[$def_text].'' : ''; + } + $this->t->set_var('row_value',"$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 .= '

'.lang('Substitutions and their meanings:').''; + foreach($vars as $var => $var_help) + { + $lname = ($lname = lang($var)) == $var.'*' ? $var : $lname; + $help .= "
\n".'$$'.$lname.'$$: '.$var_help; + } + $help .= "

\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 != '' ? '
'.lang('default').':
'.nl2br($def_text).'
' : ''; + } + $this->t->set_var('row_value',"$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=' ') + { + $this->t->set_var('list_header',$header); + $this->t->parse('lists','list',$this->list_shown); + + $this->t->set_var('rows',''); + $this->list_shown = True; + } + } diff --git a/preferences/inc/hook_preferences.inc.php b/preferences/inc/hook_preferences.inc.php index fde18c4043..ba97454299 100644 --- a/preferences/inc/hook_preferences.inc.php +++ b/preferences/inc/hook_preferences.inc.php @@ -14,9 +14,9 @@ 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); ?> diff --git a/preferences/inc/hook_settings.inc.php b/preferences/inc/hook_settings.inc.php index 16d9206e55..28595b0218 100755 --- a/preferences/inc/hook_settings.inc.php +++ b/preferences/inc/hook_settings.inc.php @@ -11,36 +11,28 @@ /* $Id$ */ + /* Setup some values to fill the array of this app's settings below */ $templates = $GLOBALS['egw']->common->list_templates(); - while (list($var,$value) = each($templates)) + foreach($templates as $var => $value) { $_templates[$var] = $templates[$var]['title']; } $themes = $GLOBALS['egw']->common->list_themes(); - while (list(,$value) = each($themes)) + foreach($themes as $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.
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( 'icons' => lang('Icons only'), 'icons_and_text' => lang('Icons and text'), '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 = ($format ? $format : 'Y/m/d') . ', '; - if ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12') + if($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12') { $format .= 'h:i a'; } @@ -48,13 +40,11 @@ { $format .= 'H:i'; } - for ($i = -23; $i<24; $i++) + for($i = -23; $i<24; $i++) { $t = time() + $i * 60*60; $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.
If you are in the same time zone as the server select 0 hours, else select your locale date and time.'); $date_formats = array( 'm/d/Y' => 'm/d/Y', @@ -71,52 +61,29 @@ '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( '12' => lang('12 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'); - 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(); - create_select_box('Language','lang',$langs, - 'Select the language of texts and messages within eGroupWare.
Some languages may not contain all messages, in that case you will see an english message.'); - // preference.php handles this function - if (is_admin()) + foreach($GLOBALS['egw_info']['user']['apps'] as $app) { - 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'])) - { - if ($GLOBALS['egw_info']['apps'][$app]['status'] != 2 && $app) + $app = $app[0]; + 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); } } - 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.
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( 'selectbox' => lang('Selectbox'), 'primary_group' => lang('Selectbox with primary group and 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( 'firstname' => lang('Firstname'). ' '.lang('Lastname'), @@ -126,8 +93,139 @@ 'lastall' => lang('Lastname').', '.lang('Firstname').' ['.lang('username').']', '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', - 'Should this help messages shown up always, when you enter the preferences or only on request.'); + /* 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.
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.
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.
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.
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 + ) + ); diff --git a/preferences/templates/default/preferences.tpl b/preferences/templates/default/preferences.tpl index 99cba0a48c..71b160a0c5 100644 --- a/preferences/templates/default/preferences.tpl +++ b/preferences/templates/default/preferences.tpl @@ -18,7 +18,8 @@ -   +   +     {help_button}