You've already forked joomla_test
first commit
This commit is contained in:
11
administrator/components/com_menus/access.xml
Normal file
11
administrator/components/com_menus/access.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<access component="com_menus">
|
||||
<section name="component">
|
||||
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
|
||||
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
|
||||
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
|
||||
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
|
||||
</section>
|
||||
</access>
|
55
administrator/components/com_menus/config.xml
Normal file
55
administrator/components/com_menus/config.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<fieldset
|
||||
name="page-options"
|
||||
label="COM_MENUS_PAGE_OPTIONS_LABEL"
|
||||
>
|
||||
|
||||
<field
|
||||
name="page_title"
|
||||
type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_PAGE_TITLE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_PAGE_TITLE_DESC"
|
||||
/>
|
||||
<field
|
||||
name="show_page_heading"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
label="COM_MENUS_ITEM_FIELD_SHOW_PAGE_HEADING_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_SHOW_PAGE_HEADING_DESC"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0" class="no">JNO</option>
|
||||
<option value="1" class="yes">JYES</option>
|
||||
</field>
|
||||
<field
|
||||
name="page_heading"
|
||||
type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_PAGE_HEADING_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_PAGE_HEADING_DESC"
|
||||
/>
|
||||
<field
|
||||
name="pageclass_sfx"
|
||||
type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_PAGE_CLASS_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_PAGE_CLASS_DESC"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset
|
||||
name="permissions"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
description="JCONFIG_PERMISSIONS_DESC"
|
||||
>
|
||||
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="JCONFIG_PERMISSIONS_LABEL"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
component="com_menus"
|
||||
section="component" />
|
||||
</fieldset>
|
||||
</config>
|
62
administrator/components/com_menus/controller.php
Normal file
62
administrator/components/com_menus/controller.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Base controller class for Menu Manager.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusController extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean If true, the view output will be cached
|
||||
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
*
|
||||
* @return JController This object to support chaining.
|
||||
* @since 1.5
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
require_once JPATH_COMPONENT.'/helpers/menus.php';
|
||||
|
||||
$view = $this->input->get('view', 'menus');
|
||||
$layout = $this->input->get('layout', 'default');
|
||||
$id = $this->input->getInt('id');
|
||||
|
||||
// Check for edit form.
|
||||
if ($view == 'menu' && $layout == 'edit' && !$this->checkEditId('com_menus.edit.menu', $id)) {
|
||||
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||
$this->setMessage($this->getError(), 'error');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menus', false));
|
||||
|
||||
return false;
|
||||
}
|
||||
elseif ($view == 'item' && $layout == 'edit' && !$this->checkEditId('com_menus.edit.item', $id)) {
|
||||
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||
$this->setMessage($this->getError(), 'error');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=items', false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::display();
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
345
administrator/components/com_menus/controllers/item.php
Normal file
345
administrator/components/com_menus/controllers/item.php
Normal file
@ -0,0 +1,345 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The Menu Item Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusControllerItem extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Method to add a new menu item.
|
||||
*
|
||||
* @return mixed True if the record can be added, a JError object if not.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$context = 'com_menus.edit.item';
|
||||
|
||||
$result = parent::add();
|
||||
if ($result)
|
||||
{
|
||||
$app->setUserState($context . '.type', null);
|
||||
$app->setUserState($context . '.link', null);
|
||||
|
||||
$menuType = $app->getUserStateFromRequest($this->context . '.filter.menutype', 'menutype', 'mainmenu', 'cmd');
|
||||
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=item&menutype=' . $menuType . $this->getRedirectToItemAppend(), false));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('Item', '', array());
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=items' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$context = 'com_menus.edit.item';
|
||||
$result = parent::cancel();
|
||||
|
||||
if ($result)
|
||||
{
|
||||
// Clear the ancillary data from the session.
|
||||
$app->setUserState($context . '.type', null);
|
||||
$app->setUserState($context . '.link', null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to edit an existing record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key
|
||||
* (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if access level check and checkout passes, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function edit($key = null, $urlVar = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$result = parent::edit();
|
||||
|
||||
if ($result)
|
||||
{
|
||||
// Push the new ancillary data into the session.
|
||||
$app->setUserState('com_menus.edit.item.type', null);
|
||||
$app->setUserState('com_menus.edit.item.link', null);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// Check for request forgeries.
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$model = $this->getModel('Item', '', array());
|
||||
$data = $this->input->post->get('jform', array(), 'array');
|
||||
$task = $this->getTask();
|
||||
$context = 'com_menus.edit.item';
|
||||
$recordId = $this->input->getInt('id');
|
||||
|
||||
if (!$this->checkEditId($context, $recordId))
|
||||
{
|
||||
// Somehow the person just went to the form and saved it - we don't allow that.
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId));
|
||||
$this->setMessage($this->getError(), 'error');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=items' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Populate the row id from the session.
|
||||
$data['id'] = $recordId;
|
||||
|
||||
// The save2copy task needs to be handled slightly differently.
|
||||
if ($task == 'save2copy')
|
||||
{
|
||||
// Check-in the original row.
|
||||
if ($model->checkin($data['id']) === false)
|
||||
{
|
||||
// Check-in failed, go back to the item and display a notice.
|
||||
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'warning');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reset the ID and then treat the request as for Apply.
|
||||
$data['id'] = 0;
|
||||
$data['associations'] = array();
|
||||
$task = 'apply';
|
||||
}
|
||||
|
||||
// Validate the posted data.
|
||||
// This post is made up of two forms, one for the item and one for params.
|
||||
$form = $model->getForm($data);
|
||||
if (!$form)
|
||||
{
|
||||
JError::raiseError(500, $model->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
$data = $model->validate($form, $data);
|
||||
|
||||
// Check for the special 'request' entry.
|
||||
if ($data['type'] == 'component' && isset($data['request']) && is_array($data['request']) && !empty($data['request']))
|
||||
{
|
||||
// Parse the submitted link arguments.
|
||||
$args = array();
|
||||
parse_str(parse_url($data['link'], PHP_URL_QUERY), $args);
|
||||
|
||||
// Merge in the user supplied request arguments.
|
||||
$args = array_merge($args, $data['request']);
|
||||
$data['link'] = 'index.php?' . urldecode(http_build_query($args, '', '&'));
|
||||
unset($data['request']);
|
||||
}
|
||||
|
||||
// Check for validation errors.
|
||||
if ($data === false)
|
||||
{
|
||||
// Get the validation messages.
|
||||
$errors = $model->getErrors();
|
||||
|
||||
// Push up to three validation messages out to the user.
|
||||
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
|
||||
{
|
||||
if ($errors[$i] instanceof Exception)
|
||||
{
|
||||
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
$app->enqueueMessage($errors[$i], 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
// Save the data in the session.
|
||||
$app->setUserState('com_menus.edit.item.data', $data);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Attempt to save the data.
|
||||
if (!$model->save($data))
|
||||
{
|
||||
// Save the data in the session.
|
||||
$app->setUserState('com_menus.edit.item.data', $data);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'warning');
|
||||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save succeeded, check-in the row.
|
||||
if ($model->checkin($data['id']) === false)
|
||||
{
|
||||
// Check-in failed, go back to the row and display a notice.
|
||||
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()), 'warning');
|
||||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setMessage(JText::_('COM_MENUS_SAVE_SUCCESS'));
|
||||
|
||||
// Redirect the user and adjust session state based on the chosen task.
|
||||
switch ($task)
|
||||
{
|
||||
case 'apply':
|
||||
// Set the row data in the session.
|
||||
$recordId = $model->getState($this->context . '.id');
|
||||
$this->holdEditId($context, $recordId);
|
||||
$app->setUserState('com_menus.edit.item.data', null);
|
||||
$app->setUserState('com_menus.edit.item.type', null);
|
||||
$app->setUserState('com_menus.edit.item.link', null);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false));
|
||||
break;
|
||||
|
||||
case 'save2new':
|
||||
// Clear the row id and data in the session.
|
||||
$this->releaseEditId($context, $recordId);
|
||||
$app->setUserState('com_menus.edit.item.data', null);
|
||||
$app->setUserState('com_menus.edit.item.type', null);
|
||||
$app->setUserState('com_menus.edit.item.link', null);
|
||||
$app->setUserState('com_menus.edit.item.menutype', $model->getState('item.menutype'));
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend(), false));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Clear the row id and data in the session.
|
||||
$this->releaseEditId($context, $recordId);
|
||||
$app->setUserState('com_menus.edit.item.data', null);
|
||||
$app->setUserState('com_menus.edit.item.type', null);
|
||||
$app->setUserState('com_menus.edit.item.link', null);
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of the menu item currently being edited.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function setType()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Get the posted values from the request.
|
||||
$data = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// Get the type.
|
||||
$type = $data['type'];
|
||||
|
||||
$type = json_decode(base64_decode($type));
|
||||
$title = isset($type->title) ? $type->title : null;
|
||||
$recordId = isset($type->id) ? $type->id : 0;
|
||||
|
||||
$specialTypes = array('alias', 'separator', 'url', 'heading');
|
||||
if (!in_array($title, $specialTypes))
|
||||
{
|
||||
$title = 'component';
|
||||
}
|
||||
|
||||
$app->setUserState('com_menus.edit.item.type', $title);
|
||||
if ($title == 'component')
|
||||
{
|
||||
if (isset($type->request))
|
||||
{
|
||||
$component = JComponentHelper::getComponent($type->request->option);
|
||||
$data['component_id'] = $component->id;
|
||||
|
||||
$app->setUserState('com_menus.edit.item.link', 'index.php?' . JUri::buildQuery((array) $type->request));
|
||||
}
|
||||
}
|
||||
// If the type is alias you just need the item id from the menu item referenced.
|
||||
elseif ($title == 'alias')
|
||||
{
|
||||
$app->setUserState('com_menus.edit.item.link', 'index.php?Itemid=');
|
||||
}
|
||||
|
||||
unset($data['request']);
|
||||
$data['type'] = $title;
|
||||
if ($this->input->get('fieldtype') == 'type')
|
||||
{
|
||||
$data['link'] = $app->getUserState('com_menus.edit.item.link');
|
||||
}
|
||||
|
||||
//Save the data in the session.
|
||||
$app->setUserState('com_menus.edit.item.data', $data);
|
||||
|
||||
$this->type = $type;
|
||||
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false));
|
||||
}
|
||||
}
|
131
administrator/components/com_menus/controllers/items.php
Normal file
131
administrator/components/com_menus/controllers/items.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The Menu Item Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusControllerItems extends JControllerAdmin
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
$this->registerTask('unsetDefault', 'setDefault');
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy for getModel
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Item', $prefix = 'MenusModel', $config = array())
|
||||
{
|
||||
return parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild the nested set tree.
|
||||
*
|
||||
* @return bool False on failure or error, true on success.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function rebuild()
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$this->setRedirect('index.php?option=com_menus&view=items');
|
||||
|
||||
$model = $this->getModel();
|
||||
|
||||
if ($model->rebuild())
|
||||
{
|
||||
// Reorder succeeded.
|
||||
$this->setMessage(JText::_('COM_MENUS_ITEMS_REBUILD_SUCCESS'));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rebuild failed.
|
||||
$this->setMessage(JText::sprintf('COM_MENUS_ITEMS_REBUILD_FAILED'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function saveorder()
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get the arrays from the Request
|
||||
$order = $this->input->post->get('order', null, 'array');
|
||||
$originalOrder = explode(',', $this->input->getString('original_order_values'));
|
||||
|
||||
// Make sure something has changed
|
||||
if (!($order === $originalOrder))
|
||||
{
|
||||
parent::saveorder();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing to reorder
|
||||
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the home property for a list of items
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function setDefault()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken('request') or die(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get items to publish from the request.
|
||||
$cid = $this->input->get('cid', array(), 'array');
|
||||
$data = array('setDefault' => 1, 'unsetDefault' => 0);
|
||||
$task = $this->getTask();
|
||||
$value = JArrayHelper::getValue($data, $task, 0, 'int');
|
||||
|
||||
if (empty($cid))
|
||||
{
|
||||
JError::raiseWarning(500, JText::_($this->text_prefix.'_NO_ITEM_SELECTED'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the model.
|
||||
$model = $this->getModel();
|
||||
|
||||
// Make sure the item ids are integers
|
||||
JArrayHelper::toInteger($cid);
|
||||
|
||||
// Publish the items.
|
||||
if (!$model->setHome($cid, $value))
|
||||
{
|
||||
JError::raiseWarning(500, $model->getError());
|
||||
} else {
|
||||
if ($value == 1)
|
||||
{
|
||||
$ntext = 'COM_MENUS_ITEMS_SET_HOME';
|
||||
}
|
||||
else {
|
||||
$ntext = 'COM_MENUS_ITEMS_UNSET_HOME';
|
||||
}
|
||||
$this->setMessage(JText::plural($ntext, count($cid)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
|
||||
}
|
||||
}
|
158
administrator/components/com_menus/controllers/menu.php
Normal file
158
administrator/components/com_menus/controllers/menu.php
Normal file
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The Menu Type Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusControllerMenu extends JControllerForm
|
||||
{
|
||||
/**
|
||||
* Dummy method to redirect back to standard controller
|
||||
*
|
||||
* @param boolean If true, the view output will be cached
|
||||
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
*
|
||||
* @return JController This object to support chaining.
|
||||
* @since 1.5
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menus', false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a menu item.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// Check for request forgeries.
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$data = $this->input->post->get('jform', array(), 'array');
|
||||
$context = 'com_menus.edit.menu';
|
||||
$task = $this->getTask();
|
||||
$recordId = $this->input->getInt('id');
|
||||
|
||||
if (!$this->checkEditId($context, $recordId))
|
||||
{
|
||||
// Somehow the person just went to the form and saved it - we don't allow that.
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $recordId));
|
||||
$this->setMessage($this->getError(), 'error');
|
||||
$this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure we are not trying to modify an administrator menu.
|
||||
if (isset($data['client_id']) && $data['client_id'] == 1){
|
||||
JError::raiseNotice(0, JText::_('COM_MENUS_MENU_TYPE_NOT_ALLOWED'));
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit', false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Populate the row id from the session.
|
||||
$data['id'] = $recordId;
|
||||
|
||||
// Get the model and attempt to validate the posted data.
|
||||
$model = $this->getModel('Menu');
|
||||
$form = $model->getForm();
|
||||
if (!$form)
|
||||
{
|
||||
JError::raiseError(500, $model->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = $model->validate($form, $data);
|
||||
|
||||
// Check for validation errors.
|
||||
if ($data === false)
|
||||
{
|
||||
// Get the validation messages.
|
||||
$errors = $model->getErrors();
|
||||
|
||||
// Push up to three validation messages out to the user.
|
||||
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
|
||||
{
|
||||
if ($errors[$i] instanceof Exception)
|
||||
{
|
||||
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
|
||||
}
|
||||
else {
|
||||
$app->enqueueMessage($errors[$i], 'warning');
|
||||
}
|
||||
}
|
||||
// Save the data in the session.
|
||||
$app->setUserState('com_menus.edit.menu.data', $data);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit', false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Attempt to save the data.
|
||||
if (!$model->save($data))
|
||||
{
|
||||
// Save the data in the session.
|
||||
$app->setUserState('com_menus.edit.menu.data', $data);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'warning');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit', false));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setMessage(JText::_('COM_MENUS_MENU_SAVE_SUCCESS'));
|
||||
|
||||
// Redirect the user and adjust session state based on the chosen task.
|
||||
switch ($task)
|
||||
{
|
||||
case 'apply':
|
||||
// Set the record data in the session.
|
||||
$recordId = $model->getState($this->context.'.id');
|
||||
$this->holdEditId($context, $recordId);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit'.$this->getRedirectToItemAppend($recordId), false));
|
||||
break;
|
||||
|
||||
case 'save2new':
|
||||
// Clear the record id and data from the session.
|
||||
$this->releaseEditId($context, $recordId);
|
||||
$app->setUserState($context.'.data', null);
|
||||
|
||||
// Redirect back to the edit screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menu&layout=edit', false));
|
||||
break;
|
||||
|
||||
default:
|
||||
// Clear the record id and data from the session.
|
||||
$this->releaseEditId($context, $recordId);
|
||||
$app->setUserState($context.'.data', null);
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menus', false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
202
administrator/components/com_menus/controllers/menus.php
Normal file
202
administrator/components/com_menus/controllers/menus.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The Menu List Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusControllerMenus extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Display the view
|
||||
*
|
||||
* @param boolean If true, the view output will be cached
|
||||
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
*
|
||||
* @return JController This object to support chaining.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return object The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Menu', $prefix = 'MenusModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, $config);
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an item
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get items to remove from the request.
|
||||
$cid = $this->input->get('cid', array(), 'array');
|
||||
|
||||
if (!is_array($cid) || count($cid) < 1)
|
||||
{
|
||||
JError::raiseWarning(500, JText::_('COM_MENUS_NO_MENUS_SELECTED'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the model.
|
||||
$model = $this->getModel();
|
||||
|
||||
// Make sure the item ids are integers
|
||||
jimport('joomla.utilities.arrayhelper');
|
||||
JArrayHelper::toInteger($cid);
|
||||
|
||||
// Remove the items.
|
||||
if (!$model->delete($cid))
|
||||
{
|
||||
$this->setMessage($model->getError());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setMessage(JText::plural('COM_MENUS_N_MENUS_DELETED', count($cid)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect('index.php?option=com_menus&view=menus');
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild the menu tree.
|
||||
*
|
||||
* @return bool False on failure or error, true on success.
|
||||
*/
|
||||
public function rebuild()
|
||||
{
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$this->setRedirect('index.php?option=com_menus&view=menus');
|
||||
|
||||
$model = $this->getModel('Item');
|
||||
|
||||
if ($model->rebuild())
|
||||
{
|
||||
// Reorder succeeded.
|
||||
$this->setMessage(JText::_('JTOOLBAR_REBUILD_SUCCESS'));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rebuild failed.
|
||||
$this->setMessage(JText::sprintf('JTOOLBAR_REBUILD_FAILED', $model->getMessage()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary method. This should go into the 1.5 to 1.6 upgrade routines.
|
||||
*/
|
||||
public function resync()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$parts = null;
|
||||
|
||||
try
|
||||
{
|
||||
$query->select('element, extension_id')
|
||||
->from('#__extensions')
|
||||
->where('type = ' . $db->quote('component'));
|
||||
$db->setQuery($query);
|
||||
|
||||
$components = $db->loadAssocList('element', 'extension_id');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
return JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
// Load all the component menu links
|
||||
$query->select($db->quoteName('id'))
|
||||
->select($db->quoteName('link'))
|
||||
->select($db->quoteName('component_id'))
|
||||
->from('#__menu')
|
||||
->where($db->quoteName('type') . ' = ' . $db->quote('component.item'));
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$items = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
return JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
// Parse the link.
|
||||
parse_str(parse_url($item->link, PHP_URL_QUERY), $parts);
|
||||
|
||||
// Tease out the option.
|
||||
if (isset($parts['option']))
|
||||
{
|
||||
$option = $parts['option'];
|
||||
|
||||
// Lookup the component ID
|
||||
if (isset($components[$option]))
|
||||
{
|
||||
$componentId = $components[$option];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mismatch. Needs human intervention.
|
||||
$componentId = -1;
|
||||
}
|
||||
|
||||
// Check for mis-matched component id's in the menu link.
|
||||
if ($item->component_id != $componentId)
|
||||
{
|
||||
// Update the menu table.
|
||||
$log = "Link $item->id refers to $item->component_id, converting to $componentId ($item->link)";
|
||||
echo "<br/>$log";
|
||||
|
||||
$query->clear();
|
||||
$query->update('#__menu')
|
||||
->set('component_id = ' . $componentId)
|
||||
->where('id = ' . $item->id);
|
||||
|
||||
try
|
||||
{
|
||||
$db->setQuery($query)->execute();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
return JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
//echo "<br>".$db->getQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
209
administrator/components/com_menus/helpers/html/menus.php
Normal file
209
administrator/components/com_menus/helpers/html/menus.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*/
|
||||
abstract class MenusHtmlMenus
|
||||
{
|
||||
/**
|
||||
* @param int $itemid The menu item id
|
||||
*/
|
||||
public static function association($itemid)
|
||||
{
|
||||
// Defaults
|
||||
$html = '';
|
||||
|
||||
// Get the associations
|
||||
if ($associations = MenusHelper::getAssociations($itemid))
|
||||
{
|
||||
// Get the associated menu items
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('m.id, m.title')
|
||||
->select('l.sef as lang_sef')
|
||||
->select('mt.title as menu_title')
|
||||
->from('#__menu as m')
|
||||
->join('LEFT', '#__menu_types as mt ON mt.menutype=m.menutype')
|
||||
->where('m.id IN (' . implode(',', array_values($associations)) . ')')
|
||||
->join('LEFT', '#__languages as l ON m.language=l.lang_code')
|
||||
->select('l.image')
|
||||
->select('l.title as language_title');
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$items = $db->loadObjectList('id');
|
||||
}
|
||||
catch (runtimeException $e)
|
||||
{
|
||||
throw new Exception($e->getMessage(), 500);
|
||||
}
|
||||
|
||||
// Construct html
|
||||
if ($items)
|
||||
{
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
$text = strtoupper($item->lang_sef);
|
||||
$url = JRoute::_('index.php?option=com_menus&task=item.edit&id=' . (int) $item->id);
|
||||
$tooltipParts = array(
|
||||
JHtml::_('image', 'mod_languages/' . $item->image . '.gif',
|
||||
$item->language_title,
|
||||
array('title' => $item->language_title),
|
||||
true
|
||||
),
|
||||
$item->title,
|
||||
'(' . $item->menu_title . ')'
|
||||
);
|
||||
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
|
||||
}
|
||||
}
|
||||
|
||||
$html = JLayoutHelper::render('joomla.content.associations', $items);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a published state on a grid
|
||||
*
|
||||
* @param integer $value The state value.
|
||||
* @param integer $i The row index
|
||||
* @param boolean $enabled An optional setting for access control on the action.
|
||||
* @param string $checkbox An optional prefix for checkboxes.
|
||||
*
|
||||
* @return string The Html code
|
||||
*
|
||||
* @see JHtmlJGrid::state
|
||||
*
|
||||
* @since 1.7.1
|
||||
*/
|
||||
public static function state($value, $i, $enabled = true, $checkbox = 'cb')
|
||||
{
|
||||
$states = array(
|
||||
9 => array(
|
||||
'unpublish',
|
||||
'',
|
||||
'COM_MENUS_HTML_UNPUBLISH_HEADING',
|
||||
'',
|
||||
false,
|
||||
'publish',
|
||||
'publish'
|
||||
),
|
||||
8 => array(
|
||||
'publish',
|
||||
'',
|
||||
'COM_MENUS_HTML_PUBLISH_HEADING',
|
||||
'',
|
||||
false,
|
||||
'unpublish',
|
||||
'unpublish'
|
||||
),
|
||||
7 => array(
|
||||
'unpublish',
|
||||
'',
|
||||
'COM_MENUS_HTML_UNPUBLISH_SEPARATOR',
|
||||
'',
|
||||
false,
|
||||
'publish',
|
||||
'publish'
|
||||
),
|
||||
6 => array(
|
||||
'publish',
|
||||
'',
|
||||
'COM_MENUS_HTML_PUBLISH_SEPARATOR',
|
||||
'',
|
||||
false,
|
||||
'unpublish',
|
||||
'unpublish'
|
||||
),
|
||||
5 => array(
|
||||
'unpublish',
|
||||
'',
|
||||
'COM_MENUS_HTML_UNPUBLISH_ALIAS',
|
||||
'',
|
||||
false,
|
||||
'publish',
|
||||
'publish'
|
||||
),
|
||||
4 => array(
|
||||
'publish',
|
||||
'',
|
||||
'COM_MENUS_HTML_PUBLISH_ALIAS',
|
||||
'',
|
||||
false,
|
||||
'unpublish',
|
||||
'unpublish'
|
||||
),
|
||||
3 => array(
|
||||
'unpublish',
|
||||
'',
|
||||
'COM_MENUS_HTML_UNPUBLISH_URL',
|
||||
'',
|
||||
false,
|
||||
'publish',
|
||||
'publish'
|
||||
),
|
||||
2 => array(
|
||||
'publish',
|
||||
'',
|
||||
'COM_MENUS_HTML_PUBLISH_URL',
|
||||
'',
|
||||
false,
|
||||
'unpublish',
|
||||
'unpublish'
|
||||
),
|
||||
1 => array(
|
||||
'unpublish',
|
||||
'COM_MENUS_EXTENSION_PUBLISHED_ENABLED',
|
||||
'COM_MENUS_HTML_UNPUBLISH_ENABLED',
|
||||
'COM_MENUS_EXTENSION_PUBLISHED_ENABLED',
|
||||
true,
|
||||
'publish',
|
||||
'publish'
|
||||
),
|
||||
0 => array(
|
||||
'publish',
|
||||
'COM_MENUS_EXTENSION_UNPUBLISHED_ENABLED',
|
||||
'COM_MENUS_HTML_PUBLISH_ENABLED',
|
||||
'COM_MENUS_EXTENSION_UNPUBLISHED_ENABLED',
|
||||
true,
|
||||
'unpublish',
|
||||
'unpublish'
|
||||
),
|
||||
-1 => array(
|
||||
'unpublish',
|
||||
'COM_MENUS_EXTENSION_PUBLISHED_DISABLED',
|
||||
'COM_MENUS_HTML_UNPUBLISH_DISABLED',
|
||||
'COM_MENUS_EXTENSION_PUBLISHED_DISABLED',
|
||||
true,
|
||||
'warning',
|
||||
'warning'
|
||||
),
|
||||
-2 => array(
|
||||
'publish',
|
||||
'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED',
|
||||
'COM_MENUS_HTML_PUBLISH_DISABLED',
|
||||
'COM_MENUS_EXTENSION_UNPUBLISHED_DISABLED',
|
||||
true,
|
||||
'unpublish',
|
||||
'unpublish'
|
||||
),
|
||||
);
|
||||
|
||||
return JHtml::_('jgrid.state', $states, $value, $i, 'items.', $enabled, true, $checkbox);
|
||||
}
|
||||
}
|
1
administrator/components/com_menus/helpers/index.html
Normal file
1
administrator/components/com_menus/helpers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
285
administrator/components/com_menus/helpers/menus.php
Normal file
285
administrator/components/com_menus/helpers/menus.php
Normal file
@ -0,0 +1,285 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Menus component helper.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusHelper
|
||||
{
|
||||
/**
|
||||
* Defines the valid request variables for the reverse lookup.
|
||||
*/
|
||||
protected static $_filter = array('option', 'view', 'layout');
|
||||
|
||||
/**
|
||||
* Configure the Linkbar.
|
||||
*
|
||||
* @param string The name of the active view.
|
||||
*/
|
||||
public static function addSubmenu($vName)
|
||||
{
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('COM_MENUS_SUBMENU_MENUS'),
|
||||
'index.php?option=com_menus&view=menus',
|
||||
$vName == 'menus'
|
||||
);
|
||||
JHtmlSidebar::addEntry(
|
||||
JText::_('COM_MENUS_SUBMENU_ITEMS'),
|
||||
'index.php?option=com_menus&view=items',
|
||||
$vName == 'items'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of the actions that can be performed.
|
||||
*
|
||||
* @param integer The menu ID.
|
||||
*
|
||||
* @return JObject
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function getActions($parentId = 0)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$result = new JObject;
|
||||
|
||||
if (empty($parentId))
|
||||
{
|
||||
$assetName = 'com_menus';
|
||||
}
|
||||
else
|
||||
{
|
||||
$assetName = 'com_menus.item.' . (int) $parentId;
|
||||
}
|
||||
|
||||
$actions = JAccess::getActions('com_menus');
|
||||
|
||||
foreach ($actions as $action)
|
||||
{
|
||||
$result->set($action->name, $user->authorise($action->name, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a standard form of a link for lookups.
|
||||
*
|
||||
* @param mixed A link string or array of request variables.
|
||||
*
|
||||
* @return mixed A link in standard option-view-layout form, or false if the supplied response is invalid.
|
||||
*/
|
||||
public static function getLinkKey($request)
|
||||
{
|
||||
if (empty($request))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the link is in the form of index.php?...
|
||||
if (is_string($request))
|
||||
{
|
||||
$args = array();
|
||||
if (strpos($request, 'index.php') === 0)
|
||||
{
|
||||
parse_str(parse_url(htmlspecialchars_decode($request), PHP_URL_QUERY), $args);
|
||||
}
|
||||
else
|
||||
{
|
||||
parse_str($request, $args);
|
||||
}
|
||||
$request = $args;
|
||||
}
|
||||
|
||||
// Only take the option, view and layout parts.
|
||||
foreach ($request as $name => $value)
|
||||
{
|
||||
if ((!in_array($name, self::$_filter)) && (!($name == 'task' && !array_key_exists('view', $request))))
|
||||
{
|
||||
// Remove the variables we want to ignore.
|
||||
unset($request[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
ksort($request);
|
||||
|
||||
return 'index.php?' . http_build_query($request, '', '&');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the menu list for create a menu module
|
||||
*
|
||||
* @return array The menu array list
|
||||
* @since 1.6
|
||||
*/
|
||||
public static function getMenuTypes()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.menutype')
|
||||
->from('#__menu_types AS a');
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->loadColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of menu links for one or all menus.
|
||||
*
|
||||
* @param string An option menu to filter the list on, otherwise all menu links are returned as a grouped array.
|
||||
* @param integer An optional parent ID to pivot results around.
|
||||
* @param integer An optional mode. If parent ID is set and mode=2, the parent and children are excluded from the list.
|
||||
* @param array An optional array of states
|
||||
*/
|
||||
public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0, $published = array(), $languages = array())
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.id AS value, a.title AS text, a.alias, a.level, a.menutype, a.type, a.template_style_id, a.checked_out')
|
||||
->from('#__menu AS a')
|
||||
->join('LEFT', $db->quoteName('#__menu') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
|
||||
|
||||
// Filter by the type
|
||||
if ($menuType)
|
||||
{
|
||||
$query->where('(a.menutype = ' . $db->quote($menuType) . ' OR a.parent_id = 0)');
|
||||
}
|
||||
|
||||
if ($parentId)
|
||||
{
|
||||
if ($mode == 2)
|
||||
{
|
||||
// Prevent the parent and children from showing.
|
||||
$query->join('LEFT', '#__menu AS p ON p.id = ' . (int) $parentId)
|
||||
->where('(a.lft <= p.lft OR a.rgt >= p.rgt)');
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($languages))
|
||||
{
|
||||
if (is_array($languages))
|
||||
{
|
||||
$languages = '(' . implode(',', array_map(array($db, 'quote'), $languages)) . ')';
|
||||
}
|
||||
$query->where('a.language IN ' . $languages);
|
||||
}
|
||||
|
||||
if (!empty($published))
|
||||
{
|
||||
if (is_array($published))
|
||||
{
|
||||
$published = '(' . implode(',', $published) . ')';
|
||||
}
|
||||
$query->where('a.published IN ' . $published);
|
||||
}
|
||||
|
||||
$query->where('a.published != -2')
|
||||
->group('a.id, a.title, a.level, a.menutype, a.type, a.template_style_id, a.checked_out, a.lft')
|
||||
->order('a.lft ASC');
|
||||
|
||||
// Get the options.
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$links = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($menuType))
|
||||
{
|
||||
// If the menutype is empty, group the items by menutype.
|
||||
$query->clear()
|
||||
->select('*')
|
||||
->from('#__menu_types')
|
||||
->where('menutype <> ' . $db->quote(''))
|
||||
->order('title, menutype');
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$menuTypes = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create a reverse lookup and aggregate the links.
|
||||
$rlu = array();
|
||||
foreach ($menuTypes as &$type)
|
||||
{
|
||||
$rlu[$type->menutype] = & $type;
|
||||
$type->links = array();
|
||||
}
|
||||
|
||||
// Loop through the list of menu links.
|
||||
foreach ($links as &$link)
|
||||
{
|
||||
if (isset($rlu[$link->menutype]))
|
||||
{
|
||||
$rlu[$link->menutype]->links[] = & $link;
|
||||
|
||||
// Cleanup garbage.
|
||||
unset($link->menutype);
|
||||
}
|
||||
}
|
||||
|
||||
return $menuTypes;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $links;
|
||||
}
|
||||
}
|
||||
|
||||
static public function getAssociations($pk)
|
||||
{
|
||||
$associations = array();
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->from('#__menu as m')
|
||||
->join('INNER', '#__associations as a ON a.id=m.id AND a.context=' . $db->quote('com_menus.item'))
|
||||
->join('INNER', '#__associations as a2 ON a.key=a2.key')
|
||||
->join('INNER', '#__menu as m2 ON a2.id=m2.id')
|
||||
->where('m.id=' . (int) $pk)
|
||||
->select('m2.language, m2.id');
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$menuitems = $db->loadObjectList('language');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
throw new Exception($e->getMessage(), 500);
|
||||
}
|
||||
|
||||
foreach ($menuitems as $tag => $item)
|
||||
{
|
||||
// Do not return itself as result
|
||||
if ((int) $item->id != $pk)
|
||||
{
|
||||
$associations[$tag] = $item->id;
|
||||
}
|
||||
}
|
||||
return $associations;
|
||||
}
|
||||
}
|
1
administrator/components/com_menus/index.html
Normal file
1
administrator/components/com_menus/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
19
administrator/components/com_menus/menus.php
Normal file
19
administrator/components/com_menus/menus.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
if (!JFactory::getUser()->authorise('core.manage', 'com_menus'))
|
||||
{
|
||||
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Menus');
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
$controller->redirect();
|
28
administrator/components/com_menus/menus.xml
Normal file
28
administrator/components/com_menus/menus.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.1" method="upgrade">
|
||||
<name>com_menus</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>April 2006</creationDate>
|
||||
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved. </copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.0.0</version>
|
||||
<description>COM_MENUS_XML_DESCRIPTION</description>
|
||||
<administration>
|
||||
<files folder="admin">
|
||||
<filename>config.xml</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>menus.php</filename>
|
||||
<folder>controllers</folder>
|
||||
<folder>helpers</folder>
|
||||
<folder>models</folder>
|
||||
<folder>views</folder>
|
||||
</files>
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB.com_menus.ini</language>
|
||||
<language tag="en-GB">language/en-GB.com_menus.sys.ini</language>
|
||||
</languages>
|
||||
</administration>
|
||||
</extension>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Form Field class for the Joomla Framework.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class JFormFieldMenuOrdering extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.7
|
||||
*/
|
||||
protected $type = 'MenuOrdering';
|
||||
|
||||
/**
|
||||
* Method to get the list of siblings in a menu.
|
||||
* The method requires that parent be set.
|
||||
*
|
||||
* @return array The field option objects or false if the parent field has not been set
|
||||
* @since 1.7
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$options = array();
|
||||
|
||||
// Get the parent
|
||||
$parent_id = $this->form->getValue('parent_id', 0);
|
||||
if (empty($parent_id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.id AS value, a.title AS text')
|
||||
->from('#__menu AS a')
|
||||
|
||||
->where('a.published >= 0')
|
||||
->where('a.parent_id =' . (int) $parent_id);
|
||||
if ($menuType = $this->form->getValue('menutype'))
|
||||
{
|
||||
$query->where('a.menutype = ' . $db->quote($menuType));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.menutype != ' . $db->quote(''));
|
||||
}
|
||||
|
||||
$query->order('a.lft ASC');
|
||||
|
||||
// Get the options.
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$options = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
$options = array_merge(
|
||||
array(array('value' => '-1', 'text' => JText::_('COM_MENUS_ITEM_FIELD_ORDERING_VALUE_FIRST'))),
|
||||
$options,
|
||||
array(array('value' => '-2', 'text' => JText::_('COM_MENUS_ITEM_FIELD_ORDERING_VALUE_LAST')))
|
||||
);
|
||||
|
||||
// Merge any additional options in the XML definition.
|
||||
$options = array_merge(parent::getOptions(), $options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the field input markup
|
||||
*
|
||||
* @return string The field input markup.
|
||||
* @since 1.7
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
if ($this->form->getValue('id', 0) == 0)
|
||||
{
|
||||
return '<span class="readonly">' . JText::_('COM_MENUS_ITEM_FIELD_ORDERING_TEXT') . '</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::getInput();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Form Field class for the Joomla Framework.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class JFormFieldMenuParent extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $type = 'MenuParent';
|
||||
|
||||
/**
|
||||
* Method to get the field options.
|
||||
*
|
||||
* @return array The field option objects.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$options = array();
|
||||
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('a.id AS value, a.title AS text, a.level')
|
||||
->from('#__menu AS a')
|
||||
->join('LEFT', $db->quoteName('#__menu') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
|
||||
|
||||
if ($menuType = $this->form->getValue('menutype'))
|
||||
{
|
||||
$query->where('a.menutype = ' . $db->quote($menuType));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.menutype != ' . $db->quote(''));
|
||||
}
|
||||
|
||||
// Prevent parenting to children of this item.
|
||||
if ($id = $this->form->getValue('id'))
|
||||
{
|
||||
$query->join('LEFT', $db->quoteName('#__menu') . ' AS p ON p.id = ' . (int) $id)
|
||||
->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');
|
||||
}
|
||||
|
||||
$query->where('a.published != -2')
|
||||
->group('a.id, a.title, a.level, a.lft, a.rgt, a.menutype, a.parent_id, a.published')
|
||||
->order('a.lft ASC');
|
||||
|
||||
// Get the options.
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$options = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
JError::raiseWarning(500, $e->getMessage());
|
||||
}
|
||||
|
||||
// Pad the option text with spaces using depth level as a multiplier.
|
||||
for ($i = 0, $n = count($options); $i < $n; $i++)
|
||||
{
|
||||
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
|
||||
}
|
||||
|
||||
// Merge any additional options in the XML definition.
|
||||
$options = array_merge(parent::getOptions(), $options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Form Field class for the Joomla Framework.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class JFormFieldMenutype extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The form field type.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $type = 'menutype';
|
||||
|
||||
/**
|
||||
* Method to get the field input markup.
|
||||
*
|
||||
* @return string The field input markup.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
$html = array();
|
||||
$recordId = (int) $this->form->getValue('id');
|
||||
$size = ($v = $this->element['size']) ? ' size="'.$v.'"' : '';
|
||||
$class = ($v = $this->element['class']) ? ' class="'.$v.'"' : 'class="text_area"';
|
||||
|
||||
// Get a reverse lookup of the base link URL to Title
|
||||
$model = JModelLegacy::getInstance('menutypes', 'menusModel');
|
||||
$rlu = $model->getReverseLookup();
|
||||
|
||||
switch ($this->value)
|
||||
{
|
||||
case 'url':
|
||||
$value = JText::_('COM_MENUS_TYPE_EXTERNAL_URL');
|
||||
break;
|
||||
|
||||
case 'alias':
|
||||
$value = JText::_('COM_MENUS_TYPE_ALIAS');
|
||||
break;
|
||||
|
||||
case 'separator':
|
||||
$value = JText::_('COM_MENUS_TYPE_SEPARATOR');
|
||||
break;
|
||||
|
||||
case 'heading':
|
||||
$value = JText::_('COM_MENUS_TYPE_HEADING');
|
||||
break;
|
||||
|
||||
default:
|
||||
$link = $this->form->getValue('link');
|
||||
// Clean the link back to the option, view and layout
|
||||
$value = JText::_(JArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link)));
|
||||
break;
|
||||
}
|
||||
// Load the javascript and css
|
||||
JHtml::_('behavior.framework');
|
||||
JHtml::_('behavior.modal');
|
||||
|
||||
$html[] = '<span class="input-append"><input type="text" readonly="readonly" disabled="disabled" value="'.$value.'"'.$size.$class.' /><a class="btn btn-primary" onclick="SqueezeBox.fromElement(this, {handler:\'iframe\', size: {x: 600, y: 450}, url:\''.JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId='.$recordId).'\'})"><i class="icon-list icon-white"></i> '.JText::_('JSELECT').'</a></span>';
|
||||
$html[] = '<input class="input-small" type="hidden" name="' . $this->name . '" value="'.htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
218
administrator/components/com_menus/models/forms/item.xml
Normal file
218
administrator/components/com_menus/models/forms/item.xml
Normal file
@ -0,0 +1,218 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field
|
||||
name="id"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="JGLOBAL_FIELD_ID_LABEL"
|
||||
description ="JGLOBAL_FIELD_ID_DESC"
|
||||
default="0"
|
||||
filter="int"
|
||||
readonly="true"/>
|
||||
|
||||
<field
|
||||
name="title"
|
||||
type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_TITLE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_TITLE_DESC"
|
||||
class="inputbox"
|
||||
size="40"
|
||||
required="true"/>
|
||||
|
||||
<field
|
||||
name="alias"
|
||||
type="alias"
|
||||
label="JFIELD_ALIAS_LABEL"
|
||||
description="JFIELD_ALIAS_DESC"
|
||||
class="inputbox"
|
||||
size="40"/>
|
||||
|
||||
<field name="aliastip"
|
||||
type="spacer"
|
||||
label="COM_MENUS_TIP_ALIAS_LABEL"/>
|
||||
|
||||
<field
|
||||
name="note"
|
||||
type="text"
|
||||
label="JFIELD_NOTE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_NOTE_DESC"
|
||||
class="inputbox"
|
||||
size="40"/>
|
||||
|
||||
<field
|
||||
name="link"
|
||||
type="link"
|
||||
label="COM_MENUS_ITEM_FIELD_LINK_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_LINK_DESC"
|
||||
readonly="true"
|
||||
class="inputbox"
|
||||
size="50"/>
|
||||
|
||||
<field
|
||||
name="menutype"
|
||||
type="menu"
|
||||
label="COM_MENUS_ITEM_FIELD_ASSIGNED_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_ASSIGNED_DESC"
|
||||
class="inputbox"
|
||||
required="true"
|
||||
size="1" />
|
||||
|
||||
<field
|
||||
name="type"
|
||||
type="menutype"
|
||||
label="COM_MENUS_ITEM_FIELD_TYPE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_TYPE_DESC"
|
||||
class="inputbox input-medium"
|
||||
required="true"
|
||||
size="40" />
|
||||
|
||||
<field
|
||||
name="published"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
id="published"
|
||||
label="JSTATUS"
|
||||
description="JFIELD_PUBLISHED_DESC"
|
||||
size="1"
|
||||
default="1"
|
||||
filter="integer">
|
||||
<option
|
||||
value="1">
|
||||
JPUBLISHED</option>
|
||||
<option
|
||||
value="0">
|
||||
JUNPUBLISHED</option>
|
||||
|
||||
<option
|
||||
value="-2">
|
||||
JTRASHED</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="parent_id"
|
||||
type="menuparent"
|
||||
label="COM_MENUS_ITEM_FIELD_PARENT_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_PARENT_DESC"
|
||||
default="1"
|
||||
filter="int"
|
||||
class="inputbox"
|
||||
size="1">
|
||||
<option
|
||||
value="1">COM_MENUS_ITEM_ROOT</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="menuordering"
|
||||
type="menuordering"
|
||||
label="COM_MENUS_ITEM_FIELD_ORDERING_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_ORDERING_DESC"
|
||||
filter="int"
|
||||
class="inputbox"
|
||||
size="1">
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="component_id"
|
||||
type="hidden"
|
||||
filter="int" />
|
||||
|
||||
<field
|
||||
name="ordering"
|
||||
type="ordering"
|
||||
label="JFIELD_ORDERING_LABEL"
|
||||
description="JFIELD_ORDERING_DESC"
|
||||
filter="int"
|
||||
class="inputbox"/>
|
||||
|
||||
<field
|
||||
name="browserNav"
|
||||
type="list"
|
||||
label="COM_MENUS_ITEM_FIELD_BROWSERNAV_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_BROWSERNAV_DESC"
|
||||
default="Parent"
|
||||
filter="int"
|
||||
class="inputbox">
|
||||
<option value="0">COM_MENUS_FIELD_VALUE_PARENT</option>
|
||||
<option value="1">COM_MENUS_FIELD_VALUE_NEW_WITH_NAV</option>
|
||||
<option value="2">COM_MENUS_FIELD_VALUE_NEW_WITHOUT_NAV</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
id="access"
|
||||
class="inputbox"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
filter="integer"/>
|
||||
|
||||
|
||||
<field
|
||||
name="template_style_id"
|
||||
type="templatestyle"
|
||||
label="COM_MENUS_ITEM_FIELD_TEMPLATE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_TEMPLATE_DESC"
|
||||
filter="int"
|
||||
class="inputbox">
|
||||
<option value="0">JOPTION_USE_DEFAULT</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="home"
|
||||
type="radio"
|
||||
label="COM_MENUS_ITEM_FIELD_HOME_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_HOME_DESC"
|
||||
default="0"
|
||||
class="btn-group"
|
||||
filter="integer">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="language"
|
||||
type="contentlanguage"
|
||||
label="JFIELD_LANGUAGE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_LANGUAGE_DESC"
|
||||
class="inputbox">
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="path"
|
||||
type="hidden"
|
||||
filter="unset"/>
|
||||
|
||||
<field
|
||||
name="level"
|
||||
type="hidden"
|
||||
filter="unset"/>
|
||||
|
||||
<field
|
||||
name="checked_out"
|
||||
type="hidden"
|
||||
filter="unset"/>
|
||||
|
||||
<field
|
||||
name="checked_out_time"
|
||||
type="hidden"
|
||||
filter="unset"/>
|
||||
|
||||
<field
|
||||
name="lft"
|
||||
type="hidden"
|
||||
filter="unset"/>
|
||||
|
||||
<field
|
||||
name="rgt"
|
||||
type="hidden"
|
||||
filter="unset"/>
|
||||
</fieldset>
|
||||
|
||||
<fields name="params">
|
||||
</fields>
|
||||
</form>
|
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<!-- Add fields to the request variables for the layout. -->
|
||||
|
||||
<fields name="params">
|
||||
|
||||
<fieldset name="aliasoptions">
|
||||
<field name="aliasoptions" type="menuitem"
|
||||
description="COM_MENUS_ITEM_FIELD_ALIAS_MENU_DESC"
|
||||
label="COM_MENUS_ITEM_FIELD_ALIAS_MENU_LABEL"
|
||||
required="true" />
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="menu-options"
|
||||
label="COM_MENUS_LINKTYPE_OPTIONS_LABEL"
|
||||
>
|
||||
|
||||
<field name="menu-anchor_title" type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_ANCHOR_TITLE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_ANCHOR_TITLE_DESC" />
|
||||
|
||||
<field name="menu-anchor_css" type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_ANCHOR_CSS_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_ANCHOR_CSS_DESC" />
|
||||
|
||||
<field name="menu_image" type="media"
|
||||
label="COM_MENUS_ITEM_FIELD_MENU_IMAGE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_MENU_IMAGE_DESC" />
|
||||
|
||||
<field name="menu_text" type="radio" class="btn-group"
|
||||
label="COM_MENUS_ITEM_FIELD_MENU_TEXT_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_MENU_TEXT_DESC"
|
||||
default="1" filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
<help key="JHELP_MENUS_MENU_ITEM_MENU_ITEM_ALIAS" />
|
||||
</form>
|
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="params" label="COM_MENUS_LINKTYPE_OPTIONS_LABEL"
|
||||
>
|
||||
<fieldset name="menu-options"
|
||||
label="COM_MENUS_LINKTYPE_OPTIONS_LABEL"
|
||||
>
|
||||
|
||||
<field name="menu-anchor_title" type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_ANCHOR_TITLE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_ANCHOR_TITLE_DESC" />
|
||||
|
||||
<field name="menu-anchor_css" type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_ANCHOR_CSS_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_ANCHOR_CSS_DESC" />
|
||||
|
||||
<field name="menu_image" type="media"
|
||||
label="COM_MENUS_ITEM_FIELD_MENU_IMAGE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_MENU_IMAGE_DESC" />
|
||||
|
||||
<field name="menu_text" type="radio"
|
||||
class="btn-group"
|
||||
label="COM_MENUS_ITEM_FIELD_MENU_TEXT_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_MENU_TEXT_DESC"
|
||||
default="1" filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="page-options"
|
||||
label="COM_MENUS_PAGE_OPTIONS_LABEL"
|
||||
>
|
||||
|
||||
|
||||
<field name="page_title" type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_PAGE_TITLE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_PAGE_TITLE_DESC" />
|
||||
|
||||
<field name="show_page_heading" type="radio"
|
||||
class="btn-group"
|
||||
label="COM_MENUS_ITEM_FIELD_SHOW_PAGE_HEADING_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_SHOW_PAGE_HEADING_DESC"
|
||||
default="0" filter="integer"
|
||||
>
|
||||
<option value="0" class="no">JNO</option>
|
||||
<option value="1" class="yes">JYES</option>
|
||||
</field>
|
||||
|
||||
<field name="page_heading" type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_PAGE_HEADING_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_PAGE_HEADING_DESC" />
|
||||
|
||||
<field name="pageclass_sfx" type="text"
|
||||
label="COM_MENUS_ITEM_FIELD_PAGE_CLASS_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_PAGE_CLASS_DESC" />
|
||||
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"
|
||||
>
|
||||
<field name="menu-meta_description" type="textarea"
|
||||
label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC"
|
||||
rows="3" cols="40" />
|
||||
|
||||
<field name="menu-meta_keywords" type="textarea"
|
||||
label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC"
|
||||
rows="3" cols="40" />
|
||||
|
||||
<field name="robots"
|
||||
type="list"
|
||||
label="JFIELD_METADATA_ROBOTS_LABEL"
|
||||
description="JFIELD_METADATA_ROBOTS_DESC"
|
||||
>
|
||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>
|
||||
<option value="noindex, follow">JGLOBAL_NOINDEX_FOLLOW</option>
|
||||
<option value="index, nofollow">JGLOBAL_INDEX_NOFOLLOW</option>
|
||||
<option value="noindex, nofollow">JGLOBAL_NOINDEX_NOFOLLOW</option>
|
||||
</field>
|
||||
|
||||
<field name="secure" type="list"
|
||||
class="btn-group"
|
||||
label="COM_MENUS_ITEM_FIELD_SECURE_LABEL" description="COM_MENUS_ITEM_FIELD_SECURE_DESC"
|
||||
default="0" filter="integer"
|
||||
>
|
||||
<option value="-1">JOFF</option>
|
||||
<option value="1">JON</option>
|
||||
<option value="0">COM_MENUS_FIELD_VALUE_IGNORE
|
||||
</option>
|
||||
|
||||
</field>
|
||||
</fieldset>
|
||||
|
||||
</fields>
|
||||
|
||||
</form>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="params">
|
||||
<fieldset name="menu-options"
|
||||
label="COM_MENUS_LINKTYPE_OPTIONS_LABEL"
|
||||
>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<help key="JHELP_MENUS_MENU_ITEM_MENU_ITEM_HEADING" />
|
||||
</form>
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="params">
|
||||
<fieldset name="menu-options"
|
||||
label="COM_MENUS_LINKTYPE_OPTIONS_LABEL"
|
||||
>
|
||||
|
||||
<field name="menu_image" type="media"
|
||||
label="COM_MENUS_ITEM_FIELD_MENU_IMAGE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_MENU_IMAGE_DESC" />
|
||||
|
||||
<field name="menu_text" type="radio" class="btn-group"
|
||||
label="COM_MENUS_ITEM_FIELD_MENU_TEXT_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_MENU_TEXT_DESC"
|
||||
default="1" filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
<help key="JHELP_MENUS_MENU_ITEM_TEXT_SEPARATOR" />
|
||||
</form>
|
31
administrator/components/com_menus/models/forms/item_url.xml
Normal file
31
administrator/components/com_menus/models/forms/item_url.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="params">
|
||||
<fieldset name="menu-options" label="COM_MENUS_LINKTYPE_OPTIONS_LABEL"
|
||||
>
|
||||
|
||||
<field name="menu-anchor_title"
|
||||
type="text" label="COM_MENUS_ITEM_FIELD_ANCHOR_TITLE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_ANCHOR_TITLE_DESC" />
|
||||
|
||||
<field name="menu-anchor_css"
|
||||
type="text" label="COM_MENUS_ITEM_FIELD_ANCHOR_CSS_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_ANCHOR_CSS_DESC" />
|
||||
|
||||
<field name="menu_image" type="media"
|
||||
label="COM_MENUS_ITEM_FIELD_MENU_IMAGE_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_MENU_IMAGE_DESC" />
|
||||
|
||||
<field name="menu_text" type="radio" class="btn-group"
|
||||
label="COM_MENUS_ITEM_FIELD_MENU_TEXT_LABEL"
|
||||
description="COM_MENUS_ITEM_FIELD_MENU_TEXT_DESC"
|
||||
default="1" filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
<help key="JHELP_MENUS_MENU_ITEM_EXTERNAL_URL" />
|
||||
</form>
|
45
administrator/components/com_menus/models/forms/menu.xml
Normal file
45
administrator/components/com_menus/models/forms/menu.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset>
|
||||
<field
|
||||
id="id"
|
||||
name="id"
|
||||
type="hidden"
|
||||
default="0"
|
||||
filter="int"
|
||||
readonly="true"/>
|
||||
|
||||
<field
|
||||
id="menutype"
|
||||
name="menutype"
|
||||
type="text"
|
||||
label="COM_MENUS_MENU_MENUTYPE_LABEL"
|
||||
description="COM_MENUS_MENU_MENUTYPE_DESC"
|
||||
class="inputbox"
|
||||
size="30"
|
||||
maxlength="24"
|
||||
required="true" />
|
||||
|
||||
<field
|
||||
id="title"
|
||||
name="title"
|
||||
type="text"
|
||||
label="JGLOBAL_TITLE"
|
||||
description="COM_MENUS_MENU_TITLE_DESC"
|
||||
class="inputbox"
|
||||
size="30"
|
||||
maxlength="48"
|
||||
required="true" />
|
||||
|
||||
<field
|
||||
id="menudescription"
|
||||
name="description"
|
||||
type="text"
|
||||
label="JGLOBAL_DESCRIPTION"
|
||||
description="COM_MENUS_MENU_DESCRIPTION_DESC"
|
||||
class="inputbox"
|
||||
size="30"
|
||||
maxlength="255" />
|
||||
|
||||
</fieldset>
|
||||
</form>
|
1
administrator/components/com_menus/models/index.html
Normal file
1
administrator/components/com_menus/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1515
administrator/components/com_menus/models/item.php
Normal file
1515
administrator/components/com_menus/models/item.php
Normal file
File diff suppressed because it is too large
Load Diff
313
administrator/components/com_menus/models/items.php
Normal file
313
administrator/components/com_menus/models/items.php
Normal file
@ -0,0 +1,313 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Menu Item List Model for Menus.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusModelItems extends JModelList
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array An optional associative array of configuration settings.
|
||||
* @see JController
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'id', 'a.id',
|
||||
'menutype', 'a.menutype',
|
||||
'title', 'a.title',
|
||||
'alias', 'a.alias',
|
||||
'published', 'a.published',
|
||||
'access', 'a.access', 'access_level',
|
||||
'language', 'a.language',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'lft', 'a.lft',
|
||||
'rgt', 'a.rgt',
|
||||
'level', 'a.level',
|
||||
'path', 'a.path',
|
||||
'client_id', 'a.client_id',
|
||||
'home', 'a.home',
|
||||
);
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
if ($assoc)
|
||||
{
|
||||
$config['filter_fields'][] = 'association';
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication('administrator');
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
$this->setState('filter.access', $access);
|
||||
|
||||
$parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id', 0, 'int');
|
||||
$this->setState('filter.parent_id', $parentId);
|
||||
|
||||
$level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int');
|
||||
$this->setState('filter.level', $level);
|
||||
|
||||
$menuType = $app->input->getString('menutype', null);
|
||||
if ($menuType)
|
||||
{
|
||||
if ($menuType != $app->getUserState($this->context . '.filter.menutype'))
|
||||
{
|
||||
$app->setUserState($this->context . '.filter.menutype', $menuType);
|
||||
$app->input->set('limitstart', 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$menuType = $app->getUserState($this->context . '.filter.menutype');
|
||||
|
||||
if (!$menuType)
|
||||
{
|
||||
$menuType = $this->getDefaultMenuType();
|
||||
}
|
||||
}
|
||||
|
||||
$this->setState('filter.menutype', $menuType);
|
||||
|
||||
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
|
||||
$this->setState('filter.language', $language);
|
||||
|
||||
// Component parameters.
|
||||
$params = JComponentHelper::getParams('com_menus');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('a.lft', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* This is necessary because the model is used by the component and
|
||||
* different modules that might need different sets of data or different
|
||||
* ordering requirements.
|
||||
*
|
||||
* @param string $id A prefix for the store id.
|
||||
*
|
||||
* @return string A store id.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.access');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
$id .= ':' . $this->getState('filter.language');
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.parent_id');
|
||||
$id .= ':' . $this->getState('filter.menutype');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the default menu type.
|
||||
*
|
||||
* In the absence of better information, this is the first menu ordered by title.
|
||||
*
|
||||
* @return string The default menu type
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getDefaultMenuType()
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('menutype')
|
||||
->from('#__menu_types')
|
||||
->order('title');
|
||||
$db->setQuery($query, 0, 1);
|
||||
$menuType = $db->loadResult();
|
||||
|
||||
return $menuType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an SQL query to load the list data.
|
||||
*
|
||||
* @return JDatabaseQuery A query object.
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$user = JFactory::getUser();
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Select all fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
$db->quoteName(
|
||||
array('a.id', 'a.menutype', 'a.title', 'a.alias', 'a.note', 'a.path', 'a.link', 'a.type', 'a.parent_id', 'a.level', 'a.published', 'a.component_id', 'a.checked_out', 'a.checked_out_time', 'a.browserNav', 'a.access', 'a.img', 'a.template_style_id', 'a.params', 'a.lft', 'a.rgt', 'a.home', 'a.language', 'a.client_id'),
|
||||
array(null, null, null, null, null, null, null, null, null, null, 'apublished', null, null, null, null, null, null, null, null, null, null, null, null, null)
|
||||
)
|
||||
)
|
||||
);
|
||||
$query->select(
|
||||
'CASE a.type' .
|
||||
' WHEN ' . $db->quote('component') . ' THEN a.published+2*(e.enabled-1) ' .
|
||||
' WHEN ' . $db->quote('url') . ' THEN a.published+2 ' .
|
||||
' WHEN ' . $db->quote('alias') . ' THEN a.published+4 ' .
|
||||
' WHEN ' . $db->quote('separator') . ' THEN a.published+6 ' .
|
||||
' WHEN ' . $db->quote('heading') . ' THEN a.published+8 ' .
|
||||
' END AS published'
|
||||
);
|
||||
$query->from($db->quoteName('#__menu') . ' AS a');
|
||||
|
||||
// Join over the language
|
||||
$query->select('l.title AS language_title, l.image as image')
|
||||
->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
|
||||
|
||||
// Join over the users.
|
||||
$query->select('u.name AS editor')
|
||||
->join('LEFT', $db->quoteName('#__users') . ' AS u ON u.id = a.checked_out');
|
||||
|
||||
//Join over components
|
||||
$query->select('c.element AS componentname')
|
||||
->join('LEFT', $db->quoteName('#__extensions') . ' AS c ON c.extension_id = a.component_id');
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level')
|
||||
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
|
||||
// Join over the associations.
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
if ($assoc)
|
||||
{
|
||||
$query->select('COUNT(asso2.id)>1 as association')
|
||||
->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_menus.item'))
|
||||
->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key')
|
||||
->group('a.id');
|
||||
}
|
||||
|
||||
// Join over the extensions
|
||||
$query->select('e.name AS name')
|
||||
->join('LEFT', '#__extensions AS e ON e.extension_id = a.component_id');
|
||||
|
||||
// Exclude the root category.
|
||||
$query->where('a.id > 1')
|
||||
->where('a.client_id = 0');
|
||||
|
||||
// Filter on the published state.
|
||||
$published = $this->getState('filter.published');
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.published = ' . (int) $published);
|
||||
}
|
||||
elseif ($published === '')
|
||||
{
|
||||
$query->where('(a.published IN (0, 1))');
|
||||
}
|
||||
|
||||
// Filter by search in title, alias or id
|
||||
if ($search = trim($this->getState('filter.search')))
|
||||
{
|
||||
if (stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('a.id = ' . (int) substr($search, 3));
|
||||
}
|
||||
elseif (stripos($search, 'link:') === 0)
|
||||
{
|
||||
if ($search = substr($search, 5))
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||
$query->where('a.link LIKE ' . $search);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||
$query->where('(' . 'a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ' OR a.note LIKE ' . $search . ')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the items over the parent id if set.
|
||||
$parentId = $this->getState('filter.parent_id');
|
||||
if (!empty($parentId))
|
||||
{
|
||||
$query->where('p.id = ' . (int) $parentId);
|
||||
}
|
||||
|
||||
// Filter the items over the menu id if set.
|
||||
$menuType = $this->getState('filter.menutype');
|
||||
if (!empty($menuType))
|
||||
{
|
||||
$query->where('a.menutype = ' . $db->quote($menuType));
|
||||
}
|
||||
|
||||
// Filter on the access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.admin'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Filter on the level.
|
||||
if ($level = $this->getState('filter.level'))
|
||||
{
|
||||
$query->where('a.level <= ' . (int) $level);
|
||||
}
|
||||
|
||||
// Filter on the language.
|
||||
if ($language = $this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language = ' . $db->quote($language));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$query->order($db->escape($this->getState('list.ordering', 'a.lft')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
|
||||
|
||||
//echo nl2br(str_replace('#__','jos_',(string)$query)).'<hr/>';
|
||||
return $query;
|
||||
}
|
||||
}
|
296
administrator/components/com_menus/models/menu.php
Normal file
296
administrator/components/com_menus/models/menu.php
Normal file
@ -0,0 +1,296 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Menu Item Model for Menus.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusModelMenu extends JModelForm
|
||||
{
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_MENUS_MENU';
|
||||
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_menus.menu';
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
|
||||
return $user->authorise('core.delete', 'com_menus.menu.' . (int) $record->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
|
||||
return $user->authorise('core.edit.state', 'com_menus.menu.' . (int) $record->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type The table type to instantiate
|
||||
* @param string A prefix for the table class name. Optional.
|
||||
* @param array Configuration array for model. Optional.
|
||||
* @return JTable A database object
|
||||
*/
|
||||
public function getTable($type = 'MenuType', $prefix = 'JTable', $config = array())
|
||||
{
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = JFactory::getApplication('administrator');
|
||||
|
||||
// Load the User state.
|
||||
$id = $app->input->getInt('id');
|
||||
$this->setState('menu.id', $id);
|
||||
|
||||
// Load the parameters.
|
||||
$params = JComponentHelper::getParams('com_menus');
|
||||
$this->setState('params', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a menu item.
|
||||
*
|
||||
* @param integer The id of the menu item to get.
|
||||
*
|
||||
* @return mixed Menu item data object on success, false on failure.
|
||||
*/
|
||||
public function &getItem($itemId = null)
|
||||
{
|
||||
$itemId = (!empty($itemId)) ? $itemId : (int) $this->getState('menu.id');
|
||||
$false = false;
|
||||
|
||||
// Get a menu item row instance.
|
||||
$table = $this->getTable();
|
||||
|
||||
// Attempt to load the row.
|
||||
$return = $table->load($itemId);
|
||||
|
||||
// Check for a table object error.
|
||||
if ($return === false && $table->getError())
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return $false;
|
||||
}
|
||||
|
||||
$properties = $table->getProperties(1);
|
||||
$value = JArrayHelper::toObject($properties, 'JObject');
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the menu item form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @return JForm A JForm object on success, false on failure
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_menus.menu', 'menu', array('control' => 'jform', 'load_data' => $loadData));
|
||||
if (empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = JFactory::getApplication()->getUserState('com_menus.edit.menu.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
$this->preprocessData('com_menus.menu', $data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array The form data.
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$id = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('menu.id');
|
||||
|
||||
// Get a row instance.
|
||||
$table = $this->getTable();
|
||||
|
||||
// Load the row if saving an existing item.
|
||||
if ($id > 0)
|
||||
{
|
||||
$table->load($id);
|
||||
}
|
||||
|
||||
// Bind the data.
|
||||
if (!$table->bind($data))
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the data.
|
||||
if (!$table->check())
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store the data.
|
||||
if (!$table->store())
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->setState('menu.id', $table->id);
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete groups.
|
||||
*
|
||||
* @param array An array of item ids.
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
*/
|
||||
public function delete($itemIds)
|
||||
{
|
||||
// Sanitize the ids.
|
||||
$itemIds = (array) $itemIds;
|
||||
JArrayHelper::toInteger($itemIds);
|
||||
|
||||
// Get a group row instance.
|
||||
$table = $this->getTable();
|
||||
|
||||
// Iterate the items to delete each one.
|
||||
foreach ($itemIds as $itemId)
|
||||
{
|
||||
// TODO: Delete the menu associations - Menu items and Modules
|
||||
|
||||
if (!$table->delete($itemId))
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of all mod_mainmenu modules and collates them by menutype
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function &getModules()
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->from('#__modules as a')
|
||||
->select('a.id, a.title, a.params, a.position')
|
||||
->where('module = ' . $db->quote('mod_menu'))
|
||||
->select('ag.title AS access_title')
|
||||
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
$db->setQuery($query);
|
||||
|
||||
$modules = $db->loadObjectList();
|
||||
|
||||
$result = array();
|
||||
|
||||
foreach ($modules as &$module)
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadString($module->params);
|
||||
|
||||
$menuType = $params->get('menutype');
|
||||
if (!isset($result[$menuType]))
|
||||
{
|
||||
$result[$menuType] = array();
|
||||
}
|
||||
$result[$menuType][] = & $module;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom clean cache method
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function cleanCache($group = null, $client_id = 0)
|
||||
{
|
||||
parent::cleanCache('com_modules');
|
||||
parent::cleanCache('mod_menu');
|
||||
}
|
||||
}
|
235
administrator/components/com_menus/models/menus.php
Normal file
235
administrator/components/com_menus/models/menus.php
Normal file
@ -0,0 +1,235 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Menu List Model for Menus.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusModelMenus extends JModelList
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array An optional associative array of configuration settings.
|
||||
*
|
||||
* @see JController
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'id', 'a.id',
|
||||
'title', 'a.title',
|
||||
'menutype', 'a.menutype',
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the getItems method to attach additional metrics to the list.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*
|
||||
* @since 1.6.1
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// Get a storage key.
|
||||
$store = $this->getStoreId('getItems');
|
||||
|
||||
// Try to load the data from internal storage.
|
||||
if (!empty($this->cache[$store]))
|
||||
{
|
||||
return $this->cache[$store];
|
||||
}
|
||||
|
||||
// Load the list items.
|
||||
$items = parent::getItems();
|
||||
|
||||
// If emtpy or an error, just return.
|
||||
if (empty($items))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
// Getting the following metric by joins is WAY TOO SLOW.
|
||||
// Faster to do three queries for very large menu trees.
|
||||
|
||||
// Get the menu types of menus in the list.
|
||||
$db = $this->getDbo();
|
||||
$menuTypes = JArrayHelper::getColumn($items, 'menutype');
|
||||
|
||||
// Quote the strings.
|
||||
$menuTypes = implode(
|
||||
',',
|
||||
array_map(array($db, 'quote'), $menuTypes)
|
||||
);
|
||||
|
||||
// Get the published menu counts.
|
||||
$query = $db->getQuery(true)
|
||||
->select('m.menutype, COUNT(DISTINCT m.id) AS count_published')
|
||||
->from('#__menu AS m')
|
||||
->where('m.published = 1')
|
||||
->where('m.menutype IN (' . $menuTypes . ')')
|
||||
->group('m.menutype');
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$countPublished = $db->loadAssocList('menutype', 'count_published');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the unpublished menu counts.
|
||||
$query->clear('where')
|
||||
->where('m.published = 0')
|
||||
->where('m.menutype IN (' . $menuTypes . ')');
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$countUnpublished = $db->loadAssocList('menutype', 'count_published');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the trashed menu counts.
|
||||
$query->clear('where')
|
||||
->where('m.published = -2')
|
||||
->where('m.menutype IN (' . $menuTypes . ')');
|
||||
$db->setQuery($query);
|
||||
|
||||
try
|
||||
{
|
||||
$countTrashed = $db->loadAssocList('menutype', 'count_published');
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$this->setError($e->getMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Inject the values back into the array.
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$item->count_published = isset($countPublished[$item->menutype]) ? $countPublished[$item->menutype] : 0;
|
||||
$item->count_unpublished = isset($countUnpublished[$item->menutype]) ? $countUnpublished[$item->menutype] : 0;
|
||||
$item->count_trashed = isset($countTrashed[$item->menutype]) ? $countTrashed[$item->menutype] : 0;
|
||||
}
|
||||
|
||||
// Add the items to the internal cache.
|
||||
$this->cache[$store] = $items;
|
||||
|
||||
return $this->cache[$store];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select all fields from the table.
|
||||
$query->select($this->getState('list.select', 'a.*'))
|
||||
->from($db->quoteName('#__menu_types') . ' AS a')
|
||||
|
||||
->group('a.id, a.menutype, a.title, a.description');
|
||||
|
||||
// Filter by search in title or menutype
|
||||
if ($search = trim($this->getState('filter.search')))
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||
$query->where('(' . 'a.title LIKE ' . $search . ' OR a.menutype LIKE ' . $search . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$query->order($db->escape($this->getState('list.ordering', 'a.id')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$search = $this->getUserStateFromRequest($this->context . '.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('a.id', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the extension id of the core mod_menu module.
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function getModMenuId()
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('e.extension_id')
|
||||
->from('#__extensions AS e')
|
||||
->where('e.type = ' . $db->quote('module'))
|
||||
->where('e.element = ' . $db->quote('mod_menu'))
|
||||
->where('e.client_id = 0');
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->loadResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of all mod_mainmenu modules and collates them by menutype
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function &getModules()
|
||||
{
|
||||
$model = JModelLegacy::getInstance('Menu', 'MenusModel', array('ignore_request' => true));
|
||||
$result = & $model->getModules();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
431
administrator/components/com_menus/models/menutypes.php
Normal file
431
administrator/components/com_menus/models/menutypes.php
Normal file
@ -0,0 +1,431 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
/**
|
||||
* Menu Item Types Model for Menus.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusModelMenutypes extends JModelLegacy
|
||||
{
|
||||
/**
|
||||
* A reverse lookup of the base link URL to Title
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rlu = array();
|
||||
|
||||
/**
|
||||
* Method to get the reverse lookup of the base link URL to Title
|
||||
*
|
||||
* @return array Array of reverse lookup of the base link URL to Title
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getReverseLookup()
|
||||
{
|
||||
if (empty($this->rlu))
|
||||
{
|
||||
$this->getTypeOptions();
|
||||
}
|
||||
return $this->rlu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the available menu item type options.
|
||||
*
|
||||
* @return array Array of groups with menu item types.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTypeOptions()
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$lang = JFactory::getLanguage();
|
||||
$list = array();
|
||||
|
||||
// Get the list of components.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('name, element AS ' . $db->quoteName('option'))
|
||||
->from('#__extensions')
|
||||
->where('type = ' . $db->quote('component'))
|
||||
->where('enabled = 1')
|
||||
->order('name ASC');
|
||||
$db->setQuery($query);
|
||||
$components = $db->loadObjectList();
|
||||
|
||||
foreach ($components as $component)
|
||||
{
|
||||
if ($options = $this->getTypeOptionsByComponent($component->option))
|
||||
{
|
||||
$list[$component->name] = $options;
|
||||
|
||||
// Create the reverse lookup for link-to-name.
|
||||
foreach ($options as $option)
|
||||
{
|
||||
if (isset($option->request))
|
||||
{
|
||||
$this->addReverseLookupUrl($option);
|
||||
|
||||
if (isset($option->request['option']))
|
||||
{
|
||||
$lang->load($option->request['option'].'.sys', JPATH_ADMINISTRATOR, null, false, false)
|
||||
|| $lang->load($option->request['option'].'.sys', JPATH_ADMINISTRATOR.'/components/'.$option->request['option'], null, false, false)
|
||||
|| $lang->load($option->request['option'].'.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
|
||||
|| $lang->load($option->request['option'].'.sys', JPATH_ADMINISTRATOR.'/components/'.$option->request['option'], $lang->getDefault(), false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Allow a system plugin to insert dynamic menu types to the list shown in menus:
|
||||
JDispatcher::getInstance()->trigger('onAfterGetMenuTypeOptions', array(&$list, $this));
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create the reverse lookup for link-to-name.
|
||||
* (can be used from onAfterGetMenuTypeOptions handlers)
|
||||
*
|
||||
* @param $option JObject with request array or string and title public variables
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1
|
||||
*/
|
||||
public function addReverseLookupUrl($option)
|
||||
{
|
||||
$this->rlu[MenusHelper::getLinkKey($option->request)] = $option->get('title');
|
||||
}
|
||||
|
||||
protected function getTypeOptionsByComponent($component)
|
||||
{
|
||||
$options = array();
|
||||
|
||||
$mainXML = JPATH_SITE.'/components/'.$component.'/metadata.xml';
|
||||
|
||||
if (is_file($mainXML))
|
||||
{
|
||||
$options = $this->getTypeOptionsFromXML($mainXML, $component);
|
||||
}
|
||||
|
||||
if (empty($options))
|
||||
{
|
||||
$options = $this->getTypeOptionsFromMVC($component);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function getTypeOptionsFromXML($file, $component)
|
||||
{
|
||||
$options = array();
|
||||
|
||||
// Attempt to load the xml file.
|
||||
if (!$xml = simplexml_load_file($file))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Look for the first menu node off of the root node.
|
||||
if (!$menu = $xml->xpath('menu[1]'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$menu = $menu[0];
|
||||
}
|
||||
|
||||
// If we have no options to parse, just add the base component to the list of options.
|
||||
if (!empty($menu['options']) && $menu['options'] == 'none')
|
||||
{
|
||||
// Create the menu option for the component.
|
||||
$o = new JObject;
|
||||
$o->title = (string) $menu['name'];
|
||||
$o->description = (string) $menu['msg'];
|
||||
$o->request = array('option' => $component);
|
||||
|
||||
$options[] = $o;
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
// Look for the first options node off of the menu node.
|
||||
if (!$optionsNode = $menu->xpath('options[1]'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$optionsNode = $optionsNode[0];
|
||||
}
|
||||
|
||||
// Make sure the options node has children.
|
||||
if (!$children = $optionsNode->children())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Process each child as an option.
|
||||
foreach ($children as $child)
|
||||
{
|
||||
if ($child->getName() == 'option')
|
||||
{
|
||||
// Create the menu option for the component.
|
||||
$o = new JObject;
|
||||
$o->title = (string) $child['name'];
|
||||
$o->description = (string) $child['msg'];
|
||||
$o->request = array('option' => $component, (string) $optionsNode['var'] => (string) $child['value']);
|
||||
|
||||
$options[] = $o;
|
||||
}
|
||||
elseif ($child->getName() == 'default')
|
||||
{
|
||||
// Create the menu option for the component.
|
||||
$o = new JObject;
|
||||
$o->title = (string) $child['name'];
|
||||
$o->description = (string) $child['msg'];
|
||||
$o->request = array('option' => $component);
|
||||
|
||||
$options[] = $o;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function getTypeOptionsFromMVC($component)
|
||||
{
|
||||
$options = array();
|
||||
|
||||
// Get the views for this component.
|
||||
$path = JPATH_SITE . '/components/' . $component . '/views';
|
||||
|
||||
if (is_dir($path))
|
||||
{
|
||||
$views = JFolder::folders($path);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($views as $view)
|
||||
{
|
||||
// Ignore private views.
|
||||
if (strpos($view, '_') !== 0)
|
||||
{
|
||||
// Determine if a metadata file exists for the view.
|
||||
$file = $path.'/'.$view.'/metadata.xml';
|
||||
|
||||
if (is_file($file))
|
||||
{
|
||||
// Attempt to load the xml file.
|
||||
if ($xml = simplexml_load_file($file))
|
||||
{
|
||||
// Look for the first view node off of the root node.
|
||||
if ($menu = $xml->xpath('view[1]'))
|
||||
{
|
||||
$menu = $menu[0];
|
||||
|
||||
// If the view is hidden from the menu, discard it and move on to the next view.
|
||||
if (!empty($menu['hidden']) && $menu['hidden'] == 'true')
|
||||
{
|
||||
unset($xml);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Do we have an options node or should we process layouts?
|
||||
// Look for the first options node off of the menu node.
|
||||
if ($optionsNode = $menu->xpath('options[1]'))
|
||||
{
|
||||
$optionsNode = $optionsNode[0];
|
||||
|
||||
// Make sure the options node has children.
|
||||
if ($children = $optionsNode->children())
|
||||
{
|
||||
// Process each child as an option.
|
||||
foreach ($children as $child)
|
||||
{
|
||||
if ($child->getName() == 'option')
|
||||
{
|
||||
// Create the menu option for the component.
|
||||
$o = new JObject;
|
||||
$o->title = (string) $child['name'];
|
||||
$o->description = (string) $child['msg'];
|
||||
$o->request = array('option' => $component, 'view' => $view, (string) $optionsNode['var'] => (string) $child['value']);
|
||||
|
||||
$options[] = $o;
|
||||
}
|
||||
elseif ($child->getName() == 'default')
|
||||
{
|
||||
// Create the menu option for the component.
|
||||
$o = new JObject;
|
||||
$o->title = (string) $child['name'];
|
||||
$o->description = (string) $child['msg'];
|
||||
$o->request = array('option' => $component, 'view' => $view);
|
||||
|
||||
$options[] = $o;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$options = array_merge($options, (array) $this->getTypeOptionsFromLayouts($component, $view));
|
||||
}
|
||||
}
|
||||
unset($xml);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$options = array_merge($options, (array) $this->getTypeOptionsFromLayouts($component, $view));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function getTypeOptionsFromLayouts($component, $view)
|
||||
{
|
||||
$options = array();
|
||||
$layouts = array();
|
||||
$layoutNames = array();
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
// Get the layouts from the view folder.
|
||||
$path = JPATH_SITE . '/components/' . $component . '/views/' . $view . '/tmpl';
|
||||
if (is_dir($path))
|
||||
{
|
||||
$layouts = array_merge($layouts, JFolder::files($path, '.xml$', false, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
return $options;
|
||||
}
|
||||
|
||||
// build list of standard layout names
|
||||
foreach ($layouts as $layout)
|
||||
{
|
||||
// Ignore private layouts.
|
||||
if (strpos(basename($layout), '_') === false)
|
||||
{
|
||||
// Get the layout name.
|
||||
$layoutNames[] = basename($layout, '.xml');
|
||||
}
|
||||
}
|
||||
|
||||
// get the template layouts
|
||||
// TODO: This should only search one template -- the current template for this item (default of specified)
|
||||
$folders = JFolder::folders(JPATH_SITE . '/templates', '', false, true);
|
||||
// Array to hold association between template file names and templates
|
||||
$templateName = array();
|
||||
foreach ($folders as $folder)
|
||||
{
|
||||
if (is_dir($folder . '/html/' . $component . '/' . $view))
|
||||
{
|
||||
$template = basename($folder);
|
||||
$lang->load('tpl_'.$template.'.sys', JPATH_SITE, null, false, false)
|
||||
|| $lang->load('tpl_'.$template.'.sys', JPATH_SITE.'/templates/'.$template, null, false, false)
|
||||
|| $lang->load('tpl_'.$template.'.sys', JPATH_SITE, $lang->getDefault(), false, false)
|
||||
|| $lang->load('tpl_'.$template.'.sys', JPATH_SITE.'/templates/'.$template, $lang->getDefault(), false, false);
|
||||
|
||||
$templateLayouts = JFolder::files($folder . '/html/' . $component . '/' . $view, '.xml$', false, true);
|
||||
|
||||
foreach ($templateLayouts as $layout)
|
||||
{
|
||||
// Get the layout name.
|
||||
$templateLayoutName = basename($layout, '.xml');
|
||||
|
||||
// add to the list only if it is not a standard layout
|
||||
if (array_search($templateLayoutName, $layoutNames) === false)
|
||||
{
|
||||
$layouts[] = $layout;
|
||||
// Set template name array so we can get the right template for the layout
|
||||
$templateName[$layout] = basename($folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process the found layouts.
|
||||
foreach ($layouts as $layout)
|
||||
{
|
||||
// Ignore private layouts.
|
||||
if (strpos(basename($layout), '_') === false)
|
||||
{
|
||||
$file = $layout;
|
||||
// Get the layout name.
|
||||
$layout = basename($layout, '.xml');
|
||||
|
||||
// Create the menu option for the layout.
|
||||
$o = new JObject;
|
||||
$o->title = ucfirst($layout);
|
||||
$o->description = '';
|
||||
$o->request = array('option' => $component, 'view' => $view);
|
||||
|
||||
// Only add the layout request argument if not the default layout.
|
||||
if ($layout != 'default')
|
||||
{
|
||||
// If the template is set, add in format template:layout so we save the template name
|
||||
$o->request['layout'] = (isset($templateName[$file])) ? $templateName[$file] . ':' . $layout : $layout;
|
||||
}
|
||||
|
||||
// Load layout metadata if it exists.
|
||||
if (is_file($file))
|
||||
{
|
||||
// Attempt to load the xml file.
|
||||
if ($xml = simplexml_load_file($file))
|
||||
{
|
||||
// Look for the first view node off of the root node.
|
||||
if ($menu = $xml->xpath('layout[1]'))
|
||||
{
|
||||
$menu = $menu[0];
|
||||
|
||||
// If the view is hidden from the menu, discard it and move on to the next view.
|
||||
if (!empty($menu['hidden']) && $menu['hidden'] == 'true')
|
||||
{
|
||||
unset($xml);
|
||||
unset($o);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Populate the title and description if they exist.
|
||||
if (!empty($menu['title']))
|
||||
{
|
||||
$o->title = trim((string) $menu['title']);
|
||||
}
|
||||
|
||||
if (!empty($menu->message[0]))
|
||||
{
|
||||
$o->description = trim((string) $menu->message[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the layout to the options array.
|
||||
$options[] = $o;
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
1
administrator/components/com_menus/tables/index.html
Normal file
1
administrator/components/com_menus/tables/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
35
administrator/components/com_menus/tables/menu.php
Normal file
35
administrator/components/com_menus/tables/menu.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Menu table
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*/
|
||||
class MenusTableMenu extends JTableMenu
|
||||
{
|
||||
/**
|
||||
* Method to delete a node and, optionally, its child nodes from the table.
|
||||
*
|
||||
* @param integer $pk The primary key of the node to delete.
|
||||
* @param boolean $children True to delete child nodes, false to move them up a level.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 2.5
|
||||
* @see http://docs.joomla.org/JTableNested/delete
|
||||
*/
|
||||
public function delete($pk = null, $children = false)
|
||||
{
|
||||
return parent::delete($pk, $children);
|
||||
}
|
||||
}
|
1
administrator/components/com_menus/views/index.html
Normal file
1
administrator/components/com_menus/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
administrator/components/com_menus/views/item/index.html
Normal file
1
administrator/components/com_menus/views/item/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
292
administrator/components/com_menus/views/item/tmpl/edit.php
Normal file
292
administrator/components/com_menus/views/item/tmpl/edit.php
Normal file
@ -0,0 +1,292 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the component HTML helpers.
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
||||
|
||||
JHtml::_('behavior.framework');
|
||||
JHtml::_('behavior.formvalidation');
|
||||
JHtml::_('behavior.modal');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(task, type)
|
||||
{
|
||||
if (task == 'item.setType' || task == 'item.setMenuType')
|
||||
{
|
||||
if (task == 'item.setType')
|
||||
{
|
||||
document.id('item-form').elements['jform[type]'].value = type;
|
||||
document.id('fieldtype').value = 'type';
|
||||
} else {
|
||||
document.id('item-form').elements['jform[menutype]'].value = type;
|
||||
}
|
||||
Joomla.submitform('item.setType', document.id('item-form'));
|
||||
} else if (task == 'item.cancel' || document.formvalidator.isValid(document.id('item-form')))
|
||||
{
|
||||
Joomla.submitform(task, document.id('item-form'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// special case for modal popups validation response
|
||||
$$('#item-form .modal-value.invalid').each(function(field){
|
||||
var idReversed = field.id.split("").reverse().join("");
|
||||
var separatorLocation = idReversed.indexOf('_');
|
||||
var name = idReversed.substr(separatorLocation).split("").reverse().join("")+'name';
|
||||
document.id(name).addClass('invalid');
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_menus&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-validate form-horizontal">
|
||||
|
||||
<fieldset>
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('COM_MENUS_ITEM_DETAILS', true)); ?>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('type'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('type'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->item->type == 'url') : ?>
|
||||
<?php $this->form->setFieldAttribute('link', 'readonly', 'false');?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('link'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('link'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->item->link == 'index.php?Itemid=') : ?>
|
||||
<?php $fieldSets = $this->form->getFieldsets('params'); ?>
|
||||
<?php foreach ($this->form->getFieldset('aliasoptions') as $field) : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $field->label; ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $field->input; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->item->link == 'index.php?option=com_wrapper&view=wrapper') : ?>
|
||||
<?php $fieldSets = $this->form->getFieldsets('params'); ?>
|
||||
<?php foreach ($this->form->getFieldset('request') as $field) : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $field->label; ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $field->input; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$fieldSets = $this->form->getFieldsets('request');
|
||||
|
||||
if (!empty($fieldSets)) :
|
||||
$fieldSet = array_shift($fieldSets);
|
||||
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_MENUS_' . $fieldSet->name . '_FIELDSET_LABEL';
|
||||
if (isset($fieldSet->description) && trim($fieldSet->description)) :
|
||||
echo '<p class="tip">' . $this->escape(JText::_($fieldSet->description)) . '</p>';
|
||||
endif;
|
||||
?>
|
||||
<?php $hidden_fields = ''; ?>
|
||||
<?php foreach ($this->form->getFieldset('request') as $field) : ?>
|
||||
<?php if (!$field->hidden) : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $field->label; ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $field->input; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else : $hidden_fields .= $field->input; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php echo $hidden_fields; ?>
|
||||
<?php endif; ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('title'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('title'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->item->type == 'alias') : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('aliastip'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->item->type != 'url') : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('alias'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('alias'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<hr />
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('published'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('published'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->item->type !== 'url') : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('link'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('link'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('menutype'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('menutype'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('parent_id'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('parent_id'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('menuordering'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('menuordering'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('access'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('access'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->item->type == 'component') : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('home'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('home'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('browserNav'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('browserNav'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('template_style_id'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('template_style_id'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('language'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('language'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('note'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('note'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('id'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('id'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'options', JText::_('COM_MENUS_ADVANCED_FIELDSET_LABEL', true)); ?>
|
||||
<?php echo $this->loadTemplate('options'); ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php if ($assoc) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'associations', JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS', true)); ?>
|
||||
<?php echo $this->loadTemplate('associations'); ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($this->modules)) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'modules', JText::_('COM_MENUS_ITEM_MODULE_ASSIGNMENT', true)); ?>
|
||||
<?php echo $this->loadTemplate('modules'); ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
||||
</fieldset>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo $this->form->getInput('component_id'); ?>
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
<input type="hidden" id="fieldtype" name="fieldtype" value="" />
|
||||
</form>
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
echo JLayoutHelper::render('joomla.edit.associations', $this);
|
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('behavior.framework', true);
|
||||
|
||||
$script = array();
|
||||
$script[] = " window.addEvent('domready', function() {";
|
||||
$script[] = " document.id('showmods').addEvent('click', function(e) {";
|
||||
$script[] = " document.id('showmods').setStyle('display', 'block');";
|
||||
$script[] = " jQuery('.table tr.no').toggle();";
|
||||
$script[] = " });";
|
||||
$script[] = " })";
|
||||
|
||||
// Add the script to the document head.
|
||||
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
|
||||
?>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<label for="showmods"><?php echo JText::_('COM_MENUS_ITEM_FIELD_HIDE_UNASSIGNED');?></label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<input type="checkbox" id="showmods" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="left">
|
||||
<?php echo JText::_('COM_MENUS_HEADING_ASSIGN_MODULE');?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JText::_('COM_MENUS_HEADING_DISPLAY');?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->modules as $i => &$module) : ?>
|
||||
<?php if (is_null($module->menuid)) : ?>
|
||||
<?php if (!$module->except || $module->menuid < 0) : ?>
|
||||
<tr class="no row<?php echo $i % 2;?>">
|
||||
<?php else : ?>
|
||||
<tr class="row<?php echo $i % 2;?>">
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<td>
|
||||
<?php $link = 'index.php?option=com_modules&client_id=0&task=module.edit&id=' . $module->id . '&tmpl=component&view=module&layout=modal'; ?>
|
||||
<a class="modal" href="<?php echo $link;?>" rel="{handler: 'iframe', size: {x: 900, y: 550}}" title="<?php echo JText::_('COM_MENUS_EDIT_MODULE_SETTINGS');?>">
|
||||
<?php echo JText::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?></a>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php if (is_null($module->menuid)) : ?>
|
||||
<?php if ($module->except):?>
|
||||
<span class="label label-success">
|
||||
<?php echo JText::_('JYES'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="label label-important">
|
||||
<?php echo JText::_('JNO'); ?>
|
||||
</span>
|
||||
<?php endif;?>
|
||||
<?php elseif ($module->menuid > 0) : ?>
|
||||
<span class="label label-success">
|
||||
<?php echo JText::_('JYES'); ?>
|
||||
</span>
|
||||
<?php elseif ($module->menuid < 0) : ?>
|
||||
<span class="label label-important">
|
||||
<?php echo JText::_('JNO'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="label label-info">
|
||||
<?php echo JText::_('JALL'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<?php
|
||||
echo JHtml::_('bootstrap.startAccordion', 'menuOptions', array('active' => 'collapse0'));
|
||||
$fieldSets = $this->form->getFieldsets('params');
|
||||
$i = 0;
|
||||
|
||||
foreach ($fieldSets as $name => $fieldSet) :
|
||||
if (!(($this->item->link == 'index.php?option=com_wrapper&view=wrapper') && $fieldSet->name == 'request')
|
||||
&& !($this->item->link == 'index.php?Itemid=' && $fieldSet->name == 'aliasoptions')) :
|
||||
$label = !empty($fieldSet->label) ? $fieldSet->label : 'COM_MENUS_'.$name.'_FIELDSET_LABEL';
|
||||
echo JHtml::_('bootstrap.addSlide', 'menuOptions', JText::_($label), 'collapse' . $i++);
|
||||
if (isset($fieldSet->description) && trim($fieldSet->description)) :
|
||||
echo '<p class="tip">'.$this->escape(JText::_($fieldSet->description)).'</p>';
|
||||
endif;
|
||||
?>
|
||||
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
||||
|
||||
<div class="control-group">
|
||||
|
||||
<div class="control-label">
|
||||
<?php echo $field->label; ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $field->input; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endforeach;
|
||||
echo JHtml::_('bootstrap.endSlide');
|
||||
endif;
|
||||
endforeach;?>
|
||||
<?php
|
||||
|
||||
echo JHtml::_('bootstrap.endAccordion');
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
123
administrator/components/com_menus/views/item/view.html.php
Normal file
123
administrator/components/com_menus/views/item/view.html.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The HTML Menus Menu Item View.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusViewItem extends JViewLegacy
|
||||
{
|
||||
protected $form;
|
||||
|
||||
protected $item;
|
||||
|
||||
protected $modules;
|
||||
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->modules = $this->get('Modules');
|
||||
$this->state = $this->get('State');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
$this->addToolbar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$input->set('hidemainmenu', true);
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$isNew = ($this->item->id == 0);
|
||||
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
|
||||
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
|
||||
|
||||
JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_ITEM_TITLE' : 'COM_MENUS_VIEW_EDIT_ITEM_TITLE'), 'menu-add');
|
||||
|
||||
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
|
||||
if ($isNew && $canDo->get('core.create'))
|
||||
{
|
||||
if ($canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::apply('item.apply');
|
||||
}
|
||||
JToolbarHelper::save('item.save');
|
||||
}
|
||||
|
||||
// If not checked out, can save the item.
|
||||
if (!$isNew && !$checkedOut && $canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::apply('item.apply');
|
||||
JToolbarHelper::save('item.save');
|
||||
}
|
||||
|
||||
// If the user can create new items, allow them to see Save & New
|
||||
if ($canDo->get('core.create'))
|
||||
{
|
||||
JToolbarHelper::save2new('item.save2new');
|
||||
}
|
||||
|
||||
// If an existing item, can save to a copy only if we have create rights.
|
||||
if (!$isNew && $canDo->get('core.create'))
|
||||
{
|
||||
JToolbarHelper::save2copy('item.save2copy');
|
||||
}
|
||||
|
||||
if ($isNew)
|
||||
{
|
||||
JToolbarHelper::cancel('item.cancel');
|
||||
}
|
||||
else
|
||||
{
|
||||
JToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
|
||||
JToolbarHelper::divider();
|
||||
|
||||
// Get the help information for the menu item.
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
$help = $this->get('Help');
|
||||
if ($lang->hasKey($help->url))
|
||||
{
|
||||
$debug = $lang->setDebug(false);
|
||||
$url = JText::_($help->url);
|
||||
$lang->setDebug($debug);
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = $help->url;
|
||||
}
|
||||
JToolbarHelper::help($help->key, $help->local, $url);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
276
administrator/components/com_menus/views/items/tmpl/default.php
Normal file
276
administrator/components/com_menus/views/items/tmpl/default.php
Normal file
@ -0,0 +1,276 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the component HTML helpers.
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$app = JFactory::getApplication();
|
||||
$userId = $user->get('id');
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$ordering = ($listOrder == 'a.lft');
|
||||
$canOrder = $user->authorise('core.edit.state', 'com_menus');
|
||||
$saveOrder = ($listOrder == 'a.lft' && $listDirn == 'asc');
|
||||
if ($saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_menus&task=items.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'itemList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
|
||||
}
|
||||
$sortFields = $this->getSortFields();
|
||||
$assoc = isset($app->item_associations) ? $app->item_associations : 0;
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.orderTable = function()
|
||||
{
|
||||
table = document.getElementById("sortTable");
|
||||
direction = document.getElementById("directionTable");
|
||||
order = table.options[table.selectedIndex].value;
|
||||
if (order != '<?php echo $listOrder; ?>')
|
||||
{
|
||||
dirn = 'asc';
|
||||
}
|
||||
else
|
||||
{
|
||||
dirn = direction.options[direction.selectedIndex].value;
|
||||
}
|
||||
Joomla.tableOrdering(order, dirn, '');
|
||||
}
|
||||
</script>
|
||||
<?php //Set up the filter bar. ?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_menus&view=items');?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if (!empty( $this->sidebar)) : ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif;?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('COM_CONTENT_FILTER_SEARCH_DESC');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_MENUS_ITEMS_SEARCH_FILTER'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left hidden-phone">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
||||
|
||||
<table class="table table-striped" id="itemList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%" class="hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
|
||||
</th>
|
||||
<th width="1%" class="hidden-phone">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th width="1%" class="nowrap center">
|
||||
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="5%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_MENUS_HEADING_HOME', 'a.home', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php if ($assoc) : ?>
|
||||
<th width="5%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_MENUS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<?php endif;?>
|
||||
<th width="5%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'language', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
|
||||
</th>
|
||||
<th width="1%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
<tbody>
|
||||
<?php
|
||||
$originalOrders = array();
|
||||
foreach ($this->items as $i => $item) :
|
||||
$orderkey = array_search($item->id, $this->ordering[$item->parent_id]);
|
||||
$canCreate = $user->authorise('core.create', 'com_menus');
|
||||
$canEdit = $user->authorise('core.edit', 'com_menus');
|
||||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id')|| $item->checked_out == 0;
|
||||
$canChange = $user->authorise('core.edit.state', 'com_menus') && $canCheckin;
|
||||
// Get the parents of item for sorting
|
||||
if ($item->level > 1)
|
||||
{
|
||||
$parentsStr = "";
|
||||
$_currentParentId = $item->parent_id;
|
||||
$parentsStr = " ".$_currentParentId;
|
||||
for ($j = 0; $j < $item->level; $j++)
|
||||
{
|
||||
foreach ($this->ordering as $k => $v)
|
||||
{
|
||||
$v = implode("-", $v);
|
||||
$v = "-" . $v . "-";
|
||||
if (strpos($v, "-" . $_currentParentId . "-") !== false)
|
||||
{
|
||||
$parentsStr .= " " . $k;
|
||||
$_currentParentId = $k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$parentsStr = "";
|
||||
}
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->parent_id;?>" item-id="<?php echo $item->id?>" parents="<?php echo $parentsStr?>" level="<?php echo $item->level?>">
|
||||
<td class="order nowrap center hidden-phone">
|
||||
<?php
|
||||
$iconClass = '';
|
||||
if (!$canChange)
|
||||
{
|
||||
$iconClass = ' inactive';
|
||||
}
|
||||
elseif (!$saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
<span class="sortable-handler<?php echo $iconClass ?>">
|
||||
<i class="icon-menu"></i>
|
||||
</span>
|
||||
<?php if ($canChange && $saveOrder) : ?>
|
||||
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $orderkey + 1;?>" />
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="center hidden-phone">
|
||||
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo JHtml::_('MenusHtml.Menus.state', $item->published, $i, $canChange, 'cb'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo str_repeat('<span class="gi">|—</span>', $item->level - 1) ?>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'items.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEdit) : ?>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_menus&task=item.edit&id='.(int) $item->id);?>">
|
||||
<?php echo $this->escape($item->title); ?></a>
|
||||
<?php else : ?>
|
||||
<?php echo $this->escape($item->title); ?>
|
||||
<?php endif; ?>
|
||||
<span class="small">
|
||||
<?php if ($item->type != 'url') : ?>
|
||||
<?php if (empty($item->note)) : ?>
|
||||
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));?>
|
||||
<?php else : ?>
|
||||
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note));?>
|
||||
<?php endif; ?>
|
||||
<?php elseif ($item->type == 'url' && $item->note) : ?>
|
||||
<?php echo JText::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note));?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<div class="small" title="<?php echo $this->escape($item->path);?>">
|
||||
<?php echo str_repeat('<span class="gtr">—</span>', $item->level - 1) ?>
|
||||
<span title="<?php echo isset($item->item_type_desc) ? htmlspecialchars($this->escape($item->item_type_desc), ENT_COMPAT, 'UTF-8') : ''; ?>">
|
||||
<?php echo $this->escape($item->item_type); ?></span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="center hidden-phone">
|
||||
<?php if ($item->type == 'component') : ?>
|
||||
<?php if ($item->language == '*' || $item->home == '0'):?>
|
||||
<?php echo JHtml::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange);?>
|
||||
<?php elseif ($canChange):?>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_menus&task=items.unsetDefault&cid[]='.$item->id.'&'.JSession::getFormToken().'=1');?>">
|
||||
<?php echo JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => JText::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title)), true);?>
|
||||
</a>
|
||||
<?php else:?>
|
||||
<?php echo JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true);?>
|
||||
<?php endif;?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
<?php echo $this->escape($item->access_level); ?>
|
||||
</td>
|
||||
<?php if ($assoc):?>
|
||||
<td class="small hidden-phone">
|
||||
<?php if ($item->association):?>
|
||||
<?php echo JHtml::_('MenusHtml.Menus.association', $item->id);?>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
<td class="small hidden-phone">
|
||||
<?php if ($item->language == ''):?>
|
||||
<?php echo JText::_('JDEFAULT'); ?>
|
||||
<?php elseif ($item->language == '*'):?>
|
||||
<?php echo JText::alt('JALL', 'language'); ?>
|
||||
<?php else:?>
|
||||
<?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<td class="center hidden-phone">
|
||||
<span title="<?php echo sprintf('%d-%d', $item->lft, $item->rgt);?>">
|
||||
<?php echo (int) $item->id; ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php //Load the batch processing form.is user is allowed ?>
|
||||
<?php if ($user->authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus')) : ?>
|
||||
<?php echo $this->loadTemplate('batch'); ?>
|
||||
<?php endif;?>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<input type="hidden" name="original_order_values" value="<?php echo implode($originalOrders, ','); ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$options = array(
|
||||
JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')),
|
||||
JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE'))
|
||||
);
|
||||
$published = $this->state->get('filter.published');
|
||||
?>
|
||||
<div class="modal hide fade" id="collapseModal">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">x</button>
|
||||
<h3><?php echo JText::_('COM_MENUS_BATCH_OPTIONS');?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php echo JText::_('COM_MENUS_BATCH_TIP'); ?></p>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<?php echo JHtml::_('batch.access');?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<?php echo JHtml::_('batch.language'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($published >= 0)
|
||||
{
|
||||
?>
|
||||
<div id="batch-choose-action" class="combo control-group">
|
||||
<label id="batch-choose-action-lbl" class="control-label" for="batch-choose-action">
|
||||
<?php echo JText::_('COM_MENUS_BATCH_MENU_LABEL'); ?>
|
||||
</label>
|
||||
<div class="controls">
|
||||
<select name="batch[menu_id]" class="inputbox" id="batch-menu-id">
|
||||
<option value=""><?php echo JText::_('JSELECT') ?></option>
|
||||
<?php echo JHtml::_('select.options', JHtml::_('menu.menuitems', array('published' => $published)));?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="batch-copy-move" class="control-group radio">
|
||||
<?php echo JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" type="button" onclick="document.id('batch-menu-id').value='';document.id('batch-access').value='';document.id('batch-language-id').value=''" data-dismiss="modal">
|
||||
<?php echo JText::_('JCANCEL'); ?>
|
||||
</button>
|
||||
<button class="btn btn-primary" type="submit" onclick="Joomla.submitbutton('item.batch');">
|
||||
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
309
administrator/components/com_menus/views/items/view.html.php
Normal file
309
administrator/components/com_menus/views/items/view.html.php
Normal file
@ -0,0 +1,309 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The HTML Menus Menu Items View.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusViewItems extends JViewLegacy
|
||||
{
|
||||
protected $f_levels;
|
||||
|
||||
protected $items;
|
||||
|
||||
protected $pagination;
|
||||
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$lang = JFactory::getLanguage();
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
|
||||
MenusHelper::addSubmenu('items');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->ordering = array();
|
||||
|
||||
// Preprocess the list of items to find ordering divisions.
|
||||
foreach ($this->items as $item)
|
||||
{
|
||||
$this->ordering[$item->parent_id][] = $item->id;
|
||||
|
||||
// item type text
|
||||
switch ($item->type)
|
||||
{
|
||||
case 'url':
|
||||
$value = JText::_('COM_MENUS_TYPE_EXTERNAL_URL');
|
||||
break;
|
||||
|
||||
case 'alias':
|
||||
$value = JText::_('COM_MENUS_TYPE_ALIAS');
|
||||
break;
|
||||
|
||||
case 'separator':
|
||||
$value = JText::_('COM_MENUS_TYPE_SEPARATOR');
|
||||
break;
|
||||
|
||||
case 'heading':
|
||||
$value = JText::_('COM_MENUS_TYPE_HEADING');
|
||||
break;
|
||||
|
||||
case 'component':
|
||||
default:
|
||||
// load language
|
||||
$lang->load($item->componentname.'.sys', JPATH_ADMINISTRATOR, null, false, false)
|
||||
|| $lang->load($item->componentname.'.sys', JPATH_ADMINISTRATOR.'/components/'.$item->componentname, null, false, false)
|
||||
|| $lang->load($item->componentname.'.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
|
||||
|| $lang->load($item->componentname.'.sys', JPATH_ADMINISTRATOR.'/components/'.$item->componentname, $lang->getDefault(), false, false);
|
||||
|
||||
if (!empty($item->componentname))
|
||||
{
|
||||
$value = JText::_($item->componentname);
|
||||
$vars = null;
|
||||
|
||||
parse_str($item->link, $vars);
|
||||
if (isset($vars['view']))
|
||||
{
|
||||
// Attempt to load the view xml file.
|
||||
$file = JPATH_SITE.'/components/'.$item->componentname.'/views/'.$vars['view'].'/metadata.xml';
|
||||
if (is_file($file) && $xml = simplexml_load_file($file))
|
||||
{
|
||||
// Look for the first view node off of the root node.
|
||||
if ($view = $xml->xpath('view[1]'))
|
||||
{
|
||||
if (!empty($view[0]['title']))
|
||||
{
|
||||
$vars['layout'] = isset($vars['layout']) ? $vars['layout'] : 'default';
|
||||
|
||||
// Attempt to load the layout xml file.
|
||||
// If Alternative Menu Item, get template folder for layout file
|
||||
if (strpos($vars['layout'], ':') > 0)
|
||||
{
|
||||
// Use template folder for layout file
|
||||
$temp = explode(':', $vars['layout']);
|
||||
$file = JPATH_SITE.'/templates/'.$temp[0].'/html/'.$item->componentname.'/'.$vars['view'].'/'.$temp[1].'.xml';
|
||||
// Load template language file
|
||||
$lang->load('tpl_'.$temp[0].'.sys', JPATH_SITE, null, false, false)
|
||||
|| $lang->load('tpl_'.$temp[0].'.sys', JPATH_SITE.'/templates/'.$temp[0], null, false, false)
|
||||
|| $lang->load('tpl_'.$temp[0].'.sys', JPATH_SITE, $lang->getDefault(), false, false)
|
||||
|| $lang->load('tpl_'.$temp[0].'.sys', JPATH_SITE.'/templates/'.$temp[0], $lang->getDefault(), false, false);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get XML file from component folder for standard layouts
|
||||
$file = JPATH_SITE.'/components/'.$item->componentname.'/views/'.$vars['view'].'/tmpl/'.$vars['layout'].'.xml';
|
||||
}
|
||||
if (is_file($file) && $xml = simplexml_load_file($file))
|
||||
{
|
||||
// Look for the first view node off of the root node.
|
||||
if ($layout = $xml->xpath('layout[1]'))
|
||||
{
|
||||
if (!empty($layout[0]['title']))
|
||||
{
|
||||
$value .= ' » ' . JText::_(trim((string) $layout[0]['title']));
|
||||
}
|
||||
}
|
||||
if (!empty($layout[0]->message[0]))
|
||||
{
|
||||
$item->item_type_desc = JText::_(trim((string) $layout[0]->message[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($xml);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Special case for absent views
|
||||
$value .= ' » ' . $vars['view'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (preg_match("/^index.php\?option=([a-zA-Z\-0-9_]*)/", $item->link, $result))
|
||||
{
|
||||
$value = JText::sprintf('COM_MENUS_TYPE_UNEXISTING', $result[1]);
|
||||
}
|
||||
else {
|
||||
$value = JText::_('COM_MENUS_TYPE_UNKNOWN');
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
$item->item_type = $value;
|
||||
}
|
||||
|
||||
// Levels filter.
|
||||
$options = array();
|
||||
$options[] = JHtml::_('select.option', '1', JText::_('J1'));
|
||||
$options[] = JHtml::_('select.option', '2', JText::_('J2'));
|
||||
$options[] = JHtml::_('select.option', '3', JText::_('J3'));
|
||||
$options[] = JHtml::_('select.option', '4', JText::_('J4'));
|
||||
$options[] = JHtml::_('select.option', '5', JText::_('J5'));
|
||||
$options[] = JHtml::_('select.option', '6', JText::_('J6'));
|
||||
$options[] = JHtml::_('select.option', '7', JText::_('J7'));
|
||||
$options[] = JHtml::_('select.option', '8', JText::_('J8'));
|
||||
$options[] = JHtml::_('select.option', '9', JText::_('J9'));
|
||||
$options[] = JHtml::_('select.option', '10', JText::_('J10'));
|
||||
|
||||
$this->f_levels = $options;
|
||||
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
|
||||
// Allow a system plugin to insert dynamic menu types to the list shown in menus:
|
||||
JDispatcher::getInstance()->trigger('onBeforeRenderMenuItems', array($this));
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
require_once JPATH_COMPONENT.'/helpers/menus.php';
|
||||
|
||||
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
|
||||
$user = JFactory::getUser();
|
||||
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
|
||||
JToolbarHelper::title(JText::_('COM_MENUS_VIEW_ITEMS_TITLE'), 'menumgr.png');
|
||||
|
||||
if ($canDo->get('core.create'))
|
||||
{
|
||||
JToolbarHelper::addNew('item.add');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::editList('item.edit');
|
||||
}
|
||||
if ($canDo->get('core.edit.state'))
|
||||
{
|
||||
JToolbarHelper::publish('items.publish', 'JTOOLBAR_PUBLISH', true);
|
||||
JToolbarHelper::unpublish('items.unpublish', 'JTOOLBAR_UNPUBLISH', true);
|
||||
}
|
||||
if (JFactory::getUser()->authorise('core.admin'))
|
||||
{
|
||||
JToolbarHelper::checkin('items.checkin', 'JTOOLBAR_CHECKIN', true);
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete'))
|
||||
{
|
||||
JToolbarHelper::deleteList('', 'items.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($canDo->get('core.edit.state'))
|
||||
{
|
||||
JToolbarHelper::trash('items.trash');
|
||||
}
|
||||
|
||||
if ($canDo->get('core.edit.state'))
|
||||
{
|
||||
JToolbarHelper::makeDefault('items.setDefault', 'COM_MENUS_TOOLBAR_SET_HOME');
|
||||
}
|
||||
if (JFactory::getUser()->authorise('core.admin'))
|
||||
{
|
||||
JToolbarHelper::custom('items.rebuild', 'refresh.png', 'refresh_f2.png', 'JToolbar_Rebuild', false);
|
||||
}
|
||||
|
||||
// Add a batch button
|
||||
if ($user->authorise('core.create', 'com_menus') && $user->authorise('core.edit', 'com_menus') && $user->authorise('core.edit.state', 'com_menus'))
|
||||
{
|
||||
JHtml::_('bootstrap.modal', 'collapseModal');
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
|
||||
JToolbarHelper::help('JHELP_MENUS_MENU_ITEM_MANAGER');
|
||||
|
||||
JHtmlSidebar::setAction('index.php?option=com_menus&view=items');
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
// @todo we need a label here
|
||||
'',
|
||||
'menutype',
|
||||
JHtml::_('select.options', JHtml::_('menu.menus'), 'value', 'text', $this->state->get('filter.menutype')),
|
||||
false
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_MENUS_OPTION_SELECT_LEVEL'),
|
||||
'filter_level',
|
||||
JHtml::_('select.options', $this->f_levels, 'value', 'text', $this->state->get('filter.level'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_PUBLISHED'),
|
||||
'filter_published',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('archived' => false)), 'value', 'text', $this->state->get('filter.published'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_ACCESS'),
|
||||
'filter_access',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_LANGUAGE'),
|
||||
'filter_language',
|
||||
JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array Array containing the field name to sort by as the key and display text as value
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
return array(
|
||||
'a.lft' => JText::_('JGRID_HEADING_ORDERING'),
|
||||
'a.published' => JText::_('JSTATUS'),
|
||||
'a.title' => JText::_('JGLOBAL_TITLE'),
|
||||
'a.home' => JText::_('COM_MENUS_HEADING_HOME'),
|
||||
'a.access' => JText::_('JGRID_HEADING_ACCESS'),
|
||||
'association' => JText::_('COM_MENUS_HEADING_ASSOCIATION'),
|
||||
'language' => JText::_('JGRID_HEADING_LANGUAGE'),
|
||||
'a.id' => JText::_('JGRID_HEADING_ID')
|
||||
);
|
||||
}
|
||||
}
|
1
administrator/components/com_menus/views/menu/index.html
Normal file
1
administrator/components/com_menus/views/menu/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
59
administrator/components/com_menus/views/menu/tmpl/edit.php
Normal file
59
administrator/components/com_menus/views/menu/tmpl/edit.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the component HTML helpers.
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
|
||||
JHtml::_('behavior.formvalidation');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task == 'menu.cancel' || document.formvalidator.isValid(document.id('item-form')))
|
||||
{
|
||||
Joomla.submitform(task, document.getElementById('item-form'));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_menus&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-horizontal">
|
||||
<fieldset>
|
||||
<legend><?php echo JText::_('COM_MENUS_MENU_DETAILS');?></legend>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('title'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('title'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('menutype'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('menutype'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="control-label">
|
||||
<?php echo $this->form->getLabel('description'); ?>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<?php echo $this->form->getInput('description'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
95
administrator/components/com_menus/views/menu/view.html.php
Normal file
95
administrator/components/com_menus/views/menu/view.html.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The HTML Menus Menu Item View.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusViewMenu extends JViewLegacy
|
||||
{
|
||||
protected $form;
|
||||
|
||||
protected $item;
|
||||
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->state = $this->get('State');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
$this->addToolbar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$input->set('hidemainmenu', true);
|
||||
|
||||
$isNew = ($this->item->id == 0);
|
||||
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
|
||||
|
||||
JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'menu.png');
|
||||
|
||||
// If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid.
|
||||
if ($isNew && $canDo->get('core.create'))
|
||||
{
|
||||
if ($canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::apply('menu.apply');
|
||||
}
|
||||
JToolbarHelper::save('menu.save');
|
||||
}
|
||||
|
||||
// If user can edit, can save the item.
|
||||
if (!$isNew && $canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::apply('menu.apply');
|
||||
JToolbarHelper::save('menu.save');
|
||||
}
|
||||
|
||||
// If the user can create new items, allow them to see Save & New
|
||||
if ($canDo->get('core.create'))
|
||||
{
|
||||
JToolbarHelper::save2new('menu.save2new');
|
||||
}
|
||||
if ($isNew)
|
||||
{
|
||||
JToolbarHelper::cancel('menu.cancel');
|
||||
}
|
||||
else
|
||||
{
|
||||
JToolbarHelper::cancel('menu.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
JToolbarHelper::divider();
|
||||
JToolbarHelper::help('JHELP_MENUS_MENU_MANAGER_EDIT');
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
167
administrator/components/com_menus/views/menus/tmpl/default.php
Normal file
167
administrator/components/com_menus/views/menus/tmpl/default.php
Normal file
@ -0,0 +1,167 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Include the component HTML helpers.
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('behavior.modal');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
$uri = JUri::getInstance();
|
||||
$return = base64_encode($uri);
|
||||
$user = JFactory::getUser();
|
||||
$userId = $user->get('id');
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$modMenuId = (int) $this->get('ModMenuId');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(task)
|
||||
{
|
||||
if (task != 'menus.delete' || confirm('<?php echo JText::_('COM_MENUS_MENU_CONFIRM_DELETE', true);?>'))
|
||||
{
|
||||
Joomla.submitform(task);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_menus&view=menus');?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if (!empty( $this->sidebar)) : ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif;?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('COM_MENUS_MENU_SEARCH_FILTER');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_MENUS_ITEMS_SEARCH_FILTER'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left hidden-phone">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap center hidden-phone">
|
||||
<?php echo JText::_('COM_MENUS_HEADING_PUBLISHED_ITEMS'); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap center hidden-phone">
|
||||
<?php echo JText::_('COM_MENUS_HEADING_UNPUBLISHED_ITEMS'); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap center hidden-phone">
|
||||
<?php echo JText::_('COM_MENUS_HEADING_TRASHED_ITEMS'); ?>
|
||||
</th>
|
||||
<th width="20%" class="nowrap hidden-phone">
|
||||
<?php echo JText::_('COM_MENUS_HEADING_LINKED_MODULES'); ?>
|
||||
</th>
|
||||
<th width="1%" class="center nowrap">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $item) :
|
||||
$canCreate = $user->authorise('core.create', 'com_menus');
|
||||
$canEdit = $user->authorise('core.edit', 'com_menus');
|
||||
$canChange = $user->authorise('core.edit.state', 'com_menus');
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="center">
|
||||
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype) ?> ">
|
||||
<?php echo $this->escape($item->title); ?></a>
|
||||
<p class="small">(<span><?php echo JText::_('COM_MENUS_MENU_MENUTYPE_LABEL') ?></span>
|
||||
<?php if ($canEdit) : ?>
|
||||
<?php echo '<a href="'.JRoute::_('index.php?option=com_menus&task=menu.edit&id='.$item->id).' title='.$this->escape($item->description).'">'.
|
||||
$this->escape($item->menutype).'</a>'; ?>)
|
||||
<?php else : ?>
|
||||
<?php echo $this->escape($item->menutype)?>)
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</td>
|
||||
<td class="center btns">
|
||||
<a class="badge badge-success" href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=1');?>">
|
||||
<?php echo $item->count_published; ?></a>
|
||||
</td>
|
||||
<td class="center btns">
|
||||
<a class="badge" href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=0');?>">
|
||||
<?php echo $item->count_unpublished; ?></a>
|
||||
</td>
|
||||
<td class="center btns">
|
||||
<a class="badge badge-error" href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=-2');?>">
|
||||
<?php echo $item->count_trashed; ?></a>
|
||||
</td>
|
||||
<td class="left">
|
||||
<?php if (isset($this->modules[$item->menutype])) : ?>
|
||||
<div class="btn-group">
|
||||
<a href="#" class="btn btn-small dropdown-toggle" data-toggle="dropdown">
|
||||
<?php echo JText::_('COM_MENUS_MODULES') ?>
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<?php foreach ($this->modules[$item->menutype] as &$module) : ?>
|
||||
<li>
|
||||
<?php if ($canEdit) : ?>
|
||||
<a class="small modal" href="<?php echo JRoute::_('index.php?option=com_modules&task=module.edit&id='.$module->id.'&return='.$return.'&tmpl=component&layout=modal');?>" rel="{handler: 'iframe', size: {x: 1024, y: 450}, onClose: function() {window.location.reload()}}" title="<?php echo JText::_('COM_MENUS_EDIT_MODULE_SETTINGS');?>">
|
||||
<?php echo JText::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?></a>
|
||||
<?php else :?>
|
||||
<?php echo JText::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php elseif ($modMenuId) : ?>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_modules&task=module.add&eid=' . $modMenuId . '¶ms[menutype]='.$item->menutype); ?>">
|
||||
<?php echo JText::_('COM_MENUS_ADD_MENU_MODULE'); ?></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
89
administrator/components/com_menus/views/menus/view.html.php
Normal file
89
administrator/components/com_menus/views/menus/view.html.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The HTML Menus Menu Menus View.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusViewMenus extends JViewLegacy
|
||||
{
|
||||
protected $items;
|
||||
|
||||
protected $modules;
|
||||
|
||||
protected $pagination;
|
||||
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->items = $this->get('Items');
|
||||
$this->modules = $this->get('Modules');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
|
||||
MenusHelper::addSubmenu('menus');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
require_once JPATH_COMPONENT.'/helpers/menus.php';
|
||||
|
||||
$canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
|
||||
|
||||
JToolbarHelper::title(JText::_('COM_MENUS_VIEW_MENUS_TITLE'), 'menumgr.png');
|
||||
|
||||
if ($canDo->get('core.create'))
|
||||
{
|
||||
JToolbarHelper::addNew('menu.add');
|
||||
}
|
||||
if ($canDo->get('core.edit'))
|
||||
{
|
||||
JToolbarHelper::editList('menu.edit');
|
||||
}
|
||||
if ($canDo->get('core.delete'))
|
||||
{
|
||||
JToolbarHelper::divider();
|
||||
JToolbarHelper::deleteList('', 'menus.delete');
|
||||
}
|
||||
|
||||
JToolbarHelper::custom('menus.rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false);
|
||||
if ($canDo->get('core.admin'))
|
||||
{
|
||||
JToolbarHelper::divider();
|
||||
JToolbarHelper::preferences('com_menus');
|
||||
}
|
||||
JToolbarHelper::divider();
|
||||
JToolbarHelper::help('JHELP_MENUS_MENU_MANAGER');
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<html><body></body></html>
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$input = JFactory::getApplication()->input;
|
||||
// Checking if loaded via index.php or component.php
|
||||
$tmpl = $input->getCmd('tmpl', '');
|
||||
$document = JFactory::getDocument();
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
setmenutype = function(type)
|
||||
{
|
||||
<?php if ($tmpl) : ?>
|
||||
window.parent.Joomla.submitbutton('item.setType', type);
|
||||
window.parent.SqueezeBox.close();
|
||||
<?php else : ?>
|
||||
window.location="index.php?option=com_menus&view=item&task=item.setType&layout=edit&type="+('item.setType', type);
|
||||
<?php endif; ?>
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.startAccordion', 'collapseTypes', array('active' => 'slide1')); ?>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($this->types as $name => $list) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addSlide', 'collapseTypes', JText::_($name), 'collapse' . $i++); ?>
|
||||
<ul class="nav nav-tabs nav-stacked">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<a class="choose_type" href="#" title="<?php echo JText::_($item->description); ?>"
|
||||
onclick="javascript:setmenutype('<?php echo base64_encode(json_encode(array('id' => $this->recordId, 'title' => $item->title, 'request' => $item->request))); ?>')">
|
||||
<?php echo JText::_($item->title);?> <small class="muted"><?php echo JText::_($item->description); ?></small>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php echo JHtml::_('bootstrap.endSlide'); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php echo JHtml::_('bootstrap.addSlide', 'collapseTypes', JText::_('COM_MENUS_TYPE_SYSTEM'), 'collapse-system'); ?>
|
||||
<ul class="nav nav-tabs nav-stacked">
|
||||
<li><a class="choose_type" href="#" title="<?php echo JText::_('COM_MENUS_TYPE_EXTERNAL_URL_DESC'); ?>"
|
||||
onclick="javascript:setmenutype('<?php echo base64_encode(json_encode(array('id' => $this->recordId, 'title' => 'url'))); ?>')">
|
||||
<?php echo JText::_('COM_MENUS_TYPE_EXTERNAL_URL'); ?> <small class="muted"><?php echo JText::_('COM_MENUS_TYPE_EXTERNAL_URL_DESC'); ?></small>
|
||||
</a>
|
||||
</li>
|
||||
<li><a class="choose_type" href="#" title="<?php echo JText::_('COM_MENUS_TYPE_ALIAS_DESC'); ?>"
|
||||
onclick="javascript:setmenutype('<?php echo base64_encode(json_encode(array('id' => $this->recordId, 'title' => 'alias'))); ?>')">
|
||||
<?php echo JText::_('COM_MENUS_TYPE_ALIAS'); ?> <small class="muted"><?php echo JText::_('COM_MENUS_TYPE_ALIAS_DESC'); ?></small>
|
||||
</a>
|
||||
</li>
|
||||
<li><a class="choose_type" href="#" title="<?php echo JText::_('COM_MENUS_TYPE_SEPARATOR_DESC'); ?>"
|
||||
onclick="javascript:setmenutype('<?php echo base64_encode(json_encode(array('id' => $this->recordId, 'title' => 'separator'))); ?>')">
|
||||
<?php echo JText::_('COM_MENUS_TYPE_SEPARATOR'); ?> <small class="muted"><?php echo JText::_('COM_MENUS_TYPE_SEPARATOR_DESC'); ?></small>
|
||||
</a>
|
||||
</li>
|
||||
<li><a class="choose_type" href="#" title="<?php echo JText::_('COM_MENUS_TYPE_HEADING_DESC'); ?>"
|
||||
onclick="javascript:setmenutype('<?php echo base64_encode(json_encode(array('id' => $this->recordId, 'title' => 'heading'))); ?>')">
|
||||
<?php echo JText::_('COM_MENUS_TYPE_HEADING'); ?> <small class="muted"><?php echo JText::_('COM_MENUS_TYPE_HEADING_DESC'); ?></small>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<?php echo JHtml::_('bootstrap.endSlide'); ?>
|
||||
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
|
@ -0,0 +1 @@
|
||||
<html><body></body></html>
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* The HTML Menus Menu Item TYpes View.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_menus
|
||||
* @since 1.6
|
||||
*/
|
||||
class MenusViewMenutypes extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* Display the view
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$input = JFactory::getApplication()->input;
|
||||
$this->recordId = $input->getInt('recordId');
|
||||
$this->types = $this->get('TypeOptions');
|
||||
|
||||
$this->addToolbar();
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
// Add page title
|
||||
JToolbarHelper::title(JText::_('COM_MENUS'), 'menumgr.png');
|
||||
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
|
||||
// Cancel
|
||||
$title = JText::_('JTOOLBAR_CANCEL');
|
||||
$dhtml = "<button onClick=\"location.href='index.php?option=com_menus&view=items'\" class=\"btn\">
|
||||
<i class=\"icon-remove\" title=\"$title\"></i>
|
||||
$title</button>";
|
||||
$bar->appendButton('Custom', $dhtml, 'new');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user