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') . '" );'); }
<?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
/** * Helper function that sets the default object mode */ public static function get_default_mode(&$data) { //only set mode once per request if (!empty($data['default_mode'])) { return $data['default_mode']; } if (midcom_baseclasses_components_configuration::get('midgard.admin.asgard', 'config')->get('edit_mode') == 1) { $data['default_mode'] = 'edit'; } else { $data['default_mode'] = 'view'; } if (midgard_admin_asgard_plugin::get_preference('edit_mode') == 1) { $data['default_mode'] = 'edit'; } else { $data['default_mode'] = 'view'; } return $data['default_mode']; }
private function _add_longtext_field($key, $type) { // Figure out nice size for the editing field $output_mode = ''; $widget = 'textarea'; $dm_type = 'text'; // Workaround for the content field of pages $adjusted_key = $key; if ($type == 'midcom_db_page' && $key == 'content') { $adjusted_key = 'code'; } switch ($adjusted_key) { case 'content': case 'description': $height = 30; // Check the user preference and configuration if (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') || midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' && $this->_config->get('tinymce_enabled')) { $widget = 'tinymce'; } $output_mode = 'html'; break; case 'value': case 'code': // These are typical "large" fields $height = 30; // Check the user preference and configuration if (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') || midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' && $this->_config->get('codemirror_enabled')) { $widget = 'codemirror'; } $dm_type = 'php'; $output_mode = 'code'; break; default: $height = 6; break; } $this->_schemadb['object']->append_field($key, array('title' => $key, 'storage' => $key, 'type' => $dm_type, 'type_config' => array('output_mode' => $output_mode), 'widget' => $widget, 'widget_config' => array('height' => $height, 'width' => '100%'))); }
<?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>
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'); } }