Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion administrator/components/com_menus/controllers/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ public function cancel($key = null)
// Clear the ancillary data from the session.
$app->setUserState($context . '.type', null);
$app->setUserState($context . '.link', null);

// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend()
. '&menutype=' . $app->getUserState('com_menus.items.menutype'), false
)
);
}

return $result;
Expand Down Expand Up @@ -326,7 +334,12 @@ public function save($key = null, $urlVar = 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));
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend()
. '&menutype=' . $app->getUserState('com_menus.items.menutype'), false
)
);
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
label="COM_MENUS_FILTER_CATEGORY"
description="JOPTION_FILTER_CATEGORY_DESC"
onchange="this.form.submit();"
/>
>
<option value="">COM_MENUS_SELECT_MENU</option>
</field>
<fields name="filter">
<field
name="search"
Expand Down Expand Up @@ -76,6 +78,8 @@
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
<option value="a.menutype ASC">COM_MENUS_HEADING_MENU_ASC</option>
<option value="a.menutype DESC">COM_MENUS_HEADING_MENU_DESC</option>
<option value="a.home ASC">COM_MENUS_HEADING_HOME_ASC</option>
<option value="a.home DESC">COM_MENUS_HEADING_HOME_DESC</option>
<option value="a.access ASC">JGRID_HEADING_ACCESS_ASC</option>
Expand Down
5 changes: 4 additions & 1 deletion administrator/components/com_menus/models/forms/item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
label="COM_MENUS_ITEM_FIELD_ASSIGNED_LABEL"
description="COM_MENUS_ITEM_FIELD_ASSIGNED_DESC"
required="true"
size="1" />
size="1"
>
<option value="">COM_MENUS_SELECT_MENU</option>
</field>

<field
name="type"
Expand Down
30 changes: 1 addition & 29 deletions administrator/components/com_menus/models/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,7 @@ protected function populateState($ordering = null, $direction = null)
}
else
{
$menuType = $app->getUserState($this->context . '.menutype');

if (!$menuType)
{
$menuType = $this->getDefaultMenuType();
}
$app->setUserState($this->context . '.menutype', '');
}

$this->setState('filter.menutype', $menuType);
Expand Down Expand Up @@ -152,29 +147,6 @@ protected function getStoreId($id = '')
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.
*
Expand Down
57 changes: 34 additions & 23 deletions administrator/components/com_menus/views/items/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
$ordering = ($listOrder == 'a.lft');
$canOrder = $user->authorise('core.edit.state', 'com_menus');
$saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc');
$menuType = (array) $app->getUserState('com_menus.items.menutype');

