Files
@ 1db340eef40b
Branch filter:
Location: hot67beta/administrator/components/com_menus/views/item/view.php
1db340eef40b
5.7 KiB
text/x-php
add mtop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | <?php
/**
* @version $Id: view.php 10559 2008-07-16 20:57:43Z instance $
* @package Joomla
* @subpackage Menus
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.view');
jimport('joomla.html.pane');
/**
* @package Joomla
* @subpackage Menus
* @since 1.5
*/
class MenusViewItem extends JView
{
var $_name = 'item';
function edit($tpl = null)
{
JRequest::setVar( 'hidemainmenu', 1 );
global $mainframe;
$lang =& JFactory::getLanguage();
$this->_layout = 'form';
$item = &$this->get('Item');
// clean item data
JFilterOutput::objectHTMLSafe( $item, ENT_QUOTES, '' );
// Set toolbar items for the page
if (!$item->id) {
JToolBarHelper::title( JText::_( 'Menu Item' ) .': <small><small>[ '. JText::_( 'New' ) .' ]</small></small>', 'menu.png' );
} else {
JToolBarHelper::title( JText::_( 'Menu Item' ) .': <small><small>[ '. JText::_( 'Edit' ) .' ]</small></small>', 'menu.png' );
}
JToolBarHelper::save();
JToolBarHelper::apply();
if ($item->id) {
// for existing items the button is renamed `close`
JToolBarHelper::cancel( 'cancelItem', 'Close' );
} else {
JToolBarHelper::cancel('cancelItem');
}
JToolBarHelper::help( 'screen.menus.edit' );
// Load component language files
$component = &$this->get('Component');
$lang->load($component->option, JPATH_ADMINISTRATOR);
// Initialize variables
$urlparams = $this->get( 'UrlParams' );
$params = $this->get( 'StateParams' );
$sysparams = $this->get( 'SystemParams' );
$advanced = $this->get( 'AdvancedParams' );
$component = $this->get( 'ComponentParams' );
$name = $this->get( 'StateName' );
$description = $this->get( 'StateDescription' );
$menuTypes = MenusHelper::getMenuTypeList();
$components = MenusHelper::getComponentList();
JHTML::_('behavior.tooltip');
$document = & JFactory::getDocument();
if ($item->id) {
$document->setTitle(JText::_( 'Menu Item' ) .': ['. JText::_( 'Edit' ) .']');
} else {
$document->setTitle(JText::_( 'Menu Item' ) .': ['. JText::_( 'New' ) .']');
}
// Was showing up null in some cases....
if (!$item->published) {
$item->published = 0;
}
$lists = new stdClass();
$lists->published = MenusHelper::Published($item);
$lists->disabled = ($item->type != 'url' ? 'readonly="true"' : '');
$item->expansion = null;
if ($item->type != 'url') {
$lists->disabled = 'readonly="true"';
$item->linkfield = '<input type="hidden" name="link" value="'.$item->link.'" />';
if (($item->id) && ($item->type == 'component') && (isset($item->linkparts['option']))) {
$item->expansion = '&expand='.trim(str_replace('com_', '', $item->linkparts['option']));
}
} else {
$lists->disabled = null;
$item->linkfield = null;
}
$this->assignRef('lists' , $lists);
$this->assignRef('item' , $item);
$this->assignRef('urlparams', $urlparams);
$this->assignRef('sysparams', $sysparams);
$this->assignRef('params' , $params);
$this->assignRef('advanced' , $advanced);
$this->assignRef('comp' , $component);
$this->assignRef('menutypes', $menuTypes);
$this->assignRef('name' , $name);
$this->assignRef('description', $description);
// Add slider pane
// TODO: allowAllClose should default true in J!1.6, so remove the array when it does.
$pane = &JPane::getInstance('sliders', array('allowAllClose' => true));
$this->assignRef('pane', $pane);
parent::display($tpl);
}
function type($tpl = null)
{
JRequest::setVar( 'hidemainmenu', 1 );
global $mainframe;
$lang =& JFactory::getLanguage();
$this->_layout = 'type';
$item = &$this->get('Item');
// Set toolbar items for the page
if (!$item->id) {
JToolBarHelper::title( JText::_( 'Menu Item' ) .': <small><small>[ '. JText::_( 'New' ) .' ]</small></small>', 'menu.png' );
} else {
JToolBarHelper::title( JText::_( 'Change Menu Item' ), 'menu.png' );
}
// Set toolbar items for the page
JToolBarHelper::cancel('view');
JToolBarHelper::help( 'screen.menus.edit' );
// Add scripts and stylesheets to the document
$document = & JFactory::getDocument();
if($lang->isRTL()){
$document->addStyleSheet('components/com_menus/assets/type_rtl.css');
} else {
$document->addStyleSheet('components/com_menus/assets/type.css');
}
JHTML::_('behavior.tooltip');
// Load component language files
$components = MenusHelper::getComponentList();
$n = count($components);
for($i = 0; $i < $n; $i++)
{
$path = JPATH_SITE.DS.'components'.DS.$components[$i]->option.DS.'views';
$components[$i]->legacy = !is_dir($path);
$lang->load($components[$i]->option, JPATH_ADMINISTRATOR);
}
// Initialize variables
$item = &$this->get('Item');
$expansion = &$this->get('Expansion');
$component = &$this->get('Component');
$name = $this->get( 'StateName' );
$description = $this->get( 'StateDescription' );
$menuTypes = MenusHelper::getMenuTypeList();
// Set document title
if ($item->id) {
$document->setTitle(JText::_( 'Menu Item' ) .': ['. JText::_( 'Edit' ) .']');
} else {
$document->setTitle(JText::_( 'Menu Item' ) .': ['. JText::_( 'New' ) .']');
}
$this->assignRef('item', $item);
$this->assignRef('components', $components);
$this->assignRef('expansion', $expansion);
parent::display($tpl);
}
}
|