/** * Show list of the style elements for the currently edited topic component * * @param string $handler_id Name of the used handler * @param mixed &$data Data passed to the show method */ public function _show_folders($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); $data['group'] =& $this->_group; midcom_show_style('midcom-admin-user-group-folders'); midgard_admin_asgard_plugin::asgard_footer(); }
public static function initialize_search() { $defaults = array('autocomplete' => false); $providers = array(); $siteconfig = org_openpsa_core_siteconfig::get_instance(); $configured_providers = self::get_config_value('search_providers'); $user_id = false; if (!midcom::get('auth')->admin) { $user_id = midcom::get('auth')->acl->get_user_id(); } foreach ($configured_providers as $component => $config) { if (!is_array($config)) { $config = array('route' => $config); } $config = array_merge($defaults, $config); if ($config['autocomplete'] === true) { midcom_helper_datamanager2_widget_autocomplete::add_head_elements(); } $node_url = $siteconfig->get_node_full_url($component); if ($node_url && (!$user_id || midcom::get('auth')->acl->can_do_byguid('midgard:read', $siteconfig->get_node_guid($component), 'midcom_db_topic', $user_id))) { $providers[] = array('helptext' => midcom::get('i18n')->get_string('search title', $component), 'url' => $node_url . $config['route'], 'identifier' => $component, 'autocomplete' => $config['autocomplete']); } } midcom::get('head')->add_jquery_state_script('org_openpsa_layout.initialize_search ( ' . json_encode($providers) . ', "' . midgard_admin_asgard_plugin::get_preference('openpsa2_search_provider') . '" );'); }
/** * Show list of the style elements for the currently createed topic component * * @param string $handler_id Name of the used handler * @param mixed &$data Data passed to the show method */ public function _show_create($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); $data['person'] =& $this->_person; midcom_show_style('midcom-admin-user-person-create'); midgard_admin_asgard_plugin::asgard_footer(); }
function midgard_admin_asgard_trash_type_show($object, $indent = 0, $prefix = '', $enable_undelete = true) { static $persons = array(); static $shown = array(); static $url_prefix = ''; if (!$url_prefix) { $url_prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); } if (isset($shown[$object->guid])) { return; } if (!isset($persons[$object->metadata->revisor])) { $persons[$object->metadata->revisor] = midcom::get('auth')->get_user($object->metadata->revisor); } $reflector = midcom_helper_reflector_tree::get($object); $icon = $reflector->get_object_icon($object); echo "{$prefix}<tr>\n"; $disabled = ''; if (!$enable_undelete) { $disabled = ' disabled="disabled"'; } $object_label = $reflector->get_object_label($object); if (empty($object_label)) { $object_label = $object->guid; } echo "{$prefix} <td class=\"checkbox\"><input type=\"checkbox\" name=\"undelete[]\"{$disabled} value=\"{$object->guid}\" id=\"guid_{$object->guid}\" /></td>\n"; echo "{$prefix} <td class=\"label\" style=\"padding-left: {$indent}px\"><label for=\"guid_{$object->guid}\">{$icon}" . $object_label . "</label></td>\n"; echo "{$prefix} <td class=\"nowrap\">" . strftime('%x %X', strtotime($object->metadata->revised)) . "</td>\n"; if (isset($persons[$object->metadata->revisor]->guid)) { echo "{$prefix} <td><a href=\"{$url_prefix}__mfa/asgard/object/view/{$persons[$object->metadata->revisor]->guid}/\">{$persons[$object->metadata->revisor]->name}</a></td>\n"; } else { echo "{$prefix} <td> </td>\n"; } echo "{$prefix} <td>" . midcom_helper_misc::filesize_to_string($object->metadata->size) . "</td>\n"; echo "{$prefix}</tr>\n"; $child_types = midcom_helper_reflector_tree::get_child_objects($object, true); if (is_array($child_types) && count($child_types) > 0) { $child_indent = $indent + 20; echo "{$prefix}<tbody class=\"children\">\n"; foreach ($child_types as $type => $children) { if (count($children) < 10 || isset($_GET['show_children'][$object->guid][$type])) { foreach ($children as $child) { midgard_admin_asgard_trash_type_show($child, $child_indent, "{$prefix} ", false); } } else { echo "{$prefix} <tr>\n"; echo "{$prefix} <td class=\"label\" style=\"padding-left: {$child_indent}px\" colspan=\"5\"><a href=\"?show_children[{$object->guid}][{$type}]=1\">" . sprintf(midcom::get('i18n')->get_string('show %s %s children', 'midgard.admin.asgard'), count($children), midgard_admin_asgard_plugin::get_type_label($type)) . "</a></td>\n"; echo "{$prefix} </tr>\n"; } } echo "{$prefix}</tbody>\n"; } $shown[$object->guid] = true; }
/** * Object editing view * * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. * @return boolean Indicating success. */ public function _handler_edit($handler_id, array $args, array &$data) { $this->_object = midcom::get('dbfactory')->get_object_by_guid($args[0]); $this->_object->require_do('midgard:update'); $this->_object->require_do('midgard:parameters'); midcom::get('auth')->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); // List all parameters for display $qb = midcom_db_parameter::new_query_builder(); $qb->add_constraint('parentguid', '=', $this->_object->guid); $qb->add_order('domain'); $qb->add_order('name'); $data['parameters'] = $qb->execute(); $this->_prepare_request_data(); midgard_admin_asgard_plugin::bind_to_object($this->_object, $handler_id, $data); }
/** * Show list of the style elements for the currently edited topic component * * @param string $handler_id Name of the used handler * @param mixed &$data Data passed to the show method */ public function _show_list($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); $data['config'] =& $this->_config; midcom_show_style('midcom-admin-libs-list-header'); $data['even'] = false; foreach ($this->_libs as $name => $lib) { $data['name'] = $name; midcom_show_style('midcom-admin-libs-list-item'); if (!$data['even']) { $data['even'] = true; } else { $data['even'] = false; } } midcom_show_style('midcom-admin-libs-list-footer'); midgard_admin_asgard_plugin::asgard_footer(); }
/** * Trash view * * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. * @return boolean Indicating success. */ public function _handler_trash_type($handler_id, array $args, array &$data) { midcom::get('auth')->require_admin_user(); midcom::get('cache')->content->no_cache(); $this->type = $args[0]; $data['view_title'] = midgard_admin_asgard_plugin::get_type_label($this->type); midcom::get('head')->set_pagetitle($data['view_title']); $dummy = new $this->type(); $data['midcom_dba_classname'] = midcom::get('dbclassloader')->get_midcom_class_name_for_mgdschema_object($dummy); $data['type'] = $this->type; $data['reflector'] = midcom_helper_reflector::get($data['type']); $data['label_property'] = $data['reflector']->get_label_property(); if (isset($_POST['undelete']) && !isset($_POST['purge']) && is_array($_POST['undelete'])) { $this->_undelete(); return new midcom_response_relocate("__mfa/asgard/trash/{$this->type}/"); } if (isset($_POST['purge']) && is_array($_POST['undelete'])) { $this->_purge(); return new midcom_response_relocate("__mfa/asgard/trash/{$this->type}/"); } $qb = new org_openpsa_qbpager_direct($data['type'], "{$data['type']}_trash"); $qb->include_deleted(); $qb->add_constraint('metadata.deleted', '=', true); $qb->add_order('metadata.revised', 'DESC'); $data['qb'] =& $qb; $data['trash'] = $qb->execute_unchecked(); // Set the breadcrumb data $this->add_breadcrumb('__mfa/asgard/', $this->_l10n->get('midgard.admin.asgard')); $this->add_breadcrumb("__mfa/asgard/{$this->type}/", $data['view_title']); $this->add_breadcrumb("__mfa/asgard/trash/{$this->type}/", sprintf($this->_l10n->get('%s trash'), midgard_admin_asgard_plugin::get_type_label($data['type']))); }
/** * Populate the object breadcrumb * * @param mixed $object MgdSchema object for which the toolbar will be created * @param String $handler_id Initialized handler id * @param array $data Local request data */ private static function _set_object_breadcrumb($object, $handler_id, &$data) { $tmp = array(); $breadcrumb = array(); $label = $data['object_reflector']->get_object_label($object); $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('view', $object->guid), MIDCOM_NAV_NAME => $label); $parent = $object->get_parent(); if (is_a($object, 'midcom_db_parameter') && is_object($parent) && $parent->guid) { // Add "parameters" list to breadcrumb if we're in a param $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('parameters', $parent->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('parameters', 'midcom')); } $i = 0; while (is_object($parent) && $parent->guid && $i < 10) { $i++; $parent_reflector = midcom_helper_reflector::get($parent); $parent_label = $parent_reflector->get_object_label($parent); $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('view', $parent->guid), MIDCOM_NAV_NAME => $parent_label); $parent = $parent->get_parent(); } $breadcrumb = array_reverse($breadcrumb); switch ($handler_id) { case '____mfa-asgard-object_edit': $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('edit', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('edit', 'midcom')); break; case '____mfa-asgard-object_copy': $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('copy', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('copy', 'midcom')); break; case '____mfa-asgard-object_copy_tree': $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('copy/tree', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('copy', 'midcom')); break; case '____mfa-asgard-components_configuration_edit_folder': $breadcrumb[] = array(MIDCOM_NAV_URL => "__mfa/asgard/components/configuration/edit/{$object->component}/{$object->guid}/", MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('component configuration', 'midcom')); break; case '____mfa-asgard-object_metadata': $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('metadata', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('metadata', 'midcom')); break; case '____mfa-asgard-object_attachments': case '____mfa-asgard-object_attachments_edit': case '____mfa-asgard-object_attachments_delete': $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('attachments', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('attachments', 'midgard.admin.asgard')); if ($handler_id == '____mfa-asgard-object_attachments_edit') { $breadcrumb[] = array(MIDCOM_NAV_URL => "__mfa/asgard/object/attachments/{$object->guid}/edit/", MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('edit', 'midcom')); } if ($handler_id == '____mfa-asgard-object_attachments_delete') { $breadcrumb[] = array(MIDCOM_NAV_URL => "__mfa/asgard/object/attachments/{$object->guid}/delete/", MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('delete', 'midcom')); } break; case '____mfa-asgard-object_parameters': $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('parameters', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('parameters', 'midcom')); break; case '____mfa-asgard-object_permissions': $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('permissions', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('privileges', 'midcom')); break; case '____mfa-asgard-object_create': if ($data['new_type_arg'] == 'midgard_parameter') { // Add "parameters" list to breadcrumb if we're creating a param $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('parameters', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('parameters', 'midcom')); } $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('create' . $data['new_type_arg'], $object->guid), MIDCOM_NAV_NAME => sprintf(midcom::get('i18n')->get_string('create %s', 'midcom'), midgard_admin_asgard_plugin::get_type_label($data['new_type_arg']))); break; case '____mfa-asgard-object_delete': $breadcrumb[] = array(MIDCOM_NAV_URL => self::_generate_url('delete', $object->guid), MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('delete', 'midcom')); break; case '____mfa-asgard_midcom.helper.replicator-object': $breadcrumb[] = array(MIDCOM_NAV_URL => "__mfa/asgard_midcom.helper.replicator/object/{$object->guid}/", MIDCOM_NAV_NAME => midcom::get('i18n')->get_string('replication information', 'midcom.helper.replicator')); break; case '____mfa-asgard-object_rcs_diff': $tmp[] = array(MIDCOM_NAV_URL => "__mfa/asgard/object/rcs/preview/{$object->guid}/{$data['args'][1]}/{$data['args'][2]}", MIDCOM_NAV_NAME => sprintf($data['l10n']->get('differences between %s and %s'), $data['args'][1], $data['args'][2])); case '____mfa-asgard-object_rcs_preview': if (isset($data['args'][2])) { $current = $data['args'][2]; } else { $current = $data['args'][1]; } $tmp[] = array(MIDCOM_NAV_URL => "__mfa/asgard/object/rcs/preview/{$object->guid}/{$current}/", MIDCOM_NAV_NAME => sprintf($data['l10n']->get('version %s'), $current)); case '____mfa-asgard-object_rcs_history': $tmp[] = array(MIDCOM_NAV_URL => "__mfa/asgard/object/rcs/{$object->guid}/", MIDCOM_NAV_NAME => $data['l10n']->get('show history')); $tmp = array_reverse($tmp); $breadcrumb = array_merge($breadcrumb, $tmp); break; } midcom_core_context::get()->set_custom_key('midcom.helper.nav.breadcrumb', $breadcrumb); }
private function _prepare_toolbar(&$data) { if (midcom::get('auth')->can_user_do('midgard:create', null, $this->type)) { $data['asgard_toolbar']->add_item(array(MIDCOM_TOOLBAR_URL => "__mfa/asgard/object/create/{$this->type}/", MIDCOM_TOOLBAR_LABEL => sprintf(midcom::get('i18n')->get_string('create %s', 'midcom'), midgard_admin_asgard_plugin::get_type_label($this->type)), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/' . midcom_helper_reflector_tree::get_create_icon($this->type))); } if (midcom::get('auth')->admin) { $qb = new midgard_query_builder($this->type); $qb->include_deleted(); $qb->add_constraint('metadata.deleted', '=', true); $deleted = $qb->count(); if ($deleted > 0) { $data['asgard_toolbar']->add_item(array(MIDCOM_TOOLBAR_URL => "__mfa/asgard/trash/{$this->type}/", MIDCOM_TOOLBAR_LABEL => sprintf(midcom::get('i18n')->get_string('%s deleted items', 'midgard.admin.asgard'), $deleted), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash-full.png')); } else { $data['asgard_toolbar']->add_item(array(MIDCOM_TOOLBAR_URL => "__mfa/asgard/trash/{$this->type}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('trash is empty', 'midgard.admin.asgard'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png')); } } if ($data['component'] != 'midgard') { $data['asgard_toolbar']->add_item(array(MIDCOM_TOOLBAR_URL => "__mfa/asgard/components/{$data['component']}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string($data['component'], $data['component']), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/component.png')); } $data['asgard_toolbar']->add_item(array(MIDCOM_TOOLBAR_URL => "__ais/help/{$data['documentation_component']}/mgdschemas/#{$this->type}", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('type documentation', 'midgard.admin.asgard'), MIDCOM_TOOLBAR_OPTIONS => array('target' => '_blank'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_help-agent.png')); }
public function _show_preview() { midgard_admin_asgard_plugin::asgard_header(); midcom_show_style('midgard_admin_asgard_rcs_preview'); midgard_admin_asgard_plugin::asgard_footer(); }
/** * Show the group listing * * @param mixed $handler_id The ID of the handler. * @param array &$data The local request data. */ public function _show_list($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); midcom_show_style('midcom-admin-user-group-list-start'); // Show the recursive listing self::list_groups(0, $data); midcom_show_style('midcom-admin-user-group-list-end'); midgard_admin_asgard_plugin::asgard_footer(); }
function draw() { $this->_request_data['chapter_name'] = $GLOBALS['midcom_config']['midcom_site_title']; midcom_show_style('midgard_admin_asgard_navigation_chapter'); $this->_draw_plugins(); if (!midcom::get('auth')->can_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin')) { return; } $label_mapping = $this->_process_root_types(); $expanded_types = array_intersect(array_keys($label_mapping), $this->expanded_root_types); $collapsed_types = array_diff($label_mapping, $expanded_types); /* * Use a dropdown for displaying the navigation if at least one type is expanded * and the user has the corresponding preference set. That way, you expanded types * can take up the maximum available space while all types are still accessible with one * click if nothing is expanded */ $types_shown = false; if (sizeof($expanded_types) > 0 && midgard_admin_asgard_plugin::get_preference('navigation_type') === 'dropdown') { $this->_draw_select_navigation(); $types_shown = true; } foreach ($expanded_types as $root_type) { $this->_request_data['section_url'] = midcom_connection::get_url('self') . "__mfa/asgard/{$root_type}"; $this->_request_data['section_name'] = $label_mapping[$root_type]; $this->_request_data['expanded'] = true; midcom_show_style('midgard_admin_asgard_navigation_section_header'); $ref = $this->_get_reflector($root_type); $root_objects = $ref->get_root_objects(); if (is_array($root_objects) && count($root_objects) > 0) { $this->_list_root_elements($root_objects, $ref); } midcom_show_style('midgard_admin_asgard_navigation_section_footer'); } if (!$types_shown) { $this->_request_data['section_name'] = $this->_l10n->get('midgard objects'); $this->_request_data['expanded'] = true; midcom_show_style('midgard_admin_asgard_navigation_section_header'); $this->_draw_type_list($collapsed_types); midcom_show_style('midgard_admin_asgard_navigation_section_footer'); } }
/** * Populate the object toolbar * * @param mixed $object MgdSchema object for which the toolbar will be created * @param String $handler_id Initialized handler id * @param array $data Local request data */ public function bind_to_object($object, $handler_id, $data) { // Show view toolbar button, if the user hasn't configured to use straight the edit mode if ($data['default_mode'] === 'view') { $this->add_item(array(MIDCOM_TOOLBAR_URL => $this->_generate_url('view', $object), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('view', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/view.png', MIDCOM_TOOLBAR_ACCESSKEY => 'v')); } if (!is_a($object, 'midcom_db_style') && !is_a($object, 'midcom_db_element') && !is_a($object, 'midcom_db_snippetdir') && !is_a($object, 'midcom_db_snippet') && !is_a($object, 'midcom_db_page') && !is_a($object, 'midcom_db_pageelement') && !is_a($object, 'midcom_db_parameter') && substr($object->__mgdschema_class_name__, 0, 23) != 'org_routamc_positioning' && substr($object->__mgdschema_class_name__, 0, 14) != 'net_nemein_tag') { $link = midcom::get('permalinks')->resolve_permalink($object->guid); if ($link) { $this->add_item(array(MIDCOM_TOOLBAR_URL => $link, MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('view on site', 'midgard.admin.asgard'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_internet.png')); } } if ($object->can_do('midgard:update')) { $this->add_item(array(MIDCOM_TOOLBAR_URL => $this->_generate_url('edit', $object), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('edit', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ACCESSKEY => 'e')); } if ($object->can_do('midgard:create')) { if (midcom_helper_reflector_tree::get_child_objects($object)) { $this->add_item(array(MIDCOM_TOOLBAR_URL => $this->_generate_url('copy/tree', $object), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('copy', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/editcopy.png')); } else { $this->add_item(array(MIDCOM_TOOLBAR_URL => $this->_generate_url('copy', $object), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('copy', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/editcopy.png')); } } if ($object->can_do('midgard:update')) { $this->_add_toolbar_update_items($object); } if ($object->can_do('midgard:create')) { // Find out what types of children the object can have and show create buttons for them $child_types = $data['tree_reflector']->get_child_classes(); if (!is_array($child_types)) { debug_add("\$data['tree_reflector']->get_child_classes() failed critically, recasting \$child_types as array", MIDCOM_LOG_WARN); $child_types = array(); } foreach ($child_types as $type) { $display_button = true; if (is_a($object, 'midcom_db_topic')) { // With topics we should check for component before populating create buttons as so many types can be children of topics switch ($type) { case 'midgard_topic': case 'midgard_article': // Articles and topics can always be created break; default: $midcom_dba_classname = midcom::get('dbclassloader')->get_midcom_class_name_for_mgdschema_object($type); if (!$midcom_dba_classname) { $display_button = false; break; } $component = midcom::get('dbclassloader')->get_component_for_class($type); if ($component != $object->component) { $display_button = false; } break; } } elseif (is_a($object, 'midcom_db_article') && $object->topic) { $topic = new midcom_db_topic($object->topic); // With articles we should check for topic component before populating create buttons as so many types can be children of topics switch ($type) { case 'midgard_article': // Articles can always be created break; default: $component = midcom::get('dbclassloader')->get_component_for_class($type); if ($component != $topic->component) { $display_button = false; } break; } } if (!$display_button) { // Skip this type continue; } $this->add_item(array(MIDCOM_TOOLBAR_URL => $this->_generate_url('create/' . $type, $object), MIDCOM_TOOLBAR_LABEL => sprintf(midcom::get('i18n')->get_string('create %s', 'midcom'), midgard_admin_asgard_plugin::get_type_label($type)), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/' . $data['tree_reflector']->get_create_icon($type))); } } if ($object->can_do('midgard:delete')) { $this->add_item(array(MIDCOM_TOOLBAR_URL => $this->_generate_url('delete', $object), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('delete', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ACCESSKEY => 'd')); } if ($GLOBALS['midcom_config']['midcom_services_rcs_enable'] && $object->can_do('midgard:update') && $object->_use_rcs) { $this->add_item(array(MIDCOM_TOOLBAR_URL => $this->_generate_url('rcs', $object), MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('show history', 'midgard.admin.asgard'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/history.png', MIDCOM_TOOLBAR_ENABLED => substr($handler_id, 0, 25) === '____mfa-asgard-object_rcs' ? false : true, MIDCOM_TOOLBAR_ACCESSKEY => 'h')); } $this->_disable_active_item($handler_id, $object, $data); }
/** * Show list of the style elements for the currently edited topic component * * @param string $handler_id Name of the used handler * @param mixed &$data Data passed to the show method */ public function _show_edit($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); midcom_show_style('midcom-admin-libs-edit'); midgard_admin_asgard_plugin::asgard_footer(); }
/** * Output the style element for deleted objects * * @param mixed $handler_id The ID of the handler. * @param array &$data The local request data. */ public function _show_deleted($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); midcom_show_style('midgard_admin_asgard_object_deleted'); midgard_admin_asgard_plugin::asgard_footer(); }
<?php $i18n = midcom::get('i18n'); $head = midcom::get('head'); $context = midcom_core_context::get(); if (!defined('MIDCOM_STATIC_URL')) { define('MIDCOM_STATIC_URL', '/midcom-static'); } $pref_found = false; $width = midgard_admin_asgard_plugin::get_preference('openpsa2_offset'); if ($width !== false) { $navigation_width = $width - 2; $content_offset = $width; $pref_found = true; } $topic = $context->get_key(MIDCOM_CONTEXT_CONTENTTOPIC); echo "<?xml version=\"1.0\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $i18n->get_current_language(); ?> "> <head> <meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" /> <title><?php echo $topic->extra . ': ' . $context->get_key(MIDCOM_CONTEXT_PAGETITLE); ?> - <(title)> OpenPSA</title>
/** * Copy handler * * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. * @return boolean Indicating success. */ public function _handler_copy($handler_id, array $args, array &$data) { // Get the object that will be copied $this->_load_object($args[0]); midcom::get('auth')->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); static $targets = array(); $mgdschema_class = midcom_helper_reflector::resolve_baseclass(get_class($this->_object)); // Get the target details if (in_array($mgdschema_class, $targets)) { $target = $targets[$mgdschema_class]; } else { $target = midcom_helper_reflector_copy::get_target_properties($this->_object); } // Load the schemadb for searching the parent object $this->_load_schemadb($target['class'], $target['parent'], true); // Change the name for the parent field $this->_schemadb['object']->fields[$target['parent']]['title'] = $this->_l10n->get('choose the target'); // Load the nullstorage controller $this->_controller = midcom_helper_datamanager2_controller::create('nullstorage'); $this->_controller->schemadb =& $this->_schemadb; if (!$this->_controller->initialize()) { throw new midcom_error('Failed to initialize the controller'); } $this->_prepare_request_data(); // Process the form switch ($this->_controller->process_form()) { case 'save': $new_object = $this->_process_copy($target); // Relocate to the newly created object return new midcom_response_relocate("__mfa/asgard/object/{$this->_request_data['default_mode']}/{$new_object->guid}/"); case 'cancel': return new midcom_response_relocate("__mfa/asgard/object/{$this->_request_data['default_mode']}/{$args[0]}/"); } // Add Thickbox midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . '/midgard.admin.asgard/object_browser.js'); midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . '/jQuery/thickbox/jquery-thickbox-3.1.pack.js'); $this->add_stylesheet(MIDCOM_STATIC_URL . '/jQuery/thickbox/thickbox.css', 'screen'); midcom::get('head')->add_jscript('var tb_pathToImage = "' . MIDCOM_STATIC_URL . '/jQuery/thickbox/loadingAnimation.gif"'); // Add jQuery file for the checkbox operations midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . '/midgard.admin.asgard/jquery-copytree.js'); midcom::get('head')->add_jscript('jQuery(document).ready(function(){jQuery("#midgard_admin_asgard_copytree").tree_checker();})'); // Common hooks for Asgard midgard_admin_asgard_plugin::bind_to_object($this->_object, $handler_id, $data); // Set the page title switch ($handler_id) { case '____mfa-asgard-object_copy_tree': $data['page_title'] = sprintf($this->_l10n->get('copy %s and its descendants'), $this->_object->{$target}['label']); break; default: $data['page_title'] = sprintf($this->_l10n->get('copy %s'), $this->_object->{$target}['label']); } $data['target'] = $target; }
/** * Object editing view * * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. * @return boolean Indicating success. */ public function _handler_edit($handler_id, array $args, array &$data) { $this->_object = midcom::get('dbfactory')->get_object_by_guid($args[0]); $this->_object->require_do('midgard:privileges'); midcom::get('auth')->require_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin'); $script = "\n applyRowClasses();\n "; midcom::get('head')->add_jquery_state_script($script); // Load possible additional component privileges $this->_load_component_privileges(); // Load the datamanager controller $this->_controller = $this->get_controller('simple', $this->_object); if (isset($_POST['midcom_helper_datamanager2_add']) && !empty($_POST['add_assignee'])) { $this->_object->set_privilege('midgard:read', $_POST['add_assignee']); return new midcom_response_relocate("__mfa/asgard/object/permissions/{$this->_object->guid}/"); } switch ($this->_controller->process_form()) { case 'save': //Fall-through //Fall-through case 'cancel': return new midcom_response_relocate("__mfa/asgard/object/view/{$this->_object->guid}/"); } $this->_prepare_request_data(); // Figure out label for the object's class switch (get_class($this->_object)) { case 'midcom_db_topic': $type = midcom::get('i18n')->get_string('folder', 'midgard.admin.asgard'); break; default: $type_parts = explode('_', get_class($this->_object)); $type = $type_parts[count($type_parts) - 1]; } midgard_admin_asgard_plugin::bind_to_object($this->_object, $handler_id, $data); }
/** * Show list of the style elements for the currently edited topic component * * @param string $handler_id Name of the used handler * @param mixed &$data Data passed to the show method */ public function _show_view($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); midcom_show_style('midcom-admin-libs-view-header'); $data['even'] = false; foreach ($data['config']->_global as $key => $value) { $data['key'] = midcom::get('i18n')->get_string($key, $data['name']); $data['global'] = $this->_detect($data['config']->_global[$key]); if (isset($data['config']->_local[$key])) { $data['local'] = $this->_detect($data['config']->_local[$key]); } else { $data['local'] = $this->_detect(null); } midcom_show_style('midcom-admin-libs-view-item'); $data['even'] = !$data['even']; } midcom_show_style('midcom-admin-libs-view-footer'); midgard_admin_asgard_plugin::asgard_footer(); }
/** * Show list of the style elements for the currently edited topic component * * @param string $handler_id Name of the used handler * @param mixed &$data Data passed to the show method */ public function _show_edit($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); midcom_show_style('midgard_admin_asgard_component_configuration_edit'); midgard_admin_asgard_plugin::asgard_footer(); }
/** * Show the batch password change form * * @param mixed $handler_id The ID of the handler. * @param array &$data The local request data. */ public function _show_batch($handler_id, array &$data) { if (!isset($_GET['ajax'])) { midgard_admin_asgard_plugin::asgard_header(); midcom_show_style('midcom-admin-user-password-nonajax-header'); } $data['message_subject'] = $this->_l10n->get($this->_config->get('message_subject')); $data['message_body'] = $this->_l10n->get($this->_config->get('message_body')); midcom_show_style('midcom-admin-user-password-email'); if (!isset($_GET['ajax'])) { midcom_show_style('midcom-admin-user-passwords-list'); midgard_admin_asgard_plugin::asgard_footer(); } }
private function _add_linked_field($key) { $linked_type = $this->_reflector->get_link_name($key); $linked_type_reflector = midcom_helper_reflector::get($linked_type); $field_type = $this->_reflector->get_midgard_type($key); if ($key == 'up') { $field_label = sprintf($this->_l10n->get('under %s'), midgard_admin_asgard_plugin::get_type_label($linked_type)); } else { $type_label = midgard_admin_asgard_plugin::get_type_label($linked_type); if (substr($type_label, 0, strlen($key)) == $key) { // Handle abbreviations like "lang" for "language" $field_label = $type_label; } else { if ($key == $type_label) { $field_label = $key; } else { $ref = midcom_helper_reflector::get($this->_object); $component_l10n = $ref->get_component_l10n(); $field_label = sprintf($this->_l10n->get('%s (%s)'), $component_l10n->get($key), $type_label); } } } // Get the chooser widgets switch ($field_type) { case MGD_TYPE_UINT: case MGD_TYPE_STRING: case MGD_TYPE_GUID: $class = midcom::get('dbclassloader')->get_midcom_class_name_for_mgdschema_object($linked_type); if (!$class) { break; } $component = midcom::get('dbclassloader')->get_component_for_class($linked_type); $this->_schemadb['object']->append_field($key, array('title' => $field_label, 'storage' => $key, 'type' => 'select', 'type_config' => array('require_corresponding_option' => false, 'options' => array(), 'allow_other' => true, 'allow_multiple' => false), 'widget' => 'chooser', 'widget_config' => array('class' => $class, 'component' => $component, 'titlefield' => $linked_type_reflector->get_label_property(), 'id_field' => $this->_reflector->get_link_target($key), 'searchfields' => $linked_type_reflector->get_search_properties(), 'result_headers' => $this->_get_result_headers($linked_type_reflector), 'orders' => array(), 'creation_mode_enabled' => true, 'creation_handler' => midcom_connection::get_url('self') . "__mfa/asgard/object/create/chooser/{$linked_type}/", 'creation_default_key' => $linked_type_reflector->get_label_property(), 'generate_path_for' => midcom_helper_reflector::get_name_property($this->_object)))); break; } }
<?php // Check the user preference and configuration $config = midcom_baseclasses_components_configuration::get('midgard.admin.asgard', 'config'); if (midgard_admin_asgard_plugin::get_preference('escape_frameset') || midgard_admin_asgard_plugin::get_preference('escape_frameset') !== '0' && $config->get('escape_frameset')) { midcom::get('head')->add_jsonload('if(top.frames.length != 0 && top.location.href != this.location.href){top.location.href = this.location.href}'); } //don't send an XML prolog for IE, it knocks IE6 into quirks mode if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.') !== false) { echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; } $pref_found = false; if ($width = midgard_admin_asgard_plugin::get_preference('offset')) { $navigation_width = $width - 40; $content_offset = $width + 2; $pref_found = true; } // JavasScript libraries required by Asgard midcom::get('head')->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.core.min.js'); midcom::get('head')->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.widget.min.js'); midcom::get('head')->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.mouse.min.js'); midcom::get('head')->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.draggable.min.js'); midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . '/midgard.admin.asgard/resize.js'); midcom::get('head')->add_jscript("var MIDGARD_ROOT = '" . midcom_connection::get_url('self') . "';"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo midcom::get('i18n')->get_current_language(); ?> " lang="<?php
/** * Show list of the style elements for the currently edited topic component * * @param string $handler_id Name of the used handler * @param mixed &$data Data passed to the show method */ public function _show_list($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); $data['config'] =& $this->_config; $data['persons'] =& $this->_persons; midcom_show_style('midcom-admin-user-personlist-header'); $data['even'] = false; foreach ($data['persons'] as $person) { $data['person'] = $person; midcom_show_style('midcom-admin-user-personlist-item'); if (!$data['even']) { $data['even'] = true; } else { $data['even'] = false; } } midcom_show_style('midcom-admin-user-personlist-footer'); midgard_admin_asgard_plugin::asgard_footer(); }
</th> </tr> </thead> <tbody> <?php foreach ($data['types'] as $type => $items) { if ($items == 0) { continue; } ?> <tr> <td><a href="&(prefix);__mfa/asgard/trash/&(type);"><img src="<?php echo MIDCOM_STATIC_URL; ?> /stock-icons/16x16/trash-full.png" /> <?php echo midgard_admin_asgard_plugin::get_type_label($type); ?> </a></td> <td>&(items);</td> </tr> <?php } ?> </tbody> </table> <script type="text/javascript"> // <![CDATA[ jQuery('#deleted').tablesorter( { widgets: ['zebra'], sortList: [[0,0]]
/** * Show the delete request * * @param string $handler_id Name of the used handler * @param mixed &$data Data passed to the show method */ public function _show_delete($handler_id, array &$data) { midgard_admin_asgard_plugin::asgard_header(); $data['file'] =& $this->_file; $data['attachment_text_types'] = $this->_config->get('attachment_text_types'); midcom_show_style('midgard_admin_asgard_object_attachments_delete'); midgard_admin_asgard_plugin::asgard_footer(); }