diff --git a/administrator/components/com_menus/controllers/item.php b/administrator/components/com_menus/controllers/item.php index 361616f334fe2..1f865517097d8 100644 --- a/administrator/components/com_menus/controllers/item.php +++ b/administrator/components/com_menus/controllers/item.php @@ -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; @@ -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; } diff --git a/administrator/components/com_menus/controllers/items.php b/administrator/components/com_menus/controllers/items.php index a9bcdb99f176f..7e02b105d7b49 100644 --- a/administrator/components/com_menus/controllers/items.php +++ b/administrator/components/com_menus/controllers/items.php @@ -120,6 +120,8 @@ public function setDefault() // Check for request forgeries JSession::checkToken('request') or die(JText::_('JINVALID_TOKEN')); + $app = JFactory::getApplication(); + // Get items to publish from the request. $cid = $this->input->get('cid', array(), 'array'); $data = array('setDefault' => 1, 'unsetDefault' => 0); @@ -157,7 +159,136 @@ public function setDefault() $this->setMessage(JText::plural($ntext, count($cid))); } } + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list + . '&menutype=' . $app->getUserState('com_menus.items.menutype'), false + ) + ); + } + + /** + * Method to publish a list of items + * + * @return void + * + * @since 12.2 + */ + public function publish() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + + // Get items to publish from the request. + $cid = JFactory::getApplication()->input->get('cid', array(), 'array'); + $data = array('publish' => 1, 'unpublish' => 0, 'trash' => -2, 'report' => -3); + $task = $this->getTask(); + $value = JArrayHelper::getValue($data, $task, 0, 'int'); + + if (empty($cid)) + { + JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror'); + } + else + { + // Get the model. + $model = $this->getModel(); + + // Make sure the item ids are integers + JArrayHelper::toInteger($cid); + + // Publish the items. + try + { + $model->publish($cid, $value); + $errors = $model->getErrors(); + + if ($value == 1) + { + if ($errors) + { + $app = JFactory::getApplication(); + $app->enqueueMessage(JText::plural($this->text_prefix . '_N_ITEMS_FAILED_PUBLISHING', count($cid)), 'error'); + } + else + { + $ntext = $this->text_prefix . '_N_ITEMS_PUBLISHED'; + } + } + elseif ($value == 0) + { + $ntext = $this->text_prefix . '_N_ITEMS_UNPUBLISHED'; + } + else + { + $ntext = $this->text_prefix . '_N_ITEMS_TRASHED'; + } + + $this->setMessage(JText::plural($ntext, count($cid))); + } + catch (Exception $e) + { + $this->setMessage($e->getMessage(), 'error'); + } + } + + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&menutype=' . + JFactory::getApplication()->getUserState('com_menus.items.menutype'), + false + ) + ); + } + + /** + * Check in of one or more records. + * + * @return boolean True on success + * + * @since 12.2 + */ + public function checkin() + { + // Check for request forgeries. + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $ids = JFactory::getApplication()->input->post->get('cid', array(), 'array'); + + $model = $this->getModel(); + $return = $model->checkin($ids); + + if ($return === false) + { + // Checkin failed. + $message = JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()); + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list + . '&menutype=' . JFactory::getApplication()->getUserState('com_menus.items.menutype'), + false + ), + $message, + 'error' + ); + + return false; + } + else + { + // Checkin succeeded. + $message = JText::plural($this->text_prefix . '_N_ITEMS_CHECKED_IN', count($ids)); + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list + . '&menutype=' . JFactory::getApplication()->getUserState('com_menus.items.menutype'), + false + ), + $message + ); - $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); + return true; + } } + } diff --git a/administrator/components/com_menus/models/forms/filter_items.xml b/administrator/components/com_menus/models/forms/filter_items.xml index 0b7f2f2c5ddf2..6fdf0d3fc4488 100644 --- a/administrator/components/com_menus/models/forms/filter_items.xml +++ b/administrator/components/com_menus/models/forms/filter_items.xml @@ -6,7 +6,9 @@ label="COM_MENUS_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" onchange="this.form.submit();" - /> + > + + JSTATUS_DESC + + diff --git a/administrator/components/com_menus/models/forms/item.xml b/administrator/components/com_menus/models/forms/item.xml index 8ba474d827bdb..290acb27a6c8d 100644 --- a/administrator/components/com_menus/models/forms/item.xml +++ b/administrator/components/com_menus/models/forms/item.xml @@ -56,7 +56,10 @@ label="COM_MENUS_ITEM_FIELD_ASSIGNED_LABEL" description="COM_MENUS_ITEM_FIELD_ASSIGNED_DESC" required="true" - size="1" /> + size="1" + > + + getUserState($this->context . '.menutype'); - - if (!$menuType) - { - $menuType = $this->getDefaultMenuType(); - } + $app->setUserState($this->context . '.menutype', ''); } $this->setState('filter.menutype', $menuType); @@ -162,29 +157,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. * diff --git a/administrator/components/com_menus/views/items/tmpl/default.php b/administrator/components/com_menus/views/items/tmpl/default.php index b418fdaaaa556..790c604b0188a 100644 --- a/administrator/components/com_menus/views/items/tmpl/default.php +++ b/administrator/components/com_menus/views/items/tmpl/default.php @@ -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); @@ -56,9 +57,11 @@ - + + + @@ -68,6 +71,9 @@ + @@ -133,26 +139,28 @@ } ?> - + if (!$canChange) + { + $iconClass = ' inactive'; + } + elseif (!$saveOrder) + { + $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + + + + + @@ -187,6 +195,9 @@ escape($item->item_type); ?> +
- - + + + +
- + + - - - - - - - id); ?> + escape($item->menutype); ?> + type == 'component') : ?> language == '*' || $item->home == '0') : ?> diff --git a/administrator/components/com_menus/views/items/tmpl/default_batch_body.php b/administrator/components/com_menus/views/items/tmpl/default_batch_body.php index d049812194527..43f3f963e9bd6 100644 --- a/administrator/components/com_menus/views/items/tmpl/default_batch_body.php +++ b/administrator/components/com_menus/views/items/tmpl/default_batch_body.php @@ -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'); ?> - -
-
-
- -
-
-
-
- -
-
-
-
- = 0) : ?> -
- + +
+
- +
-
- - +
+
+ +
- -
\ No newline at end of file +
+
+ = 0) : ?> +
+ +
+ +
+
+
+ + +
+ +
+ +
+

