/** * Simple helper which references all important members to the request data listing * for usage within the style listing. */ private function _prepare_request_data($handler_id) { $this->_request_data['message'] =& $this->_message; $this->_request_data['datamanager'] =& $this->_datamanager; $this->_request_data['controller'] =& $this->_controller; $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/edit/{$this->_message->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('edit message'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_message->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e')); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/delete/{$this->_message->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('delete message'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_message->can_do('midgard:delete'), MIDCOM_TOOLBAR_ACCESSKEY => 'd')); switch ($handler_id) { case 'message_edit': $this->_view_toolbar->disable_item("message/edit/{$this->_message->guid}/"); break; case 'message_delete': $this->_view_toolbar->disable_item("message/delete/{$this->_message->guid}/"); break; } }
private function _populate_toolbar() { $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/edit/{$this->_message->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('edit message'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ACCESSKEY => 'e', MIDCOM_TOOLBAR_ENABLED => $this->_message->can_do('midgard:update'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/delete/{$this->_message->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('delete message'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ACCESSKEY => 'd', MIDCOM_TOOLBAR_ENABLED => $this->_message->can_do('midgard:delete'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/copy/{$this->_message->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('copy message'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/editcopy.png', MIDCOM_TOOLBAR_ACCESSKEY => 'e', MIDCOM_TOOLBAR_ENABLED => $this->_message->can_do('midgard:update'))); if (!empty(midcom::get('auth')->user->guid)) { $preview_url = "message/compose/{$this->_message->guid}/" . midcom::get('auth')->user->guid . '/'; } else { $preview_url = "message/compose/{$this->_message->guid}/"; } $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $preview_url, MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('preview message'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/view.png', MIDCOM_TOOLBAR_ACCESSKEY => 'p', MIDCOM_TOOLBAR_OPTIONS => array('target' => '_BLANK'))); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/report/{$this->_request_data['message']->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("message report"), MIDCOM_TOOLBAR_ACCESSKEY => 'r', MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png')); $this->_campaign->get_testers(); $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/send_test/{$this->_request_data['message']->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("send message to testers"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail-send.png', MIDCOM_TOOLBAR_ENABLED => count($this->_campaign->testers) > 0 ? true : false)); $mc = org_openpsa_campaign_member::new_collector('campaign', $this->_campaign->id); $mc->set_key_property('campaign'); $mc->execute(); $keys = $mc->list_keys(); // Show the message send if there are recipients $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "message/send/{$this->_request_data['message']->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get("send message to whole campaign"), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_mail-send.png', MIDCOM_TOOLBAR_ENABLED => count($keys) > 0 && $this->_message->can_do('midgard:update') ? true : false, MIDCOM_TOOLBAR_OPTIONS => array('onclick' => "return confirm('" . $this->_l10n->get('are you sure you wish to send this to the whole campaign') . "')"))); }