if ($saveOrder)
if ($saveOrder && !empty($menuType))
{
$saveOrderingUrl = 'index.php?option=com_menus&task=items.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'itemList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
Expand Down Expand Up @@ -56,9 +57,11 @@
<table class="table table-striped" id="itemList">
<thead>
<tr>
<th width="1%" class="hidden-phone">
<?php echo JHtml::_('searchtools.sort', '', 'a.lft', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th>
<?php if (!empty($menuType)) : ?>
<th width="1%" class="hidden-phone">
<?php echo JHtml::_('searchtools.sort', '', 'a.lft', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th>
<?php endif; ?>
<th width="1%" class="center">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
Expand All @@ -68,6 +71,9 @@
<th class="title">
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'COM_MENUS_HEADING_MENU', 'a.menutype', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="center nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'COM_MENUS_HEADING_HOME', 'a.home', $listDirn, $listOrder); ?>
</th>
Expand Down Expand Up @@ -133,26 +139,28 @@
}
?>
<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 = '';
<?php if (!empty($menuType)) : ?>
<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 ?>">
<span class="icon-menu"></span>
</span>
<?php if ($canChange && $saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $orderkey + 1;?>" />
<?php endif; ?>
</td>
if (!$canChange)
{
$iconClass = ' inactive';
}
elseif (!$saveOrder)
{
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
}
?>
<span class="sortable-handler<?php echo $iconClass ?>">
<span class="icon-menu"></span>
</span>
<?php if ($canChange && $saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $orderkey + 1;?>" />
<?php endif; ?>
</td>
<?php endif; ?>
<td class="center">
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
</td>
Expand Down Expand Up @@ -187,6 +195,9 @@
<?php echo $this->escape($item->item_type); ?></span>
</div>
</td>
<td class="small hidden-phone">
<?php echo $this->escape($item->menutype); ?>
</td>
<td class="center hidden-phone">
<?php if ($item->type == 'component') : ?>
<?php if ($item->language == '*' || $item->home == '0') : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,42 @@
JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE'))
);
$published = $this->state->get('filter.published');
$menuType = (array) JFactory::getApplication()->getUserState('com_menus.items.menutype');
?>

<div class="row-fluid">
<div class="control-group span6">
<div class="controls">
<?php echo JHtml::_('batch.language'); ?>
</div>
</div>
<div class="control-group span6">
<div class="controls">
<?php echo JHtml::_('batch.access'); ?>
</div>
</div>
</div>
<div class="row-fluid">
<?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>
<?php if (!empty($menuType)) : ?>
<div class="row-fluid">
<div class="control-group span6">
<div class="controls">
<select name="batch[menu_id]" id="batch-menu-id">
<option value=""><?php echo JText::_('JLIB_HTML_BATCH_NO_CATEGORY') ?></option>
<?php echo JHtml::_('select.options', JHtml::_('menu.menuitems', array('published' => $published))); ?>
</select>
<?php echo JHtml::_('batch.language'); ?>
</div>
</div>
<div id="batch-copy-move" class="control-group radio">
<?php echo JText::_('JLIB_HTML_BATCH_MOVE_QUESTION'); ?>
<?php echo JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'); ?>
<div class="control-group span6">
<div class="controls">
<?php echo JHtml::_('batch.access'); ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="row-fluid">
<?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]" id="batch-menu-id">
<option value=""><?php echo JText::_('JLIB_HTML_BATCH_NO_CATEGORY') ?></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 JText::_('JLIB_HTML_BATCH_MOVE_QUESTION'); ?>
<?php echo JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'); ?>
</div>
<?php endif; ?>
</div>
<?php else : ?>
<div class="row-fluid">
<p><?php echo JText::_('COM_MENUS_SELECT_MENU_FIRST') ?></p>
</div>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
*/
defined('_JEXEC') or die;

$menuType = (array) JFactory::getApplication()->getUserState('com_menus.items.menutype');
?>
<button class="btn" type="button" onclick="document.getElementById('batch-menu-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value=''" data-dismiss="modal">
<?php echo JText::_('JCANCEL'); ?>
</button>
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('item.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>
<?php if (!empty($menuType)) : ?>
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('item.batch');">
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>
<?php endif; ?>
5 changes: 5 additions & 0 deletions administrator/language/en-GB/en-GB.com_menus.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ COM_MENUS_HEADING_HOME_ASC="Home ascending"
COM_MENUS_HEADING_HOME_DESC="Home descending"
COM_MENUS_HEADING_LEVELS="View level"
COM_MENUS_HEADING_LINKED_MODULES="Linked Modules"
COM_MENUS_HEADING_MENU="Menu"
COM_MENUS_HEADING_MENU_ASC="Menu ascending"
COM_MENUS_HEADING_MENU_DESC="Menu descending"
COM_MENUS_HEADING_NUMBER_MENU_ITEMS="Number of Menu Items"
COM_MENUS_HEADING_POSITION="Position"
COM_MENUS_HEADING_PUBLISHED_ITEMS="Published"
Expand Down Expand Up @@ -158,6 +161,8 @@ COM_MENUS_NO_MENUS_SELECTED="No menu selected."
COM_MENUS_OPTION_SELECT_LEVEL="- Select Max Levels -"
COM_MENUS_REQUEST_FIELDSET_LABEL="Required Settings"
COM_MENUS_SAVE_SUCCESS="Menu item successfully saved."
COM_MENUS_SELECT_MENU="- Select Menu -"
COM_MENUS_SELECT_MENU_FIRST="To use batch processing, please first select a Menu in the manager."
COM_MENUS_SUBMENU_ITEMS="Menu Items"
COM_MENUS_SUBMENU_MENUS="Menus"
COM_MENUS_SUCCESS_REORDERED="Menu item successfully reordered."
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.mod_menu.ini
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ MOD_MENU_LOGOUT="Logout"
MOD_MENU_MASS_MAIL_USERS="Mass Mail Users"
MOD_MENU_MEDIA_MANAGER="Media"
MOD_MENU_MENUS="Menus"
MOD_MENU_MENUS_ALL_ITEMS="All Menu Items"
MOD_MENU_MENU_MANAGER="Manage"
MOD_MENU_MENU_MANAGER_NEW_MENU="Add New Menu"
MOD_MENU_MENU_MANAGER_NEW_MENU_ITEM="Add New Menu Item"
Expand Down
4 changes: 4 additions & 0 deletions administrator/modules/mod_menu/tmpl/default_enabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@

$menu->addSeparator();

$menu->addChild(new JMenuNode(JText::_('MOD_MENU_MENUS_ALL_ITEMS'), 'index.php?option=com_menus&view=items', 'class:menumgr'), $createMenu);
$menu->getParent();
$menu->addSeparator();

// Menu Types
$menuTypes = ModMenuHelper::getMenus();
$menuTypes = JArrayHelper::sortObjects($menuTypes, 'title', 1, false);
Expand Down