Changeset 17966
- Timestamp:
- 10/06/08 13:59:01 (2 months ago)
- Files:
-
- branches/MidCOM_2_8/org.openpsa.calendar/config/config.inc (modified) (1 diff)
- branches/MidCOM_2_8/org.openpsa.calendar/handler/admin.php (modified) (3 diffs)
- branches/MidCOM_2_8/org.openpsa.calendar/handler/create.php (modified) (2 diffs)
- branches/MidCOM_2_8/org.openpsa.calendar/handler/filters.php (modified) (2 diffs)
- branches/MidCOM_2_8/org.openpsa.calendar/handler/view.php (modified) (13 diffs)
- branches/MidCOM_2_8/org.openpsa.calendar/locale/default.en.txt (modified) (4 diffs)
- branches/MidCOM_2_8/org.openpsa.calendar/locale/default.fi.txt (modified) (4 diffs)
- branches/MidCOM_2_8/org.openpsa.calendar/style/calendar-filter-chooser.php (added)
- branches/MidCOM_2_8/org.openpsa.calendar/style/show-event-delete.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/org.openpsa.calendar/config/config.inc
r3853 r17966 1 "schemadb" => "file:/org/openpsa/calendar/config/schemadb_default.inc", 2 "week_slot_length" => 120, // minutes 3 "day_slot_length" => 60, // minutes 4 "day_start_time" => 8, // hour "working day" starts 5 "day_end_time" => 18, // hour "working day" ends 6 "calendar_popup_width" => 500, // width of the popup in pixels 7 "calendar_popup_height" => 550, // height of the popup in pixels 8 "show_group_subscribers" => FALSE, // whether to show members of "subscriber" groups 1 'schemadb' => 'file:/org/openpsa/calendar/config/schemadb_default.inc', 2 'schemadb_filters' => 'file:/org/openpsa/calendar/config/schemadb_filters.inc', 3 4 'week_slot_length' => 120, // minutes 5 'day_slot_length' => 60, // minutes 6 'day_start_time' => 8, // hour 'working day' starts 7 'day_end_time' => 18, // hour 'working day' ends 8 'calendar_popup_width' => 500, // width of the popup in pixels 9 'calendar_popup_height' => 550, // height of the popup in pixels 10 'show_group_subscribers' => FALSE, // whether to show members of 'subscriber' groups 9 11 'start_view' => 'week', // which view to start in 10 12 'wiki_title_skeleton' => 'meeting note for %s on %s by %s', //format of wiki page title created from event branches/MidCOM_2_8/org.openpsa.calendar/handler/admin.php
r17959 r17966 162 162 debug_pop(); 163 163 } 164 164 165 /** 166 * Show the requested administrator view 167 * 168 * @access public 169 * @param String $handler_id Name of the request handler 170 * @param array &$data Public request data, passed by reference 171 */ 165 172 function _show_admin($handler_id, &$data) 166 173 { … … 208 215 } 209 216 217 switch ($this->_controller->process_form()) 218 { 219 case 'save': 220 case 'cancel': 221 $_MIDCOM->relocate("event/{$this->_event->id}/"); 222 // This will exit 223 } 224 210 225 return true; 211 226 } … … 241 256 function _handler_delete($handler_id, $args, &$data) 242 257 { 258 $this->_event->require_do('midgard:delete'); 259 $this->_request_data['delete_succeeded'] = false; 260 261 // Cancel pressed 262 if (isset($_POST['org_openpsa_calendar_delete_cancel'])) 263 { 264 $_MIDCOM->relocate("event/{$this->_event->id}/"); 265 // This will exit 266 } 267 268 // Delete confirmed, remove the event 269 if (isset($_POST['org_openpsa_calendar_deleteok'])) 270 { 271 $this->_request_data['delete_succeeded'] = true; 272 $this->_event->delete(); 273 } 274 243 275 return true; 244 276 } branches/MidCOM_2_8/org.openpsa.calendar/handler/create.php
r17959 r17966 100 100 function & dm2_create_callback (&$controller) 101 101 { 102 $this->_event = new midcom_ db_event();102 $this->_event = new midcom_org_openpsa_event(); 103 103 $this->_event->up = $this->_root_event->id; 104 104 … … 128 128 { 129 129 // Get the root event 130 $this->_root_event = new midcom_ db_event($this->_config->get('calendar_root_event'));130 $this->_root_event = new midcom_org_openpsa_event($this->_config->get('calendar_root_event')); 131 131 132 132 if ( !$this->_root_event branches/MidCOM_2_8/org.openpsa.calendar/handler/filters.php
r17959 r17966 19 19 parent::midcom_baseclasses_components_handler(); 20 20 } 21 21 22 /** 23 * Handle the AJAX request 24 */ 22 25 function _handle_ajax() 23 26 { … … 49 52 } 50 53 54 /** 55 * Handle the request for editing contact list 56 * 57 * @access public 58 * @param String $handler_id Name of the request handler 59 * @param array $args Variable arguments 60 * @param array &$data Public request data, passed by reference 61 * @return boolean Indicating success 62 */ 51 63 function _handler_edit($handler_id, $args, &$data) 52 64 { 53 65 $_MIDCOM->auth->require_valid_user(); 54 55 $this->_request_data['user'] = $_MIDCOM->auth->user->get_storage(); 56 57 if ( array_key_exists('org_openpsa_calendar_filters_add', $_POST) 58 || array_key_exists('org_openpsa_calendar_filters_remove', $_POST)) 66 67 // Get the current user 68 $this->_person = new midcom_db_person($_MIDGARD['user']); 69 $this->_person->require_do('midgard:update'); 70 71 // Load the schema database 72 $this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_filters')); 73 74 // Load the controller 75 $this->_controller = midcom_helper_datamanager2_controller::create('simple'); 76 $this->_controller->schemadb =& $this->_schemadb; 77 $this->_controller->set_storage($this->_person); 78 if (! $this->_controller->initialize()) 59 79 { 60 $this->_handle_ajax(); 80 $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to initialize a DM2 controller instance for article {$this->_article->id}."); 81 // This will exit. 61 82 } 62 63 // Debug helpers 64 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/org.openpsa.helpers/messages.js"); 65 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/org.openpsa.helpers/ajaxutils.js"); 66 67 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/org.openpsa.calendar/filters.js"); 68 $_MIDCOM->add_jsonload("org_openpsa_calendar_filters_makeEditable();"); 69 70 $this->_request_data['buddylist'] = array(); 71 72 $qb = org_openpsa_contacts_buddy::new_query_builder(); 73 $qb->add_constraint('account', '=', $this->_request_data['user']->guid); 74 $qb->add_constraint('blacklisted', '=', false); 75 $buddies = $qb->execute(); 76 77 foreach ($buddies as $buddy) 83 84 // Process the form 85 switch ($this->_controller->process_form()) 78 86 { 79 $person = new org_openpsa_contacts_person($buddy->buddy); 80 if ($person) 81 { 82 $this->_request_data['buddylist'][$person->id] = $person; 83 } 87 case 'save': 88 case 'cancel': 89 if (isset($_GET['org_openpsa_calendar_returnurl'])) 90 { 91 $url = $_GET['org_openpsa_calendar_returnurl']; 92 } 93 else 94 { 95 $url = ''; 96 } 97 $_MIDCOM->relocate($url); 98 // This will exit 84 99 } 85 86 // Add user to the filter list if needed 87 if ( !array_key_exists($this->_request_data['user']->id, $this->_request_data['buddylist']) 88 && $_MIDCOM->auth->can_do('midgard:create', $GLOBALS['midcom_component_data']['org.openpsa.calendar']['calendar_root_event'])) 100 101 // Add the breadcrumb pieces 102 $tmp = array(); 103 104 if (isset($_GET['org_openpsa_calendar_returnurl'])) 89 105 { 90 $this->_request_data['buddylist'][$this->_request_data['user']->id] = $this->_request_data['user']; 91 } 92 93 if (array_key_exists('org_openpsa_calendar_returnurl', $_GET)) 94 { 95 $this->_view_toolbar->add_item( 96 array 97 ( 98 MIDCOM_TOOLBAR_URL => $_GET['org_openpsa_calendar_returnurl'], 99 MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('back to calendar'), 100 MIDCOM_TOOLBAR_HELPTEXT => null, 101 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png', 102 MIDCOM_TOOLBAR_ENABLED => true, 103 ) 106 $tmp[] = array 107 ( 108 MIDCOM_NAV_URL => $_GET['org_openpsa_calendar_returnurl'], 109 MIDCOM_NAV_NAME => $this->_l10n->get('calendar'), 104 110 ); 105 111 } 106 107 $_MIDCOM->set_pagetitle($this->_request_data['l10n']->get('choose calendars')); 112 113 $tmp[] = array 114 ( 115 MIDCOM_NAV_URL => 'filters/', 116 MIDCOM_NAV_NAME => $this->_l10n->get('choose calendars'), 117 ); 118 $_MIDCOM->set_custom_context_data('midcom.helper.nav.breadcrumb', $tmp); 108 119 109 120 return true; 110 121 } 111 122 123 /** 124 * Show the contact editing interface 125 * 126 * @access public 127 * @param String $handler_id Name of the request handler 128 * @param array &$data Public request data, passed by reference 129 */ 112 130 function _show_edit($handler_id, &$data) 113 131 { 114 if (count($this->_request_data['buddylist']) > 0) 115 { 116 midcom_show_style("show-filters-header"); 117 foreach ($this->_request_data['buddylist'] as $person) 118 { 119 $this->_request_data['person'] =& $person; 120 if ($this->_request_data['user']->parameter('org_openpsa_calendar_show', $person->guid)) 121 { 122 $this->_request_data['subscribed'] = true; 123 } 124 else 125 { 126 $this->_request_data['subscribed'] = false; 127 } 128 midcom_show_style("show-filters-item"); 129 } 130 midcom_show_style("show-filters-footer"); 131 } 132 $data['controller'] =& $this->_controller; 133 $data['person'] =& $this->_person; 134 135 midcom_show_style('calendar-filter-chooser'); 132 136 } 133 137 } branches/MidCOM_2_8/org.openpsa.calendar/handler/view.php
r17959 r17966 46 46 } 47 47 48 /** 49 * Populate the toolbar 50 * 51 * @access private 52 * @param String $today_path Path to the today's calendar 53 */ 48 54 function _populate_toolbar($today_path = null) 49 55 { … … 65 71 ( 66 72 'rel' => 'directlink', 67 'on Click' => org_openpsa_calendar_interface::calendar_newevent_js($this_node),73 'onclick' => org_openpsa_calendar_interface::calendar_newevent_js($this_node), 68 74 ), 69 75 ) … … 177 183 ( 178 184 'rel' => 'directlink', 179 'on Click' => 'javascript:openPsaShowMonthSelector();',185 'onclick' => 'javascript:openPsaShowMonthSelector();', 180 186 ), 181 187 ) … … 215 221 return $datestring; 216 222 } 217 223 224 /** 225 * Populate the calendar with resources 226 * 227 * @access private 228 * @param midcom_db_person $resource 229 * @param int $from Start time 230 * @param int $to End time 231 */ 218 232 function _populate_calendar_resource($resource, $from, $to) 219 233 { … … 292 306 return $resource_array; 293 307 } 294 308 309 /** 310 * Populate the calendar with selected contacts 311 * 312 * @access private 313 * @param int $from Start time 314 * @param int $to End time 315 */ 295 316 function _populate_calendar_contacts($from, $to) 296 317 { … … 298 319 299 320 $user = $_MIDCOM->auth->user->get_storage(); 321 300 322 if ( $this->_config->get('always_show_self') 301 323 || $user->parameter('org_openpsa_calendar_show', $user->guid)) … … 304 326 $this->_request_data['calendar']->_resources[$user->guid] = $this->_populate_calendar_resource($user, $from, $to); 305 327 } 328 306 329 $shown_persons[$user->id] = true; 307 330 308 331 $subscribed_contacts = $user->list_parameters('org_openpsa_calendar_show'); 332 333 // Backwards compatibiltiy 309 334 foreach ($subscribed_contacts as $guid => $subscribed) 310 335 { … … 312 337 $this->_request_data['calendar']->_resources[$person->guid] = $this->_populate_calendar_resource($person, $from, $to); 313 338 $shown_persons[$person->id] = true; 339 } 340 341 // New UI for showing resources 342 foreach ($user->list_parameters('org.openpsa.calendar.filters') as $type => $value) 343 { 344 $selected = @unserialize($value); 345 346 // Skip empty 347 if ( !$selected 348 || empty($selected)) 349 { 350 continue; 351 } 352 353 // Include each type 354 switch ($type) 355 { 356 case 'people': 357 foreach ($selected as $guid) 358 { 359 $person = new midcom_db_person($guid); 360 $this->_request_data['calendar']->_resources[$person->guid] = $this->_populate_calendar_resource($person, $from, $to); 361 $shown_persons[$person->id] = true; 362 } 363 break; 364 365 case 'groups': 366 foreach ($selected as $guid) 367 { 368 // Get the group 369 $group = new midcom_db_group($guid); 370 371 if ( !$group 372 || !$group->guid) 373 { 374 continue; 375 } 376 377 // Get the members 378 $mc = midcom_db_member::new_collector('gid', $group->id); 379 $mc->add_value_property('uid'); 380 $mc->add_order('metadata.score'); 381 $mc->execute(); 382 383 $keys = $mc->list_keys(); 384 385 foreach ($keys as $membership_guid => $array) 386 { 387 $person = new midcom_db_person($mc->get_subkey($membership_guid, 'uid')); 388 $this->_request_data['calendar']->_resources[$person->guid] = $this->_populate_calendar_resource($person, $from, $to); 389 $shown_persons[$person->id] = true; 390 } 391 } 392 break; 393 } 314 394 } 315 395 … … 434 514 $this->_request_data['calendar']->reservation_div_options = array 435 515 ( 436 'on Click' => org_openpsa_calendar_interface::calendar_editevent_js('__GUID__', $this_node),516 'onclick' => org_openpsa_calendar_interface::calendar_editevent_js('__GUID__', $this_node), 437 517 ); 438 518 if ($_MIDCOM->auth->can_do('midgard:create', $GLOBALS['midcom_component_data']['org.openpsa.calendar']['calendar_root_event'])) … … 440 520 $this->_request_data['calendar']->free_div_options = array 441 521 ( 442 'on Click' => org_openpsa_calendar_interface::calendar_newevent_js($this_node, '__START__', '__RESOURCE__'),522 'onclick' => org_openpsa_calendar_interface::calendar_newevent_js($this_node, '__START__', '__RESOURCE__'), 443 523 ); 444 524 } … … 527 607 $this->_request_data['calendar']->reservation_div_options = array 528 608 ( 529 'on Click' => org_openpsa_calendar_interface::calendar_editevent_js('__GUID__', $this_node),609 'onclick' => org_openpsa_calendar_interface::calendar_editevent_js('__GUID__', $this_node), 530 610 ); 531 611 if ($_MIDCOM->auth->can_do('midgard:create', $GLOBALS['midcom_component_data']['org.openpsa.calendar']['calendar_root_event'])) … … 533 613 $this->_request_data['calendar']->free_div_options = array 534 614 ( 535 'on Click' => org_openpsa_calendar_interface::calendar_newevent_js($this_node, '__START__', '__RESOURCE__'),615 'onclick' => org_openpsa_calendar_interface::calendar_newevent_js($this_node, '__START__', '__RESOURCE__'), 536 616 ); 537 617 } … … 679 759 $this->_request_data['calendar']->reservation_div_options = array 680 760 ( 681 'on Click' => org_openpsa_calendar_interface::calendar_editevent_js('__GUID__', $this_node),761 'onclick' => org_openpsa_calendar_interface::calendar_editevent_js('__GUID__', $this_node), 682 762 ); 683 763 } 684 764 $this->_request_data['calendar']->free_div_options = array 685 765 ( 686 'on Click' => org_openpsa_calendar_interface::calendar_newevent_js($this_node, '__START__', '__RESOURCE__'),766 'onclick' => org_openpsa_calendar_interface::calendar_newevent_js($this_node, '__START__', '__RESOURCE__'), 687 767 ); 688 768 branches/MidCOM_2_8/org.openpsa.calendar/locale/default.en.txt
r4574 r17966 10 10 ---STRING back to calendar 11 11 Back to calendar 12 ---STRINGEND 13 14 ---STRING calendar 15 Calendar 12 16 ---STRINGEND 13 17 … … 80 84 ---STRINGEND 81 85 86 ---STRING groups 87 Groups 88 ---STRINGEND 89 82 90 ---STRING location 83 91 Location … … 110 118 ---STRING participants 111 119 Participants 120 ---STRINGEND 121 122 ---STRING people 123 People 112 124 ---STRINGEND 113 125 … … 156 168 ---STRINGEND 157 169 170 ---STRING resources 171 Resources 172 ---STRINGEND 173 branches/MidCOM_2_8/org.openpsa.calendar/locale/default.fi.txt
r4574 r17966 10 10 ---STRING back to calendar 11 11 Takaisin kalenteriin 12 ---STRINGEND 13 14 ---STRING calendar 15 Kalenteri 12 16 ---STRINGEND 13 17 … … 80 84 ---STRINGEND 81 85 86 ---STRING groups 87 RyhmÀt 88 ---STRINGEND 89 82 90 ---STRING location 83 91 Paikka … … 110 118 ---STRING participants 111 119 Osallistujat 120 ---STRINGEND 121 122 ---STRING people 123 Henkilöt 112 124 ---STRINGEND 113 125 … … 156 168 ---STRINGEND 157 169 170 ---STRING resources 171 Resurssit 172 ---STRINGEND 173 branches/MidCOM_2_8/org.openpsa.calendar/style/show-event-delete.php
r5048 r17966 17 17 <?php echo $data['l10n']->get('really delete event'); ?> 18 18 <input type="submit" id="org_openpsa_calendar_deleteok" name="org_openpsa_calendar_deleteok" value="<?php echo $data['l10n_midcom']->get('yes'); ?>" /> 19 <input type="submit" id="org_openpsa_calendar_delete_cancel" name="org_openpsa_calendar_delete_cancel" value="<?php echo $data['l10n_midcom']->get('no'); ?>" /> 19 20 </label> 20 21 </fieldset>
