From d2d4ce40c678f7d7cb5bab76dc4792c5a0888966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gr=C3=BCnewald?= Date: Thu, 2 Apr 2020 13:12:23 +0200 Subject: [PATCH 1/2] optionally show names of participants on an appointment --- calendar/inc/class.calendar_hooks.inc.php | 961 +++++++++++----------- calendar/inc/class.calendar_ui.inc.php | 419 +++++----- calendar/js/et2_widget_event.js | 408 +++++---- calendar/lang/egw_de.lang | 2 + calendar/lang/egw_en.lang | 2 + 5 files changed, 937 insertions(+), 855 deletions(-) diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index a6afcd3929b..3b0558ba0c4 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -28,46 +28,46 @@ class calendar_hooks */ static function search_link($location) { - unset($location); // not used, but in function signature for hooks + unset($location); // not used, but in function signature for hooks return array( - 'query' => 'calendar.calendar_bo.link_query', - 'title' => 'calendar.calendar_bo.link_title', - 'view' => array( + 'query' => 'calendar.calendar_bo.link_query', + 'title' => 'calendar.calendar_bo.link_title', + 'view' => array( 'menuaction' => 'calendar.calendar_uiforms.edit', ), - 'view_id' => 'cal_id', - 'view_popup' => '850x590', - 'edit_popup' => '850x590', - 'list' => array( + 'view_id' => 'cal_id', + 'view_popup' => '850x590', + 'edit_popup' => '850x590', + 'list' => array( 'menuaction' => 'calendar.calendar_uiviews.index', - 'view' => 'listview', - 'ajax'=>'true' + 'view' => 'listview', + 'ajax' => 'true' ), // If calendar is not loaded, load it first, then add - 'add' => 'javascript:var promise = framework.setActiveApp(framework.getApplicationByName(\'calendar\')); if(promise) {promise.then(function() {et2_call(\'app.calendar.add\',params);});} else { app.calendar.add(params);}', - 'add_app' => 'link_app', - 'add_id' => 'link_id', - 'file_access' => 'calendar.calendar_bo.file_access', - 'file_access_user' => true, // file_access supports 4th parameter $user - 'mime' => array( - 'text/calendar' => array( - 'menuaction' => 'calendar.calendar_uiforms.edit', - 'mime_data' => 'ical_data', - 'mime_url' => 'ical_url', - 'mime_popup' => '850x590', + 'add' => 'javascript:var promise = framework.setActiveApp(framework.getApplicationByName(\'calendar\')); if(promise) {promise.then(function() {et2_call(\'app.calendar.add\',params);});} else { app.calendar.add(params);}', + 'add_app' => 'link_app', + 'add_id' => 'link_id', + 'file_access' => 'calendar.calendar_bo.file_access', + 'file_access_user' => true, // file_access supports 4th parameter $user + 'mime' => array( + 'text/calendar' => array( + 'menuaction' => 'calendar.calendar_uiforms.edit', + 'mime_data' => 'ical_data', + 'mime_url' => 'ical_url', + 'mime_popup' => '850x590', 'mime_target' => '_blank' ), 'application/ics' => array( - 'menuaction' => 'calendar.calendar_uiforms.edit', - 'mime_data' => 'ical_data', - 'mime_url' => 'ical_url', - 'mime_popup' => '850x590', + 'menuaction' => 'calendar.calendar_uiforms.edit', + 'mime_data' => 'ical_data', + 'mime_url' => 'ical_url', + 'mime_popup' => '850x590', 'mime_target' => '_blank' ), ), - 'merge' => true, - 'entry' => 'Event', - 'entries' => 'Events', + 'merge' => true, + 'entry' => 'Event', + 'entries' => 'Events', ); } @@ -79,7 +79,7 @@ static function search_link($location) */ static function getAppExportLimit($location) { - unset($location); // not used, but in function signature for hooks + unset($location); // not used, but in function signature for hooks return $GLOBALS['egw_info']['server']['calendar_export_limit']; } @@ -89,13 +89,13 @@ static function getAppExportLimit($location) static function admin() { $file = Array( - 'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), - 'Custom fields' => Egw::link('/index.php','menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), - 'Global Categories' => Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), - 'Category ACL' => Egw::link('/index.php','menuaction=calendar.calendar_uiforms.cat_acl'), - 'Update timezones' => Egw::link('/index.php','menuaction=calendar.calendar_timezones.update'), + 'Site Configuration' => Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=calendar&ajax=true'), + 'Custom fields' => Egw::link('/index.php', 'menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), + 'Global Categories' => Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), + 'Category ACL' => Egw::link('/index.php', 'menuaction=calendar.calendar_uiforms.cat_acl'), + 'Update timezones' => Egw::link('/index.php', 'menuaction=calendar.calendar_timezones.update'), ); - display_section('calendar','calendar',$file); + display_section('calendar', 'calendar', $file); } /** @@ -105,7 +105,7 @@ static function admin() */ static function settings($hook_data) { - if (!$hook_data['setup']) // does not work on setup time + if(!$hook_data['setup']) // does not work on setup time { $bo = new calendar_bo(); $bo->check_set_default_prefs(); @@ -115,12 +115,12 @@ static function settings($hook_data) '0' => lang('No'), ); $list_views = array( - 0 => lang('None'), + 0 => lang('None'), 'month' => lang('Monthview'), 'weekN' => lang('Multiple week view'), - 'week' => lang('Weekview'), - 'day4' => lang('Four days view'), - 'day' => lang('Dayview'), + 'week' => lang('Weekview'), + 'day4' => lang('Four days view'), + 'day' => lang('Dayview'), ); $updates = array( 'no' => lang('Never'), @@ -136,23 +136,23 @@ static function settings($hook_data) 'ical' => lang('iCal / rfc2445'), ); $event_details = array( - 'to-fullname' => lang('Fullname of person to notify'), - 'to-firstname'=> lang('Firstname of person to notify'), - 'to-lastname' => lang('Lastname of person to notify'), - 'title' => lang('Title of the event'), - 'description' => lang('Description'), - 'startdate' => lang('Start Date/Time'), - 'enddate' => lang('End Date/Time'), - 'olddate' => lang('Old Startdate'), - 'category' => lang('Category'), - 'location' => lang('Location'), - 'priority' => lang('Priority'), - 'participants'=> lang('Participants'), - 'owner' => lang('Owner'), - 'repetition' => lang('Repetitiondetails (or empty)'), - 'action' => lang('Action that caused the notify: Added, Canceled, Accepted, Rejected, ...'), - 'link' => lang('Link to view the event'), - 'disinvited' => lang('Participants uninvited from an event'), + 'to-fullname' => lang('Fullname of person to notify'), + 'to-firstname' => lang('Firstname of person to notify'), + 'to-lastname' => lang('Lastname of person to notify'), + 'title' => lang('Title of the event'), + 'description' => lang('Description'), + 'startdate' => lang('Start Date/Time'), + 'enddate' => lang('End Date/Time'), + 'olddate' => lang('Old Startdate'), + 'category' => lang('Category'), + 'location' => lang('Location'), + 'priority' => lang('Priority'), + 'participants' => lang('Participants'), + 'owner' => lang('Owner'), + 'repetition' => lang('Repetitiondetails (or empty)'), + 'action' => lang('Action that caused the notify: Added, Canceled, Accepted, Rejected, ...'), + 'link' => lang('Link to view the event'), + 'disinvited' => lang('Participants uninvited from an event'), ); $weekdaystarts = array( 'Monday' => lang('Monday'), @@ -165,56 +165,56 @@ static function settings($hook_data) 'holiday' => lang('Holidays') ); - if (!isset($hook_data['setup'])) + if(!isset($hook_data['setup'])) { $times = Api\Etemplate\Widget\Select::typeOptions('select-hour', ''); $default_cat_seloptions = Api\Etemplate\Widget\Select::typeOptions('select-cat', ',,,calendar'); } - for ($i = 2; $i <= 9; ++$i) + for($i = 2; $i <= 9; ++$i) { - $muliple_weeks[$i] = lang('%1 weeks',$i); + $muliple_weeks[$i] = lang('%1 weeks', $i); } - for ($i = 2; $i <= 20; $i++) + for($i = 2; $i <= 20; $i++) { $consolidated[$i] = $i; } $intervals = array( - 5 => '5', - 10 => '10', - 15 => '15', - 20 => '20', - 30 => '30', - 45 => '45', - 60 => '60' + 5 => '5', + 10 => '10', + 15 => '15', + 20 => '20', + 30 => '30', + 45 => '45', + 60 => '60' ); $default_participants = array( - 0 => lang('Just me'), + 0 => lang('Just me'), 'selected' => lang('Selected users/groups') ); $defaultresource_sel = array( - 'resources_conflict' => lang('resources with conflict detection'), - 'resources_without_conflict' => lang('resources except conflicting ones') + 'resources_conflict' => lang('resources with conflict detection'), + 'resources_without_conflict' => lang('resources except conflicting ones') ); $reset_stati_on_shifts = array( - 'no' => lang('Never'), - 'all' => lang('Always'), - 'startday' => lang('If start day differs'), + 'no' => lang('Never'), + 'all' => lang('Always'), + 'startday' => lang('If start day differs'), ); $freebusy_values = array( - 0 => lang('No'), - 1 => lang('Yes'), - 2 => lang('With credentials included'), + 0 => lang('No'), + 1 => lang('Yes'), + 2 => lang('With credentials included'), ); - if (!$hook_data['setup']) // does not work at setup time + if(!$hook_data['setup']) // does not work at setup time { $options = array('0' => lang('none')); - foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group) + foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups', 'app' => 'calendar')) as $group) { $options[$group['account_id']] = Api\Accounts::username($group['account_id']); } - $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); - $freebusy_url = ''.$freebusy_url.''; + $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'], $GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); + $freebusy_url = '' . $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'); $freebusy_help .= ' ' . $freebusy_url; @@ -224,12 +224,12 @@ static function settings($hook_data) } $link_title_options = calendar_bo::get_link_options(); $settings = array( - '1.section' => array( - 'type' => 'section', - 'title' => lang('General settings'), - 'no_lang'=> true, - 'xmlrpc' => False, - 'admin' => False + '1.section' => array( + 'type' => 'section', + 'title' => lang('General settings'), + 'no_lang' => true, + 'xmlrpc' => False, + 'admin' => False ), /* disabled until we have a home app again 'mainscreen_showevents' => array( @@ -242,17 +242,17 @@ static function settings($hook_data) 'admin' => False, 'default'=> '1', // 1 = week ),*/ - 'multiple_weeks' => array( - 'type' => 'select', - 'label' => 'Weeks in multiple week view', - 'name' => 'multiple_weeks', - 'values' => $muliple_weeks, - 'help' => 'How many weeks should the multiple week view show?', - 'xmlrpc' => True, - 'admin' => False, - 'default'=> 2, - ), - 'weekdaystarts' => array( + 'multiple_weeks' => array( + 'type' => 'select', + 'label' => 'Weeks in multiple week view', + 'name' => 'multiple_weeks', + 'values' => $muliple_weeks, + 'help' => 'How many weeks should the multiple week view show?', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 2, + ), + 'weekdaystarts' => array( 'type' => 'select', 'label' => 'weekday starts on', 'name' => 'weekdaystarts', @@ -262,191 +262,198 @@ static function settings($hook_data) 'admin' => False, 'forced' => 'Monday', ), - 'workdaystarts' => array( - 'type' => 'select', - 'label' => 'work day starts on', - 'name' => 'workdaystarts', - 'values' => $times, - '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, - 'default'=> 9, - ), - 'workdayends' => array( - 'type' => 'select', - 'label' => 'work day ends on', - 'name' => 'workdayends', - 'values' => $times, - 'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.', - 'xmlrpc' => True, - 'admin' => False, - 'default'=> 18, - ), - 'interval' => array( - 'type' => 'select', - 'label' => 'Length of the time interval', - 'name' => 'interval', - 'values' => $intervals, - 'help' => 'How many minutes should each interval last?', - 'xmlrpc' => True, - 'admin' => False, - 'default'=> 30, - ), - 'day_consolidate' => array( - 'type' => 'select', - 'label' => 'Minimum number of users for showing day view as consolidated.', - 'name' => 'day_consolidate', - 'values'=> $consolidated, - 'help' => 'How many separate calendars to show before merging them together', - 'default'=> 6 - ), - 'week_consolidate' => array( - 'type' => 'select', - 'label' => 'Minimum number of users for showing week view as consolidated.', - 'name' => 'week_consolidate', - 'values'=> $consolidated, - 'help' => 'How many separate calendars to show before merging them together', - 'default'=> 4 - ), - 'use_time_grid' => array( - 'type' => 'multiselect', - 'label' => 'Views showing a list of events', - 'name' => 'use_time_grid', - 'values' => $list_views, - 'help' => 'For which views should calendar just a list of events instead of distinct lines with a fixed time interval.', - 'xmlrpc' => True, - 'admin' => False, + 'workdaystarts' => array( + 'type' => 'select', + 'label' => 'work day starts on', + 'name' => 'workdaystarts', + 'values' => $times, + '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, + 'default' => 9, + ), + 'workdayends' => array( + 'type' => 'select', + 'label' => 'work day ends on', + 'name' => 'workdayends', + 'values' => $times, + 'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 18, + ), + 'interval' => array( + 'type' => 'select', + 'label' => 'Length of the time interval', + 'name' => 'interval', + 'values' => $intervals, + 'help' => 'How many minutes should each interval last?', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 30, + ), + 'day_consolidate' => array( + 'type' => 'select', + 'label' => 'Minimum number of users for showing day view as consolidated.', + 'name' => 'day_consolidate', + 'values' => $consolidated, + 'help' => 'How many separate calendars to show before merging them together', + 'default' => 6 + ), + 'week_consolidate' => array( + 'type' => 'select', + 'label' => 'Minimum number of users for showing week view as consolidated.', + 'name' => 'week_consolidate', + 'values' => $consolidated, + 'help' => 'How many separate calendars to show before merging them together', + 'default' => 4 + ), + 'use_time_grid' => array( + 'type' => 'multiselect', + 'label' => 'Views showing a list of events', + 'name' => 'use_time_grid', + 'values' => $list_views, + 'help' => 'For which views should calendar just a list of events instead of distinct lines with a fixed time interval.', + 'xmlrpc' => True, + 'admin' => False, 'default' => ['weekN', 'month'], ), 'auto_update_on_sidebox_change' => array( - 'type' => 'check', - 'label' => 'Update calendar view immediately when navigation calendar in sidebox is changed', - 'name' => 'auto_update_on_sidebox_change', - 'help' => 'When changing the month', - 'default'=> false - ), - '2.section' => array( - 'type' => 'section', - 'title' => lang('appointment settings'), - 'no_lang'=> true, - 'xmlrpc' => False, - 'admin' => False + 'type' => 'check', + 'label' => 'Update calendar view immediately when navigation calendar in sidebox is changed', + 'name' => 'auto_update_on_sidebox_change', + 'help' => 'When changing the month', + 'default' => false + ), + '2.section' => array( + 'type' => 'section', + 'title' => lang('appointment settings'), + 'no_lang' => true, + 'xmlrpc' => False, + 'admin' => False ), - 'defaultlength' => array( + '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, - 'default'=> 60, - ), - 'default_participant' => array( - 'type' => 'select', - 'label' => 'New event participants', - 'name' => 'default_participant', - 'values'=> $default_participants, - 'help' => 'Participants automatically added to new events', - 'default' => 'selected', - 'xmlrpc' => False, - 'admin' => False - ), - 'default_category' => array( - 'type' => 'multiselect', - 'label' => 'New event category', - 'name' => 'default_category', - 'help' => 'Category automatically added to new events', - 'values' => $default_cat_seloptions, - 'default' => '', - 'xmlrpc' => False, - 'admin' => False - ), - 'default-alarm' => array( - 'type' => 'date-duration',//'select', - 'label' => lang('Default alarm for regular events').' ('.lang('empty = no alarm').')', - 'name' => 'default-alarm', - 'help' => 'Alarm added automatic to new events before event start-time', - 'xmlrpc' => True, - 'admin' => False, + 'xmlrpc' => True, + 'admin' => False, + 'default' => 60, + ), + 'default_participant' => array( + 'type' => 'select', + 'label' => 'New event participants', + 'name' => 'default_participant', + 'values' => $default_participants, + 'help' => 'Participants automatically added to new events', + 'default' => 'selected', + 'xmlrpc' => False, + 'admin' => False + ), + 'default_category' => array( + 'type' => 'multiselect', + 'label' => 'New event category', + 'name' => 'default_category', + 'help' => 'Category automatically added to new events', + 'values' => $default_cat_seloptions, + 'default' => '', + 'xmlrpc' => False, + 'admin' => False + ), + 'default-alarm' => array( + 'type' => 'date-duration',//'select', + 'label' => lang('Default alarm for regular events') . ' (' . lang('empty = no alarm') . ')', + 'name' => 'default-alarm', + 'help' => 'Alarm added automatic to new events before event start-time', + 'xmlrpc' => True, + 'admin' => False, 'default' => '', ), - 'default-alarm-wholeday' => array( - 'type' => 'date-duration',//'select', - 'label' => lang('Default alarm for whole-day events').' ('.lang('empty = no alarm').')', - 'name' => 'default-alarm-wholeday', - 'help' => lang('Alarm added automatic to new events before event start-time').' ('.lang('Midnight').')', - 'xmlrpc' => True, - 'admin' => False, + 'default-alarm-wholeday' => array( + 'type' => 'date-duration',//'select', + 'label' => lang('Default alarm for whole-day events') . ' (' . lang('empty = no alarm') . ')', + 'name' => 'default-alarm-wholeday', + 'help' => lang('Alarm added automatic to new events before event start-time') . ' (' . lang('Midnight') . ')', + 'xmlrpc' => True, + 'admin' => False, 'default' => '', ), ); - if (isset($bo)) // add custom time-spans set by CalDAV clients, not in our prefs + if(isset($bo)) // add custom time-spans set by CalDAV clients, not in our prefs { $prefs = $GLOBALS['egw_info']['user']['preferences']['calendar']; $data = array( - 'prefs' => &$prefs, // use reference to get preference value back + 'prefs' => &$prefs, // use reference to get preference value back 'preprocess' => true, - 'type' => 'user', + 'type' => 'user', ); self::verify_settings_reference($data); } $settings += array( - 'defaultresource_sel' => array( - 'type' => 'select', - 'label' => 'default type of resources selection', - 'name' => 'defaultresource_sel', - 'values' => $defaultresource_sel, - 'help' => 'Default type of resources application selected in the calendar participants research form.', - 'xmlrpc' => True, - 'admin' => False, - 'default' => 'resources' - ), - 'default_private' => array( - 'type' => 'check', - 'label' => 'Set new events to private', - 'name' => 'default_private', - 'help' => 'Should new events created as private by default ?', + 'defaultresource_sel' => array( + 'type' => 'select', + 'label' => 'default type of resources selection', + 'name' => 'defaultresource_sel', + 'values' => $defaultresource_sel, + 'help' => 'Default type of resources application selected in the calendar participants research form.', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 'resources' + ), + '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, 'forced' => '0', ), - 'reset_stati' => array( - 'type' => 'select', - 'label' => 'Reset participant stati on event shifts', - 'name' => 'reset_stati', - 'help' => 'Select whether you want the participant stati reset to unknown, if an event is shifted later on.', - 'values' => $reset_stati_on_shifts, + 'reset_stati' => array( + 'type' => 'select', + 'label' => 'Reset participant stati on event shifts', + 'name' => 'reset_stati', + 'help' => 'Select whether you want the participant stati reset to unknown, if an event is shifted later on.', + 'values' => $reset_stati_on_shifts, 'default' => 'all', - 'xmlrpc' => True, - 'admin' => False, + 'xmlrpc' => True, + 'admin' => False, ), 'no_category_custom_color' => array( - 'type' => 'color', - 'label' => 'Custom event color', + 'type' => 'color', + 'label' => 'Custom event color', 'no_lang' => true, - 'name' => 'no_category_custom_color', - 'help' => lang('Custom color for events without category color'), - 'xmlrpc' => True, - 'admin' => False, - ), - '2.5.section' => array( - 'type' => 'section', - 'title' => lang('Configuration settings'), - 'no_lang'=> true, - 'xmlrpc' => False, - 'admin' => False - ), - 'new_event_dialog' => array( - 'type' => 'select', - 'label' => 'Add appointments via shortened dialog or complete edit window', - 'name' => 'new_event_dialog', - 'values'=> array('add' => lang('Quick add'), 'edit' => lang('Regular edit')), - 'help' => 'Use quick add or full edit dialog when creating a new event', - 'default' => 'add', - ), - 'limit_des_lines' => array( + 'name' => 'no_category_custom_color', + 'help' => lang('Custom color for events without category color'), + 'xmlrpc' => True, + 'admin' => False, + ), + 'participant_names' => array( + 'type' => 'check', + 'label' => 'Show participant names on event', + 'name' => 'participant_names', + 'help' => 'Controls whether names of participants are shown alongside the title of an appointment.', + 'default' => false + ), + '2.5.section' => array( + 'type' => 'section', + 'title' => lang('Configuration settings'), + 'no_lang' => true, + 'xmlrpc' => False, + 'admin' => False + ), + 'new_event_dialog' => array( + 'type' => 'select', + 'label' => 'Add appointments via shortened dialog or complete edit window', + 'name' => 'new_event_dialog', + 'values' => array('add' => lang('Quick add'), 'edit' => lang('Regular edit')), + 'help' => 'Use quick add or full edit dialog when creating a new event', + 'default' => 'add', + ), + 'limit_des_lines' => array( 'type' => 'input', 'size' => 5, 'label' => 'Limit number of description lines in list view (default 5, 0 for no limit)', @@ -455,22 +462,22 @@ static function settings($hook_data) 'xmlrpc' => True, 'admin' => False ), - 'limit_all_day_lines' => array( - 'type' => 'input', - 'size' => 5, - 'label' => 'Limit number of lines for all day events', - 'name' => 'limit_all_day_lines', - 'help' => 'How many lines of all day events should be directly visible. Further lines are available via a mouseover.', - 'xmlrpc' => True, - 'default'=> 3, - 'admin' => False - ), - 'planner_show_empty_rows' => array( + 'limit_all_day_lines' => array( + 'type' => 'input', + 'size' => 5, + 'label' => 'Limit number of lines for all day events', + 'name' => 'limit_all_day_lines', + 'help' => 'How many lines of all day events should be directly visible. Further lines are available via a mouseover.', + 'xmlrpc' => True, + 'default' => 3, + 'admin' => False + ), + 'planner_show_empty_rows' => array( 'type' => 'select', 'label' => 'Show empty rows in Planner', 'name' => 'planner_show_empty_rows', 'values' => array( - 0 => lang('no'), + 0 => lang('no'), 'user' => lang('Planner by user'), 'cat' => lang('Planner by category'), 'both' => lang('All'), @@ -480,71 +487,71 @@ static function settings($hook_data) 'admin' => False, 'forced' => 'user', ), - 'birthdays_as_events' => array( - 'type' => 'multiselect', - 'values' => $birthdays_as_events, - 'label' => 'Show birthdays as events', - 'name' => 'birthdays_as_events', - 'help' => 'Show birthdays as all day non-blocking events as well as via mouseover of the date.', - 'default'=> 'none' - ), - 'link_title' => array( - 'type' => 'multiselect', - 'label' => 'Link title for events to show', - 'name' => 'link_title', - 'values' => $link_title_options, - 'help' => 'What should links to the calendar events display in other applications.', - 'xmlrpc' => True, - 'admin' => false, - 'default'=> '', + 'birthdays_as_events' => array( + 'type' => 'multiselect', + 'values' => $birthdays_as_events, + 'label' => 'Show birthdays as events', + 'name' => 'birthdays_as_events', + 'help' => 'Show birthdays as all day non-blocking events as well as via mouseover of the date.', + 'default' => 'none' + ), + 'link_title' => array( + 'type' => 'multiselect', + 'label' => 'Link title for events to show', + 'name' => 'link_title', + 'values' => $link_title_options, + 'help' => 'What should links to the calendar events display in other applications.', + 'xmlrpc' => True, + 'admin' => false, + 'default' => '', ), - '3.section' => array( - 'type' => 'section', - 'title' => lang('notification settings'), - 'no_lang'=> true, - 'xmlrpc' => False, - '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, - 'default'=> 'time_change', - ), - 'receive_own_updates' => array( - 'type' => 'select', - 'label' => 'Receive notifications about events you created/modified/deleted', - 'name' => 'receive_own_updates', - 'values' => $yesno, - 'help' => "Do you want to be notified about changes of appointments you modified?", - 'xmlrpc' => True, - 'admin' => False, - 'default'=> 'false', + '3.section' => array( + 'type' => 'section', + 'title' => lang('notification settings'), + 'no_lang' => true, + 'xmlrpc' => False, + '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, + 'default' => 'time_change', + ), + 'receive_own_updates' => array( + 'type' => 'select', + 'label' => 'Receive notifications about events you created/modified/deleted', + 'name' => 'receive_own_updates', + 'values' => $yesno, + 'help' => "Do you want to be notified about changes of appointments you modified?", + 'xmlrpc' => True, + 'admin' => False, + 'default' => 'false', ), 'receive_not_participating' => array( - 'type' => 'select', - 'label' => 'Do you want responses from events you created, but are not participating in?', - 'name' => 'receive_not_participating', - 'values' => $yesno, - 'help' => 'Do you want to be notified about participant responses from events you created, but are not participating in?', - 'default'=> '1' - ), - 'notify_externals' => array( - 'type' => 'select', - 'label' => 'Notify non-EGroupware users about event updates', - 'name' => 'notify_externals', - 'values' => $updates, - 'help' => 'Do you want non-EGroupware participants of events you created to be automatically notified about new or changed appointments?', - 'xmlrpc' => True, - 'admin' => False, - 'default'=> 'no', - ), - 'update_format' => array( + 'type' => 'select', + 'label' => 'Do you want responses from events you created, but are not participating in?', + 'name' => 'receive_not_participating', + 'values' => $yesno, + 'help' => 'Do you want to be notified about participant responses from events you created, but are not participating in?', + 'default' => '1' + ), + 'notify_externals' => array( + 'type' => 'select', + 'label' => 'Notify non-EGroupware users about event updates', + 'name' => 'notify_externals', + 'values' => $updates, + 'help' => 'Do you want non-EGroupware participants of events you created to be automatically notified about new or changed appointments?', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 'no', + ), + 'update_format' => array( 'type' => 'select', 'label' => 'Format of event updates', 'name' => 'update_format', @@ -554,146 +561,146 @@ static function settings($hook_data) 'admin' => False, 'forced' => 'ical', ), - '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.', + '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, + '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', - 'label' => 'Notification messages for modified events', - 'name' => 'notifyModified', - 'rows' => 5, - 'cols' => 50, - 'help' => 'This message is sent for modified or moved events.', - 'default' => '', - 'values' => $event_details, + 'xmlrpc' => True, + 'admin' => False, + ), + 'notifyModified' => array( + 'type' => 'notify', + 'label' => 'Notification messages for modified events', + 'name' => '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, - ), - 'notifyDisinvited' => array( - 'type' => 'notify', - 'label' => 'Notification messages for uninvited participants', - 'name' => 'notifyDisinvited', - 'rows' => 5, - 'cols' => 50, - 'help' => 'This message is sent to uninvited participants.', - 'values' => $event_details, + 'xmlrpc' => True, + 'admin' => False, + ), + 'notifyDisinvited' => array( + 'type' => 'notify', + 'label' => 'Notification messages for uninvited participants', + 'name' => 'notifyDisinvited', + 'rows' => 5, + 'cols' => 50, + 'help' => 'This message is sent to uninvited participants.', + '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.', - 'values' => $event_details, + '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.', + '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.', - 'values' => $event_details, + '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.', + 'values' => $event_details, 'subst_help' => False, - 'xmlrpc' => True, - 'admin' => False, + 'xmlrpc' => True, + 'admin' => False, ), - '4.section' => array( - 'type' => 'section', - 'title' => lang('Data exchange settings'), - 'no_lang'=> true, - 'xmlrpc' => False, - 'admin' => False + '4.section' => array( + 'type' => 'section', + 'title' => lang('Data exchange settings'), + 'no_lang' => true, + 'xmlrpc' => False, + 'admin' => False ), ); // Merge print - if ($GLOBALS['egw_info']['user']['apps']['filemanager']) + if($GLOBALS['egw_info']['user']['apps']['filemanager']) { $settings['default_document'] = array( - 'type' => 'vfs_file', - 'size' => 60, - 'label' => 'Default document to insert entries', - 'name' => 'default_document', - 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('calendar')).' '. - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), + 'type' => 'vfs_file', + 'size' => 60, + 'label' => 'Default document to insert entries', + 'name' => 'default_document', + 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('calendar')) . ' ' . + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title') . ' ' . + lang('The following document-types are supported:') . implode(',', Api\Storage\Merge::get_file_extensions()), 'run_lang' => false, - 'xmlrpc' => True, - 'admin' => False, + 'xmlrpc' => True, + 'admin' => False, ); $settings['document_dir'] = array( - 'type' => 'vfs_dirs', - 'size' => 60, - 'label' => 'Directory with documents to insert entries', - 'name' => 'document_dir', - 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('calendar')).' '. - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), + 'type' => 'vfs_dirs', + 'size' => 60, + 'label' => 'Directory with documents to insert entries', + 'name' => 'document_dir', + 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.', lang('calendar')) . ' ' . + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title') . ' ' . + lang('The following document-types are supported:') . implode(',', Api\Storage\Merge::get_file_extensions()), 'run_lang' => false, - 'xmlrpc' => True, - 'admin' => False, - 'default' => '/templates/calendar', + 'xmlrpc' => True, + 'admin' => False, + 'default' => '/templates/calendar', ); } $settings += array( 'export_timezone' => array( - 'type' => 'select', - 'label' => 'Timezone of event iCal file import/export', - 'name' => 'export_timezone', - 'values' => $export_tzs, - 'help' => 'Use this timezone to import/export calendar data.', - 'xmlrpc' => True, - 'admin' => False, + 'type' => 'select', + 'label' => 'Timezone of event iCal file import/export', + 'name' => 'export_timezone', + 'values' => $export_tzs, + 'help' => 'Use this timezone to import/export calendar data.', + 'xmlrpc' => True, + 'admin' => False, 'default' => '0', // Use event's TZ ), - 'freebusy' => array( - 'type' => 'select', - 'label' => 'Make freebusy information available to not logged in persons?', - 'name' => 'freebusy', - 'help' => $freebusy_help, - 'values' => $freebusy_values, - 'run_lang' => false, + 'freebusy' => array( + 'type' => 'select', + 'label' => 'Make freebusy information available to not logged in persons?', + 'name' => 'freebusy', + 'help' => $freebusy_help, + 'values' => $freebusy_values, + 'run_lang' => false, 'subst_help' => False, - 'xmlrpc' => True, - 'admin' => False, - 'forced' => 0, + 'xmlrpc' => True, + 'admin' => False, + 'forced' => 0, ), - '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!!!', + '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, 'forced' => '' @@ -728,30 +735,30 @@ public static function verify_settings_reference(array &$data) { //error_log(__METHOD__."(".array2string($data).")"); // caldav perfs are always user specific and cant by switched off - if ($data['type'] != 'user') return; + if($data['type'] != 'user') return; $account_lid = $GLOBALS['egw_info']['user']['account_lid']; foreach(array( - 'default-alarm' => 'default-alarm-vevent-datetime:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', - 'default-alarm-wholeday' => 'default-alarm-vevent-date:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', - ) as $name => $dav) + 'default-alarm' => 'default-alarm-vevent-datetime:/' . $account_lid . '/:urn:ietf:params:xml:ns:caldav', + 'default-alarm-wholeday' => 'default-alarm-vevent-date:/' . $account_lid . '/:urn:ietf:params:xml:ns:caldav', + ) as $name => $dav) { $pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; - if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match + if(true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match $val =& $data['prefs'][$name]; //error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val"); - if ($data['preprocess']) // showing preferences + if($data['preprocess']) // showing preferences { - if (!isset($val)) // no calendar pref --> read value from caldav + if(!isset($val)) // no calendar pref --> read value from caldav { $matches = null; - if (preg_match('/^ACTION:NONE$/mi', $pref)) + if(preg_match('/^ACTION:NONE$/mi', $pref)) { $val = ''; } - elseif (preg_match('/^TRIGGER:-PT(\d+(M|H|D))$/mi', $pref, $matches)) + elseif(preg_match('/^TRIGGER:-PT(\d+(M|H|D))$/mi', $pref, $matches)) { static $factors = array( 'M' => 1, @@ -759,7 +766,7 @@ public static function verify_settings_reference(array &$data) 'D' => 1440, ); $factor = $factors[strtoupper($matches[2])]; - $val = $factor*(int)$matches[1]; + $val = $factor * (int)$matches[1]; } else { @@ -769,9 +776,9 @@ public static function verify_settings_reference(array &$data) //error_log(__METHOD__."() setting $name={$val} from $dav='$pref'"); } } - else // storing preferences + else // storing preferences { - if (empty($pref) || !preg_match('/^TRIGGER:/m', $pref)) + if(empty($pref) || !preg_match('/^TRIGGER:/m', $pref)) { $pref = 'BEGIN:VALARM TRIGGER:-PT1H @@ -780,17 +787,17 @@ public static function verify_settings_reference(array &$data) END:VALARM'; } $trigger = $val < 0 ? 'TRIGGER:PT' : 'TRIGGER:-PT'; - if ((string)$val === '') + if((string)$val === '') { $pref = preg_replace('/^ACTION:.*$/m', 'ACTION:NONE', $pref); } - elseif (abs($val) < 60) + elseif(abs($val) < 60) { - $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val), 0).'M', $pref); + $pref = preg_replace('/^TRIGGER:.*$/m', $trigger . number_format(abs($val), 0) . 'M', $pref); } else { - $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val)/60, 0).'H', $pref); + $pref = preg_replace('/^TRIGGER:.*$/m', $trigger . number_format(abs($val) / 60, 0) . 'H', $pref); } $GLOBALS['egw']->preferences->add('groupdav', $dav, $pref, 'user'); //error_log(__METHOD__."() storing $name=$val --> $dav='$pref'"); @@ -806,9 +813,9 @@ public static function verify_settings_reference(array &$data) public static function sync_default_alarms() { self::verify_settings(array( - 'prefs' => array(), + 'prefs' => array(), 'preprocess' => true, - 'type' => 'user', + 'type' => 'user', )); } @@ -836,7 +843,7 @@ public static function acl_rights($params) ); $require_acl_invite = $GLOBALS['egw_info']['server']['require_acl_invite']; - if (!$require_acl_invite || $require_acl_invite == 'groups' && !($params['owner'] < 0)) + if(!$require_acl_invite || $require_acl_invite == 'groups' && !($params['owner'] < 0)) { unset($rights[Acl::CUSTOM3]); } @@ -851,7 +858,7 @@ public static function acl_rights($params) */ public static function categories($data) { - unset($data); // not used, but in function signature for hooks + unset($data); // not used, but in function signature for hooks return true; } @@ -862,11 +869,11 @@ public static function categories($data) */ public static function mail_import($args) { - unset($args); // not used, but required by function signature + unset($args); // not used, but required by function signature - return array ( + return array( 'menuaction' => 'calendar.calendar_uiforms.mail_import', - 'popup' => Link::get_registry('calendar', 'edit_popup') + 'popup' => Link::get_registry('calendar', 'edit_popup') ); } @@ -876,29 +883,29 @@ public static function mail_import($args) * @param type $params * @return type */ - public static function notifications_actions ($params) + public static function notifications_actions($params) { Api\Translation::add_app('calendar'); // do not set actions for alarm type - if ($params['data']['type'] == 6) return array(); + if($params['data']['type'] == 6) return array(); return array( array( - 'id' => 'A', - 'caption' => lang('Accept'), - 'icon' => 'accepted', - 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",['.$params['data']['event_id'].','.$params['data']['user_id'].','.'"A"'.']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' + 'id' => 'A', + 'caption' => lang('Accept'), + 'icon' => 'accepted', + 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",[' . $params['data']['event_id'] . ',' . $params['data']['user_id'] . ',' . '"A"' . ']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' ), array( - 'id' => 'R', - 'caption' => lang('Reject'), - 'icon' => 'rejected', - 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",['.$params['data']['event_id'].','.$params['data']['user_id'].','.'"R"'.']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' + 'id' => 'R', + 'caption' => lang('Reject'), + 'icon' => 'rejected', + 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",[' . $params['data']['event_id'] . ',' . $params['data']['user_id'] . ',' . '"R"' . ']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' ), array( - 'id' => 'T', - 'caption' => lang('Tentative'), - 'icon' => 'tentative', - 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",['.$params['data']['event_id'].','.$params['data']['user_id'].','.'"T"'.']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' + 'id' => 'T', + 'caption' => lang('Tentative'), + 'icon' => 'tentative', + 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",[' . $params['data']['event_id'] . ',' . $params['data']['user_id'] . ',' . '"T"' . ']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' ) ); } diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 3c5ee71bd9e..eb7de4d14f0 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -33,7 +33,7 @@ class calendar_ui /** * @var $debug mixed integer level or string function-name */ - var $debug=false; + var $debug = false; /** * instance of the bocal or bocalupdate class * @@ -127,7 +127,7 @@ class calendar_ui /** * @var array $states_to_save all states that will be saved to the user prefs */ - var $states_to_save = array('owner','status_filter','filter','cat_id','view','sortby','planner_view','weekend'); + var $states_to_save = array('owner', 'status_filter', 'filter', 'cat_id', 'view', 'sortby', 'planner_view', 'weekend'); /** * Constructor @@ -135,9 +135,9 @@ class calendar_ui * @param boolean $use_boupdate use bocalupdate as parenent instead of bocal * @param array $set_states to manualy set / change one of the states, default NULL = use $_REQUEST */ - function __construct($use_boupdate=false,$set_states=NULL) + function __construct($use_boupdate = false, $set_states = NULL) { - if ($use_boupdate) + if($use_boupdate) { $this->bo = new calendar_boupdate(); } @@ -146,27 +146,27 @@ function __construct($use_boupdate=false,$set_states=NULL) $this->bo = new calendar_bo(); } - $this->categories = new Api\Categories($this->user,'calendar'); + $this->categories = new Api\Categories($this->user, 'calendar'); - $this->common_prefs = &$GLOBALS['egw_info']['user']['preferences']['common']; - $this->cal_prefs = &$GLOBALS['egw_info']['user']['preferences']['calendar']; + $this->common_prefs = &$GLOBALS['egw_info']['user']['preferences']['common']; + $this->cal_prefs = &$GLOBALS['egw_info']['user']['preferences']['calendar']; $this->bo->check_set_default_prefs(); - $this->wd_start = 60*$this->cal_prefs['workdaystarts']; - $this->wd_end = 60*$this->cal_prefs['workdayends']; - $this->interval_m = $this->cal_prefs['interval']; + $this->wd_start = 60 * $this->cal_prefs['workdaystarts']; + $this->wd_end = 60 * $this->cal_prefs['workdayends']; + $this->interval_m = $this->cal_prefs['interval']; $this->user = $GLOBALS['egw_info']['user']['account_id']; $this->manage_states($set_states); - $GLOBALS['uical'] = &$this; // make us available for ExecMethod, else it creates a new instance + $GLOBALS['uical'] = &$this; // make us available for ExecMethod, else it creates a new instance // calendar does not work with hidden sidebox atm. unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); // make sure the hook for export_limit is registered - if (!Api\Hooks::exists('export_limit','calendar')) Api\Hooks::read(true); + if(!Api\Hooks::exists('export_limit', 'calendar')) Api\Hooks::read(true); } /** @@ -179,36 +179,36 @@ function __construct($use_boupdate=false,$set_states=NULL) function check_owners_access($users = null, &$no_access = array()) { $no_access = $no_access_group = array(); - $owner_array = $users ? $users : explode(',',$this->owner); + $owner_array = $users ? $users : explode(',', $this->owner); foreach($owner_array as $idx => $owner) { $owner = trim($owner); - if (is_numeric($owner) && $GLOBALS['egw']->accounts->get_type($owner) == 'g') + if(is_numeric($owner) && $GLOBALS['egw']->accounts->get_type($owner) == 'g') { foreach($GLOBALS['egw']->accounts->members($owner, true) as $member) { - if (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY,0,$member)) + if(!$this->bo->check_perms(Acl::READ | calendar_bo::ACL_READ_FOR_PARTICIPANTS | calendar_bo::ACL_FREEBUSY, 0, $member)) { $no_access_group[$member] = $this->bo->participant_name($member); } } } - elseif (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY,0,$owner)) + elseif(!$this->bo->check_perms(Acl::READ | calendar_bo::ACL_READ_FOR_PARTICIPANTS | calendar_bo::ACL_FREEBUSY, 0, $owner)) { $no_access[$owner] = $this->bo->participant_name($owner); unset($owner_array[$idx]); } } - if (count($no_access)) + if(count($no_access)) { - $message = lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access)); - Framework::message($message,'error'); - $this->owner = implode(',',$owner_array); + $message = lang('Access denied to the calendar of %1 !!!', implode(', ', $no_access)); + Framework::message($message, 'error'); + $this->owner = implode(',', $owner_array); return $message; } - if (count($no_access_group)) + if(count($no_access_group)) { - $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.',implode(', ',$no_access_group)); + $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.', implode(', ', $no_access_group)); } return false; } @@ -218,116 +218,116 @@ function check_owners_access($users = null, &$no_access = array()) * * The state of all these controls is updated if they are set in $_REQUEST or $set_states and saved in the session. * The following states are used: - * - date or year, month, day: the actual date of the period displayed - * - cat_id: the selected category - * - owner: the owner of the displayed calendar - * - save_owner: the overriden owner of the planner - * - status_filter: the used filter: all or hideprivate - * - sortby: category or user of planner - * - view: the actual view, where dialogs should return to or which they refresh + * - date or year, month, day: the actual date of the period displayed + * - cat_id: the selected category + * - owner: the owner of the displayed calendar + * - save_owner: the overriden owner of the planner + * - status_filter: the used filter: all or hideprivate + * - sortby: category or user of planner + * - view: the actual view, where dialogs should return to or which they refresh * @param array $set_states array to manualy set / change one of the states, default NULL = use $_REQUEST */ - function manage_states($set_states=NULL) + function manage_states($set_states = NULL) { // retrieve saved states from prefs $states = is_array($this->bo->cal_prefs['saved_states']) ? $this->bo->cal_prefs['saved_states'] : unserialize($this->bo->cal_prefs['saved_states']); // only look at _REQUEST, if we are in the calendar (prefs and admin show our sidebox menu too!) - if (is_null($set_states)) + if(is_null($set_states)) { // ajax-exec call has get-parameter in some json - if (isset($_REQUEST['json_data']) && ($json_data = json_decode($_REQUEST['json_data'], true)) && + if(isset($_REQUEST['json_data']) && ($json_data = json_decode($_REQUEST['json_data'], true)) && !empty($json_data['request']['parameters'][0])) { - if (is_array($json_data['request']['parameters'][0])) + if(is_array($json_data['request']['parameters'][0])) { //error_log(__METHOD__.__LINE__.array2string($json_data['request']['parameters'][0])); $set_states = $json_data['request']['parameters'][0]; } else { - parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?" + parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?" } } else { - $set_states = substr($_GET['menuaction'],0,9) == 'calendar.' ? $_REQUEST : array(); + $set_states = substr($_GET['menuaction'], 0, 9) == 'calendar.' ? $_REQUEST : array(); } } - if (!$states['date'] && $states['year'] && $states['month'] && $states['day']) + if(!$states['date'] && $states['year'] && $states['month'] && $states['day']) { $states['date'] = $this->bo->date2string($states); } foreach(array( - 'date' => $this->bo->date2string($this->bo->now_su), - 'cat_id' => 0, - 'status_filter' => 'default', - 'owner' => $this->user, - 'save_owner' => 0, - 'sortby' => 'category', - 'planner_view'=> 'month', // full month - 'view' => ($this->bo->cal_prefs['defaultcalendar']?$this->bo->cal_prefs['defaultcalendar']:'day'), // use pref, if exists else use the dayview - 'listview_days'=> '', // no range - 'test' => 'false', - ) as $state => $default) - { - if (isset($set_states[$state])) + 'date' => $this->bo->date2string($this->bo->now_su), + 'cat_id' => 0, + 'status_filter' => 'default', + 'owner' => $this->user, + 'save_owner' => 0, + 'sortby' => 'category', + 'planner_view' => 'month', // full month + 'view' => ($this->bo->cal_prefs['defaultcalendar'] ? $this->bo->cal_prefs['defaultcalendar'] : 'day'), // use pref, if exists else use the dayview + 'listview_days' => '', // no range + 'test' => 'false', + ) as $state => $default) + { + if(isset($set_states[$state])) { - if ($state == 'owner') + if($state == 'owner') { // only change the owners of the same resource-type as given in set_state[owner] - $set_owners = is_array($set_states['owner']) ? $set_states['owner'] : explode(',',$set_states['owner']); - if ((string)$set_owners[0] === '0') // set exactly the specified owners (without the 0) + $set_owners = is_array($set_states['owner']) ? $set_states['owner'] : explode(',', $set_states['owner']); + if((string)$set_owners[0] === '0') // set exactly the specified owners (without the 0) { - if ($set_states['owner'] === '0,r0') // small fix for resources + if($set_states['owner'] === '0,r0') // small fix for resources { - $set_states['owner'] = $default; // --> set default, instead of none + $set_states['owner'] = $default; // --> set default, instead of none } else { - $set_states['owner'] = substr($set_states['owner'],2); + $set_states['owner'] = substr($set_states['owner'], 2); } } - else // change only the owners of the given type + else // change only the owners of the given type { $res_type = is_numeric($set_owners[0]) ? false : $set_owners[0][0]; $owners = $states['owner'] ? $states['owner'] : $default; if(!is_array($owners)) { - $owners = explode(',',$owners); + $owners = explode(',', $owners); } foreach($owners as $key => $owner) { - if (!$res_type && is_numeric($owner) || $res_type && $owner[0] == $res_type) + if(!$res_type && is_numeric($owner) || $res_type && $owner[0] == $res_type) { unset($owners[$key]); } } - if (!$res_type || !in_array($res_type.'0',$set_owners)) + if(!$res_type || !in_array($res_type . '0', $set_owners)) { - $owners = array_merge($owners,$set_owners); + $owners = array_merge($owners, $set_owners); } - $set_states['owner'] = implode(',',$owners); + $set_states['owner'] = implode(',', $owners); } } // for the uiforms class (eg. edit), dont store the (new) owner, as it might change the view - if (substr($_GET['menuaction'],0,25) == 'calendar.calendar_uiforms') + if(substr($_GET['menuaction'], 0, 25) == 'calendar.calendar_uiforms') { $this->owner = $set_states[$state]; continue; } $states[$state] = $set_states[$state]; } - elseif (!is_array($states) || !isset($states[$state])) + elseif(!is_array($states) || !isset($states[$state])) { $states[$state] = $default; } - if ($state == 'date') + if($state == 'date') { $date_arr = $this->bo->date2array($states['date']); - foreach(array('year','month','day') as $name) + foreach(array('year', 'month', 'day') as $name) { $this->$name = $states[$name] = $date_arr[$name]; } @@ -335,117 +335,118 @@ function manage_states($set_states=NULL) $this->$state = $states[$state]; } // remove a given calendar from the view - if (isset($_GET['close']) && ($k = array_search($_GET['close'], $owners=explode(',',$this->owner))) !== false) + if(isset($_GET['close']) && ($k = array_search($_GET['close'], $owners = explode(',', $this->owner))) !== false) { unset($owners[$k]); - $this->owner = $states['owner'] = implode(',',$owners); + $this->owner = $states['owner'] = implode(',', $owners); } if(is_array($this->owner)) { - $this->owner = implode(',',$this->owner); + $this->owner = implode(',', $this->owner); } - if (substr($this->view,0,8) == 'planner_') + if(substr($this->view, 0, 8) == 'planner_') { $states['sortby'] = $this->sortby = $this->view == 'planner_cat' ? 'category' : 'user'; $states['view'] = $this->view = 'planner'; } // set the actual view as return_to - if (isset($_GET['menuaction'])) + if(isset($_GET['menuaction'])) { - list(,$class,$func) = explode('.',$_GET['menuaction']); - if ($func == 'index') + list(, $class, $func) = explode('.', $_GET['menuaction']); + if($func == 'index') { - $func = $this->view; $this->view = 'index'; // switch to the default view + $func = $this->view; + $this->view = 'index'; // switch to the default view } } - else // eg. calendar/index.php + else // eg. calendar/index.php { $func = $this->view; $class = $this->view == 'listview' ? 'calendar_uilist' : 'calendar_uiviews'; } - if ($class == 'calendar_uiviews' || $class == 'calendar_uilist') + if($class == 'calendar_uiviews' || $class == 'calendar_uilist') { $this->view = $states['view'] = $func; } $this->view_menuaction = $this->view == 'listview' ? 'calendar.calendar_uilist.listview' : 'calendar.calendar_uiviews.index'; - if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1), states now %3',True,$set_states,$states); + if($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1), states now %3', True, $set_states, $states); // save the states in the session only when we are in calendar - if ($GLOBALS['egw_info']['flags']['currentapp']=='calendar') + if($GLOBALS['egw_info']['flags']['currentapp'] == 'calendar') { // save defined states into the user-prefs if(!empty($states) && is_array($states)) { - $saved_states = array_intersect_key($states,array_flip($this->states_to_save)); - if ($saved_states != $this->cal_prefs['saved_states']) + $saved_states = array_intersect_key($states, array_flip($this->states_to_save)); + if($saved_states != $this->cal_prefs['saved_states']) { - $GLOBALS['egw']->preferences->add('calendar','saved_states',$saved_states); - $GLOBALS['egw']->preferences->save_repository(false,'user',true); + $GLOBALS['egw']->preferences->add('calendar', 'saved_states', $saved_states); + $GLOBALS['egw']->preferences->save_repository(false, 'user', true); } } } } /** - * gets the icons displayed for a given event - * - * @param array $event - * @return array of 'img' / 'title' pairs - */ + * gets the icons displayed for a given event + * + * @param array $event + * @return array of 'img' / 'title' pairs + */ function event_icons($event) { - $is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ,$event); + $is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ, $event); $icons = array(); - if (!$is_private) + if(!$is_private) { if($event['priority'] == 3) { - $icons[] = Api\Html::image('calendar','high',lang('high priority')); + $icons[] = Api\Html::image('calendar', 'high', lang('high priority')); } if($event['recur_type'] != MCAL_RECUR_NONE) { - $icons[] = Api\Html::image('calendar','recur',lang('recurring event')); + $icons[] = Api\Html::image('calendar', 'recur', lang('recurring event')); } // icons for single user, multiple users or group(s) and resources - foreach(array_keys($event['participants']) as $uid) + foreach(array_keys($event['participants']) as $uid) { if(is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon'])) { - if (isset($icons['single']) || $GLOBALS['egw']->accounts->get_type($uid) == 'g') + if(isset($icons['single']) || $GLOBALS['egw']->accounts->get_type($uid) == 'g') { unset($icons['single']); - $icons['multiple'] = Api\Html::image('calendar','users'); + $icons['multiple'] = Api\Html::image('calendar', 'users'); } - elseif (!isset($icons['multiple'])) + elseif(!isset($icons['multiple'])) { - $icons['single'] = Api\Html::image('calendar','single'); + $icons['single'] = Api\Html::image('calendar', 'single'); } } elseif(!isset($icons[$uid[0]]) && isset($this->bo->resources[$uid[0]]) && isset($this->bo->resources[$uid[0]]['icon'])) { - $icons[$uid[0]] = Api\Html::image($this->bo->resources[$uid[0]]['app'], - ($this->bo->resources[$uid[0]]['icon'] ? $this->bo->resources[$uid[0]]['icon'] : 'navbar'), - lang($this->bo->resources[$uid[0]]['app']), - 'width="16px" height="16px"'); + $icons[$uid[0]] = Api\Html::image($this->bo->resources[$uid[0]]['app'], + ($this->bo->resources[$uid[0]]['icon'] ? $this->bo->resources[$uid[0]]['icon'] : 'navbar'), + lang($this->bo->resources[$uid[0]]['app']), + 'width="16px" height="16px"'); } } } if($event['non_blocking']) { - $icons[] = Api\Html::image('calendar','nonblocking',lang('non blocking')); + $icons[] = Api\Html::image('calendar', 'nonblocking', lang('non blocking')); } if($event['public'] == 0) { - $icons[] = Api\Html::image('calendar','private',lang('private')); + $icons[] = Api\Html::image('calendar', 'private', lang('private')); } if(isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) { - $icons[] = Api\Html::image('calendar','alarm',lang('alarm')); + $icons[] = Api\Html::image('calendar', 'alarm', lang('alarm')); } if($event['participants'][$this->user][0] == 'U') { - $icons[] = Api\Html::image('calendar','needs-action',lang('Needs action')); + $icons[] = Api\Html::image('calendar', 'needs-action', lang('Needs action')); } return $icons; } @@ -460,18 +461,18 @@ function event_icons($event) * @param array $vars * @return string the link incl. content */ - function add_link($content,$date=null,$hour=null,$minute=0,array $vars=null) + function add_link($content, $date = null, $hour = null, $minute = 0, array $vars = null) { $vars['menuaction'] = 'calendar.calendar_uiforms.edit'; - $vars['date'] = $date ? $date : $this->date; + $vars['date'] = $date ? $date : $this->date; - if (!is_null($hour)) + if(!is_null($hour)) { $vars['hour'] = $hour; $vars['minute'] = $minute; } - return Api\Html::a_href($content,'',$vars,' data-date="' .$vars['date'].'|'.$vars['hour'].'|'.$vars['minute'] - . '" title="'.Api\Html::htmlspecialchars(lang('Add')).'"'); + return Api\Html::a_href($content, '', $vars, ' data-date="' . $vars['date'] . '|' . $vars['hour'] . '|' . $vars['minute'] + . '" title="' . Api\Html::htmlspecialchars(lang('Add')) . '"'); } /** @@ -482,51 +483,51 @@ function sidebox_menu() // Magic etemplate2 favorites menu (from framework) display_sidebox('calendar', lang('Favorites'), Framework\Favorites::list_favorites('calendar')); - $file = array('menuOpened' => true); // menu open by default + $file = array('menuOpened' => true); // menu open by default // Target for etemplate $file[] = array( 'no_lang' => true, - 'text'=>'', - 'link'=>false, - 'icon' => false + 'text' => '', + 'link' => false, + 'icon' => false ); // Merge print placeholders (selectbox in etemplate) - if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) + if($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) { - $file['Placeholders'] = Egw::link('/index.php','menuaction=calendar.calendar_merge.show_replacements'); + $file['Placeholders'] = Egw::link('/index.php', 'menuaction=calendar.calendar_merge.show_replacements'); } $appname = 'calendar'; $menu_title = lang('Calendar Menu'); - display_sidebox($appname,$menu_title,$file); + display_sidebox($appname, $menu_title, $file); $this->sidebox_etemplate(); // resources menu hooks - foreach ($this->bo->resources as $resource) + foreach($this->bo->resources as $resource) { if(!is_array($resource['cal_sidebox'])) continue; $menu_title = $resource['cal_sidebox']['menu_title'] ? $resource['cal_sidebox']['menu_title'] : lang($resource['app']); - $file = ExecMethod($resource['cal_sidebox']['file'],array( + $file = ExecMethod($resource['cal_sidebox']['file'], array( 'menuaction' => $this->view_menuaction, - 'owner' => $this->owner, + 'owner' => $this->owner, )); - display_sidebox($appname,$menu_title,$file); + display_sidebox($appname, $menu_title, $file); } - if ($GLOBALS['egw_info']['user']['apps']['admin']) + if($GLOBALS['egw_info']['user']['apps']['admin']) { $file = Array( - 'Site configuration'=>Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), - 'Custom Fields'=>Egw::link('/index.php','menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), - 'Global Categories' =>Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), + 'Site configuration' => Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=calendar&ajax=true'), + 'Custom Fields' => Egw::link('/index.php', 'menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), + 'Global Categories' => Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), ); - $GLOBALS['egw']->framework->sidebox($appname,lang('Admin'),$file,'admin'); + $GLOBALS['egw']->framework->sidebox($appname, lang('Admin'), $file, 'admin'); } - display_sidebox('calendar', lang('Utilities'), array('Category report' => "javascript:egw_openWindowCentered2('". - Egw::link('/index.php',array('menuaction'=>'calendar.calendar_category_report.index','ajax'=>true),false). - "','_blank',870,500,'yes')" )); + display_sidebox('calendar', lang('Utilities'), array('Category report' => "javascript:egw_openWindowCentered2('" . + Egw::link('/index.php', array('menuaction' => 'calendar.calendar_category_report.index', 'ajax' => true), false) . + "','_blank',870,500,'yes')")); } /** @@ -537,10 +538,10 @@ function sidebox_etemplate($content = array()) if($content['merge']) { // View from sidebox is JSON encoded - $this->manage_states(array_merge($content,(array)json_decode($content['view'],true))); + $this->manage_states(array_merge($content, (array)json_decode($content['view'], true))); if($content['first']) { - $this->first = Api\DateTime::to($content['first'],'ts'); + $this->first = Api\DateTime::to($content['first'], 'ts'); } if($content['last']) { @@ -560,28 +561,28 @@ function sidebox_etemplate($content = array()) $sidebox = new Etemplate('calendar.sidebox'); $cont = $this->cal_prefs['saved_states']; - if (!is_array($cont)) $cont = array(); + if(!is_array($cont)) $cont = array(); $cont['view'] = $this->view ? $this->view : 'week'; $cont['date'] = $this->date ? $this->date : new Api\DateTime(); - $cont['owner'] = $this->owner ? (is_array($this->owner) ? $this->owner : explode(',',$this->owner) ) : $cont['owner']; + $cont['owner'] = $this->owner ? (is_array($this->owner) ? $this->owner : explode(',', $this->owner)) : $cont['owner']; - $cont['year'] = (int)Api\DateTime::to($cont['date'],'Y'); + $cont['year'] = (int)Api\DateTime::to($cont['date'], 'Y'); $cont['holidays'] = $this->bo->read_holidays($cont['year']); $readonlys = array(); $sel_options['status_filter'] = array( - array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), - array('value' => 'accepted', 'label' => lang('Accepted'), 'title' => lang('Show only accepted events')), - array('value' => 'unknown', 'label' => lang('Invitations'), 'title' => lang('Show only invitations, not yet accepted or rejected')), - array('value' => 'tentative', 'label' => lang('Tentative'), 'title' => lang('Show only tentative accepted events')), - array('value' => 'delegated', 'label' => lang('Delegated'), 'title' => lang('Show only delegated events')), - array('value' => 'rejected', 'label' => lang('Rejected'),'title' => lang('Show only rejected events')), - array('value' => 'owner', 'label' => lang('Owner too'),'title' => lang('Show also events just owned by selected user')), - array('value' => 'all', 'label' => lang('All incl. rejected'),'title' => lang('Show all status incl. rejected events')), - array('value' => 'hideprivate', 'label' => lang('Hide private infos'),'title' => lang('Show all events, as if they were private')), - array('value' => 'showonlypublic', 'label' => lang('Hide private events'),'title' => lang('Show only events flagged as public, (not checked as private)')), - array('value' => 'no-enum-groups', 'label' => lang('only group-events'),'title' => lang('Do not include events of group members')), - array('value' => 'not-unknown', 'label' => lang('No meeting requests'),'title' => lang('Show all status, but unknown')), + array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), + array('value' => 'accepted', 'label' => lang('Accepted'), 'title' => lang('Show only accepted events')), + array('value' => 'unknown', 'label' => lang('Invitations'), 'title' => lang('Show only invitations, not yet accepted or rejected')), + array('value' => 'tentative', 'label' => lang('Tentative'), 'title' => lang('Show only tentative accepted events')), + array('value' => 'delegated', 'label' => lang('Delegated'), 'title' => lang('Show only delegated events')), + array('value' => 'rejected', 'label' => lang('Rejected'), 'title' => lang('Show only rejected events')), + array('value' => 'owner', 'label' => lang('Owner too'), 'title' => lang('Show also events just owned by selected user')), + array('value' => 'all', 'label' => lang('All incl. rejected'), 'title' => lang('Show all status incl. rejected events')), + array('value' => 'hideprivate', 'label' => lang('Hide private infos'), 'title' => lang('Show all events, as if they were private')), + array('value' => 'showonlypublic', 'label' => lang('Hide private events'), 'title' => lang('Show only events flagged as public, (not checked as private)')), + array('value' => 'no-enum-groups', 'label' => lang('only group-events'), 'title' => lang('Do not include events of group members')), + array('value' => 'not-unknown', 'label' => lang('No meeting requests'), 'title' => lang('Show all status, but unknown')), ); if($GLOBALS['egw_info']['server']['calendar_delete_history']) { @@ -589,23 +590,23 @@ function sidebox_etemplate($content = array()) } // Merge print - try { - if (class_exists('EGroupware\\collabora\\Bo') && - $GLOBALS['egw_info']['user']['apps']['collabora'] && - $discovery = \EGroupware\collabora\Bo::discover() + try + { + if(class_exists('EGroupware\\collabora\\Bo') && + $GLOBALS['egw_info']['user']['apps']['collabora'] && + $discovery = \EGroupware\collabora\Bo::discover() ) { $cont['collabora_enabled'] = true; } - } - catch (\Exception $e) + } catch(\Exception $e) { // ignore failed discovery unset($e); } - if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) + if($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) { - $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null,'calendar'); + $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null, 'calendar'); } else @@ -631,14 +632,14 @@ function sidebox_etemplate($content = array()) * @param Api\DateTime $recurrence_date * * @return boolean True if the event was updated, false if it could not be - * updated or was removed. + * updated or was removed. */ public function update_client($event_id, Api\DateTime $recurrence_date = null) { if(!$event_id) return false; - if(is_string($event_id) && strpos($event_id,':') !== FALSE) + if(is_string($event_id) && strpos($event_id, ':') !== FALSE) { - list($event_id, $date) = explode(':',$event_id); + list($event_id, $date) = explode(':', $event_id); $recurrence_date = new Api\DateTime($date); } @@ -652,23 +653,23 @@ public function update_client($event_id, Api\DateTime $recurrence_date = null) // the event because it should no longer be displayed $filter_match = true; if($event && ($this->cal_prefs['saved_states']['status_filter'] != 'all' || - $this->cal_prefs['saved_states']['cat_id'])) + $this->cal_prefs['saved_states']['cat_id'])) { $filter_check = array( - 'start' => $event['start'], - 'users' => $this->cal_prefs['saved_states']['owner'], - 'cat_id' => $this->cal_prefs['saved_states']['cat_id'], - 'filter' => $this->cal_prefs['saved_states']['status_filter'], + 'start' => $event['start'], + 'users' => $this->cal_prefs['saved_states']['owner'], + 'cat_id' => $this->cal_prefs['saved_states']['cat_id'], + 'filter' => $this->cal_prefs['saved_states']['status_filter'], 'num_rows' => 1 ); - $filter_match = count($this->bo->search($filter_check, $this->bo->so->cal_table.".cal_id = {$event['id']}")) > 0; + $filter_match = count($this->bo->search($filter_check, $this->bo->so->cal_table . ".cal_id = {$event['id']}")) > 0; } if(!$event || !$filter_match) { // Sending null will trigger a removal $uid = 'calendar::' . $event_id; - if ($recurrence_date) + if($recurrence_date) { $uid .= ':' . $recurrence_date->getTimestamp(); } @@ -679,10 +680,10 @@ public function update_client($event_id, Api\DateTime $recurrence_date = null) if(!$event['recur_type'] || $recurrence_date) { $this->to_client($event); - $response->generic('data', array('uid' => 'calendar::'.$event['row_id'], 'data' => $event)); + $response->generic('data', array('uid' => 'calendar::' . $event['row_id'], 'data' => $event)); } // If it's recurring, try to send the next month or so - else if($event['recur_type'] ) + else if($event['recur_type']) { $this_month = new Api\DateTime('next month'); $rrule = calendar_rrule::event2rrule($event, true); @@ -692,10 +693,9 @@ public function update_client($event_id, Api\DateTime $recurrence_date = null) $occurrence = $rrule->current(); $converted = $this->bo->read($event['id'], $occurrence); $this->to_client($converted); - $response->generic('data', array('uid' => 'calendar::'.$converted['row_id'], 'data' => $converted)); + $response->generic('data', array('uid' => 'calendar::' . $converted['row_id'], 'data' => $converted)); $rrule->next(); - } - while ($rrule->valid() && $occurrence <= $this_month ); + } while($rrule->valid() && $occurrence <= $this_month); } return true; } @@ -715,27 +715,27 @@ public function to_client(&$event) static $sent_groups = array(); - if (!$this->bo->check_perms(Acl::EDIT,$event)) + if(!$this->bo->check_perms(Acl::EDIT, $event)) { $event['class'] .= 'rowNoEdit '; } // Delete disabled for other applications - if (!$this->bo->check_perms(Acl::DELETE,$event) || !is_numeric($event['id'])) + if(!$this->bo->check_perms(Acl::DELETE, $event) || !is_numeric($event['id'])) { $event['class'] .= 'rowNoDelete '; } // mark deleted events - if ($event['deleted']) + if($event['deleted']) { $event['class'] .= 'rowDeleted '; } $event['recure'] = $this->bo->recure2string($event); - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment + if(empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment + if(empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment // respect category permissions if(!empty($event['category'])) @@ -745,23 +745,23 @@ public function to_client(&$event) $event['non_blocking'] = (bool)$event['non_blocking']; $matches = null; - if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches)) + if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i', $event['id'], $matches)) { $app = $matches[1]; $app_id = $matches[2]; $icons = array(); - if(!($is_private = calendar_bo::integration_get_private($app,$app_id,$event))) + if(!($is_private = calendar_bo::integration_get_private($app, $app_id, $event))) { - $icons = calendar_uiviews::integration_get_icons($app,$app_id,$event); + $icons = calendar_uiviews::integration_get_icons($app, $app_id, $event); } $event['app'] = $app; $event['app_id'] = $app_id; } else { - $is_private = !$this->bo->check_perms(Acl::READ,$event); + $is_private = !$this->bo->check_perms(Acl::READ, $event); } - if ($is_private) + if($is_private) { $event['is_private'] = true; $event['class'] .= 'rowNoView '; @@ -776,17 +776,20 @@ public function to_client(&$event) $event['app_id'] = $event['id']; } - if ($event['recur_type'] != MCAL_RECUR_NONE) + if($event['recur_type'] != MCAL_RECUR_NONE) { - $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts'); + $event['app_id'] .= ':' . Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts'); } // set id for grid - $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts') : ''); + $event['row_id'] = $event['id'] . ($event['recur_type'] ? ':' . Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts') : ''); // Set up participant section of tooltip - $participants = $this->bo->participants($event,false); - $event['parts'] = implode("\n",$participants); + $participants = $this->bo->participants($event, false); + $event['parts'] = implode("\n", $participants); $event['participant_types'] = array(); + // semicolon-separated string of participants that may (optionally) be shown alongside title + $participantNames = ""; + foreach($participants as $uid => $text) { $user_type = $user_id = null; @@ -798,11 +801,18 @@ public function to_client(&$event) // Make sure group membership info is on the client Api\Json\Response::get()->apply( 'egw.set_account_cache', array( - array($uid => $GLOBALS['egw']->accounts->members($uid) ), + array($uid => $GLOBALS['egw']->accounts->members($uid)), 'account_id' )); } + $participantNames .= ($this->bo->participant_name($user_id) . "; "); + } + // add the names of all participants as semicolon-separated string + if($GLOBALS['egw_info']['user']['preferences']['calendar']['participant_names']) + { + $event['participant_names'] = substr($participantNames, 0, -2); } + $event['date'] = $this->bo->date2string($event['start']); // Change dates @@ -833,43 +843,43 @@ public function merge($timespan = array()) if(!$timespan) { // Try to make time span into appropriate ranges to match - if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month'; - if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week'; + if(stripos($_GET['merge'], 'month') !== false || stripos($_GET['merge'], lang('month')) !== false) $template = 'month'; + if(stripos($_GET['merge'], 'week') !== false || stripos($_GET['merge'], lang('week')) !== false) $template = 'week'; //error_log("Detected template $template"); - switch ($template) + switch($template) { case 'month': // Trim to _only_ the month, do not pad to week start / end $time = new Api\DateTime($this->date); $timespan = array(array( - 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'),'ts'), - 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'),'ts') - )); + 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'), 'ts'), + 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'), 'ts') + )); break; case 'week': $timespan = array(); $start = new Api\DateTime($this->first); $t = clone $start; $t->modify('+1 week')->modify('-1 second'); - if($t->format('ts') < Api\DateTime::to($this->last,'ts')) + if($t->format('ts') < Api\DateTime::to($this->last, 'ts')) { do { $timespan[] = array( 'start' => $start->format('ts'), - 'end' => $t->format('ts') + 'end' => $t->format('ts') ); $start->modify('+1 week'); $t->modify('+1 week'); - } while( $start->format('ts') < $this->last); + } while($start->format('ts') < $this->last); break; } - // Fall through + // Fall through default: $timespan = array(array( - 'start' => is_array($this->first) ? $this->bo->date2ts($this->first) : $this->first, - 'end' => is_array($this->last) ? $this->bo->date2ts($this->last) : $this->last - )); + 'start' => is_array($this->first) ? $this->bo->date2ts($this->first) : $this->first, + 'end' => is_array($this->last) ? $this->bo->date2ts($this->last) : $this->last + )); } } $document = $_GET['merge']; @@ -882,7 +892,7 @@ public function merge($timespan = array()) { return false; } - else if (!$error) + else if(!$error) { //error_log($_GET['merge'] . ' Timespan: ');foreach($timespan as $t) error_log(Api\DateTime::to($t['start']) . ' - ' . Api\DateTime::to($t['end'])); $error = $merge->download($document, $timespan, '', $GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']); @@ -896,7 +906,7 @@ public function merge($timespan = array()) // This doesn't give message either, but at least it doesn't give a blank screen Framework::redirect_link('/index.php', array( 'msg' => $error, - 'cd' => 'yes' + 'cd' => 'yes' )); } } @@ -912,28 +922,27 @@ protected function merge_collabora($document, $timespan) $editable_mimes = array(); try { - if (class_exists('EGroupware\\collabora\\Bo') && - $GLOBALS['egw_info']['user']['apps']['collabora'] && - $discovery = \EGroupware\collabora\Bo::discover() + if(class_exists('EGroupware\\collabora\\Bo') && + $GLOBALS['egw_info']['user']['apps']['collabora'] && + $discovery = \EGroupware\collabora\Bo::discover() ) { $editable_mimes = $discovery; } - } - catch (\Exception $e) + } catch(\Exception $e) { return false; } $timespan = json_encode($timespan); - if ($editable_mimes[$file['mime']]) + if($editable_mimes[$file['mime']]) { Framework::popup(Framework::link('/index.php', array( 'menuaction' => 'collabora.EGroupware\\collabora\\Ui.merge_edit', 'document' => $document, 'merge' => 'calendar_merge', 'id' => $timespan - )),'_blank',false); + )), '_blank', false); return true; } diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js index de5b480edcc..26f60bfb10f 100644 --- a/calendar/js/et2_widget_event.js +++ b/calendar/js/et2_widget_event.js @@ -69,7 +69,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten this.div = jQuery(document.createElement("div")) .addClass("calendar_calEvent") .addClass(this.options.class) - .css('width',this.options.width) + .css('width', this.options.width) .on('mouseenter', function() { // Bind actions on first mouseover for faster creation if(event._need_actions_linked) @@ -89,22 +89,22 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten // Hacky to remove egw's tooltip border and let the mouse in window.setTimeout(function() { jQuery('body .egw_tooltip') - .css('border','none') + .css('border', 'none') .on('mouseenter', function() { event.div.off('mouseleave.tooltip'); jQuery('body.egw_tooltip').remove(); jQuery('body').append(this); jQuery(this).stop(true).fadeTo(400, 1) - .on('mouseleave', function() { - jQuery(this).fadeOut('400', function() { - jQuery(this).remove(); - // Set up to work again - event.set_statustext(event._tooltip()); - }); - }); + .on('mouseleave', function() { + jQuery(this).fadeOut('400', function() { + jQuery(this).remove(); + // Set up to work again + event.set_statustext(event._tooltip()); + }); + }); }); - },105); + }, 105); }); this.title = jQuery(document.createElement('div')) .addClass("calendar_calEventHeader") @@ -128,7 +128,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten if(this.options.value && this.options.value.row_id) { egw.dataRegisterUID( - 'calendar::'+this.options.value.row_id, + 'calendar::' + this.options.value.row_id, this._UID_callback, this, this.getInstanceManager().execId, @@ -162,7 +162,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten if(this.options.value) { var old_app_id = this.options.value.row_id; - egw.dataUnregisterUID('calendar::'+old_app_id,false,this); + egw.dataUnregisterUID('calendar::' + old_app_id, false, this); } }, @@ -173,7 +173,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten var old_id = this.options.value.row_id; if(!_value || !_value.row_id || old_id !== _value.row_id) { - egw.dataUnregisterUID('calendar::'+old_id,false,this); + egw.dataUnregisterUID('calendar::' + old_id, false, this); } } this.options.value = _value; @@ -182,11 +182,11 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten var id = this.options.value.row_id; if(!old_id || old_id !== id) { - egw.dataRegisterUID('calendar::'+id, this._UID_callback ,this,this.getInstanceManager().execId,this.id); + egw.dataRegisterUID('calendar::' + id, this._UID_callback, this, this.getInstanceManager().execId, this.id); } - if(_value && !egw.dataHasUID('calendar::'+id)) + if(_value && !egw.dataHasUID('calendar::' + id)) { - egw.dataStoreUID('calendar::'+id, _value); + egw.dataStoreUID('calendar::' + id, _value); } }, @@ -195,7 +195,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten */ _UID_callback: function _UID_callback(event) { // Copy to avoid changes, which may cause nm problems - var value = event === null ? null : jQuery.extend({},event); + var value = event === null ? null : jQuery.extend({}, event); let parent = this.getParent(); let parent_owner = parent.getDOMNode(parent).dataset['owner'] || parent.getParent().options.owner; @@ -221,7 +221,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten } // Copy to avoid changes, which may cause nm problems - this.options.value = jQuery.extend({},value); + this.options.value = jQuery.extend({}, value); if(this._parent.options.date) { @@ -246,7 +246,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten // Update to reflect new information var event = this.options.value; - var id = event.row_id ? event.row_id : event.id + (event.recur_type ? ':'+event.recur_date : ''); + var id = event.row_id ? event.row_id : event.id + (event.recur_type ? ':' + event.recur_date : ''); var formatted_start = event.start.toJSON(); this.set_id('event_' + id); @@ -262,9 +262,11 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten // immediately. var im = this.getInstanceManager(); et2_selectbox.cat_options({ - _type:'select-cat', - getInstanceManager: function() {return im} - }, {application:event.app||'calendar'}); + _type: 'select-cat', + getInstanceManager: function() { + return im + } + }, {application: event.app || 'calendar'}); // Need cleaning? (DnD helper removes content) if(!this.div.has(this.title).length) @@ -278,7 +280,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten { this.div // Let timegrid always get the drag - .droppable('option','greedy',false); + .droppable('option', 'greedy', false); } // DOM nodes this.div @@ -292,11 +294,11 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten .attr('data-start', formatted_start) .attr('data-owner', event.owner) .attr('data-recur_type', event.recur_type) - .attr('data-resize', event.whole_day ? 'WD' : '' + (event.recur_type ? 'S':'')) + .attr('data-resize', event.whole_day ? 'WD' : '' + (event.recur_type ? 'S' : '')) .attr('data-priority', event.priority) // Remove any category classes .removeClass(function(index, css) { - return (css.match (/(^|\s)cat_\S+/g) || []).join(' '); + return (css.match(/(^|\s)cat_\S+/g) || []).join(' '); }) // Remove any status classes .removeClass(function(index, css) { @@ -327,14 +329,15 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten var title = !event.is_private ? egw.htmlspecialchars(event['title']) : egw.lang('private'); this.title - .html(''+this._get_timespan(event) + '
') - .append(''+title+'') + .html('' + this._get_timespan(event) + '
') + .append('' + this._getTitle(event) + '') // Colors - don't make them transparent if there is no color - if(jQuery.Color("rgba(0,0,0,0)").toRgbaString() != jQuery.Color(this.div,'background-color').toRgbaString()) + if(jQuery.Color("rgba(0,0,0,0)").toRgbaString() != jQuery.Color(this.div, 'background-color') + .toRgbaString()) { // Most statuses use colored borders - this.div.css('border-color',this.div.css('background-color') ); + this.div.css('border-color', this.div.css('background-color')); } this.icons.appendTo(this.title) @@ -343,7 +346,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten // Body if(event.whole_day_on_top) { - this.body.html(title); + this.body.html(this._getTitle(event)); } else { @@ -359,12 +362,12 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten ).trim(); this.body - .html(''+title+'') - .append(''+start_time + ''); + .html('' + this._getTitle(event) + '') + .append('' + start_time + ''); if(this.options.value.description.trim()) { this.body - .append('

'+egw.htmlspecialchars(this.options.value.description)+'

'); + .append('

' + egw.htmlspecialchars(this.options.value.description) + '

'); } } @@ -407,24 +410,24 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten // Handle sizing while hidden, such as when calendar is not the active tab visible_lines = Math.floor(egw.getHiddenDimensions(this.div).h / egw.getHiddenDimensions(this.title).h); } - visible_lines = Math.max(1,visible_lines); + visible_lines = Math.max(1, visible_lines); if(this.getParent() && this.getParent().instanceOf(et2_calendar_daycol)) { - this.div.toggleClass('calendar_calEventSmall',visible_lines < 4); + this.div.toggleClass('calendar_calEventSmall', visible_lines < 4); this.div .attr('data-visible_lines', visible_lines); } - else if (this.getParent() && this.getParent().instanceOf(et2_calendar_planner_row)) + else if(this.getParent() && this.getParent().instanceOf(et2_calendar_planner_row)) { // Less than 8 hours is small - this.div.toggleClass('calendar_calEventSmall',this.options.value.end.valueOf() - this.options.value.start.valueOf() < 28800000); + this.div.toggleClass('calendar_calEventSmall', this.options.value.end.valueOf() - this.options.value.start.valueOf() < 28800000); } if(this.body.height() > this.div.height() - this.title.height() && visible_lines >= 4) { - this.body.css('height', Math.floor((visible_lines-1)*line_height - this.title.height()) + 'px'); + this.body.css('height', Math.floor((visible_lines - 1) * line_height - this.title.height()) + 'px'); } else { @@ -445,7 +448,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten status = et2_calendar_event.split_status(status); - switch (status) + switch(status) { case 'A': case '': // app without status @@ -480,13 +483,13 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten var end = this._parent.date_helper.input_date.val(); var times = !this.options.value.multiday ? - ''+this.egw().lang('Time')+':' + timespan : - ''+this.egw().lang('Start') + ':' +start+ ' ' + - ''+this.egw().lang('End') + ':' + end; + '' + this.egw().lang('Time') + ':' + timespan : + '' + this.egw().lang('Start') + ':' + start + ' ' + + '' + this.egw().lang('End') + ':' + end; var cat_label = ''; if(this.options.value.category) { - var cat = et2_createWidget('select-cat',{'readonly':true},this); + var cat = et2_createWidget('select-cat', {'readonly': true}, this); cat.set_value(this.options.value.category); cat_label = this.options.value.category.indexOf(',') <= 0 ? cat.span.text() : []; if(typeof cat_label != 'string') @@ -507,29 +510,31 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten { if(type_name) { - participants += '

'+type_name+':
'; + participants += '

' + type_name + ':
'; participants += this.options.value.participant_types[type_name].join("
"); } } - return '

'+ - '
'+ - ''+timespan+''+ - this.icons[0].outerHTML+ - '
'+ - '
'+ - '

'+ - ''+egw.htmlspecialchars(this.options.value.title)+'
'+ - egw.htmlspecialchars(this.options.value.description)+'

'+ - '

'+times+'

'+ - (this.options.value.location ? '

'+this.egw().lang('Location') + ':' + - egw.htmlspecialchars(this.options.value.location)+'

' : '')+ - (cat_label ? '

'+this.egw().lang('Category') + ':' + cat_label +'

' : '')+ - '

'+this.egw().lang('Participants')+':
'+ - participants + '

'+ this._participant_summary(this.options.value.participants) + - '
'+ - '
'; + return '
' + + '
' + + '' + timespan + '' + + this.icons[0].outerHTML + + '
' + + '
' + + '

' + + '' + egw.htmlspecialchars(this.options.value.title) + '
' + + egw.htmlspecialchars(this.options.value.description) + '

' + + '

' + times + '

' + + (this.options.value.location ? '

' + this.egw() + .lang('Location') + ':' + + egw.htmlspecialchars(this.options.value.location) + '

' : '') + + (cat_label ? '

' + this.egw() + .lang('Category') + ':' + cat_label + '

' : '') + + '

' + this.egw().lang('Participants') + ':
' + + participants + '

' + this._participant_summary(this.options.value.participants) + + '
' + + '
'; }, /** @@ -537,21 +542,21 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten * * @returns {String} */ - _participant_summary: function(participants) - { - if( Object.keys(this.options.value.participants).length < 2) + _participant_summary: function(participants) { + if(Object.keys(this.options.value.participants).length < 2) { return ''; } var participant_status = {A: 0, R: 0, T: 0, U: 0, D: 0}; var status_label = {A: 'accepted', R: 'rejected', T: 'tentative', U: 'unknown', D: 'delegated'}; - var participant_summary = Object.keys(this.options.value.participants).length + ' ' + this.egw().lang('Participants')+': '; + var participant_summary = Object.keys(this.options.value.participants).length + ' ' + this.egw() + .lang('Participants') + ': '; var status_totals = []; for(var id in this.options.value.participants) { - var status = this.options.value.participants[id].substr(0,1); + var status = this.options.value.participants[id].substr(0, 1); participant_status[status]++; } for(var status in participant_status) @@ -574,30 +579,34 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten if(this.options.value.is_private) { // Hide everything - icons.push(''); + icons.push(''); } else { if(this.options.value.app !== 'calendar') { - icons.push(''); + icons.push(''); } if(this.options.value.priority == 3) { - icons.push(''); + icons.push(''); } if(this.options.value.public == '0') { // Show private flag - icons.push(''); + icons.push(''); } if(this.options.value['recur_type']) { - icons.push(''); + icons.push(''); } // icons for single user, multiple users or group(s) and resources - var single = ''; - var multiple = ''; + var single = ''; + var multiple = ''; for(var uid in this.options.value['participants']) { if(Object.keys(this.options.value.participants).length == 1 && !isNaN(uid)) @@ -613,28 +622,32 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten * TODO: resource icons elseif(!isset($icons[$uid[0]]) && isset($this->bo->resources[$uid[0]]) && isset($this->bo->resources[$uid[0]]['icon'])) { - $icons[$uid[0]] = html::image($this->bo->resources[$uid[0]]['app'], - ($this->bo->resources[$uid[0]]['icon'] ? $this->bo->resources[$uid[0]]['icon'] : 'navbar'), - lang($this->bo->resources[$uid[0]]['app']), - 'width="16px" height="16px"'); + $icons[$uid[0]] = html::image($this->bo->resources[$uid[0]]['app'], + ($this->bo->resources[$uid[0]]['icon'] ? $this->bo->resources[$uid[0]]['icon'] : 'navbar'), + lang($this->bo->resources[$uid[0]]['app']), + 'width="16px" height="16px"'); } */ } if(this.options.value.alarm && !jQuery.isEmptyObject(this.options.value.alarm) && !this.options.value.is_private) { - icons.push(''); + icons.push(''); } if(this.options.value.participants[egw.user('account_id')] && this.options.value.participants[egw.user('account_id')][0] == 'U') { - icons.push(''); + icons.push(''); } } // Always include non-blocking, regardless of privacy if(this.options.value.non_blocking) { - icons.push(''); + icons.push(''); } return icons; }, @@ -651,9 +664,9 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten */ _get_timespan: function(event) { var timespan = ''; - if (event['start_m'] === 0 && event['end_m'] >= 24*60-1) + if(event['start_m'] === 0 && event['end_m'] >= 24 * 60 - 1) { - if (event['end_m'] > 24*60) + if(event['end_m'] > 24 * 60) { timespan = jQuery.datepicker.formatTime( egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", @@ -664,7 +677,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten timezone: 0 }, {"ampm": (egw.preference("timeformat") === "12")} - ).trim()+' - '+jQuery.datepicker.formatTime( + ).trim() + ' - ' + jQuery.datepicker.formatTime( egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", { hour: event.end_m / 60, @@ -685,7 +698,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten var duration = event.multiday ? (event.end - event.start) / 60000 : (event.end_m - event.start_m); - duration = Math.floor(duration/60) + this.egw().lang('h')+(duration%60 ? duration%60 : ''); + duration = Math.floor(duration / 60) + this.egw().lang('h') + (duration % 60 ? duration % 60 : ''); timespan = jQuery.datepicker.formatTime( egw.preference("timeformat") === "12" ? "h:mmtt" : "HH:mm", @@ -714,16 +727,63 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten return timespan; }, + /** + * Creates the title-string for an event + * @param {Object} event the current event. + * @return {string} the resulting title. + */ + _getTitle: function(event) { + let title = ""; + if(!event.is_private) + { + title = egw.htmlspecialchars(event['title']); + title += this._getParticipants(event); + } + else + { + title = egw.lang('private'); + } + return title; + }, + + /** + * Retrieves participant names from an event + * @param {Object} event the current event + * @return {string} the participants as span-objects + */ + _getParticipants: function(event) { + let participants = ""; + if(this._hasParticipantNames(event)) + { + return ' // ' + event["participant_names"] + "" + } + return participants; + }, + + /** + * Tries to detect provided names of participants for an event. + * Names will only be shown when provided with the event. + * + * @param {Object} event the current event + * @return boolean whether the event contains participant-names or not + */ + _hasParticipantNames: function(event) + { + return event["participant_names"] !== undefined + && event["participant_names"] !== null; + }, + + + /** * Make sure event data has all proper values, and format them as expected * @param {Object} event */ - _values_check: function _values_check(event) - { + _values_check: function _values_check(event) { // Make sure ID is a string if(event.id) { - event.id = ''+event.id; + event.id = '' + event.id; } // Use dates as objects @@ -773,8 +833,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten * * @return {Boolean} Provided event data is for the same date */ - _sameday_check: function(event) - { + _sameday_check: function(event) { // Event somehow got orphaned, or deleted if(!this._parent || event === null) { @@ -807,23 +866,23 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten } // Update daywise caches - var new_cache_id = app.classes.calendar._daywise_cache_id(event.date,this._parent.options.owner); + var new_cache_id = app.classes.calendar._daywise_cache_id(event.date, this._parent.options.owner); var new_daywise = egw.dataGetUIDdata(new_cache_id); new_daywise = new_daywise && new_daywise.data ? new_daywise.data : []; var old_cache_id = false; if(this.options.value && this.options.value.date) { - old_cache_id = app.classes.calendar._daywise_cache_id(this.options.value.date,this._parent.options.owner); + old_cache_id = app.classes.calendar._daywise_cache_id(this.options.value.date, this._parent.options.owner); } if(new_cache_id != old_cache_id) { var old_daywise = egw.dataGetUIDdata(old_cache_id); old_daywise = old_daywise && old_daywise.data ? old_daywise.data : []; - old_daywise.splice(old_daywise.indexOf(this.options.value.row_id),1); - egw.dataStoreUID(old_cache_id,old_daywise); + old_daywise.splice(old_daywise.indexOf(this.options.value.row_id), 1); + egw.dataStoreUID(old_cache_id, old_daywise); - if (new_daywise.indexOf(event.row_id) < 0) + if(new_daywise.indexOf(event.row_id) < 0) { new_daywise.push(event.row_id); } @@ -844,8 +903,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten * @param filter * @private */ - _status_check: function(event, filter, owner) - { + _status_check: function(event, filter, owner) { if(!owner || !event) { return false; @@ -855,7 +913,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten if(typeof owner !== "string") { let pass = false; - for (let j = 0; j < owner.length && pass == false; j++) + for(let j = 0; j < owner.length && pass == false; j++) { pass = pass || this._status_check(event, filter, owner[j]); } @@ -887,8 +945,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten } if((isNaN(parseInt(owner)) || parseInt(owner) < 0) && options && typeof options.find == "function") { - let resource = options.find(function (element) - { + let resource = options.find(function(element) { return element.id == owner; }) || {}; if(resource && resource.resources) @@ -901,7 +958,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten let status = et2_calendar_event.split_status(participant); - switch (filter) + switch(filter) { default: case 'all': @@ -934,13 +991,12 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten } }, - attachToDOM: function() - { + attachToDOM: function() { this._super.apply(this, arguments); // Remove the binding for the click handler, unless there's something // custom here. - if (!this.onclick) + if(!this.onclick) { jQuery(this.node).off("click"); } @@ -974,9 +1030,8 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten * @param {et2_calendar_event~prompt_callback} callback * @param {Object} [extra_data] */ - recur_prompt: function(callback, extra_data) - { - et2_calendar_event.recur_prompt(this.options.value,callback,extra_data); + recur_prompt: function(callback, extra_data) { + et2_calendar_event.recur_prompt(this.options.value, callback, extra_data); }, /** @@ -986,9 +1041,8 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten * * @param {et2_calendar_event~prompt_callback} callback */ - series_split_prompt: function(callback) - { - et2_calendar_event.series_split_prompt(this.options.value,this.options.value.recur_date, callback); + series_split_prompt: function(callback) { + et2_calendar_event.series_split_prompt(this.options.value, this.options.value.recur_date, callback); }, /** @@ -996,22 +1050,23 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten * * This can take a while to do, so we try to do it only when needed - on mouseover */ - _copy_parent_actions: function() - { + _copy_parent_actions: function() { // Copy actions set in parent if(!this.options.readonly && !this._parent.options.readonly) { var action_parent = this; while(action_parent != null && !action_parent.options.actions && !action_parent.instanceOf(et2_container) - ) + ) { action_parent = action_parent.getParent(); } - try { - this._link_actions(action_parent.options.actions||{}); + try + { + this._link_actions(action_parent.options.actions || {}); this._need_actions_linked = false; - } catch (e) { + } catch(e) + { // something went wrong, but keep quiet about it } } @@ -1022,22 +1077,23 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten * * @param {object} actions {ID: {attributes..}+} map of egw action information */ - _link_actions: function(actions) - { + _link_actions: function(actions) { if(!this._actionObject) { // Get the top level element - timegrid or so var objectManager = this.getParent()._actionObject || this.getParent().getParent()._actionObject || - egw_getAppObjectManager(true).getObjectById(this._parent._parent._parent.id) || egw_getAppObjectManager(true); - this._actionObject = objectManager.getObjectById('calendar::'+this.options.value.row_id); + egw_getAppObjectManager(true) + .getObjectById(this._parent._parent._parent.id) || egw_getAppObjectManager(true); + this._actionObject = objectManager.getObjectById('calendar::' + this.options.value.row_id); } - if (this._actionObject == null) { + if(this._actionObject == null) + { // Add a new container to the object manager which will hold the widget // objects this._actionObject = objectManager.insertObject(false, new egwActionObject( - 'calendar::'+this.options.value.row_id, objectManager, new et2_event_action_object_impl(this,this.getDOMNode()), - this._actionManager || objectManager.manager.getActionById('calendar::'+this.options.value.row_id) || objectManager.manager + 'calendar::' + this.options.value.row_id, objectManager, new et2_event_action_object_impl(this, this.getDOMNode()), + this._actionManager || objectManager.manager.getActionById('calendar::' + this.options.value.row_id) || objectManager.manager )); } else @@ -1077,7 +1133,8 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten setDetachedAttributes: function(_nodes, _values) { }, -});}).call(this); +}); +}).call(this); et2_register_widget(et2_calendar_event, ["calendar-event"]); // Static class stuff @@ -1098,8 +1155,7 @@ et2_register_widget(et2_calendar_event, ["calendar-event"]); * * @return {boolean} Should the event be displayed */ -et2_calendar_event.owner_check = function owner_check(event, parent, owner_too) -{ +et2_calendar_event.owner_check = function owner_check(event, parent, owner_too) { var owner_match = true; if(typeof owner_too === 'undefined' && app.calendar.state.status_filter) { @@ -1121,38 +1177,42 @@ et2_calendar_event.owner_check = function owner_check(event, parent, owner_too) parent.options.owner); owner_match = false; var length = parent_owner.length; - for(var i = 0; i < length; i++ ) + for(var i = 0; i < length; i++) { // Handle groups & grouped resources like mailing lists, they won't match so // we need the list - pull it from sidebox owner if((isNaN(parent_owner[i]) || parent_owner[i] < 0) && options && options.find) { - var resource = options.find(function(element) {return element.id == parent_owner[i];}) || {}; + var resource = options.find(function(element) { + return element.id == parent_owner[i]; + }) || {}; if(resource && resource.resources) { - parent_owner.splice(i,1); + parent_owner.splice(i, 1); parent_owner = parent_owner.concat(resource.resources); continue; } } } - var participants = jQuery.extend([],Object.keys(event.participants)); - for(var i = 0; i < participants.length; i++ ) + var participants = jQuery.extend([], Object.keys(event.participants)); + for(var i = 0; i < participants.length; i++) { var id = participants[i]; // Expand group invitations - if (parseInt(id) < 0) + if(parseInt(id) < 0) { // Add in groups, if we can get them from options, great var resource; - if(options && options.find && (resource = options.find(function(element) {return element.id === id;})) && resource.resources) + if(options && options.find && (resource = options.find(function(element) { + return element.id === id; + })) && resource.resources) { participants = participants.concat(resource.resources); } else { // Add in groups, if we can get them (this is asynchronous) - egw.accountData(id,'account_id',true,function(members) { + egw.accountData(id, 'account_id', true, function(members) { participants = participants.concat(Object.keys(members)); }); } @@ -1205,17 +1265,17 @@ et2_calendar_event.owner_check = function owner_check(event, parent, owner_too) * * @augments {et2_calendar_event} */ -et2_calendar_event.recur_prompt = function(event_data, callback, extra_data) -{ +et2_calendar_event.recur_prompt = function(event_data, callback, extra_data) { var edit_id = event_data.app_id; var edit_date = event_data.start; // seems window.opener somehow in certian conditions could be from different origin // we try to catch the exception and in this case retrive the egw object from current window. - try { - var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar'):window.egw('calendar'); - } - catch(e){ + try + { + var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar') : window.egw('calendar'); + } catch(e) + { var egw = window.egw('calendar'); } @@ -1225,17 +1285,16 @@ et2_calendar_event.recur_prompt = function(event_data, callback, extra_data) extra_params.date = edit_date.toJSON ? edit_date.toJSON() : edit_date; if(typeof callback != 'function') { - callback = function(_button_id) - { + callback = function(_button_id) { switch(_button_id) { case 'exception': extra_params.exception = '1'; - egw.open(edit_id, event_data.app||'calendar', 'edit', extra_params); + egw.open(edit_id, event_data.app || 'calendar', 'edit', extra_params); break; case 'series': case 'single': - egw.open(edit_id, event_data.app||'calendar', 'edit', extra_params); + egw.open(edit_id, event_data.app || 'calendar', 'edit', extra_params); break; case 'cancel': default: @@ -1247,11 +1306,13 @@ et2_calendar_event.recur_prompt = function(event_data, callback, extra_data) { var buttons = [ {text: egw.lang("Edit exception"), id: "exception", class: "ui-priority-primary", "default": true}, - {text: egw.lang("Edit series"), id:"series"}, - {text: egw.lang("Cancel"), id:"cancel"} + {text: egw.lang("Edit series"), id: "series"}, + {text: egw.lang("Cancel"), id: "cancel"} ]; et2_dialog.show_dialog( - function(button_id) {callback.call(that, button_id, event_data);}, + function(button_id) { + callback.call(that, button_id, event_data); + }, (!event_data.is_private ? event_data['title'] : egw.lang('private')) + "\n" + egw.lang("Do you want to edit this event as an exception or the whole series?"), egw.lang("This event is part of a series"), {}, buttons, et2_dialog.QUESTION_MESSAGE @@ -1259,7 +1320,7 @@ et2_calendar_event.recur_prompt = function(event_data, callback, extra_data) } else { - callback.call(this,'single',event_data); + callback.call(this, 'single', event_data); } }; @@ -1280,14 +1341,14 @@ et2_calendar_event.recur_prompt = function(event_data, callback, extra_data) * called with the button (ok or cancel) and the event data. * @augments {et2_calendar_event} */ -et2_calendar_event.series_split_prompt = function(event_data, instance_date, callback) -{ +et2_calendar_event.series_split_prompt = function(event_data, instance_date, callback) { // seems window.opener somehow in certian conditions could be from different origin // we try to catch the exception and in this case retrive the egw object from current window. - try { - var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar'):window.egw('calendar'); - } - catch(e){ + try + { + var egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar') : window.egw('calendar'); + } catch(e) + { var egw = window.egw('calendar'); } @@ -1300,48 +1361,49 @@ et2_calendar_event.series_split_prompt = function(event_data, instance_date, cal // Check for modifying a series that started before today var tempDate = new Date(); - var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(),tempDate.getHours(),-tempDate.getTimezoneOffset(),tempDate.getSeconds()); - var termination_date = instance_date < today ? egw.lang('today') : date(egw.preference('dateformat'),instance_date); + var today = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(), tempDate.getHours(), -tempDate.getTimezoneOffset(), tempDate.getSeconds()); + var termination_date = instance_date < today ? egw.lang('today') : date(egw.preference('dateformat'), instance_date); if(parseInt(event_data.recur_type)) { et2_dialog.show_dialog( - function(button_id) {callback.call(that, button_id, event_data);}, + function(button_id) { + callback.call(that, button_id, event_data); + }, (!event_data.is_private ? event_data['title'] : egw.lang('private')) + "\n" + egw.lang("Do you really want to change the start of this series? If you do, the original series will be terminated as of %1 and a new series for the future reflecting your changes will be created.", termination_date), - egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL , et2_dialog.WARNING_MESSAGE + egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL, et2_dialog.WARNING_MESSAGE ); } }; -et2_calendar_event.drag_helper = function(event,ui) { +et2_calendar_event.drag_helper = function(event, ui) { ui.helper.width(ui.width()); }; /** -* splits the combined status, quantity and role -* -* @param {string} status - combined value, O: status letter: U, T, A, R -* @param {int} [quantity] - quantity -* @param {string} [role] -* @return string status U, T, A or R, same as $status parameter on return -*/ -et2_calendar_event.split_status = function(status,quantity,role) -{ + * splits the combined status, quantity and role + * + * @param {string} status - combined value, O: status letter: U, T, A, R + * @param {int} [quantity] - quantity + * @param {string} [role] + * @return string status U, T, A or R, same as $status parameter on return + */ +et2_calendar_event.split_status = function(status, quantity, role) { quantity = 1; role = 'REQ-PARTICIPANT'; //error_log(__METHOD__.__LINE__.array2string($status)); var matches = null; - if (typeof status === 'string' && status.length > 1) + if(typeof status === 'string' && status.length > 1) { matches = status.match(/^.([0-9]*)(.*)$/gi); } if(matches) { - if (parseInt(matches[1]) > 0) quantity = parseInt(matches[1]); - if (matches[2]) role = matches[2]; + if(parseInt(matches[1]) > 0) quantity = parseInt(matches[1]); + if(matches[2]) role = matches[2]; status = status[0]; } - else if (status === true) + else if(status === true) { status = 'U'; } @@ -1369,4 +1431,4 @@ function et2_event_action_object_impl(widget, node) }; return aoi; -}; +}; \ No newline at end of file diff --git a/calendar/lang/egw_de.lang b/calendar/lang/egw_de.lang index 61e71b56825..edad80b4c65 100644 --- a/calendar/lang/egw_de.lang +++ b/calendar/lang/egw_de.lang @@ -109,6 +109,7 @@ close the window calendar de Schließt das Fenster compose a mail to all participants after the event is saved calendar de Schreibe eine E-Mail an alle Teilnehmer, nachdem der Termin gespeichert wurde. configuration settings calendar de Einstellungen der Konfiguration conflict calendar de Konflikt +controls whether names of participants are shown alongside the title of an appointment. calendar de Steuert, ob die Namen von Teilnehmern auf einem Termin (neben dem Titel) angezeigt werden. copy of: calendar de Kopie von: copy this event calendar de Kopiert diesen Termin copy your changes to the clipboard, %1reload the entry%2 and merge them. calendar de Kopieren Sie ihre Änderungen in die Zwischenablage, %1laden den Eintrag neu%2 und fügen diese wieder ein. @@ -531,6 +532,7 @@ show only invitations, not yet accepted or rejected calendar de Zeige nur Einlad show only rejected events calendar de Zeige nur abgesagte Termine show only tentative accepted events calendar de Zeige nur vorläufig zugesagte Termine show only the date, not the year admin de Zeige nur das Datum nicht das Jahr +show participant names on event calendar de Zeige Teilnehmer auf einem Termin an show this month calendar de Diesen Monat anzeigen show this week calendar de Diese Woche anzeigen show year and age calendar de Zeige Jahr und Alter diff --git a/calendar/lang/egw_en.lang b/calendar/lang/egw_en.lang index 34dd720aeab..18297081636 100644 --- a/calendar/lang/egw_en.lang +++ b/calendar/lang/egw_en.lang @@ -109,6 +109,7 @@ close the window calendar en Close the window compose a mail to all participants after the event is saved calendar en Compose a mail to all participants after the event is saved. configuration settings calendar en Configuration settings conflict calendar en Conflict +controls whether names of participants are shown alongside the title of an appointment. calendar en Controls whether names of participants are shown alongside the title of an appointment. copy of: calendar en Copy of: copy this event calendar en Copy this event copy your changes to the clipboard, %1reload the entry%2 and merge them. calendar en Copy your changes to the clipboard, %1reload the entry%2 and merge them. @@ -531,6 +532,7 @@ show only invitations, not yet accepted or rejected calendar en Show only invita show only rejected events calendar en Show only rejected events show only tentative accepted events calendar en Show only tentative accepted events show only the date, not the year admin en Show only the date, not the year +show participant names on event calendar en Show participant names on event show this month calendar en Show this month show this week calendar en Show this week show year and age calendar en Show year and age From 04b6b8a94d373ea68fe57ae1aa19602bc223fc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Gr=C3=BCnewald?= Date: Thu, 2 Apr 2020 13:41:23 +0200 Subject: [PATCH 2/2] updated file-formatting --- calendar/inc/class.calendar_hooks.inc.php | 952 +++++++++++----------- 1 file changed, 476 insertions(+), 476 deletions(-) diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php index 3b0558ba0c4..14226ac574c 100644 --- a/calendar/inc/class.calendar_hooks.inc.php +++ b/calendar/inc/class.calendar_hooks.inc.php @@ -28,46 +28,46 @@ class calendar_hooks */ static function search_link($location) { - unset($location); // not used, but in function signature for hooks + unset($location); // not used, but in function signature for hooks return array( - 'query' => 'calendar.calendar_bo.link_query', - 'title' => 'calendar.calendar_bo.link_title', - 'view' => array( + 'query' => 'calendar.calendar_bo.link_query', + 'title' => 'calendar.calendar_bo.link_title', + 'view' => array( 'menuaction' => 'calendar.calendar_uiforms.edit', ), - 'view_id' => 'cal_id', - 'view_popup' => '850x590', - 'edit_popup' => '850x590', - 'list' => array( + 'view_id' => 'cal_id', + 'view_popup' => '850x590', + 'edit_popup' => '850x590', + 'list' => array( 'menuaction' => 'calendar.calendar_uiviews.index', - 'view' => 'listview', - 'ajax' => 'true' + 'view' => 'listview', + 'ajax'=>'true' ), // If calendar is not loaded, load it first, then add - 'add' => 'javascript:var promise = framework.setActiveApp(framework.getApplicationByName(\'calendar\')); if(promise) {promise.then(function() {et2_call(\'app.calendar.add\',params);});} else { app.calendar.add(params);}', - 'add_app' => 'link_app', - 'add_id' => 'link_id', - 'file_access' => 'calendar.calendar_bo.file_access', - 'file_access_user' => true, // file_access supports 4th parameter $user - 'mime' => array( - 'text/calendar' => array( - 'menuaction' => 'calendar.calendar_uiforms.edit', - 'mime_data' => 'ical_data', - 'mime_url' => 'ical_url', - 'mime_popup' => '850x590', + 'add' => 'javascript:var promise = framework.setActiveApp(framework.getApplicationByName(\'calendar\')); if(promise) {promise.then(function() {et2_call(\'app.calendar.add\',params);});} else { app.calendar.add(params);}', + 'add_app' => 'link_app', + 'add_id' => 'link_id', + 'file_access' => 'calendar.calendar_bo.file_access', + 'file_access_user' => true, // file_access supports 4th parameter $user + 'mime' => array( + 'text/calendar' => array( + 'menuaction' => 'calendar.calendar_uiforms.edit', + 'mime_data' => 'ical_data', + 'mime_url' => 'ical_url', + 'mime_popup' => '850x590', 'mime_target' => '_blank' ), 'application/ics' => array( - 'menuaction' => 'calendar.calendar_uiforms.edit', - 'mime_data' => 'ical_data', - 'mime_url' => 'ical_url', - 'mime_popup' => '850x590', + 'menuaction' => 'calendar.calendar_uiforms.edit', + 'mime_data' => 'ical_data', + 'mime_url' => 'ical_url', + 'mime_popup' => '850x590', 'mime_target' => '_blank' ), ), - 'merge' => true, - 'entry' => 'Event', - 'entries' => 'Events', + 'merge' => true, + 'entry' => 'Event', + 'entries' => 'Events', ); } @@ -79,7 +79,7 @@ static function search_link($location) */ static function getAppExportLimit($location) { - unset($location); // not used, but in function signature for hooks + unset($location); // not used, but in function signature for hooks return $GLOBALS['egw_info']['server']['calendar_export_limit']; } @@ -89,13 +89,13 @@ static function getAppExportLimit($location) static function admin() { $file = Array( - 'Site Configuration' => Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=calendar&ajax=true'), - 'Custom fields' => Egw::link('/index.php', 'menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), - 'Global Categories' => Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), - 'Category ACL' => Egw::link('/index.php', 'menuaction=calendar.calendar_uiforms.cat_acl'), - 'Update timezones' => Egw::link('/index.php', 'menuaction=calendar.calendar_timezones.update'), + 'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), + 'Custom fields' => Egw::link('/index.php','menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), + 'Global Categories' => Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), + 'Category ACL' => Egw::link('/index.php','menuaction=calendar.calendar_uiforms.cat_acl'), + 'Update timezones' => Egw::link('/index.php','menuaction=calendar.calendar_timezones.update'), ); - display_section('calendar', 'calendar', $file); + display_section('calendar','calendar',$file); } /** @@ -105,7 +105,7 @@ static function admin() */ static function settings($hook_data) { - if(!$hook_data['setup']) // does not work on setup time + if (!$hook_data['setup']) // does not work on setup time { $bo = new calendar_bo(); $bo->check_set_default_prefs(); @@ -115,12 +115,12 @@ static function settings($hook_data) '0' => lang('No'), ); $list_views = array( - 0 => lang('None'), + 0 => lang('None'), 'month' => lang('Monthview'), 'weekN' => lang('Multiple week view'), - 'week' => lang('Weekview'), - 'day4' => lang('Four days view'), - 'day' => lang('Dayview'), + 'week' => lang('Weekview'), + 'day4' => lang('Four days view'), + 'day' => lang('Dayview'), ); $updates = array( 'no' => lang('Never'), @@ -136,23 +136,23 @@ static function settings($hook_data) 'ical' => lang('iCal / rfc2445'), ); $event_details = array( - 'to-fullname' => lang('Fullname of person to notify'), - 'to-firstname' => lang('Firstname of person to notify'), - 'to-lastname' => lang('Lastname of person to notify'), - 'title' => lang('Title of the event'), - 'description' => lang('Description'), - 'startdate' => lang('Start Date/Time'), - 'enddate' => lang('End Date/Time'), - 'olddate' => lang('Old Startdate'), - 'category' => lang('Category'), - 'location' => lang('Location'), - 'priority' => lang('Priority'), - 'participants' => lang('Participants'), - 'owner' => lang('Owner'), - 'repetition' => lang('Repetitiondetails (or empty)'), - 'action' => lang('Action that caused the notify: Added, Canceled, Accepted, Rejected, ...'), - 'link' => lang('Link to view the event'), - 'disinvited' => lang('Participants uninvited from an event'), + 'to-fullname' => lang('Fullname of person to notify'), + 'to-firstname'=> lang('Firstname of person to notify'), + 'to-lastname' => lang('Lastname of person to notify'), + 'title' => lang('Title of the event'), + 'description' => lang('Description'), + 'startdate' => lang('Start Date/Time'), + 'enddate' => lang('End Date/Time'), + 'olddate' => lang('Old Startdate'), + 'category' => lang('Category'), + 'location' => lang('Location'), + 'priority' => lang('Priority'), + 'participants'=> lang('Participants'), + 'owner' => lang('Owner'), + 'repetition' => lang('Repetitiondetails (or empty)'), + 'action' => lang('Action that caused the notify: Added, Canceled, Accepted, Rejected, ...'), + 'link' => lang('Link to view the event'), + 'disinvited' => lang('Participants uninvited from an event'), ); $weekdaystarts = array( 'Monday' => lang('Monday'), @@ -165,56 +165,56 @@ static function settings($hook_data) 'holiday' => lang('Holidays') ); - if(!isset($hook_data['setup'])) + if (!isset($hook_data['setup'])) { $times = Api\Etemplate\Widget\Select::typeOptions('select-hour', ''); $default_cat_seloptions = Api\Etemplate\Widget\Select::typeOptions('select-cat', ',,,calendar'); } - for($i = 2; $i <= 9; ++$i) + for ($i = 2; $i <= 9; ++$i) { - $muliple_weeks[$i] = lang('%1 weeks', $i); + $muliple_weeks[$i] = lang('%1 weeks',$i); } - for($i = 2; $i <= 20; $i++) + for ($i = 2; $i <= 20; $i++) { $consolidated[$i] = $i; } $intervals = array( - 5 => '5', - 10 => '10', - 15 => '15', - 20 => '20', - 30 => '30', - 45 => '45', - 60 => '60' + 5 => '5', + 10 => '10', + 15 => '15', + 20 => '20', + 30 => '30', + 45 => '45', + 60 => '60' ); $default_participants = array( - 0 => lang('Just me'), + 0 => lang('Just me'), 'selected' => lang('Selected users/groups') ); $defaultresource_sel = array( - 'resources_conflict' => lang('resources with conflict detection'), - 'resources_without_conflict' => lang('resources except conflicting ones') + 'resources_conflict' => lang('resources with conflict detection'), + 'resources_without_conflict' => lang('resources except conflicting ones') ); $reset_stati_on_shifts = array( - 'no' => lang('Never'), - 'all' => lang('Always'), - 'startday' => lang('If start day differs'), + 'no' => lang('Never'), + 'all' => lang('Always'), + 'startday' => lang('If start day differs'), ); $freebusy_values = array( - 0 => lang('No'), - 1 => lang('Yes'), - 2 => lang('With credentials included'), + 0 => lang('No'), + 1 => lang('Yes'), + 2 => lang('With credentials included'), ); - if(!$hook_data['setup']) // does not work at setup time + if (!$hook_data['setup']) // does not work at setup time { $options = array('0' => lang('none')); - foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups', 'app' => 'calendar')) as $group) + foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group) { $options[$group['account_id']] = Api\Accounts::username($group['account_id']); } - $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'], $GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); - $freebusy_url = '' . $freebusy_url . ''; + $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); + $freebusy_url = ''.$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'); $freebusy_help .= ' ' . $freebusy_url; @@ -224,12 +224,12 @@ static function settings($hook_data) } $link_title_options = calendar_bo::get_link_options(); $settings = array( - '1.section' => array( - 'type' => 'section', - 'title' => lang('General settings'), - 'no_lang' => true, - 'xmlrpc' => False, - 'admin' => False + '1.section' => array( + 'type' => 'section', + 'title' => lang('General settings'), + 'no_lang'=> true, + 'xmlrpc' => False, + 'admin' => False ), /* disabled until we have a home app again 'mainscreen_showevents' => array( @@ -242,17 +242,17 @@ static function settings($hook_data) 'admin' => False, 'default'=> '1', // 1 = week ),*/ - 'multiple_weeks' => array( - 'type' => 'select', - 'label' => 'Weeks in multiple week view', - 'name' => 'multiple_weeks', - 'values' => $muliple_weeks, - 'help' => 'How many weeks should the multiple week view show?', - 'xmlrpc' => True, - 'admin' => False, - 'default' => 2, - ), - 'weekdaystarts' => array( + 'multiple_weeks' => array( + 'type' => 'select', + 'label' => 'Weeks in multiple week view', + 'name' => 'multiple_weeks', + 'values' => $muliple_weeks, + 'help' => 'How many weeks should the multiple week view show?', + 'xmlrpc' => True, + 'admin' => False, + 'default'=> 2, + ), + 'weekdaystarts' => array( 'type' => 'select', 'label' => 'weekday starts on', 'name' => 'weekdaystarts', @@ -262,174 +262,174 @@ static function settings($hook_data) 'admin' => False, 'forced' => 'Monday', ), - 'workdaystarts' => array( - 'type' => 'select', - 'label' => 'work day starts on', - 'name' => 'workdaystarts', - 'values' => $times, - '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, - 'default' => 9, - ), - 'workdayends' => array( - 'type' => 'select', - 'label' => 'work day ends on', - 'name' => 'workdayends', - 'values' => $times, - 'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.', - 'xmlrpc' => True, - 'admin' => False, - 'default' => 18, - ), - 'interval' => array( - 'type' => 'select', - 'label' => 'Length of the time interval', - 'name' => 'interval', - 'values' => $intervals, - 'help' => 'How many minutes should each interval last?', - 'xmlrpc' => True, - 'admin' => False, - 'default' => 30, - ), - 'day_consolidate' => array( - 'type' => 'select', - 'label' => 'Minimum number of users for showing day view as consolidated.', - 'name' => 'day_consolidate', - 'values' => $consolidated, - 'help' => 'How many separate calendars to show before merging them together', - 'default' => 6 - ), - 'week_consolidate' => array( - 'type' => 'select', - 'label' => 'Minimum number of users for showing week view as consolidated.', - 'name' => 'week_consolidate', - 'values' => $consolidated, - 'help' => 'How many separate calendars to show before merging them together', - 'default' => 4 - ), - 'use_time_grid' => array( - 'type' => 'multiselect', - 'label' => 'Views showing a list of events', - 'name' => 'use_time_grid', - 'values' => $list_views, - 'help' => 'For which views should calendar just a list of events instead of distinct lines with a fixed time interval.', - 'xmlrpc' => True, - 'admin' => False, + 'workdaystarts' => array( + 'type' => 'select', + 'label' => 'work day starts on', + 'name' => 'workdaystarts', + 'values' => $times, + '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, + 'default'=> 9, + ), + 'workdayends' => array( + 'type' => 'select', + 'label' => 'work day ends on', + 'name' => 'workdayends', + 'values' => $times, + 'help' => 'This defines the end of your dayview. Events after this time, are shown below the dayview.', + 'xmlrpc' => True, + 'admin' => False, + 'default'=> 18, + ), + 'interval' => array( + 'type' => 'select', + 'label' => 'Length of the time interval', + 'name' => 'interval', + 'values' => $intervals, + 'help' => 'How many minutes should each interval last?', + 'xmlrpc' => True, + 'admin' => False, + 'default'=> 30, + ), + 'day_consolidate' => array( + 'type' => 'select', + 'label' => 'Minimum number of users for showing day view as consolidated.', + 'name' => 'day_consolidate', + 'values'=> $consolidated, + 'help' => 'How many separate calendars to show before merging them together', + 'default'=> 6 + ), + 'week_consolidate' => array( + 'type' => 'select', + 'label' => 'Minimum number of users for showing week view as consolidated.', + 'name' => 'week_consolidate', + 'values'=> $consolidated, + 'help' => 'How many separate calendars to show before merging them together', + 'default'=> 4 + ), + 'use_time_grid' => array( + 'type' => 'multiselect', + 'label' => 'Views showing a list of events', + 'name' => 'use_time_grid', + 'values' => $list_views, + 'help' => 'For which views should calendar just a list of events instead of distinct lines with a fixed time interval.', + 'xmlrpc' => True, + 'admin' => False, 'default' => ['weekN', 'month'], ), 'auto_update_on_sidebox_change' => array( - 'type' => 'check', - 'label' => 'Update calendar view immediately when navigation calendar in sidebox is changed', - 'name' => 'auto_update_on_sidebox_change', - 'help' => 'When changing the month', - 'default' => false - ), - '2.section' => array( - 'type' => 'section', - 'title' => lang('appointment settings'), - 'no_lang' => true, - 'xmlrpc' => False, - 'admin' => False + 'type' => 'check', + 'label' => 'Update calendar view immediately when navigation calendar in sidebox is changed', + 'name' => 'auto_update_on_sidebox_change', + 'help' => 'When changing the month', + 'default'=> false + ), + '2.section' => array( + 'type' => 'section', + 'title' => lang('appointment settings'), + 'no_lang'=> true, + 'xmlrpc' => False, + 'admin' => False ), - 'defaultlength' => array( + '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, - 'default' => 60, - ), - 'default_participant' => array( - 'type' => 'select', - 'label' => 'New event participants', - 'name' => 'default_participant', - 'values' => $default_participants, - 'help' => 'Participants automatically added to new events', - 'default' => 'selected', - 'xmlrpc' => False, - 'admin' => False - ), - 'default_category' => array( - 'type' => 'multiselect', - 'label' => 'New event category', - 'name' => 'default_category', - 'help' => 'Category automatically added to new events', - 'values' => $default_cat_seloptions, - 'default' => '', - 'xmlrpc' => False, - 'admin' => False - ), - 'default-alarm' => array( - 'type' => 'date-duration',//'select', - 'label' => lang('Default alarm for regular events') . ' (' . lang('empty = no alarm') . ')', - 'name' => 'default-alarm', - 'help' => 'Alarm added automatic to new events before event start-time', - 'xmlrpc' => True, - 'admin' => False, + 'xmlrpc' => True, + 'admin' => False, + 'default'=> 60, + ), + 'default_participant' => array( + 'type' => 'select', + 'label' => 'New event participants', + 'name' => 'default_participant', + 'values'=> $default_participants, + 'help' => 'Participants automatically added to new events', + 'default' => 'selected', + 'xmlrpc' => False, + 'admin' => False + ), + 'default_category' => array( + 'type' => 'multiselect', + 'label' => 'New event category', + 'name' => 'default_category', + 'help' => 'Category automatically added to new events', + 'values' => $default_cat_seloptions, + 'default' => '', + 'xmlrpc' => False, + 'admin' => False + ), + 'default-alarm' => array( + 'type' => 'date-duration',//'select', + 'label' => lang('Default alarm for regular events').' ('.lang('empty = no alarm').')', + 'name' => 'default-alarm', + 'help' => 'Alarm added automatic to new events before event start-time', + 'xmlrpc' => True, + 'admin' => False, 'default' => '', ), - 'default-alarm-wholeday' => array( - 'type' => 'date-duration',//'select', - 'label' => lang('Default alarm for whole-day events') . ' (' . lang('empty = no alarm') . ')', - 'name' => 'default-alarm-wholeday', - 'help' => lang('Alarm added automatic to new events before event start-time') . ' (' . lang('Midnight') . ')', - 'xmlrpc' => True, - 'admin' => False, + 'default-alarm-wholeday' => array( + 'type' => 'date-duration',//'select', + 'label' => lang('Default alarm for whole-day events').' ('.lang('empty = no alarm').')', + 'name' => 'default-alarm-wholeday', + 'help' => lang('Alarm added automatic to new events before event start-time').' ('.lang('Midnight').')', + 'xmlrpc' => True, + 'admin' => False, 'default' => '', ), ); - if(isset($bo)) // add custom time-spans set by CalDAV clients, not in our prefs + if (isset($bo)) // add custom time-spans set by CalDAV clients, not in our prefs { $prefs = $GLOBALS['egw_info']['user']['preferences']['calendar']; $data = array( - 'prefs' => &$prefs, // use reference to get preference value back + 'prefs' => &$prefs, // use reference to get preference value back 'preprocess' => true, - 'type' => 'user', + 'type' => 'user', ); self::verify_settings_reference($data); } $settings += array( - 'defaultresource_sel' => array( - 'type' => 'select', - 'label' => 'default type of resources selection', - 'name' => 'defaultresource_sel', - 'values' => $defaultresource_sel, - 'help' => 'Default type of resources application selected in the calendar participants research form.', - 'xmlrpc' => True, - 'admin' => False, - 'default' => 'resources' - ), - 'default_private' => array( - 'type' => 'check', - 'label' => 'Set new events to private', - 'name' => 'default_private', - 'help' => 'Should new events created as private by default ?', + 'defaultresource_sel' => array( + 'type' => 'select', + 'label' => 'default type of resources selection', + 'name' => 'defaultresource_sel', + 'values' => $defaultresource_sel, + 'help' => 'Default type of resources application selected in the calendar participants research form.', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 'resources' + ), + '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, 'forced' => '0', ), - 'reset_stati' => array( - 'type' => 'select', - 'label' => 'Reset participant stati on event shifts', - 'name' => 'reset_stati', - 'help' => 'Select whether you want the participant stati reset to unknown, if an event is shifted later on.', - 'values' => $reset_stati_on_shifts, + 'reset_stati' => array( + 'type' => 'select', + 'label' => 'Reset participant stati on event shifts', + 'name' => 'reset_stati', + 'help' => 'Select whether you want the participant stati reset to unknown, if an event is shifted later on.', + 'values' => $reset_stati_on_shifts, 'default' => 'all', - 'xmlrpc' => True, - 'admin' => False, + 'xmlrpc' => True, + 'admin' => False, ), 'no_category_custom_color' => array( - 'type' => 'color', - 'label' => 'Custom event color', + 'type' => 'color', + 'label' => 'Custom event color', 'no_lang' => true, - 'name' => 'no_category_custom_color', - 'help' => lang('Custom color for events without category color'), - 'xmlrpc' => True, - 'admin' => False, + 'name' => 'no_category_custom_color', + 'help' => lang('Custom color for events without category color'), + 'xmlrpc' => True, + 'admin' => False, ), 'participant_names' => array( 'type' => 'check', @@ -438,22 +438,22 @@ static function settings($hook_data) 'help' => 'Controls whether names of participants are shown alongside the title of an appointment.', 'default' => false ), - '2.5.section' => array( - 'type' => 'section', - 'title' => lang('Configuration settings'), - 'no_lang' => true, - 'xmlrpc' => False, - 'admin' => False - ), - 'new_event_dialog' => array( - 'type' => 'select', - 'label' => 'Add appointments via shortened dialog or complete edit window', - 'name' => 'new_event_dialog', - 'values' => array('add' => lang('Quick add'), 'edit' => lang('Regular edit')), - 'help' => 'Use quick add or full edit dialog when creating a new event', - 'default' => 'add', - ), - 'limit_des_lines' => array( + '2.5.section' => array( + 'type' => 'section', + 'title' => lang('Configuration settings'), + 'no_lang'=> true, + 'xmlrpc' => False, + 'admin' => False + ), + 'new_event_dialog' => array( + 'type' => 'select', + 'label' => 'Add appointments via shortened dialog or complete edit window', + 'name' => 'new_event_dialog', + 'values'=> array('add' => lang('Quick add'), 'edit' => lang('Regular edit')), + 'help' => 'Use quick add or full edit dialog when creating a new event', + 'default' => 'add', + ), + 'limit_des_lines' => array( 'type' => 'input', 'size' => 5, 'label' => 'Limit number of description lines in list view (default 5, 0 for no limit)', @@ -462,22 +462,22 @@ static function settings($hook_data) 'xmlrpc' => True, 'admin' => False ), - 'limit_all_day_lines' => array( - 'type' => 'input', - 'size' => 5, - 'label' => 'Limit number of lines for all day events', - 'name' => 'limit_all_day_lines', - 'help' => 'How many lines of all day events should be directly visible. Further lines are available via a mouseover.', - 'xmlrpc' => True, - 'default' => 3, - 'admin' => False - ), - 'planner_show_empty_rows' => array( + 'limit_all_day_lines' => array( + 'type' => 'input', + 'size' => 5, + 'label' => 'Limit number of lines for all day events', + 'name' => 'limit_all_day_lines', + 'help' => 'How many lines of all day events should be directly visible. Further lines are available via a mouseover.', + 'xmlrpc' => True, + 'default'=> 3, + 'admin' => False + ), + 'planner_show_empty_rows' => array( 'type' => 'select', 'label' => 'Show empty rows in Planner', 'name' => 'planner_show_empty_rows', 'values' => array( - 0 => lang('no'), + 0 => lang('no'), 'user' => lang('Planner by user'), 'cat' => lang('Planner by category'), 'both' => lang('All'), @@ -487,71 +487,71 @@ static function settings($hook_data) 'admin' => False, 'forced' => 'user', ), - 'birthdays_as_events' => array( - 'type' => 'multiselect', - 'values' => $birthdays_as_events, - 'label' => 'Show birthdays as events', - 'name' => 'birthdays_as_events', - 'help' => 'Show birthdays as all day non-blocking events as well as via mouseover of the date.', - 'default' => 'none' - ), - 'link_title' => array( - 'type' => 'multiselect', - 'label' => 'Link title for events to show', - 'name' => 'link_title', - 'values' => $link_title_options, - 'help' => 'What should links to the calendar events display in other applications.', - 'xmlrpc' => True, - 'admin' => false, - 'default' => '', + 'birthdays_as_events' => array( + 'type' => 'multiselect', + 'values' => $birthdays_as_events, + 'label' => 'Show birthdays as events', + 'name' => 'birthdays_as_events', + 'help' => 'Show birthdays as all day non-blocking events as well as via mouseover of the date.', + 'default'=> 'none' + ), + 'link_title' => array( + 'type' => 'multiselect', + 'label' => 'Link title for events to show', + 'name' => 'link_title', + 'values' => $link_title_options, + 'help' => 'What should links to the calendar events display in other applications.', + 'xmlrpc' => True, + 'admin' => false, + 'default'=> '', ), - '3.section' => array( - 'type' => 'section', - 'title' => lang('notification settings'), - 'no_lang' => true, - 'xmlrpc' => False, - '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, - 'default' => 'time_change', - ), - 'receive_own_updates' => array( - 'type' => 'select', - 'label' => 'Receive notifications about events you created/modified/deleted', - 'name' => 'receive_own_updates', - 'values' => $yesno, - 'help' => "Do you want to be notified about changes of appointments you modified?", - 'xmlrpc' => True, - 'admin' => False, - 'default' => 'false', + '3.section' => array( + 'type' => 'section', + 'title' => lang('notification settings'), + 'no_lang'=> true, + 'xmlrpc' => False, + '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, + 'default'=> 'time_change', + ), + 'receive_own_updates' => array( + 'type' => 'select', + 'label' => 'Receive notifications about events you created/modified/deleted', + 'name' => 'receive_own_updates', + 'values' => $yesno, + 'help' => "Do you want to be notified about changes of appointments you modified?", + 'xmlrpc' => True, + 'admin' => False, + 'default'=> 'false', ), 'receive_not_participating' => array( - 'type' => 'select', - 'label' => 'Do you want responses from events you created, but are not participating in?', - 'name' => 'receive_not_participating', - 'values' => $yesno, - 'help' => 'Do you want to be notified about participant responses from events you created, but are not participating in?', - 'default' => '1' - ), - 'notify_externals' => array( - 'type' => 'select', - 'label' => 'Notify non-EGroupware users about event updates', - 'name' => 'notify_externals', - 'values' => $updates, - 'help' => 'Do you want non-EGroupware participants of events you created to be automatically notified about new or changed appointments?', - 'xmlrpc' => True, - 'admin' => False, - 'default' => 'no', - ), - 'update_format' => array( + 'type' => 'select', + 'label' => 'Do you want responses from events you created, but are not participating in?', + 'name' => 'receive_not_participating', + 'values' => $yesno, + 'help' => 'Do you want to be notified about participant responses from events you created, but are not participating in?', + 'default'=> '1' + ), + 'notify_externals' => array( + 'type' => 'select', + 'label' => 'Notify non-EGroupware users about event updates', + 'name' => 'notify_externals', + 'values' => $updates, + 'help' => 'Do you want non-EGroupware participants of events you created to be automatically notified about new or changed appointments?', + 'xmlrpc' => True, + 'admin' => False, + 'default'=> 'no', + ), + 'update_format' => array( 'type' => 'select', 'label' => 'Format of event updates', 'name' => 'update_format', @@ -561,146 +561,146 @@ static function settings($hook_data) 'admin' => False, 'forced' => 'ical', ), - '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.', + '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, - '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, + 'values' => $event_details, 'subst_help' => False, - 'xmlrpc' => True, - 'admin' => False, - ), - 'notifyModified' => array( - 'type' => 'notify', - 'label' => 'Notification messages for modified events', - 'name' => 'notifyModified', - 'rows' => 5, - 'cols' => 50, - 'help' => 'This message is sent for modified or moved events.', - 'default' => '', - 'values' => $event_details, + 'xmlrpc' => True, + 'admin' => False, + ), + 'notifyModified' => array( + 'type' => 'notify', + 'label' => 'Notification messages for modified events', + 'name' => '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, - ), - 'notifyDisinvited' => array( - 'type' => 'notify', - 'label' => 'Notification messages for uninvited participants', - 'name' => 'notifyDisinvited', - 'rows' => 5, - 'cols' => 50, - 'help' => 'This message is sent to uninvited participants.', - 'values' => $event_details, + 'xmlrpc' => True, + 'admin' => False, + ), + 'notifyDisinvited' => array( + 'type' => 'notify', + 'label' => 'Notification messages for uninvited participants', + 'name' => 'notifyDisinvited', + 'rows' => 5, + 'cols' => 50, + 'help' => 'This message is sent to uninvited participants.', + '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.', - 'values' => $event_details, + '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.', + '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.', - 'values' => $event_details, + '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.', + 'values' => $event_details, 'subst_help' => False, - 'xmlrpc' => True, - 'admin' => False, + 'xmlrpc' => True, + 'admin' => False, ), - '4.section' => array( - 'type' => 'section', - 'title' => lang('Data exchange settings'), - 'no_lang' => true, - 'xmlrpc' => False, - 'admin' => False + '4.section' => array( + 'type' => 'section', + 'title' => lang('Data exchange settings'), + 'no_lang'=> true, + 'xmlrpc' => False, + 'admin' => False ), ); // Merge print - if($GLOBALS['egw_info']['user']['apps']['filemanager']) + if ($GLOBALS['egw_info']['user']['apps']['filemanager']) { $settings['default_document'] = array( - 'type' => 'vfs_file', - 'size' => 60, - 'label' => 'Default document to insert entries', - 'name' => 'default_document', - 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('calendar')) . ' ' . - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title') . ' ' . - lang('The following document-types are supported:') . implode(',', Api\Storage\Merge::get_file_extensions()), + 'type' => 'vfs_file', + 'size' => 60, + 'label' => 'Default document to insert entries', + 'name' => 'default_document', + 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('calendar')).' '. + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. + lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), 'run_lang' => false, - 'xmlrpc' => True, - 'admin' => False, + 'xmlrpc' => True, + 'admin' => False, ); $settings['document_dir'] = array( - 'type' => 'vfs_dirs', - 'size' => 60, - 'label' => 'Directory with documents to insert entries', - 'name' => 'document_dir', - 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.', lang('calendar')) . ' ' . - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title') . ' ' . - lang('The following document-types are supported:') . implode(',', Api\Storage\Merge::get_file_extensions()), + 'type' => 'vfs_dirs', + 'size' => 60, + 'label' => 'Directory with documents to insert entries', + 'name' => 'document_dir', + 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('calendar')).' '. + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. + lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), 'run_lang' => false, - 'xmlrpc' => True, - 'admin' => False, - 'default' => '/templates/calendar', + 'xmlrpc' => True, + 'admin' => False, + 'default' => '/templates/calendar', ); } $settings += array( 'export_timezone' => array( - 'type' => 'select', - 'label' => 'Timezone of event iCal file import/export', - 'name' => 'export_timezone', - 'values' => $export_tzs, - 'help' => 'Use this timezone to import/export calendar data.', - 'xmlrpc' => True, - 'admin' => False, + 'type' => 'select', + 'label' => 'Timezone of event iCal file import/export', + 'name' => 'export_timezone', + 'values' => $export_tzs, + 'help' => 'Use this timezone to import/export calendar data.', + 'xmlrpc' => True, + 'admin' => False, 'default' => '0', // Use event's TZ ), - 'freebusy' => array( - 'type' => 'select', - 'label' => 'Make freebusy information available to not logged in persons?', - 'name' => 'freebusy', - 'help' => $freebusy_help, - 'values' => $freebusy_values, - 'run_lang' => false, + 'freebusy' => array( + 'type' => 'select', + 'label' => 'Make freebusy information available to not logged in persons?', + 'name' => 'freebusy', + 'help' => $freebusy_help, + 'values' => $freebusy_values, + 'run_lang' => false, 'subst_help' => False, - 'xmlrpc' => True, - 'admin' => False, - 'forced' => 0, + 'xmlrpc' => True, + 'admin' => False, + 'forced' => 0, ), - '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!!!', + '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, 'forced' => '' @@ -735,30 +735,30 @@ public static function verify_settings_reference(array &$data) { //error_log(__METHOD__."(".array2string($data).")"); // caldav perfs are always user specific and cant by switched off - if($data['type'] != 'user') return; + if ($data['type'] != 'user') return; $account_lid = $GLOBALS['egw_info']['user']['account_lid']; foreach(array( - 'default-alarm' => 'default-alarm-vevent-datetime:/' . $account_lid . '/:urn:ietf:params:xml:ns:caldav', - 'default-alarm-wholeday' => 'default-alarm-vevent-date:/' . $account_lid . '/:urn:ietf:params:xml:ns:caldav', - ) as $name => $dav) + 'default-alarm' => 'default-alarm-vevent-datetime:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', + 'default-alarm-wholeday' => 'default-alarm-vevent-date:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', + ) as $name => $dav) { $pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; - if(true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match + if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match $val =& $data['prefs'][$name]; //error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val"); - if($data['preprocess']) // showing preferences + if ($data['preprocess']) // showing preferences { - if(!isset($val)) // no calendar pref --> read value from caldav + if (!isset($val)) // no calendar pref --> read value from caldav { $matches = null; - if(preg_match('/^ACTION:NONE$/mi', $pref)) + if (preg_match('/^ACTION:NONE$/mi', $pref)) { $val = ''; } - elseif(preg_match('/^TRIGGER:-PT(\d+(M|H|D))$/mi', $pref, $matches)) + elseif (preg_match('/^TRIGGER:-PT(\d+(M|H|D))$/mi', $pref, $matches)) { static $factors = array( 'M' => 1, @@ -766,7 +766,7 @@ public static function verify_settings_reference(array &$data) 'D' => 1440, ); $factor = $factors[strtoupper($matches[2])]; - $val = $factor * (int)$matches[1]; + $val = $factor*(int)$matches[1]; } else { @@ -776,9 +776,9 @@ public static function verify_settings_reference(array &$data) //error_log(__METHOD__."() setting $name={$val} from $dav='$pref'"); } } - else // storing preferences + else // storing preferences { - if(empty($pref) || !preg_match('/^TRIGGER:/m', $pref)) + if (empty($pref) || !preg_match('/^TRIGGER:/m', $pref)) { $pref = 'BEGIN:VALARM TRIGGER:-PT1H @@ -787,17 +787,17 @@ public static function verify_settings_reference(array &$data) END:VALARM'; } $trigger = $val < 0 ? 'TRIGGER:PT' : 'TRIGGER:-PT'; - if((string)$val === '') + if ((string)$val === '') { $pref = preg_replace('/^ACTION:.*$/m', 'ACTION:NONE', $pref); } - elseif(abs($val) < 60) + elseif (abs($val) < 60) { - $pref = preg_replace('/^TRIGGER:.*$/m', $trigger . number_format(abs($val), 0) . 'M', $pref); + $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val), 0).'M', $pref); } else { - $pref = preg_replace('/^TRIGGER:.*$/m', $trigger . number_format(abs($val) / 60, 0) . 'H', $pref); + $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val)/60, 0).'H', $pref); } $GLOBALS['egw']->preferences->add('groupdav', $dav, $pref, 'user'); //error_log(__METHOD__."() storing $name=$val --> $dav='$pref'"); @@ -813,9 +813,9 @@ public static function verify_settings_reference(array &$data) public static function sync_default_alarms() { self::verify_settings(array( - 'prefs' => array(), + 'prefs' => array(), 'preprocess' => true, - 'type' => 'user', + 'type' => 'user', )); } @@ -843,7 +843,7 @@ public static function acl_rights($params) ); $require_acl_invite = $GLOBALS['egw_info']['server']['require_acl_invite']; - if(!$require_acl_invite || $require_acl_invite == 'groups' && !($params['owner'] < 0)) + if (!$require_acl_invite || $require_acl_invite == 'groups' && !($params['owner'] < 0)) { unset($rights[Acl::CUSTOM3]); } @@ -858,7 +858,7 @@ public static function acl_rights($params) */ public static function categories($data) { - unset($data); // not used, but in function signature for hooks + unset($data); // not used, but in function signature for hooks return true; } @@ -869,11 +869,11 @@ public static function categories($data) */ public static function mail_import($args) { - unset($args); // not used, but required by function signature + unset($args); // not used, but required by function signature - return array( + return array ( 'menuaction' => 'calendar.calendar_uiforms.mail_import', - 'popup' => Link::get_registry('calendar', 'edit_popup') + 'popup' => Link::get_registry('calendar', 'edit_popup') ); } @@ -883,29 +883,29 @@ public static function mail_import($args) * @param type $params * @return type */ - public static function notifications_actions($params) + public static function notifications_actions ($params) { Api\Translation::add_app('calendar'); // do not set actions for alarm type - if($params['data']['type'] == 6) return array(); + if ($params['data']['type'] == 6) return array(); return array( array( - 'id' => 'A', - 'caption' => lang('Accept'), - 'icon' => 'accepted', - 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",[' . $params['data']['event_id'] . ',' . $params['data']['user_id'] . ',' . '"A"' . ']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' + 'id' => 'A', + 'caption' => lang('Accept'), + 'icon' => 'accepted', + 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",['.$params['data']['event_id'].','.$params['data']['user_id'].','.'"A"'.']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' ), array( - 'id' => 'R', - 'caption' => lang('Reject'), - 'icon' => 'rejected', - 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",[' . $params['data']['event_id'] . ',' . $params['data']['user_id'] . ',' . '"R"' . ']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' + 'id' => 'R', + 'caption' => lang('Reject'), + 'icon' => 'rejected', + 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",['.$params['data']['event_id'].','.$params['data']['user_id'].','.'"R"'.']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' ), array( - 'id' => 'T', - 'caption' => lang('Tentative'), - 'icon' => 'tentative', - 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",[' . $params['data']['event_id'] . ',' . $params['data']['user_id'] . ',' . '"T"' . ']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' + 'id' => 'T', + 'caption' => lang('Tentative'), + 'icon' => 'tentative', + 'onExecute' => 'egw().json("calendar.calendar_uiforms.ajax_status",['.$params['data']['event_id'].','.$params['data']['user_id'].','.'"T"'.']).sendRequest(true);this.button_delete(arguments[0], arguments[1]);' ) ); }