private function _populate_toolbar() { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('view'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png', MIDCOM_TOOLBAR_ACCESSKEY => 'v')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "edit/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ACCESSKEY => 'e', MIDCOM_TOOLBAR_ENABLED => $this->_page->can_do('midgard:update'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "delete/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n_midcom']->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ACCESSKEY => 'd', MIDCOM_TOOLBAR_ENABLED => $this->_page->can_do('midgard:delete'))); foreach (array_keys($this->_request_data['schemadb']) as $name) { if ($name == $this->_datamanager->schema->name) { // The page is already of this type, skip continue; } $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "change/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n->get('change to %s'), $this->_l10n->get($this->_request_data['schemadb'][$name]->description)), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_refresh.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('change_to' => $name), MIDCOM_TOOLBAR_ENABLED => $this->_page->can_do('midgard:update'))); } $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "whatlinks/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('what links'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png')); if (midcom::get('auth')->user) { $user = midcom::get('auth')->user->get_storage(); if ($this->_page->parameter('net.nemein.wiki:watch', $user->guid)) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "subscribe/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('unsubscribe'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('unsubscribe' => 1))); } else { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "subscribe/{$this->_page->name}/", MIDCOM_TOOLBAR_LABEL => $this->_request_data['l10n']->get('subscribe'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('subscribe' => 1))); } } if ($this->_page->can_do('midgard:update')) { midcom::get('head')->add_link_head(array('rel' => 'alternate', 'type' => 'application/x-wiki', 'title' => $this->_request_data['l10n_midcom']->get('edit'), 'href' => midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . "edit/{$this->_page->name}/")); } if (midcom::get('componentloader')->is_installed('org.openpsa.relatedto')) { org_openpsa_relatedto_plugin::add_button($this->_view_toolbar, $this->_page->guid); } $this->bind_view_to_object($this->_page, $this->_datamanager->schema->name); }
/** * Special helper for adding the supported operations from read into the toolbar. * * @param mixed $handler_id The ID of the handler. */ private function _add_read_toolbar($handler_id) { // Add toolbar items $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "project/edit/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ACCESSKEY => 'e')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "task/new/project/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create task'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/new_task.png', MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'))); $siteconfig = org_openpsa_core_siteconfig::get_instance(); $sales_url = $siteconfig->get_node_full_url('org.openpsa.sales'); if (!empty($sales_url)) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $sales_url . "salesproject/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('salesproject', 'org.openpsa.sales'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/jump-to.png')); } org_openpsa_relatedto_plugin::add_button($this->_view_toolbar, $this->_object->guid); }
/** * Simple helper which references all important members to the request data listing * for usage within the style listing. */ private function _prepare_request_data() { $this->_request_data['product'] =& $this->_product; $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "product/edit/{$this->_product->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_product->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "product/delete/{$this->_product->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_product->can_do('midgard:delete'))); if ($this->_config->get('enable_productlinks') && $this->_request_data['is_linked_from'] != '') { $product_link_guid = $this->_request_data['is_linked_from']; $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "productlink/{$product_link_guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('view productlink'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/view.png', MIDCOM_TOOLBAR_ENABLED => $this->_product->can_do('midgard:update'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "productlink/edit/{$product_link_guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit productlink'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_product->can_do('midgard:update'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "productlink/delete/{$product_link_guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete productlink'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_product->can_do('midgard:delete'))); } if (midcom::get('componentloader')->is_installed('org.openpsa.relatedto')) { org_openpsa_relatedto_plugin::add_button($this->_view_toolbar, $this->_product->guid); } }
/** * Special helper for adding the supported operations from read into the toolbar. * * @param mixed $handler_id The ID of the handler. */ private function _populate_read_toolbar($handler_id) { if (!$this->_object->can_do('midgard:update')) { return; } if ($this->_object->status == org_openpsa_projects_task_status_dba::CLOSED) { // TODO: Make POST request $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "task/{$this->_object->guid}/reopen/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('reopen'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/folder-expanded.png')); } else { if ($this->_object->status_type == 'ongoing') { // TODO: Make POST request $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "task/{$this->_object->guid}/complete/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('mark completed'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/new_task.png')); } } $siteconfig = org_openpsa_core_siteconfig::get_instance(); $expenses_url = $siteconfig->get_node_full_url('org.openpsa.expenses'); if ($expenses_url) { midcom_helper_datamanager2_widget_autocomplete::add_head_elements(); org_openpsa_widgets_grid::add_head_elements(); if ($this->_object->status < org_openpsa_projects_task_status_dba::CLOSED) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $expenses_url . "hours/create/hour_report/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('hour report')), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new-event.png')); } $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $expenses_url . "hours/task/all/{$this->_object->guid}", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('hour reports'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/scheduled_and_shown.png', MIDCOM_TOOLBAR_ACCESSKEY => 'h')); } org_openpsa_relatedto_plugin::add_button($this->_view_toolbar, $this->_object->guid); }
private function _populate_read_toolbar($handler_id) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "invoice/edit/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "invoice/delete/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:delete'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "invoice/items/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('edit invoice items'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'))); if (!$this->_object->sent) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "invoice/process/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('mark sent'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail-reply.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('action' => 'mark_sent', 'id' => $this->_object->id, 'relocate' => true), MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'))); } else { if (!$this->_object->paid) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "invoice/process/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('mark paid'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/ok.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('action' => 'mark_paid', 'id' => $this->_object->id, 'relocate' => true), MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'))); } } if (!$this->_object->paid && $this->_config->get('invoice_pdfbuilder_class')) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "invoice/pdf/{$this->_object->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create pdf'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/attach.png')); // sending per email enabled in billing data? $billing_data = $this->_object->get_billing_data(); if (intval($billing_data->sendingoption) == 2) { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "invoice/process/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('mark sent_per_mail'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail-reply.png', MIDCOM_TOOLBAR_POST => true, MIDCOM_TOOLBAR_POST_HIDDENARGS => array('action' => 'send_by_mail', 'id' => $this->_object->id, 'relocate' => true), MIDCOM_TOOLBAR_ENABLED => $this->_object->can_do('midgard:update'))); } } org_openpsa_relatedto_plugin::add_button($this->_view_toolbar, $this->_object->guid); $this->_master->add_next_previous($this->_object, $this->_view_toolbar, 'invoice/'); }