Exemple #1
0
 private function _populate_toolbar()
 {
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/edit/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get("edit"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e'));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/create/organization/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create suborganization'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:update')));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "group/create/group/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create subgroup'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', MIDCOM_TOOLBAR_ENABLED => $this->_group->can_do('midgard:update')));
     if (midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba') && $this->_group->can_do('midgard:create')) {
         $allow_person_create = true;
     } else {
         $allow_person_create = false;
     }
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "person/create/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', MIDCOM_TOOLBAR_ENABLED => $allow_person_create));
     $siteconfig = org_openpsa_core_siteconfig::get_instance();
     $user_url = $siteconfig->get_node_full_url('org.openpsa.user');
     if ($user_url && midcom::get('auth')->can_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface')) {
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $user_url . "group/{$this->_group->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('user management', 'org.openpsa.user'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png'));
     }
     $cal_node = midcom_helper_misc::find_node_by_component('org.openpsa.calendar');
     if (!empty($cal_node)) {
         //TODO: Check for privileges somehow
         $this->_node_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "#", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create event'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new-event.png', MIDCOM_TOOLBAR_OPTIONS => array('rel' => 'directlink', 'onclick' => org_openpsa_calendar_interface::calendar_newevent_js($cal_node, false, $this->_group->guid))));
     }
 }
Exemple #2
0
 /**
  * Day view
  *
  * @param String $handler_id    Name of the request handler
  * @param array $args           Variable arguments
  * @param array &$data          Public request data, passed by reference
  */
 public function _handler_day($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     $this->_generate_date($args);
     // Instantiate calendar widget
     $this->_calendar = new org_openpsa_widgets_calendar(date('Y', $this->_selected_time), date('m', $this->_selected_time), date('d', $this->_selected_time));
     $this->_calendar->type = org_openpsa_widgets_calendar::DAY;
     // Slots are 2 hours long
     $this->_calendar->calendar_slot_length = $this->_config->get('day_slot_length') * 60;
     $this->_calendar->start_hour = $this->_config->get('day_start_time');
     $this->_calendar->end_hour = $this->_config->get('day_end_time');
     $this->_calendar->column_width = 60;
     $this->_populate_toolbar('day');
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'month/' . $this->_get_datestring() . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('month view'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png'));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'week/' . $this->_get_datestring() . '/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('week view'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png'));
     // Clicking a free slot should bring up 'new event' dialogue
     $nap = new midcom_helper_nav();
     $this_node = $nap->get_node($nap->get_current_node());
     if ($this->_root_event->can_do('midgard:create')) {
         $this->_calendar->reservation_div_options = array('onclick' => org_openpsa_calendar_interface::calendar_editevent_js('__GUID__', $this_node));
     }
     $this->_calendar->free_div_options = array('onclick' => org_openpsa_calendar_interface::calendar_newevent_js($this_node, '__START__', '__RESOURCE__'));
     // Populate contacts
     $this->_populate_calendar_contacts($this->_calendar->get_day_start(), $this->_calendar->get_day_end());
     $this->_request_data['calendar'] =& $this->_calendar;
     // Set the breadcrumb
     $this->add_breadcrumb('year/' . date('Y-01-01', $this->_selected_time) . '/', strftime('%Y', $this->_selected_time));
     $this->add_breadcrumb('month/' . date('Y-m-01', $this->_selected_time) . '/', strftime('%B', $this->_selected_time));
     $this->add_breadcrumb('day/' . date('Y-m-d', $this->_selected_time) . '/', strftime('%x', $this->_selected_time));
     midcom::get('head')->set_pagetitle(strftime("%x", $this->_selected_time));
 }
Exemple #3
0
 static function common_node_toolbar_buttons(&$toolbar, &$bind_object, $calling_component, $buttons = 'default')
 {
     self::add_header_files();
     if ($buttons == 'default') {
         $buttons = self::common_toolbar_buttons_defaults();
     }
     if (!is_array($buttons)) {
         //Invalid buttons given
         return;
     }
     foreach ($buttons as $mode => $data) {
         debug_print_r("processing button '{$mode}' with data:", $data);
         if ($data === false) {
             //In case somebody didn't unset() a button from the defaults, just marked it as false
             debug_add('data marked as false, skipping (the correct way is to unset() the key)', MIDCOM_LOG_WARN);
             continue;
         }
         $related_to = self::common_node_toolbar_buttons_sanitycheck($data, $data['component'], $bind_object, $calling_component);
         if (!$related_to) {
             debug_add("sanitycheck returned false, skipping", MIDCOM_LOG_WARN);
             continue;
         }
         //Remember that switch is also a for statement in PHPs mind, use "continue 2"
         switch ($mode) {
             case 'event':
                 $toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "#", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('create event', $data['component']), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new-event.png', MIDCOM_TOOLBAR_OPTIONS => array('rel' => 'directlink', 'onclick' => org_openpsa_calendar_interface::calendar_newevent_js($data['node'], false, false, '?' . self::relatedto2get(array($related_to))))));
                 break;
             case 'task':
                 $toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$data['node'][MIDCOM_NAV_FULLURL]}task/new/?" . self::relatedto2get(array($related_to)), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('create task', $data['component']), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/new_task.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_projects_task_dba'), MIDCOM_TOOLBAR_OPTIONS => array('target' => 'newtask')));
                 break;
             case 'wikinote':
                 if (!array_key_exists('wikiword', $data) || empty($data['wikiword'])) {
                     //Wikiword to use not given
                     debug_add("data['wikiword'] not given, skipping", MIDCOM_LOG_WARN);
                     continue 2;
                 }
                 if (!net_nemein_wiki_interface::node_wikiword_is_free($data['node'], $data['wikiword'])) {
                     //Wikiword is already reserved
                     //PONDER: append number or something and check again ??
                     debug_add("node_wikiword_is_free returned false for '{$data['wikiword']}'", MIDCOM_LOG_WARN);
                     continue 2;
                 }
                 $data['wikiword_encoded'] = rawurlencode($data['wikiword']);
                 $toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$data['node'][MIDCOM_NAV_FULLURL]}create/?wikiword={$data['wikiword_encoded']}&" . self::relatedto2get(array($related_to)), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('create note', $data['component']), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/new-text.png', MIDCOM_TOOLBAR_ENABLED => $data['node'][MIDCOM_NAV_OBJECT]->can_do('midgard:create'), MIDCOM_TOOLBAR_OPTIONS => array('target' => 'wiki')));
                 break;
             case 'document':
                 $toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$data['node'][MIDCOM_NAV_FULLURL]}document/create/choosefolder/?" . self::relatedto2get(array($related_to)), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('create document', $data['component']), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/new-text.png', MIDCOM_TOOLBAR_ENABLED => $data['node'][MIDCOM_NAV_OBJECT]->can_do('midgard:create'), MIDCOM_TOOLBAR_OPTIONS => array('target' => 'newdocument')));
                 break;
             default:
                 debug_add("given button '{$mode}' not recognized", MIDCOM_LOG_ERROR);
                 break;
         }
     }
 }