+
+ diff --git a/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php b/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php index b891924f71289..8c7355e555907 100644 --- a/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php +++ b/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php @@ -8,10 +8,13 @@ */ defined('_JEXEC') or die; +$menuType = (array) JFactory::getApplication()->getUserState('com_menus.items.menutype'); ?> - \ No newline at end of file + + + diff --git a/administrator/components/com_menus/views/items/view.html.php b/administrator/components/com_menus/views/items/view.html.php index f13fc5ac9d77f..79f8d8055672f 100644 --- a/administrator/components/com_menus/views/items/view.html.php +++ b/administrator/components/com_menus/views/items/view.html.php @@ -245,7 +245,14 @@ protected function addToolbar() // Get the toolbar object instance $bar = JToolbar::getInstance('toolbar'); - JToolbarHelper::title(JText::sprintf('COM_MENUS_VIEW_ITEMS_MENU_TITLE', $menuTypeTitle), 'list menumgr'); + if ($menuTypeTitle) + { + JToolbarHelper::title(JText::sprintf('COM_MENUS_VIEW_ITEMS_MENU_TITLE', $menuTypeTitle), 'list menumgr'); + } + else + { + JToolbarHelper::title(JText::_('COM_MENUS_VIEW_ITEMS_ALL_TITLE'), 'list menumgr'); + } if ($canDo->get('core.create')) { diff --git a/administrator/language/en-GB/en-GB.com_menus.ini b/administrator/language/en-GB/en-GB.com_menus.ini index ce28583a05bb3..f86c13a9cd37b 100644 --- a/administrator/language/en-GB/en-GB.com_menus.ini +++ b/administrator/language/en-GB/en-GB.com_menus.ini @@ -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" @@ -160,6 +163,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." @@ -181,6 +186,7 @@ COM_MENUS_TYPE_UNEXISTING="Component '%s' does not exist." COM_MENUS_TYPE_UNKNOWN="Unknown" COM_MENUS_VIEW_EDIT_ITEM_TITLE="Menus: Edit Item" COM_MENUS_VIEW_EDIT_MENU_TITLE="Menus: Edit" +COM_MENUS_VIEW_ITEMS_ALL_TITLE="Menus: All Menu Items" COM_MENUS_VIEW_ITEMS_MENU_TITLE="Menus: Items (%s)" COM_MENUS_VIEW_ITEMS_TITLE="Menus: Items" COM_MENUS_VIEW_MENUS_TITLE="Menus" diff --git a/administrator/language/en-GB/en-GB.mod_menu.ini b/administrator/language/en-GB/en-GB.mod_menu.ini index a769f3ca1f8f8..97f354ea2f3d0 100644 --- a/administrator/language/en-GB/en-GB.mod_menu.ini +++ b/administrator/language/en-GB/en-GB.mod_menu.ini @@ -74,6 +74,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" diff --git a/administrator/modules/mod_menu/tmpl/default_enabled.php b/administrator/modules/mod_menu/tmpl/default_enabled.php index a9e6aabc3a43c..50fa95ea88960 100644 --- a/administrator/modules/mod_menu/tmpl/default_enabled.php +++ b/administrator/modules/mod_menu/tmpl/default_enabled.php @@ -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);