diff --git a/README.md b/README.md index 191c05c05..465b40c9e 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time. -Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! +Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.11.7) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.2) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -133,7 +133,6 @@ Get involved on the forums, and the GitHub issues, and you can even help us deve TODO ====== -- Add automatic (REST) API ability for all components build with [JCB](http://joomlacomponentbuilder.com). So we can link any component build with JCB to an Android/Apple APP. - Add automatic unit testing. To nurture pipeline integration for all components build with [JCB](http://joomlacomponentbuilder.com). - Team collaborative development across [JCB](http://joomlacomponentbuilder.com) installations offline and online. - Documentation (maintained by the community) for [JCB](http://joomlacomponentbuilder.com). (help us select the best system for this) @@ -144,20 +143,21 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 29th October, 2020 -+ *Version*: 2.11.7 ++ *Last Build*: 12th December, 2020 ++ *Version*: 2.12.2 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **283847** -+ *Field count*: **1536** -+ *File count*: **1799** -+ *Folder count*: **304** ++ *Line count*: **290479** ++ *Field count*: **1555** ++ *File count*: **1923** ++ *Folder count*: **316** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + ## Contributors -This project exists thanks to all the people who contribute. +This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder). [![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors) @@ -178,4 +178,15 @@ Support this project by becoming a sponsor. Your logo will show up here with a l [![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website) [![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website) [![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website) \ No newline at end of file +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website) \ No newline at end of file diff --git a/admin/README.txt b/admin/README.txt index 191c05c05..465b40c9e 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -10,9 +10,9 @@ This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time. -Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! +Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.11.7) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.12.2) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -133,7 +133,6 @@ Get involved on the forums, and the GitHub issues, and you can even help us deve TODO ====== -- Add automatic (REST) API ability for all components build with [JCB](http://joomlacomponentbuilder.com). So we can link any component build with JCB to an Android/Apple APP. - Add automatic unit testing. To nurture pipeline integration for all components build with [JCB](http://joomlacomponentbuilder.com). - Team collaborative development across [JCB](http://joomlacomponentbuilder.com) installations offline and online. - Documentation (maintained by the community) for [JCB](http://joomlacomponentbuilder.com). (help us select the best system for this) @@ -144,20 +143,21 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 29th October, 2020 -+ *Version*: 2.11.7 ++ *Last Build*: 12th December, 2020 ++ *Version*: 2.12.2 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **283847** -+ *Field count*: **1536** -+ *File count*: **1799** -+ *Folder count*: **304** ++ *Line count*: **290479** ++ *Field count*: **1555** ++ *File count*: **1923** ++ *Folder count*: **316** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + ## Contributors -This project exists thanks to all the people who contribute. +This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder). [![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors) @@ -178,4 +178,15 @@ Support this project by becoming a sponsor. Your logo will show up here with a l [![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website) [![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website) [![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website) -[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website) \ No newline at end of file +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website) +[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website) \ No newline at end of file diff --git a/admin/compiler/SD.txt b/admin/compiler/SD.txt index 0a97f920d..b48b1bc6c 100644 --- a/admin/compiler/SD.txt +++ b/admin/compiler/SD.txt @@ -16,7 +16,7 @@ @author ###AUTHOR### <###AUTHORWEBSITE###>###CONTRIBUTORS### @copyright ###COPYRIGHT### @license ###LICENSE### - + ###SHORT_DESCRIPTION### - + /----------------------------------------------------------------------------------------------------------------------------------*/ \ No newline at end of file diff --git a/admin/compiler/joomla_3/JModelList.php b/admin/compiler/joomla_3/JModelList.php index dda6a9d10..3eda45328 100644 --- a/admin/compiler/joomla_3/JModelList.php +++ b/admin/compiler/joomla_3/JModelList.php @@ -35,11 +35,17 @@ class ###Component###Model###Views### extends JModelList parent::__construct($config); }###ADMIN_CUSTOM_BUTTONS_METHOD_LIST### - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -49,26 +55,7 @@ class ###Component###Model###Views### extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - ###POPULATESTATE### - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + }###POPULATESTATE### // List state information. parent::populateState($ordering, $direction); diff --git a/admin/compiler/joomla_3/JViewLegacy_edit_site.php b/admin/compiler/joomla_3/JViewLegacy_edit_site.php index 1877dbec6..7570483d1 100644 --- a/admin/compiler/joomla_3/JViewLegacy_edit_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_edit_site.php @@ -82,10 +82,7 @@ class ###Component###View###View### extends JViewLegacy * Setting the toolbar */ protected function addToolBar() - { - // adding the joomla edit toolbar to the front - JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php'); - ###ADDTOOLBAR### + {###ADDTOOLBAR### // now initiate the toolbar $this->toolbar = JToolbar::getInstance(); } diff --git a/admin/compiler/joomla_3/JViewLegacy_list.php b/admin/compiler/joomla_3/JViewLegacy_list.php index e05449944..be06c75cb 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list.php +++ b/admin/compiler/joomla_3/JViewLegacy_list.php @@ -39,7 +39,7 @@ class ###Component###View###Views### extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser();###ADMIN_DIPLAY_METHOD### - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -139,40 +139,7 @@ class ###Component###View###Views### extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_###component###'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); - }###CATEGORYFILTER######OTHERFILTERS### + }###FILTERFIELDDISPLAYHELPER######BATCHDISPLAYHELPER### } /** diff --git a/admin/compiler/joomla_3/JViewLegacy_list_site.php b/admin/compiler/joomla_3/JViewLegacy_list_site.php index d63dcb54b..e181b7617 100644 --- a/admin/compiler/joomla_3/JViewLegacy_list_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_list_site.php @@ -46,9 +46,7 @@ class ###Component###View###SViews### extends JViewLegacy * Setting the toolbar */ protected function addToolBar() - { - // adding the joomla toolbar to the front - JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php');###SITE_CUSTOM_BUTTONS### + {###SITE_CUSTOM_BUTTONS### // set help url for this view if found $help_url = ###Component###Helper::getHelpUrl('###sviews###'); diff --git a/admin/compiler/joomla_3/JViewLegacy_site.php b/admin/compiler/joomla_3/JViewLegacy_site.php index 868d7c8ae..d698d97fc 100644 --- a/admin/compiler/joomla_3/JViewLegacy_site.php +++ b/admin/compiler/joomla_3/JViewLegacy_site.php @@ -46,9 +46,7 @@ class ###Component###View###SView### extends JViewLegacy * Setting the toolbar */ protected function addToolBar() - { - // adding the joomla toolbar to the front - JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php');###SITE_CUSTOM_BUTTONS### + {###SITE_CUSTOM_BUTTONS### // set help url for this view if found $help_url = ###Component###Helper::getHelpUrl('###sview###'); diff --git a/admin/compiler/joomla_3/default.php b/admin/compiler/joomla_3/default.php index b93d04e3f..1e16e1573 100644 --- a/admin/compiler/joomla_3/default.php +++ b/admin/compiler/joomla_3/default.php @@ -17,74 +17,11 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); ###LICENSE_LOCKED_DEFINED### -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); - +###ADMIN_VIEWS_HEADER### if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_###component###&task=###views###.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', '###view###List', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_###COMPONENT###_###VIEWS###_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - -###VIEWS_FOOTER_SCRIPT### \ No newline at end of file +###VIEWS_DEFAULT_BODY######VIEWS_FOOTER_SCRIPT### diff --git a/admin/compiler/joomla_3/default_custom_admin.php b/admin/compiler/joomla_3/default_custom_admin.php index d3c514504..c8aa64812 100644 --- a/admin/compiler/joomla_3/default_custom_admin.php +++ b/admin/compiler/joomla_3/default_custom_admin.php @@ -15,13 +15,9 @@ defined('_JEXEC') or die('Restricted access'); ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_CODE_BODY### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +###CUSTOM_ADMIN_VIEW_HEADER######CUSTOM_ADMIN_CODE_BODY### ?> canDo->get('###sview###.access')): ?>###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT### item->id)) ? '&id='. (int) $this->item->id : ''; ?> diff --git a/admin/compiler/joomla_3/default_list_custom_admin.php b/admin/compiler/joomla_3/default_list_custom_admin.php index 038a79cba..a2a73271c 100644 --- a/admin/compiler/joomla_3/default_list_custom_admin.php +++ b/admin/compiler/joomla_3/default_list_custom_admin.php @@ -15,13 +15,9 @@ defined('_JEXEC') or die('Restricted access'); ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######CUSTOM_ADMIN_CODE_BODY### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +###CUSTOM_ADMIN_VIEWS_HEADER######CUSTOM_ADMIN_CODE_BODY### ?> canDo->get('###sview###.access')): ?>###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT### ###CUSTOM_ADMIN_TOP_FORM######CUSTOM_ADMIN_BODY######CUSTOM_ADMIN_BOTTOM_FORM### diff --git a/admin/compiler/joomla_3/default_list_site.php b/admin/compiler/joomla_3/default_list_site.php index 758f184c3..f3d2191fc 100644 --- a/admin/compiler/joomla_3/default_list_site.php +++ b/admin/compiler/joomla_3/default_list_site.php @@ -15,7 +15,8 @@ defined('_JEXEC') or die('Restricted access'); ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_CODE_BODY### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +###SITE_VIEWS_HEADER######SITE_CODE_BODY### ?> ###SITE_TOP_FORM######SITE_TOP_BUTTON######SITE_BODY######SITE_BOTTOM_BUTTON######SITE_BOTTOM_FORM### diff --git a/admin/compiler/joomla_3/default_site.php b/admin/compiler/joomla_3/default_site.php index 758f184c3..8d0338477 100644 --- a/admin/compiler/joomla_3/default_site.php +++ b/admin/compiler/joomla_3/default_site.php @@ -15,7 +15,8 @@ defined('_JEXEC') or die('Restricted access'); ###BOM### // No direct access to this file -defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED######SITE_CODE_BODY### +defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED### +###SITE_VIEW_HEADER######SITE_CODE_BODY### ?> ###SITE_TOP_FORM######SITE_TOP_BUTTON######SITE_BODY######SITE_BOTTOM_BUTTON######SITE_BOTTOM_FORM### diff --git a/admin/compiler/joomla_3/edit.php b/admin/compiler/joomla_3/edit.php index 8e87bf81a..ed1e7f0f5 100644 --- a/admin/compiler/joomla_3/edit.php +++ b/admin/compiler/joomla_3/edit.php @@ -17,11 +17,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); +###ADMIN_VIEW_HEADER### $componentParams = $this->params; // will be removed just use $this->params instead ?> ###EDITBODYFADEIN### diff --git a/admin/compiler/joomla_3/edit_site.php b/admin/compiler/joomla_3/edit_site.php index 17f2e9277..c8c04e44e 100644 --- a/admin/compiler/joomla_3/edit_site.php +++ b/admin/compiler/joomla_3/edit_site.php @@ -17,13 +17,7 @@ defined('_JEXEC') or die('Restricted access'); // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tabstate'); -JHtml::_('behavior.calendar'); +###SITE_ADMIN__VIEW_HEADER### ?>
toolbar->render(); ?> diff --git a/admin/compiler/joomla_3/filter_forms.xml b/admin/compiler/joomla_3/filter_forms.xml new file mode 100644 index 000000000..c1a539eff --- /dev/null +++ b/admin/compiler/joomla_3/filter_forms.xml @@ -0,0 +1,9 @@ + +
+###FIELDFILTERSETS### + +###FIELDLISTSETS### +
\ No newline at end of file diff --git a/admin/compiler/joomla_3/install.mysql.utf8.sql b/admin/compiler/joomla_3/install.mysql.utf8.sql index 520b17a19..50bd3de50 100644 --- a/admin/compiler/joomla_3/install.mysql.utf8.sql +++ b/admin/compiler/joomla_3/install.mysql.utf8.sql @@ -1,11 +1 @@ ###INSTALL### - --- --- Always insure this column rules is large enough for all the access control values. --- -ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.'; - --- --- Always insure this column name is large enough for long component and view names. --- -ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.'; diff --git a/admin/compiler/joomla_3/settings.json b/admin/compiler/joomla_3/settings.json index 748bc7e17..13321c9f9 100644 --- a/admin/compiler/joomla_3/settings.json +++ b/admin/compiler/joomla_3/settings.json @@ -269,6 +269,11 @@ "rename": false, "type": "dashboard" }, + "filter_forms.xml": { + "path": "c0mp0n3nt/admin/models/forms", + "rename": "filter_forms", + "type": "filter" + }, "module_forms.xml": { "path": "c0mp0n3nt/admin/models/forms", "rename": "module_forms", diff --git a/admin/compiler/joomla_3/uninstall.mysql.utf8.sql b/admin/compiler/joomla_3/uninstall.mysql.utf8.sql index 568025694..b8b61a080 100644 --- a/admin/compiler/joomla_3/uninstall.mysql.utf8.sql +++ b/admin/compiler/joomla_3/uninstall.mysql.utf8.sql @@ -1 +1 @@ -###UNINSTALL### \ No newline at end of file +###UNINSTALL### diff --git a/admin/config.xml b/admin/config.xml index e2395cdff..e1e80d6fe 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -122,16 +122,6 @@ folder="editors" filter="cmd" /> - - - - - - - - - - - - - - - - - - - - COM_COMPONENTBUILDER_CONFIG_NEVER_UPDATE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/admin/controllers/admin_views.php b/admin/controllers/admin_views.php index bb3825f81..4f9562d3a 100644 --- a/admin/controllers/admin_views.php +++ b/admin/controllers/admin_views.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerAdmin_views extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Admin_views'); // get the data to export diff --git a/admin/controllers/class_methods.php b/admin/controllers/class_methods.php index 709f69dd7..77fc19054 100644 --- a/admin/controllers/class_methods.php +++ b/admin/controllers/class_methods.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerClass_methods extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Class_methods'); // get the data to export diff --git a/admin/controllers/class_properties.php b/admin/controllers/class_properties.php index f55e8a472..ee06679a2 100644 --- a/admin/controllers/class_properties.php +++ b/admin/controllers/class_properties.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerClass_properties extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Class_properties'); // get the data to export diff --git a/admin/controllers/custom_admin_views.php b/admin/controllers/custom_admin_views.php index aa3a2def6..895d90bf1 100644 --- a/admin/controllers/custom_admin_views.php +++ b/admin/controllers/custom_admin_views.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerCustom_admin_views extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Custom_admin_views'); // get the data to export diff --git a/admin/controllers/custom_codes.php b/admin/controllers/custom_codes.php index 8fd2baf75..69416ba32 100644 --- a/admin/controllers/custom_codes.php +++ b/admin/controllers/custom_codes.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerCustom_codes extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Custom_codes'); // get the data to export diff --git a/admin/controllers/dynamic_gets.php b/admin/controllers/dynamic_gets.php index 8f2779626..b12db48b1 100644 --- a/admin/controllers/dynamic_gets.php +++ b/admin/controllers/dynamic_gets.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerDynamic_gets extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Dynamic_gets'); // get the data to export diff --git a/admin/controllers/fields.php b/admin/controllers/fields.php index 333d6c2a3..37aa93fb9 100644 --- a/admin/controllers/fields.php +++ b/admin/controllers/fields.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerFields extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Fields'); // get the data to export diff --git a/admin/controllers/fieldtypes.php b/admin/controllers/fieldtypes.php index b3f11562c..9ab64e184 100644 --- a/admin/controllers/fieldtypes.php +++ b/admin/controllers/fieldtypes.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerFieldtypes extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Fieldtypes'); // get the data to export diff --git a/admin/controllers/help_documents.php b/admin/controllers/help_documents.php index 1fd855f42..c196281df 100644 --- a/admin/controllers/help_documents.php +++ b/admin/controllers/help_documents.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerHelp_documents extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Help_documents'); // get the data to export diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index 6dae9b775..40f89410c 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Joomla_components'); // get the data to export @@ -391,7 +391,7 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin $subject = JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY'); // email the message componentbuilderEmail::send($email, $subject, componentbuilderEmail::setTableBody($message, $subject), $plainText, 1); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND'); + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT'); } else { diff --git a/admin/controllers/language_translations.php b/admin/controllers/language_translations.php index 63f63c677..707f1fa8a 100644 --- a/admin/controllers/language_translations.php +++ b/admin/controllers/language_translations.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerLanguage_translations extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Language_translations'); // get the data to export diff --git a/admin/controllers/languages.php b/admin/controllers/languages.php index 4a5f9527c..122219384 100644 --- a/admin/controllers/languages.php +++ b/admin/controllers/languages.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerLanguages extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Languages'); // get the data to export diff --git a/admin/controllers/layouts.php b/admin/controllers/layouts.php index 5c46d7201..4cffcf47b 100644 --- a/admin/controllers/layouts.php +++ b/admin/controllers/layouts.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerLayouts extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Layouts'); // get the data to export diff --git a/admin/controllers/placeholders.php b/admin/controllers/placeholders.php index 7e1cedf00..d42263160 100644 --- a/admin/controllers/placeholders.php +++ b/admin/controllers/placeholders.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerPlaceholders extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Placeholders'); // get the data to export diff --git a/admin/controllers/servers.php b/admin/controllers/servers.php index c2dce20e0..c1d011ba4 100644 --- a/admin/controllers/servers.php +++ b/admin/controllers/servers.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerServers extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Servers'); // get the data to export diff --git a/admin/controllers/site_views.php b/admin/controllers/site_views.php index e85fe2e21..0054fd1c4 100644 --- a/admin/controllers/site_views.php +++ b/admin/controllers/site_views.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerSite_views extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Site_views'); // get the data to export diff --git a/admin/controllers/snippets.php b/admin/controllers/snippets.php index 649f3270a..d3b64683a 100644 --- a/admin/controllers/snippets.php +++ b/admin/controllers/snippets.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerSnippets extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Snippets'); // get the data to export diff --git a/admin/controllers/templates.php b/admin/controllers/templates.php index 5557a929f..4da43d674 100644 --- a/admin/controllers/templates.php +++ b/admin/controllers/templates.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerTemplates extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Templates'); // get the data to export diff --git a/admin/controllers/validation_rules.php b/admin/controllers/validation_rules.php index f99585aaf..4807eaa6d 100644 --- a/admin/controllers/validation_rules.php +++ b/admin/controllers/validation_rules.php @@ -55,7 +55,7 @@ class ComponentbuilderControllerValidation_rules extends JControllerAdmin $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input - ArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Validation_rules'); // get the data to export diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index abc8c4c5c..43cefb508 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -190,13 +190,69 @@ class Compiler extends Infusion { $this->app->enqueueMessage( JText::sprintf( - 'The %s language has %s% translated. Was addeded %s', + 'The %s language has %s% translated. Was added %s', $tag, $percentage, $whyAddedLang ), 'Notice' ); } } } + // set assets table column fix type messages + $message_fix['intelligent'] = JText::_( + 'The intelligent fix only updates the #__assets table\'s column when it detects that it is too small for the worse case. The intelligent fix also only reverse the #__assets table\'s update on uninstall of the component if it detects that no other component needs the rules column to be larger any longer. This options also shows a notice to the end user of all that it does to the #__assets table on installation and uninstalling of the component.' + ); + $message_fix['sql'] = JText::_( + 'The SQL fix updates the #__assets table\'s column size on installation of the component and reverses it back to the Joomla default on uninstall of the component.' + ); + // set assets table rules column notice + if ($this->addAssetsTableFix) + { + $this->app->enqueueMessage( + JText::_('

Assets Table Notice

'), 'Notice' + ); + $asset_table_fix_type = ($this->addAssetsTableFix == 2) + ? 'intelligent' : 'sql'; + $this->app->enqueueMessage( + JText::sprintf( + 'The #__assets table %s fix has been added to this component. %s', + $asset_table_fix_type, + $message_fix[$asset_table_fix_type] + ), 'Notice' + ); + } + // set assets table rules column Warning + elseif ($this->accessSize >= 30) + { + $this->app->enqueueMessage( + JText::_('

Assets Table Warning

'), 'Warning' + ); + $this->app->enqueueMessage( + JText::sprintf( + 'The Joomla #__assets table\'s rules column has to be fixed for this component to work coherently. JCB has detected that in worse case the rules column in the #__assets table may require %s characters, and yet the Joomla default is only varchar(5120). JCB has three option to resolve this issue, first use less permissions in your component, second use the SQL fix, or the intelligent fix. %s %s', + $this->accessWorseCase, $message_fix['intelligent'], + $message_fix['sql'] + ), 'Warning' + ); + } + // set assets table name column warning if not set + if (!$this->addAssetsTableFix && $this->addAssetsTableNameFix) + { + // only add if not already added + if ($this->accessSize < 30) + { + $this->app->enqueueMessage( + JText::_('

Assets Table Warning

'), + 'Warning' + ); + } + $this->app->enqueueMessage( + JText::sprintf( + 'The Joomla #__assets table\'s name column has to be fixed for this component to work correctly. JCB has detected that the #__assets table name column will need to be enlarged because this component\'s own naming convention is larger than varchar(50) which is the Joomla default. JCB has three option to resolve this issue, first shorter names for your component and/or its admin views, second use the SQL fix, or the intelligent fix. %s %s', + $message_fix['intelligent'], + $message_fix['sql'] + ), 'Warning' + ); + } // move the update server into place $this->setUpdateServer(); // set the global counters diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 17ae26cbe..30339c415 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -95,6 +95,27 @@ class Get */ public $compilerPath; + /** + * Switch to add assets table fix + * + * @var int + */ + public $addAssetsTableFix = 1; + + /** + * Assets table worse case + * + * @var int + */ + public $accessWorseCase; + + /** + * Switch to add assets table name fix + * + * @var bool + */ + public $addAssetsTableNameFix = false; + /** * Switch to add custom code placeholders * @@ -341,6 +362,13 @@ class Get */ public $componentCodeName; + /** + * The Component Code Name Length + * + * @var int + */ + public $componentCodeNameLength; + /** * The Component ID * @@ -453,6 +481,13 @@ class Get */ public $siteEditView = array(); + /** + * The admin list view filter type + * + * @var array + */ + public $adminFilterType = array(); + /** * The Language target * @@ -822,7 +857,8 @@ class Get if (isset($config) && count($config)) { // we do not yet have this set as an option - $config['remove_line_breaks'] = 2; // 2 is global (use the components value) + $config['remove_line_breaks'] + = 2; // 2 is global (use the components value) // load application $this->app = JFactory::getApplication(); // Set the params @@ -900,14 +936,29 @@ class Get // set component context $this->componentContext = $this->componentCodeName . '.' . $this->componentID; + // set the component name length + $this->componentCodeNameLength = strlen( + $this->componentCodeName + ); + // add assets table fix + $global = (int) $this->params->get( + 'assets_table_fix', 1 + ); + $this->addAssetsTableFix = (($add_assets_table_fix + = (int) ComponentbuilderHelper::getVar( + 'joomla_component', $this->componentID, 'id', + 'assets_table_fix' + )) == 3) ? $global : $add_assets_table_fix; // set if language strings line breaks should be removed - $global = ((int) ComponentbuilderHelper::getVar( + $global = ((int) ComponentbuilderHelper::getVar( 'joomla_component', $this->componentID, 'id', 'remove_line_breaks' ) == 1) ? true : false; - $this->removeLineBreaks = ((int) $config['remove_line_breaks'] == 0) + $this->removeLineBreaks = ((int) $config['remove_line_breaks'] + == 0) ? false - : (((int) $config['remove_line_breaks'] == 1) ? true : $global); + : (((int) $config['remove_line_breaks'] == 1) ? true + : $global); // set if placeholders should be added to customcode $global = ((int) ComponentbuilderHelper::getVar( 'joomla_component', $this->componentID, 'id', @@ -1477,16 +1528,19 @@ class Get $this->siteEditView[$array['adminview']] = true; $this->lang = 'both'; } + // set the import/export option for this view if (isset($array['port']) && $array['port'] && !$this->addEximport) { $this->addEximport = true; } + // set the history tracking option for this view if (isset($array['history']) && $array['history'] && !$this->setTagHistory) { $this->setTagHistory = true; } + // set the custom field integration for this view if (isset($array['joomla_fields']) && $array['joomla_fields'] && !$this->setJoomlaFields) @@ -1499,6 +1553,18 @@ class Get $array['settings'] = $this->getAdminViewData( $array['view'] ); + // set the filter option for this view + $this->adminFilterType[$array['settings']->name_list_code] + = 1; // Side (old) [default for now] + if (isset($array['filter']) + && is_numeric( + $array['filter'] + ) + && $array['filter'] > 0) + { + $this->adminFilterType[$array['settings']->name_list_code] + = (int) $array['filter']; + } return $array; }, array_values($component->addadmin_views) @@ -2080,14 +2146,16 @@ class Get } elseif (!isset($this->langContent[$target][$language])) { - $this->langContent[$target][$language] = $this->fixLangString($string); + $this->langContent[$target][$language] = $this->fixLangString( + $string + ); } } /** * We need to remove all text breaks from all language strings * - * @param string $string The language string + * @param string $string The language string * * @return string * @@ -2098,6 +2166,7 @@ class Get { return trim(str_replace(array(PHP_EOL, "\r", "\n"), '', $string)); } + return trim($string); } @@ -2175,13 +2244,35 @@ class Get // Load the results as a list of stdClass objects (see later for more options on retrieving data). $view = $this->db->loadObject(); - // setup view name to use in storing the data - $name_single = ComponentbuilderHelper::safeString( - $view->name_single - ); - $name_list = ComponentbuilderHelper::safeString($view->name_list); + // setup single view code names to use in storing the data + $view->name_single_code = 'oops_hmm_' . $id; + if (isset($view->name_single) && $view->name_single != 'null') + { + $view->name_single_code = ComponentbuilderHelper::safeString( + $view->name_single + ); + } - // set upater + // setup list view code name to use in storing the data + $view->name_list_code = 'oops_hmmm_' . $id; + if (isset($view->name_list) && $view->name_list != 'null') + { + $view->name_list_code = ComponentbuilderHelper::safeString( + $view->name_list + ); + } + + // check the length of the view name (+5 for com_ and _) + $name_length = $this->componentCodeNameLength + strlen( + $view->name_single_code + ) + 5; + // when the name is larger then 49 we need to add the assets table name fix + if ($name_length > 49) + { + $this->addAssetsTableNameFix = true; + } + + // set updater $updater = array( 'unique' => array( 'addfields' => array('table' => 'admin_fields', @@ -2217,32 +2308,29 @@ class Get { $this->customScriptBuilder['token'] = array(); } - $this->customScriptBuilder['token'][$name_single] = false; - $this->customScriptBuilder['token'][$name_list] = false; + $this->customScriptBuilder['token'][$view->name_single_code] + = false; + $this->customScriptBuilder['token'][$view->name_list_code] = false; // set some placeholders $this->placeholders[$this->hhh . 'view' . $this->hhh] - = ComponentbuilderHelper::safeString( - $name_single - ); + = $view->name_single_code; $this->placeholders[$this->hhh . 'views' . $this->hhh] - = ComponentbuilderHelper::safeString( - $name_list - ); + = $view->name_list_code; $this->placeholders[$this->hhh . 'View' . $this->hhh] = ComponentbuilderHelper::safeString( - $name_single, 'F' + $view->name_single, 'F' ); $this->placeholders[$this->hhh . 'Views' . $this->hhh] = ComponentbuilderHelper::safeString( - $name_list, 'F' + $view->name_list, 'F' ); $this->placeholders[$this->hhh . 'VIEW' . $this->hhh] = ComponentbuilderHelper::safeString( - $name_single, 'U' + $view->name_single, 'U' ); $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh] = ComponentbuilderHelper::safeString( - $name_list, 'U' + $view->name_list, 'U' ); $this->placeholders[$this->bbb . 'view' . $this->ddd] = $this->placeholders[$this->hhh . 'view' . $this->hhh]; @@ -2274,17 +2362,18 @@ class Get unset($view->addtables); // set custom tabs - $this->customTabs[$name_single] = null; - $view->customtabs = (isset($view->customtabs) + $this->customTabs[$view->name_single_code] = null; + $view->customtabs + = (isset($view->customtabs) && ComponentbuilderHelper::checkJson($view->customtabs)) ? json_decode($view->customtabs, true) : null; if (ComponentbuilderHelper::checkArray($view->customtabs)) { // setup custom tabs to global data sets - $this->customTabs[$name_single] = array_map( - function ($tab) use ($name_single) { + $this->customTabs[$view->name_single_code] = array_map( + function ($tab) use (&$view) { // set the view name - $tab['view'] = $name_single; + $tab['view'] = $view->name_single_code; // load the dynamic data $tab['html'] = $this->setPlaceholders( $this->setDynamicValues($tab['html']), @@ -2445,11 +2534,12 @@ class Get // load the field data $view->fields = array_map( function ($field) use ( - $name_single, $name_list, &$ignoreFields + &$view, &$ignoreFields ) { // set the field details $this->setFieldDetails( - $field, $name_single, $name_list + $field, $view->name_single_code, + $view->name_list_code ); // check if this field is a default field OR // check if this is none database related field @@ -2480,7 +2570,7 @@ class Get { $this->setUpdateSQL( json_decode($old_view->addfields, true), - $view->addfields, 'field', $name_single, + $view->addfields, 'field', $view->name_single_code, $ignoreFields ); } @@ -2515,7 +2605,9 @@ class Get foreach ($view->fields as $field) { // so first we lock the field name in - $field_name = $this->getFieldName($field, $name_list); + $field_name = $this->getFieldName( + $field, $view->name_list_code + ); // check if the field changed since the last compilation (default fields never change and are always added) if (!isset($ignoreFields[$field['field']]) && ComponentbuilderHelper::checkObject( @@ -2528,7 +2620,7 @@ class Get $this->setUpdateSQL( $field['settings']->history->datatype, $field['settings']->datatype, 'field.datatype', - $name_single . '.' . $field_name + $view->name_single_code . '.' . $field_name ); } // check if the datatype lenght changed @@ -2540,7 +2632,8 @@ class Get . $field['settings']->history->datalenght_other, $field['settings']->datalenght . $field['settings']->datalenght_other, - 'field.lenght', $name_single . '.' . $field_name + 'field.lenght', + $view->name_single_code . '.' . $field_name ); } // check if the name changed @@ -2578,13 +2671,14 @@ class Get ); // only run this if not a multi field - if (!isset($this->uniqueNames[$name_list]['names'][$field_name])) + if (!isset($this->uniqueNames[$view->name_list_code]['names'][$field_name])) { // this only works when the field is not multiple of the same field $this->setUpdateSQL( $old_field_name, $field_name, 'field.name', - $name_single . '.' . $field_name + $view->name_single_code . '.' + . $field_name ); } elseif ($old_field_name !== $field_name) @@ -2597,7 +2691,8 @@ class Get $this->app->enqueueMessage( JText::sprintf( 'You have a field called %s that has been added multiple times to the %s view, the name of that field has changed to %s. Normaly we would automaticly add the update SQL to your component, but with multiple fields this does not work automaticly since it could be that noting changed and it just seems like it did. Therefore you will have to do this manualy if it actualy did change!', - $field_name, $name_single, + $field_name, + $view->name_single_code, $old_field_name ), 'Notice' ); @@ -2619,7 +2714,8 @@ class Get $this->setUpdateSQL( ComponentbuilderHelper::safeString( $old_view->name_single - ), $name_single, 'table_name', $name_single + ), $view->name_single_code, 'table_name', + $view->name_single_code ); } // loop the mysql table settings @@ -2634,7 +2730,7 @@ class Get $this->setUpdateSQL( $old_view->{'mysql_table_' . $_mysqlTableKey}, $view->{'mysql_table_' . $_mysqlTableKey}, - 'table_' . $_mysqlTableKey, $name_single + 'table_' . $_mysqlTableKey, $view->name_single_code ); } // check if there is no history on table engine, and it changed from the default/global @@ -2649,7 +2745,7 @@ class Get $this->setUpdateSQL( $_mysqlTableVal['default'], $view->{'mysql_table_' . $_mysqlTableKey}, - 'table_' . $_mysqlTableKey, $name_single + 'table_' . $_mysqlTableKey, $view->name_single_code ); } } @@ -2702,7 +2798,7 @@ class Get $conditionValue['target_field'][$fieldKey] = array( 'name' => $this->getFieldName( - $fieldValues, $name_list + $fieldValues, $view->name_list_code ), 'type' => $this->getFieldType( $fieldValues @@ -2730,7 +2826,7 @@ class Get // set the field details $conditionValue['match_name'] = $this->getFieldName( - $fieldValue, $name_list + $fieldValue, $view->name_list_code ); $conditionValue['match_type'] = $type; $conditionValue['match_xml'] @@ -2760,9 +2856,9 @@ class Get unset($view->addconditions); // prep the buckets - $this->fieldRelations[$name_list] = array(); - $this->listJoinBuilder[$name_list] = array(); - $this->listHeadOverRide[$name_list] = array(); + $this->fieldRelations[$view->name_list_code] = array(); + $this->listJoinBuilder[$view->name_list_code] = array(); + $this->listHeadOverRide[$view->name_list_code] = array(); // set the relations $view->addrelations = (isset($view->addrelations) && ComponentbuilderHelper::checkJson($view->addrelations)) @@ -2792,16 +2888,16 @@ class Get ); } // check that the arrays are set - if (!isset($this->fieldRelations[$name_list][(int) $relationsValue['listfield']]) + if (!isset($this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']]) || !ComponentbuilderHelper::checkArray( - $this->fieldRelations[$name_list][(int) $relationsValue['listfield']] + $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']] )) { - $this->fieldRelations[$name_list][(int) $relationsValue['listfield']] + $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']] = array(); } // load the field relations - $this->fieldRelations[$name_list][(int) $relationsValue['listfield']][(int) $relationsValue['area']] + $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']][(int) $relationsValue['area']] = $relationsValue; // load the list joints if (isset($relationsValue['joinfields']) @@ -2811,7 +2907,7 @@ class Get { foreach ($relationsValue['joinfields'] as $join) { - $this->listJoinBuilder[$name_list][(int) $join] + $this->listJoinBuilder[$view->name_list_code][(int) $join] = (int) $join; } } @@ -2829,7 +2925,7 @@ class Get { $column_name_lang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString( - $name_list, 'U' + $view->name_list_code, 'U' ) . '_' . ComponentbuilderHelper::safeString( $relationsValue['column_name'], 'U' @@ -2838,7 +2934,7 @@ class Get 'admin', $column_name_lang, $relationsValue['column_name'] ); - $this->listHeadOverRide[$name_list][(int) $relationsValue['listfield']] + $this->listHeadOverRide[$view->name_list_code][(int) $relationsValue['listfield']] = $column_name_lang; } } @@ -2848,15 +2944,15 @@ class Get unset($view->addrelations); // set linked views - $this->linkedAdminViews[$name_single] = null; + $this->linkedAdminViews[$view->name_single_code] = null; $view->addlinked_views - = (isset($view->addlinked_views) + = (isset($view->addlinked_views) && ComponentbuilderHelper::checkJson($view->addlinked_views)) ? json_decode($view->addlinked_views, true) : null; if (ComponentbuilderHelper::checkArray($view->addlinked_views)) { // setup linked views to global data sets - $this->linkedAdminViews[$name_single] = array_values( + $this->linkedAdminViews[$view->name_single_code] = array_values( $view->addlinked_views ); } @@ -2890,7 +2986,7 @@ class Get $this->setCustomScriptBuilder( $view->{$scripter}, $scripter_target, - $name_single, + $view->name_single_code, false, $guiMapper, true, @@ -2903,9 +2999,9 @@ class Get $view->$scripter, "task=ajax" ) !== false) { - if (!$this->customScriptBuilder['token'][$name_single]) + if (!$this->customScriptBuilder['token'][$view->name_single_code]) { - $this->customScriptBuilder['token'][$name_single] + $this->customScriptBuilder['token'][$view->name_single_code] = true; } } @@ -2924,7 +3020,7 @@ class Get $this->setCustomScriptBuilder( $view->{$scripter}, $scripter, - $name_single, + $view->name_single_code, false, array('prefix' => PHP_EOL), true, @@ -2956,13 +3052,15 @@ class Get $this->setCustomScriptBuilder( $view->{$scripter}, $scripter, - $name_single, + $view->name_single_code, false, $guiMapper ); // check if we have template or layouts to load - $this->setTemplateAndLayoutData($view->{$scripter}, $name_single); + $this->setTemplateAndLayoutData( + $view->{$scripter}, $view->name_single_code + ); unset($view->{$scripter}); } @@ -2996,7 +3094,9 @@ class Get ); // check if we have template or layouts to load - $this->setTemplateAndLayoutData($view->{$button_code_field}, $name_single); + $this->setTemplateAndLayoutData( + $view->{$button_code_field}, $view->name_single_code + ); } } // set the button array @@ -3026,7 +3126,7 @@ class Get { // update GUI mapper field $guiMapper['field'] = $importScripter; - $guiMapper['type'] = 'php'; + $guiMapper['type'] = 'php'; // Make sure html gets HTML comment for placeholder if ('html_import_view' === $importScripter) { @@ -3035,7 +3135,7 @@ class Get $this->setCustomScriptBuilder( $view->$importScripter, $importScripter, - 'import_' . $name_list, + 'import_' . $view->name_list_code, false, $guiMapper ); @@ -3045,7 +3145,7 @@ class Get { // load the default $this->customScriptBuilder[$importScripter]['import_' - . $name_list] + . $view->name_list_code] = ComponentbuilderHelper::getDynamicScripts( $importScripter, true ); @@ -3056,8 +3156,9 @@ class Get if (isset($view->add_php_ajax) && $view->add_php_ajax == 1) { // insure the token is added to edit view atleast - $this->customScriptBuilder['token'][$name_single] = true; - $addAjaxSite = false; + $this->customScriptBuilder['token'][$view->name_single_code] + = true; + $addAjaxSite = false; if (isset($this->siteEditView[$id]) && $this->siteEditView[$id]) { // we should add this site ajax to front ajax @@ -3075,10 +3176,10 @@ class Get { if ($addAjaxSite) { - $this->customScriptBuilder['site']['ajax_controller'][$name_single] + $this->customScriptBuilder['site']['ajax_controller'][$view->name_single_code] = array_values($view->ajax_input); } - $this->customScriptBuilder['admin']['ajax_controller'][$name_single] + $this->customScriptBuilder['admin']['ajax_controller'][$view->name_single_code] = array_values($view->ajax_input); $this->addAjax = true; unset($view->ajax_input); @@ -3093,7 +3194,7 @@ class Get $view->php_ajaxmethod, 'admin', 'ajax_model', - $name_single, + $view->name_single_code, $guiMapper ); @@ -3103,7 +3204,7 @@ class Get $view->php_ajaxmethod, 'site', 'ajax_model', - $name_single, + $view->name_single_code, $guiMapper, false, false @@ -3115,7 +3216,7 @@ class Get } } // activate alias builder - if (!isset($this->customAliasBuilder[$name_single]) + if (!isset($this->customAliasBuilder[$view->name_single_code]) && isset($view->alias_builder_type) && 2 == $view->alias_builder_type && isset($view->alias_builder) @@ -3139,9 +3240,12 @@ class Get if (ComponentbuilderHelper::checkArray($alias_fields)) { // load the field names - $this->customAliasBuilder[$name_single] = (array) array_map( - function ($field) use ($name_list) { - return $this->getFieldName($field, $name_list); + $this->customAliasBuilder[$view->name_single_code] + = (array) array_map( + function ($field) use (&$view) { + return $this->getFieldName( + $field, $view->name_list_code + ); }, $alias_fields ); } @@ -3154,8 +3258,10 @@ class Get if ($view->source == 1 && isset($view->tables)) { // build and add the SQL dump - $this->customScriptBuilder['sql'][$name_single] - = $this->buildSqlDump($view->tables, $name_single, $id); + $this->customScriptBuilder['sql'][$view->name_single_code] + = $this->buildSqlDump( + $view->tables, $view->name_single_code, $id + ); unset($view->tables); } elseif ($view->source == 2 && isset($view->sql)) @@ -3164,15 +3270,15 @@ class Get $this->setCustomScriptBuilder( $view->sql, 'sql', - $name_single + $view->name_single_code ); unset($view->sql); } } // load table settings - if (!isset($this->mysqlTableSetting[$name_single])) + if (!isset($this->mysqlTableSetting[$view->name_single_code])) { - $this->mysqlTableSetting[$name_single] = array(); + $this->mysqlTableSetting[$view->name_single_code] = array(); } // set mySql Table Settings foreach ( @@ -3185,12 +3291,12 @@ class Get ) && !is_numeric($view->{'mysql_table_' . $_mysqlTableKey})) { - $this->mysqlTableSetting[$name_single][$_mysqlTableKey] + $this->mysqlTableSetting[$view->name_single_code][$_mysqlTableKey] = $view->{'mysql_table_' . $_mysqlTableKey}; } else { - $this->mysqlTableSetting[$name_single][$_mysqlTableKey] + $this->mysqlTableSetting[$view->name_single_code][$_mysqlTableKey] = $_mysqlTableVal['default']; } // remove the table values since we moved to another object @@ -3254,7 +3360,12 @@ class Get // Load the results as a list of stdClass objects (see later for more options on retrieving data). $view = $this->db->loadObject(); - + // fix alias to use in code + $view->code = $this->uniqueCode( + ComponentbuilderHelper::safeString($view->codename) + ); + $view->Code = ComponentbuilderHelper::safeString($view->code, 'F'); + $view->CODE = ComponentbuilderHelper::safeString($view->code, 'U'); // Trigger Event: jcb_ce_onBeforeModelCustomViewData $this->triggerEvent( 'jcb_ce_onBeforeModelCustomViewData', @@ -3300,12 +3411,6 @@ class Get $this->setDynamicValues(base64_decode($view->default)), $guiMapper ); - // fix alias to use in code - $view->code = $this->uniqueCode( - ComponentbuilderHelper::safeString($view->codename) - ); - $view->Code = ComponentbuilderHelper::safeString($view->code, 'F'); - $view->CODE = ComponentbuilderHelper::safeString($view->code, 'U'); // load context if not set if (!isset($view->context) || !ComponentbuilderHelper::checkString( @@ -3931,8 +4036,6 @@ class Get $this->_fieldData[$id]->css_view_decoded = true; } } - // add this only once to view. - $this->customFieldScript[$name_single][$id] = true; } // check if we should load scripts for list views if (ComponentbuilderHelper::checkString($name_list) @@ -4003,7 +4106,7 @@ class Get $this->setCustomScriptBuilder( $this->_fieldData[$id]->css_views, 'css_views', - $name_list, + $name_single, false, array('prefix' => PHP_EOL), $convert__, @@ -4015,10 +4118,11 @@ class Get $this->_fieldData[$id]->css_views_decoded = true; } } - - // add this only once to view. - $this->customFieldScript[$name_list][$id] = true; } + // add this only once to single view. + $this->customFieldScript[$name_single][$id] = true; + // add this only once to list view. + $this->customFieldScript[$name_list][$id] = true; } if ($id > 0 && isset($this->_fieldData[$id])) { @@ -4088,6 +4192,100 @@ class Get } } + /** + * get the list default ordering values + * + * @param string $nameListCode The list view name + * + * @return array + * + */ + public function getListViewDefaultOrdering(&$nameListCode) + { + if (isset($this->viewsDefaultOrdering[$nameListCode]) + && $this->viewsDefaultOrdering[$nameListCode]['add_admin_ordering'] + == 1) + { + foreach ( + $this->viewsDefaultOrdering[$nameListCode]['admin_ordering_fields'] + as $order_field + ) + { + if (($order_field_name = $this->getFieldDatabaseName( + $nameListCode, $order_field['field'] + )) !== false) + { + // just the first field is the based ordering state + return array( + 'name' => $order_field_name, + 'direction' => $order_field['direction'] + ); + } + } + } + + // the default + return array( + 'name' => 'a.id', + 'direction' => 'DESC' + ); + } + + /** + * get the field database name and AS prefix + * + * @param string $nameListCode The list view name + * @param int $fieldId The field ID + * @param string $targetArea The area being targeted + * + * @return string + * + */ + public function getFieldDatabaseName($nameListCode, int $fieldId, + $targetArea = 'listBuilder' + ) { + if (isset($this->{$targetArea}[$nameListCode])) + { + if ($fieldId < 0) + { + switch ($fieldId) + { + case -1: + return 'a.id'; + case -2: + return 'a.ordering'; + case -3: + return 'a.published'; + } + } + foreach ($this->{$targetArea}[$nameListCode] as $field) + { + if ($field['id'] == $fieldId) + { + // now check if this is a category + if ($field['type'] === 'category') + { + return 'c.title'; + } + // set the custom code + elseif (ComponentbuilderHelper::checkArray( + $field['custom'] + )) + { + return $field['custom']['db'] . "." + . $field['custom']['text']; + } + else + { + return 'a.' . $field['code']; + } + } + } + } + + return false; + } + /** * Get the field's actual type * @@ -5088,6 +5286,57 @@ class Get return false; } + /** + * get the a script from the custom script builder + * + * @param string $first The first key + * @param string $second The second key + * @param string $prefix The prefix to add in front of the script if found + * @param string $note The switch/note to add to the script + * @param bool $unset The switch to unset the value if found + * @param string $default The switch/string to use as default return if script not found + * @param string $sufix The sufix to add after the script if found + * + * @return mix The string/script if found or the default value if not found + * + */ + public function getCustomScriptBuilder($first, $second, $prefix = '', + $note = null, $unset = null, $default = null, $sufix = '' + ) { + // default is to return an empty string + $script = ''; + // check if there is any custom script + if (isset($this->customScriptBuilder[$first][$second]) + && ComponentbuilderHelper::checkString( + $this->customScriptBuilder[$first][$second] + )) + { + // add not if set + if ($note) + { + $script .= $note; + } + // load the actual script + $script .= $prefix . str_replace( + array_keys($this->placeholders), + array_values($this->placeholders), + $this->customScriptBuilder[$first][$second] + ) . $sufix; + // clear some memory + if ($unset) + { + unset($this->customScriptBuilder[$first][$second]); + } + } + // if not found return default + if (!ComponentbuilderHelper::checkString($script) && $default) + { + return $default; + } + + return $script; + } + /** * To limit the SQL Demo date build in the views * @@ -8552,7 +8801,7 @@ class Get $unique = $form['fields_name'] . $form['fieldset']; } - // set global fields rule path switchs + // set global fields rule path switches if ($module->fields_rules_paths == 1 && isset($form['fields_rules_paths']) && $form['fields_rules_paths'] == 2) @@ -8771,7 +9020,7 @@ class Get $addScriptTypes = array('install', 'update', 'uninstall'); // the next are php placeholders - $guiMapper['type'] = 'php'; + $guiMapper['type'] = 'php'; foreach ($addScriptMethods as $scriptMethod) { foreach ($addScriptTypes as $scriptType) @@ -8948,6 +9197,46 @@ class Get return $xml; } + /** + * get the module admin custom script field + * + * @return string + * + */ + public function getModAdminVvvvvvvdm($fieldScriptBucket) + { + $form_field_class = array(); + $form_field_class[] = $this->hhh . 'BOM' . $this->hhh . PHP_EOL; + $form_field_class[] = "//" . $this->setLine(__LINE__) + . " No direct access to this file"; + $form_field_class[] = "defined('_JEXEC') or die('Restricted access');"; + $form_field_class[] = PHP_EOL . "use Joomla\CMS\Form\FormField;"; + $form_field_class[] = "use Joomla\CMS\Factory;"; + $form_field_class[] = PHP_EOL + . "class JFormFieldModadminvvvvvvvdm extends FormField"; + $form_field_class[] = "{"; + $form_field_class[] = $this->_t(1) + . "protected \$type = 'modadminvvvvvvvdm';"; + $form_field_class[] = PHP_EOL . $this->_t(1) + . "protected function getLabel()"; + $form_field_class[] = $this->_t(1) . "{"; + $form_field_class[] = $this->_t(2) . "return;"; + $form_field_class[] = $this->_t(1) . "}"; + $form_field_class[] = PHP_EOL . $this->_t(1) + . "protected function getInput()"; + $form_field_class[] = $this->_t(1) . "{"; + $form_field_class[] = $this->_t(2) . "//" . $this->setLine(__LINE__) + . " Get the document"; + $form_field_class[] = $this->_t(2) + . "\$document = Factory::getDocument();"; + $form_field_class[] = implode(PHP_EOL, $fieldScriptBucket); + $form_field_class[] = $this->_t(2) . "return; // noting for now :)"; + $form_field_class[] = $this->_t(1) . "}"; + $form_field_class[] = "}"; + + return implode(PHP_EOL, $form_field_class); + } + /** * get the Joomla plugins IDs * @@ -9253,7 +9542,7 @@ class Get ); // set description $this->placeholders[$this->hhh . 'DESCRIPTION' . $this->hhh] - = $plugin->description; + = $plugin->description; $plugin->description = '

' . $plugin->description . '

'; } @@ -9739,13 +10028,16 @@ class Get ); unset( $this->placeholders[$this->hhh . 'VERSION' - . $this->hhh]); + . $this->hhh] + ); unset( $this->placeholders[$this->hhh . 'DESCRIPTION' - . $this->hhh]); + . $this->hhh] + ); unset( $this->placeholders[$this->hhh . 'PLUGIN_NAME' - . $this->hhh]); + . $this->hhh] + ); $this->joomlaPlugins[$id] = $plugin; @@ -10406,19 +10698,26 @@ class Get if (strpos($script, 'LOCKBASE64((((') !== false) { // get the strings - $values = ComponentbuilderHelper::getAllBetween($script, 'LOCKBASE64((((', '))))'); + $values = ComponentbuilderHelper::getAllBetween( + $script, 'LOCKBASE64((((', '))))' + ); $locker = array(); // convert them - foreach($values as $value) + foreach ($values as $value) { - $locker['LOCKBASE64((((' . $value . '))))'] = "base64_decode( preg_replace('/\s+/', ''," . + $locker['LOCKBASE64((((' . $value . '))))'] + = "base64_decode( preg_replace('/\s+/', ''," . PHP_EOL . $this->_t(2) . "'" . - wordwrap(base64_encode($value), 64, PHP_EOL . $this->_t(2), true) . + wordwrap( + base64_encode($value), 64, PHP_EOL . $this->_t(2), true + ) . "'))"; } + // update the script return $this->setPlaceholders($script, $locker); } + return $script; } diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index caea7cafb..d963a8eb0 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -501,16 +501,8 @@ class Structure extends Get $this->dynamicPaths[$module->key] = $module->folder_path; // make sure there is no old build $this->removeFolder($module->folder_path); - // creat the main component folder - if (!JFolder::exists($module->folder_path)) - { - JFolder::create($module->folder_path); - // count the folder created - $this->folderCount++; - $this->indexHTML( - $module->folder_name, $this->compilerPath - ); - } + // creat the main module folder + $this->createFolder($module->folder_path); // set main mod file $fileDetails = array('path' => $module->folder_path . '/' . $module->file_name . '.php', @@ -592,15 +584,7 @@ class Structure extends Get // count the file created $this->fileCount++; // set tmpl folder - if (!JFolder::exists($module->folder_path . '/tmpl')) - { - JFolder::create($module->folder_path . '/tmpl'); - // count the folder created - $this->folderCount++; - $this->indexHTML( - $module->folder_name . '/tmpl', $this->compilerPath - ); - } + $this->createFolder($module->folder_path . '/tmpl'); // set default file $fileDetails = array('path' => $module->folder_path . '/tmpl/default.php', @@ -652,32 +636,116 @@ class Structure extends Get // count the file created $this->fileCount++; } - // set fields & rules folders if needed + // set the folders target path + $target_path = ''; + if ($module->target_client === 'administrator') + { + $target_path = '/administrator'; + } + // check if we have custom fields needed for scripts + $module->add_scripts_field = false; + $field_script_bucket = array(); + // add any css from the fields + if (($css = $this->getCustomScriptBuilder( + 'css_view', $module->key + )) !== null + && ComponentbuilderHelper::checkString($css)) + { + // make sure this script does not have PHP + if (strpos($css, 'add_scripts_field = true; + // create the css folder + $this->createFolder($module->folder_path . '/css'); + // add the CSS file + $fileDetails = array('path' => $module->folder_path + . '/css/mod_admin.css', + 'name' => 'mod_admin.css', + 'zip' => 'mod_admin.css'); + $this->writeFile( + $fileDetails['path'], + $this->hhh . 'BOM' . $this->hhh . PHP_EOL + . PHP_EOL . $css + ); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + // add the field script + $field_script_bucket[] = $this->_t(2) . "//" + . $this->setLine(__LINE__) . " Custom CSS"; + $field_script_bucket[] = $this->_t(2) + . "\$document->addStyleSheet('" . $target_path + . "/modules/" . $module->folder_name + . "/css/mod_admin.css', ['version' => 'auto', 'relative' => true]);"; + } + } + // add any JavaScript from the fields + if (($javascript = $this->getCustomScriptBuilder( + 'view_footer', $module->key + )) !== null + && ComponentbuilderHelper::checkString($javascript)) + { + // make sure this script does not have PHP + if (strpos($javascript, 'add_scripts_field = true; + // add the JavaScript file + $this->createFolder($module->folder_path . '/js'); + // add the CSS file + $fileDetails = array('path' => $module->folder_path + . '/js/mod_admin.js', + 'name' => 'mod_admin.js', + 'zip' => 'mod_admin.js'); + $this->writeFile( + $fileDetails['path'], + $this->hhh . 'BOM' . $this->hhh . PHP_EOL + . PHP_EOL . $javascript + ); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + // add the field script + $field_script_bucket[] = $this->_t(2) . "//" + . $this->setLine(__LINE__) . " Custom JS"; + $field_script_bucket[] = $this->_t(2) + . "\$document->addScript('" . $target_path + . "/modules/" . $module->folder_name + . "/js/mod_admin.js', ['version' => 'auto', 'relative' => true]);"; + } + } + // set fields folders if needed + if ($module->add_scripts_field + || (isset($module->fields_rules_paths) + && $module->fields_rules_paths == 2)) + { + // create fields folder + $this->createFolder($module->folder_path . '/fields'); + // add the custom script field + if ($module->add_scripts_field) + { + $fileDetails = array('path' => $module->folder_path + . '/fields/modadminvvvvvvvdm.php', + 'name' => 'modadminvvvvvvvdm.php', + 'zip' => 'modadminvvvvvvvdm.php'); + $this->writeFile( + $fileDetails['path'], + $this->getModAdminVvvvvvvdm( + $field_script_bucket + ) + ); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + } + } + // set rules folders if needed if (isset($module->fields_rules_paths) && $module->fields_rules_paths == 2) { - // create fields folder - if (!JFolder::exists($module->folder_path . '/fields')) - { - JFolder::create($module->folder_path . '/fields'); - // count the folder created - $this->folderCount++; - $this->indexHTML( - $module->folder_name . '/fields', - $this->compilerPath - ); - } // create rules folder - if (!JFolder::exists($module->folder_path . '/rules')) - { - JFolder::create($module->folder_path . '/rules'); - // count the folder created - $this->folderCount++; - $this->indexHTML( - $module->folder_name . '/rules', - $this->compilerPath - ); - } + $this->createFolder($module->folder_path . '/rules'); } // set forms folder if needed if (isset($module->form_files) @@ -686,16 +754,7 @@ class Structure extends Get )) { // create forms folder - if (!JFolder::exists($module->folder_path . '/forms')) - { - JFolder::create($module->folder_path . '/forms'); - // count the folder created - $this->folderCount++; - $this->indexHTML( - $module->folder_name . '/forms', - $this->compilerPath - ); - } + $this->createFolder($module->folder_path . '/forms'); // set the template files foreach ($module->form_files as $file => $fields) { @@ -705,7 +764,7 @@ class Structure extends Get 'name' => $file . '.xml', 'zip' => 'forms/' . $file . '.xml'); - // biuld basic XML + // build basic XML $xml = ''; $xml .= PHP_EOL . '"; // if id is not set - if (!isset($this->fieldsNames[$view_name_single]['id'])) + if (!isset($this->fieldsNames[$nameSingleCode]['id'])) { $fieldSet[] = $this->_t(2) . "_t(3) . "name=" . '"id"'; @@ -652,7 +652,7 @@ class Fields extends Structure $this->fieldCount++; } // if created is not set - if (!isset($this->fieldsNames[$view_name_single]['created'])) + if (!isset($this->fieldsNames[$nameSingleCode]['created'])) { $fieldSet[] = $this->_t(2) . ""; @@ -675,7 +675,7 @@ class Fields extends Structure $this->fieldCount++; } // if created_by is not set - if (!isset($this->fieldsNames[$view_name_single]['created_by'])) + if (!isset($this->fieldsNames[$nameSingleCode]['created_by'])) { $fieldSet[] = $this->_t(2) . ""; @@ -695,7 +695,7 @@ class Fields extends Structure $this->fieldCount++; } // if published is not set - if (!isset($this->fieldsNames[$view_name_single]['published'])) + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) { $fieldSet[] = $this->_t(2) . ""; @@ -722,7 +722,7 @@ class Fields extends Structure $this->fieldCount++; } // if modified is not set - if (!isset($this->fieldsNames[$view_name_single]['modified'])) + if (!isset($this->fieldsNames[$nameSingleCode]['modified'])) { $fieldSet[] = $this->_t(2) . ""; @@ -737,7 +737,7 @@ class Fields extends Structure $this->fieldCount++; } // if modified_by is not set - if (!isset($this->fieldsNames[$view_name_single]['modified_by'])) + if (!isset($this->fieldsNames[$nameSingleCode]['modified_by'])) { $fieldSet[] = $this->_t(2) . ""; @@ -755,11 +755,11 @@ class Fields extends Structure $this->fieldCount++; } // check if view has access - if (isset($this->accessBuilder[$view_name_single]) + if (isset($this->accessBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->accessBuilder[$view_name_single] + $this->accessBuilder[$nameSingleCode] ) - && !isset($this->fieldsNames[$view_name_single]['access'])) + && !isset($this->fieldsNames[$nameSingleCode]['access'])) { $fieldSet[] = $this->_t(2) . ""; @@ -778,7 +778,7 @@ class Fields extends Structure $this->fieldCount++; } // if ordering is not set - if (!isset($this->fieldsNames[$view_name_single]['ordering'])) + if (!isset($this->fieldsNames[$nameSingleCode]['ordering'])) { $fieldSet[] = $this->_t(2) . ""; @@ -801,7 +801,7 @@ class Fields extends Structure $this->fieldCount++; } // if version is not set - if (!isset($this->fieldsNames[$view_name_single]['version'])) + if (!isset($this->fieldsNames[$nameSingleCode]['version'])) { $fieldSet[] = $this->_t(2) . ""; @@ -821,13 +821,13 @@ class Fields extends Structure $this->fieldCount++; } // check if metadata is added to this view - if (isset($this->metadataBuilder[$view_name_single]) + if (isset($this->metadataBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->metadataBuilder[$view_name_single] + $this->metadataBuilder[$nameSingleCode] )) { // metakey - if (!isset($this->fieldsNames[$view_name_single]['metakey'])) + if (!isset($this->fieldsNames[$nameSingleCode]['metakey'])) { $fieldSet[] = $this->_t(2) . ""; @@ -845,7 +845,7 @@ class Fields extends Structure $this->fieldCount++; } // metadesc - if (!isset($this->fieldsNames[$view_name_single]['metadesc'])) + if (!isset($this->fieldsNames[$nameSingleCode]['metadesc'])) { $fieldSet[] = $this->_t(2) . ""; @@ -872,14 +872,14 @@ class Fields extends Structure // close fieldset $fieldSet[] = $this->_t(1) . "
"; // check if metadata is added to this view - if (isset($this->metadataBuilder[$view_name_single]) + if (isset($this->metadataBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->metadataBuilder[$view_name_single] + $this->metadataBuilder[$nameSingleCode] )) { - if (!isset($this->fieldsNames[$view_name_single]['robots']) - || !isset($this->fieldsNames[$view_name_single]['rights']) - || !isset($this->fieldsNames[$view_name_single]['author'])) + if (!isset($this->fieldsNames[$nameSingleCode]['robots']) + || !isset($this->fieldsNames[$nameSingleCode]['rights']) + || !isset($this->fieldsNames[$nameSingleCode]['author'])) { $fieldSet[] = PHP_EOL . $this->_t(1) . "' . PHP_EOL + . $this->_t(1) . $this->xmlPrettyPrint( + $xmlField, 'field' + ); + } + } + + // return the string + return $xmlField; + } + /** * set a field * - * @param string $setType The set of fields type - * @param array $fieldAttributes The field values - * @param string $name The field name - * @param string $typeName The field type - * @param string $langView The language string of the view - * @param string $view_name_single The single view name - * @param string $view_name_list The list view name - * @param array $placeholders The place holder and replace values - * @param string $optionArray The option bucket array used to set the field options if needed. - * @param array $custom Used when field is from config - * @param string $taber The tabs to add in layout (only in string manipulation) + * @param string $setType The set of fields type + * @param array $fieldAttributes The field values + * @param string $name The field name + * @param string $typeName The field type + * @param string $langView The language string of the view + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * @param array $placeholders The place holder and replace values + * @param string $optionArray The option bucket array used to set the field options if needed. + * @param array $custom Used when field is from config + * @param string $taber The tabs to add in layout (only in string manipulation) * * @return SimpleXMLElement The field in xml * */ private function setField($setType, &$fieldAttributes, &$name, &$typeName, - &$langView, &$view_name_single, &$view_name_list, $placeholders, + &$langView, &$nameSingleCode, &$nameListCode, $placeholders, &$optionArray, $custom = null, $taber = '' ) { // count the dynamic fields created @@ -1605,7 +1725,7 @@ class Fields extends Structure // build field set using string manipulation return $this->stringSetField( $setType, $fieldAttributes, $name, $typeName, $langView, - $view_name_single, $view_name_list, $placeholders, $optionArray, + $nameSingleCode, $nameListCode, $placeholders, $optionArray, $custom, $taber ); } @@ -1614,7 +1734,7 @@ class Fields extends Structure // build field set with simpleXMLElement class return $this->simpleXMLSetField( $setType, $fieldAttributes, $name, $typeName, $langView, - $view_name_single, $view_name_list, $placeholders, $optionArray, + $nameSingleCode, $nameListCode, $placeholders, $optionArray, $custom ); } @@ -1623,23 +1743,23 @@ class Fields extends Structure /** * set a field using string manipulation * - * @param string $setType The set of fields type - * @param array $fieldAttributes The field values - * @param string $name The field name - * @param string $typeName The field type - * @param string $langView The language string of the view - * @param string $view_name_single The single view name - * @param string $view_name_list The list view name - * @param array $placeholders The place holder and replace values - * @param string $optionArray The option bucket array used to set the field options if needed. - * @param array $custom Used when field is from config - * @param string $taber The tabs to add in layout + * @param string $setType The set of fields type + * @param array $fieldAttributes The field values + * @param string $name The field name + * @param string $typeName The field type + * @param string $langView The language string of the view + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * @param array $placeholders The place holder and replace values + * @param string $optionArray The option bucket array used to set the field options if needed. + * @param array $custom Used when field is from config + * @param string $taber The tabs to add in layout * * @return SimpleXMLElement The field in xml * */ protected function stringSetField($setType, &$fieldAttributes, &$name, - &$typeName, &$langView, &$view_name_single, &$view_name_list, + &$typeName, &$langView, &$nameSingleCode, &$nameListCode, $placeholders, &$optionArray, $custom = null, $taber = '' ) { $field = ''; @@ -2013,14 +2133,14 @@ class Fields extends Structure // load the field data $fieldsSets = array_map( function ($id) use ( - $view_name_single, $view_name_list, $_resolverKey + $nameSingleCode, $nameListCode, $_resolverKey ) { // start field $field = array(); $field['field'] = $id; // set the field details $this->setFieldDetails( - $field, $view_name_single, $view_name_list, + $field, $nameSingleCode, $nameListCode, $_resolverKey ); @@ -2037,7 +2157,7 @@ class Fields extends Structure )) { $r_name = $this->getFieldName( - $fieldData, $view_name_list, $_resolverKey + $fieldData, $nameListCode, $_resolverKey ); $r_typeName = $this->getFieldType($fieldData); $r_multiple = false; @@ -2048,7 +2168,7 @@ class Fields extends Structure $r_fieldValues = $this->setFieldAttributes( $fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, - $view_name_list, $view_name_single, + $nameListCode, $nameSingleCode, $placeholders, true ); // check if values were set @@ -2066,7 +2186,7 @@ class Fields extends Structure $field .= $this->setField( 'option', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray, null, $r_taber ); @@ -2083,7 +2203,7 @@ class Fields extends Structure $field .= $this->setField( 'custom', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray, null, $r_taber ); @@ -2113,8 +2233,8 @@ class Fields extends Structure 'custom' => $custom); // set the custom field file $this->setCustomFieldTypeFile( - $data, $view_name_list, - $view_name_single + $data, $nameListCode, + $nameSingleCode ); } else @@ -2123,7 +2243,7 @@ class Fields extends Structure $field .= $this->setField( 'plain', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray, null, $r_taber ); @@ -2179,14 +2299,14 @@ class Fields extends Structure // load the field data $fieldsSets = array_map( function ($id) use ( - $view_name_single, $view_name_list, $_resolverKey + $nameSingleCode, $nameListCode, $_resolverKey ) { // start field $field = array(); $field['field'] = $id; // set the field details $this->setFieldDetails( - $field, $view_name_single, $view_name_list, + $field, $nameSingleCode, $nameListCode, $_resolverKey ); @@ -2203,7 +2323,7 @@ class Fields extends Structure )) { $r_name = $this->getFieldName( - $fieldData, $view_name_list, $_resolverKey + $fieldData, $nameListCode, $_resolverKey ); $r_typeName = $this->getFieldType($fieldData); $r_multiple = false; @@ -2214,7 +2334,7 @@ class Fields extends Structure $r_fieldValues = $this->setFieldAttributes( $fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, - $view_name_list, $view_name_single, + $nameListCode, $nameSingleCode, $placeholders, true ); // check if values were set @@ -2232,7 +2352,7 @@ class Fields extends Structure $field .= $this->setField( 'option', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray, null, $r_taber ); @@ -2256,7 +2376,7 @@ class Fields extends Structure $field .= $this->setField( 'special', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray, null, $r_taber ); @@ -2274,7 +2394,7 @@ class Fields extends Structure $field .= $this->setField( 'custom', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray, null, $r_taber ); @@ -2304,8 +2424,8 @@ class Fields extends Structure 'custom' => $custom); // set the custom field file $this->setCustomFieldTypeFile( - $data, $view_name_list, - $view_name_single + $data, $nameListCode, + $nameSingleCode ); } else @@ -2314,7 +2434,7 @@ class Fields extends Structure $field .= $this->setField( 'plain', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray, null, $r_taber ); @@ -2614,10 +2734,10 @@ class Fields extends Structure $field .= PHP_EOL . $this->_t(2) . $taber . "/>"; } // incase the field is in the config and has not been set - if ('config' === $view_name_single && 'configs' === $view_name_list - || (strpos($view_name_single, 'P|uG!n') !== false + if ('config' === $nameSingleCode && 'configs' === $nameListCode + || (strpos($nameSingleCode, 'P|uG!n') !== false || strpos( - $view_name_single, 'M0dU|3' + $nameSingleCode, 'M0dU|3' ) !== false)) { // set lang (just incase) @@ -2628,7 +2748,7 @@ class Fields extends Structure 'lang' => $listLangName, 'custom' => $custom); // set the custom field file $this->setCustomFieldTypeFile( - $data, $view_name_list, $view_name_single + $data, $nameListCode, $nameSingleCode ); } } @@ -2640,22 +2760,22 @@ class Fields extends Structure /** * set a field with simpleXMLElement class * - * @param string $setType The set of fields type - * @param array $fieldAttributes The field values - * @param string $name The field name - * @param string $typeName The field type - * @param string $langView The language string of the view - * @param string $view_name_single The single view name - * @param string $view_name_list The list view name - * @param array $placeholders The place holder and replace values - * @param string $optionArray The option bucket array used to set the field options if needed. - * @param array $custom Used when field is from config + * @param string $setType The set of fields type + * @param array $fieldAttributes The field values + * @param string $name The field name + * @param string $typeName The field type + * @param string $langView The language string of the view + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * @param array $placeholders The place holder and replace values + * @param string $optionArray The option bucket array used to set the field options if needed. + * @param array $custom Used when field is from config * * @return SimpleXMLElement The field in xml * */ protected function simpleXMLSetField($setType, &$fieldAttributes, &$name, - &$typeName, &$langView, &$view_name_single, &$view_name_list, + &$typeName, &$langView, &$nameSingleCode, &$nameListCode, $placeholders, &$optionArray, $custom = null ) { $field = new stdClass(); @@ -3009,14 +3129,14 @@ class Fields extends Structure // load the field data $fieldsSets = array_map( function ($id) use ( - $view_name_single, $view_name_list, $_resolverKey + $nameSingleCode, $nameListCode, $_resolverKey ) { // start field $field = array(); $field['field'] = $id; // set the field details $this->setFieldDetails( - $field, $view_name_single, $view_name_list, + $field, $nameSingleCode, $nameListCode, $_resolverKey ); @@ -3033,7 +3153,7 @@ class Fields extends Structure )) { $r_name = $this->getFieldName( - $fieldData, $view_name_list, $_resolverKey + $fieldData, $nameListCode, $_resolverKey ); $r_typeName = $this->getFieldType($fieldData); $r_multiple = false; @@ -3042,7 +3162,7 @@ class Fields extends Structure $r_fieldValues = $this->setFieldAttributes( $fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, - $view_name_list, $view_name_single, + $nameListCode, $nameSingleCode, $placeholders, true ); // check if values were set @@ -3061,7 +3181,7 @@ class Fields extends Structure $fieldSetXML, $this->setField( 'option', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray ) ); @@ -3079,7 +3199,7 @@ class Fields extends Structure $fieldSetXML, $this->setField( 'custom', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray ) ); @@ -3109,8 +3229,8 @@ class Fields extends Structure 'custom' => $custom); // set the custom field file $this->setCustomFieldTypeFile( - $data, $view_name_list, - $view_name_single + $data, $nameListCode, + $nameSingleCode ); } else @@ -3120,7 +3240,7 @@ class Fields extends Structure $fieldSetXML, $this->setField( 'plain', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray ) ); @@ -3192,7 +3312,7 @@ class Fields extends Structure // load the field data $fieldsSets = array_map( function ($id) use ( - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $_resolverKey ) { // start field @@ -3200,7 +3320,7 @@ class Fields extends Structure $field['field'] = $id; // set the field details $this->setFieldDetails( - $field, $view_name_single, $view_name_list, + $field, $nameSingleCode, $nameListCode, $_resolverKey ); @@ -3217,7 +3337,7 @@ class Fields extends Structure )) { $r_name = $this->getFieldName( - $fieldData, $view_name_list, $_resolverKey + $fieldData, $nameListCode, $_resolverKey ); $r_typeName = $this->getFieldType($fieldData); $r_multiple = false; @@ -3226,7 +3346,7 @@ class Fields extends Structure $r_fieldValues = $this->setFieldAttributes( $fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, - $view_name_list, $view_name_single, + $nameListCode, $nameSingleCode, $placeholders, true ); // check if values were set @@ -3245,7 +3365,7 @@ class Fields extends Structure $form, $this->setField( 'option', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray ) ); @@ -3271,8 +3391,8 @@ class Fields extends Structure $form, $this->setField( 'special', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, - $view_name_list, $placeholders, + $nameSingleCode, + $nameListCode, $placeholders, $r_optionArray ) ); @@ -3292,7 +3412,7 @@ class Fields extends Structure $form, $this->setField( 'custom', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray ) ); @@ -3322,8 +3442,8 @@ class Fields extends Structure 'custom' => $custom); // set the custom field file $this->setCustomFieldTypeFile( - $data, $view_name_list, - $view_name_single + $data, $nameListCode, + $nameSingleCode ); } else @@ -3333,7 +3453,7 @@ class Fields extends Structure $form, $this->setField( 'plain', $r_fieldValues, $r_name, $r_typeName, $langView, - $view_name_single, $view_name_list, + $nameSingleCode, $nameListCode, $placeholders, $r_optionArray ) ); @@ -3599,11 +3719,11 @@ class Fields extends Structure } } // incase the field is in the config and has not been set (or is part of a plugin or module) - if (('config' === $view_name_single - && 'configs' === $view_name_list) - || (strpos($view_name_single, 'P|uG!n') !== false + if (('config' === $nameSingleCode + && 'configs' === $nameListCode) + || (strpos($nameSingleCode, 'P|uG!n') !== false || strpos( - $view_name_single, 'M0dU|3' + $nameSingleCode, 'M0dU|3' ) !== false)) { // set lang (just incase) @@ -3614,7 +3734,7 @@ class Fields extends Structure 'lang' => $listLangName, 'custom' => $custom); // set the custom field file $this->setCustomFieldTypeFile( - $data, $view_name_list, $view_name_single + $data, $nameListCode, $nameSingleCode ); } } @@ -3625,15 +3745,15 @@ class Fields extends Structure /** * set the layout builder * - * @param string $view_name_single The single edit view code name - * @param string $tabName The tab code name - * @param string $name The field code name - * @param array $field The field details + * @param string $nameSingleCode The single edit view code name + * @param string $tabName The tab code name + * @param string $name The field code name + * @param array $field The field details * * @return void * */ - public function setLayoutBuilder(&$view_name_single, &$tabName, &$name, + public function setLayoutBuilder(&$nameSingleCode, &$tabName, &$name, &$field ) { // first fix the zero order @@ -3641,100 +3761,100 @@ class Fields extends Structure // as zero is expected to behave if ($field['order_edit'] == 0) { - if (!isset($this->zeroOrderFix[$view_name_single])) + if (!isset($this->zeroOrderFix[$nameSingleCode])) { - $this->zeroOrderFix[$view_name_single] = array(); + $this->zeroOrderFix[$nameSingleCode] = array(); } - if (!isset($this->zeroOrderFix[$view_name_single][(int) $field['tab']])) + if (!isset($this->zeroOrderFix[$nameSingleCode][(int) $field['tab']])) { - $this->zeroOrderFix[$view_name_single][(int) $field['tab']] + $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']] = -999; } else { - $this->zeroOrderFix[$view_name_single][(int) $field['tab']]++; + $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']]++; } $field['order_edit'] - = $this->zeroOrderFix[$view_name_single][(int) $field['tab']]; + = $this->zeroOrderFix[$nameSingleCode][(int) $field['tab']]; } // now build the layout if (ComponentbuilderHelper::checkString($tabName) && $tabName != 'publishing') { - $this->tabCounter[$view_name_single][(int) $field['tab']] + $this->tabCounter[$nameSingleCode][(int) $field['tab']] = $tabName; - if (isset($this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']][(int) $field['order_edit']])) + if (isset($this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']][(int) $field['order_edit']])) { $size = (int) count( - (array) $this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']] + (array) $this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']] ) + 1; - while (isset($this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']][$size])) + while (isset($this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']][$size])) { $size++; } - $this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']][$size] + $this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']][$size] = $name; } else { - $this->layoutBuilder[$view_name_single][$tabName][(int) $field['alignment']][(int) $field['order_edit']] + $this->layoutBuilder[$nameSingleCode][$tabName][(int) $field['alignment']][(int) $field['order_edit']] = $name; } // check if default fields were over written if (in_array($name, $this->defaultFields)) { // just to eliminate - $this->movedPublishingFields[$view_name_single][$name] = $name; + $this->movedPublishingFields[$nameSingleCode][$name] = $name; } } elseif ($tabName === 'publishing' || $tabName === 'Publishing') { if (!in_array($name, $this->defaultFields)) { - if (isset($this->newPublishingFields[$view_name_single][(int) $field['alignment']][(int) $field['order_edit']])) + if (isset($this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][(int) $field['order_edit']])) { $size = (int) count( - (array) $this->newPublishingFields[$view_name_single][(int) $field['alignment']] + (array) $this->newPublishingFields[$nameSingleCode][(int) $field['alignment']] ) + 1; - while (isset($this->newPublishingFields[$view_name_single][(int) $field['alignment']][$size])) + while (isset($this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][$size])) { $size++; } - $this->newPublishingFields[$view_name_single][(int) $field['alignment']][$size] + $this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][$size] = $name; } else { - $this->newPublishingFields[$view_name_single][(int) $field['alignment']][(int) $field['order_edit']] + $this->newPublishingFields[$nameSingleCode][(int) $field['alignment']][(int) $field['order_edit']] = $name; } } } else { - $this->tabCounter[$view_name_single][1] = 'Details'; - if (isset($this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']][(int) $field['order_edit']])) + $this->tabCounter[$nameSingleCode][1] = 'Details'; + if (isset($this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']][(int) $field['order_edit']])) { $size = (int) count( - (array) $this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']] + (array) $this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']] ) + 1; - while (isset($this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']][$size])) + while (isset($this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']][$size])) { $size++; } - $this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']][$size] + $this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']][$size] = $name; } else { - $this->layoutBuilder[$view_name_single]['Details'][(int) $field['alignment']][(int) $field['order_edit']] + $this->layoutBuilder[$nameSingleCode]['Details'][(int) $field['alignment']][(int) $field['order_edit']] = $name; } // check if default fields were over written if (in_array($name, $this->defaultFields)) { // just to eliminate - $this->movedPublishingFields[$view_name_single][$name] = $name; + $this->movedPublishingFields[$nameSingleCode][$name] = $name; } } } @@ -3812,23 +3932,23 @@ class Fields extends Structure /** * set field attributes * - * @param array $field The field data - * @param int $viewType The view type - * @param string $name The field name - * @param string $typeName The field type - * @param boolean $multiple The switch to set multiple selection option - * @param string $langLabel The language string for field label - * @param string $langView The language string of the view - * @param string $view_name_list The list view name - * @param string $view_name_single The single view name - * @param array $placeholders The place holder and replace values - * @param boolean $repeatable The repeatable field switch + * @param array $field The field data + * @param int $viewType The view type + * @param string $name The field name + * @param string $typeName The field type + * @param boolean $multiple The switch to set multiple selection option + * @param string $langLabel The language string for field label + * @param string $langView The language string of the view + * @param string $nameListCode The list view name + * @param string $nameSingleCode The single view name + * @param array $placeholders The place holder and replace values + * @param boolean $repeatable The repeatable field switch * * @return array The field attributes * */ private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, - &$multiple, &$langLabel, $langView, $view_name_list, $view_name_single, + &$multiple, &$langLabel, $langView, $nameListCode, $nameSingleCode, $placeholders, $repeatable = false ) { // reset array @@ -4098,11 +4218,11 @@ class Fields extends Structure if ($property['name'] === 'label') { if (isset($fieldAttributes['name']) - && isset($this->uniqueNames[$view_name_list]['names'][$fieldAttributes['name']])) + && isset($this->uniqueNames[$nameListCode]['names'][$fieldAttributes['name']])) { $xmlValue .= ' (' . ComponentbuilderHelper::safeString( - $this->uniqueNames[$view_name_list]['names'][$fieldAttributes['name']] + $this->uniqueNames[$nameListCode]['names'][$fieldAttributes['name']] ) . ')'; } } @@ -4226,7 +4346,7 @@ class Fields extends Structure ); if (ComponentbuilderHelper::checkString($listclass)) { - $this->listFieldClass[$view_name_list][$fieldAttributes['name']] + $this->listFieldClass[$nameListCode][$fieldAttributes['name']] = $listclass; } // check if we find reason to remove this field from being escaped @@ -4235,7 +4355,7 @@ class Fields extends Structure ); if (ComponentbuilderHelper::checkString($escaped)) { - $this->doNotEscape[$view_name_list][] + $this->doNotEscape[$nameListCode][] = $fieldAttributes['name']; } // check if we have display switch for dynamic placment @@ -4275,23 +4395,23 @@ class Fields extends Structure /** * set Builders * - * @param string $langLabel The language string for field label - * @param string $langView The language string of the view - * @param string $view_name_single The single view name - * @param string $view_name_list The list view name - * @param string $name The field name - * @param array $view The view data - * @param array $field The field data - * @param string $typeName The field type - * @param boolean $multiple The switch to set multiple selection option - * @param boolean $custom The custom field switch - * @param boolean $options The options switch + * @param string $langLabel The language string for field label + * @param string $langView The language string of the view + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * @param string $name The field name + * @param array $view The view data + * @param array $field The field data + * @param string $typeName The field type + * @param boolean $multiple The switch to set multiple selection option + * @param boolean $custom The custom field switch + * @param boolean $options The options switch * * @return void * */ - public function setBuilders($langLabel, $langView, $view_name_single, - $view_name_list, $name, $view, $field, $typeName, $multiple, + public function setBuilders($langLabel, $langView, $nameSingleCode, + $nameListCode, $name, $view, $field, $typeName, $multiple, $custom = false, $options = false ) { // dbSwitch @@ -4304,7 +4424,7 @@ class Fields extends Structure elseif ($typeName === 'tag') { // set tags for this view but don't load to DB - $this->tagsBuilder[$view_name_single] = $view_name_single; + $this->tagsBuilder[$nameSingleCode] = $nameSingleCode; } elseif (isset($field['settings']->datatype)) { @@ -4315,7 +4435,7 @@ class Fields extends Structure $textKeys = array('TEXT', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'BLOB', 'TINYBLOB', 'MEDIUMBLOB', 'LONGBLOB'); // build the query values - $this->queryBuilder[$view_name_single][$name]['type'] + $this->queryBuilder[$nameSingleCode][$name]['type'] = $field['settings']->datatype; // check if this is a number if (in_array($field['settings']->datatype, $numberKeys)) @@ -4346,25 +4466,25 @@ class Fields extends Structure // check if this is not text if (!in_array($field['settings']->datatype, $textKeys)) { - $this->queryBuilder[$view_name_single][$name]['lenght'] + $this->queryBuilder[$nameSingleCode][$name]['lenght'] = $field['settings']->datalenght; - $this->queryBuilder[$view_name_single][$name]['lenght_other'] + $this->queryBuilder[$nameSingleCode][$name]['lenght_other'] = $field['settings']->datalenght_other; - $this->queryBuilder[$view_name_single][$name]['default'] + $this->queryBuilder[$nameSingleCode][$name]['default'] = $field['settings']->datadefault; - $this->queryBuilder[$view_name_single][$name]['other'] + $this->queryBuilder[$nameSingleCode][$name]['other'] = $field['settings']->datadefault_other; } // fall back unto EMPTY for text else { - $this->queryBuilder[$view_name_single][$name]['default'] + $this->queryBuilder[$nameSingleCode][$name]['default'] = 'EMPTY'; } // to identify the field - $this->queryBuilder[$view_name_single][$name]['ID'] + $this->queryBuilder[$nameSingleCode][$name]['ID'] = $field['settings']->id; - $this->queryBuilder[$view_name_single][$name]['null_switch'] + $this->queryBuilder[$nameSingleCode][$name]['null_switch'] = $field['settings']->null_switch; // set index types $_guid = true; @@ -4374,7 +4494,7 @@ class Fields extends Structure )) { // build unique keys of this view for db - $this->dbUniqueKeys[$view_name_single][] = $name; + $this->dbUniqueKeys[$nameSingleCode][] = $name; // prevent guid from being added twice if ('guid' === $name) { @@ -4389,12 +4509,12 @@ class Fields extends Structure && !in_array($field['settings']->datatype, $textKeys)) { // build keys of this view for db - $this->dbKeys[$view_name_single][] = $name; + $this->dbKeys[$nameSingleCode][] = $name; } // special treatment for GUID if ('guid' === $name && $_guid) { - $this->dbUniqueGuid[$view_name_single] = true; + $this->dbUniqueGuid[$nameSingleCode] = true; } } // set list switch @@ -4404,45 +4524,46 @@ class Fields extends Structure || $field['list'] == 4)); // set list join $listJoin - = (isset($this->listJoinBuilder[$view_name_list][(int) $field['field']])); + = (isset($this->listJoinBuilder[$nameListCode][(int) $field['field']])); // add history to this view if (isset($view['history']) && $view['history']) { - $this->historyBuilder[$view_name_single] = $view_name_single; + $this->historyBuilder[$nameSingleCode] = $nameSingleCode; } // set Alias (only one title per view) if ($dbSwitch && isset($field['alias']) && $field['alias'] - && !isset($this->aliasBuilder[$view_name_single])) + && !isset($this->aliasBuilder[$nameSingleCode])) { - $this->aliasBuilder[$view_name_single] = $name; + $this->aliasBuilder[$nameSingleCode] = $name; } // set Titles (only one title per view) if ($dbSwitch && isset($field['title']) && $field['title'] - && !isset($this->titleBuilder[$view_name_single])) + && !isset($this->titleBuilder[$nameSingleCode])) { - $this->titleBuilder[$view_name_single] = $name; + $this->titleBuilder[$nameSingleCode] = $name; } // category name fix if ($typeName === 'category') { - if (isset($this->catOtherName[$view_name_list]) + if (isset($this->catOtherName[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->catOtherName[$view_name_list] + $this->catOtherName[$nameListCode] )) { - $tempName = $this->catOtherName[$view_name_list]['name']; + $tempName = $this->catOtherName[$nameListCode]['name']; } else { - $tempName = $view_name_list . ' categories'; + $tempName = $nameListCode . ' categories'; } // set lang $listLangName = $langView . '_' . ComponentbuilderHelper::safeFieldName($tempName, true); + // set field name + $listFieldName = ComponentbuilderHelper::safeString($tempName, 'W'); // add to lang array $this->setLangContent( - $this->lang, $listLangName, - ComponentbuilderHelper::safeString($tempName, 'W') + $this->lang, $listLangName, $listFieldName ); } else @@ -4450,10 +4571,11 @@ class Fields extends Structure // set lang (just in case) $listLangName = $langView . '_' . ComponentbuilderHelper::safeFieldName($name, true); + // set field name + $listFieldName = ComponentbuilderHelper::safeString($name, 'W'); // add to lang array $this->setLangContent( - $this->lang, $listLangName, - ComponentbuilderHelper::safeString($name, 'W') + $this->lang, $listLangName, $listFieldName ); // if label was set use instead if (ComponentbuilderHelper::checkString($langLabel)) @@ -4468,7 +4590,7 @@ class Fields extends Structure // load to list builder if ($listSwitch) { - $this->listBuilder[$view_name_list][] = array( + $this->listBuilder[$nameListCode][] = array( 'id' => (int) $field['field'], 'type' => $typeName, 'code' => $name, @@ -4489,13 +4611,13 @@ class Fields extends Structure // build custom builder list if ($listSwitch || $listJoin) { - $this->customBuilderList[$view_name_list][] = $name; + $this->customBuilderList[$nameListCode][] = $name; } } // load the list join builder if ($listJoin) { - $this->listJoinBuilder[$view_name_list][(int) $field['field']] + $this->listJoinBuilder[$nameListCode][(int) $field['field']] = array( 'type' => $typeName, 'code' => $name, @@ -4513,14 +4635,14 @@ class Fields extends Structure 'options' => $options); } // update the field relations - if (isset($this->fieldRelations[$view_name_list]) - && isset($this->fieldRelations[$view_name_list][(int) $field['field']]) + if (isset($this->fieldRelations[$nameListCode]) + && isset($this->fieldRelations[$nameListCode][(int) $field['field']]) && ComponentbuilderHelper::checkArray( - $this->fieldRelations[$view_name_list][(int) $field['field']] + $this->fieldRelations[$nameListCode][(int) $field['field']] )) { foreach ( - $this->fieldRelations[$view_name_list][(int) $field['field']] as + $this->fieldRelations[$nameListCode][(int) $field['field']] as $area => &$field_values ) { @@ -4532,11 +4654,11 @@ class Fields extends Structure // set the hidden field of this view if ($typeName === 'hidden') { - if (!isset($this->hiddenFieldsBuilder[$view_name_single])) + if (!isset($this->hiddenFieldsBuilder[$nameSingleCode])) { - $this->hiddenFieldsBuilder[$view_name_single] = ''; + $this->hiddenFieldsBuilder[$nameSingleCode] = ''; } - $this->hiddenFieldsBuilder[$view_name_single] .= ',"' . $name . '"'; + $this->hiddenFieldsBuilder[$nameSingleCode] .= ',"' . $name . '"'; } // set all int fields of this view if ($dbSwitch && isset($field['settings']->datatype) @@ -4544,32 +4666,32 @@ class Fields extends Structure || $field['settings']->datatype === 'TINYINT' || $field['settings']->datatype === 'BIGINT')) { - if (!isset($this->intFieldsBuilder[$view_name_single])) + if (!isset($this->intFieldsBuilder[$nameSingleCode])) { - $this->intFieldsBuilder[$view_name_single] = ''; + $this->intFieldsBuilder[$nameSingleCode] = ''; } - $this->intFieldsBuilder[$view_name_single] .= ',"' . $name . '"'; + $this->intFieldsBuilder[$nameSingleCode] .= ',"' . $name . '"'; } // set all dynamic field of this view if ($typeName != 'category' && $typeName != 'repeatable' && $typeName != 'subform' && !in_array($name, $this->defaultFields)) { - if (!isset($this->dynamicfieldsBuilder[$view_name_single])) + if (!isset($this->dynamicfieldsBuilder[$nameSingleCode])) { - $this->dynamicfieldsBuilder[$view_name_single] = ''; + $this->dynamicfieldsBuilder[$nameSingleCode] = ''; } - if (isset($this->dynamicfieldsBuilder[$view_name_single]) + if (isset($this->dynamicfieldsBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->dynamicfieldsBuilder[$view_name_single] + $this->dynamicfieldsBuilder[$nameSingleCode] )) { - $this->dynamicfieldsBuilder[$view_name_single] .= ',"' . $name + $this->dynamicfieldsBuilder[$nameSingleCode] .= ',"' . $name . '":"' . $name . '"'; } else { - $this->dynamicfieldsBuilder[$view_name_single] .= '"' . $name + $this->dynamicfieldsBuilder[$nameSingleCode] .= '"' . $name . '":"' . $name . '"'; } } @@ -4577,12 +4699,12 @@ class Fields extends Structure // set the main(biggest) text field of this view if ($dbSwitch && $typeName === 'editor') { - if (!isset($this->maintextBuilder[$view_name_single]) + if (!isset($this->maintextBuilder[$nameSingleCode]) || !ComponentbuilderHelper::checkString( - $this->maintextBuilder[$view_name_single] + $this->maintextBuilder[$nameSingleCode] )) { - $this->maintextBuilder[$view_name_single] = $name; + $this->maintextBuilder[$nameSingleCode] = $name; } } // set the custom builder @@ -4591,15 +4713,15 @@ class Fields extends Structure && $typeName != 'repeatable' && $typeName != 'subform') { - $this->customBuilder[$view_name_list][] = array('type' => $typeName, - 'code' => $name, - 'lang' => $listLangName, - 'custom' => $custom, - 'method' => $field['settings']->store); + $this->customBuilder[$nameListCode][] = array('type' => $typeName, + 'code' => $name, + 'lang' => $listLangName, + 'custom' => $custom, + 'method' => $field['settings']->store); // set the custom fields needed in content type data - if (!isset($this->customFieldLinksBuilder[$view_name_single])) + if (!isset($this->customFieldLinksBuilder[$nameSingleCode])) { - $this->customFieldLinksBuilder[$view_name_single] = ''; + $this->customFieldLinksBuilder[$nameSingleCode] = ''; } // only load this if table is set if (isset($custom['table']) @@ -4607,7 +4729,7 @@ class Fields extends Structure $custom['table'] )) { - $this->customFieldLinksBuilder[$view_name_single] .= ',{"sourceColumn": "' + $this->customFieldLinksBuilder[$nameSingleCode] .= ',{"sourceColumn": "' . $name . '","targetTable": "' . $custom['table'] . '","targetColumn": "' . $custom['id'] . '","displayColumn": "' . $custom['text'] . '"}'; @@ -4625,18 +4747,18 @@ class Fields extends Structure // setup category for this view if ($dbSwitch && $typeName === 'category') { - if (isset($this->catOtherName[$view_name_list]) + if (isset($this->catOtherName[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->catOtherName[$view_name_list] + $this->catOtherName[$nameListCode] )) { - $otherViews = $this->catOtherName[$view_name_list]['views']; - $otherView = $this->catOtherName[$view_name_list]['view']; + $otherViews = $this->catOtherName[$nameListCode]['views']; + $otherView = $this->catOtherName[$nameListCode]['view']; } else { - $otherViews = $view_name_list; - $otherView = $view_name_single; + $otherViews = $nameListCode; + $otherView = $nameSingleCode; } // get the xml extension name $_extension = $this->setPlaceholders( @@ -4672,20 +4794,20 @@ class Fields extends Structure
Please watch this tutorial before proceeding!!!, code fix

', - $field['field'], $view_name_single, $_extension, + $field['field'], $nameSingleCode, $_extension, $field['field'], $correction ), 'Error' ); } } // load the category builder - TODO must move all to single view - $this->categoryBuilder[$view_name_list] = array('code' => $name, - 'name' => $listLangName, - 'extension' => $_extension); + $this->categoryBuilder[$nameListCode] = array('code' => $name, + 'name' => $listLangName, + 'extension' => $_extension); // also set code name for title alias fix - $this->catCodeBuilder[$view_name_single] = array('code' => $name, - 'views' => $otherViews, - 'view' => $otherView); + $this->catCodeBuilder[$nameSingleCode] = array('code' => $name, + 'views' => $otherViews, + 'view' => $otherView); } // setup checkbox for this view if ($dbSwitch @@ -4694,7 +4816,7 @@ class Fields extends Structure && isset($custom['extends']) && $custom['extends'] === 'checkboxes'))) { - $this->checkboxBuilder[$view_name_single][] = $name; + $this->checkboxBuilder[$nameSingleCode][] = $name; } // setup checkboxes and other json items for this view // if we have advance field modeling and the field is not being set in the DB @@ -4710,42 +4832,42 @@ class Fields extends Structure { case 1: // JSON_STRING_ENCODE - $this->jsonStringBuilder[$view_name_single][] = $name; + $this->jsonStringBuilder[$nameSingleCode][] = $name; // Site settings of each field if needed $this->buildSiteFieldData( - $view_name_single, $name, 'json', $typeName + $nameSingleCode, $name, 'json', $typeName ); break; case 2: // BASE_SIXTY_FOUR - $this->base64Builder[$view_name_single][] = $name; + $this->base64Builder[$nameSingleCode][] = $name; // Site settings of each field if needed $this->buildSiteFieldData( - $view_name_single, $name, 'base64', $typeName + $nameSingleCode, $name, 'base64', $typeName ); break; case 3: // BASIC_ENCRYPTION_LOCALKEY - $this->basicFieldModeling[$view_name_single][] = $name; + $this->basicFieldModeling[$nameSingleCode][] = $name; // Site settings of each field if needed $this->buildSiteFieldData( - $view_name_single, $name, 'basic_encryption', $typeName + $nameSingleCode, $name, 'basic_encryption', $typeName ); break; case 4: // WHMCS_ENCRYPTION_VDMKEY - $this->whmcsFieldModeling[$view_name_single][] = $name; + $this->whmcsFieldModeling[$nameSingleCode][] = $name; // Site settings of each field if needed $this->buildSiteFieldData( - $view_name_single, $name, 'whmcs_encryption', $typeName + $nameSingleCode, $name, 'whmcs_encryption', $typeName ); break; case 5: // MEDIUM_ENCRYPTION_LOCALFILE - $this->mediumFieldModeling[$view_name_single][] = $name; + $this->mediumFieldModeling[$nameSingleCode][] = $name; // Site settings of each field if needed $this->buildSiteFieldData( - $view_name_single, $name, 'medium_encryption', $typeName + $nameSingleCode, $name, 'medium_encryption', $typeName ); break; case 6: @@ -4754,28 +4876,28 @@ class Fields extends Structure { if (isset($field['settings']->initiator_save_key)) { - $this->expertFieldModelInitiator[$view_name_single]['save'][$field['settings']->initiator_save_key] + $this->expertFieldModelInitiator[$nameSingleCode]['save'][$field['settings']->initiator_save_key] = $field['settings']->initiator_save; } if (isset($field['settings']->initiator_get_key)) { - $this->expertFieldModelInitiator[$view_name_single]['get'][$field['settings']->initiator_get_key] + $this->expertFieldModelInitiator[$nameSingleCode]['get'][$field['settings']->initiator_get_key] = $field['settings']->initiator_get; } - $this->expertFieldModeling[$view_name_single][$name] + $this->expertFieldModeling[$nameSingleCode][$name] = $field['settings']->model_field; // Site settings of each field if needed $this->buildSiteFieldData( - $view_name_single, $name, 'expert_mode', $typeName + $nameSingleCode, $name, 'expert_mode', $typeName ); } break; default: // JSON_ARRAY_ENCODE - $this->jsonItemBuilder[$view_name_single][] = $name; + $this->jsonItemBuilder[$nameSingleCode][] = $name; // Site settings of each field if needed $this->buildSiteFieldData( - $view_name_single, $name, 'json', $typeName + $nameSingleCode, $name, 'json', $typeName ); // no londer add the json again (already added) $subformJsonSwitch = false; @@ -4785,7 +4907,7 @@ class Fields extends Structure if ($typeName === 'usergroup') { $this->buildSiteFieldData( - $view_name_single, $name, 'json', $typeName + $nameSingleCode, $name, 'json', $typeName ); } @@ -4797,14 +4919,14 @@ class Fields extends Structure { if (ComponentbuilderHelper::checkArray($options)) { - $this->getItemsMethodListStringFixBuilder[$view_name_single][] + $this->getItemsMethodListStringFixBuilder[$nameSingleCode][] = array('name' => $name, 'type' => $typeName, 'translation' => true, 'custom' => $custom, 'method' => $field['settings']->store); } else { - $this->getItemsMethodListStringFixBuilder[$view_name_single][] + $this->getItemsMethodListStringFixBuilder[$nameSingleCode][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store); @@ -4815,15 +4937,15 @@ class Fields extends Structure if ('subform' === $typeName && $field['settings']->store != 6) { // the values must revert to array - $this->jsonItemBuilderArray[$view_name_single][] = $name; + $this->jsonItemBuilderArray[$nameSingleCode][] = $name; // should the json builder still be added if ($subformJsonSwitch) { // and insure the if is converted to json - $this->jsonItemBuilder[$view_name_single][] = $name; + $this->jsonItemBuilder[$nameSingleCode][] = $name; // Site settings of each field if needed $this->buildSiteFieldData( - $view_name_single, $name, 'json', $typeName + $nameSingleCode, $name, 'json', $typeName ); } } @@ -4834,13 +4956,13 @@ class Fields extends Structure || $field['settings']->store != 0) && !ComponentbuilderHelper::checkArray($options))) { - $this->getItemsMethodEximportStringFixBuilder[$view_name_single][] + $this->getItemsMethodEximportStringFixBuilder[$nameSingleCode][] = array('name' => $name, 'type' => $typeName, 'translation' => false, 'custom' => $custom, 'method' => $field['settings']->store); } // check if field should be added to uikit - $this->buildSiteFieldData($view_name_single, $name, 'uikit', $typeName); + $this->buildSiteFieldData($nameSingleCode, $name, 'uikit', $typeName); // load the selection translation fix if (ComponentbuilderHelper::checkArray($options) && ($listSwitch @@ -4848,9 +4970,11 @@ class Fields extends Structure && $typeName != 'repeatable' && $typeName != 'subform') { - $this->selectionTranslationFixBuilder[$view_name_list][$name] + $this->selectionTranslationFixBuilder[$nameListCode][$name] = $options; } + // main lang filter prefix + $lang_filter_ = $this->langPrefix . '_FILTER_'; // build the sort values if ($dbSwitch && (isset($field['sort']) && $field['sort'] == 1) && ($listSwitch || $listJoin) @@ -4859,39 +4983,99 @@ class Fields extends Structure && $typeName != 'repeatable' && $typeName != 'subform')) { - $this->sortBuilder[$view_name_list][] = array('type' => $typeName, - 'code' => $name, - 'lang' => $listLangName, - 'custom' => $custom, - 'options' => $options); + // add the language only for new filter option + $filter_name_asc_lang = ''; + $filter_name_desc_lang = ''; + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + // set the language strings for ascending + $filter_name_asc = $listFieldName . ' ascending'; + $filter_name_asc_lang = $lang_filter_ + . ComponentbuilderHelper::safeString( + $filter_name_asc, 'U' + ); + // and to translation + $this->setLangContent( + $this->lang, $filter_name_asc_lang, $filter_name_asc + ); + // set the language strings for descending + $filter_name_desc = $listFieldName . ' descending'; + $filter_name_desc_lang = $lang_filter_ + . ComponentbuilderHelper::safeString( + $filter_name_desc, 'U' + ); + // and to translation + $this->setLangContent( + $this->lang, $filter_name_desc_lang, $filter_name_desc + ); + } + $this->sortBuilder[$nameListCode][] = array('type' => $typeName, + 'code' => $name, + 'lang' => $listLangName, + 'lang_asc' => $filter_name_asc_lang, + 'lang_desc' => $filter_name_desc_lang, + 'custom' => $custom, + 'options' => $options); } // build the search values if ($dbSwitch && isset($field['search']) && $field['search'] == 1) { - $_list = (isset($field['list'])) + $_list = (isset($field['list'])) ? $field['list'] : 0; - $this->searchBuilder[$view_name_list][] = array('type' => $typeName, - 'code' => $name, - 'custom' => $custom, - 'list' => $_list); + $this->searchBuilder[$nameListCode][] = array('type' => $typeName, + 'code' => $name, + 'custom' => $custom, + 'list' => $_list); } // build the filter values - if ($dbSwitch && (isset($field['filter']) && $field['filter'] == 1) + if ($dbSwitch && (isset($field['filter']) && $field['filter'] >= 1) && ($listSwitch || $listJoin) && (!$multiple && $typeName != 'checkbox' && $typeName != 'checkboxes' && $typeName != 'repeatable' && $typeName != 'subform')) { - $this->filterBuilder[$view_name_list][] = array('type' => $typeName, - 'code' => $name, - 'lang' => $listLangName, - 'database' => $view_name_single, - 'function' => ComponentbuilderHelper::safeString( - $name, 'F' - ), - 'custom' => $custom, - 'options' => $options); + // this pains me... but to avoid collusion + $filter_type_code = ComponentbuilderHelper::safeString( + $nameListCode . 'filter' . $name + ); + $filter_type_code = preg_replace('/_+/', '', $filter_type_code); + $filter_function_name = ComponentbuilderHelper::safeString( + $name, 'F' + ); + // add the language only for new filter option + $filter_name_select_lang = ''; + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + // set the language strings for selection + $filter_name_select = 'Select ' . $listFieldName; + $filter_name_select_lang = $lang_filter_ + . ComponentbuilderHelper::safeString( + $filter_name_select, 'U' + ); + // and to translation + $this->setLangContent( + $this->lang, $filter_name_select_lang, $filter_name_select + ); + } + + // add the filter details + $this->filterBuilder[$nameListCode][] = array( + 'id' => (int) $field['field'], + 'type' => $typeName, + 'multi' => $field['filter'], + 'code' => $name, + 'label' => $langLabel, + 'lang' => $listLangName, + 'lang_select' => $filter_name_select_lang, + 'database' => $nameSingleCode, + 'function' => $filter_function_name, + 'custom' => $custom, + 'options' => $options, + 'filter_type' => $filter_type_code + ); } // build the layout @@ -4906,21 +5090,21 @@ class Fields extends Structure // set to publishing tab $tabName = 'publishing'; } - $this->setLayoutBuilder($view_name_single, $tabName, $name, $field); + $this->setLayoutBuilder($nameSingleCode, $tabName, $name, $field); } /** * set Custom Field Type File * - * @param array $data The field complete data set - * @param string $view_name_list The list view code name - * @param string $view_name_single The single view code name + * @param array $data The field complete data set + * @param string $nameListCode The list view code name + * @param string $nameSingleCode The single view code name * * @return void * */ - public function setCustomFieldTypeFile($data, $view_name_list, - $view_name_single + public function setCustomFieldTypeFile($data, $nameListCode, + $nameSingleCode ) { // make sure it is not already been build or if it is prime if (isset($data['custom']) && isset($data['custom']['extends']) @@ -4971,7 +5155,7 @@ class Fields extends Structure ? $data['code'] . '_' . $data['custom']['text'] : '', $this->bbb . 'CODE' . $this->ddd => (isset($data['code'])) ? $data['code'] : '', - $this->bbb . 'view_type' . $this->ddd => $view_name_single + $this->bbb . 'view_type' . $this->ddd => $nameSingleCode . '_' . $data['type'], $this->bbb . 'type' . $this->ddd => (isset($data['type'])) ? $data['type'] : '', @@ -4994,14 +5178,14 @@ class Fields extends Structure $data['custom']['view'] )) ? ComponentbuilderHelper::safeString( $data['custom']['view'] - ) : $view_name_single, + ) : $nameSingleCode, $this->bbb . 'views' . $this->ddd => (isset($data['custom']['views']) && ComponentbuilderHelper::checkString( $data['custom']['views'] )) ? ComponentbuilderHelper::safeString( $data['custom']['views'] - ) : $view_name_list + ) : $nameListCode ); // now set the ###PLACEHOLDER### options foreach ($replace as $replacekey => $replacevalue) @@ -5027,7 +5211,7 @@ class Fields extends Structure } // start loading the field type $this->fileContentDynamic['customfield_' . $data['type']] = array(); - // JPREFIX <>> + // JPREFIX <<>> $this->fileContentDynamic['customfield_' . $data['type']][$this->hhh . 'JPREFIX' . $this->hhh] = $jprefix; @@ -5281,9 +5465,9 @@ class Fields extends Structure } } // if this field gets used in plugin or module we should track it so if needed we can copy it over - if ((strpos($view_name_single, 'P|uG!n') !== false + if ((strpos($nameSingleCode, 'P|uG!n') !== false || strpos( - $view_name_single, 'M0dU|3' + $nameSingleCode, 'M0dU|3' ) !== false) && isset($data['custom']) && isset($data['custom']['type'])) @@ -5293,6 +5477,447 @@ class Fields extends Structure } } + /** + * This is just to get the code. + * Don't use this to build the field + * + * @param array $custom The field complete data set + * + * @return array with the code + * + */ + public function getCustomFieldCode($custom) + { + // the code bucket + $code_bucket = array( + 'JFORM_TYPE_HEADER' => '', + 'JFORM_TYPE_PHP' => '' + ); + // set tab and break replacements + $tabBreak = array( + '\t' => $this->_t(1), + '\n' => PHP_EOL + ); + // load the other PHP options + foreach (ComponentbuilderHelper::$phpFieldArray as $x) + { + // reset the php bucket + $phpBucket = ''; + // only set if available + if (isset($custom['php' . $x]) + && ComponentbuilderHelper::checkArray( + $custom['php' . $x] + )) + { + foreach ($custom['php' . $x] as $line => $code) + { + if (ComponentbuilderHelper::checkString($code)) + { + $phpBucket .= PHP_EOL . $this->setPlaceholders( + $code, $tabBreak + ); + } + } + // check if this is header text + if ('HEADER' === $x) + { + $code_bucket['JFORM_TYPE_HEADER'] + .= PHP_EOL . $phpBucket; + } + else + { + // JFORM_TYPE_PHP <<>> + $code_bucket['JFORM_TYPE_PHP'] + .= PHP_EOL . $phpBucket; + } + } + } + + return $code_bucket; + } + + /** + * set the Filter Field set of a view + * + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return string The fields set in xml + * + */ + public function setFieldFilterSet(&$nameSingleCode, &$nameListCode) + { + // check if this is the above/new filter option + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + // we first create the file + $target = array('admin' => 'filter_' . $nameListCode); + $this->buildDynamique( + $target, 'filter' + ); + // the search language string + $lang_search = $this->langPrefix . '_FILTER_SEARCH'; + // and to translation + $this->setLangContent( + $this->lang, $lang_search, 'Search' + . ComponentbuilderHelper::safeString($nameListCode, 'w') + ); + // the search description language string + $lang_search_desc = $this->langPrefix . '_FILTER_SEARCH_' + . strtoupper($nameListCode); + // and to translation + $this->setLangContent( + $this->lang, $lang_search_desc, 'Search the ' + . ComponentbuilderHelper::safeString($nameSingleCode, 'w') + . ' items. Prefix with ID: to search for an item by ID.' + ); + // now build the XML + $field_filter_sets = array(); + $field_filter_sets[] = $this->_t(1) . ''; + // we first add the search + $field_filter_sets[] = $this->_t(2) . '_t(3) . 'type="text"'; + $field_filter_sets[] = $this->_t(3) . 'name="search"'; + $field_filter_sets[] = $this->_t(3) . 'inputmode="search"'; + $field_filter_sets[] = $this->_t(3) + . 'label="' . $lang_search . '"'; + $field_filter_sets[] = $this->_t(3) + . 'description="' . $lang_search_desc . '"'; + $field_filter_sets[] = $this->_t(3) . 'hint="JSEARCH_FILTER"'; + $field_filter_sets[] = $this->_t(2) . '/>'; + // add the published filter if published is not set + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) + { + // the published language string + $lang_published = $this->langPrefix . '_FILTER_PUBLISHED'; + // and to translation + $this->setLangContent( + $this->lang, $lang_published, 'Status' + ); + // the published description language string + $lang_published_desc = $this->langPrefix . '_FILTER_PUBLISHED_' + . strtoupper($nameListCode); + // and to translation + $this->setLangContent( + $this->lang, $lang_published_desc, 'Status options for ' + . ComponentbuilderHelper::safeString($nameListCode, 'w') + ); + $field_filter_sets[] = $this->_t(2) . '_t(3) . 'type="status"'; + $field_filter_sets[] = $this->_t(3) . 'name="published"'; + $field_filter_sets[] = $this->_t(3) + . 'label="' . $lang_published . '"'; + $field_filter_sets[] = $this->_t(3) + . 'description="' . $lang_published_desc . '"'; + $field_filter_sets[] = $this->_t(3) + . 'onchange="this.form.submit();"'; + $field_filter_sets[] = $this->_t(2) . '>'; + $field_filter_sets[] = $this->_t(3) + . ''; + $field_filter_sets[] = $this->_t(2) . '
'; + } + // add the category if found + if (isset($this->categoryBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->categoryBuilder[$nameListCode] + ) + && isset($this->categoryBuilder[$nameListCode]['extension'])) + { + $field_filter_sets[] = $this->_t(2) . '_t(3) . 'type="category"'; + $field_filter_sets[] = $this->_t(3) . 'name="category_id"'; + $field_filter_sets[] = $this->_t(3) + . 'label="' . $this->categoryBuilder[$nameListCode]['name'] + . '"'; + $field_filter_sets[] = $this->_t(3) + . 'description="JOPTION_FILTER_CATEGORY_DESC"'; + $field_filter_sets[] = $this->_t(3) . 'multiple="true"'; + $field_filter_sets[] = $this->_t(3) + . 'class="multipleCategories"'; + $field_filter_sets[] = $this->_t(3) . 'extension="' + . $this->categoryBuilder[$nameListCode]['extension'] . '"'; + $field_filter_sets[] = $this->_t(3) + . 'onchange="this.form.submit();"'; + // TODO NOT SURE IF THIS SHOULD BE STATIC + $field_filter_sets[] = $this->_t(3) . 'published="0,1,2"'; + $field_filter_sets[] = $this->_t(2) . '/>'; + } + // add the access filter if this view has access + // and if access manually is not set + if (isset($this->accessBuilder[$nameSingleCode]) + && ComponentbuilderHelper::checkString( + $this->accessBuilder[$nameSingleCode] + ) + && !isset($this->fieldsNames[$nameSingleCode]['access'])) + { + $field_filter_sets[] = $this->_t(2) . '_t(3) . 'type="accesslevel"'; + $field_filter_sets[] = $this->_t(3) . 'name="access"'; + $field_filter_sets[] = $this->_t(3) + . 'label="JFIELD_ACCESS_LABEL"'; + $field_filter_sets[] = $this->_t(3) + . 'description="JFIELD_ACCESS_DESC"'; + $field_filter_sets[] = $this->_t(3) . 'multiple="true"'; + $field_filter_sets[] = $this->_t(3) + . 'class="multipleAccessLevels"'; + $field_filter_sets[] = $this->_t(3) + . 'onchange="this.form.submit();"'; + $field_filter_sets[] = $this->_t(2) . '/>'; + } + // now add the dynamic fields + if (isset($this->filterBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->filterBuilder[$nameListCode] + )) + { + foreach ($this->filterBuilder[$nameListCode] as $r => &$filter) + { + if ($filter['type'] != 'category') + { + $field_filter_sets[] = $this->_t(2) . '_t(3) . 'type="' + . $filter['type'] . '"'; + // set css classname of this field + $filter['class'] = ucfirst($filter['type']); + } + else + { + // we use the filter field type that was build + $field_filter_sets[] = $this->_t(3) . 'type="' + . $filter['filter_type'] . '"'; + // set css classname of this field + $filter['class'] = ucfirst($filter['filter_type']); + } + $field_filter_sets[] = $this->_t(3) . 'name="' + . $filter['code'] . '"'; + $field_filter_sets[] = $this->_t(3) . 'label="' + . $filter['label'] . '"'; + // if this is a multi field + if ($filter['multi'] == 2) + { + $field_filter_sets[] = $this->_t(3) + . 'class="multiple' + . $filter['class'] . '"'; + $field_filter_sets[] = $this->_t(3) + . 'multiple="true"'; + } + else + { + $field_filter_sets[] = $this->_t(3) + . 'multiple="false"'; + } + $field_filter_sets[] = $this->_t(3) + . 'onchange="this.form.submit();"'; + $field_filter_sets[] = $this->_t(2) . '/>'; + } + } + } + $field_filter_sets[] = $this->_t(2) + . ''; + $field_filter_sets[] = $this->_t(1) . ''; + + // now update the file + return implode(PHP_EOL, $field_filter_sets); + } + + return ''; + } + + /** + * set the Filter List set of a view + * + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return string The fields set in xml + * + */ + public function setFieldFilterListSet(&$nameSingleCode, &$nameListCode) + { + // check if this is the above/new filter option + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + // keep track of all fields already added + $donelist = array('ordering' => true, 'id' => true); + // now build the XML + $list_sets = array(); + $list_sets[] = $this->_t(1) . ''; + $list_sets[] = $this->_t(2) . '_t(3) . 'name="fullordering"'; + $list_sets[] = $this->_t(3) . 'type="list"'; + $list_sets[] = $this->_t(3) + . 'label="COM_CONTENT_LIST_FULL_ORDERING"'; + $list_sets[] = $this->_t(3) + . 'description="COM_CONTENT_LIST_FULL_ORDERING_DESC"'; + $list_sets[] = $this->_t(3) . 'onchange="this.form.submit();"'; + // add dynamic ordering (Admin view) + $default_ordering = $this->getListViewDefaultOrdering( + $nameListCode + ); + // set the default ordering + $list_sets[] = $this->_t(3) . 'default="' + . $default_ordering['name'] . ' ' + . $default_ordering['direction'] . '"'; + $list_sets[] = $this->_t(3) . 'validate="options"'; + $list_sets[] = $this->_t(2) . '>'; + $list_sets[] = $this->_t(3) + . ''; + $list_sets[] = $this->_t(3) + . ''; + $list_sets[] = $this->_t(3) + . ''; + // add the published filter if published is not set + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) + { + // add to done list + $donelist['published'] = true; + // add to xml :) + $list_sets[] = $this->_t(3) + . ''; + $list_sets[] = $this->_t(3) + . ''; + } + + // add the rest of the set filters + if (isset($this->sortBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->sortBuilder[$nameListCode] + )) + { + foreach ($this->sortBuilder[$nameListCode] as $filter) + { + if (!isset($donelist[$filter['code']])) + { + if ($filter['type'] === 'category') + { + $list_sets[] = $this->_t(3) + . ''; + $list_sets[] = $this->_t(3) + . ''; + } + elseif (ComponentbuilderHelper::checkArray( + $filter['custom'] + )) + { + $list_sets[] = $this->_t(3) . ''; + $list_sets[] = $this->_t(3) . ''; + } + else + { + $list_sets[] = $this->_t(3) . ''; + $list_sets[] = $this->_t(3) . ''; + } + // do not add again + $donelist[$filter['code']] = true; + } + } + } + + $list_sets[] = $this->_t(3) + . ''; + $list_sets[] = $this->_t(3) + . ''; + $list_sets[] = $this->_t(2) . '
' . PHP_EOL; + + $list_sets[] = $this->_t(2) . '_t(3) . 'name="limit"'; + $list_sets[] = $this->_t(3) . 'type="limitbox"'; + $list_sets[] = $this->_t(3) . 'label="COM_CONTENT_LIST_LIMIT"'; + $list_sets[] = $this->_t(3) + . 'description="COM_CONTENT_LIST_LIMIT_DESC"'; + $list_sets[] = $this->_t(3) . 'class="input-mini"'; + $list_sets[] = $this->_t(3) . 'default="25"'; + $list_sets[] = $this->_t(3) . 'onchange="this.form.submit();"'; + $list_sets[] = $this->_t(2) . '/>'; + $list_sets[] = $this->_t(1) . ''; + + return implode(PHP_EOL, $list_sets); + } + + return ''; + } + + /** + * set Custom Field for Filter + * + * @param string $getOptions The get options php string/code + * @param array $filter The filter details + * + * @return void + * + */ + public function setFilterFieldFile($getOptions, $filter) + { + // make sure it is not already been build + if (!isset( + $this->fileContentDynamic['customfilterfield_' + . $filter['filter_type']] + ) + || !ComponentbuilderHelper::checkArray( + $this->fileContentDynamic['customfilterfield_' + . $filter['filter_type']] + ) + ) + { + // start loading the field type + $this->fileContentDynamic['customfilterfield_' + . $filter['filter_type']] + = array(); + // JPREFIX <>> + $this->fileContentDynamic['customfilterfield_' + . $filter['filter_type']][$this->hhh + . 'JPREFIX' . $this->hhh] + = 'J'; + // Type <<>> + $this->fileContentDynamic['customfilterfield_' + . $filter['filter_type']][$this->hhh + . 'Type' . $this->hhh] + = ComponentbuilderHelper::safeString( + $filter['filter_type'], 'F' + ); + // type <<>> + $this->fileContentDynamic['customfilterfield_' + . $filter['filter_type']][$this->hhh + . 'type' . $this->hhh] + = ComponentbuilderHelper::safeString($filter['filter_type']); + // JFORM_GETOPTIONS_PHP <<>> + $this->fileContentDynamic['customfilterfield_' + . $filter['filter_type']][$this->hhh . 'JFORM_GETOPTIONS_PHP' + . $this->hhh] + = $getOptions; + // ADD_BUTTON <<>> + $this->fileContentDynamic['customfilterfield_' + . $filter['filter_type']][$this->hhh . 'ADD_BUTTON' . $this->hhh] + = ''; + // now build the custom filter field type file + $target = array('admin' => 'customfilterfield'); + $this->buildDynamique( + $target, 'fieldlist', + $filter['filter_type'] + ); + } + } + /** * set Add Button To List Field (getInput tweak) * diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index d5b22de90..35a98d8ab 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -842,9 +842,8 @@ class Interpretation extends Fields JText::_('

WHMCS Error

'), 'Error' ); $this->app->enqueueMessage( - JText::sprintf( - 'The WHMCS class could not be added to this component. You will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes. If you have done this, then please check that you have your own Basic Encryption set in the global settings of JCB. Then open and save this component again, making sure that your WHMCS settings are still correct.', - $this->libraries[$id]->name + JText::_( + 'The WHMCS class could not be added to this component. You will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes. If you have done this, then please check that you have your own Basic Encryption set in the global settings of JCB. Then open and save this component again, making sure that your WHMCS settings are still correct.' ), 'Error' ); @@ -1178,11 +1177,11 @@ class Interpretation extends Fields $updateXML[] = ''; // UPDATE_SERVER_XML $name = substr( - $this->componentData->update_server_url, - strrpos($this->componentData->update_server_url, '/') - + 1 - ); - $name = explode('.xml', $name)[0]; + $this->componentData->update_server_url, + strrpos($this->componentData->update_server_url, '/') + + 1 + ); + $name = explode('.xml', $name)[0]; $target = array('admin' => $name); $this->buildDynamique($target, 'update_server'); $this->fileContentDynamic[$name][$this->hhh @@ -1454,9 +1453,9 @@ class Interpretation extends Fields return implode(PHP_EOL, $help); } - public function checkHelp($viewName_single) + public function checkHelp($nameSingleCode) { - if ($viewName_single == "help_document") + if ($nameSingleCode == "help_document") { // set help file into admin place $target = array('admin' => 'help'); @@ -1685,7 +1684,8 @@ class Interpretation extends Fields $exel[] = $this->_t(2) . "));"; $exel[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Add some data"; - $exel[] = $this->_t(2) . "if ((\$size = self::checkArray(\$rows)) !== false)"; + $exel[] = $this->_t(2) + . "if ((\$size = self::checkArray(\$rows)) !== false)"; $exel[] = $this->_t(2) . "{"; $exel[] = $this->_t(3) . "\$i = 1;"; $exel[] = PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -1702,7 +1702,8 @@ class Interpretation extends Fields $exel[] = $this->_t(3) . "}"; $exel[] = PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Set active sheet and get it."; - $exel[] = $this->_t(3) . "\$active_sheet = \$spreadsheet->setActiveSheetIndex(0);"; + $exel[] = $this->_t(3) + . "\$active_sheet = \$spreadsheet->setActiveSheetIndex(0);"; $exel[] = $this->_t(3) . "foreach (\$rows as \$array)"; $exel[] = $this->_t(3) . "{"; $exel[] = $this->_t(4) . "\$a = 'A';"; @@ -1712,7 +1713,7 @@ class Interpretation extends Fields . "\$active_sheet->setCellValue(\$a.\$i, \$value);"; $exel[] = $this->_t(5) . "if (\$xls_mode != 3)"; $exel[] = $this->_t(5) . "{"; - $exel[] = $this->_t(6) . "if (\$i == 1)"; + $exel[] = $this->_t(6) . "if (\$i == 1)"; $exel[] = $this->_t(6) . "{"; $exel[] = $this->_t(7) . "\$active_sheet->getColumnDimension(\$a)->setAutoSize(true);"; @@ -1878,30 +1879,37 @@ class Interpretation extends Fields $method[] = PHP_EOL . PHP_EOL . $this->_t(1) . "/**"; $method[] = $this->_t(1) . " * Greate user and update given table"; $method[] = $this->_t(1) . " *"; - $method[] = $this->_t(1) . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)"; + $method[] = $this->_t(1) + . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)"; $method[] = $this->_t(1) . " * @param int \$autologin"; - $method[] = $this->_t(1) . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)"; - $method[] = $this->_t(1) . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = $this->_t(1) + . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)"; + $method[] = $this->_t(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; $method[] = $this->_t(1) . " *"; - $method[] = $this->_t(1) . " * @return int|Error User ID on success, or an error."; + $method[] = $this->_t(1) + . " * @return int|Error User ID on success, or an error."; $method[] = $this->_t(1) . " */"; $method[] = $this->_t(1) . "public static function createUser(\$credentials, \$autologin = 0,"; $method[] = $this->_t(2) . "\$params = array("; - $method[] = $this->_t(3) . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = $this->_t(3) + . "'useractivation' => 0, 'sendpassword' => 1"; $method[] = $this->_t(2) . "), \$mode = 1"; $method[] = $this->_t(1) . ")"; $method[] = $this->_t(1) . "{"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Override mode"; - $method[] = $this->_t(2) . "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))"; + $method[] = $this->_t(2) + . "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Update params"; $method[] = $this->_t(3) . "\$params['autologin'] = \$autologin;"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Now Register User"; - $method[] = $this->_t(3) . "return self::registerUser(\$credentials, \$params);"; + $method[] = $this->_t(3) + . "return self::registerUser(\$credentials, \$params);"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "elseif (\$mode == 2)"; $method[] = $this->_t(2) . "{"; @@ -1921,7 +1929,9 @@ class Interpretation extends Fields . "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Load the correct user model."; - $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site Registrations"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -1942,14 +1952,14 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "if (self::checkArray(\$params))"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) - . " Make changes to user config"; + . " Make changes to user config"; $method[] = $this->_t(3) . "foreach (\$params as \$param => \$set)"; $method[] = $this->_t(3) . "{"; $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " If you know of a better path, let me know"; $method[] = $this->_t(4) - ."\$params[\$param] = self::setParams(\$extension, \$param, \$set);"; + . "\$params[\$param] = self::setParams(\$extension, \$param, \$set);"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -1963,25 +1973,31 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Lineup new user data array"; $method[] = $this->_t(2) . "\$data = array("; - $method[] = $this->_t(3) . "'username' => \$credentials['username'],"; + $method[] = $this->_t(3) + . "'username' => \$credentials['username'],"; $method[] = $this->_t(3) . "'name' => \$credentials['name'],"; $method[] = $this->_t(3) . "'block' => 0 );"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Added details based on mode"; - $method[] = $this->_t(2) . "if (\$mode == 1) //". $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "\$data['email1'] = \$credentials['email'];"; + $method[] = $this->_t(3) + . "\$data['email1'] = \$credentials['email'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "else //" . $this->setLine(__LINE__) . " 0 = Admin-registration mode"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "\$data['email'] = \$credentials['email'];"; - $method[] = $this->_t(3) . "\$data['registerDate'] = JFactory::getDate()->toSql();"; + $method[] = $this->_t(3) + . "\$data['email'] = \$credentials['email'];"; + $method[] = $this->_t(3) + . "\$data['registerDate'] = JFactory::getDate()->toSql();"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) - . " Check if password was set"; + . " Check if password was set"; $method[] = $this->_t(2) . "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !self::checkString(\$credentials['password']) || !self::checkString(\$credentials['password2'])))"; $method[] = $this->_t(2) . "{"; @@ -1989,8 +2005,10 @@ class Interpretation extends Fields . " Set random password when empty password was submitted,"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " when using the 1 = site-registration mode"; - $method[] = $this->_t(3) . "\$credentials['password'] = self::randomkey(8);"; - $method[] = $this->_t(3) . "\$credentials['password2'] = \$credentials['password'];"; + $method[] = $this->_t(3) + . "\$credentials['password'] = self::randomkey(8);"; + $method[] = $this->_t(3) + . "\$credentials['password2'] = \$credentials['password'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -1998,17 +2016,22 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && self::checkString(\$credentials['password']) && self::checkString(\$credentials['password2']))"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "if (\$mode == 1) //". $this->setLine(__LINE__) + $method[] = $this->_t(3) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(3) . "{"; - $method[] = $this->_t(4) . "\$data['password1'] = \$credentials['password'];"; + $method[] = $this->_t(4) + . "\$data['password1'] = \$credentials['password'];"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(3) . "else //" . $this->setLine(__LINE__) . " 0 = Admin-registration mode"; $method[] = $this->_t(3) . "{"; - $method[] = $this->_t(4) . "\$data['password'] = \$credentials['password'];"; + $method[] = $this->_t(4) + . "\$data['password'] = \$credentials['password'];"; $method[] = $this->_t(3) . "}"; - $method[] = $this->_t(3) . "\$data['password2'] = \$credentials['password2'];"; + $method[] = $this->_t(3) + . "\$data['password2'] = \$credentials['password2'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Load the group/s value if set, only for Admin Registration (\$mode == 0)"; @@ -2020,7 +2043,9 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Create the new user"; - $method[] = $this->_t(2) . "if (\$mode == 1) //". $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "\$userId = \$model->register(\$data);"; @@ -2029,7 +2054,8 @@ class Interpretation extends Fields . " 0 = Admin-registration mode"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "\$model->save(\$data);"; - $method[] = $this->_t(3) . "\$userId = \$model->getState('user.id', 0);"; + $method[] = $this->_t(3) + . "\$userId = \$model->getState('user.id', 0);"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -2044,7 +2070,7 @@ class Interpretation extends Fields $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " If you know of a better path, let me know"; $method[] = $this->_t(4) - ."self::setParams(\$extension, \$param, \$set);"; + . "self::setParams(\$extension, \$param, \$set);"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -2053,12 +2079,14 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Auto Login if Needed"; - $method[] = $this->_t(3) . "if (\$autologin && isset(\$credentials['password']))"; + $method[] = $this->_t(3) + . "if (\$autologin && isset(\$credentials['password']))"; $method[] = $this->_t(3) . "{"; $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Try to login"; $method[] = $this->_t(4) . "try{"; - $method[] = $this->_t(5) . "JFactory::getApplication()->login(\$credentials);"; + $method[] = $this->_t(5) + . "JFactory::getApplication()->login(\$credentials);"; $method[] = $this->_t(4) . "} catch (Exception \$exception){"; $method[] = $this->_t(5) . "//" . $this->setLine(__LINE__) . " Do noting for now, may want to set redirect."; @@ -2170,17 +2198,18 @@ class Interpretation extends Fields return ''; } - public function setAdminViewMenu(&$viewName_single, &$view) + public function setAdminViewMenu(&$nameSingleCode, &$view) { $xml = ''; // build the file target values - $target = array('site' => $viewName_single); + $target = array('site' => $nameSingleCode); // build the edit.xml file if ($this->buildDynamique($target, 'admin_menu')) { // set the lang $lang = ComponentbuilderHelper::safeString( - 'com_' . $this->componentCodeName . '_menu_' . $viewName_single, + 'com_' . $this->componentCodeName . '_menu_' + . $nameSingleCode, 'U' ); $this->setLangContent( @@ -2211,7 +2240,7 @@ class Interpretation extends Fields $this->app->enqueueMessage( JText::sprintf( '

Site menu for %s was not build.

', - $viewName_single + $nameSingleCode ), 'Warning' ); } @@ -4748,57 +4777,6 @@ class Interpretation extends Fields return false; } - /** - * get the a script from the custom script builder - * - * @param string $first The first key - * @param string $second The second key - * @param string $prefix The prefix to add in front of the script if found - * @param string $note The switch/note to add to the script - * @param bool $unset The switch to unset the value if found - * @param string $default The switch/string to use as default return if script not found - * @param string $sufix The sufix to add after the script if found - * - * @return mix The string/script if found or the default value if not found - * - */ - public function getCustomScriptBuilder($first, $second, $prefix = '', - $note = null, $unset = null, $default = null, $sufix = '' - ) { - // default is to return an empty string - $script = ''; - // check if there is any custom script - if (isset($this->customScriptBuilder[$first][$second]) - && ComponentbuilderHelper::checkString( - $this->customScriptBuilder[$first][$second] - )) - { - // add not if set - if ($note) - { - $script .= $note; - } - // load the actual script - $script .= $prefix . str_replace( - array_keys($this->placeholders), - array_values($this->placeholders), - $this->customScriptBuilder[$first][$second] - ) . $sufix; - // clear some memory - if ($unset) - { - unset($this->customScriptBuilder[$first][$second]); - } - } - // if not found return default - if (!ComponentbuilderHelper::checkString($script) && $default) - { - return $default; - } - - return $script; - } - public function setCustomViewListQuery(&$get, $code, $return = true) { if (ComponentbuilderHelper::checkObject($get)) @@ -5064,49 +5042,48 @@ class Interpretation extends Fields return $script . $getItem; } - public function setAdminViewDisplayMethod($viewName_list) + /** + * build code for the admin view display method + * + * @param string $nameListCode The list view name + * + * @return string The php to place in view.html.php + * + */ + public function setAdminViewDisplayMethod($nameListCode) { $script = ''; - if (isset($this->viewsDefaultOrdering[$viewName_list]) - && $this->viewsDefaultOrdering[$viewName_list]['add_admin_ordering'] - == 1) + // add the the new filter methods for the search toolbar above the list view (2 = topbar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) { - // the first is from the state - $order_first = true; - foreach ( - $this->viewsDefaultOrdering[$viewName_list]['admin_ordering_fields'] - as $order_field - ) - { - if ($order_first && ($order_field_name = $this->getFieldDatabaseName( - $viewName_list, $order_field['field'] - )) !== false) - { - // just the first field is based on state - $order_first = false; - $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( - __LINE__ - ) . " Add the list ordering clause."; - $script .= PHP_EOL . $this->_t(2) - . "\$this->listOrder = \$this->escape(\$this->state->get('list.ordering', '" - . $order_field_name . "'));"; - $script .= PHP_EOL . $this->_t(2) - . "\$this->listDirn = \$this->escape(\$this->state->get('list.direction', '" - . $order_field['direction'] . "'));"; - } - } - } - // if no ordering is added we must add default - if (!ComponentbuilderHelper::checkString($script)) - { - $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( + $script .= PHP_EOL . $this->_t(2) . "//" + . $this->setLine( __LINE__ - ) . " Add the list ordering clause."; - $script .= PHP_EOL . $this->_t(2) - . "\$this->listOrder = \$this->escape(\$this->state->get('list.ordering', 'a.id'));"; - $script .= PHP_EOL . $this->_t(2) - . "\$this->listDirn = \$this->escape(\$this->state->get('list.direction', 'asc'));"; + ) . " Load the filter form from xml."; + $script .= PHP_EOL . $this->_t(2) . "\$this->filterForm " + . "= \$this->get('FilterForm');"; + $script .= PHP_EOL . $this->_t(2) . "//" + . $this->setLine( + __LINE__ + ) . " Load the active filters."; + $script .= PHP_EOL . $this->_t(2) . "\$this->activeFilters " + . "= \$this->get('ActiveFilters');"; } + // get the default ordering values + $default_ordering = $this->getListViewDefaultOrdering($nameListCode); + // now add the default ordering + $script .= PHP_EOL . $this->_t(2) . "//" + . $this->setLine( + __LINE__ + ) . " Add the list ordering clause."; + $script .= PHP_EOL . $this->_t(2) + . "\$this->listOrder = \$this->escape(\$this->state->get('list.ordering', '" + . $default_ordering['name'] . "'));"; + $script .= PHP_EOL . $this->_t(2) + . "\$this->listDirn = \$this->escape(\$this->state->get('list.direction', '" + . $default_ordering['direction'] . "'));"; + return $script; } @@ -5515,38 +5492,32 @@ class Interpretation extends Fields { if (1 == $type) { - $viewName = $view['settings']->code; + $viewCodeName = $view['settings']->code; } if (2 == $type) { - $viewName = ComponentbuilderHelper::safeString( - $view['settings']->name_single - ); + $viewCodeName = $view['settings']->name_single_code; } // set the custom buttons CUSTOM_BUTTONS_CONTROLLER - $this->fileContentDynamic[$viewName][$this->hhh . $TARGET + $this->fileContentDynamic[$viewCodeName][$this->hhh . $TARGET . '_CUSTOM_BUTTONS_CONTROLLER' . $this->hhh] = ''; // set the custom buttons CUSTOM_BUTTONS_METHOD - $this->fileContentDynamic[$viewName][$this->hhh . $TARGET + $this->fileContentDynamic[$viewCodeName][$this->hhh . $TARGET . '_CUSTOM_BUTTONS_METHOD' . $this->hhh] = ''; } elseif (3 == $type) { // set the names - $viewName = ComponentbuilderHelper::safeString( - $view['settings']->name_single - ); - $viewsName = ComponentbuilderHelper::safeString( - $view['settings']->name_list - ); + $viewCodeName = $view['settings']->name_single_code; + $viewsCodeName = $view['settings']->name_list_code; // set the custom buttons CUSTOM_BUTTONS_CONTROLLER_LIST - $this->fileContentDynamic[$viewsName][$this->hhh . $TARGET + $this->fileContentDynamic[$viewsCodeName][$this->hhh . $TARGET . '_CUSTOM_BUTTONS_CONTROLLER_LIST' . $this->hhh] = ''; // set the custom buttons CUSTOM_BUTTONS_METHOD_LIST - $this->fileContentDynamic[$viewsName][$this->hhh . $TARGET + $this->fileContentDynamic[$viewsCodeName][$this->hhh . $TARGET . '_CUSTOM_BUTTONS_METHOD_LIST' . $this->hhh] = ''; // validate selection @@ -5558,11 +5529,12 @@ class Interpretation extends Fields if ($this->target === 'site') { // set the custom buttons SITE_TOP_BUTTON - $this->fileContentDynamic[$viewName][$this->hhh . 'SITE_TOP_BUTTON' + $this->fileContentDynamic[$viewCodeName][$this->hhh + . 'SITE_TOP_BUTTON' . $this->hhh] = ''; // set the custom buttons SITE_BOTTOM_BUTTON - $this->fileContentDynamic[$viewName][$this->hhh + $this->fileContentDynamic[$viewCodeName][$this->hhh . 'SITE_BOTTOM_BUTTON' . $this->hhh] = ''; // load into place @@ -5570,25 +5542,25 @@ class Interpretation extends Fields { case 1: // set buttons to top right of the view - $this->fileContentDynamic[$viewName][$this->hhh + $this->fileContentDynamic[$viewCodeName][$this->hhh . 'SITE_TOP_BUTTON' . $this->hhh] = '
toolbar->render(); ?>
'; break; case 2: // set buttons to top left of the view - $this->fileContentDynamic[$viewName][$this->hhh + $this->fileContentDynamic[$viewCodeName][$this->hhh . 'SITE_TOP_BUTTON' . $this->hhh] = 'toolbar->render(); ?>'; break; case 3: // set buttons to buttom right of the view - $this->fileContentDynamic[$viewName][$this->hhh + $this->fileContentDynamic[$viewCodeName][$this->hhh . 'SITE_BOTTOM_BUTTON' . $this->hhh] = '
toolbar->render(); ?>
'; break; case 4: // set buttons to buttom left of the view - $this->fileContentDynamic[$viewName][$this->hhh + $this->fileContentDynamic[$viewCodeName][$this->hhh . 'SITE_BOTTOM_BUTTON' . $this->hhh] = 'toolbar->render(); ?>'; break; @@ -5606,12 +5578,12 @@ class Interpretation extends Fields // add this button only if this is not the default view if ($this->dynamicDashboardType !== 'custom_admin_views' || ($this->dynamicDashboardType === 'custom_admin_views' - && $this->dynamicDashboard !== $viewName)) + && $this->dynamicDashboard !== $viewCodeName)) { $buttons[] = $tab . $this->_t(2) . "//" . $this->setLine(__LINE__) . " add cpanel button"; $buttons[] = $tab . $this->_t(2) - . "JToolBarHelper::custom('" . $viewName . "." + . "JToolBarHelper::custom('" . $viewCodeName . "." . "dashboard', 'grid-2', '', 'COM_" . $this->fileContentStatic[$this->hhh . 'COMPONENT' . $this->hhh] @@ -5652,14 +5624,16 @@ class Interpretation extends Fields || $this->target === 'site') { $buttons[] = $this->_t(1) . $tab . $this->_t(1) - . "if (\$this->user->authorise('" . $viewName + . "if (\$this->user->authorise('" + . $viewCodeName . "." . $keyCode . "', 'com_" . $this->componentCodeName . "'))"; } else { $buttons[] = $this->_t(1) . $tab . $this->_t(1) - . "if (\$this->canDo->get('" . $viewName . "." + . "if (\$this->canDo->get('" . $viewCodeName + . "." . $keyCode . "'))"; } $buttons[] = $this->_t(1) . $tab . $this->_t(1) . "{"; @@ -5667,10 +5641,11 @@ class Interpretation extends Fields . $this->setLine(__LINE__) . " add " . $custom_button['name'] . " button."; $buttons[] = $this->_t(1) . $tab . $this->_t(2) - . "JToolBarHelper::custom('" . $viewName . "." + . "JToolBarHelper::custom('" . $viewCodeName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" . $keyLang + . strtolower($custom_button['method']) . "', '', '" + . $keyLang . "', false);"; $buttons[] = $this->_t(1) . $tab . $this->_t(1) . "}"; } @@ -5681,40 +5656,49 @@ class Interpretation extends Fields if (isset($custom_button['type']) && $custom_button['type'] == 2) { - if (!isset($this->onlyFunctionButton[$viewsName])) + if (!isset($this->onlyFunctionButton[$viewsCodeName])) { - $this->onlyFunctionButton[$viewsName] = array(); + $this->onlyFunctionButton[$viewsCodeName] + = array(); } - $this->onlyFunctionButton[$viewsName][] = $this->_t( + $this->onlyFunctionButton[$viewsCodeName][] + = $this->_t( 1 ) . $tab . "if (\$this->user->authorise('" - . $viewName . "." . $keyCode . "', 'com_" + . $viewCodeName . "." . $keyCode . "', 'com_" . $this->componentCodeName . "'))"; - $this->onlyFunctionButton[$viewsName][] = $this->_t( + $this->onlyFunctionButton[$viewsCodeName][] + = $this->_t( 1 ) . $tab . "{"; - $this->onlyFunctionButton[$viewsName][] = $this->_t( + $this->onlyFunctionButton[$viewsCodeName][] + = $this->_t( 1 ) . $tab . $this->_t(1) . "//" . $this->setLine( __LINE__ ) . " add " . $custom_button['name'] . " button."; - $this->onlyFunctionButton[$viewsName][] = $this->_t( + $this->onlyFunctionButton[$viewsCodeName][] + = $this->_t( 1 ) . $tab . $this->_t(1) - . "JToolBarHelper::custom('" . $viewsName . "." + . "JToolBarHelper::custom('" . $viewsCodeName + . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" + . strtolower($custom_button['method']) + . "', '', '" . $keyLang . "', false);"; - $this->onlyFunctionButton[$viewsName][] = $this->_t( + $this->onlyFunctionButton[$viewsCodeName][] + = $this->_t( 1 ) . $tab . "}"; } else { $buttons[] = $this->_t(1) . $tab . $this->_t(1) - . "if (\$this->user->authorise('" . $viewName + . "if (\$this->user->authorise('" + . $viewCodeName . "." . $keyCode . "', 'com_" . $this->componentCodeName . "'))"; $buttons[] = $this->_t(1) . $tab . $this->_t(1) @@ -5723,10 +5707,12 @@ class Interpretation extends Fields . "//" . $this->setLine(__LINE__) . " add " . $custom_button['name'] . " button."; $buttons[] = $this->_t(1) . $tab . $this->_t(2) - . "JToolBarHelper::custom('" . $viewsName . "." + . "JToolBarHelper::custom('" . $viewsCodeName + . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" + . strtolower($custom_button['method']) + . "', '', '" . $keyLang . "', '" . $validateSelection . "');"; $buttons[] = $this->_t(1) . $tab . $this->_t(1) @@ -5746,7 +5732,8 @@ class Interpretation extends Fields && $view['settings']->php_controller_list != '//') { // set the custom buttons CUSTOM_BUTTONS_CONTROLLER - $this->fileContentDynamic[$viewsName][$this->hhh . $TARGET + $this->fileContentDynamic[$viewsCodeName][$this->hhh + . $TARGET . '_CUSTOM_BUTTONS_CONTROLLER_LIST' . $this->hhh] = PHP_EOL . PHP_EOL . $this->setPlaceholders( $view['settings']->php_controller_list, @@ -5761,7 +5748,8 @@ class Interpretation extends Fields && $view['settings']->php_model_list != '//') { // set the custom buttons CUSTOM_BUTTONS_METHOD - $this->fileContentDynamic[$viewsName][$this->hhh . $TARGET + $this->fileContentDynamic[$viewsCodeName][$this->hhh + . $TARGET . '_CUSTOM_BUTTONS_METHOD_LIST' . $this->hhh] = PHP_EOL . PHP_EOL . $this->setPlaceholders( $view['settings']->php_model_list, @@ -5778,7 +5766,8 @@ class Interpretation extends Fields && $view['settings']->php_controller != '//') { // set the custom buttons CUSTOM_BUTTONS_CONTROLLER - $this->fileContentDynamic[$viewName][$this->hhh . $TARGET + $this->fileContentDynamic[$viewCodeName][$this->hhh + . $TARGET . '_CUSTOM_BUTTONS_CONTROLLER' . $this->hhh] = PHP_EOL . PHP_EOL . $this->setPlaceholders( $view['settings']->php_controller, @@ -5788,7 +5777,7 @@ class Interpretation extends Fields { // add the controller for this view // build the file - $target = array($this->target => $viewName); + $target = array($this->target => $viewCodeName); $this->buildDynamique($target, 'custom_form'); // GET_FORM_CUSTOM } @@ -5800,7 +5789,8 @@ class Interpretation extends Fields && $view['settings']->php_model != '//') { // set the custom buttons CUSTOM_BUTTONS_METHOD - $this->fileContentDynamic[$viewName][$this->hhh . $TARGET + $this->fileContentDynamic[$viewCodeName][$this->hhh + . $TARGET . '_CUSTOM_BUTTONS_METHOD' . $this->hhh] = PHP_EOL . PHP_EOL . $this->setPlaceholders( $view['settings']->php_model, $this->placeholders @@ -5812,9 +5802,11 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($buttons)) { // just to check if the submission script is manually added - if (!isset($view['settings']->php_document) || - strpos(implode(' ', $view['settings']->php_document), - '/submitbutton.js') === false) + if (!isset($view['settings']->php_document) + || strpos( + implode(' ', $view['settings']->php_document), + '/submitbutton.js' + ) === false) { // set the custom get form method JAVASCRIPT_FOR_BUTTONS $this->fileContentDynamic[$view['settings']->code][$this->hhh @@ -5851,16 +5843,16 @@ class Interpretation extends Fields return PHP_EOL . implode(PHP_EOL, $script); } - public function setFunctionOnlyButtons($viewName_list) + public function setFunctionOnlyButtons($nameListCode) { // return buttons if they were build - if (isset($this->onlyFunctionButton[$viewName_list]) + if (isset($this->onlyFunctionButton[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->onlyFunctionButton[$viewName_list] + $this->onlyFunctionButton[$nameListCode] )) { return PHP_EOL . implode( - PHP_EOL, $this->onlyFunctionButton[$viewName_list] + PHP_EOL, $this->onlyFunctionButton[$nameListCode] ); } @@ -6956,7 +6948,8 @@ class Interpretation extends Fields // add pagination start if (!$has_pagination_start) { - $body[] = $this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]; + $body[] = $this->placeholders[$this->bbb . 'PAGINATIONSTART' + . $this->ddd]; } if (!$has_limitbox && !$has_pagescounter) @@ -6977,14 +6970,28 @@ class Interpretation extends Fields // add pagination end if (!$has_pagination_end) { - $body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]; + $body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' + . $this->ddd]; } // lets clear the placeholders just in case - unset($this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGESCOUNTER' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]); + unset( + $this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGESCOUNTER' + . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGINATIONSTART' + . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGINATIONEND' + . $this->ddd] + ); // insure the form is added (only if no form exist) if (strpos($view['settings']->default, 'getCustomScriptBuilder( 'php_postflight', 'install', PHP_EOL . PHP_EOL, null, true ); + // add the Intelligent Fix script if needed + $script .= $this->getAssetsTableIntelligentInstall(); // add the component install notice if (ComponentbuilderHelper::checkString($script)) { @@ -8040,14 +8049,16 @@ class Interpretation extends Fields ) . " Get The Database object"; $script .= PHP_EOL . $this->_t(2) . "\$db = JFactory::getDbo();"; - foreach ($this->uninstallScriptBuilder as $viewName => $typeAlias) + foreach ( + $this->uninstallScriptBuilder as $viewsCodeName => $typeAlias + ) { // set a var value - $view = ComponentbuilderHelper::safeString($viewName); + $view = ComponentbuilderHelper::safeString($viewsCodeName); // check if it has field relations if (isset($this->uninstallScriptFields) - && isset($this->uninstallScriptFields[$viewName])) + && isset($this->uninstallScriptFields[$viewsCodeName])) { // First check if data is till in table $script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" @@ -8064,7 +8075,7 @@ class Interpretation extends Fields . "\$query->from(\$db->quoteName('#__fields'));"; $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ - ) . " Where " . $viewName . " context is found"; + ) . " Where " . $viewsCodeName . " context is found"; $script .= PHP_EOL . $this->_t(2) . "\$query->where( \$db->quoteName('context') . ' = '. \$db->quote('" . $typeAlias . "') );"; @@ -8092,7 +8103,8 @@ class Interpretation extends Fields // Now remove the actual type entry $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Remove " . $viewName . " from the field table"; + ) . " Remove " . $viewsCodeName + . " from the field table"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('context') . ' = '. \$db->quote('" . $typeAlias . "') );"; @@ -8109,7 +8121,7 @@ class Interpretation extends Fields . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Execute the query to remove " . $viewName + ) . " Execute the query to remove " . $viewsCodeName . " items"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; @@ -8118,7 +8130,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " If succesfully remove " . $viewName + ) . " If successfully remove " . $viewsCodeName . " add queued success message."; // TODO lang is not translated $script .= PHP_EOL . $this->_t(4) @@ -8128,7 +8140,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "}"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Also Remove " . $viewName . " field values"; + ) . " Also Remove " . $viewsCodeName . " field values"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('field_id') . ' IN ('. implode(',', \$" . $view . "_field_ids) .')');"; @@ -8145,7 +8157,7 @@ class Interpretation extends Fields . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Execute the query to remove " . $viewName + ) . " Execute the query to remove " . $viewsCodeName . " field values"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; @@ -8154,12 +8166,12 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " If succesfully remove " . $viewName + ) . " If successfully remove " . $viewsCodeName . " add queued success message."; // TODO lang is not translated $script .= PHP_EOL . $this->_t(4) . "\$app->enqueueMessage(JText:" - . ":_('The fields values for " . $viewName + . ":_('The fields values for " . $viewsCodeName . " was removed from the #__fields_values table'));"; $script .= PHP_EOL . $this->_t(3) . "}"; $script .= PHP_EOL . $this->_t(2) . "}"; @@ -8179,7 +8191,7 @@ class Interpretation extends Fields . "\$query->from(\$db->quoteName('#__fields_groups'));"; $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ - ) . " Where " . $viewName . " context is found"; + ) . " Where " . $viewsCodeName . " context is found"; $script .= PHP_EOL . $this->_t(2) . "\$query->where( \$db->quoteName('context') . ' = '. \$db->quote('" . $typeAlias . "') );"; @@ -8201,7 +8213,7 @@ class Interpretation extends Fields // Now remove the actual type entry $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Remove " . $viewName + ) . " Remove " . $viewsCodeName . " from the field groups table"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('context') . ' = '. \$db->quote('" @@ -8219,7 +8231,7 @@ class Interpretation extends Fields . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Execute the query to remove " . $viewName + ) . " Execute the query to remove " . $viewsCodeName . " items"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; @@ -8228,7 +8240,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " If succesfully remove " . $viewName + ) . " If successfully remove " . $viewsCodeName . " add queued success message."; // TODO lang is not translated $script .= PHP_EOL . $this->_t(4) @@ -8252,7 +8264,7 @@ class Interpretation extends Fields . "\$query->from(\$db->quoteName('#__content_types'));"; $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ - ) . " Where " . $viewName . " alias is found"; + ) . " Where " . $viewsCodeName . " alias is found"; $script .= PHP_EOL . $this->_t(2) . "\$query->where( \$db->quoteName('type_alias') . ' = '. \$db->quote('" . $typeAlias . "') );"; @@ -8279,7 +8291,8 @@ class Interpretation extends Fields // Now remove the actual type entry $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Remove " . $viewName . " from the content type table"; + ) . " Remove " . $viewsCodeName + . " from the content type table"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('type_alias') . ' = '. \$db->quote('" . $typeAlias . "') );"; @@ -8295,14 +8308,15 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Execute the query to remove " . $viewName . " items"; + ) . " Execute the query to remove " . $viewsCodeName + . " items"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " If succesfully remove " . $viewName + ) . " If successfully remove " . $viewsCodeName . " add queued success message."; // TODO lang is not translated $script .= PHP_EOL . $this->_t(4) @@ -8312,7 +8326,7 @@ class Interpretation extends Fields // Now remove the related items from contentitem tag map table $script .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" - . $this->setLine(__LINE__) . " Remove " . $viewName + . $this->setLine(__LINE__) . " Remove " . $viewsCodeName . " items from the contentitem tag map table"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('type_alias') . ' = '. \$db->quote('" @@ -8329,14 +8343,15 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Execute the query to remove " . $viewName . " items"; + ) . " Execute the query to remove " . $viewsCodeName + . " items"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " If succesfully remove " . $viewName + ) . " If successfully remove " . $viewsCodeName . " add queued success message."; // TODO lang is not translated $script .= PHP_EOL . $this->_t(4) @@ -8346,7 +8361,7 @@ class Interpretation extends Fields // Now remove the related items from ucm content table $script .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" - . $this->setLine(__LINE__) . " Remove " . $viewName + . $this->setLine(__LINE__) . " Remove " . $viewsCodeName . " items from the ucm content table"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('core_type_alias') . ' = ' . \$db->quote('" @@ -8363,14 +8378,15 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ - ) . " Execute the query to remove " . $viewName . " items"; + ) . " Execute the query to remove " . $viewsCodeName + . " items"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " If succesfully remove " . $viewName + ) . " If successfully removed " . $viewsCodeName . " add queued success message."; // TODO lang is not translated $script .= PHP_EOL . $this->_t(4) @@ -8381,7 +8397,7 @@ class Interpretation extends Fields // setup the foreach loop of ids $script .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Make sure that all the " - . $viewName . " items are cleared from DB"; + . $viewsCodeName . " items are cleared from DB"; $script .= PHP_EOL . $this->_t(3) . "foreach (\$" . $view . "_ids as \$" . $view . "_id)"; $script .= PHP_EOL . $this->_t(3) . "{"; @@ -8389,7 +8405,7 @@ class Interpretation extends Fields // Now remove the related items from ucm base table $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " Remove " . $viewName + ) . " Remove " . $viewsCodeName . " items from the ucm base table"; $script .= PHP_EOL . $this->_t(4) . "\$" . $view . "_condition = array( \$db->quoteName('ucm_type_id') . ' = ' . \$" @@ -8406,12 +8422,13 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(4) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " Execute the query to remove " . $viewName . " items"; + ) . " Execute the query to remove " . $viewsCodeName + . " items"; $script .= PHP_EOL . $this->_t(4) . "\$db->execute();"; // Now remove the related items from ucm history table $script .= PHP_EOL . PHP_EOL . $this->_t(4) . "//" - . $this->setLine(__LINE__) . " Remove " . $viewName + . $this->setLine(__LINE__) . " Remove " . $viewsCodeName . " items from the ucm history table"; $script .= PHP_EOL . $this->_t(4) . "\$" . $view . "_condition = array( \$db->quoteName('ucm_type_id') . ' = ' . \$" @@ -8428,7 +8445,8 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(4) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine( __LINE__ - ) . " Execute the query to remove " . $viewName . " items"; + ) . " Execute the query to remove " . $viewsCodeName + . " items"; $script .= PHP_EOL . $this->_t(4) . "\$db->execute();"; $script .= PHP_EOL . $this->_t(3) . "}"; @@ -8466,7 +8484,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(2) . "if (\$" . $view . "_done)"; $script .= PHP_EOL . $this->_t(2) . "{"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) - . " If succesfully remove " . $component + . " If successfully removed " . $component . " add queued success message."; // TODO lang is not translated $script .= PHP_EOL . $this->_t(3) . "\$app->enqueueMessage(JText:" @@ -8475,6 +8493,8 @@ class Interpretation extends Fields // done $script .= PHP_EOL; } + // add the Intelligent Reversal script if needed + $script .= $this->getAssetsTableIntelligentUninstall(); // add the custom uninstall script $script .= $this->getCustomScriptBuilder( 'php_method', 'uninstall', "", null, true, null, PHP_EOL @@ -8483,6 +8503,156 @@ class Interpretation extends Fields return $script; } + /** + * build code for the assets table script intelligent fix + * + * @return string The php to place in script.php + * + */ + protected function getAssetsTableIntelligentInstall() + { + // WHY DO WE NEED AN ASSET TABLE FIX? + // https://www.mysqltutorial.org/mysql-varchar/ + // https://stackoverflow.com/a/15227917/1429677 + // https://forums.mysql.com/read.php?24,105964,105964 + // https://github.com/vdm-io/Joomla-Component-Builder/issues/616#issuecomment-741502980 + // 30 actions each +-20 characters with 8 groups + // that makes 4800 characters and the current Joomla + // column size is varchar(5120) + + // check if we should add the intelligent fix treatment for the assets table + if ($this->addAssetsTableFix == 2) + { + // get the type we will convert to + $data_type = ($this->accessWorseCase > 64000) ? "MEDIUMTEXT" : "TEXT"; + // the if statement about $rule_length + $codeIF = "\$rule_length <= " . $this->accessWorseCase; + // fix column size + $script = array(); + $script[] = $this->_t(5) . "//" . $this->setLine(__LINE__) + . " Fix the assets table rules column size"; + $script[] = $this->_t(5) + . '$fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` ' + . $data_type + . ' NOT NULL COMMENT \'JSON encoded access control. Enlarged to ' . $data_type . ' by JCB\';";'; + $script[] = $this->_t(5) . "\$db->setQuery(\$fix_rules_size);"; + $script[] = $this->_t(5) . "\$db->execute();"; + $codeA = implode(PHP_EOL, $script); + // fixed message + $messageA = $this->_t(5) + . "\$app->enqueueMessage(JText::_('The #__assets table rules column was resized to the " + . $data_type + . " datatype for the components possible large permission rules.'));"; + // do nothing + $codeB = ""; + // fix not needed so ignore + $messageB = ""; + + // done + return $this->getAssetsTableIntelligentCode( + $codeIF, $codeA, $codeB, $messageA, $messageB, 2 + ); + } + + return ''; + } + + /** + * build code for the assets table script intelligent reversal + * + * @return string The php to place in script.php + * + */ + protected function getAssetsTableIntelligentUninstall() + { + // check if we should add the intelligent uninstall treatment for the assets table + if ($this->addAssetsTableFix == 2) + { + // the if statement about $rule_length + $codeIF = "\$rule_length < 5120"; + // reverse column size + $script = array(); + $script[] = $this->_t(4) . "//" . $this->setLine(__LINE__) + . " Revert the assets table rules column back to the default"; + $script[] = $this->_t(4) + . '$revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT \'JSON encoded access control.\';";'; + $script[] = $this->_t(4) . "\$db->setQuery(\$revert_rule);"; + $script[] = $this->_t(4) . "\$db->execute();"; + $codeA = implode(PHP_EOL, $script); + // reverted message + $messageA = $this->_t(4) + . "\$app->enqueueMessage(JText::_('Reverted the #__assets table rules column back to its default size of varchar(5120)'));"; + // do nothing + $codeB = ""; + // not reverted message + $messageB = $this->_t(4) + . "\$app->enqueueMessage(JText::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.'));"; + + // done + return $this->getAssetsTableIntelligentCode( + $codeIF, $codeA, $codeB, $messageA, $messageB + ); + } + + return ''; + } + + /** + * set code for both install, update and uninstall + * + * @param string $codeIF The IF code to fix this issue + * @param string $codeA The a code to fix this issue + * @param string $codeB The b code to fix this issue + * @param string $messageA The fix a message + * @param string $messageB The fix b message + * + * @return string + * + */ + protected function getAssetsTableIntelligentCode($codeIF, $codeA, $codeB, + $messageA, $messageB, $tab = 1 + ) { + // reset script + $script = array(); + $script[] = $this->_t($tab) . $this->_t(1) . "//" . $this->setLine( + __LINE__ + ) + . " Get the biggest rule column in the assets table at this point."; + $script[] = $this->_t($tab) . $this->_t(1) + . '$get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1";'; + $script[] = $this->_t($tab) . $this->_t(1) + . "\$db->setQuery(\$get_rule_length);"; + $script[] = $this->_t($tab) . $this->_t(1) . "if (\$db->execute())"; + $script[] = $this->_t($tab) . $this->_t(1) . "{"; + $script[] = $this->_t($tab) . $this->_t(2) + . "\$rule_length = \$db->loadResult();"; + // https://github.com/joomla/joomla-cms/blob/3.10.0-alpha3/installation/sql/mysql/joomla.sql#L22 + // Checked 1st December 2020 (let us know if this changes) + $script[] = $this->_t($tab) . $this->_t(2) . "//" . $this->setLine( + __LINE__ + ) + . " Check the size of the rules column"; + $script[] = $this->_t($tab) . $this->_t(2) . "if (" . $codeIF . ")"; + $script[] = $this->_t($tab) . $this->_t(2) . "{"; + $script[] = $codeA; + $script[] = $messageA; + $script[] = $this->_t($tab) . $this->_t(2) . "}"; + // only ad this if there is a B part + if (ComponentbuilderHelper::checkString($codeB) + || ComponentbuilderHelper::checkString($messageB)) + { + $script[] = $this->_t($tab) . $this->_t(2) . "else"; + $script[] = $this->_t($tab) . $this->_t(2) . "{"; + $script[] = $codeB; + $script[] = $messageB; + $script[] = $this->_t($tab) . $this->_t(2) . "}"; + } + $script[] = $this->_t($tab) . $this->_t(1) . "}"; + + // done + return PHP_EOL . implode(PHP_EOL, $script); + } + public function setMoveFolderScript() { if ($this->setMoveFolders) @@ -8711,7 +8881,8 @@ class Interpretation extends Fields $array['type_title'] = $Component . ' ' . $View . ' ' . ComponentbuilderHelper::safeString($category, 'F'); // set the alias - $array['type_alias'] = 'com_' . $component . '.' . $otherView . '.category'; + $array['type_alias'] = 'com_' . $component . '.' . $otherView + . '.category'; // set the table $array['table'] = '{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}'; @@ -8727,30 +8898,30 @@ class Interpretation extends Fields return $array; } - public function setRouterHelp($viewName_single, $viewName_list, + public function setRouterHelp($nameSingleCode, $nameListCode, $front = false ) { // add if tags is added, also for all front item views - if (((isset($this->tagsBuilder[$viewName_single]) + if (((isset($this->tagsBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->tagsBuilder[$viewName_single] + $this->tagsBuilder[$nameSingleCode] )) || $front) - && (!in_array($viewName_single, $this->setRouterHelpDone))) + && (!in_array($nameSingleCode, $this->setRouterHelpDone))) { // insure we load a view only once - $this->setRouterHelpDone[] = $viewName_single; + $this->setRouterHelpDone[] = $nameSingleCode; // build view route helper $View = ComponentbuilderHelper::safeString( - $viewName_single, 'F' + $nameSingleCode, 'F' ); $routeHelper = array(); $routeHelper[] = PHP_EOL . PHP_EOL . $this->_t(1) . "/**"; $routeHelper[] = $this->_t(1) . " * @param int The route of the " . $View; $routeHelper[] = $this->_t(1) . " */"; - if ('category' === $viewName_single - || 'categories' === $viewName_single) + if ('category' === $nameSingleCode + || 'categories' === $nameSingleCode) { $routeHelper[] = $this->_t(1) . "public static function get" . $View . "Route(\$id = 0)"; @@ -8766,13 +8937,13 @@ class Interpretation extends Fields $routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Initialize the needel array."; $routeHelper[] = $this->_t(3) . "\$needles = array("; - $routeHelper[] = $this->_t(4) . "'" . $viewName_single + $routeHelper[] = $this->_t(4) . "'" . $nameSingleCode . "' => array((int) \$id)"; $routeHelper[] = $this->_t(3) . ");"; $routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Create the link"; $routeHelper[] = $this->_t(3) . "\$link = 'index.php?option=com_" - . $this->componentCodeName . "&view=" . $viewName_single + . $this->componentCodeName . "&view=" . $nameSingleCode . "&id='. \$id;"; $routeHelper[] = $this->_t(2) . "}"; $routeHelper[] = $this->_t(2) . "else"; @@ -8780,22 +8951,23 @@ class Interpretation extends Fields $routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Initialize the needel array."; $routeHelper[] = $this->_t(3) . "\$needles = array("; - $routeHelper[] = $this->_t(4) . "'" . $viewName_single + $routeHelper[] = $this->_t(4) . "'" . $nameSingleCode . "' => array()"; $routeHelper[] = $this->_t(3) . ");"; $routeHelper[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Create the link but don't add the id."; $routeHelper[] = $this->_t(3) . "\$link = 'index.php?option=com_" - . $this->componentCodeName . "&view=" . $viewName_single . "';"; + . $this->componentCodeName . "&view=" . $nameSingleCode + . "';"; $routeHelper[] = $this->_t(2) . "}"; - if ('category' != $viewName_single - && 'categories' != $viewName_single) + if ('category' != $nameSingleCode + && 'categories' != $nameSingleCode) { $routeHelper[] = $this->_t(2) . "if (\$catid > 1)"; $routeHelper[] = $this->_t(2) . "{"; $routeHelper[] = $this->_t(3) . "\$categories = JCategories::getInstance('" - . $this->componentCodeName . "." . $viewName_list . "');"; + . $this->componentCodeName . "." . $nameListCode . "');"; $routeHelper[] = $this->_t(3) . "\$category = \$categories->get(\$catid);"; $routeHelper[] = $this->_t(3) . "if (\$category)"; @@ -8808,11 +8980,11 @@ class Interpretation extends Fields $routeHelper[] = $this->_t(3) . "}"; $routeHelper[] = $this->_t(2) . "}"; } - if (isset($this->hasMenuGlobal[$viewName_single])) + if (isset($this->hasMenuGlobal[$nameSingleCode])) { $routeHelper[] = PHP_EOL . $this->_t(2) . "if (\$item = self::_findItem(\$needles, '" - . $viewName_single . "'))"; + . $nameSingleCode . "'))"; } else { @@ -8977,30 +9149,30 @@ class Interpretation extends Fields } } - public function setBatchMove($viewName_single) + public function setBatchMove($nameSingleCode) { // set needed defaults $category = false; $batchmove = array(); - $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); + $VIEW = ComponentbuilderHelper::safeString($nameSingleCode, 'U'); // component helper name $Helper = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper'; // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // only load category if set in this view - if (array_key_exists($viewName_single, $this->catCodeBuilder)) + if (array_key_exists($nameSingleCode, $this->catCodeBuilder)) { - $category = $this->catCodeBuilder[$viewName_single]['code']; + $category = $this->catCodeBuilder[$nameSingleCode]['code']; } // prepare custom script $customScript = $this->getCustomScriptBuilder( - 'php_batchmove', $viewName_single, PHP_EOL . PHP_EOL, null, true + 'php_batchmove', $nameSingleCode, PHP_EOL . PHP_EOL, null, true ); $batchmove[] = PHP_EOL . $this->_t(1) . "/**"; @@ -9032,7 +9204,7 @@ class Interpretation extends Fields $batchmove[] = $this->_t(3) . "\$this->tableClassName = get_class(\$this->table);"; $batchmove[] = $this->_t(3) . "\$this->canDo = " . $Helper - . "::getActions('" . $viewName_single . "');"; + . "::getActions('" . $nameSingleCode . "');"; $batchmove[] = $this->_t(2) . "}"; if ($coreLoad && isset($core['core.edit']) @@ -9041,7 +9213,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit']] )) { @@ -9068,7 +9240,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit.state']] )) { @@ -9122,7 +9294,7 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit']] ) && in_array( - $viewName_single, $this->permissionBuilder[$core['core.edit']] + $nameSingleCode, $this->permissionBuilder[$core['core.edit']] )) { $batchmove[] = $this->_t(3) . "if (!\$this->user->authorise('" @@ -9222,7 +9394,7 @@ class Interpretation extends Fields return PHP_EOL . implode(PHP_EOL, $batchmove); } - public function setBatchCopy($viewName_single) + public function setBatchCopy($nameSingleCode) { // set needed defaults $title = false; @@ -9230,37 +9402,39 @@ class Interpretation extends Fields $alias = false; $category = false; $batchcopy = array(); - $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); + $VIEW = ComponentbuilderHelper::safeString($nameSingleCode, 'U'); // component helper name $Helper = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . 'Helper'; // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // only load category if set in this view - if (array_key_exists($viewName_single, $this->catCodeBuilder)) + if (array_key_exists($nameSingleCode, $this->catCodeBuilder)) { - $category = $this->catCodeBuilder[$viewName_single]['code']; + $category = $this->catCodeBuilder[$nameSingleCode]['code']; } // only load alias if set in this view - if (array_key_exists($viewName_single, $this->aliasBuilder)) + if (array_key_exists($nameSingleCode, $this->aliasBuilder)) { - $alias = $this->aliasBuilder[$viewName_single]; + $alias = $this->aliasBuilder[$nameSingleCode]; } // only load title if set in this view - if (isset($this->customAliasBuilder[$viewName_single])) + if (isset($this->customAliasBuilder[$nameSingleCode])) { - $titles = array_values($this->customAliasBuilder[$viewName_single]); + $titles = array_values( + $this->customAliasBuilder[$nameSingleCode] + ); $title = true; } - elseif (array_key_exists($viewName_single, $this->titleBuilder)) + elseif (array_key_exists($nameSingleCode, $this->titleBuilder)) { - $titles = array($this->titleBuilder[$viewName_single]); + $titles = array($this->titleBuilder[$nameSingleCode]); $title = true; } // se the dynamic title @@ -9276,7 +9450,7 @@ class Interpretation extends Fields } // prepare custom script $customScript = $this->getCustomScriptBuilder( - 'php_batchcopy', $viewName_single, PHP_EOL . PHP_EOL, null, true + 'php_batchcopy', $nameSingleCode, PHP_EOL . PHP_EOL, null, true ); $batchcopy[] = PHP_EOL . $this->_t(1) . "/**"; @@ -9310,7 +9484,7 @@ class Interpretation extends Fields $batchcopy[] = $this->_t(3) . "\$this->tableClassName = get_class(\$this->table);"; $batchcopy[] = $this->_t(3) . "\$this->canDo = " . $Helper - . "::getActions('" . $viewName_single . "');"; + . "::getActions('" . $nameSingleCode . "');"; $batchcopy[] = $this->_t(2) . "}"; if ($coreLoad && isset($core['core.create']) && isset($this->permissionBuilder['global'][$core['core.create']]) @@ -9318,7 +9492,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -9355,7 +9529,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit.state']] )) { @@ -9415,7 +9589,7 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit']] ) && in_array( - $viewName_single, $this->permissionBuilder[$core['core.edit']] + $nameSingleCode, $this->permissionBuilder[$core['core.edit']] )) { $batchcopy[] = $this->_t(3) . "if (!\$this->user->authorise('" @@ -9616,39 +9790,39 @@ class Interpretation extends Fields return PHP_EOL . implode(PHP_EOL, $batchcopy); } - public function setAliasTitleFix($viewName_single) + public function setAliasTitleFix($nameSingleCode) { $fixUnique = array(); // only load this if these two items are set - if (array_key_exists($viewName_single, $this->aliasBuilder) - && (array_key_exists($viewName_single, $this->titleBuilder) - || isset($this->customAliasBuilder[$viewName_single]))) + if (array_key_exists($nameSingleCode, $this->aliasBuilder) + && (array_key_exists($nameSingleCode, $this->titleBuilder) + || isset($this->customAliasBuilder[$nameSingleCode]))) { // set needed defaults $setCategory = false; - $alias = $this->aliasBuilder[$viewName_single]; + $alias = $this->aliasBuilder[$nameSingleCode]; $VIEW = ComponentbuilderHelper::safeString( - $viewName_single, 'U' + $nameSingleCode, 'U' ); - if (array_key_exists($viewName_single, $this->catCodeBuilder)) + if (array_key_exists($nameSingleCode, $this->catCodeBuilder)) { - $category = $this->catCodeBuilder[$viewName_single]['code']; + $category = $this->catCodeBuilder[$nameSingleCode]['code']; $setCategory = true; } // set the title stuff - if (isset($this->customAliasBuilder[$viewName_single])) + if (isset($this->customAliasBuilder[$nameSingleCode])) { $titles = array_values( - $this->customAliasBuilder[$viewName_single] + $this->customAliasBuilder[$nameSingleCode] ); - if (isset($this->titleBuilder[$viewName_single])) + if (isset($this->titleBuilder[$nameSingleCode])) { - // $titles[] = $this->titleBuilder[$viewName_single]; // TODO this may be unexpected + // $titles[] = $this->titleBuilder[$nameSingleCode]; // TODO this may be unexpected } } else { - $titles = array($this->titleBuilder[$viewName_single]); + $titles = array($this->titleBuilder[$nameSingleCode]); } // start building the fix $fixUnique[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine( @@ -9744,7 +9918,7 @@ class Interpretation extends Fields ) . ");"; $fixUnique[] = $this->_t(4) . "}"; $fixUnique[] = PHP_EOL . $this->_t(4) - . "\$table = JTable::getInstance('" . $viewName_single . "', '" + . "\$table = JTable::getInstance('" . $nameSingleCode . "', '" . $this->componentCodeName . "Table');"; if ($setCategory && count($titles) == 1) { @@ -9828,12 +10002,12 @@ class Interpretation extends Fields return PHP_EOL . implode(PHP_EOL, $fixUnique); } - public function setGenerateNewTitle($viewName_single) + public function setGenerateNewTitle($nameSingleCode) { // if category is added to this view then do nothing - if (array_key_exists($viewName_single, $this->aliasBuilder) - && (array_key_exists($viewName_single, $this->titleBuilder) - || isset($this->customAliasBuilder[$viewName_single]))) + if (array_key_exists($nameSingleCode, $this->aliasBuilder) + && (array_key_exists($nameSingleCode, $this->titleBuilder) + || isset($this->customAliasBuilder[$nameSingleCode]))) { // get component name $Component = $this->fileContentStatic[$this->hhh . 'Component' @@ -9906,7 +10080,7 @@ class Interpretation extends Fields return implode(PHP_EOL, $newFunction); } - elseif (array_key_exists($viewName_single, $this->titleBuilder)) + elseif (array_key_exists($nameSingleCode, $this->titleBuilder)) { $newFunction = array(); $newFunction[] = PHP_EOL . PHP_EOL . $this->_t(1) . "/**"; @@ -9941,21 +10115,21 @@ class Interpretation extends Fields return ''; } - public function setGenerateNewAlias($viewName_single) + public function setGenerateNewAlias($nameSingleCode) { // make sure this view has an alias - if (isset($this->aliasBuilder[$viewName_single])) + if (isset($this->aliasBuilder[$nameSingleCode])) { // set the title stuff - if (isset($this->customAliasBuilder[$viewName_single])) + if (isset($this->customAliasBuilder[$nameSingleCode])) { $titles = array_values( - $this->customAliasBuilder[$viewName_single] + $this->customAliasBuilder[$nameSingleCode] ); } - elseif (isset($this->titleBuilder[$viewName_single])) + elseif (isset($this->titleBuilder[$nameSingleCode])) { - $titles = array($this->titleBuilder[$viewName_single]); + $titles = array($this->titleBuilder[$nameSingleCode]); } // reset the bucket $titleData = array(); @@ -10077,7 +10251,8 @@ class Interpretation extends Fields elseif ($default === 'DATETIME' || $default === 'CURRENT_TIMESTAMP') { - $default = $data['null_switch'] . ' DEFAULT ' . $default; + $default = $data['null_switch'] . ' DEFAULT ' + . $default; } elseif ($default == 0 || $default) { @@ -10437,6 +10612,80 @@ class Interpretation extends Fields unset($this->customScriptBuilder['sql']); } + // WHY DO WE NEED AN ASSET TABLE FIX? + // https://www.mysqltutorial.org/mysql-varchar/ + // https://stackoverflow.com/a/15227917/1429677 + // https://forums.mysql.com/read.php?24,105964,105964 + // https://github.com/vdm-io/Joomla-Component-Builder/issues/616#issuecomment-741502980 + // 30 actions each +-20 characters with 8 groups + // that makes 4800 characters and the current Joomla + // column size is varchar(5120) + + // just a little event tracking in classes + // count actions = setAccessSections + // around line206 (infusion call) + // around line26454 (interpretation function) + // first fix = setInstall + // around line1600 (infusion call) + // around line10063 (interpretation function) + // second fix = setUninstallScript + // around line2161 (infusion call) + // around line8030 (interpretation function) + + // check if this component needs larger rules + // also check if the developer will allow this + // the access actions length must be checked before this + // only add this option if set to SQL fix + if ($this->addAssetsTableFix == 1) + { + // 400 actions worse case is larger the 65535 characters + if ($this->accessSize > 400) + { + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column rules is large enough for all the access control values.'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to MEDIUMTEXT by JCB';"; + } + // smaller then 400 makes TEXT large enough + elseif ($this->addAssetsTableFix == 1) + { + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column rules is large enough for all the access control values.'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';"; + } + } + + // check if this component needs larger names + // also check if the developer will allow this + // the config length must be checked before this + // only add this option if set to SQL fix + if ($this->addAssetsTableFix && $this->addAssetsTableNameFix) + { + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column name is large enough for long component and view names.'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';"; + } + return $db; } @@ -10469,6 +10718,44 @@ class Interpretation extends Fields unset($this->customScriptBuilder['sql_uninstall']); } + // check if this component used larger rules + // now revert them back on uninstall + // only add this option if set to SQL fix + if ($this->addAssetsTableFix == 1) + { + // https://github.com/joomla/joomla-cms/blob/3.10.0-alpha3/installation/sql/mysql/joomla.sql#L22 + // Checked 1st December 2020 (let us know if this changes) + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column rules is reversed to Joomla defaults on uninstall. (as on 1st Dec 2020)'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; + } + + // check if this component used larger names + // now revert them back on uninstall + // only add this option if set to SQL fix + if ($this->addAssetsTableFix == 1 && $this->addAssetsTableNameFix) + { + // https://github.com/joomla/joomla-cms/blob/3.10.0-alpha3/installation/sql/mysql/joomla.sql#L20 + // Checked 1st December 2020 (let us know if this changes) + $db .= PHP_EOL; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . '--' . $this->setLine( + __LINE__ + ) + . ' Always insure this column name is reversed to Joomla defaults on uninstall. (as on 1st Dec 2020).'; + $db .= PHP_EOL . '--'; + $db .= PHP_EOL + . "ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';"; + } + return $db; } @@ -10959,7 +11246,7 @@ class Interpretation extends Fields return false; } - public function setCustomAdminViewListLink($view, $viewName_list) + public function setCustomAdminViewListLink($view, $nameListCode) { if (isset($this->componentData->custom_admin_views) && ComponentbuilderHelper::checkArray( @@ -11008,7 +11295,7 @@ class Interpretation extends Fields if ($setId) { // now load it to the global object for items list - $this->customAdminViewListLink[$viewName_list][] + $this->customAdminViewListLink[$nameListCode][] = $set; // add to set id for list view if needed $this->customAdminViewListId[$custom_admin_view['settings']->code] @@ -11017,7 +11304,7 @@ class Interpretation extends Fields else { // now load it to the global object for tool bar - $this->customAdminDynamicButtons[$viewName_list][] + $this->customAdminDynamicButtons[$nameListCode][] = $set; } // log that it has been added already @@ -11033,16 +11320,16 @@ class Interpretation extends Fields /** * set the list body * - * @param string $viewName_single - * @param string $viewName_list + * @param string $nameSingleCode + * @param string $nameListCode * * @return string */ - public function setListBody($viewName_single, $viewName_list) + public function setListBody($nameSingleCode, $nameListCode) { - if (isset($this->listBuilder[$viewName_list]) + if (isset($this->listBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->listBuilder[$viewName_list] + $this->listBuilder[$nameListCode] )) { // component helper name @@ -11051,9 +11338,9 @@ class Interpretation extends Fields // setup correct core target $coreLoad = false; $core = null; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // make sure the custom links are only added once @@ -11066,13 +11353,13 @@ class Interpretation extends Fields $body .= PHP_EOL . $this->_t(2) . "\$userChkOut = JFactory::getUser(\$item->checked_out);"; $body .= PHP_EOL . $this->_t(2) . "\$canDo = " . $Helper - . "::getActions('" . $viewName_single . "',\$item,'" - . $viewName_list . "');"; + . "::getActions('" . $nameSingleCode . "',\$item,'" + . $nameListCode . "');"; $body .= PHP_EOL . $this->_t(1) . "?>"; $body .= PHP_EOL . $this->_t(1) . ''; // only load if not over written - if (!isset($this->fieldsNames[$viewName_single]['ordering'])) + if (!isset($this->fieldsNames[$nameSingleCode]['ordering'])) { $body .= PHP_EOL . $this->_t(2) . ''; @@ -11083,7 +11370,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit.state']] )) { @@ -11096,11 +11383,8 @@ class Interpretation extends Fields . "get('core.edit.state')): ?>"; } $body .= PHP_EOL . $this->_t(3) . "_t(4) . "if (\$this->saveOrder)"; - $body .= PHP_EOL . $this->_t(4) . "{"; - $body .= PHP_EOL . $this->_t(5) . "\$iconClass = ' inactive';"; - $body .= PHP_EOL . $this->_t(4) . "}"; - $body .= PHP_EOL . $this->_t(4) . "else"; + $body .= PHP_EOL . $this->_t(4) . "\$iconClass = '';"; + $body .= PHP_EOL . $this->_t(4) . "if (!\$this->saveOrder)"; $body .= PHP_EOL . $this->_t(4) . "{"; $body .= PHP_EOL . $this->_t(5) . "\$iconClass = ' inactive tip-top" @@ -11132,7 +11416,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit']] )) { @@ -11162,12 +11446,12 @@ class Interpretation extends Fields $body .= PHP_EOL . $this->_t(2) . ""; // check if this view has fields that should not be escaped $doNotEscape = false; - if (isset($this->doNotEscape[$viewName_list])) + if (isset($this->doNotEscape[$nameListCode])) { $doNotEscape = true; } // start adding the dynamic - foreach ($this->listBuilder[$viewName_list] as $item) + foreach ($this->listBuilder[$nameListCode] as $item) { // check if target is admin list if (1 == $item['target'] || 3 == $item['target']) @@ -11178,7 +11462,7 @@ class Interpretation extends Fields $itemClass = 'hidden-phone'; // set the item row $itemRow = $this->getListItemBuilder( - $item, $viewName_single, $viewName_list, $itemClass, + $item, $nameSingleCode, $nameListCode, $itemClass, $doNotEscape, $coreLoad, $core ); // check if buttons was aready added @@ -11186,14 +11470,14 @@ class Interpretation extends Fields { // get custom admin view buttons $customAdminViewButtons - = $this->getCustomAdminViewButtons($viewName_list); + = $this->getCustomAdminViewButtons($nameListCode); // make sure the custom admin view buttons are only added once $firstTimeBeingAdded = false; } // add row to body $body .= PHP_EOL . $this->_t(2) . "getListFieldClass( - $item['code'], $viewName_list, $itemClass + $item['code'], $nameListCode, $itemClass ) . "\">"; $body .= $itemRow; $body .= $customAdminViewButtons; @@ -11201,7 +11485,7 @@ class Interpretation extends Fields } } // add the defaults - if (!isset($this->fieldsNames[$viewName_single]['published'])) + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) { $body .= PHP_EOL . $this->_t(2) . ''; // check if the item has permissions. @@ -11211,7 +11495,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit.state']] )) { @@ -11229,29 +11513,29 @@ class Interpretation extends Fields . ""; $body .= PHP_EOL . $this->_t(6) . "published, \$i, '" - . $viewName_list . ".', true, 'cb'); ?>"; + . $nameListCode . ".', true, 'cb'); ?>"; $body .= PHP_EOL . $this->_t(5) . ""; $body .= PHP_EOL . $this->_t(6) . "published, \$i, '" - . $viewName_list . ".', false, 'cb'); ?>"; + . $nameListCode . ".', false, 'cb'); ?>"; $body .= PHP_EOL . $this->_t(5) . ""; $body .= PHP_EOL . $this->_t(4) . ""; $body .= PHP_EOL . $this->_t(5) . "published, \$i, '" - . $viewName_list . ".', true, 'cb'); ?>"; + . $nameListCode . ".', true, 'cb'); ?>"; $body .= PHP_EOL . $this->_t(4) . ""; $body .= PHP_EOL . $this->_t(2) . ""; $body .= PHP_EOL . $this->_t(3) . "published, \$i, '" - . $viewName_list . ".', false, 'cb'); ?>"; + . $nameListCode . ".', false, 'cb'); ?>"; $body .= PHP_EOL . $this->_t(2) . ""; $body .= PHP_EOL . $this->_t(2) . ""; } - if (!isset($this->fieldsNames[$viewName_single]['id'])) + if (!isset($this->fieldsNames[$nameSingleCode]['id'])) { $body .= PHP_EOL . $this->_t(2) . ''; $body .= PHP_EOL . $this->_t(3) . "id; ?>"; @@ -11270,46 +11554,46 @@ class Interpretation extends Fields /** * Get the list item dynamic row * - * @param array $item The item array - * @param string $viewName_single The single view code name - * @param string $viewName_list The list view code name - * @param string $itemClass The table row default class - * @param bool $doNotEscape The do not escape global switch - * @param bool $coreLoad The core permission loader switch - * @param array $core The core permission values - * @param bool $class The dive class adding switch - * @param string $ref The link referral string - * @param string $escape The escape code name - * @param string $user The user code name - * @param string $refview The override of the referral view code name + * @param array $item The item array + * @param string $nameSingleCode The single view code name + * @param string $nameListCode The list view code name + * @param string $itemClass The table row default class + * @param bool $doNotEscape The do not escape global switch + * @param bool $coreLoad The core permission loader switch + * @param array $core The core permission values + * @param bool $class The dive class adding switch + * @param string $ref The link referral string + * @param string $escape The escape code name + * @param string $user The user code name + * @param string $refview The override of the referral view code name * * @return string of the completer item value for the table row * */ - protected function getListItemBuilder($item, $viewName_single, - $viewName_list, &$itemClass, $doNotEscape, $coreLoad, $core, + protected function getListItemBuilder($item, $nameSingleCode, + $nameListCode, &$itemClass, $doNotEscape, $coreLoad, $core, $class = true, $ref = null, $escape = '$this->escape', $user = '$this->user', $refview = null ) { // check if we have relation fields - if (isset($this->fieldRelations[$viewName_list]) - && isset($this->fieldRelations[$viewName_list][(int) $item['id']]) - && isset($this->fieldRelations[$viewName_list][(int) $item['id']][2])) + if (isset($this->fieldRelations[$nameListCode]) + && isset($this->fieldRelations[$nameListCode][(int) $item['id']]) + && isset($this->fieldRelations[$nameListCode][(int) $item['id']][2])) { // set the fields array $field = array(); // use custom code $useCustomCode - = (isset($this->fieldRelations[$viewName_list][(int) $item['id']][2]['join_type']) - && $this->fieldRelations[$viewName_list][(int) $item['id']][2]['join_type'] + = (isset($this->fieldRelations[$nameListCode][(int) $item['id']][2]['join_type']) + && $this->fieldRelations[$nameListCode][(int) $item['id']][2]['join_type'] == 2 - && isset($this->fieldRelations[$viewName_list][(int) $item['id']][2]['set']) + && isset($this->fieldRelations[$nameListCode][(int) $item['id']][2]['set']) && ComponentbuilderHelper::checkString( - $this->fieldRelations[$viewName_list][(int) $item['id']][2]['set'] + $this->fieldRelations[$nameListCode][(int) $item['id']][2]['set'] )); // load the main list view field $field['[field=' . (int) $item['id'] . ']'] = $this->getListItem( - $item, $viewName_single, $viewName_list, $itemClass, + $item, $nameSingleCode, $nameListCode, $itemClass, $doNotEscape, $coreLoad, $core, false, $ref, $escape, $user, $refview ); @@ -11320,34 +11604,34 @@ class Interpretation extends Fields . $item['code']; } // now load the relations - if (isset($this->fieldRelations[$viewName_list][(int) $item['id']][2]['joinfields']) + if (isset($this->fieldRelations[$nameListCode][(int) $item['id']][2]['joinfields']) && ComponentbuilderHelper::checkArray( - $this->fieldRelations[$viewName_list][(int) $item['id']][2]['joinfields'] + $this->fieldRelations[$nameListCode][(int) $item['id']][2]['joinfields'] )) { foreach ( - $this->fieldRelations[$viewName_list][(int) $item['id']][2]['joinfields'] + $this->fieldRelations[$nameListCode][(int) $item['id']][2]['joinfields'] as $join ) { $blankClass = ''; - if (isset($this->listJoinBuilder[$viewName_list]) - && isset($this->listJoinBuilder[$viewName_list][(int) $join])) + if (isset($this->listJoinBuilder[$nameListCode]) + && isset($this->listJoinBuilder[$nameListCode][(int) $join])) { // code block $field['[field=' . (int) $join . ']'] = $this->getListItem( - $this->listJoinBuilder[$viewName_list][(int) $join], - $viewName_single, $viewName_list, $blankClass, + $this->listJoinBuilder[$nameListCode][(int) $join], + $nameSingleCode, $nameListCode, $blankClass, $doNotEscape, $coreLoad, $core, false, $ref, $escape, $user, $refview ); // code name - if (isset($this->listJoinBuilder[$viewName_list][(int) $join]['code']) + if (isset($this->listJoinBuilder[$nameListCode][(int) $join]['code']) && $useCustomCode) { $field['$item->{' . (int) $join . '}'] = '$item->' - . $this->listJoinBuilder[$viewName_list][(int) $join]['code']; + . $this->listJoinBuilder[$nameListCode][(int) $join]['code']; } } } @@ -11360,18 +11644,18 @@ class Interpretation extends Fields . $this->setPlaceholders( str_replace( array_keys($field), array_values($field), - $this->fieldRelations[$viewName_list][(int) $item['id']][2]['set'] + $this->fieldRelations[$nameListCode][(int) $item['id']][2]['set'] ), $this->placeholders ) . PHP_EOL . $this->_t(3) . "
"; } - elseif (isset($this->fieldRelations[$viewName_list][(int) $item['id']]['set']) + elseif (isset($this->fieldRelations[$nameListCode][(int) $item['id']]['set']) && ComponentbuilderHelper::checkString( - $this->fieldRelations[$viewName_list][(int) $item['id']][2]['set'] + $this->fieldRelations[$nameListCode][(int) $item['id']][2]['set'] )) { // concatenate return PHP_EOL . $this->_t(3) . "
" . implode( - $this->fieldRelations[$viewName_list][(int) $item['id']][2]['set'], + $this->fieldRelations[$nameListCode][(int) $item['id']][2]['set'], $field ) . PHP_EOL . $this->_t(3) . "
"; } @@ -11382,7 +11666,7 @@ class Interpretation extends Fields } return $this->getListItem( - $item, $viewName_single, $viewName_list, $itemClass, $doNotEscape, + $item, $nameSingleCode, $nameListCode, $itemClass, $doNotEscape, $coreLoad, $core, $class, $ref, $escape, $user, $refview ); } @@ -11390,29 +11674,29 @@ class Interpretation extends Fields /** * Get the list item row value * - * @param array $item The item array - * @param string $viewName_single The single view code name - * @param string $viewName_list The list view code name - * @param string $itemClass The table row default class - * @param bool $doNotEscape The do not escape global switch - * @param bool $coreLoad The core permission loader switch - * @param array $core The core permission values - * @param bool $class The dive class adding switch - * @param string $ref The link referral string - * @param string $escape The escape code name - * @param string $user The user code name - * @param string $refview The override of the referral view code name + * @param array $item The item array + * @param string $nameSingleCode The single view code name + * @param string $nameListCode The list view code name + * @param string $itemClass The table row default class + * @param bool $doNotEscape The do not escape global switch + * @param bool $coreLoad The core permission loader switch + * @param array $core The core permission values + * @param bool $class The dive class adding switch + * @param string $ref The link referral string + * @param string $escape The escape code name + * @param string $user The user code name + * @param string $refview The override of the referral view code name * * @return string of the single item value for the table row * */ - protected function getListItem($item, $viewName_single, $viewName_list, + protected function getListItem($item, $nameSingleCode, $nameListCode, &$itemClass, $doNotEscape, $coreLoad, $core, $class = true, $ref = null, $escape = '$this->escape', $user = '$this->user', $refview = null ) { // get list item code $itemCode = $this->getListItemCode( - $item, $viewName_list, $doNotEscape, $escape + $item, $nameListCode, $doNotEscape, $escape ); // add default links $defaultLink = true; @@ -11437,16 +11721,17 @@ class Interpretation extends Fields $itemClass = 'nowrap'; // get list item link $itemLink = $this->getListItemLink( - $item, $checkoutTriger, $viewName_single, $viewName_list, $ref + $item, $checkoutTriger, $nameSingleCode, $nameListCode, $ref ); // get list item link authority $itemLinkAuthority = $this->getListItemLinkAuthority( - $item, $viewName_single, $viewName_list, $coreLoad, $core, $user + $item, $nameSingleCode, $nameListCode, $coreLoad, $core, + $user ); // set item row return $this->getListItemLinkLogic( - $itemCode, $itemLink, $itemLinkAuthority, $viewName_list, + $itemCode, $itemLink, $itemLinkAuthority, $nameListCode, $checkoutTriger, $class ); } @@ -11461,7 +11746,7 @@ class Interpretation extends Fields * @param string $itemCode The item code string * @param string $itemLink The item link string * @param string $itemLinkAuthority The link authority string - * @param string $viewName_list The list view code name + * @param string $nameListCode The list view code name * @param bool $checkoutTriger The check out trigger * @param bool $class The dive class adding switch * @@ -11469,7 +11754,7 @@ class Interpretation extends Fields * */ protected function getListItemLinkLogic($itemCode, $itemLink, - $itemLinkAuthority, $viewName_list, $checkoutTriger, $class = true + $itemLinkAuthority, $nameListCode, $checkoutTriger, $class = true ) { // build link $link = ''; @@ -11491,7 +11776,7 @@ class Interpretation extends Fields . "checked_out): ?>"; $link .= PHP_EOL . $tab . $this->_t(5) . "name, \$item->checked_out_time, '" - . $viewName_list . ".', \$canCheckin); ?>"; + . $nameListCode . ".', \$canCheckin); ?>"; $link .= PHP_EOL . $tab . $this->_t(4) . ""; } $link .= PHP_EOL . $tab . $this->_t(3) . ""; @@ -11511,26 +11796,26 @@ class Interpretation extends Fields /** * Get the custom admin view buttons * - * @param string $viewName_list The list view code name - * @param string $ref The link referral string + * @param string $nameListCode The list view code name + * @param string $ref The link referral string * * @return string of the custom admin view buttons * */ - protected function getCustomAdminViewButtons($viewName_list, $ref = '') + protected function getCustomAdminViewButtons($nameListCode, $ref = '') { $customAdminViewButton = ''; // check if custom links should be added to this list views - if (isset($this->customAdminViewListLink[$viewName_list]) + if (isset($this->customAdminViewListLink[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->customAdminViewListLink[$viewName_list] + $this->customAdminViewListLink[$nameListCode] )) { // start building the links $customAdminViewButton .= PHP_EOL . $this->_t(3) . '
'; foreach ( - $this->customAdminViewListLink[$viewName_list] as + $this->customAdminViewListLink[$nameListCode] as $customLinkView ) { @@ -11566,15 +11851,15 @@ class Interpretation extends Fields /** * Get the list item code value * - * @param array $item The item array - * @param string $viewName_list The list view code name - * @param bool $doNotEscape The do not escape global switch - * @param string $escape The escape code name + * @param array $item The item array + * @param string $nameListCode The list view code name + * @param bool $doNotEscape The do not escape global switch + * @param string $escape The escape code name * * @return string of the single item code * */ - protected function getListItemCode(&$item, $viewName_list, $doNotEscape, + protected function getListItemCode(&$item, $nameListCode, $doNotEscape, $escape = '$this->escape' ) { // first update the code id needed @@ -11613,13 +11898,13 @@ class Interpretation extends Fields . ')->name'; } // check if translated value is used - elseif (isset($this->selectionTranslationFixBuilder[$viewName_list]) + elseif (isset($this->selectionTranslationFixBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->selectionTranslationFixBuilder[$viewName_list] + $this->selectionTranslationFixBuilder[$nameListCode] ) && array_key_exists( $item['code'], - $this->selectionTranslationFixBuilder[$viewName_list] + $this->selectionTranslationFixBuilder[$nameListCode] )) { return 'JText:' . ':_($item->' . $item['code'] . ')'; @@ -11634,7 +11919,7 @@ class Interpretation extends Fields } elseif ($doNotEscape) { - if (in_array($item['code'], $this->doNotEscape[$viewName_list])) + if (in_array($item['code'], $this->doNotEscape[$nameListCode])) { return '$item->' . $item['code']; } @@ -11647,17 +11932,17 @@ class Interpretation extends Fields /** * Get the list item link * - * @param array $item The item array - * @param bool $checkoutTriger The checkout trigger switch - * @param string $viewName_single The single view code name - * @param string $viewName_list The list view code name - * @param string $ref The link referral string + * @param array $item The item array + * @param bool $checkoutTriger The checkout trigger switch + * @param string $nameSingleCode The single view code name + * @param string $nameListCode The list view code name + * @param string $ref The link referral string * * @return string of the single item link * */ protected function getListItemLink($item, &$checkoutTriger, - $viewName_single, $viewName_list, $ref = null + $nameSingleCode, $nameListCode, $ref = null ) { // set referal if not set $referal = ''; @@ -11676,7 +11961,7 @@ class Interpretation extends Fields // return the link to category return 'index.php?option=com_categories&task=category.edit&id=' . $item['code'] . '; ?>&extension=' - . $this->categoryBuilder[$viewName_list]['extension']; + . $this->categoryBuilder[$nameListCode]['extension']; } elseif ($item['type'] === 'user' && !$item['title']) { @@ -11720,24 +12005,25 @@ class Interpretation extends Fields /** * Get the list item authority * - * @param array $item The item array - * @param string $viewName_single The single view code name - * @param string $viewName_list The list view code name - * @param bool $coreLoad The core permission loader switch - * @param array $core The core permission values - * @param string $user The user code name + * @param array $item The item array + * @param string $nameSingleCode The single view code name + * @param string $nameListCode The list view code name + * @param bool $coreLoad The core permission loader switch + * @param array $core The core permission values + * @param string $user The user code name * * @return string of the single item link authority * */ - protected function getListItemLinkAuthority($item, $viewName_single, - $viewName_list, $coreLoad, $core, $user = '$this->user' + protected function getListItemLinkAuthority($item, $nameSingleCode, + $nameListCode, $coreLoad, $core, $user = '$this->user' ) { // if to be linked if ($item['type'] === 'category' && !$item['title']) { // get the other view - $otherView = $this->catCodeBuilder[$viewName_single]['view']; + $otherView = $this->catCodeBuilder[$nameSingleCode]['view']; + // return the authority to category return $user . "->authorise('core.edit', 'com_" . $this->componentCodeName . "." . $otherView @@ -11804,7 +12090,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit']] )) { @@ -11820,37 +12106,189 @@ class Interpretation extends Fields * Get the list field class * * @param string $name The field code name - * @param string $listViewName The list view code name + * @param string $nameListCode The list view code name * @param string $default The default * * @return string The list field class * */ - protected function getListFieldClass($name, $listViewName, $default = '') + protected function getListFieldClass($name, $nameListCode, $default = '') { - return (isset($this->listFieldClass[$listViewName]) - && isset($this->listFieldClass[$listViewName][$name])) - ? $this->listFieldClass[$listViewName][$name] : $default; + return (isset($this->listFieldClass[$nameListCode]) + && isset($this->listFieldClass[$nameListCode][$name])) + ? $this->listFieldClass[$nameListCode][$name] : $default; + } + + /** + * set the default views body + * + * @param string $nameSingleCode + * @param string $nameListCode + * + * @return string + */ + public function setDefaultViewsBody($nameSingleCode, $nameListCode) + { + // set component name + $component = $this->componentCodeName; + $Component = ucfirst($component); + $COMPONENT = strtoupper($component); + // set uppercase view + $VIEWS = strtoupper($nameListCode); + + // build the body + $body = array(); + // check if the filter type is sidebar (1 = sidebar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1) + { + $body[] = ""; + } + $body[] = "
\" method=\"post\" name=\"adminForm\" id=\"adminForm\">"; + $body[] = "sidebar)): ?>"; + $body[] = $this->_t(1) + . "
"; + $body[] = $this->_t(2) . "sidebar; ?>"; + $body[] = $this->_t(1) . "
"; + $body[] = $this->_t(1) + . "
"; + $body[] = ""; + $body[] = $this->_t(1) . "
"; + $body[] = ""; + // check if the filter type is sidebar (2 = topbar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + $body[] = "_t(1) . "//" . $this->setLine( + __LINE__ + ) . " Add the searchtools"; + $body[] = $this->_t(1) + . "echo JLayoutHelper::render('joomla.searchtools.default', array('view' => \$this));"; + $body[] = "?>"; + } + $body[] = "items)): ?>"; + // check if the filter type is sidebar (1 = sidebar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1) + { + $body[] = $this->_t(1) + . "loadTemplate('toolbar');?>"; + } + $body[] = $this->_t(1) + . "
"; + $body[] = $this->_t(2) + . ""; + $body[] = $this->_t(1) . "
"; + $body[] = ""; + // check if the filter type is sidebar (1 = sidebar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1) + { + $body[] = $this->_t(1) + . "loadTemplate('toolbar');?>"; + } + $body[] = $this->_t(1) . ""; + $body[] = $this->_t(2) + . "loadTemplate('head');?>"; + $body[] = $this->_t(2) + . "loadTemplate('foot');?>"; + $body[] = $this->_t(2) + . "loadTemplate('body');?>"; + $body[] = $this->_t(1) . "
"; + $body[] = $this->_t(1) . "setLine( + __LINE__ + ) . " Load the batch processing form. ?>"; + $body[] = $this->_t(1) + . "canCreate && \$this->canEdit) : ?>"; + $body[] = $this->_t(2) . "_t(3) . "'bootstrap.renderModal',"; + $body[] = $this->_t(3) . "'collapseModal',"; + $body[] = $this->_t(3) . "array("; + $body[] = $this->_t(4) . "'title' => JText::_('COM_" . $COMPONENT . "_" + . $VIEWS + . "_BATCH_OPTIONS'),"; + $body[] = $this->_t(4) + . "'footer' => \$this->loadTemplate('batch_footer')"; + $body[] = $this->_t(3) . "),"; + $body[] = $this->_t(3) . "\$this->loadTemplate('batch_body')"; + $body[] = $this->_t(2) . "); ?>"; + $body[] = $this->_t(1) . ""; + // check if the filter type is sidebar (1 = sidebar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1) + { + $body[] = $this->_t(1) + . "listOrder; ?>\" />"; + $body[] = $this->_t(1) + . "listDirn; ?>\" />"; + } + $body[] = $this->_t(1) + . ""; + $body[] = $this->_t(1) . "
"; + $body[] = ""; + $body[] = $this->_t(1) + . ""; + $body[] = $this->_t(1) . ""; + $body[] = ""; + + return implode(PHP_EOL, $body); } /** * set the list body table head * - * @param string $viewName_single - * @param string $viewName_list + * @param string $nameSingleCode + * @param string $nameListCode * * @return string */ - public function setListHead($viewName_single, $viewName_list) + public function setListHead($nameSingleCode, $nameListCode) { - if (isset($this->listBuilder[$viewName_list]) + if (isset($this->listBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->listBuilder[$viewName_list] + $this->listBuilder[$nameListCode] )) { + // set the JHtml values based on filter type + $jhtml_sort = "grid.sort"; + $jhtml_sort_icon = ""; + $jhtml_sort_icon_2 = ""; + // for the new filter (2 = topbar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + $jhtml_sort = "searchtools.sort"; + $jhtml_sort_icon = ""; + $jhtml_sort_icon_2 = ", 'icon-menu-2'"; + } // main lang prefix $langView = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString($viewName_single, 'U'); + . ComponentbuilderHelper::safeString($nameSingleCode, 'U'); // set status lang $statusLangName = $langView . '_STATUS'; // set id lang @@ -11863,14 +12301,15 @@ class Interpretation extends Fields $head = ''; $head .= PHP_EOL . $this->_t(1) . "canEdit&& \$this->canState): ?>"; - if (!isset($this->fieldsNames[$viewName_single]['ordering'])) + if (!isset($this->fieldsNames[$nameSingleCode]['ordering'])) { $head .= PHP_EOL . $this->_t(2) . ''; $head .= PHP_EOL . $this->_t(3) - . "' - . "', 'ordering', \$this->listDirn, \$this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>"; + . "listDirn, \$this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'" + . $jhtml_sort_icon_2 . "); ?>"; $head .= PHP_EOL . $this->_t(2) . ""; } $head .= PHP_EOL . $this->_t(2) @@ -11889,22 +12328,22 @@ class Interpretation extends Fields $head .= PHP_EOL . $this->_t(2) . ""; $head .= PHP_EOL . $this->_t(1) . ""; // set footer Column number - $this->listColnrBuilder[$viewName_list] = 4; + $this->listColnrBuilder[$nameListCode] = 4; // build the dynamic fields - foreach ($this->listBuilder[$viewName_list] as $item) + foreach ($this->listBuilder[$nameListCode] as $item) { // check if target is admin list if (1 == $item['target'] || 3 == $item['target']) { // check if we have an over-ride - if (isset($this->listHeadOverRide[$viewName_list]) + if (isset($this->listHeadOverRide[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->listHeadOverRide[$viewName_list] + $this->listHeadOverRide[$nameListCode] ) - && isset($this->listHeadOverRide[$viewName_list][$item['id']])) + && isset($this->listHeadOverRide[$nameListCode][$item['id']])) { $item['lang'] - = $this->listHeadOverRide[$viewName_list][$item['id']]; + = $this->listHeadOverRide[$nameListCode][$item['id']]; } $class = 'nowrap hidden-phone'; if ($item['link']) @@ -11918,7 +12357,8 @@ class Interpretation extends Fields if ($item['type'] === 'category') { // only one category per/view allowed at this point - $title = "listDirn, \$this->listOrder); ?>"; } @@ -11928,14 +12368,16 @@ class Interpretation extends Fields )) { // keep an eye on this - $title = "listDirn, \$this->listOrder); ?>"; } else { - $title = "listDirn, \$this->listOrder); ?>"; } @@ -11949,18 +12391,19 @@ class Interpretation extends Fields . '" >'; $head .= PHP_EOL . $this->_t(3) . $title; $head .= PHP_EOL . $this->_t(1) . ""; - $this->listColnrBuilder[$viewName_list]++; + $this->listColnrBuilder[$nameListCode]++; } } // set default - if (!isset($this->fieldsNames[$viewName_single]['published'])) + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) { $head .= PHP_EOL . $this->_t(1) . "canState): ?>"; $head .= PHP_EOL . $this->_t(2) . ''; $head .= PHP_EOL . $this->_t(3) - . "listDirn, \$this->listOrder); ?>"; $head .= PHP_EOL . $this->_t(2) . ""; $head .= PHP_EOL . $this->_t(1) . ""; @@ -11971,12 +12414,13 @@ class Interpretation extends Fields $head .= PHP_EOL . $this->_t(2) . ""; $head .= PHP_EOL . $this->_t(1) . ""; } - if (!isset($this->fieldsNames[$viewName_single]['id'])) + if (!isset($this->fieldsNames[$nameSingleCode]['id'])) { $head .= PHP_EOL . $this->_t(1) . ''; $head .= PHP_EOL . $this->_t(3) - . "listDirn, \$this->listOrder); ?>"; $head .= PHP_EOL . $this->_t(1) . ""; } @@ -11988,11 +12432,11 @@ class Interpretation extends Fields return ''; } - public function setListColnr($viewName_list) + public function setListColnr($nameListCode) { - if (isset($this->listColnrBuilder[$viewName_list])) + if (isset($this->listColnrBuilder[$nameListCode])) { - return $this->listColnrBuilder[$viewName_list]; + return $this->listColnrBuilder[$nameListCode]; } return ''; @@ -12001,22 +12445,22 @@ class Interpretation extends Fields /** * set Tabs Layouts Fields Array * - * @param string $view_name_single The single view name + * @param string $nameSingleCode The single view name * * @return string The array * */ - public function getTabLayoutFieldsArray($view_name_single) + public function getTabLayoutFieldsArray($nameSingleCode) { // check if the load build is set for this view - if (isset($this->layoutBuilder[$view_name_single]) + if (isset($this->layoutBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkArray( - $this->layoutBuilder[$view_name_single] + $this->layoutBuilder[$nameSingleCode] )) { $layoutArray = array(); foreach ( - $this->layoutBuilder[$view_name_single] as $layout => + $this->layoutBuilder[$nameSingleCode] as $layout => $alignments ) { @@ -12066,16 +12510,16 @@ class Interpretation extends Fields public function setEditBody(&$view) { // set view name - $view_name_single = ComponentbuilderHelper::safeString( + $nameSingleCode = ComponentbuilderHelper::safeString( $view['settings']->name_single ); // main lang prefix $langView = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString($view_name_single, 'U'); + . ComponentbuilderHelper::safeString($nameSingleCode, 'U'); // check if the load build is set for this view - if (isset($this->layoutBuilder[$view_name_single]) + if (isset($this->layoutBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkArray( - $this->layoutBuilder[$view_name_single] + $this->layoutBuilder[$nameSingleCode] )) { // reset the linked keys @@ -12083,7 +12527,7 @@ class Interpretation extends Fields $linkedViewIdentifier = array(); // set the linked view tabs $linkedTab = $this->getEditBodyLinkedAdminViewsTabs( - $view, $view_name_single, $keys, $linkedViewIdentifier + $view, $nameSingleCode, $keys, $linkedViewIdentifier ); // custom tab searching array $searchTabs = array(); @@ -12096,7 +12540,7 @@ class Interpretation extends Fields $sidewidth = 0; // get the tabs with positions $tabBucket = $this->getEditBodyTabs( - $view_name_single, $langView, $linkedTab, $keys, + $nameSingleCode, $langView, $linkedTab, $keys, $linkedViewIdentifier, $searchTabs, $leftside, $rightside, $footer, $header, $mainwidth, $sidewidth ); @@ -12130,12 +12574,12 @@ class Interpretation extends Fields { $body .= PHP_EOL . PHP_EOL . $this->_t(1) . " '" + . $nameSingleCode . "Tab', array('active' => '" . $tabCodeName . "')); ?>"; } // check if custom tab must be added if (($_customTabHTML = $this->addCustomTabs( - $searchTabs[$tabCodeName], $view_name_single, 1 + $searchTabs[$tabCodeName], $nameSingleCode, 1 )) !== false) { $body .= $_customTabHTML; @@ -12190,7 +12634,7 @@ class Interpretation extends Fields // start addtab body $body .= PHP_EOL . $this->_t(1) . ""; // add the main $body .= PHP_EOL . $this->_t(2) @@ -12216,7 +12660,7 @@ class Interpretation extends Fields } // check if custom tab must be added if (($_customTabHTML = $this->addCustomTabs( - $searchTabs[$tabCodeName], $view_name_single, 2 + $searchTabs[$tabCodeName], $nameSingleCode, 2 )) !== false) { $body .= $_customTabHTML; @@ -12228,19 +12672,19 @@ class Interpretation extends Fields $body .= PHP_EOL . PHP_EOL . $this->_t(1) . "ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>"; $body .= PHP_EOL . $this->_t(1) . "tab_name = '" - . $view_name_single . "Tab'; ?>"; + . $nameSingleCode . "Tab'; ?>"; $body .= PHP_EOL . $this->_t(1) . ""; // add the publish and meta data tabs $body .= $this->getEditBodyPublishMetaTabs( - $view_name_single, $langView + $nameSingleCode, $langView ); // end the tab set $body .= PHP_EOL . PHP_EOL . $this->_t(1) . ""; $body .= PHP_EOL . PHP_EOL . $this->_t(1) . "
"; $body .= PHP_EOL . $this->_t(2) - . ''; $body .= PHP_EOL . $this->_t(2) . ""; @@ -12283,7 +12727,7 @@ class Interpretation extends Fields * get Edit Body Linked Admin Views * * @param array $view The view data - * @param string $view_name_single The single view name + * @param string $nameSingleCode The single view name * @param array $keys The tabs to add in layout * @param array $linkedViewIdentifier The linked view identifier * @@ -12291,22 +12735,22 @@ class Interpretation extends Fields * */ protected function getEditBodyLinkedAdminViewsTabs(&$view, - &$view_name_single, &$keys, &$linkedViewIdentifier + &$nameSingleCode, &$keys, &$linkedViewIdentifier ) { // start linked tabs bucket $linkedTab = array(); // check if the view has linked admin view - if (isset($this->linkedAdminViews[$view_name_single]) + if (isset($this->linkedAdminViews[$nameSingleCode]) && ComponentbuilderHelper::checkArray( - $this->linkedAdminViews[$view_name_single] + $this->linkedAdminViews[$nameSingleCode] )) { - foreach ($this->linkedAdminViews[$view_name_single] as $linkedView) + foreach ($this->linkedAdminViews[$nameSingleCode] as $linkedView) { // get the tab name $tabName = $view['settings']->tabs[(int) $linkedView['tab']]; // update the tab counter - $this->tabCounter[$view_name_single][$linkedView['tab']] + $this->tabCounter[$nameSingleCode][$linkedView['tab']] = $tabName; // add the linked view $linkedTab[$linkedView['adminview']] = $linkedView['tab']; @@ -12344,7 +12788,7 @@ class Interpretation extends Fields /** * get Edit Body Tabs * - * @param string $view_name_single The single view name + * @param string $nameSingleCode The single view name * @param string $langView The main lang prefix * @param array $linkedTab The linked admin view tabs * @param array $keys The tabs to add in layout @@ -12360,16 +12804,16 @@ class Interpretation extends Fields * @return array The linked tabs * */ - protected function getEditBodyTabs(&$view_name_single, &$langView, + protected function getEditBodyTabs(&$nameSingleCode, &$langView, &$linkedTab, &$keys, &$linkedViewIdentifier, &$searchTabs, &$leftside, &$rightside, &$footer, &$header, &$mainwidth, &$sidewidth ) { // start tabs $tabs = array(); // sort the tabs based on key order - ksort($this->tabCounter[$view_name_single]); + ksort($this->tabCounter[$nameSingleCode]); // start tab builinging loop - foreach ($this->tabCounter[$view_name_single] as $tabNr => $tabName) + foreach ($this->tabCounter[$nameSingleCode] as $tabNr => $tabName) { $tabWidth = 12; $lrCounter = 0; @@ -12399,7 +12843,7 @@ class Interpretation extends Fields if ($buildLayout) { // sort to make sure it loads left first - $alignments = $this->layoutBuilder[$view_name_single][$tabName]; + $alignments = $this->layoutBuilder[$nameSingleCode][$tabName]; ksort($alignments); foreach ($alignments as $alignment => $names) { @@ -12434,7 +12878,7 @@ class Interpretation extends Fields $lrCounter++; // set as items layout $this->setLayout( - $view_name_single, $layoutCodeName, $items, + $nameSingleCode, $layoutCodeName, $items, 'layoutitems' ); // set the lang to tab @@ -12445,13 +12889,13 @@ class Interpretation extends Fields $tabs[$tabCodeName][(int) $alignment] = ''; } $tabs[$tabCodeName][(int) $alignment] .= ""; break; case 3: // fullwidth // set as items layout $this->setLayout( - $view_name_single, $layoutCodeName, $items, + $nameSingleCode, $layoutCodeName, $items, 'layoutfull' ); // set the lang to tab @@ -12462,58 +12906,58 @@ class Interpretation extends Fields $tabs[$tabCodeName][(int) $alignment] = ''; } $tabs[$tabCodeName][(int) $alignment] .= ""; break; case 4: // above // set as title layout $this->setLayout( - $view_name_single, $layoutCodeName, $items, + $nameSingleCode, $layoutCodeName, $items, 'layouttitle' ); // load to header $header .= PHP_EOL . $this->_t(1) . ""; break; case 5: // under // set as title layout $this->setLayout( - $view_name_single, $layoutCodeName, $items, + $nameSingleCode, $layoutCodeName, $items, 'layouttitle' ); // load to footer $footer .= PHP_EOL . PHP_EOL . "
" . PHP_EOL . ""; break; case 6: // left side $tabWidth = $tabWidth - 2; // set as items layout $this->setLayout( - $view_name_single, $layoutCodeName, $items, + $nameSingleCode, $layoutCodeName, $items, 'layoutitems' ); // load the body $leftside .= PHP_EOL . $this->_t(1) . ""; break; case 7: // right side $tabWidth = $tabWidth - 2; // set as items layout $this->setLayout( - $view_name_single, $layoutCodeName, $items, + $nameSingleCode, $layoutCodeName, $items, 'layoutitems' ); // load the body $rightside .= PHP_EOL . $this->_t(1) . ""; break; } @@ -12531,27 +12975,27 @@ class Interpretation extends Fields ); // set as items layout $this->setLayout( - $view_name_single, $layoutCodeName, $codeName, + $nameSingleCode, $layoutCodeName, $codeName, 'layoutlinkedview' ); // set the lang to tab $tabs[$tabCodeName]['lang'] = $tabLangName; // set all the linked view stuff $this->secondRunAdmin['setLinkedView'][] = array( - 'viewId' => $linkedViewId, - 'view_name_single' => $view_name_single, - 'codeName' => $codeName, - 'layoutCodeName' => $layoutCodeName, - 'key' => $keys[$linkedViewId]['key'], - 'parentKey' => $keys[$linkedViewId]['parentKey'], - 'addNewButon' => $keys[$linkedViewId]['addNewButton']); + 'viewId' => $linkedViewId, + 'nameSingleCode' => $nameSingleCode, + 'codeName' => $codeName, + 'layoutCodeName' => $layoutCodeName, + 'key' => $keys[$linkedViewId]['key'], + 'parentKey' => $keys[$linkedViewId]['parentKey'], + 'addNewButon' => $keys[$linkedViewId]['addNewButton']); // load the body if (!isset($tabs[$tabCodeName][3])) { $tabs[$tabCodeName][3] = ''; } $tabs[$tabCodeName][3] .= ""; } // width calculator :) @@ -12626,13 +13070,13 @@ class Interpretation extends Fields /** * get Edit Body Publish and Meta Tab * - * @param string $view_name_single The single view name - * @param string $langView The main lang prefix + * @param string $nameSingleCode The single view name + * @param string $langView The main lang prefix * * @return string The published and Meta Data Tabs * */ - protected function getEditBodyPublishMetaTabs(&$view_name_single, &$langView + protected function getEditBodyPublishMetaTabs(&$nameSingleCode, &$langView ) { // build the two tabs $tabs = ''; @@ -12645,10 +13089,10 @@ class Interpretation extends Fields // Setup the default (custom) fields // only load (1 => 'left', 2 => 'right') $fieldsAddedRight = false; - if (isset($this->newPublishingFields[$view_name_single])) + if (isset($this->newPublishingFields[$nameSingleCode])) { foreach ( - $this->newPublishingFields[$view_name_single] as $df_alignment + $this->newPublishingFields[$nameSingleCode] as $df_alignment => $df_items ) { @@ -12669,7 +13113,7 @@ class Interpretation extends Fields 'Your %s field could not be added, since the %s alignment position is not available in the %s (publishing) tab. Please only target Left or right in the publishing tab.', $df_name, $this->alignmentOptions[$df_alignment], - $view_name_single + $nameSingleCode ), 'Warning' ); } @@ -12692,16 +13136,16 @@ class Interpretation extends Fields { foreach ($defaultFields as $defaultField) { - if (!isset($this->movedPublishingFields[$view_name_single][$defaultField])) + if (!isset($this->movedPublishingFields[$nameSingleCode][$defaultField])) { if ($defaultField != 'access') { $items[$d_alignment][] = $defaultField; } elseif ($defaultField === 'access' - && isset($this->accessBuilder[$view_name_single]) + && isset($this->accessBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->accessBuilder[$view_name_single] + $this->accessBuilder[$nameSingleCode] )) { $items[$d_alignment][] = $defaultField; @@ -12710,9 +13154,9 @@ class Interpretation extends Fields } } // check if metadata is added to this view - if (isset($this->metadataBuilder[$view_name_single]) + if (isset($this->metadataBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->metadataBuilder[$view_name_single] + $this->metadataBuilder[$nameSingleCode] )) { // set default publishing tab code name @@ -12759,13 +13203,13 @@ class Interpretation extends Fields $this->app->enqueueMessage( JText::sprintf( 'Your field/s added to the right alignment position in the %s (publishing) tab was added to the left. Since we have metadata fields on the right. Fields can only be loaded to the right of the publishing tab if there is no metadata fields.', - $view_name_single + $nameSingleCode ), 'Notice' ); } // set the publishing layout $this->setLayout( - $view_name_single, $tabCodeNameLeft, $items_one, + $nameSingleCode, $tabCodeNameLeft, $items_one, 'layoutpublished' ); $items_one = true; @@ -12776,7 +13220,7 @@ class Interpretation extends Fields } // set the metadata layout $this->setLayout( - $view_name_single, $tabCodeNameRight, false, 'layoutmetadata' + $nameSingleCode, $tabCodeNameRight, false, 'layoutmetadata' ); $items_two = true; } @@ -12798,7 +13242,7 @@ class Interpretation extends Fields ) . "'"; // set the publishing layout $this->setLayout( - $view_name_single, $tabCodeNameLeft, $items_one, + $nameSingleCode, $tabCodeNameLeft, $items_one, 'layoutpublished' ); $items_one = true; @@ -12812,7 +13256,7 @@ class Interpretation extends Fields ) . "'"; // set the publishing layout $this->setLayout( - $view_name_single, $tabCodeNameRight, $items_two, + $nameSingleCode, $tabCodeNameRight, $items_two, 'layoutpublished' ); $items_two = true; @@ -12834,9 +13278,9 @@ class Interpretation extends Fields } // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$view_name_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$view_name_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // only load this if needed @@ -12855,7 +13299,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core[$core_permission]] ) && in_array( - $view_name_single, + $nameSingleCode, $this->permissionBuilder['global'][$core[$core_permission]] )) { @@ -12866,7 +13310,8 @@ class Interpretation extends Fields else { // set permissions. - $publishingPerOR[] = "\$this->canDo->get('" . $core_permission + $publishingPerOR[] = "\$this->canDo->get('" + . $core_permission . "')"; } } @@ -12880,7 +13325,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core[$core_permission]] ) && in_array( - $view_name_single, + $nameSingleCode, $this->permissionBuilder['global'][$core[$core_permission]] )) { @@ -12891,13 +13336,14 @@ class Interpretation extends Fields else { // set permissions. - $publishingPerAND[] = "\$this->canDo->get('" . $core_permission + $publishingPerAND[] = "\$this->canDo->get('" + . $core_permission . "')"; } } // check if custom tab must be added if (($_customTabHTML = $this->addCustomTabs( - 15, $view_name_single, 1 + 15, $nameSingleCode, 1 )) !== false) { $tabs .= $_customTabHTML; @@ -12911,7 +13357,7 @@ class Interpretation extends Fields // set the default publishing tab $tabs .= PHP_EOL . $this->_t(1) . ""; $tabs .= PHP_EOL . $this->_t(2) . '
'; @@ -12920,7 +13366,7 @@ class Interpretation extends Fields $tabs .= PHP_EOL . $this->_t(3) . '
'; $tabs .= PHP_EOL . $this->_t(4) - . ""; $tabs .= PHP_EOL . $this->_t(3) . "
"; } @@ -12929,7 +13375,7 @@ class Interpretation extends Fields $tabs .= PHP_EOL . $this->_t(3) . '
'; $tabs .= PHP_EOL . $this->_t(4) - . ""; $tabs .= PHP_EOL . $this->_t(3) . "
"; } @@ -12939,7 +13385,7 @@ class Interpretation extends Fields $tabs .= PHP_EOL . $this->_t(1) . ""; // check if custom tab must be added if (($_customTabHTML = $this->addCustomTabs( - 15, $view_name_single, 2 + 15, $nameSingleCode, 2 )) !== false) { $tabs .= $_customTabHTML; @@ -12947,7 +13393,7 @@ class Interpretation extends Fields } // make sure we dont load it to a view with the name component (as this will cause conflict with Joomla conventions) - if ($view_name_single != 'component') + if ($nameSingleCode != 'component') { // set permissions tab lang $tabLangName = $langView . '_PERMISSION'; @@ -12960,7 +13406,7 @@ class Interpretation extends Fields . "canDo->get('core.admin')) : ?>"; $tabs .= PHP_EOL . $this->_t(1) . ""; $tabs .= PHP_EOL . $this->_t(2) . '
'; @@ -13068,33 +13514,33 @@ class Interpretation extends Fields } /** - * @param $viewName_single + * @param $nameSingleCode * @param $layoutName * @param $items * @param $type */ - public function setLayout($viewName_single, $layoutName, $items, $type) + public function setLayout($nameSingleCode, $layoutName, $items, $type) { // first build the layout file - $target = array('admin' => $viewName_single); + $target = array('admin' => $nameSingleCode); $this->buildDynamique($target, $type, $layoutName); // add to front if needed if ($this->lang === 'both') { - $target = array('site' => $viewName_single); + $target = array('site' => $nameSingleCode); $this->buildDynamique($target, $type, $layoutName); } if (ComponentbuilderHelper::checkString($items)) { // LAYOUTITEMS <<>> - $this->fileContentDynamic[$viewName_single . '_' + $this->fileContentDynamic[$nameSingleCode . '_' . $layoutName][$this->hhh . 'LAYOUTITEMS' . $this->hhh] = $items; } else { // LAYOUTITEMS <<>> - $this->fileContentDynamic[$viewName_single . '_' + $this->fileContentDynamic[$nameSingleCode . '_' . $layoutName][$this->hhh . 'bogus' . $this->hhh] = 'boom'; } @@ -13107,7 +13553,7 @@ class Interpretation extends Fields { /** * @var $viewId - * @var $view_name_single + * @var $nameSingleCode * @var $codeName * @var $layoutCodeName * @var $key @@ -13115,46 +13561,44 @@ class Interpretation extends Fields * @var $addNewButon */ extract($args, EXTR_PREFIX_SAME, "oops"); - $single = ''; - $list = ''; + $single = ''; + $name_list_code = ''; foreach ($this->componentData->admin_views as $array) { if ($array['adminview'] == $viewId) { - $single = ComponentbuilderHelper::safeString( - $array['settings']->name_single - ); - $list = ComponentbuilderHelper::safeString( - $array['settings']->name_list - ); + $name_single_code = $array['settings']->name_single_code; + $name_list_code = $array['settings']->name_list_code; break; } } - if (ComponentbuilderHelper::checkString($single) - && ComponentbuilderHelper::checkString($list)) + if (ComponentbuilderHelper::checkString($name_single_code) + && ComponentbuilderHelper::checkString($name_list_code)) { $head = $this->setListHeadLinked( - $single, $list, $addNewButon, $view_name_single + $name_single_code, $name_list_code, $addNewButon, + $nameSingleCode ); $body = $this->setListBodyLinked( - $single, $list, $view_name_single + $name_single_code, $name_list_code, $nameSingleCode ); $functionName = ComponentbuilderHelper::safeString($codeName, 'F'); // LAYOUTITEMSTABLE <<>> - $this->fileContentDynamic[$view_name_single . '_' + $this->fileContentDynamic[$nameSingleCode . '_' . $layoutCodeName][$this->hhh . 'LAYOUTITEMSTABLE' . $this->hhh] = $head . $body; // LAYOUTITEMSHEADER <<>> $headerscript = '//' . $this->setLine(__LINE__) . ' set the edit URL'; $headerscript .= PHP_EOL . '$edit = "index.php?option=com_' - . $this->componentCodeName . '&view=' . $list . '&task=' - . $single . '.edit";'; + . $this->componentCodeName . '&view=' . $name_list_code + . '&task=' + . $name_single_code . '.edit";'; $headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set a return value'; $headerscript .= PHP_EOL . '$return = ($id) ? "index.php?option=com_' - . $this->componentCodeName . '&view=' . $view_name_single + . $this->componentCodeName . '&view=' . $nameSingleCode . '&layout=edit&id=" . $id : "";'; $headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' check for a return value'; @@ -13176,13 +13620,13 @@ class Interpretation extends Fields __LINE__ ) . ' set the referral values'; $headerscript .= PHP_EOL . $this->_t(1) . '$ref = ($id) ? "&ref=' - . $view_name_single + . $nameSingleCode . '&refid=" . $id . "&return=" . urlencode(base64_encode($return)) : "&return=" . urlencode(base64_encode($return));'; $headerscript .= PHP_EOL . '}'; $headerscript .= PHP_EOL . 'else'; $headerscript .= PHP_EOL . '{'; $headerscript .= PHP_EOL . $this->_t(1) . '$ref = ($id) ? "&ref=' - . $view_name_single . '&refid=" . $id : "";'; + . $nameSingleCode . '&refid=" . $id : "";'; $headerscript .= PHP_EOL . '}'; if ($addNewButon > 0) { @@ -13192,8 +13636,9 @@ class Interpretation extends Fields $headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' set the create new URL'; $headerscript .= PHP_EOL . '$new = "index.php?option=com_' - . $this->componentCodeName . '&view=' . $list . '&task=' - . $single . '.edit" . $ref;'; + . $this->componentCodeName . '&view=' . $name_list_code + . '&task=' + . $name_single_code . '.edit" . $ref;'; } // and the link for close and new if ($addNewButon == 2 || $addNewButon == 3) @@ -13202,21 +13647,23 @@ class Interpretation extends Fields . ' set the create new and close URL'; $headerscript .= PHP_EOL . '$close_new = "index.php?option=com_' - . $this->componentCodeName . '&view=' . $list . '&task=' - . $single . '.edit";'; + . $this->componentCodeName . '&view=' . $name_list_code + . '&task=' + . $name_single_code . '.edit";'; } $headerscript .= PHP_EOL . '//' . $this->setLine(__LINE__) . ' load the action object'; $headerscript .= PHP_EOL . '$can = ' . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] . 'Helper::getActions(' . "'" . $single . "'" + . $this->hhh] . 'Helper::getActions(' . "'" + . $name_single_code . "'" . ');'; } - $this->fileContentDynamic[$view_name_single . '_' + $this->fileContentDynamic[$nameSingleCode . '_' . $layoutCodeName][$this->hhh . 'LAYOUTITEMSHEADER' . $this->hhh] = $headerscript; // LINKEDVIEWITEMS <<>> - $this->fileContentDynamic[$view_name_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWITEMS' . $this->hhh] .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ @@ -13224,7 +13671,7 @@ class Interpretation extends Fields . "\$this->" . $codeName . " = \$this->get('" . $functionName . "');"; // LINKEDVIEWTABLESCRIPTS <<>> - $this->fileContentDynamic[$view_name_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWTABLESCRIPTS' . $this->hhh] = $this->setFootableScripts(); if (strpos($parentKey, '-R>') !== false @@ -13267,7 +13714,7 @@ class Interpretation extends Fields = ComponentbuilderHelper::safeString( $_key . $this->uniquekey(4) ); - $this->fileContentDynamic[$view_name_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWGLOBAL' . $this->hhh] .= PHP_EOL . $this->_t(2) . "\$this->" . $globalKey[$parent_key] . " = \$item->" . $parent_key @@ -13280,25 +13727,26 @@ class Interpretation extends Fields $globalKey = ComponentbuilderHelper::safeString( $_key . $this->uniquekey(4) ); - $this->fileContentDynamic[$view_name_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWGLOBAL' . $this->hhh] .= PHP_EOL . $this->_t(2) . "\$this->" . $globalKey . " = \$item->" . $parent_key . ";"; } // LINKEDVIEWMETHODS <<>> - $this->fileContentDynamic[$view_name_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWMETHODS' . $this->hhh] .= $this->setListQueryLinked( - $single, $list, $functionName, $key, $_key, $parentKey, + $name_single_code, $name_list_code, $functionName, $key, $_key, + $parentKey, $parent_key, $globalKey ); } else { - $this->fileContentDynamic[$view_name_single . '_' + $this->fileContentDynamic[$nameSingleCode . '_' . $layoutCodeName][$this->hhh . 'LAYOUTITEMSTABLE' . $this->hhh] = 'oops! error.....'; - $this->fileContentDynamic[$view_name_single . '_' + $this->fileContentDynamic[$nameSingleCode . '_' . $layoutCodeName][$this->hhh . 'LAYOUTITEMSHEADER' . $this->hhh] = ''; } @@ -13436,17 +13884,18 @@ class Interpretation extends Fields /** * set the list body of the linked admin view * - * @param string $viewName_single - * @param string $viewName_list + * @param string $nameSingleCode + * @param string $nameListCode * @param string $refview * * @return string */ - public function setListBodyLinked($viewName_single, $viewName_list, $refview + public function setListBodyLinked($nameSingleCode, $nameListCode, + $refview ) { - if (isset($this->listBuilder[$viewName_list]) + if (isset($this->listBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->listBuilder[$viewName_list] + $this->listBuilder[$nameListCode] )) { // component helper name @@ -13457,9 +13906,9 @@ class Interpretation extends Fields // setup correct core target $coreLoad = false; $core = null; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } $counter = 0; @@ -13472,18 +13921,18 @@ class Interpretation extends Fields $body .= PHP_EOL . $this->_t(2) . "\$userChkOut = JFactory::getUser(\$item->checked_out);"; $body .= PHP_EOL . $this->_t(2) . "\$canDo = " . $Helper - . "::getActions('" . $viewName_single . "',\$item,'" - . $viewName_list . "');"; + . "::getActions('" . $nameSingleCode . "',\$item,'" + . $nameListCode . "');"; $body .= PHP_EOL . $this->_t(1) . "?>"; $body .= PHP_EOL . $this->_t(1) . ''; // check if this view has fields that should not be escaped $doNotEscape = false; - if (isset($this->doNotEscape[$viewName_list])) + if (isset($this->doNotEscape[$nameListCode])) { $doNotEscape = true; } // start adding the dynamic - foreach ($this->listBuilder[$viewName_list] as $item) + foreach ($this->listBuilder[$nameListCode] as $item) { // check if target is linked list view if (1 == $item['target'] || 4 == $item['target']) @@ -13494,7 +13943,7 @@ class Interpretation extends Fields $customAdminViewButtons = ''; // set the item row $itemRow = $this->getListItemBuilder( - $item, $viewName_single, $viewName_list, $itemClass, + $item, $nameSingleCode, $nameListCode, $itemClass, $doNotEscape, $coreLoad, $core, false, $ref, '$displayData->escape', '$user', $refview ); @@ -13504,7 +13953,7 @@ class Interpretation extends Fields // get custom admin view buttons $customAdminViewButtons = $this->getCustomAdminViewButtons( - $viewName_list, $ref + $nameListCode, $ref ); // make sure the custom admin view buttons are only added once $firstTimeBeingAdded = false; @@ -13519,10 +13968,10 @@ class Interpretation extends Fields } } $data_value = (3 == $this->footableVersion) ? 'data-sort-value' - : 'data-value'; + : 'data-value'; // add the defaults - if (!isset($this->fieldsNames[$viewName_single]['published'])) + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) { $counter++; // add the defaults @@ -13585,7 +14034,7 @@ class Interpretation extends Fields } // add the defaults - if (!isset($this->fieldsNames[$viewName_single]['id'])) + if (!isset($this->fieldsNames[$nameSingleCode]['id'])) { $counter++; $body .= PHP_EOL . $this->_t(2) @@ -13627,19 +14076,19 @@ class Interpretation extends Fields /** * set the list body table head linked admin view * - * @param string $viewName_single - * @param string $viewName_list + * @param string $nameSingleCode + * @param string $nameListCode * @param bool $addNewButon * @param string $refview * * @return string */ - public function setListHeadLinked($viewName_single, $viewName_list, + public function setListHeadLinked($nameSingleCode, $nameListCode, $addNewButon, $refview ) { - if (isset($this->listBuilder[$viewName_list]) + if (isset($this->listBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->listBuilder[$viewName_list] + $this->listBuilder[$nameListCode] )) { // component helper name @@ -13651,9 +14100,9 @@ class Interpretation extends Fields { // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // check if the item has permissions. @@ -13663,7 +14112,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -13721,18 +14170,18 @@ class Interpretation extends Fields ? ' data-show-toggle="true" data-toggle-column="first"' : ''; // set paging $paging = (2 == $this->footableVersion) - ? ' data-page-size="20" data-filter="#filter_' . $viewName_list + ? ' data-page-size="20" data-filter="#filter_' . $nameListCode . '"' : ' data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true"'; // add html fix for V3 $htmlFix = (3 == $this->footableVersion) ? ' data-type="html" data-sort-use="text"' : ''; $head .= PHP_EOL . ''; + . $nameListCode . $metro_blue . '"' . $toggle . $paging . '>'; $head .= PHP_EOL . ""; // main lang prefix $langView = $this->langPrefix . '_' - . ComponentbuilderHelper::safeString($viewName_single, 'U'); + . ComponentbuilderHelper::safeString($nameSingleCode, 'U'); // set status lang $statusLangName = $langView . '_STATUS'; // set id lang @@ -13747,20 +14196,20 @@ class Interpretation extends Fields // set controller for data hiding options $controller = 1; // build the dynamic fields - foreach ($this->listBuilder[$viewName_list] as $item) + foreach ($this->listBuilder[$nameListCode] as $item) { // check if target is linked list view if (1 == $item['target'] || 4 == $item['target']) { // check if we have an over-ride - if (isset($this->listHeadOverRide[$viewName_list]) + if (isset($this->listHeadOverRide[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->listHeadOverRide[$viewName_list] + $this->listHeadOverRide[$nameListCode] ) - && isset($this->listHeadOverRide[$viewName_list][$item['id']])) + && isset($this->listHeadOverRide[$nameListCode][$item['id']])) { $item['lang'] - = $this->listHeadOverRide[$viewName_list][$item['id']]; + = $this->listHeadOverRide[$nameListCode][$item['id']]; } $setin = (2 == $this->footableVersion) ? ' data-hide="phone"' : ' data-breakpoints="xs sm"'; @@ -13795,7 +14244,7 @@ class Interpretation extends Fields $data_hide = (2 == $this->footableVersion) ? 'data-hide="phone,tablet"' : 'data-breakpoints="xs sm md"'; // add the defaults - if (!isset($this->fieldsNames[$viewName_single]['published'])) + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) { $head .= PHP_EOL . $this->_t(2) . '"; + $head .= PHP_EOL . $this->_t(2) . ""; } $head .= PHP_EOL . $this->_t(1) . ""; $head .= PHP_EOL . ""; @@ -13825,8 +14277,8 @@ class Interpretation extends Fields } /** - * @param $viewName_single - * @param $viewName_list + * @param $nameSingleCode + * @param $nameListCode * @param $functionName * @param $key * @param $_key @@ -13836,16 +14288,16 @@ class Interpretation extends Fields * * @return string */ - public function setListQueryLinked($viewName_single, $viewName_list, + public function setListQueryLinked($nameSingleCode, $nameListCode, $functionName, $key, $_key, $parentKey, $parent_key, $globalKey ) { // check if this view has category added - if (isset($this->categoryBuilder[$viewName_list]) + if (isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->categoryBuilder[$viewName_list] + $this->categoryBuilder[$nameListCode] )) { - $categoryCodeName = $this->categoryBuilder[$viewName_list]['code']; + $categoryCodeName = $this->categoryBuilder[$nameListCode]['code']; $addCategory = true; } else @@ -13881,10 +14333,11 @@ class Interpretation extends Fields } $query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ - ) . " From the " . $this->componentCodeName . "_" . $viewName_single + ) . " From the " . $this->componentCodeName . "_" + . $nameSingleCode . " table"; $query .= PHP_EOL . $this->_t(2) . "\$query->from(\$db->quoteName('#__" - . $this->componentCodeName . "_" . $viewName_single . "', 'a'));"; + . $this->componentCodeName . "_" . $nameSingleCode . "', 'a'));"; // add the category if ($addCategory) { @@ -13895,10 +14348,10 @@ class Interpretation extends Fields } // add custom filtering php $query .= $this->getCustomScriptBuilder( - 'php_getlistquery', $viewName_single, PHP_EOL . PHP_EOL + 'php_getlistquery', $nameSingleCode, PHP_EOL . PHP_EOL ); // add the custom fields query - $query .= $this->setCustomQuery($viewName_list, $viewName_single); + $query .= $this->setCustomQuery($nameListCode, $nameSingleCode); if (ComponentbuilderHelper::checkString($globalKey) && $key && strpos( $key, '-R>' @@ -13988,9 +14441,9 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(2) . "}"; } } - if (isset($this->accessBuilder[$viewName_single]) + if (isset($this->accessBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->accessBuilder[$viewName_single] + $this->accessBuilder[$nameSingleCode] )) { $query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( @@ -14000,14 +14453,40 @@ class Interpretation extends Fields . "\$query->select('ag.title AS access_level');"; $query .= PHP_EOL . $this->_t(2) . "\$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');"; - $query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) - . " Filter by access level."; - $query .= PHP_EOL . $this->_t(2) - . "if (\$access = \$this->getState('filter.access'))"; - $query .= PHP_EOL . $this->_t(2) . "{"; - $query .= PHP_EOL . $this->_t(3) - . "\$query->where('a.access = ' . (int) \$access);"; - $query .= PHP_EOL . $this->_t(2) . "}"; + // check if the access field was over ridden + if (!isset($this->fieldsNames[$nameSingleCode]['access'])) + { + // component helper name + $Helper = $this->fileContentStatic[$this->hhh . 'Component' + . $this->hhh] . 'Helper'; + // load the access filter query code + $query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( + __LINE__ + ) + . " Filter by access level."; + $query .= PHP_EOL . $this->_t(2) + . "\$_access = \$this->getState('filter.access');"; + $query .= PHP_EOL . $this->_t(2) + . "if (\$_access && is_numeric(\$_access))"; + $query .= PHP_EOL . $this->_t(2) . "{"; + $query .= PHP_EOL . $this->_t(3) + . "\$query->where('a.access = ' . (int) \$_access);"; + $query .= PHP_EOL . $this->_t(2) . "}"; + $query .= PHP_EOL . $this->_t(2) . "elseif (" + . $Helper . "::checkArray(\$_access))"; + $query .= PHP_EOL . $this->_t(2) . "{"; + $query .= PHP_EOL . $this->_t(3) . "//" + . $this->setLine(__LINE__) + . " Secure the array for the query"; + $query .= PHP_EOL . $this->_t(3) + . "\$_access = ArrayHelper::toInteger(\$_access);"; + $query .= PHP_EOL . $this->_t(3) . "//" + . $this->setLine(__LINE__) . " Filter by the Access Array."; + $query .= PHP_EOL . $this->_t(3) + . "\$query->where('a.access IN (' . implode(',', \$_access) . ')');"; + $query .= PHP_EOL . $this->_t(2) . "}"; + } + // TODO the following will fight against the above access filter $query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Implement View Level Access"; $query .= PHP_EOL . $this->_t(2) @@ -14021,19 +14500,19 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(2) . "}"; } // add dynamic ordering (Linked view) - if (isset($this->viewsDefaultOrdering[$viewName_list]) - && $this->viewsDefaultOrdering[$viewName_list]['add_linked_ordering'] + if (isset($this->viewsDefaultOrdering[$nameListCode]) + && $this->viewsDefaultOrdering[$nameListCode]['add_linked_ordering'] == 1) { foreach ( - $this->viewsDefaultOrdering[$viewName_list]['linked_ordering_fields'] + $this->viewsDefaultOrdering[$nameListCode]['linked_ordering_fields'] as $order_field ) { if (($order_field_name = $this->getFieldDatabaseName( - $viewName_list, $order_field['field'] - // We Removed This 'listJoinBuilder' as targetArea - // we will keep an eye on this + $nameListCode, $order_field['field'] + // We Removed This 'listJoinBuilder' as targetArea + // we will keep an eye on this )) !== false) { // default ordering is by publish and ordering @@ -14043,7 +14522,8 @@ class Interpretation extends Fields ) . " Order the results by ordering"; $query .= PHP_EOL . $this->_t(2) . "\$query->order('" - . $order_field_name . " " . $order_field['direction'] . "');"; + . $order_field_name . " " . $order_field['direction'] + . "');"; } } } @@ -14068,13 +14548,13 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "\$items = \$db->loadObjectList();"; // add the fixing strings method $query .= $this->setGetItemsMethodStringFix( - $viewName_single, $viewName_list, + $nameSingleCode, $nameListCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(1) ); // add translations $query .= $this->setSelectionTranslationFix( - $viewName_list, + $nameListCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(1) ); @@ -14304,7 +14784,7 @@ class Interpretation extends Fields } // add custom php to getitems method after all $query .= $this->getCustomScriptBuilder( - 'php_getitems_after_all', $viewName_single, + 'php_getitems_after_all', $nameSingleCode, PHP_EOL . PHP_EOL . $this->_t(1) ); @@ -14314,7 +14794,7 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(1) . "}"; // SELECTIONTRANSLATIONFIXFUNC<<>> $query .= $this->setSelectionTranslationFixFunc( - $viewName_list, + $nameListCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] ); @@ -14328,21 +14808,21 @@ class Interpretation extends Fields } /** - * @param $viewName_list + * @param $nameListCode * * @return array|string */ - public function setCustomAdminDynamicButton($viewName_list) + public function setCustomAdminDynamicButton($nameListCode) { $buttons = ''; - if (isset($this->customAdminDynamicButtons[$viewName_list]) + if (isset($this->customAdminDynamicButtons[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->customAdminDynamicButtons[$viewName_list] + $this->customAdminDynamicButtons[$nameListCode] )) { $buttons = array(); foreach ( - $this->customAdminDynamicButtons[$viewName_list] as + $this->customAdminDynamicButtons[$nameListCode] as $custom_button ) { @@ -14360,7 +14840,7 @@ class Interpretation extends Fields $buttons[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " add " . $custom_button['name'] . " button."; $buttons[] = $this->_t(3) . "JToolBarHelper::custom('" - . $viewName_list . ".redirectTo" + . $nameListCode . ".redirectTo" . ComponentbuilderHelper::safeString( $custom_button['link'], 'F' ) . "', '" . $custom_button['icon'] . "', '', '" . $keyLang @@ -14377,21 +14857,21 @@ class Interpretation extends Fields } /** - * @param $viewName_list + * @param $nameListCode * * @return array|string */ - public function setCustomAdminDynamicButtonController($viewName_list) + public function setCustomAdminDynamicButtonController($nameListCode) { $method = ''; - if (isset($this->customAdminDynamicButtons[$viewName_list]) + if (isset($this->customAdminDynamicButtons[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->customAdminDynamicButtons[$viewName_list] + $this->customAdminDynamicButtons[$nameListCode] )) { $method = array(); foreach ( - $this->customAdminDynamicButtons[$viewName_list] as + $this->customAdminDynamicButtons[$nameListCode] as $custom_button ) { @@ -14422,7 +14902,8 @@ class Interpretation extends Fields . "\$pks = \$input->post->get('cid', array(), 'array');"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Sanitize the input"; - $method[] = $this->_t(3) . "ArrayHelper::toInteger(\$pks);"; + $method[] = $this->_t(3) + . "\$pks = ArrayHelper::toInteger(\$pks);"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " convert to string"; $method[] = $this->_t(3) . "\$ids = implode('_', \$pks);"; @@ -14439,7 +14920,7 @@ class Interpretation extends Fields . "_FAILED');"; $method[] = $this->_t(2) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName . "&view=" . $viewName_list + . $this->componentCodeName . "&view=" . $nameListCode . "', false), \$message, 'error');"; $method[] = $this->_t(2) . "return;"; $method[] = $this->_t(1) . "}"; @@ -14461,13 +14942,13 @@ class Interpretation extends Fields /** * A function that builds get Items Method for model * - * @param string $viewName_single The single view name - * @param string $viewName_list The list view name - * @param array $config The config details to adapt the method being build + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * @param array $config The config details to adapt the method being build * * @return string */ - public function setGetItemsModelMethod($viewName_single, $viewName_list, + public function setGetItemsModelMethod(&$nameSingleCode, &$nameListCode, $config = array('functionName' => 'getExportData', 'docDesc' => 'Method to get list export data.', @@ -14478,8 +14959,8 @@ class Interpretation extends Fields // check if this is the export method $isExport = ('export' === $config['type']); // check if this view has export feature, and or if this is not an export method - if ((isset($this->eximportView[$viewName_list]) - && $this->eximportView[$viewName_list]) + if ((isset($this->eximportView[$nameListCode]) + && $this->eximportView[$nameListCode]) || !$isExport) { $query = PHP_EOL . PHP_EOL . $this->_t(1) . "/**"; @@ -14500,7 +14981,8 @@ class Interpretation extends Fields . " setup the query"; $query .= PHP_EOL . $this->_t(2) . "if ((\$pks_size = " . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] . "Helper::checkArray(\$pks)) !== false || 'bulk' === \$pks)"; + . $this->hhh] + . "Helper::checkArray(\$pks)) !== false || 'bulk' === \$pks)"; $query .= PHP_EOL . $this->_t(2) . "{"; $query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Set a value to know this is " . $config['type'] @@ -14527,10 +15009,10 @@ class Interpretation extends Fields $query .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" . $this->setLine( __LINE__ ) . " From the " . $this->componentCodeName . "_" - . $viewName_single . " table"; + . $nameSingleCode . " table"; $query .= PHP_EOL . $this->_t(3) . "\$query->from(\$db->quoteName('#__" - . $this->componentCodeName . "_" . $viewName_single + . $this->componentCodeName . "_" . $nameSingleCode . "', 'a'));"; $query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " The bulk export path"; @@ -14567,7 +15049,7 @@ class Interpretation extends Fields . "}"; // add custom filtering php $query .= $this->getCustomScriptBuilder( - 'php_getlistquery', $viewName_single, + 'php_getlistquery', $nameSingleCode, PHP_EOL . PHP_EOL . $this->_t(1) ); // first check if we export of text only is avalable @@ -14583,7 +15065,7 @@ class Interpretation extends Fields . "')->get('export_text_only', 0);"; // first check if we have custom queries $custom_query = $this->setCustomQuery( - $viewName_list, $viewName_single, $this->_t(2), true + $nameListCode, $nameSingleCode, $this->_t(2), true ); } // if values were returned add the area @@ -14602,9 +15084,9 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "}"; } // add access levels if the view has access set - if (isset($this->accessBuilder[$viewName_single]) + if (isset($this->accessBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->accessBuilder[$viewName_single] + $this->accessBuilder[$nameSingleCode] )) { $query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine( @@ -14621,17 +15103,17 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "}"; } // add dynamic ordering (Exported data) - if (isset($this->viewsDefaultOrdering[$viewName_list]) - && $this->viewsDefaultOrdering[$viewName_list]['add_admin_ordering'] + if (isset($this->viewsDefaultOrdering[$nameListCode]) + && $this->viewsDefaultOrdering[$nameListCode]['add_admin_ordering'] == 1) { foreach ( - $this->viewsDefaultOrdering[$viewName_list]['admin_ordering_fields'] + $this->viewsDefaultOrdering[$nameListCode]['admin_ordering_fields'] as $order_field ) { if (($order_field_name = $this->getFieldDatabaseName( - $viewName_list, $order_field['field'] + $nameListCode, $order_field['field'] )) !== false) { $query .= PHP_EOL . PHP_EOL . $this->_t(3) . "//" @@ -14665,7 +15147,7 @@ class Interpretation extends Fields . "\$items = \$db->loadObjectList();"; // set the string fixing code $query .= $this->setGetItemsMethodStringFix( - $viewName_single, $viewName_list, + $nameSingleCode, $nameListCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(2), $isExport, true ); @@ -14673,7 +15155,7 @@ class Interpretation extends Fields if ($this->exportTextOnly) { $query_translations = $this->setSelectionTranslationFix( - $viewName_list, + $nameListCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh], $this->_t(3) ); @@ -14692,7 +15174,7 @@ class Interpretation extends Fields } // add custom php to getItems method after all $query .= $this->getCustomScriptBuilder( - 'php_getitems_after_all', $viewName_single, + 'php_getitems_after_all', $nameSingleCode, PHP_EOL . PHP_EOL . $this->_t(2) ); // in privacy export we must return array of arrays @@ -14716,7 +15198,7 @@ class Interpretation extends Fields // add getExImPortHeaders $query .= $this->getCustomScriptBuilder( - 'php_import_headers', 'import_' . $viewName_list, + 'php_import_headers', 'import_' . $nameListCode, PHP_EOL . PHP_EOL, null, true, // set a default script for those with no custom script PHP_EOL . PHP_EOL . $this->setPlaceholders( @@ -14729,11 +15211,12 @@ class Interpretation extends Fields return $query; } - public function setControllerEximportMethod($viewName_single, $viewName_list + public function setControllerEximportMethod($nameSingleCode, + $nameListCode ) { $method = ''; - if (isset($this->eximportView[$viewName_list]) - && $this->eximportView[$viewName_list]) + if (isset($this->eximportView[$nameListCode]) + && $this->eximportView[$nameListCode]) { $method = array(); @@ -14749,7 +15232,7 @@ class Interpretation extends Fields . " check if export is allowed for this user."; $method[] = $this->_t(2) . "\$user = JFactory::getUser();"; $method[] = $this->_t(2) . "if (\$user->authorise('" - . $viewName_single . ".export', 'com_" + . $nameSingleCode . ".export', 'com_" . $this->componentCodeName . "') && \$user->authorise('core.export', 'com_" . $this->componentCodeName . "'))"; @@ -14762,11 +15245,11 @@ class Interpretation extends Fields . "\$pks = \$input->post->get('cid', array(), 'array');"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Sanitize the input"; - $method[] = $this->_t(3) . "ArrayHelper::toInteger(\$pks);"; + $method[] = $this->_t(3) . "\$pks = ArrayHelper::toInteger(\$pks);"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the model"; $method[] = $this->_t(3) . "\$model = \$this->getModel('" - . ComponentbuilderHelper::safeString($viewName_list, 'F') + . ComponentbuilderHelper::safeString($nameListCode, 'F') . "');"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " get the data to export"; @@ -14781,11 +15264,11 @@ class Interpretation extends Fields $method[] = $this->_t(4) . "\$date = JFactory::getDate();"; $method[] = $this->_t(4) . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::xls(\$data,'" - . ComponentbuilderHelper::safeString($viewName_list, 'F') + . ComponentbuilderHelper::safeString($nameListCode, 'F') . "_'.\$date->format('jS_F_Y'),'" - . ComponentbuilderHelper::safeString($viewName_list, 'Ww') + . ComponentbuilderHelper::safeString($nameListCode, 'Ww') . " exported ('.\$date->format('jS F, Y').')','" - . ComponentbuilderHelper::safeString($viewName_list, 'w') + . ComponentbuilderHelper::safeString($nameListCode, 'w') . "');"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(2) . "}"; @@ -14795,7 +15278,7 @@ class Interpretation extends Fields . $this->langPrefix . "_EXPORT_FAILED');"; $method[] = $this->_t(2) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName . "&view=" . $viewName_list + . $this->componentCodeName . "&view=" . $nameListCode . "', false), \$message, 'error');"; $method[] = $this->_t(2) . "return;"; $method[] = $this->_t(1) . "}"; @@ -14812,7 +15295,7 @@ class Interpretation extends Fields . " check if import is allowed for this user."; $method[] = $this->_t(2) . "\$user = JFactory::getUser();"; $method[] = $this->_t(2) . "if (\$user->authorise('" - . $viewName_single . ".import', 'com_" + . $nameSingleCode . ".import', 'com_" . $this->componentCodeName . "') && \$user->authorise('core.import', 'com_" . $this->componentCodeName . "'))"; @@ -14820,7 +15303,7 @@ class Interpretation extends Fields $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Get the import model"; $method[] = $this->_t(3) . "\$model = \$this->getModel('" - . ComponentbuilderHelper::safeString($viewName_list, 'F') + . ComponentbuilderHelper::safeString($nameListCode, 'F') . "');"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " get the headers to import"; @@ -14834,33 +15317,33 @@ class Interpretation extends Fields . " Load headers to session."; $method[] = $this->_t(4) . "\$session = JFactory::getSession();"; $method[] = $this->_t(4) . "\$headers = json_encode(\$headers);"; - $method[] = $this->_t(4) . "\$session->set('" . $viewName_single + $method[] = $this->_t(4) . "\$session->set('" . $nameSingleCode . "_VDM_IMPORTHEADERS', \$headers);"; $method[] = $this->_t(4) . "\$session->set('backto_VDM_IMPORT', '" - . $viewName_list . "');"; + . $nameListCode . "');"; $method[] = $this->_t(4) . "\$session->set('dataType_VDM_IMPORTINTO', '" - . $viewName_single . "');"; + . $nameSingleCode . "');"; $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Redirect to import view."; // add to lang array $selectImportFileNote = $this->langPrefix . "_IMPORT_SELECT_FILE_FOR_" - . ComponentbuilderHelper::safeString($viewName_list, 'U'); + . ComponentbuilderHelper::safeString($nameListCode, 'U'); $this->setLangContent( $this->lang, $selectImportFileNote, - 'Select the file to import data to ' . $viewName_list . '.' + 'Select the file to import data to ' . $nameListCode . '.' ); $method[] = $this->_t(4) . "\$message = JText:" . ":_('" . $selectImportFileNote . "');"; // if this view has custom script it must have as custom import (model, veiw, controller) - if (isset($this->importCustomScripts[$viewName_list]) - && $this->importCustomScripts[$viewName_list]) + if (isset($this->importCustomScripts[$nameListCode]) + && $this->importCustomScripts[$nameListCode]) { $method[] = $this->_t(4) . "\$this->setRedirect(JRoute::_('index.php?option=com_" . $this->componentCodeName . "&view=import_" - . $viewName_list . "', false), \$message);"; + . $nameListCode . "', false), \$message);"; } else { @@ -14878,7 +15361,7 @@ class Interpretation extends Fields . $this->langPrefix . "_IMPORT_FAILED');"; $method[] = $this->_t(2) . "\$this->setRedirect(JRoute::_('index.php?option=com_" - . $this->componentCodeName . "&view=" . $viewName_list + . $this->componentCodeName . "&view=" . $nameListCode . "', false), \$message, 'error');"; $method[] = $this->_t(2) . "return;"; $method[] = $this->_t(1) . "}"; @@ -14889,11 +15372,11 @@ class Interpretation extends Fields return $method; } - public function setExportButton($viewName_single, $viewName_list) + public function setExportButton($nameSingleCode, $nameListCode) { $button = ''; - if (isset($this->eximportView[$viewName_list]) - && $this->eximportView[$viewName_list]) + if (isset($this->eximportView[$nameListCode]) + && $this->eximportView[$nameListCode]) { // main lang prefix $langExport = $this->langPrefix . '_' @@ -14903,10 +15386,10 @@ class Interpretation extends Fields $button = array(); $button[] = PHP_EOL . PHP_EOL . $this->_t(3) . "if (\$this->canDo->get('core.export') && \$this->canDo->get('" - . $viewName_single . ".export'))"; + . $nameSingleCode . ".export'))"; $button[] = $this->_t(3) . "{"; $button[] = $this->_t(4) . "JToolBarHelper::custom('" - . $viewName_list . ".exportData', 'download', '', '" + . $nameListCode . ".exportData', 'download', '', '" . $langExport . "', true);"; $button[] = $this->_t(3) . "}"; @@ -14916,11 +15399,11 @@ class Interpretation extends Fields return $button; } - public function setImportButton($viewName_single, $viewName_list) + public function setImportButton($nameSingleCode, $nameListCode) { $button = ''; - if (isset($this->eximportView[$viewName_list]) - && $this->eximportView[$viewName_list]) + if (isset($this->eximportView[$nameListCode]) + && $this->eximportView[$nameListCode]) { // main lang prefix $langImport = $this->langPrefix . '_' @@ -14930,10 +15413,11 @@ class Interpretation extends Fields $button = array(); $button[] = PHP_EOL . PHP_EOL . $this->_t(2) . "if (\$this->canDo->get('core.import') && \$this->canDo->get('" - . $viewName_single . ".import'))"; + . $nameSingleCode . ".import'))"; $button[] = $this->_t(2) . "{"; $button[] = $this->_t(3) . "JToolBarHelper::custom('" - . $viewName_list . ".importData', 'upload', '', '" . $langImport + . $nameListCode . ".importData', 'upload', '', '" + . $langImport . "', false);"; $button[] = $this->_t(2) . "}"; @@ -14943,95 +15427,95 @@ class Interpretation extends Fields return $button; } - public function setImportCustomScripts($viewName_list) + public function setImportCustomScripts($nameListCode) { // setup Ajax files - $target = array('admin' => 'import_' . $viewName_list); + $target = array('admin' => 'import_' . $nameListCode); $this->buildDynamique($target, 'customimport'); // load the custom script to the files // IMPORT_EXT_METHOD <<>> - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'IMPORT_EXT_METHOD' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_import_ext', 'import_' . $viewName_list, PHP_EOL, null, + 'php_import_ext', 'import_' . $nameListCode, PHP_EOL, null, true ); // IMPORT_DISPLAY_METHOD_CUSTOM <<>> - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'IMPORT_DISPLAY_METHOD_CUSTOM' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_import_display', 'import_' . $viewName_list, PHP_EOL, + 'php_import_display', 'import_' . $nameListCode, PHP_EOL, null, true ); // IMPORT_SETDATA_METHOD <<>> - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'IMPORT_SETDATA_METHOD' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_import_setdata', 'import_' . $viewName_list, PHP_EOL, + 'php_import_setdata', 'import_' . $nameListCode, PHP_EOL, null, true ); // IMPORT_METHOD_CUSTOM <<>> - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'IMPORT_METHOD_CUSTOM' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_import', 'import_' . $viewName_list, PHP_EOL, null, + 'php_import', 'import_' . $nameListCode, PHP_EOL, null, true ); // IMPORT_SAVE_METHOD <<>> - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'IMPORT_SAVE_METHOD' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_import_save', 'import_' . $viewName_list, PHP_EOL, + 'php_import_save', 'import_' . $nameListCode, PHP_EOL, null, true ); // IMPORT_DEFAULT_VIEW_CUSTOM <<>> - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'IMPORT_DEFAULT_VIEW_CUSTOM' . $this->hhh] = $this->getCustomScriptBuilder( - 'html_import_view', 'import_' . $viewName_list, PHP_EOL, + 'html_import_view', 'import_' . $nameListCode, PHP_EOL, null, true ); // insure we have the view placeholders setup - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'VIEW' . $this->hhh] = 'IMPORT_' . $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh]; - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'View' . $this->hhh] = 'Import_' . $this->placeholders[$this->hhh . 'views' . $this->hhh]; - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'view' . $this->hhh] = 'import_' . $this->placeholders[$this->hhh . 'views' . $this->hhh]; - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'VIEWS' . $this->hhh] = 'IMPORT_' . $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh]; - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'Views' . $this->hhh] = 'Import_' . $this->placeholders[$this->hhh . 'views' . $this->hhh]; - $this->fileContentDynamic['import_' . $viewName_list][$this->hhh + $this->fileContentDynamic['import_' . $nameListCode][$this->hhh . 'views' . $this->hhh] = 'import_' . $this->placeholders[$this->hhh . 'views' . $this->hhh]; } - public function setListQuery($viewName_single, $viewName_list) + public function setListQuery(&$nameSingleCode, &$nameListCode) { // check if this view has category added - if (isset($this->categoryBuilder[$viewName_list]) + if (isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->categoryBuilder[$viewName_list] + $this->categoryBuilder[$nameListCode] )) { - $categoryCodeName = $this->categoryBuilder[$viewName_list]['code']; + $categoryCodeName = $this->categoryBuilder[$nameListCode]['code']; $addCategory = true; } else @@ -15059,7 +15543,7 @@ class Interpretation extends Fields __LINE__ ) . " From the " . $this->componentCodeName . "_item table"; $query .= PHP_EOL . $this->_t(2) . "\$query->from(\$db->quoteName('#__" - . $this->componentCodeName . "_" . $viewName_single . "', 'a'));"; + . $this->componentCodeName . "_" . $nameSingleCode . "', 'a'));"; // add the category if ($addCategory) { @@ -15070,10 +15554,10 @@ class Interpretation extends Fields } // add custom filtering php $query .= $this->getCustomScriptBuilder( - 'php_getlistquery', $viewName_single, PHP_EOL . PHP_EOL + 'php_getlistquery', $nameSingleCode, PHP_EOL . PHP_EOL ); // add the custom fields query - $query .= $this->setCustomQuery($viewName_list, $viewName_single); + $query .= $this->setCustomQuery($nameListCode, $nameSingleCode); $query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ ) . " Filter by published state"; @@ -15089,9 +15573,9 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(3) . "\$query->where('(a.published = 0 OR a.published = 1)');"; $query .= PHP_EOL . $this->_t(2) . "}"; - if (isset($this->accessBuilder[$viewName_single]) + if (isset($this->accessBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->accessBuilder[$viewName_single] + $this->accessBuilder[$nameSingleCode] )) { $query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( @@ -15101,14 +15585,40 @@ class Interpretation extends Fields . "\$query->select('ag.title AS access_level');"; $query .= PHP_EOL . $this->_t(2) . "\$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');"; - $query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) - . " Filter by access level."; - $query .= PHP_EOL . $this->_t(2) - . "if (\$access = \$this->getState('filter.access'))"; - $query .= PHP_EOL . $this->_t(2) . "{"; - $query .= PHP_EOL . $this->_t(3) - . "\$query->where('a.access = ' . (int) \$access);"; - $query .= PHP_EOL . $this->_t(2) . "}"; + // check if the access field was over ridden + if (!isset($this->fieldsNames[$nameSingleCode]['access'])) + { + // component helper name + $Helper = $this->fileContentStatic[$this->hhh . 'Component' + . $this->hhh] . 'Helper'; + // load the access filter query code + $query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( + __LINE__ + ) + . " Filter by access level."; + $query .= PHP_EOL . $this->_t(2) + . "\$_access = \$this->getState('filter.access');"; + $query .= PHP_EOL . $this->_t(2) + . "if (\$_access && is_numeric(\$_access))"; + $query .= PHP_EOL . $this->_t(2) . "{"; + $query .= PHP_EOL . $this->_t(3) + . "\$query->where('a.access = ' . (int) \$_access);"; + $query .= PHP_EOL . $this->_t(2) . "}"; + $query .= PHP_EOL . $this->_t(2) . "elseif (" + . $Helper . "::checkArray(\$_access))"; + $query .= PHP_EOL . $this->_t(2) . "{"; + $query .= PHP_EOL . $this->_t(3) . "//" + . $this->setLine(__LINE__) + . " Secure the array for the query"; + $query .= PHP_EOL . $this->_t(3) + . "\$_access = ArrayHelper::toInteger(\$_access);"; + $query .= PHP_EOL . $this->_t(3) . "//" + . $this->setLine(__LINE__) . " Filter by the Access Array."; + $query .= PHP_EOL . $this->_t(3) + . "\$query->where('a.access IN (' . implode(',', \$_access) . ')');"; + $query .= PHP_EOL . $this->_t(2) . "}"; + } + // TODO the following will fight against the above access filter $query .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Implement View Level Access"; $query .= PHP_EOL . $this->_t(2) @@ -15122,9 +15632,9 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(2) . "}"; } // set the search query - $query .= $this->setSearchQuery($viewName_list); + $query .= $this->setSearchQuery($nameListCode); // set other filters - $query .= $this->setFilterQuery($viewName_list); + $query .= $this->setFilterQuery($nameListCode); // add the category if ($addCategory) { @@ -15153,30 +15663,30 @@ class Interpretation extends Fields . "elseif (is_array(\$categoryId))"; $query .= PHP_EOL . $this->_t(2) . "{"; $query .= PHP_EOL . $this->_t(3) - . "ArrayHelper::toInteger(\$categoryId);"; + . "\$categoryId = ArrayHelper::toInteger(\$categoryId);"; $query .= PHP_EOL . $this->_t(3) . "\$categoryId = implode(',', \$categoryId);"; $query .= PHP_EOL . $this->_t(3) - . "\$query->where('a.category IN (' . \$categoryId . ')');"; + . "\$query->where('a." . $categoryCodeName + . " IN (' . \$categoryId . ')');"; $query .= PHP_EOL . $this->_t(2) . "}"; $query .= PHP_EOL; } // setup values for the view ordering - // add dynamic ordering (Admin view) - if (isset($this->viewsDefaultOrdering[$viewName_list]) - && $this->viewsDefaultOrdering[$viewName_list]['add_admin_ordering'] + if (isset($this->viewsDefaultOrdering[$nameListCode]) + && $this->viewsDefaultOrdering[$nameListCode]['add_admin_ordering'] == 1) { // the first is from the state $order_first = true; foreach ( - $this->viewsDefaultOrdering[$viewName_list]['admin_ordering_fields'] + $this->viewsDefaultOrdering[$nameListCode]['admin_ordering_fields'] as $order_field ) { if (($order_field_name = $this->getFieldDatabaseName( - $viewName_list, $order_field['field'] + $nameListCode, $order_field['field'] )) !== false) { if ($order_first) @@ -15222,7 +15732,7 @@ class Interpretation extends Fields $query .= PHP_EOL . $this->_t(2) . "\$orderCol = \$this->state->get('list.ordering', 'a.id');"; $query .= PHP_EOL . $this->_t(2) - . "\$orderDirn = \$this->state->get('list.direction', 'asc');"; + . "\$orderDirn = \$this->state->get('list.direction', 'desc');"; $query .= PHP_EOL . $this->_t(2) . "if (\$orderCol != '')"; $query .= PHP_EOL . $this->_t(2) . "{"; $query .= PHP_EOL . $this->_t(3) @@ -15235,65 +15745,16 @@ class Interpretation extends Fields return $query; } - /** - * get the field database name and AS prefix - * - * @return string - * - */ - protected function getFieldDatabaseName($viewName_list, int $fieldId, $targetArea = 'listBuilder') + public function setSearchQuery($nameListCode) { - if (isset($this->{$targetArea}[$viewName_list])) - { - if ($fieldId < 0) - { - switch($fieldId) - { - case -1: - return 'a.id'; - case -2: - return 'a.ordering'; - case -3: - return 'a.published'; - } - } - foreach ($this->{$targetArea}[$viewName_list] as $field) - { - if ($field['id'] == $fieldId) - { - // now check if this is a category - if ($field['type'] === 'category') - { - return 'c.title'; - } - // set the custom code - elseif (ComponentbuilderHelper::checkArray( - $field['custom'] - )) - { - return $field['custom']['db'] . "." - . $field['custom']['text']; - } - else - { - return 'a.' . $field['code']; - } - } - } - } - return false; - } - - public function setSearchQuery($viewName_list) - { - if (isset($this->searchBuilder[$viewName_list]) + if (isset($this->searchBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->searchBuilder[$viewName_list] + $this->searchBuilder[$nameListCode] )) { // setup the searh options $search = "'("; - foreach ($this->searchBuilder[$viewName_list] as $nr => $array) + foreach ($this->searchBuilder[$nameListCode] as $nr => $array) { // array( 'type' => $typeName, 'code' => $name, 'custom' => $custom, 'list' => $field['list']); if ($nr == 0) @@ -15347,25 +15808,26 @@ class Interpretation extends Fields return ''; } - public function setCustomQuery($viewName_list, $viewName_single, $tab = '', + public function setCustomQuery($nameListCode, $nameSingleCode, + $tab = '', $just_text = false ) { - if (isset($this->customBuilder[$viewName_list]) + if (isset($this->customBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->customBuilder[$viewName_list] + $this->customBuilder[$nameListCode] )) { $query = ""; - foreach ($this->customBuilder[$viewName_list] as $filter) + foreach ($this->customBuilder[$nameListCode] as $filter) { // only load this if table is set - if ((isset($this->customBuilderList[$viewName_list]) + if ((isset($this->customBuilderList[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->customBuilderList[$viewName_list] + $this->customBuilderList[$nameListCode] ) && in_array( $filter['code'], - $this->customBuilderList[$viewName_list] + $this->customBuilderList[$nameListCode] ) && isset($filter['custom']['table']) && ComponentbuilderHelper::checkString( @@ -15414,7 +15876,7 @@ class Interpretation extends Fields } // build the field type file $this->setCustomFieldTypeFile( - $filter, $viewName_list, $viewName_single + $filter, $nameListCode, $nameSingleCode ); } @@ -15422,47 +15884,51 @@ class Interpretation extends Fields } } - public function setFilterQuery($viewName_list) + /** + * build model filter per/field in the list view + * + * @param string $nameListCode The list view name + * + * @return string The php to place in model to filter + * + */ + public function setFilterQuery($nameListCode) { - if (isset($this->filterBuilder[$viewName_list]) + if (isset($this->filterBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->filterBuilder[$viewName_list] + $this->filterBuilder[$nameListCode] )) { + // component helper name + $Helper = $this->fileContentStatic[$this->hhh . 'Component' + . $this->hhh] . 'Helper'; + // start building the filter query $filterQuery = ""; - foreach ($this->filterBuilder[$viewName_list] as $filter) + foreach ($this->filterBuilder[$nameListCode] as $filter) { - if ($filter['type'] != 'category' - && ComponentbuilderHelper::checkArray($filter['custom'])) + // only add for none category fields + if ($filter['type'] != 'category') { $filterQuery .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Filter by " - . $filter['code'] . "."; - $filterQuery .= PHP_EOL . $this->_t(2) . "if (\$" - . $filter['code'] . " = \$this->getState('filter." - . $filter['code'] . "'))"; - $filterQuery .= PHP_EOL . $this->_t(2) . "{"; - $filterQuery .= PHP_EOL . $this->_t(3) - . "\$query->where('a." . $filter['code'] - . " = ' . \$db->quote(\$db->escape(\$" . $filter['code'] - . ")));"; - $filterQuery .= PHP_EOL . $this->_t(2) . "}"; - } - elseif ($filter['type'] != 'category') - { - $filterQuery .= PHP_EOL . $this->_t(2) . "//" - . $this->setLine(__LINE__) . " Filter by " . ucwords( - $filter['code'] - ) . "."; - $filterQuery .= PHP_EOL . $this->_t(2) . "if (\$" - . $filter['code'] . " = \$this->getState('filter." - . $filter['code'] . "'))"; - $filterQuery .= PHP_EOL . $this->_t(2) . "{"; - $filterQuery .= PHP_EOL . $this->_t(3) - . "\$query->where('a." . $filter['code'] - . " = ' . \$db->quote(\$db->escape(\$" . $filter['code'] - . ")));"; - $filterQuery .= PHP_EOL . $this->_t(2) . "}"; + . ucwords($filter['code']) . "."; + // we only add multi filter option if new filter type + // and we have multi filter set for this field (2 = topbar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2 + && isset($filter['multi']) + && $filter['multi'] == 2) + { + $filterQuery .= $this->setMultiFilterQuery( + $filter, $Helper + ); + } + else + { + $filterQuery .= $this->setSingleFilterQuery( + $filter, $Helper + ); + } } } @@ -15472,12 +15938,135 @@ class Interpretation extends Fields return ''; } + /** + * build single filter query + * + * @param array $filter The field/filter + * @param string $Helper The helper name of the component being build + * @param string $a The db table target name (a) + * + * @return string The php to place in model to filter this field + * + */ + protected function setSingleFilterQuery($filter, $Helper, $a = "a") + { + $filterQuery = PHP_EOL . $this->_t(2) . "\$_" + . $filter['code'] . " = \$this->getState('filter." + . $filter['code'] . "');"; + $filterQuery .= PHP_EOL . $this->_t(2) . "if (is_numeric(\$_" + . $filter['code'] . "))"; + $filterQuery .= PHP_EOL . $this->_t(2) . "{"; + $filterQuery .= PHP_EOL . $this->_t(3) . "if (is_float(\$_" + . $filter['code'] . "))"; + $filterQuery .= PHP_EOL . $this->_t(3) . "{"; + $filterQuery .= PHP_EOL . $this->_t(4) + . "\$query->where('" . $a . "." . $filter['code'] + . " = ' . (float) \$_" . $filter['code'] . ");"; + $filterQuery .= PHP_EOL . $this->_t(3) . "}"; + $filterQuery .= PHP_EOL . $this->_t(3) . "else"; + $filterQuery .= PHP_EOL . $this->_t(3) . "{"; + $filterQuery .= PHP_EOL . $this->_t(4) + . "\$query->where('" . $a . "." . $filter['code'] + . " = ' . (int) \$_" . $filter['code'] . ");"; + $filterQuery .= PHP_EOL . $this->_t(3) . "}"; + $filterQuery .= PHP_EOL . $this->_t(2) . "}"; + $filterQuery .= PHP_EOL . $this->_t(2) . "elseif (" + . $Helper . "::checkString(\$_" . $filter['code'] . "))"; + $filterQuery .= PHP_EOL . $this->_t(2) . "{"; + $filterQuery .= PHP_EOL . $this->_t(3) + . "\$query->where('" . $a . "." . $filter['code'] + . " = ' . \$db->quote(\$db->escape(\$_" . $filter['code'] + . ")));"; + $filterQuery .= PHP_EOL . $this->_t(2) . "}"; + + return $filterQuery; + } + + /** + * build multiple filter query + * + * @param array $filter The field/filter + * @param string $Helper The helper name of the component being build + * @param string $a The db table target name (a) + * + * @return string The php to place in model to filter this field + * + */ + protected function setMultiFilterQuery($filter, $Helper, $a = "a") + { + $filterQuery = PHP_EOL . $this->_t(2) . "\$_" + . $filter['code'] . " = \$this->getState('filter." + . $filter['code'] . "');"; + $filterQuery .= PHP_EOL . $this->_t(2) . "if (is_numeric(\$_" + . $filter['code'] . "))"; + $filterQuery .= PHP_EOL . $this->_t(2) . "{"; + $filterQuery .= PHP_EOL . $this->_t(3) . "if (is_float(\$_" + . $filter['code'] . "))"; + $filterQuery .= PHP_EOL . $this->_t(3) . "{"; + $filterQuery .= PHP_EOL . $this->_t(4) + . "\$query->where('" . $a . "." . $filter['code'] + . " = ' . (float) \$_" . $filter['code'] . ");"; + $filterQuery .= PHP_EOL . $this->_t(3) . "}"; + $filterQuery .= PHP_EOL . $this->_t(3) . "else"; + $filterQuery .= PHP_EOL . $this->_t(3) . "{"; + $filterQuery .= PHP_EOL . $this->_t(4) + . "\$query->where('" . $a . "." . $filter['code'] + . " = ' . (int) \$_" . $filter['code'] . ");"; + $filterQuery .= PHP_EOL . $this->_t(3) . "}"; + $filterQuery .= PHP_EOL . $this->_t(2) . "}"; + $filterQuery .= PHP_EOL . $this->_t(2) . "elseif (" + . $Helper . "::checkString(\$_" . $filter['code'] . "))"; + $filterQuery .= PHP_EOL . $this->_t(2) . "{"; + $filterQuery .= PHP_EOL . $this->_t(3) + . "\$query->where('" . $a . "." . $filter['code'] + . " = ' . \$db->quote(\$db->escape(\$_" . $filter['code'] + . ")));"; + $filterQuery .= PHP_EOL . $this->_t(2) . "}"; + $filterQuery .= PHP_EOL . $this->_t(2) . "elseif (" + . $Helper . "::checkArray(\$_" . $filter['code'] . "))"; + $filterQuery .= PHP_EOL . $this->_t(2) . "{"; + + $filterQuery .= PHP_EOL . $this->_t(3) . "//" + . $this->setLine(__LINE__) . " Secure the array for the query"; + + $filterQuery .= PHP_EOL . $this->_t(3) . "\$_" . $filter['code'] + . " = array_map( function (\$val) use(&\$db) {"; + $filterQuery .= PHP_EOL . $this->_t(4) . "if (is_numeric(\$val))"; + $filterQuery .= PHP_EOL . $this->_t(4) . "{"; + $filterQuery .= PHP_EOL . $this->_t(5) . "if (is_float(\$val))"; + $filterQuery .= PHP_EOL . $this->_t(5) . "{"; + $filterQuery .= PHP_EOL . $this->_t(6) . "return (float) \$val;"; + $filterQuery .= PHP_EOL . $this->_t(5) . "}"; + $filterQuery .= PHP_EOL . $this->_t(5) . "else"; + $filterQuery .= PHP_EOL . $this->_t(5) . "{"; + $filterQuery .= PHP_EOL . $this->_t(6) . "return (int) \$val;"; + $filterQuery .= PHP_EOL . $this->_t(5) . "}"; + $filterQuery .= PHP_EOL . $this->_t(4) . "}"; + $filterQuery .= PHP_EOL . $this->_t(4) . "elseif (" + . $Helper . "::checkString(\$val))"; + $filterQuery .= PHP_EOL . $this->_t(4) . "{"; + $filterQuery .= PHP_EOL . $this->_t(5) + . "return \$db->quote(\$db->escape(\$val));"; + $filterQuery .= PHP_EOL . $this->_t(4) . "}"; + $filterQuery .= PHP_EOL . $this->_t(3) . "}, \$_" + . $filter['code'] . ");"; + + $filterQuery .= PHP_EOL . $this->_t(3) . "//" + . $this->setLine(__LINE__) . " Filter by the " + . ucwords($filter['code']) . " Array."; + + $filterQuery .= PHP_EOL . $this->_t(3) + . "\$query->where('" . $a . "." . $filter['code'] + . " IN (' . implode(',', \$_" . $filter['code'] . ") . ')');"; + $filterQuery .= PHP_EOL . $this->_t(2) . "}"; + + return $filterQuery; + } + public function buildTheViewScript($viewArray) { // set the view name - $viewName = ComponentbuilderHelper::safeString( - $viewArray['settings']->name_single - ); + $nameSingleCode = $viewArray['settings']->name_single_code; // add conditions to this view if (isset($viewArray['settings']->conditions) && ComponentbuilderHelper::checkArray( @@ -15513,7 +16102,7 @@ class Interpretation extends Fields // chain to other items of the same target $relations = $this->getTargetRelationScript( $viewArray['settings']->conditions, $condition, - $viewName + $nameSingleCode ); if (ComponentbuilderHelper::checkArray($relations)) { @@ -15552,7 +16141,7 @@ class Interpretation extends Fields = $this->setTargetControlsScript( $toggleSwitch[$matchName], $condition['target_field'], $targetBehavior, - $targetDefault, $uniqueVar, $viewName + $targetDefault, $uniqueVar, $nameSingleCode ); foreach ($relations as $relation) @@ -15627,7 +16216,7 @@ class Interpretation extends Fields = $this->setTargetControlsScript( $toggleSwitch[$matchName], $condition['target_field'], $targetBehavior, - $targetDefault, $uniqueVar, $viewName + $targetDefault, $uniqueVar, $nameSingleCode ); } } @@ -15888,9 +16477,9 @@ class Interpretation extends Fields . PHP_EOL . $map; } // add the needed validation to file - if (isset($this->validationFixBuilder[$viewName]) + if (isset($this->validationFixBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkArray( - $this->validationFixBuilder[$viewName] + $this->validationFixBuilder[$nameSingleCode] )) { $validation .= PHP_EOL . "// update fields required"; @@ -15971,16 +16560,16 @@ class Interpretation extends Fields $fileScript = ''; } $fileScript .= $this->getCustomScriptBuilder( - 'view_file', $viewName, PHP_EOL . PHP_EOL, null, true, '' + 'view_file', $nameSingleCode, PHP_EOL . PHP_EOL, null, true, '' ); // add custom script to footer - if (isset($this->customScriptBuilder['view_footer'][$viewName]) + if (isset($this->customScriptBuilder['view_footer'][$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->customScriptBuilder['view_footer'][$viewName] + $this->customScriptBuilder['view_footer'][$nameSingleCode] )) { $customFooterScript = PHP_EOL . PHP_EOL . $this->setPlaceholders( - $this->customScriptBuilder['view_footer'][$viewName], + $this->customScriptBuilder['view_footer'][$nameSingleCode], $this->placeholders ); if (strpos($customFooterScript, 'name_list - ); + $nameListCode = $viewArray['settings']->name_list_code; // add custom script to list view JS file if (($list_fileScript = $this->getCustomScriptBuilder( - 'views_file', $viewName, PHP_EOL . PHP_EOL, null, true, false + 'views_file', $nameSingleCode, PHP_EOL . PHP_EOL, null, true, + false )) !== false && ComponentbuilderHelper::checkString($list_fileScript)) { @@ -16008,7 +16596,7 @@ class Interpretation extends Fields $_created = $this->getCreatedDate($viewArray); $_modified = $this->getLastModifiedDate($viewArray); // add file to view - $_target = array($this->target => $viewName_list); + $_target = array($this->target => $nameListCode); $_config = array($this->hhh . 'CREATIONDATE' . $this->hhh => $_created, $this->hhh . 'BUILDDATE' @@ -16018,9 +16606,9 @@ class Interpretation extends Fields $this->buildDynamique($_target, 'javascript_file', false, $_config); // set path $_path = '/administrator/components/com_' . $this->componentCodeName - . '/assets/js/' . $viewName_list . '.js'; + . '/assets/js/' . $nameListCode . '.js'; // load the file to the list view - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_ADD_JAVASCRIPT_FILE' . $this->hhh] = PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ @@ -16030,7 +16618,7 @@ class Interpretation extends Fields else { $list_fileScript = ''; - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_ADD_JAVASCRIPT_FILE' . $this->hhh] = ''; } @@ -16068,7 +16656,7 @@ class Interpretation extends Fields )) { // load the script - $this->viewScriptBuilder[$viewName_list]['list_fileScript'] + $this->viewScriptBuilder[$nameListCode]['list_fileScript'] = $list_fileScript; } // make sure there is script to add @@ -16084,7 +16672,8 @@ class Interpretation extends Fields . PHP_EOL . $fileScript; } // load the script - $this->viewScriptBuilder[$viewName]['fileScript'] = $fileScript; + $this->viewScriptBuilder[$nameSingleCode]['fileScript'] + = $fileScript; } // make sure to add custom footer script if php was found in it, since we canot minfy it with php if (isset($customFooterScript) @@ -16105,10 +16694,11 @@ class Interpretation extends Fields )) { // add the needed script tags - $footerScript = PHP_EOL + $footerScript = PHP_EOL . PHP_EOL . '"; - $this->viewScriptBuilder[$viewName]['footerScript'] = $footerScript; + $this->viewScriptBuilder[$nameSingleCode]['footerScript'] + = $footerScript; } } @@ -16241,7 +16831,7 @@ class Interpretation extends Fields } public function setTargetControlsScript($toggleSwitch, $targets, - $targetBehavior, $targetDefault, $uniqueVar, $viewName + $targetBehavior, $targetDefault, $uniqueVar, $nameSingleCode ) { $bucket = array(); if (ComponentbuilderHelper::checkArray($targets) @@ -16414,7 +17004,7 @@ class Interpretation extends Fields $bucket[$target['name']]['show'] = $show; } // make sure that the axaj and other needed things for this view is loaded - $this->validationFixBuilder[$viewName][] + $this->validationFixBuilder[$nameSingleCode][] = $target['name']; } else @@ -16932,7 +17522,8 @@ class Interpretation extends Fields $fix .= PHP_EOL . $this->_t(1) . "{"; $fix .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " check if the not_required field is set"; - $fix .= PHP_EOL . $this->_t(2) . "if (isset(\$data['not_required']) && " . $Component + $fix .= PHP_EOL . $this->_t(2) + . "if (isset(\$data['not_required']) && " . $Component . "Helper::checkString(\$data['not_required']))"; $fix .= PHP_EOL . $this->_t(2) . "{"; $fix .= PHP_EOL . $this->_t(3) @@ -17166,28 +17757,50 @@ class Interpretation extends Fields return $methods; } - public function setFilterFunctions($viewName_single, $viewName_list) + /** + * build filter functions + * + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return string The php to place in view.html.php + * + */ + public function setFilterFieldHelper(&$nameSingleCode, &$nameListCode) { - if (isset($this->filterBuilder[$viewName_list]) + // the old filter type uses these functions + if (isset($this->filterBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->filterBuilder[$viewName_list] + $this->filterBuilder[$nameListCode] )) { + // set the function or file path (2 = topbar) + $funtion_path = true; + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + $funtion_path = false; + } $function = array(); // set component name $component = $this->componentCodeName; - foreach ($this->filterBuilder[$viewName_list] as $filter) + $Component = ucfirst($component); + foreach ($this->filterBuilder[$nameListCode] as $filter) { if ($filter['type'] != 'category' && ComponentbuilderHelper::checkArray($filter['custom']) && $filter['custom']['extends'] === 'user') { - $function[] = PHP_EOL . $this->_t(1) - . "protected function getThe" . $filter['function'] - . ComponentbuilderHelper::safeString( - $filter['custom']['text'], 'F' - ) . "Selections()"; - $function[] = $this->_t(1) . "{"; + // add if this is a function path + if ($funtion_path) + { + $function[] = PHP_EOL . $this->_t(1) + . "protected function getThe" . $filter['function'] + . ComponentbuilderHelper::safeString( + $filter['custom']['text'], 'F' + ) . "Selections()"; + $function[] = $this->_t(1) . "{"; + } $function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get a db connection."; $function[] = $this->_t(2) . "\$db = JFactory::getDbo();"; @@ -17226,22 +17839,31 @@ class Interpretation extends Fields $function[] = $this->_t(2) . "\$db->setQuery(\$query);"; $function[] = PHP_EOL . $this->_t(2) . "\$results = \$db->loadObjectList();"; + $function[] = $this->_t(2) . "\$_filter = array();"; + // if this is not a multi field + if (!$funtion_path && $filter['multi'] == 1) + { + $function[] = $this->_t(2) + . "\$_filter[] = JHtml::_('select.option', '', '- Select ' . JText:" + . ":_('" . $filter['lang'] . "') . ' -');"; + } $function[] = $this->_t(2) . "if (\$results)"; $function[] = $this->_t(2) . "{"; - $function[] = $this->_t(3) . "\$filter = array();"; - $function[] = $this->_t(3) . "\$batch = array();"; $function[] = $this->_t(3) . "foreach (\$results as \$result)"; $function[] = $this->_t(3) . "{"; $function[] = $this->_t(4) - . "\$filter[] = JHtml::_('select.option', \$result->" + . "\$_filter[] = JHtml::_('select.option', \$result->" . $filter['custom']['id'] . ", \$result->" . $filter['custom']['text'] . ");"; $function[] = $this->_t(3) . "}"; - $function[] = $this->_t(3) . "return \$filter;"; $function[] = $this->_t(2) . "}"; - $function[] = $this->_t(2) . "return false;"; - $function[] = $this->_t(1) . "}"; + $function[] = $this->_t(2) . "return \$_filter;"; + // add if this is a function path + if ($funtion_path) + { + $function[] = $this->_t(1) . "}"; + } /* else { @@ -17286,23 +17908,34 @@ class Interpretation extends Fields && !ComponentbuilderHelper::checkArray($filter['custom'])) { $translation = false; - if (isset($this->selectionTranslationFixBuilder[$viewName_list]) + if (isset($this->selectionTranslationFixBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->selectionTranslationFixBuilder[$viewName_list] + $this->selectionTranslationFixBuilder[$nameListCode] ) && array_key_exists( $filter['code'], - $this->selectionTranslationFixBuilder[$viewName_list] + $this->selectionTranslationFixBuilder[$nameListCode] )) { $translation = true; } - $function[] = PHP_EOL . $this->_t(1) - . "protected function getThe" . $filter['function'] - . "Selections()"; - $function[] = $this->_t(1) . "{"; - $function[] = $this->_t(2) . "//" . $this->setLine(__LINE__) - . " Get a db connection."; + // add if this is a function path + if ($funtion_path) + { + $function[] = PHP_EOL . $this->_t(1) + . "protected function getThe" . $filter['function'] + . "Selections()"; + $function[] = $this->_t(1) . "{"; + $function[] = $this->_t(2) . "//" . $this->setLine( + __LINE__ + ) + . " Get a db connection."; + } + else + { + $function[] = "//" . $this->setLine(__LINE__) + . " Get a db connection."; + } $function[] = $this->_t(2) . "\$db = JFactory::getDbo();"; $function[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -17358,12 +17991,19 @@ class Interpretation extends Fields $function[] = PHP_EOL . $this->_t(2) . "\$results = \$db->loadColumn();"; } - + $function[] = $this->_t(2) . "\$_filter = array();"; + // if this is not a multi field + if (!$funtion_path && $filter['multi'] == 1) + { + $function[] = $this->_t(2) + . "\$_filter[] = JHtml::_('select.option', '', '- ' . JText:" + . ":_('" . $filter['lang_select'] . "') . ' -');"; + } $function[] = PHP_EOL . $this->_t(2) . "if (\$results)"; $function[] = $this->_t(2) . "{"; // check if translated value is used - if ($translation) + if ($funtion_path && $translation) { $function[] = $this->_t(3) . "//" . $this->setLine( __LINE__ @@ -17371,18 +18011,25 @@ class Interpretation extends Fields $function[] = $this->_t(3) . "\$model = \$this->getModel();"; } + elseif ($translation) + { + $function[] = $this->_t(3) . "//" . $this->setLine( + __LINE__ + ) . " get " . $nameListCode . "model"; + $function[] = $this->_t(3) + . "\$model = " . $Component . "Helper::getModel('" + . $nameListCode . "');"; + } // check if usergroup as we change to an object query if ($filter['type'] !== 'usergroup') { $function[] = $this->_t(3) . "\$results = array_unique(\$results);"; } - $function[] = $this->_t(3) . "\$_filter = array();"; $function[] = $this->_t(3) . "foreach (\$results as \$" . $filter['code'] . ")"; $function[] = $this->_t(3) . "{"; - // check if translated value is used if ($translation) { @@ -17438,13 +18085,70 @@ class Interpretation extends Fields } } $function[] = $this->_t(3) . "}"; - $function[] = $this->_t(3) . "return \$_filter;"; $function[] = $this->_t(2) . "}"; - $function[] = $this->_t(2) . "return false;"; - $function[] = $this->_t(1) . "}"; + $function[] = $this->_t(2) . "return \$_filter;"; + // add if this is a function path + if ($funtion_path) + { + $function[] = $this->_t(1) . "}"; + } + } + // we check if this is a multi field + // and if there is a blank option + // and give a notice that this will cause an issue + elseif (!$funtion_path && $filter['type'] != 'category' + && $filter['multi'] == 2 + && ComponentbuilderHelper::checkArray($filter['custom'])) + { + // get the field code + $field_code = $this->getCustomFieldCode( + $filter['custom'] + )['JFORM_TYPE_PHP']; + // check for the [JHtml::_('select.option', '',] code + if (strpos($field_code, "JHtml::_('select.option', '',") + !== false + && strpos($field_code, '($this->multiple === false)') + === false) + { + // for now we just give an error message (don't fix it) + $this->app->enqueueMessage( + JText::_('

Multi Filter Error

'), + 'Error' + ); + $field_url + = "index.php?option=com_componentbuilder&view=fields&task=field.edit&id=" + . $filter['id']; + $field_fix + = "
if (\$this->multiple === false) { // <-- this if statement is needed";
+						$field_fix .= PHP_EOL . $this->_t(1)
+							. "\$options[] = JHtml::_('select.option', '', 'Select an option'); // <-- the empty option";
+						$field_fix .= PHP_EOL . "}
"; + $this->app->enqueueMessage( + JText::sprintf( + 'We detected that you have an empty option in a custom field (%s) that is used in a multi filter.
This will cause a problem, you will need to add the following code to it.
%s', + $field_url, + $filter['code'], + $field_fix + ), 'Error' + ); + } + } + // divert the code to a file if this is not a funtion path + if (!$funtion_path + && ComponentbuilderHelper::checkArray( + $function + )) + { + // set the filter file + $this->setFilterFieldFile( + implode(PHP_EOL, $function), $filter + ); + // clear the filter out + $function = array(); } } - if (ComponentbuilderHelper::checkArray($function)) + // if this is a function path, return the function if set + if ($funtion_path && ComponentbuilderHelper::checkArray($function)) { // return the function return PHP_EOL . implode(PHP_EOL, $function); @@ -17500,94 +18204,101 @@ class Interpretation extends Fields return implode(PHP_EOL, $fields); } - public function setOtherFilter(&$view) - { - if (isset($this->filterBuilder[$view]) - && ComponentbuilderHelper::checkArray($this->filterBuilder[$view])) + /** + * build sidebar filter loading scripts + * + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return string The php to place in view.html.php + * + */ + public function setFilterFieldSidebarDisplayHelper(&$nameSingleCode, + &$nameListCode + ) { + // start the filter bucket + $fieldFilters = array(); + // add the default filter + $this->setDefaultSidebarFilterHelper( + $fieldFilters, $nameSingleCode, $nameListCode + ); + // add the category filter stuff + $this->setCategorySidebarFilterHelper($fieldFilters, $nameListCode); + // check if filter fields are added (1 = sidebar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1 + && isset($this->filterBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->filterBuilder[$nameListCode] + )) { // get component name - $Component = $this->fileContentStatic[$this->hhh . 'Component' + $Component = $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh]; - $otherFilter = array(); - foreach ($this->filterBuilder[$view] as $filter) + // load the rest of the filters + foreach ($this->filterBuilder[$nameListCode] as $filter) { if ($filter['type'] != 'category' && ComponentbuilderHelper::checkArray($filter['custom']) && $filter['custom']['extends'] !== 'user') { - $CodeName = ComponentbuilderHelper::safeString( + $CodeName = ComponentbuilderHelper::safeString( $filter['code'] . ' ' . $filter['custom']['text'], 'W' ); - $codeName = $filter['code'] + $codeName = $filter['code'] . ComponentbuilderHelper::safeString( $filter['custom']['text'], 'F' ); - $type = ComponentbuilderHelper::safeString( + $type = ComponentbuilderHelper::safeString( $filter['custom']['type'], 'F' ); - $otherFilter[] = PHP_EOL . $this->_t(2) . "//" + $fieldFilters[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Set " . $CodeName . " Selection"; - $otherFilter[] = $this->_t(2) . "\$this->" . $codeName + $fieldFilters[] = $this->_t(2) . "\$this->" . $codeName . "Options = JFormHelper::loadFieldType('" . $type . "')->options;"; - $otherFilter[] = $this->_t(2) . "//" . $this->setLine( + $fieldFilters[] = $this->_t(2) . "//" . $this->setLine( __LINE__ ) . " We do some sanitation for " . $CodeName . " filter"; - $otherFilter[] = $this->_t(2) . "if (" . $Component + $fieldFilters[] = $this->_t(2) . "if (" . $Component . "Helper::checkArray(\$this->" . $codeName . "Options) &&"; - $otherFilter[] = $this->_t(3) . "isset(\$this->" . $codeName + $fieldFilters[] = $this->_t(3) . "isset(\$this->" + . $codeName . "Options[0]->value) &&"; - $otherFilter[] = $this->_t(3) . "!" . $Component + $fieldFilters[] = $this->_t(3) . "!" . $Component . "Helper::checkString(\$this->" . $codeName . "Options[0]->value))"; - $otherFilter[] = $this->_t(2) . "{"; - $otherFilter[] = $this->_t(3) . "unset(\$this->" . $codeName + $fieldFilters[] = $this->_t(2) . "{"; + $fieldFilters[] = $this->_t(3) . "unset(\$this->" + . $codeName . "Options[0]);"; - $otherFilter[] = $this->_t(2) . "}"; - $otherFilter[] = $this->_t(2) . "//" . $this->setLine( + $fieldFilters[] = $this->_t(2) . "}"; + $fieldFilters[] = $this->_t(2) . "//" . $this->setLine( __LINE__ ) . " Only load " . $CodeName . " filter if it has values"; - $otherFilter[] = $this->_t(2) . "if (" . $Component + $fieldFilters[] = $this->_t(2) . "if (" . $Component . "Helper::checkArray(\$this->" . $codeName . "Options))"; - $otherFilter[] = $this->_t(2) . "{"; - $otherFilter[] = $this->_t(3) . "//" . $this->setLine( + $fieldFilters[] = $this->_t(2) . "{"; + $fieldFilters[] = $this->_t(3) . "//" . $this->setLine( __LINE__ ) . " " . $CodeName . " Filter"; - $otherFilter[] = $this->_t(3) . "JHtmlSidebar::addFilter("; - $otherFilter[] = $this->_t(4) . "'- Select '.JText:" - . ":_('" . $filter['lang'] . "').' -',"; - $otherFilter[] = $this->_t(4) . "'filter_" . $filter['code'] + $fieldFilters[] = $this->_t(3) . "JHtmlSidebar::addFilter("; + $fieldFilters[] = $this->_t(4) . "'- Select ' . JText:" + . ":_('" . $filter['lang'] . "') . ' -',"; + $fieldFilters[] = $this->_t(4) . "'filter_" + . $filter['code'] . "',"; - $otherFilter[] = $this->_t(4) + $fieldFilters[] = $this->_t(4) . "JHtml::_('select.options', \$this->" . $codeName . "Options, 'value', 'text', \$this->state->get('filter." . $filter['code'] . "'))"; - $otherFilter[] = $this->_t(3) . ");"; - - $otherFilter[] = PHP_EOL . $this->_t(3) - . "if (\$this->canBatch && \$this->canCreate && \$this->canEdit)"; - $otherFilter[] = $this->_t(3) . "{"; - $otherFilter[] = $this->_t(4) . "//" . $this->setLine( - __LINE__ - ) . " " . $CodeName . " Batch Selection"; - $otherFilter[] = $this->_t(4) - . "JHtmlBatch_::addListSelection("; - $otherFilter[] = $this->_t(5) . "'- Keep Original '.JText:" - . ":_('" . $filter['lang'] . "').' -',"; - $otherFilter[] = $this->_t(5) . "'batch[" . $filter['code'] - . "]',"; - $otherFilter[] = $this->_t(5) - . "JHtml::_('select.options', \$this->" . $codeName - . "Options, 'value', 'text')"; - $otherFilter[] = $this->_t(4) . ");"; - $otherFilter[] = $this->_t(3) . "}"; - - $otherFilter[] = $this->_t(2) . "}"; + $fieldFilters[] = $this->_t(3) . ");"; + $fieldFilters[] = $this->_t(2) . "}"; } elseif ($filter['type'] != 'category') { @@ -17608,96 +18319,138 @@ class Interpretation extends Fields $functionName = "\$this->getThe" . $filter['function'] . "Selections();"; } - $otherFilter[] = PHP_EOL . $this->_t(2) . "//" + $fieldFilters[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Set " . $Codename . " Selection"; - $otherFilter[] = $this->_t(2) . "\$this->" . $filter['code'] + $fieldFilters[] = $this->_t(2) . "\$this->" + . $filter['code'] . "Options = " . $functionName; - $otherFilter[] = $this->_t(2) . "//" . $this->setLine( + $fieldFilters[] = $this->_t(2) . "//" . $this->setLine( __LINE__ ) . " We do some sanitation for " . $Codename . " filter"; - $otherFilter[] = $this->_t(2) . "if (" . $Component + $fieldFilters[] = $this->_t(2) . "if (" . $Component . "Helper::checkArray(\$this->" . $filter['code'] . "Options) &&"; - $otherFilter[] = $this->_t(3) . "isset(\$this->" + $fieldFilters[] = $this->_t(3) . "isset(\$this->" . $filter['code'] . "Options[0]->value) &&"; - $otherFilter[] = $this->_t(3) . "!" . $Component + $fieldFilters[] = $this->_t(3) . "!" . $Component . "Helper::checkString(\$this->" . $filter['code'] . "Options[0]->value))"; - $otherFilter[] = $this->_t(2) . "{"; - $otherFilter[] = $this->_t(3) . "unset(\$this->" + $fieldFilters[] = $this->_t(2) . "{"; + $fieldFilters[] = $this->_t(3) . "unset(\$this->" . $filter['code'] . "Options[0]);"; - $otherFilter[] = $this->_t(2) . "}"; - $otherFilter[] = $this->_t(2) . "//" . $this->setLine( + $fieldFilters[] = $this->_t(2) . "}"; + $fieldFilters[] = $this->_t(2) . "//" . $this->setLine( __LINE__ ) . " Only load " . $Codename . " filter if it has values"; - $otherFilter[] = $this->_t(2) . "if (" . $Component + $fieldFilters[] = $this->_t(2) . "if (" . $Component . "Helper::checkArray(\$this->" . $filter['code'] . "Options))"; - $otherFilter[] = $this->_t(2) . "{"; - $otherFilter[] = $this->_t(3) . "//" . $this->setLine( + $fieldFilters[] = $this->_t(2) . "{"; + $fieldFilters[] = $this->_t(3) . "//" . $this->setLine( __LINE__ ) . " " . $Codename . " Filter"; - $otherFilter[] = $this->_t(3) . "JHtmlSidebar::addFilter("; - $otherFilter[] = $this->_t(4) . "'- Select '.JText:" + $fieldFilters[] = $this->_t(3) . "JHtmlSidebar::addFilter("; + $fieldFilters[] = $this->_t(4) . "'- Select '.JText:" . ":_('" . $filter['lang'] . "').' -',"; - $otherFilter[] = $this->_t(4) . "'filter_" . $filter['code'] + $fieldFilters[] = $this->_t(4) . "'filter_" + . $filter['code'] . "',"; - $otherFilter[] = $this->_t(4) + $fieldFilters[] = $this->_t(4) . "JHtml::_('select.options', \$this->" . $filter['code'] . "Options, 'value', 'text', \$this->state->get('filter." . $filter['code'] . "'))"; - $otherFilter[] = $this->_t(3) . ");"; + $fieldFilters[] = $this->_t(3) . ");"; - $otherFilter[] = PHP_EOL . $this->_t(3) - . "if (\$this->canBatch && \$this->canCreate && \$this->canEdit)"; - $otherFilter[] = $this->_t(3) . "{"; - $otherFilter[] = $this->_t(4) . "//" . $this->setLine( - __LINE__ - ) . " " . $Codename . " Batch Selection"; - $otherFilter[] = $this->_t(4) - . "JHtmlBatch_::addListSelection("; - $otherFilter[] = $this->_t(5) . "'- Keep Original '.JText:" - . ":_('" . $filter['lang'] . "').' -',"; - $otherFilter[] = $this->_t(5) . "'batch[" . $filter['code'] - . "]',"; - $otherFilter[] = $this->_t(5) - . "JHtml::_('select.options', \$this->" - . $filter['code'] . "Options, 'value', 'text')"; - $otherFilter[] = $this->_t(4) . ");"; - $otherFilter[] = $this->_t(3) . "}"; - - $otherFilter[] = $this->_t(2) . "}"; + $fieldFilters[] = $this->_t(2) . "}"; } } - if (ComponentbuilderHelper::checkArray($otherFilter)) - { - // return the filter - return PHP_EOL . implode(PHP_EOL, $otherFilter); - } + } + // did we find filters + if (ComponentbuilderHelper::checkArray($fieldFilters)) + { + // return the filter + return PHP_EOL . implode(PHP_EOL, $fieldFilters); } return ''; } - public function setCategoryFilter($viewName_list) - { - if (isset($this->categoryBuilder[$viewName_list]) - && ComponentbuilderHelper::checkArray( - $this->categoryBuilder[$viewName_list] - ) - && isset($this->categoryBuilder[$viewName_list]['extension'])) + /** + * add default filter helper + * + * @param array $filter The batch code array + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return void + * + */ + protected function setDefaultSidebarFilterHelper(&$filter, &$nameSingleCode, + &$nameListCode + ) { + // add the default filters if we are on the old filter paths (1 = sidebar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1) + { + // set batch + $filter[] = PHP_EOL . $this->_t(2) + . "//" . $this->setLine(__LINE__) + . " Only load publish filter if state change is allowed"; + $filter[] = $this->_t(2) + . "if (\$this->canState)"; + $filter[] = $this->_t(2) . "{"; + $filter[] = $this->_t(3) . "JHtmlSidebar::addFilter("; + $filter[] = $this->_t(4) . "JText:" + . ":_('JOPTION_SELECT_PUBLISHED'),"; + $filter[] = $this->_t(4) . "'filter_published',"; + $filter[] = $this->_t(4) + . "JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', \$this->state->get('filter.published'), true)"; + $filter[] = $this->_t(3) . ");"; + $filter[] = $this->_t(2) . "}"; + // check if view has access + if (isset($this->accessBuilder[$nameSingleCode]) + && ComponentbuilderHelper::checkString( + $this->accessBuilder[$nameSingleCode] + ) + && !isset($this->fieldsNames[$nameSingleCode]['access'])) + { + $filter[] = PHP_EOL . $this->_t(2) . "JHtmlSidebar::addFilter("; + $filter[] = $this->_t(3) . "JText:" + . ":_('JOPTION_SELECT_ACCESS'),"; + $filter[] = $this->_t(3) . "'filter_access',"; + $filter[] = $this->_t(3) + . "JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', \$this->state->get('filter.access'))"; + $filter[] = $this->_t(2) . ");"; + } + } + } + + /** + * build category sidebar display filter helper + * + * @param array $filter The filter code array + * @param string $nameListCode The list view name + * + * @return void + * + */ + protected function setCategorySidebarFilterHelper(&$filter, &$nameListCode) + { + // add the category filter if we are on the old filter paths (1 = sidebar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1 + && isset($this->categoryBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->categoryBuilder[$nameListCode] + ) + && isset($this->categoryBuilder[$nameListCode]['extension'])) { - // set component name - $COPMONENT = ComponentbuilderHelper::safeString( - $this->componentData->name_code, 'U' - ); // set filter - $filter = array(); - $filter[] = PHP_EOL . PHP_EOL . $this->_t(2) . "//" + $filter[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Category Filter."; $filter[] = $this->_t(2) . "JHtmlSidebar::addFilter("; $filter[] = $this->_t(3) . "JText:" @@ -17705,43 +18458,284 @@ class Interpretation extends Fields $filter[] = $this->_t(3) . "'filter_category_id',"; $filter[] = $this->_t(3) . "JHtml::_('select.options', JHtml::_('category.options', '" - . $this->categoryBuilder[$viewName_list]['extension'] + . $this->categoryBuilder[$nameListCode]['extension'] . "'), 'value', 'text', \$this->state->get('filter.category_id'))"; $filter[] = $this->_t(2) . ");"; + } + } + /** + * build batch loading helper scripts + * + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return string The php to place in view.html.php + * + */ + public function setBatchDisplayHelper(&$nameSingleCode, &$nameListCode) + { + // start the batch bucket + $fieldBatch = array(); + // add the default batch + $this->setDefaultBatchHelper($fieldBatch, $nameSingleCode); + // add the category filter stuff + $this->setCategoryBatchHelper($fieldBatch, $nameListCode); + // check if we have other batch options to add + if (isset($this->filterBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->filterBuilder[$nameListCode] + )) + { + // check if we should add some help to get the values (2 = topbar) + $get_values = false; + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + // since the old path is not used, we need to add those values here + $get_values = true; + } + // get component name + $Component = $this->fileContentStatic[$this->hhh . 'Component' + . $this->hhh]; + // load the rest of the batch options + foreach ($this->filterBuilder[$nameListCode] as $filter) + { + if ($filter['type'] != 'category' + && ComponentbuilderHelper::checkArray($filter['custom']) + && $filter['custom']['extends'] !== 'user') + { + $CodeName = ComponentbuilderHelper::safeString( + $filter['code'] . ' ' . $filter['custom']['text'], 'W' + ); + $codeName = $filter['code'] + . ComponentbuilderHelper::safeString( + $filter['custom']['text'], 'F' + ); + $fieldBatch[] = PHP_EOL . $this->_t(2) + . "//" . $this->setLine(__LINE__) + . " Only load " . $CodeName + . " batch if create, edit, and batch is allowed"; + $fieldBatch[] = $this->_t(2) + . "if (\$this->canBatch && \$this->canCreate && \$this->canEdit)"; + $fieldBatch[] = $this->_t(2) . "{"; + // add the get values here + if ($get_values) + { + $type = ComponentbuilderHelper::safeString( + $filter['custom']['type'], 'F' + ); + $fieldBatch[] = $this->_t(3) . "//" + . $this->setLine(__LINE__) . " Set " . $CodeName + . " Selection"; + $fieldBatch[] = $this->_t(3) . "\$this->" . $codeName + . "Options = JFormHelper::loadFieldType('" . $type + . "')->options;"; + $fieldBatch[] = $this->_t(3) . "//" . $this->setLine( + __LINE__ + ) . " We do some sanitation for " . $CodeName + . " filter"; + $fieldBatch[] = $this->_t(3) . "if (" . $Component + . "Helper::checkArray(\$this->" . $codeName + . "Options) &&"; + $fieldBatch[] = $this->_t(4) . "isset(\$this->" + . $codeName + . "Options[0]->value) &&"; + $fieldBatch[] = $this->_t(4) . "!" . $Component + . "Helper::checkString(\$this->" . $codeName + . "Options[0]->value))"; + $fieldBatch[] = $this->_t(3) . "{"; + $fieldBatch[] = $this->_t(4) . "unset(\$this->" + . $codeName + . "Options[0]);"; + $fieldBatch[] = $this->_t(3) . "}"; + } + $fieldBatch[] = $this->_t(3) . "//" . $this->setLine( + __LINE__ + ) . " " . $CodeName . " Batch Selection"; + $fieldBatch[] = $this->_t(3) + . "JHtmlBatch_::addListSelection("; + $fieldBatch[] = $this->_t(4) . "'- Keep Original '.JText:" + . ":_('" . $filter['lang'] . "').' -',"; + $fieldBatch[] = $this->_t(4) . "'batch[" . $filter['code'] + . "]',"; + $fieldBatch[] = $this->_t(4) + . "JHtml::_('select.options', \$this->" . $codeName + . "Options, 'value', 'text')"; + $fieldBatch[] = $this->_t(3) . ");"; + $fieldBatch[] = $this->_t(2) . "}"; + } + elseif ($filter['type'] != 'category') + { + $CodeName = ComponentbuilderHelper::safeString( + $filter['code'], 'W' + ); - $filter[] = PHP_EOL . $this->_t(2) - . "if (\$this->canBatch && \$this->canCreate && \$this->canEdit)"; - $filter[] = $this->_t(2) . "{"; - $filter[] = $this->_t(3) . "//" . $this->setLine(__LINE__) - . " Category Batch selection."; - $filter[] = $this->_t(3) . "JHtmlBatch_::addListSelection("; - $filter[] = $this->_t(4) . "JText:" . ":_('COM_" . $COPMONENT - . "_KEEP_ORIGINAL_CATEGORY'),"; - $filter[] = $this->_t(4) . "'batch[category]',"; - $filter[] = $this->_t(4) - . "JHtml::_('select.options', JHtml::_('category.options', '" - . $this->categoryBuilder[$viewName_list]['extension'] - . "'), 'value', 'text')"; - $filter[] = $this->_t(3) . ");"; - $filter[] = $this->_t(2) . "}"; - - // return the filter - return implode(PHP_EOL, $filter); + $fieldBatch[] = PHP_EOL . $this->_t(2) + . "//" . $this->setLine(__LINE__) + . " Only load " . $CodeName + . " batch if create, edit, and batch is allowed"; + $fieldBatch[] = $this->_t(2) + . "if (\$this->canBatch && \$this->canCreate && \$this->canEdit)"; + $fieldBatch[] = $this->_t(2) . "{"; + // add the get values here + if ($get_values) + { + $fieldBatch[] = $this->_t(3) . "//" + . $this->setLine(__LINE__) . " Set " . $CodeName + . " Selection"; + $fieldBatch[] = $this->_t(3) . "\$this->" + . $filter['code'] + . "Options = JFormHelper::loadFieldType('" + . $filter['filter_type'] + . "')->options;"; + $fieldBatch[] = $this->_t(3) . "//" . $this->setLine( + __LINE__ + ) . " We do some sanitation for " . $CodeName + . " filter"; + $fieldBatch[] = $this->_t(3) . "if (" . $Component + . "Helper::checkArray(\$this->" . $filter['code'] + . "Options) &&"; + $fieldBatch[] = $this->_t(4) . "isset(\$this->" + . $filter['code'] . "Options[0]->value) &&"; + $fieldBatch[] = $this->_t(4) . "!" . $Component + . "Helper::checkString(\$this->" . $filter['code'] + . "Options[0]->value))"; + $fieldBatch[] = $this->_t(3) . "{"; + $fieldBatch[] = $this->_t(4) . "unset(\$this->" + . $filter['code'] . "Options[0]);"; + $fieldBatch[] = $this->_t(3) . "}"; + } + $fieldBatch[] = $this->_t(3) . "//" . $this->setLine( + __LINE__ + ) . " " . $CodeName . " Batch Selection"; + $fieldBatch[] = $this->_t(3) + . "JHtmlBatch_::addListSelection("; + $fieldBatch[] = $this->_t(4) . "'- Keep Original '.JText:" + . ":_('" . $filter['lang'] . "').' -',"; + $fieldBatch[] = $this->_t(4) . "'batch[" . $filter['code'] + . "]',"; + $fieldBatch[] = $this->_t(4) + . "JHtml::_('select.options', \$this->" + . $filter['code'] . "Options, 'value', 'text')"; + $fieldBatch[] = $this->_t(3) . ");"; + $fieldBatch[] = $this->_t(2) . "}"; + } + } + } + // did we find batch options + if (ComponentbuilderHelper::checkArray($fieldBatch)) + { + // return the batch + return PHP_EOL . implode(PHP_EOL, $fieldBatch); } return ''; } - public function setRouterCategoryViews($viewName_single, $viewName_list) + /** + * add default batch helper + * + * @param array $batch The batch code array + * @param string $nameSingleCode The single view name + * + * @return void + * + */ + protected function setDefaultBatchHelper(&$batch, &$nameSingleCode) { - if (isset($this->categoryBuilder[$viewName_list]) + // set component name + $COPMONENT = ComponentbuilderHelper::safeString( + $this->componentData->name_code, 'U' + ); + // set batch + $batch[] = PHP_EOL . $this->_t(2) + . "//" . $this->setLine(__LINE__) + . " Only load published batch if state and batch is allowed"; + $batch[] = $this->_t(2) + . "if (\$this->canState && \$this->canBatch)"; + $batch[] = $this->_t(2) . "{"; + $batch[] = $this->_t(3) . "JHtmlBatch_::addListSelection("; + $batch[] = $this->_t(4) . "JText:" . ":_('COM_" . $COPMONENT + . "_KEEP_ORIGINAL_STATE'),"; + $batch[] = $this->_t(4) . "'batch[published]',"; + $batch[] = $this->_t(4) + . "JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)"; + $batch[] = $this->_t(3) . ");"; + $batch[] = $this->_t(2) . "}"; + // check if view has access + if (isset($this->accessBuilder[$nameSingleCode]) + && ComponentbuilderHelper::checkString( + $this->accessBuilder[$nameSingleCode] + ) + && !isset($this->fieldsNames[$nameSingleCode]['access'])) + { + $batch[] = PHP_EOL . $this->_t(2) + . "//" . $this->setLine(__LINE__) + . " Only load access batch if create, edit and batch is allowed"; + $batch[] = $this->_t(2) + . "if (\$this->canBatch && \$this->canCreate && \$this->canEdit)"; + $batch[] = $this->_t(2) . "{"; + $batch[] = $this->_t(3) . "JHtmlBatch_::addListSelection("; + $batch[] = $this->_t(4) . "JText:" . ":_('COM_" . $COPMONENT + . "_KEEP_ORIGINAL_ACCESS'),"; + $batch[] = $this->_t(4) . "'batch[access]',"; + $batch[] = $this->_t(4) + . "JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')"; + $batch[] = $this->_t(3) . ");"; + $batch[] = $this->_t(2) . "}"; + } + } + + /** + * build category batch helper + * + * @param array $batch The batch code array + * @param string $nameListCode The list view name + * + * @return mixed The php to place in view.html.php + * + */ + protected function setCategoryBatchHelper(&$batch, &$nameListCode) + { + if (isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->categoryBuilder[$viewName_list] + $this->categoryBuilder[$nameListCode] + ) + && isset($this->categoryBuilder[$nameListCode]['extension'])) + { + // set component name + $COPMONENT = ComponentbuilderHelper::safeString( + $this->componentData->name_code, 'U' + ); + // set filter + $batch[] = PHP_EOL . $this->_t(2) + . "if (\$this->canBatch && \$this->canCreate && \$this->canEdit)"; + $batch[] = $this->_t(2) . "{"; + $batch[] = $this->_t(3) . "//" . $this->setLine(__LINE__) + . " Category Batch selection."; + $batch[] = $this->_t(3) . "JHtmlBatch_::addListSelection("; + $batch[] = $this->_t(4) . "JText:" . ":_('COM_" . $COPMONENT + . "_KEEP_ORIGINAL_CATEGORY'),"; + $batch[] = $this->_t(4) . "'batch[category]',"; + $batch[] = $this->_t(4) + . "JHtml::_('select.options', JHtml::_('category.options', '" + . $this->categoryBuilder[$nameListCode]['extension'] + . "'), 'value', 'text')"; + $batch[] = $this->_t(3) . ");"; + $batch[] = $this->_t(2) . "}"; + } + } + + public function setRouterCategoryViews($nameSingleCode, $nameListCode) + { + if (isset($this->categoryBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->categoryBuilder[$nameListCode] )) { // get the actual extention - $_extension = $this->categoryBuilder[$viewName_list]['extension']; + $_extension = $this->categoryBuilder[$nameListCode]['extension']; $_extension = explode('.', $_extension); // set component name if (ComponentbuilderHelper::checkArray($_extension)) @@ -17753,18 +18747,18 @@ class Interpretation extends Fields $component = $this->componentCodeName; } // check if category has another name - if (isset($this->catOtherName[$viewName_list]) + if (isset($this->catOtherName[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->catOtherName[$viewName_list] + $this->catOtherName[$nameListCode] )) { - $otherViews = $this->catOtherName[$viewName_list]['views']; - $otherView = $this->catOtherName[$viewName_list]['view']; + $otherViews = $this->catOtherName[$nameListCode]['views']; + $otherView = $this->catOtherName[$nameListCode]['view']; } else { - $otherViews = $viewName_list; - $otherView = $viewName_single; + $otherViews = $nameListCode; + $otherView = $nameSingleCode; } // set the OtherView value $this->fileContentDynamic['category' . $otherView][$this->hhh @@ -17823,13 +18817,13 @@ class Interpretation extends Fields )) { return "," . PHP_EOL . $this->_t(3) . '"' - . $this->categoryBuilder[$viewName_list]['extension'] + . $this->categoryBuilder[$nameListCode]['extension'] . '" => "' . $otherView . '"'; } else { return PHP_EOL . $this->_t(3) . '"' - . $this->categoryBuilder[$viewName_list]['extension'] + . $this->categoryBuilder[$nameListCode]['extension'] . '" => "' . $otherView . '"'; } } @@ -17837,38 +18831,38 @@ class Interpretation extends Fields return ''; } - public function setJcontrollerAllowAdd($viewName_single, $viewName_list) + public function setJcontrollerAllowAdd($nameSingleCode, $nameListCode) { $allow = array(); // set component name $component = $this->componentCodeName; // prepare custom permission script $customAllow = $this->getCustomScriptBuilder( - 'php_allowadd', $viewName_single, '', null, true + 'php_allowadd', $nameSingleCode, '', null, true ); // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // check if item has category - if (0) //isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list])) <-- remove category from check + if (0) //isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameListCode])) <-- remove category from check { // check if category has another name - if ($coreLoad && isset($this->catOtherName[$viewName_list]) + if ($coreLoad && isset($this->catOtherName[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->catOtherName[$viewName_list] + $this->catOtherName[$nameListCode] )) { - $otherViews = $this->catOtherName[$viewName_list]['views']; - $otherView = $this->catOtherName[$viewName_list]['view']; + $otherViews = $this->catOtherName[$nameListCode]['views']; + $otherView = $this->catOtherName[$nameListCode]['view']; } else { - $otherViews = $viewName_list; - $otherView = $viewName_single; + $otherViews = $nameListCode; + $otherView = $nameSingleCode; } // setup the category script $allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -17915,7 +18909,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -17950,7 +18944,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.access']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.access']] )) { @@ -17972,7 +18966,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -17994,40 +18988,40 @@ class Interpretation extends Fields return implode(PHP_EOL, $allow); } - public function setJcontrollerAllowEdit($viewName_single, $viewName_list) + public function setJcontrollerAllowEdit($nameSingleCode, $nameListCode) { $allow = array(); // set component name $component = $this->componentCodeName; // prepare custom permission script $customAllow = $this->getCustomScriptBuilder( - 'php_allowedit', $viewName_single, '', null, true + 'php_allowedit', $nameSingleCode, '', null, true ); // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } - if (isset($this->categoryBuilder[$viewName_list]) + if (isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->categoryBuilder[$viewName_list] + $this->categoryBuilder[$nameListCode] )) { // check if category has another name - if ($coreLoad && isset($this->catOtherName[$viewName_list]) + if ($coreLoad && isset($this->catOtherName[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->catOtherName[$viewName_list] + $this->catOtherName[$nameListCode] )) { - $otherViews = $this->catOtherName[$viewName_list]['views']; - $otherView = $this->catOtherName[$viewName_list]['view']; + $otherViews = $this->catOtherName[$nameListCode]['views']; + $otherView = $this->catOtherName[$nameListCode]['view']; } else { - $otherViews = $viewName_list; - $otherView = $viewName_single; + $otherViews = $nameListCode; + $otherView = $nameSingleCode; } // setup the category script $allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -18210,7 +19204,7 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.access']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.access']] )) { @@ -18219,7 +19213,7 @@ class Interpretation extends Fields ) . " Access check."; $allow[] = $this->_t(2) . "\$access = (\$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "." - . $viewName_single + . $nameSingleCode . ".' . (int) \$recordId) && \$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "'));"; $allow[] = $this->_t(2) . "if (!\$access)"; @@ -18238,19 +19232,19 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit']] )) { $allow[] = $this->_t(3) . "\$permission = \$user->authorise('" . $core['core.edit'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$recordId);"; + . $nameSingleCode . ".' . (int) \$recordId);"; } else { $allow[] = $this->_t(3) . "\$permission = \$user->authorise('core.edit', 'com_" - . $component . "." . $viewName_single + . $component . "." . $nameSingleCode . ".' . (int) \$recordId);"; } $allow[] = $this->_t(3) . "if (!\$permission)"; @@ -18262,19 +19256,20 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.own']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.own']] )) { $allow[] = $this->_t(4) . "if (\$user->authorise('" . $core['core.edit.own'] . "', 'com_" . $component . "." - . $viewName_single . ".' . \$recordId))"; + . $nameSingleCode . ".' . \$recordId))"; } else { $allow[] = $this->_t(4) . "if (\$user->authorise('core.edit.own', 'com_" - . $component . "." . $viewName_single . ".' . \$recordId))"; + . $component . "." . $nameSingleCode + . ".' . \$recordId))"; } $allow[] = $this->_t(4) . "{"; $allow[] = $this->_t(5) . "//" . $this->setLine(__LINE__) @@ -18304,7 +19299,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit.own']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit.own']] )) { @@ -18331,7 +19326,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit']] )) { @@ -18352,7 +19347,7 @@ class Interpretation extends Fields return implode(PHP_EOL, $allow); } - public function setJmodelAdminGetForm($viewName_single, $viewName_list) + public function setJmodelAdminGetForm($nameSingleCode, $nameListCode) { // set component name $component = $this->componentCodeName; @@ -18377,7 +19372,7 @@ class Interpretation extends Fields $getForm[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the form."; $getForm[] = $this->_t(2) . "\$form = \$this->loadForm('com_" - . $component . "." . $viewName_single . "', '" . $viewName_single + . $component . "." . $nameSingleCode . "', '" . $nameSingleCode . "', \$options, \$clear, \$xpath);"; $getForm[] = PHP_EOL . $this->_t(2) . "if (empty(\$form))"; $getForm[] = $this->_t(2) . "{"; @@ -18387,37 +19382,37 @@ class Interpretation extends Fields if ($this->componentData->add_license && $this->componentData->license_type == 3 && isset( - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'BOOLMETHOD' . $this->hhh] )) { $getForm[] = $this->checkStatmentLicenseLocked( - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'BOOLMETHOD' . $this->hhh] ); } // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } - if (0) //isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list])) <-- remove category from check + if (0) //isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameListCode])) <-- remove category from check { // check if category has another name - if ($coreLoad && isset($this->catOtherName[$viewName_list]) + if ($coreLoad && isset($this->catOtherName[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->catOtherName[$viewName_list] + $this->catOtherName[$nameListCode] )) { - $otherViews = $this->catOtherName[$viewName_list]['views']; - $otherView = $this->catOtherName[$viewName_list]['view']; + $otherViews = $this->catOtherName[$nameListCode]['views']; + $otherView = $this->catOtherName[$nameListCode]['view']; } else { - $otherViews = $viewName_list; - $otherView = $viewName_single; + $otherViews = $nameListCode; + $otherView = $nameSingleCode; } // setup the category script $getForm[] = PHP_EOL . $this->_t(2) @@ -18440,10 +19435,10 @@ class Interpretation extends Fields $getForm[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Determine correct permissions to check."; $getForm[] = $this->_t(2) . "if (\$this->getState('" - . $viewName_single . ".id'))"; + . $nameSingleCode . ".id'))"; $getForm[] = $this->_t(2) . "{"; $getForm[] = $this->_t(3) . "\$id = \$this->getState('" - . $viewName_single . ".id');"; + . $nameSingleCode . ".id');"; $getForm[] = PHP_EOL . $this->_t(3) . "\$catid = 0;"; $getForm[] = $this->_t(3) . "if (isset(\$this->getItem(\$id)->catid))"; @@ -18480,7 +19475,7 @@ class Interpretation extends Fields $getForm[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Modify the form based on Edit State access controls."; // get the other view - $otherView = $this->catCodeBuilder[$viewName_single]['view']; + $otherView = $this->catCodeBuilder[$nameSingleCode]['view']; // check if the item has permissions. if ($coreLoad && isset($core['core.edit.state']) && isset($this->permissionBuilder[$core['core.edit.state']]) @@ -18488,14 +19483,14 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.state']] )) { $getForm[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $core['core.edit.state'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".' . (int) \$id))"; $getForm[] = $this->_t(3) . "|| (isset(\$catid) && \$catid != 0 && !\$user->authorise('core.edit.state', 'com_" . $component . "." . $otherView @@ -18509,7 +19504,8 @@ class Interpretation extends Fields { $getForm[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('core.edit.state', 'com_" - . $component . "." . $viewName_single . ".' . (int) \$id))"; + . $component . "." . $nameSingleCode + . ".' . (int) \$id))"; $getForm[] = $this->_t(3) . "|| (isset(\$catid) && \$catid != 0 && !\$user->authorise('core.edit.state', 'com_" . $component . "." . $otherView @@ -18567,14 +19563,14 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.state']] )) { $getForm[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $core['core.edit.state'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".' . (int) \$id))"; $getForm[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" . $core['core.edit.state'] . "', 'com_" . $component @@ -18584,7 +19580,8 @@ class Interpretation extends Fields { $getForm[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('core.edit.state', 'com_" - . $component . "." . $viewName_single . ".' . (int) \$id))"; + . $component . "." . $nameSingleCode + . ".' . (int) \$id))"; $getForm[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('core.edit.state', 'com_" . $component . "')))"; @@ -18622,13 +19619,13 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.created_by']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.created_by']] )) { $getForm[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $core['core.edit.created_by'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".' . (int) \$id))"; $getForm[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" . $core['core.edit.created_by'] . "', 'com_" . $component . "')))"; @@ -18662,13 +19659,13 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.created']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.created']] )) { $getForm[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $core['core.edit.created'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".' . (int) \$id))"; $getForm[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" . $core['core.edit.created'] . "', 'com_" . $component . "')))"; } @@ -18695,7 +19692,7 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.access']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.access']] )) { @@ -18703,7 +19700,7 @@ class Interpretation extends Fields . " Modify the form based on Edit Access 'access' controls."; $getForm[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" . $core['core.edit.access'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".' . (int) \$id))"; $getForm[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" . $core['core.edit.access'] . "', 'com_" . $component . "')))"; $getForm[] = $this->_t(2) . "{"; @@ -18718,13 +19715,13 @@ class Interpretation extends Fields $getForm[] = $this->_t(2) . "}"; } // handel the fields permissions - if (isset($this->permissionFields[$viewName_single]) + if (isset($this->permissionFields[$nameSingleCode]) && ComponentbuilderHelper::checkArray( - $this->permissionFields[$viewName_single] + $this->permissionFields[$nameSingleCode] )) { foreach ( - $this->permissionFields[$viewName_single] as $fieldName => + $this->permissionFields[$nameSingleCode] as $fieldName => $permission_options ) { @@ -18736,19 +19733,19 @@ class Interpretation extends Fields { case 'edit': $this->setPermissionEditFields( - $getForm, $viewName_single, $fieldName, + $getForm, $nameSingleCode, $fieldName, $fieldType, $component ); break; case 'access': $this->setPermissionAccessFields( - $getForm, $viewName_single, $fieldName, + $getForm, $nameSingleCode, $fieldName, $fieldType, $component ); break; case 'view': $this->setPermissionViewFields( - $getForm, $viewName_single, $fieldName, + $getForm, $nameSingleCode, $fieldName, $fieldType, $component ); break; @@ -18791,7 +19788,7 @@ class Interpretation extends Fields $getForm[] = $this->_t(3) . "}"; // load custom script if found $getForm[] = $this->_t(2) . "}" . $this->getCustomScriptBuilder( - 'php_getform', $viewName_single, PHP_EOL + 'php_getform', $nameSingleCode, PHP_EOL ); // setup the default script $getForm[] = $this->_t(2) . "return \$form;"; @@ -18799,7 +19796,7 @@ class Interpretation extends Fields return implode(PHP_EOL, $getForm); } - protected function setPermissionEditFields(&$allow, $viewName_single, + protected function setPermissionEditFields(&$allow, $nameSingleCode, $fieldName, $fieldType, $component ) { // only for fields that can be edited @@ -18810,10 +19807,10 @@ class Interpretation extends Fields . ComponentbuilderHelper::safeString($fieldName, 'W') . " access controls."; $allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" - . $viewName_single . ".edit." . $fieldName . "', 'com_" - . $component . "." . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".edit." . $fieldName . "', 'com_" + . $component . "." . $nameSingleCode . ".' . (int) \$id))"; $allow[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" - . $viewName_single . ".edit." . $fieldName . "', 'com_" + . $nameSingleCode . ".edit." . $fieldName . "', 'com_" . $component . "')))"; $allow[] = $this->_t(2) . "{"; $allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -18852,7 +19849,7 @@ class Interpretation extends Fields } } - protected function setPermissionAccessFields(&$allow, $viewName_single, + protected function setPermissionAccessFields(&$allow, $nameSingleCode, $fieldName, $fieldType, $component ) { $allow[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -18860,10 +19857,10 @@ class Interpretation extends Fields . ComponentbuilderHelper::safeString($fieldName, 'W') . " access controls."; $allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" - . $viewName_single . ".access." . $fieldName . "', 'com_" - . $component . "." . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".access." . $fieldName . "', 'com_" + . $component . "." . $nameSingleCode . ".' . (int) \$id))"; $allow[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" - . $viewName_single . ".access." . $fieldName . "', 'com_" + . $nameSingleCode . ".access." . $fieldName . "', 'com_" . $component . "')))"; $allow[] = $this->_t(2) . "{"; $allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -18872,7 +19869,7 @@ class Interpretation extends Fields $allow[] = $this->_t(2) . "}"; } - protected function setPermissionViewFields(&$allow, $viewName_single, + protected function setPermissionViewFields(&$allow, $nameSingleCode, $fieldName, $fieldType, $component ) { if (ComponentbuilderHelper::fieldCheck($fieldType, 'spacer')) @@ -18882,10 +19879,10 @@ class Interpretation extends Fields . ComponentbuilderHelper::safeString($fieldName, 'W') . " access controls."; $allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" - . $viewName_single . ".view." . $fieldName . "', 'com_" - . $component . "." . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".view." . $fieldName . "', 'com_" + . $component . "." . $nameSingleCode . ".' . (int) \$id))"; $allow[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" - . $viewName_single . ".view." . $fieldName . "', 'com_" + . $nameSingleCode . ".view." . $fieldName . "', 'com_" . $component . "')))"; $allow[] = $this->_t(2) . "{"; $allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -18901,10 +19898,10 @@ class Interpretation extends Fields . ComponentbuilderHelper::safeString($fieldName, 'W') . " access controls."; $allow[] = $this->_t(2) . "if (\$id != 0 && (!\$user->authorise('" - . $viewName_single . ".view." . $fieldName . "', 'com_" - . $component . "." . $viewName_single . ".' . (int) \$id))"; + . $nameSingleCode . ".view." . $fieldName . "', 'com_" + . $component . "." . $nameSingleCode . ".' . (int) \$id))"; $allow[] = $this->_t(3) . "|| (\$id == 0 && !\$user->authorise('" - . $viewName_single . ".view." . $fieldName . "', 'com_" + . $nameSingleCode . ".view." . $fieldName . "', 'com_" . $component . "')))"; $allow[] = $this->_t(2) . "{"; $allow[] = $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -18945,22 +19942,22 @@ class Interpretation extends Fields } } - public function setJmodelAdminAllowEdit($viewName_single, $viewName_list) + public function setJmodelAdminAllowEdit($nameSingleCode, $nameListCode) { $allow = array(); // set component name $component = $this->componentCodeName; // prepare custom permission script $customAllow = $this->getCustomScriptBuilder( - 'php_allowedit', $viewName_single, $this->_t(2) + 'php_allowedit', $nameSingleCode, $this->_t(2) . "\$recordId = (int) isset(\$data[\$key]) ? \$data[\$key] : 0;" . PHP_EOL ); // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // check if the item has permissions. @@ -18970,7 +19967,7 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit']] ) && in_array( - $viewName_single, $this->permissionBuilder[$core['core.edit']] + $nameSingleCode, $this->permissionBuilder[$core['core.edit']] )) { $allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -18980,7 +19977,7 @@ class Interpretation extends Fields $allow[] = $customAllow; $allow[] = $this->_t(2) . "return \$user->authorise('" . $core['core.edit'] . "', 'com_" . $component . "." - . $viewName_single + . $nameSingleCode . ".'. ((int) isset(\$data[\$key]) ? \$data[\$key] : 0)) or \$user->authorise('" . $core['core.edit'] . "', 'com_" . $component . "');"; } @@ -18996,40 +19993,40 @@ class Interpretation extends Fields $allow[] = $customAllow; $allow[] = $this->_t(2) . "return JFactory::getUser()->authorise('core.edit', 'com_" - . $component . "." . $viewName_single + . $component . "." . $nameSingleCode . ".'. ((int) isset(\$data[\$key]) ? \$data[\$key] : 0)) or parent::allowEdit(\$data, \$key);"; } return implode(PHP_EOL, $allow); } - public function setJmodelAdminCanDelete($viewName_single, $viewName_list) + public function setJmodelAdminCanDelete($nameSingleCode, $nameListCode) { $allow = array(); // set component name $component = $this->componentCodeName; // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } - if (0) //isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list])) <-- remove category from check + if (0) //isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameListCode])) <-- remove category from check { // check if category has another name - if ($coreLoad && isset($this->catOtherName[$viewName_list]) + if ($coreLoad && isset($this->catOtherName[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->catOtherName[$viewName_list] + $this->catOtherName[$nameListCode] )) { - $otherViews = $this->catOtherName[$viewName_list]['views']; - $otherView = $this->catOtherName[$viewName_list]['view']; + $otherViews = $this->catOtherName[$nameListCode]['views']; + $otherView = $this->catOtherName[$nameListCode]['view']; } else { - $otherViews = $viewName_list; - $otherView = $viewName_single; + $otherViews = $nameListCode; + $otherView = $nameSingleCode; } // setup the category script $allow[] = PHP_EOL . $this->_t(2) . "if (!empty(\$record->id))"; @@ -19095,7 +20092,7 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.delete']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.delete']] )) { @@ -19105,7 +20102,7 @@ class Interpretation extends Fields . " The record has been set. Check the record permissions."; $allow[] = $this->_t(3) . "return \$user->authorise('" . $core['core.delete'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$record->id);"; + . $nameSingleCode . ".' . (int) \$record->id);"; } else { @@ -19115,7 +20112,7 @@ class Interpretation extends Fields . " The record has been set. Check the record permissions."; $allow[] = $this->_t(3) . "return \$user->authorise('core.delete', 'com_" - . $component . "." . $viewName_single + . $component . "." . $nameSingleCode . ".' . (int) \$record->id);"; } $allow[] = $this->_t(2) . "}"; @@ -19125,33 +20122,34 @@ class Interpretation extends Fields return implode(PHP_EOL, $allow); } - public function setJmodelAdminCanEditState($viewName_single, $viewName_list) - { + public function setJmodelAdminCanEditState($nameSingleCode, + $nameListCode + ) { $allow = array(); // set component name $component = $this->componentCodeName; // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } - if (0) // isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list])) <-- remove category from check + if (0) // isset($this->categoryBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameListCode])) <-- remove category from check { // check if category has another name - if (isset($this->catOtherName[$viewName_list]) + if (isset($this->catOtherName[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->catOtherName[$viewName_list] + $this->catOtherName[$nameListCode] )) { - $otherViews = $this->catOtherName[$viewName_list]['views']; - $otherView = $this->catOtherName[$viewName_list]['view']; + $otherViews = $this->catOtherName[$nameListCode]['views']; + $otherView = $this->catOtherName[$nameListCode]['view']; } else { - $otherViews = $viewName_list; - $otherView = $viewName_single; + $otherViews = $nameListCode; + $otherView = $nameSingleCode; } $allow[] = PHP_EOL . $this->_t(2) . "\$user = JFactory::getUser();"; $allow[] = $this->_t(2) @@ -19167,19 +20165,19 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.state']] )) { $allow[] = $this->_t(3) . "\$permission = \$user->authorise('" . $core['core.edit.state'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$recordId);"; + . $nameSingleCode . ".' . (int) \$recordId);"; } else { $allow[] = $this->_t(3) . "\$permission = \$user->authorise('core.edit.state', 'com_" - . $component . "." . $viewName_single + . $component . "." . $nameSingleCode . ".' . (int) \$recordId);"; } $allow[] = $this->_t(3) @@ -19209,7 +20207,7 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.state']] )) { @@ -19244,19 +20242,19 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder[$core['core.edit.state']] )) { $allow[] = $this->_t(3) . "\$permission = \$user->authorise('" . $core['core.edit.state'] . "', 'com_" . $component . "." - . $viewName_single . ".' . (int) \$recordId);"; + . $nameSingleCode . ".' . (int) \$recordId);"; } else { $allow[] = $this->_t(3) . "\$permission = \$user->authorise('core.edit.state', 'com_" - . $component . "." . $viewName_single + . $component . "." . $nameSingleCode . ".' . (int) \$recordId);"; } $allow[] = $this->_t(3) @@ -19271,7 +20269,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit.state']] )) { @@ -19293,16 +20291,16 @@ class Interpretation extends Fields return implode(PHP_EOL, $allow); } - public function setJviewListCanDo($viewName_single, $viewName_list) + public function setJviewListCanDo($nameSingleCode, $nameListCode) { $allow = array(); // set component name $component = $this->componentCodeName; // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // check if the item has permissions for edit. @@ -19312,7 +20310,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit']] )) { @@ -19332,7 +20330,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit.state']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit.state']] )) { @@ -19351,7 +20349,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -19370,7 +20368,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.delete']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.delete']] )) { @@ -19389,7 +20387,7 @@ class Interpretation extends Fields $this->permissionBuilder['global']['global'][$core['core.batch']] ) && in_array( - $viewName_single, + $nameSingleCode, $this->permissionBuilder['global']['global'][$core['core.delete']] )) { @@ -19450,16 +20448,28 @@ class Interpretation extends Fields return $access; } - public function setFilterFields(&$view) + /** + * set the filter fields + * + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return string The code for the filter fields array + * + */ + public function setFilterFieldsArray(&$nameSingleCode, &$nameListCode) { // keep track of all fields already added - $donelist = array('id', 'search', 'published', 'access', 'created_by', - 'modified_by'); + $donelist = array('id' => true, 'search' => true, + 'published' => true, 'access' => true, + 'created_by' => true, 'modified_by' => true); // default filter fields $fields = "'a.id','id'"; $fields .= "," . PHP_EOL . $this->_t(4) . "'a.published','published'"; - if (isset($this->accessBuilder[$view]) - && ComponentbuilderHelper::checkString($this->accessBuilder[$view])) + if (isset($this->accessBuilder[$nameSingleCode]) + && ComponentbuilderHelper::checkString( + $this->accessBuilder[$nameSingleCode] + )) { $fields .= "," . PHP_EOL . $this->_t(4) . "'a.access','access'"; } @@ -19469,80 +20479,36 @@ class Interpretation extends Fields . "'a.modified_by','modified_by'"; // add the rest of the set filters - if (isset($this->sortBuilder[$view]) - && ComponentbuilderHelper::checkArray($this->sortBuilder[$view])) + if (isset($this->filterBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->filterBuilder[$nameListCode] + )) { - foreach ($this->sortBuilder[$view] as $filter) + foreach ($this->filterBuilder[$nameListCode] as $filter) { - if (!in_array($filter['code'], $donelist)) + if (!isset($donelist[$filter['code']])) { - if ($filter['type'] === 'category') - { - $fields .= "," . PHP_EOL . $this->_t(4) - . "'c.title','category_title'"; - $fields .= "," . PHP_EOL . $this->_t(4) - . "'c.id', 'category_id'"; - if ($filter['code'] != 'category') - { - $fields .= "," . PHP_EOL . $this->_t(4) . "'a." - . $filter['code'] . "', '" . $filter['code'] - . "'"; - } - } - else - { - // check if custom field is set - if (ComponentbuilderHelper::checkArray( - $filter['custom'] - )) - { - $fields .= "," . PHP_EOL . $this->_t(4) . "'" - . $filter['custom']['db'] . "." - . $filter['custom']['text'] . "'"; - } - else - { - $fields .= "," . PHP_EOL . $this->_t(4) . "'a." - . $filter['code'] . "','" . $filter['code'] - . "'"; - } - } - $donelist[] = $filter['code']; + $fields .= $this->getFilterFieldCode( + $filter + ); + $donelist[$filter['code']] = true; } } } // add the rest of the set filters - if (isset($this->filterBuilder[$view]) - && ComponentbuilderHelper::checkArray($this->filterBuilder[$view])) + if (isset($this->sortBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->sortBuilder[$nameListCode] + )) { - foreach ($this->filterBuilder[$view] as $filter) + foreach ($this->sortBuilder[$nameListCode] as $filter) { - if (!in_array($filter['code'], $donelist)) + if (!isset($donelist[$filter['code']])) { - if ($filter['type'] === 'category') - { - $fields .= "," . PHP_EOL . $this->_t(4) - . "'c.title','category_title'"; - $fields .= "," . PHP_EOL . $this->_t(4) - . "'c.id', 'category_id'"; - if ($filter['code'] != 'category') - { - $fields .= "," . PHP_EOL . $this->_t(4) . "'a." - . $filter['code'] . "', '" . $filter['code'] - . "'"; - } - } - else - { - // check if custom field is set - /* if (ComponentbuilderHelper::checkArray($filter['custom'])) - { - $fields .= ",".PHP_EOL.$this->_t(4) . "'".$filter['custom']['db'].".".$filter['custom']['text']."','".$filter['code']."_".$filter['custom']['text']."'"; - } */ - $fields .= "," . PHP_EOL . $this->_t(4) . "'a." - . $filter['code'] . "','" . $filter['code'] . "'"; - } - $donelist[] = $filter['code']; + $fields .= $this->getFilterFieldCode( + $filter + ); + $donelist[$filter['code']] = true; } } } @@ -19550,100 +20516,156 @@ class Interpretation extends Fields return $fields; } - public function setStoredId(&$view) + /** + * Add the code of the filter field array + * + * @param array $filter The field/filter array + * + * @return string The code for the filter array + * + */ + protected function getFilterFieldCode(&$filter) { + // add the category stuff (may still remove these) TODO + if ($filter['type'] === 'category') + { + $field = "," . PHP_EOL . $this->_t(4) + . "'c.title','category_title'"; + $field .= "," . PHP_EOL . $this->_t(4) + . "'c.id', 'category_id'"; + if ($filter['code'] != 'category') + { + $field .= "," . PHP_EOL . $this->_t(4) . "'a." + . $filter['code'] . "','" . $filter['code'] + . "'"; + } + } + else + { + // check if custom field is set + if (ComponentbuilderHelper::checkArray( + $filter['custom'] + ) + && isset($filter['custom']['db']) + && ComponentbuilderHelper::checkString( + $filter['custom']['db'] + ) + && isset($filter['custom']['text']) + && ComponentbuilderHelper::checkString( + $filter['custom']['text'] + )) + { + $field = "," . PHP_EOL . $this->_t(4) . "'" + . $filter['custom']['db'] . "." + . $filter['custom']['text'] . "','" . $filter['code'] + . "'"; + } + else + { + $field = "," . PHP_EOL . $this->_t(4) . "'a." + . $filter['code'] . "','" . $filter['code'] + . "'"; + } + } + + return $field; + } + + /** + * set the sotred ids + * + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return string The code for the populate state + * + */ + public function setStoredId(&$nameSingleCode, &$nameListCode) + { + // set component name + $Component = ucwords($this->componentCodeName); // keep track of all fields already added - $donelist = array('id', 'search', 'published', 'access', 'created_by', - 'modified_by'); + $donelist = array('id' => true, 'search' => true, + 'published' => true, 'access' => true, + 'created_by' => true, 'modified_by' => true); // set the defaults first $stored = "//" . $this->setLine(__LINE__) . " Compile the store id."; $stored .= PHP_EOL . $this->_t(2) . "\$id .= ':' . \$this->getState('filter.id');"; $stored .= PHP_EOL . $this->_t(2) . "\$id .= ':' . \$this->getState('filter.search');"; - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter.published');"; - if (isset($this->accessBuilder[$view]) - && ComponentbuilderHelper::checkString($this->accessBuilder[$view])) + // add this if not already added + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) { $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter.access');"; + . "\$id .= ':' . \$this->getState('filter.published');"; + } + // add if view calls for it, and not already added + if (isset($this->accessBuilder[$nameSingleCode]) + && ComponentbuilderHelper::checkString( + $this->accessBuilder[$nameSingleCode] + ) + && !isset($this->fieldsNames[$nameSingleCode]['access'])) + { + // the side bar option is single + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1) + { + $stored .= PHP_EOL . $this->_t(2) + . "\$id .= ':' . \$this->getState('filter.access');"; + } + else + { + // top bar selection can result in + // an array due to multi selection + $stored .= $this->getStoredIdCodeMulti('access', $Component); + } } $stored .= PHP_EOL . $this->_t(2) . "\$id .= ':' . \$this->getState('filter.ordering');"; - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter.created_by');"; - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter.modified_by');"; - // add the rest of the set filters - if (isset($this->sortBuilder[$view]) - && ComponentbuilderHelper::checkArray($this->sortBuilder[$view])) + // add this if not already added + if (!isset($this->fieldsNames[$nameSingleCode]['created_by'])) { - foreach ($this->sortBuilder[$view] as $filter) + $stored .= PHP_EOL . $this->_t(2) + . "\$id .= ':' . \$this->getState('filter.created_by');"; + } + // add this if not already added + if (!isset($this->fieldsNames[$nameSingleCode]['modified_by'])) + { + $stored .= PHP_EOL . $this->_t(2) + . "\$id .= ':' . \$this->getState('filter.modified_by');"; + } + // add the rest of the set filters + if (isset($this->filterBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->filterBuilder[$nameListCode] + )) + { + foreach ($this->filterBuilder[$nameListCode] as $filter) { - if (!in_array($filter['code'], $donelist)) + if (!isset($donelist[$filter['code']])) { - if ($filter['type'] === 'category') - { - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter.category');"; - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter.category_id');"; - if ($filter['code'] != 'category') - { - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter." - . $filter['code'] . "');"; - } - } - else - { - // check if custom field is set - /* if (ComponentbuilderHelper::checkArray($filter['custom'])) - { - $stored .= PHP_EOL.$this->_t(2) . "\$id .= ':' . \$this->getState('filter.".$filter['code']."_".$filter['custom']['text']."');"; - } */ - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter." - . $filter['code'] . "');"; - } - $donelist[] = $filter['code']; + $stored .= $this->getStoredIdCode( + $filter, $nameListCode, $Component + ); + $donelist[$filter['code']] = true; } } } // add the rest of the set filters - if (isset($this->filterBuilder[$view]) - && ComponentbuilderHelper::checkArray($this->filterBuilder[$view])) + if (isset($this->sortBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->sortBuilder[$nameListCode] + )) { - foreach ($this->filterBuilder[$view] as $filter) + foreach ($this->sortBuilder[$nameListCode] as $filter) { - if (!in_array($filter['code'], $donelist)) + if (!isset($donelist[$filter['code']])) { - if ($filter['type'] === 'category') - { - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter.category');"; - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter.category_id');"; - if ($filter['code'] != 'category') - { - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter." - . $filter['code'] . "');"; - } - } - else - { - // check if custom field is set - /* if (ComponentbuilderHelper::checkArray($filter['custom'])) - { - $stored .= PHP_EOL . $this->_t(2) . "\$id .= ':' . \$this->getState('filter.".$filter['code']."_".$filter['custom']['text']."');"; - } */ - $stored .= PHP_EOL . $this->_t(2) - . "\$id .= ':' . \$this->getState('filter." - . $filter['code'] . "');"; - } - $donelist[] = $filter['code']; + $stored .= $this->getStoredIdCode( + $filter, $nameListCode, $Component + ); + $donelist[$filter['code']] = true; } } } @@ -19651,17 +20673,127 @@ class Interpretation extends Fields return $stored; } + /** + * Add the code of the stored ids + * + * @param array $filter The field/filter array + * @param string $nameListCode The list view name + * @param string $Component The Component name + * + * @return string The code for the stored IDs + * + */ + protected function getStoredIdCode(&$filter, &$nameListCode, &$Component) + { + if ($filter['type'] === 'category') + { + // the side bar option is single (1 = sidebar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 1) + { + $stored = PHP_EOL . $this->_t(2) + . "\$id .= ':' . \$this->getState('filter.category');"; + $stored .= PHP_EOL . $this->_t(2) + . "\$id .= ':' . \$this->getState('filter.category_id');"; + if ($filter['code'] != 'category') + { + $stored .= PHP_EOL . $this->_t(2) + . "\$id .= ':' . \$this->getState('filter." + . $filter['code'] . "');"; + } + } + else + { + $stored = $this->getStoredIdCodeMulti('category', $Component); + $stored .= $this->getStoredIdCodeMulti( + 'category_id', $Component + ); + if ($filter['code'] != 'category') + { + $stored .= $this->getStoredIdCodeMulti( + $filter['code'], $Component + ); + } + } + } + else + { + // check if this is the topbar filter, and multi option (2 = topbar) + if ($filter['multi'] == 2 + && isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + // top bar selection can result in + // an array due to multi selection + $stored = $this->getStoredIdCodeMulti( + $filter['code'], $Component + ); + } + else + { + $stored = PHP_EOL . $this->_t(2) + . "\$id .= ':' . \$this->getState('filter." + . $filter['code'] . "');"; + } + } + + return $stored; + } + + /** + * Add the code of the stored multi ids + * + * @param string $key The key field name + * @param string $Component The Component name + * + * @return string The code for the stored IDs + * + */ + protected function getStoredIdCodeMulti($key, &$Component) + { + // top bar selection can result in + // an array due to multi selection + $stored = PHP_EOL . $this->_t(2) + . "//" . $this->setLine(__LINE__) + . " Check if the value is an array"; + $stored .= PHP_EOL . $this->_t(2) + . "\$_" . $key . " = \$this->getState('filter." + . $key . "');"; + $stored .= PHP_EOL . $this->_t(2) + . "if (" . $Component . "Helper::checkArray(\$_" + . $key . "))"; + $stored .= PHP_EOL . $this->_t(2) + . "{"; + $stored .= PHP_EOL . $this->_t(3) + . "\$id .= ':' . implode(':', \$_" . $key . ");"; + $stored .= PHP_EOL . $this->_t(2) + . "}"; + $stored .= PHP_EOL . $this->_t(2) + . "//" . $this->setLine(__LINE__) + . " Check if this is only an number or string"; + $stored .= PHP_EOL . $this->_t(2) + . "elseif (is_numeric(\$_" . $key . ")"; + $stored .= PHP_EOL . $this->_t(2) + . " || " . $Component . "Helper::checkString(\$_" . $key . "))"; + $stored .= PHP_EOL . $this->_t(2) + . "{"; + $stored .= PHP_EOL . $this->_t(3) + . "\$id .= ':' . \$_" . $key . ";"; + $stored .= PHP_EOL . $this->_t(2) + . "}"; + + return $stored; + } + public function setAddToolBar(&$view) { // set view name - $viewName = ComponentbuilderHelper::safeString( - $view['settings']->name_single - ); + $nameSingleCode = $view['settings']->name_single_code; // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } // check type @@ -19682,9 +20814,10 @@ class Interpretation extends Fields $toolBar = "JFactory::getApplication()->input->set('hidemainmenu', true);"; $toolBar .= PHP_EOL . $this->_t(2) . "JToolBarHelper::title(JText:" - . ":_('" . $viewNameLang_readonly . "'), '" . $viewName . "');"; + . ":_('" . $viewNameLang_readonly . "'), '" . $nameSingleCode + . "');"; $toolBar .= PHP_EOL . $this->_t(2) . "JToolBarHelper::cancel('" - . $viewName . ".cancel', 'JTOOLBAR_CLOSE');"; + . $nameSingleCode . ".cancel', 'JTOOLBAR_CLOSE');"; } else { @@ -19730,7 +20863,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -19746,7 +20879,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " We can create the record."; $toolBar .= PHP_EOL . $this->_t(4) . "JToolBarHelper::save('" - . $viewName . ".save', 'JTOOLBAR_SAVE');"; + . $nameSingleCode . ".save', 'JTOOLBAR_SAVE');"; $toolBar .= PHP_EOL . $this->_t(3) . "}"; if ($coreLoad && isset($core['core.edit']) && isset($this->permissionBuilder['global'][$core['core.edit']]) @@ -19754,7 +20887,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( - $viewName, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit']] )) { @@ -19771,21 +20904,21 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " We can save the record."; $toolBar .= PHP_EOL . $this->_t(4) . "JToolBarHelper::save('" - . $viewName . ".save', 'JTOOLBAR_SAVE');"; + . $nameSingleCode . ".save', 'JTOOLBAR_SAVE');"; $toolBar .= PHP_EOL . $this->_t(3) . "}"; $toolBar .= PHP_EOL . $this->_t(3) . "if (\$isNew)"; $toolBar .= PHP_EOL . $this->_t(3) . "{"; $toolBar .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " Do not creat but cancel."; $toolBar .= PHP_EOL . $this->_t(4) . "JToolBarHelper::cancel('" - . $viewName . ".cancel', 'JTOOLBAR_CANCEL');"; + . $nameSingleCode . ".cancel', 'JTOOLBAR_CANCEL');"; $toolBar .= PHP_EOL . $this->_t(3) . "}"; $toolBar .= PHP_EOL . $this->_t(3) . "else"; $toolBar .= PHP_EOL . $this->_t(3) . "{"; $toolBar .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " We can close it."; $toolBar .= PHP_EOL . $this->_t(4) . "JToolBarHelper::cancel('" - . $viewName . ".cancel', 'JTOOLBAR_CLOSE');"; + . $nameSingleCode . ".cancel', 'JTOOLBAR_CLOSE');"; $toolBar .= PHP_EOL . $this->_t(3) . "}"; $toolBar .= PHP_EOL . $this->_t(2) . "}"; $toolBar .= PHP_EOL . $this->_t(2) . "else"; @@ -19800,7 +20933,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -19814,15 +20947,15 @@ class Interpretation extends Fields } $toolBar .= PHP_EOL . $this->_t(4) . "{"; $toolBar .= PHP_EOL . $this->_t(5) . "JToolBarHelper::apply('" - . $viewName . ".apply', 'JTOOLBAR_APPLY');"; + . $nameSingleCode . ".apply', 'JTOOLBAR_APPLY');"; $toolBar .= PHP_EOL . $this->_t(5) . "JToolBarHelper::save('" - . $viewName . ".save', 'JTOOLBAR_SAVE');"; + . $nameSingleCode . ".save', 'JTOOLBAR_SAVE');"; $toolBar .= PHP_EOL . $this->_t(5) . "JToolBarHelper::custom('" - . $viewName + . $nameSingleCode . ".save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);"; $toolBar .= PHP_EOL . $this->_t(4) . "};"; $toolBar .= PHP_EOL . $this->_t(4) . "JToolBarHelper::cancel('" - . $viewName . ".cancel', 'JTOOLBAR_CANCEL');"; + . $nameSingleCode . ".cancel', 'JTOOLBAR_CANCEL');"; $toolBar .= PHP_EOL . $this->_t(3) . "}"; $toolBar .= PHP_EOL . $this->_t(3) . "else"; $toolBar .= PHP_EOL . $this->_t(3) . "{"; @@ -19832,7 +20965,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( - $viewName, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit']] )) { @@ -19848,9 +20981,9 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(5) . "//" . $this->setLine(__LINE__) . " We can save the new record"; $toolBar .= PHP_EOL . $this->_t(5) . "JToolBarHelper::apply('" - . $viewName . ".apply', 'JTOOLBAR_APPLY');"; + . $nameSingleCode . ".apply', 'JTOOLBAR_APPLY');"; $toolBar .= PHP_EOL . $this->_t(5) . "JToolBarHelper::save('" - . $viewName . ".save', 'JTOOLBAR_SAVE');"; + . $nameSingleCode . ".save', 'JTOOLBAR_SAVE');"; $toolBar .= PHP_EOL . $this->_t(5) . "//" . $this->setLine(__LINE__) . " We can save this record, but check the create permission to see"; $toolBar .= PHP_EOL . $this->_t(5) . "//" . $this->setLine(__LINE__) @@ -19861,7 +20994,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -19875,7 +21008,7 @@ class Interpretation extends Fields } $toolBar .= PHP_EOL . $this->_t(5) . "{"; $toolBar .= PHP_EOL . $this->_t(6) . "JToolBarHelper::custom('" - . $viewName + . $nameSingleCode . ".save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);"; $toolBar .= PHP_EOL . $this->_t(5) . "}"; $toolBar .= PHP_EOL . $this->_t(4) . "}"; @@ -19885,13 +21018,13 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.edit']] ) && in_array( - $viewName, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.edit']] )) { - if ($coreLoad && isset($this->historyBuilder[$viewName]) + if ($coreLoad && isset($this->historyBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->historyBuilder[$viewName] + $this->historyBuilder[$nameSingleCode] )) { $toolBar .= PHP_EOL . $this->_t(4) @@ -19903,16 +21036,16 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(4) . "{"; $toolBar .= PHP_EOL . $this->_t(5) . "JToolbarHelper::versions('com_" - . $this->componentCodeName . "." . $viewName + . $this->componentCodeName . "." . $nameSingleCode . "', \$this->item->id);"; $toolBar .= PHP_EOL . $this->_t(4) . "}"; } } else { - if ($coreLoad && isset($this->historyBuilder[$viewName]) + if ($coreLoad && isset($this->historyBuilder[$nameSingleCode]) && ComponentbuilderHelper::checkString( - $this->historyBuilder[$viewName] + $this->historyBuilder[$nameSingleCode] )) { $toolBar .= PHP_EOL . $this->_t(4) @@ -19923,7 +21056,7 @@ class Interpretation extends Fields $toolBar .= PHP_EOL . $this->_t(4) . "{"; $toolBar .= PHP_EOL . $this->_t(5) . "JToolbarHelper::versions('com_" - . $this->componentCodeName . "." . $viewName + . $this->componentCodeName . "." . $nameSingleCode . "', \$this->item->id);"; $toolBar .= PHP_EOL . $this->_t(4) . "}"; } @@ -19934,7 +21067,7 @@ class Interpretation extends Fields $this->permissionBuilder['global'][$core['core.create']] ) && in_array( - $viewName, + $nameSingleCode, $this->permissionBuilder['global'][$core['core.create']] )) { @@ -19948,13 +21081,13 @@ class Interpretation extends Fields } $toolBar .= PHP_EOL . $this->_t(4) . "{"; $toolBar .= PHP_EOL . $this->_t(5) . "JToolBarHelper::custom('" - . $viewName + . $nameSingleCode . ".save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);"; $toolBar .= PHP_EOL . $this->_t(4) . "}"; // add custom buttons $toolBar .= $this->setCustomButtons($view, 2, $this->_t(2)); $toolBar .= PHP_EOL . $this->_t(4) . "JToolBarHelper::cancel('" - . $viewName . ".cancel', 'JTOOLBAR_CLOSE');"; + . $nameSingleCode . ".cancel', 'JTOOLBAR_CLOSE');"; $toolBar .= PHP_EOL . $this->_t(3) . "}"; $toolBar .= PHP_EOL . $this->_t(2) . "}"; $toolBar .= PHP_EOL . $this->_t(2) . "JToolbarHelper::divider();"; @@ -19962,7 +21095,8 @@ class Interpretation extends Fields . " set help url for this view if found"; $toolBar .= PHP_EOL . $this->_t(2) . "\$help_url = " . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] . "Helper::getHelpUrl('" . $viewName . "');"; + . $this->hhh] . "Helper::getHelpUrl('" . $nameSingleCode + . "');"; $toolBar .= PHP_EOL . $this->_t(2) . "if (" . $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] . "Helper::checkString(\$help_url))"; @@ -19975,146 +21109,65 @@ class Interpretation extends Fields return $toolBar; } - public function setPopulateState(&$view) + /** + * set the populate state code + * + * @param string $nameSingleCode The single view name + * @param string $nameListCode The list view name + * + * @return string The code for the populate state + * + */ + public function setPopulateState(&$nameSingleCode, &$nameListCode) { - // reset buket + // reset bucket $state = ''; // keep track of all fields already added $donelist = array(); - - // add the rest of the set filters - if (isset($this->sortBuilder[$view]) - && ComponentbuilderHelper::checkArray($this->sortBuilder[$view])) + // we must add the formSubmited code if new above filters is used (2 = topbar) + $new_filter = false; + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) { - foreach ($this->sortBuilder[$view] as $filter) + $state .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" + . $this->setLine(__LINE__) . " Check if the form was submitted"; + $state .= PHP_EOL . $this->_t(2) . "\$formSubmited" + . " = \$app->input->post->get('form_submited');"; + $new_filter = true; + } + // add the default populate states (this must be added first) + $state .= $this->setDefaultPopulateState($nameSingleCode, $new_filter); + // add the filters + if (isset($this->filterBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->filterBuilder[$nameListCode] + )) + { + foreach ($this->filterBuilder[$nameListCode] as $filter) { - if (!in_array($filter['code'], $donelist)) + if (!isset($donelist[$filter['code']])) { - if ($filter['type'] === 'category') - { - if (strlen($state) == 0) - { - $spacer = ""; - } - else - { - $spacer = PHP_EOL . PHP_EOL . $this->_t(2); - } - $state .= $spacer - . "\$category = \$app->getUserStateFromRequest(\$this->context . '.filter.category', 'filter_category');"; - $state .= PHP_EOL . $this->_t(2) - . "\$this->setState('filter.category', \$category);"; - $state .= PHP_EOL . PHP_EOL . $this->_t(2) - . "\$categoryId = \$this->getUserStateFromRequest(\$this->context . '.filter.category_id', 'filter_category_id');"; - $state .= PHP_EOL . $this->_t(2) - . "\$this->setState('filter.category_id', \$categoryId);"; - if ($filter['code'] != 'category') - { - $state .= PHP_EOL . PHP_EOL . $this->_t(2) . "\$" - . $filter['code'] - . " = \$app->getUserStateFromRequest(\$this->context . '.filter." - . $filter['code'] . "', 'filter_" - . $filter['code'] . "');"; - $state .= PHP_EOL . $this->_t(2) - . "\$this->setState('filter." . $filter['code'] - . "', \$" . $filter['code'] . ");"; - } - } - else - { - if (strlen($state) == 0) - { - $spacer = ""; - } - else - { - $spacer = PHP_EOL . PHP_EOL . $this->_t(2); - } - // check if custom field is set - /* if (ComponentbuilderHelper::checkArray($filter['custom'])) - { - $state .= $spacer."\$".$filter['code']."_".$filter['custom']['text']." = \$this->getUserStateFromRequest(\$this->context . '.filter.".$filter['code']."_".$filter['custom']['text']."', 'filter_".$filter['code']."_".$filter['custom']['text']."');"; - $state .= PHP_EOL.$this->_t(2) . "\$this->setState('filter.".$filter['code']."_".$filter['custom']['text']."', \$".$filter['code']."_".$filter['custom']['text'].");"; - $spacer = PHP_EOL.PHP_EOL.$this->_t(2); - } */ - $state .= $spacer . "\$" . $filter['code'] - . " = \$this->getUserStateFromRequest(\$this->context . '.filter." - . $filter['code'] . "', 'filter_" . $filter['code'] - . "');"; - $state .= PHP_EOL . $this->_t(2) - . "\$this->setState('filter." . $filter['code'] - . "', \$" . $filter['code'] . ");"; - } - $donelist[] = $filter['code']; + $state .= $this->getPopulateStateFilterCode( + $filter, $new_filter + ); + $donelist[$filter['code']] = true; } } } // add the rest of the set filters - if (isset($this->filterBuilder[$view]) - && ComponentbuilderHelper::checkArray($this->filterBuilder[$view])) + if (isset($this->sortBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->sortBuilder[$nameListCode] + )) { - foreach ($this->filterBuilder[$view] as $filter) + foreach ($this->sortBuilder[$nameListCode] as $filter) { - if (!in_array($filter['code'], $donelist)) + if (!isset($donelist[$filter['code']])) { - if ($filter['type'] === 'category') - { - if (strlen($state) == 0) - { - $spacer = ""; - } - else - { - $spacer = PHP_EOL . PHP_EOL . $this->_t(2); - } - $state .= $spacer - . "\$category = \$app->getUserStateFromRequest(\$this->context . '.filter.category', 'filter_category');"; - $state .= PHP_EOL . $this->_t(2) - . "\$this->setState('filter.category', \$category);"; - $state .= PHP_EOL . PHP_EOL . $this->_t(2) - . "\$categoryId = \$this->getUserStateFromRequest(\$this->context . '.filter.category_id', 'filter_category_id');"; - $state .= PHP_EOL . $this->_t(2) - . "\$this->setState('filter.category_id', \$categoryId);"; - if ($filter['code'] != 'category') - { - $state .= PHP_EOL . PHP_EOL . $this->_t(2) . "\$" - . $filter['code'] - . " = \$app->getUserStateFromRequest(\$this->context . '.filter." - . $filter['code'] . "', 'filter_" - . $filter['code'] . "');"; - $state .= PHP_EOL . $this->_t(2) - . "\$this->setState('filter." . $filter['code'] - . "', \$" . $filter['code'] . ");"; - } - } - else - { - if (strlen($state) == 0) - { - $spacer = ""; - } - else - { - $spacer = PHP_EOL . PHP_EOL . $this->_t(2); - } - // check if custom field is set - /* if (ComponentbuilderHelper::checkArray($filter['custom'])) - { - $state .= $spacer."\$".$filter['custom']['text']." = \$this->getUserStateFromRequest(\$this->context . '.filter.".$filter['custom']['text']."', 'filter_".$filter['custom']['text']."');"; - $state .= PHP_EOL.$this->_t(2) . "\$this->setState('filter.".$filter['custom']['text']."', \$".$filter['custom']['text'].");"; - $state .= PHP_EOL.$this->_t(2) . "\$".$filter['code']."_".$filter['custom']['text']." = \$this->getUserStateFromRequest(\$this->context . '.filter.".$filter['code']."_".$filter['custom']['text']."', 'filter_".$filter['code']."_".$filter['custom']['text']."');"; - $state .= PHP_EOL.$this->_t(2) . "\$this->setState('filter.".$filter['code']."_".$filter['custom']['text']."', \$".$filter['code']."_".$filter['custom']['text'].");"; - $spacer = PHP_EOL.PHP_EOL.$this->_t(2); - } */ - $state .= $spacer . "\$" . $filter['code'] - . " = \$this->getUserStateFromRequest(\$this->context . '.filter." - . $filter['code'] . "', 'filter_" . $filter['code'] - . "');"; - $state .= PHP_EOL . $this->_t(2) - . "\$this->setState('filter." . $filter['code'] - . "', \$" . $filter['code'] . ");"; - } - $donelist[] = $filter['code']; + $state .= $this->getPopulateStateFilterCode( + $filter, $new_filter + ); + $donelist[$filter['code']] = true; } } } @@ -20122,22 +21175,146 @@ class Interpretation extends Fields return $state; } - public function setSortFields(&$view) + /** + * Add the code of the filter in the populate state + * + * @param array $filter The field/filter array + * @param bool $newFilter The switch to use the new filter + * @param string $extra The defaults/extra options of the filter + * + * @return string The code for the populate state + * + */ + protected function getPopulateStateFilterCode(&$filter, $newFilter, + $extra = '' + ) { + $state = ''; + // add category stuff (may still remove these) TODO + if (isset($filter['type']) && $filter['type'] === 'category') + { + $state .= PHP_EOL . PHP_EOL . $this->_t(2) + . "\$category = \$app->getUserStateFromRequest(\$this->context . '.filter.category', 'filter_category');"; + $state .= PHP_EOL . $this->_t(2) + . "\$this->setState('filter.category', \$category);"; + $state .= PHP_EOL . PHP_EOL . $this->_t(2) + . "\$categoryId = \$this->getUserStateFromRequest(\$this->context . '.filter.category_id', 'filter_category_id');"; + $state .= PHP_EOL . $this->_t(2) + . "\$this->setState('filter.category_id', \$categoryId);"; + } + // always add the default filter + $state .= PHP_EOL . PHP_EOL . $this->_t(2) . "\$" . $filter['code'] + . " = \$this->getUserStateFromRequest(\$this->context . '.filter." + . $filter['code'] . "', 'filter_" . $filter['code'] + . "'" . $extra . ");"; + if ($newFilter) + { + // add the new filter option + $state .= PHP_EOL . $this->_t(2) + . "if (\$formSubmited)"; + $state .= PHP_EOL . $this->_t(2) . "{"; + $state .= PHP_EOL . $this->_t(3) . "\$" . $filter['code'] + . " = \$app->input->post->get('" . $filter['code'] . "');"; + $state .= PHP_EOL . $this->_t(3) + . "\$this->setState('filter." . $filter['code'] + . "', \$" . $filter['code'] . ");"; + $state .= PHP_EOL . $this->_t(2) . "}"; + } + else + { + // the old filter option + $state .= PHP_EOL . $this->_t(2) + . "\$this->setState('filter." . $filter['code'] + . "', \$" . $filter['code'] . ");"; + } + + return $state; + } + + /** + * set the default populate state code + * + * @param string $nameSingleCode The single view name + * @param bool $newFilter The switch to use the new filter + * + * @return string The state code added + * + */ + protected function setDefaultPopulateState(&$nameSingleCode, $newFilter) + { + $state = ''; + // start filter + $filter = array('type' => 'text'); + // if access is not set add its default filter here + if (!isset($this->fieldsNames[$nameSingleCode]['access'])) + { + $filter['code'] = "access"; + $state .= $this->getPopulateStateFilterCode( + $filter, $newFilter, ", 0, 'int'" + ); + } + // if published is not set add its default filter here + if (!isset($this->fieldsNames[$nameSingleCode]['published'])) + { + $filter['code'] = "published"; + $state .= $this->getPopulateStateFilterCode( + $filter, false, ", ''" + ); + } + // if created_by is not set add its default filter here + if (!isset($this->fieldsNames[$nameSingleCode]['created_by'])) + { + $filter['code'] = "created_by"; + $state .= $this->getPopulateStateFilterCode( + $filter, false, ", ''" + ); + } + // if created is not set add its default filter here + if (!isset($this->fieldsNames[$nameSingleCode]['created'])) + { + $filter['code'] = "created"; + $state .= $this->getPopulateStateFilterCode( + $filter, false + ); + } + + // the sorting defaults are always added + $filter['code'] = "sorting"; + $state .= $this->getPopulateStateFilterCode( + $filter, false, ", 0, 'int'" + ); + // the search defaults are always added + $filter['code'] = "search"; + $state .= $this->getPopulateStateFilterCode($filter, false); + + return $state; + } + + /** + * set the sorted field array for the getSortFields method + * + * @param string $nameSingleCode The single view name + * + * @return string The array/string of fields to add to the getSortFields method + * + */ + public function setSortFields(&$nameListCode) { // keep track of all fields already added $donelist = array('ordering', 'published'); // set the default first $fields = "return array("; - $fields .= PHP_EOL . $this->_t(3) . "'ordering' => JText:" + $fields .= PHP_EOL . $this->_t(3) . "'a.ordering' => JText:" . ":_('JGRID_HEADING_ORDERING')"; $fields .= "," . PHP_EOL . $this->_t(3) . "'a.published' => JText:" . ":_('JSTATUS')"; // add the rest of the set filters - if (isset($this->sortBuilder[$view]) - && ComponentbuilderHelper::checkArray($this->sortBuilder[$view])) + if (isset($this->sortBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->sortBuilder[$nameListCode] + )) { - foreach ($this->sortBuilder[$view] as $filter) + foreach ($this->sortBuilder[$nameListCode] as $filter) { if (!in_array($filter['code'], $donelist)) { @@ -20257,7 +21434,8 @@ class Interpretation extends Fields return $checkin; } - public function setGetItemsMethodStringFix($viewName_single, $viewName_list, + public function setGetItemsMethodStringFix($nameSingleCode, + $nameListCode, $Component, $tab = '', $export = false, $all = false ) { // add the fix if this view has the need for it @@ -20271,9 +21449,9 @@ class Interpretation extends Fields } // setup correct core target $coreLoad = false; - if (isset($this->permissionCore[$viewName_single])) + if (isset($this->permissionCore[$nameSingleCode])) { - $core = $this->permissionCore[$viewName_single]; + $core = $this->permissionCore[$nameSingleCode]; $coreLoad = true; } $component = ComponentbuilderHelper::safeString($Component); @@ -20284,7 +21462,8 @@ class Interpretation extends Fields $this->permissionBuilder[$core['core.access']] ) && in_array( - $viewName_single, $this->permissionBuilder[$core['core.access']] + $nameSingleCode, + $this->permissionBuilder[$core['core.access']] )) { $fix_access = PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" @@ -20292,7 +21471,7 @@ class Interpretation extends Fields . " Remove items the user can't access."; $fix_access .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$access = (\$user->authorise('" . $core['core.access'] - . "', 'com_" . $component . "." . $viewName_single + . "', 'com_" . $component . "." . $nameSingleCode . ".' . (int) \$item->id) && \$user->authorise('" . $core['core.access'] . "', 'com_" . $component . "'));"; $fix_access .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) @@ -20315,13 +21494,13 @@ class Interpretation extends Fields $methodName = 'getItemsMethodListStringFixBuilder'; } // load the relations before modeling - if (isset($this->fieldRelations[$viewName_list]) + if (isset($this->fieldRelations[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->fieldRelations[$viewName_list] + $this->fieldRelations[$nameListCode] )) { foreach ( - $this->fieldRelations[$viewName_list] as $field_id => $fields + $this->fieldRelations[$nameListCode] as $field_id => $fields ) { foreach ($fields as $area => $field) @@ -20329,19 +21508,19 @@ class Interpretation extends Fields if ($area == 1 && isset($field['code'])) { $fix .= $this->setModelFieldRelation( - $field, $viewName_list, $tab + $field, $nameListCode, $tab ); } } } } // open the values - if (isset($this->{$methodName}[$viewName_single]) + if (isset($this->{$methodName}[$nameSingleCode]) && ComponentbuilderHelper::checkArray( - $this->{$methodName}[$viewName_single] + $this->{$methodName}[$nameSingleCode] )) { - foreach ($this->{$methodName}[$viewName_single] as $item) + foreach ($this->{$methodName}[$nameSingleCode] as $item) { switch ($item['method']) { @@ -20469,7 +21648,7 @@ class Interpretation extends Fields PHP_EOL . $this->_t(1) . $tab . $this->_t( 3 ), - $this->expertFieldModeling[$viewName_single][$item['name']]['get'] + $this->expertFieldModeling[$nameSingleCode][$item['name']]['get'] ), $_placeholder_for_field ); } @@ -20675,28 +21854,28 @@ class Interpretation extends Fields } } /* // set translation (TODO) would be nice to cut down on double loops.. - if (!$export && isset($this->selectionTranslationFixBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$viewName_list])) + if (!$export && isset($this->selectionTranslationFixBuilder[$nameListCode]) && ComponentbuilderHelper::checkArray($this->selectionTranslationFixBuilder[$nameListCode])) { - foreach ($this->selectionTranslationFixBuilder[$viewName_list] as $name => $values) + foreach ($this->selectionTranslationFixBuilder[$nameListCode] as $name => $values) { $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " convert " . $name; $fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$item->" . $name . " = \$this->selectionTranslation(\$item->" . $name . ", '" . $name . "');"; } } */ // load the relations after modeling - if (isset($this->fieldRelations[$viewName_list]) + if (isset($this->fieldRelations[$nameListCode]) && ComponentbuilderHelper::checkArray( - $this->fieldRelations[$viewName_list] + $this->fieldRelations[$nameListCode] )) { - foreach ($this->fieldRelations[$viewName_list] as $fields) + foreach ($this->fieldRelations[$nameListCode] as $fields) { foreach ($fields as $area => $field) { if ($area == 3 && isset($field['code'])) { $fix .= $this->setModelFieldRelation( - $field, $viewName_list, $tab + $field, $nameListCode, $tab ); } } @@ -20737,13 +21916,13 @@ class Interpretation extends Fields $hasPermissional = false; // add the permissional removal of values the user has not right to view or access if ($this->strictFieldExportPermissions - && isset($this->permissionFields[$viewName_single]) + && isset($this->permissionFields[$nameSingleCode]) && ComponentbuilderHelper::checkArray( - $this->permissionFields[$viewName_single] + $this->permissionFields[$nameSingleCode] )) { foreach ( - $this->permissionFields[$viewName_single] as $fieldName => + $this->permissionFields[$nameSingleCode] as $fieldName => $permission_options ) { @@ -20799,7 +21978,7 @@ class Interpretation extends Fields $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "{"; foreach ( - $this->permissionFields[$viewName_single] as $fieldName => + $this->permissionFields[$nameSingleCode] as $fieldName => $permission_options ) { @@ -20820,14 +21999,14 @@ class Interpretation extends Fields $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(4) . "if (isset(\$item->" . $fieldName . ") && (!\$user->authorise('" - . $viewName_single . "." + . $nameSingleCode . "." . $permission_option . "." . $fieldName . "', 'com_" . $component . "." - . $viewName_single + . $nameSingleCode . ".' . (int) \$item->id)"; $forEachStart .= PHP_EOL . $this->_t(1) . $tab . $this->_t(5) . "|| !\$user->authorise('" - . $viewName_single . "." + . $nameSingleCode . "." . $permission_option . "." . $fieldName . "', 'com_" . $component . "')))"; $forEachStart .= PHP_EOL . $this->_t(1) . $tab @@ -20882,7 +22061,7 @@ class Interpretation extends Fields // add custom php to getitems method $fix .= $this->getCustomScriptBuilder( - 'php_getitems', $viewName_single, PHP_EOL . PHP_EOL . $tab + 'php_getitems', $nameSingleCode, PHP_EOL . PHP_EOL . $tab ); // load the encryption object if needed @@ -20908,16 +22087,16 @@ class Interpretation extends Fields } elseif (isset( $this->{$cryptionType - . 'FieldModelInitiator'}[$viewName_single] + . 'FieldModelInitiator'}[$nameSingleCode] ) && isset( $this->{$cryptionType - . 'FieldModelInitiator'}[$viewName_single]['get'] + . 'FieldModelInitiator'}[$nameSingleCode]['get'] )) { foreach ( $this->{$cryptionType - . 'FieldModelInitiator'}[$viewName_single]['get'] as + . 'FieldModelInitiator'}[$nameSingleCode]['get'] as $block ) { @@ -20935,11 +22114,20 @@ class Interpretation extends Fields return $script . $forEachStart . $fix; } - public function setClassHeaders($context, $viewName) + /** + * Build headers for the model/view/controller headers + * + * @param string $context The name of the context + * @param string $viewsCodeName The view or views name + * + * @return string The php to place in the header + * + */ + public function setClassHeaders($context, $viewsCodeName) { // set the defaults $headers = array(); - switch($context) + switch ($context) { case 'admin.view.model': case 'site.admin.view.model': @@ -20947,6 +22135,34 @@ class Interpretation extends Fields $headers[] = 'use Joomla\String\StringHelper;'; $headers[] = 'use Joomla\Utilities\ArrayHelper;'; break; + case 'admin.view': + case 'custom.admin.view': + case 'custom.admin.views': + case 'site.admin.view': + $headers[] + = 'JHtml::addIncludePath(JPATH_COMPONENT.\'/helpers/html\');'; + $headers[] = 'JHtml::_(\'behavior.tooltip\');'; + $headers[] = 'JHtml::_(\'behavior.formvalidation\');'; + $headers[] = 'JHtml::_(\'formbehavior.chosen\', \'select\');'; + $headers[] = 'JHtml::_(\'behavior.keepalive\');'; + if ($context === 'site.admin.view') + { + $headers[] = 'JHtml::_(\'behavior.tabstate\');'; + $headers[] = 'JHtml::_(\'behavior.calendar\');'; + } + break; + case 'admin.views': + $headers[] = 'JHtml::_(\'behavior.tooltip\');'; + $headers[] = 'JHtml::_(\'behavior.multiselect\');'; + $headers[] = 'JHtml::_(\'dropdown.init\');'; + // add more headers if the new filter option is used + $this->setChosenMultiSelectionHeaders($headers, $viewsCodeName); + $headers[] = 'JHtml::_(\'formbehavior.chosen\', \'select\');'; + break; + case 'site.view': + case 'site.views': + $headers = array(); + break; default: $headers[] = 'use Joomla\Utilities\ArrayHelper;'; break; @@ -20954,14 +22170,122 @@ class Interpretation extends Fields // Trigger Event: jcb_ce_setClassHeader $this->triggerEvent( 'jcb_ce_setClassHeader', - array(&$this->componentContext, &$context, &$viewName, + array(&$this->componentContext, &$context, &$viewsCodeName, &$headers) ); - // return the headers - return implode(PHP_EOL, $headers); + // check if headers were added + if (ComponentbuilderHelper::checkArray($headers)) + { + // return the headers + return implode(PHP_EOL, $headers); + } + + return ''; } - protected function setModelFieldRelation($item, $viewName_list, $tab) + /** + * Build chosen multi selection headers for the view + * + * @param array $headers The headers array + * @param string $nameListCode The list view name + * + * @return void + * + */ + protected function setChosenMultiSelectionHeaders(&$headers, $nameListCode) + { + // check that the filter type is the new filter option (2 = topbar) + if (isset($this->adminFilterType[$nameListCode]) + && $this->adminFilterType[$nameListCode] == 2) + { + // add category switch + $add_category = false; + if (isset($this->categoryBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->categoryBuilder[$nameListCode] + ) + && isset($this->categoryBuilder[$nameListCode]['extension'])) + { + // is found so add it + $add_category = true; + } + // add accessLevels switch + $add_access_levels = false; + if (in_array($nameListCode, $this->accessBuilder)) + { + // is found so add it + $add_access_levels = true; + } + // check if this view have filters + if (isset($this->filterBuilder[$nameListCode]) + && ComponentbuilderHelper::checkArray( + $this->filterBuilder[$nameListCode] + )) + { + foreach ($this->filterBuilder[$nameListCode] as $filter) + { + // we need this only for filters that are multi + if (isset($filter['multi']) + && $filter['multi'] == 2) + { + // add the header + $headers[] + = 'JHtml::_(\'formbehavior.chosen\', \'.multiple' + . $filter['class'] + . '\', null, array(\'placeholder_text_multiple\' => \'- \' . JText::_(\'' + . $filter['lang_select'] . '\') . \' -\'));'; + // check if this was an access field + if ($filter['type'] === 'accesslevel') + { + // already added here so no need to add again + $add_access_levels = false; + } + } + elseif ($add_category && $filter['type'] === 'category') + { + // add the header + $headers[] + = 'JHtml::_(\'formbehavior.chosen\', \'.multipleCategories' + . '\', null, array(\'placeholder_text_multiple\' => \'- \' . JText::_(\'' + . $filter['lang_select'] . '\') . \' -\'));'; + // already added here so no need to add again + $add_category = false; + } + } + } + // add category if not already added + if ($add_category) + { + // add the header + $headers[] + = 'JHtml::_(\'formbehavior.chosen\', \'.multipleCategories' + . '\', null, array(\'placeholder_text_multiple\' => \'- \' . JText::_(\'' + . $this->categoryBuilder[$nameListCode]['name'] + . '\') . \' -\'));'; + } + // add accessLevels if not already added + if ($add_access_levels) + { + // set the language strings for selection + $filter_name_select = 'Select Access'; + $filter_name_select_lang = $this->langPrefix . '_FILTER_' + . ComponentbuilderHelper::safeString( + $filter_name_select, 'U' + ); + // and to translation + $this->setLangContent( + $this->lang, $filter_name_select_lang, $filter_name_select + ); + // add the header + $headers[] + = 'JHtml::_(\'formbehavior.chosen\', \'.multipleAccessLevels' + . '\', null, array(\'placeholder_text_multiple\' => \'- \' . JText::_(\'' + . $filter_name_select_lang . '\') . \' -\'));'; + } + } + } + + protected function setModelFieldRelation($item, $nameListCode, $tab) { $fix = ''; // set fields @@ -20978,7 +22302,7 @@ class Interpretation extends Fields foreach ($item['joinfields'] as $join) { $field['$item->{' . (int) $join . '}'] = '$item->' - . $this->listJoinBuilder[$viewName_list][(int) $join]['code']; + . $this->listJoinBuilder[$nameListCode][(int) $join]['code']; } } // set based on join_type @@ -21129,15 +22453,16 @@ class Interpretation extends Fields return $fix; } - public function setRouterCase($viewName) + public function setRouterCase($viewsCodeName) { - if (strlen($viewName) > 0) + if (strlen($viewsCodeName) > 0) { - $router = PHP_EOL . $this->_t(2) . "case '" . $viewName . "':"; + $router = PHP_EOL . $this->_t(2) . "case '" . $viewsCodeName . "':"; $router .= PHP_EOL . $this->_t(3) - . "\$id = explode(':', \$segments[$count-1]);"; + . "\$id = explode(':', \$segments[\$count-1]);"; $router .= PHP_EOL . $this->_t(3) . "\$vars['id'] = (int) \$id[0];"; - $router .= PHP_EOL . $this->_t(3) . "\$vars['view'] = '" . $viewName + $router .= PHP_EOL . $this->_t(3) . "\$vars['view'] = '" + . $viewsCodeName . "';"; $router .= PHP_EOL . $this->_t(2) . "break;"; @@ -21317,8 +22642,10 @@ class Interpretation extends Fields if (!in_array($otherViews, $catArray)) { // set the extension key string, new convention (more stable) - $_key_extension = str_replace('.', '_po0O0oq_', - $this->categoryBuilder[$name_list]['extension']); + $_key_extension = str_replace( + '.', '_po0O0oq_', + $this->categoryBuilder[$name_list]['extension'] + ); // add to lang $langKey = $this->langPrefix . '_DASHBOARD_' @@ -21352,7 +22679,8 @@ class Interpretation extends Fields else { $icons .= ", '" . $type . $otherViews . "." - . $catCode . '_qpo0O0oqp_' . $_key_extension . "'"; + . $catCode . '_qpo0O0oqp_' . $_key_extension + . "'"; } $counter++; // make sure we add a category only once @@ -22491,9 +23819,9 @@ class Interpretation extends Fields )) { // set component code name - $component = $this->componentCodeName; - $viewName = 'config'; - $listViewName = 'configs'; + $component = $this->componentCodeName; + $nameSingleCode = 'config'; + $nameListCode = 'configs'; // set place holders $placeholders = array(); $placeholders[$this->hhh . 'component' . $this->hhh] @@ -22507,9 +23835,9 @@ class Interpretation extends Fields $this->componentData->name_code, 'U' ); $placeholders[$this->hhh . 'view' . $this->hhh] - = $viewName; + = $nameSingleCode; $placeholders[$this->hhh . 'views' . $this->hhh] - = $listViewName; + = $nameListCode; $placeholders[$this->bbb . 'component' . $this->ddd] = $this->componentCodeName; $placeholders[$this->bbb . 'Component' . $this->ddd] @@ -22519,9 +23847,9 @@ class Interpretation extends Fields = $placeholders[$this->hhh . 'COMPONENT' . $this->hhh]; $placeholders[$this->bbb . 'view' . $this->ddd] - = $viewName; + = $nameSingleCode; $placeholders[$this->bbb . 'views' . $this->ddd] - = $listViewName; + = $nameListCode; // load the global placeholders if (ComponentbuilderHelper::checkArray( $this->globalPlaceholders @@ -22551,35 +23879,12 @@ class Interpretation extends Fields // build the config fields foreach ($this->componentData->config as $field) { - // check the field builder type - if ($this->fieldBuilderType == 1) - { - // string manipulation - $xmlField = $this->setDynamicField( - $field, $view, $viewType, $lang, $viewName, - $listViewName, $placeholders, $dbkey, false - ); - } - else - { - // simpleXMLElement class - $newxmlField = $this->setDynamicField( - $field, $view, $viewType, $lang, $viewName, - $listViewName, $placeholders, $dbkey, false - ); - if (isset($newxmlField->fieldXML)) - { - $xmlField = dom_import_simplexml( - $newxmlField->fieldXML - ); - $xmlField = PHP_EOL . $this->_t(1) . "' . PHP_EOL - . $this->_t(1) . $this->xmlPrettyPrint( - $xmlField, 'field' - ); - } - } + // get the xml string + $xmlField = $this->getFieldXMLString( + $field, $view, $viewType, $lang, $nameSingleCode, + $nameListCode, $placeholders, $dbkey, false + ); + // make sure the xml is set and a string if (isset($xmlField) && ComponentbuilderHelper::checkString( @@ -25331,14 +26636,14 @@ function vdm_dkim() { } } - public function setAccessSectionsCategory($viewName_single, $viewName_list) - { + public function setAccessSectionsCategory($nameSingleCode, $nameListCode + ) { $component = ''; // check if view has category - if (array_key_exists($viewName_single, $this->catCodeBuilder)) + if (array_key_exists($nameSingleCode, $this->catCodeBuilder)) { - $otherViews = $this->catCodeBuilder[$viewName_single]['views']; - if ($otherViews == $viewName_list) + $otherViews = $this->catCodeBuilder[$nameSingleCode]['views']; + if ($otherViews == $nameListCode) { $component .= PHP_EOL . $this->_t(1) . '
'; @@ -25393,6 +26698,8 @@ function vdm_dkim() { public function setAccessSections() { + // access size counter + $this->accessSize = 12; // ;) // set the default component access values $this->componentHead = array(); $this->componentGlobal = array(); @@ -25427,7 +26734,8 @@ function vdm_dkim() { $this->componentHead[] = $this->_t(2) . ''; - + // the size needs increase + $this->accessSize++; $importTitle = $this->langPrefix . '_' . ComponentbuilderHelper::safeString('Import Data', 'U'); $importDesc = $this->langPrefix . '_' @@ -25441,6 +26749,8 @@ function vdm_dkim() { $this->componentHead[] = $this->_t(2) . ''; + // the size needs increase + $this->accessSize++; } // version permission $batchTitle = $this->langPrefix . '_' @@ -25485,6 +26795,8 @@ function vdm_dkim() { { $this->componentHead[] = $this->_t(2) . ' '; + // the size needs increase + $this->accessSize++; } // new custom created by permissions $created_byTitle = $this->langPrefix . '_' @@ -25555,6 +26867,8 @@ function vdm_dkim() { . ''; + // the size needs increase + $this->accessSize++; // add the custom permissions to use the buttons of this view $this->addCustomButtonPermissions( $custom_admin_view['settings'], $customAdminName, @@ -25638,7 +26952,8 @@ function vdm_dkim() { $this->componentGlobal[$sortKey] = $this->_t(2) . ''; - + // the size needs increase + $this->accessSize++; // check if this site view requires access rule to default to public if (isset($site_view['public_access']) && $site_view['public_access'] == 1) @@ -25686,6 +27001,8 @@ function vdm_dkim() { . $_customTab['lang_permission'] . '" description="' . $_customTab['lang_permission_desc'] . '" />'; + // the size needs increase + $this->accessSize++; } } } @@ -25834,10 +27151,10 @@ function vdm_dkim() { // set the views permissions now if (ComponentbuilderHelper::checkArray($this->permissionViews)) { - foreach ($this->permissionViews as $viewName => $actions) + foreach ($this->permissionViews as $viewsCodeName => $actions) { $componentViews[] = $this->_t(1) . '
'; + . $viewsCodeName . '">'; foreach ($actions as $action) { $componentViews[] = $this->_t(2) . $action; @@ -25852,13 +27169,32 @@ function vdm_dkim() { // add global to the compnent section $component .= PHP_EOL . implode(PHP_EOL, $this->componentGlobal) . PHP_EOL . $this->_t(1) . "
"; - // add views to the compnent section + // add views to the component section $component .= PHP_EOL . implode(PHP_EOL, $componentViews); // be sure to reset again. (memory) $this->componentHead = null; $this->componentGlobal = null; $this->permissionViews = null; + // remove the fix, is not needed + if ($this->accessSize < 30) + { + // since we have less than 30 actions + // we do not need the fix for this component + $this->addAssetsTableFix = 0; + } + else + { + // get the worse case column size required (can be worse I know) + // access/action size x 20 characters x 8 groups + $character_length = (int) ComponentbuilderHelper::bcmath( + 'mul', $this->accessSize, 20, 0 + ); + $this->accessWorseCase = (int) ComponentbuilderHelper::bcmath( + 'mul', $character_length, 8, 0 + ); + } + // return the build return $component; } @@ -25905,6 +27241,8 @@ function vdm_dkim() { . ''; + // the size needs increase + $this->accessSize++; } } } @@ -26243,6 +27581,8 @@ function vdm_dkim() { $this->componentGlobal[$sortKey] = $this->_t(2) . ''; + // the size needs increase + $this->accessSize++; // build permission switch $this->permissionBuilder['global'][$action][$nameView] = $nameView; @@ -26291,6 +27631,8 @@ function vdm_dkim() { $this->componentGlobal[$sortKey] = $this->_t(2) . ''; + // the size needs increase + $this->accessSize++; // build permission switch $this->permissionBuilder['global'][$action][$nameView] = $nameView; @@ -26378,10 +27720,26 @@ function vdm_dkim() { return $_helper . PHP_EOL . $code . PHP_EOL; } - public function getModDefault(&$module) + public function getModDefault(&$module, &$key) { - return PHP_EOL . $module->default_header . PHP_EOL . '?>' . PHP_EOL - . $module->default . PHP_EOL; + // first add the header + $default = PHP_EOL . $module->default_header . PHP_EOL . '?>'; + // add any css from the fields + $default .= $this->getCustomScriptBuilder( + 'css_views', $key, PHP_EOL . '' . PHP_EOL + ); + // now add the body + $default .= PHP_EOL . $module->default . PHP_EOL; + // add any JavaScript from the fields + $default .= $this->getCustomScriptBuilder( + 'views_footer', $key, + PHP_EOL . '' . PHP_EOL + ); + + // return the default content for the model default area + return $default; } public function getModHelperCode(&$module) @@ -26467,6 +27825,7 @@ function vdm_dkim() { $module->config_fields )) { + $add_scripts_field = true; foreach ($module->config_fields as $field_name => $fieldsets) { foreach ($fieldsets as $fieldset => $fields) @@ -26475,6 +27834,15 @@ function vdm_dkim() { $xmlFields = $this->getExtensionFieldsetXML( $module, $fields, $dbkey ); + // check if the custom script field must be set + if ($add_scripts_field && $module->add_scripts_field) + { + // get the custom script field + $xmlFields .= PHP_EOL . $this->_t(2) + . ""; + // don't add it again + $add_scripts_field = false; + } // make sure the xml is set and a string if (isset($xmlFields) && ComponentbuilderHelper::checkString($xmlFields)) @@ -26611,7 +27979,7 @@ function vdm_dkim() { $xml .= PHP_EOL . $this->_t(2) . ''; $xml .= PHP_EOL . $this->_t(3) . 'sql/mysql/install.sql'; - $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; $xml .= PHP_EOL . $this->_t(1) . ''; } // should the sql uninstall be added @@ -26624,7 +27992,7 @@ function vdm_dkim() { $xml .= PHP_EOL . $this->_t(2) . ''; $xml .= PHP_EOL . $this->_t(3) . 'sql/mysql/uninstall.sql'; - $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; $xml .= PHP_EOL . $this->_t(1) . ''; } // should the language xml be added @@ -26744,10 +28112,12 @@ function vdm_dkim() { if ($module->target == 2) { $xml .= PHP_EOL . $this->_t(2) - . 'addrulepath="/administrator/modules/' . $module->file_name + . 'addrulepath="/administrator/modules/' + . $module->file_name . '/rules"'; $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/administrator/modules/' . $module->file_name + . 'addfieldpath="/administrator/modules/' + . $module->file_name . '/fields"'; } else @@ -26970,7 +28340,7 @@ function vdm_dkim() { $xml .= PHP_EOL . $this->_t(2) . ''; $xml .= PHP_EOL . $this->_t(3) . 'sql/mysql/install.sql'; - $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; $xml .= PHP_EOL . $this->_t(1) . ''; } // should the sql uninstall be added @@ -26983,7 +28353,7 @@ function vdm_dkim() { $xml .= PHP_EOL . $this->_t(2) . ''; $xml .= PHP_EOL . $this->_t(3) . 'sql/mysql/uninstall.sql'; - $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; $xml .= PHP_EOL . $this->_t(1) . ''; } // should the language xml be added @@ -27149,61 +28519,23 @@ function vdm_dkim() { return $xml; } + /** + * build field set for an extention + * + * @param object $extension The extention object + * @param array $fields The fields to build + * @param string $dbkey The database key + * + * @return string The fields set in xml + * + */ public function getExtensionFieldsetXML(&$extension, &$fields, $dbkey = 'zz' ) { - // set some defaults - $view = ''; - $viewType = 0; // build the fieldset - $fieldset = ''; - - if (ComponentbuilderHelper::checkArray($fields)) - { - foreach ($fields as $field) - { - // check the field builder type - if ($this->fieldBuilderType == 1) - { - // string manipulation - $xmlField = $this->setDynamicField( - $field, $view, $viewType, $extension->lang_prefix, - $extension->key, $extension->key, - $this->globalPlaceholders, $dbkey, false - ); - } - else - { - // simpleXMLElement class - $newxmlField = $this->setDynamicField( - $field, $view, $viewType, $extension->lang_prefix, - $extension->key, $extension->key, - $this->globalPlaceholders, $dbkey, false - ); - if (isset($newxmlField->fieldXML)) - { - $xmlField = dom_import_simplexml( - $newxmlField->fieldXML - ); - $xmlField = PHP_EOL . $this->_t(2) . "' . PHP_EOL - . $this->_t(1) . $this->xmlPrettyPrint( - $xmlField, 'field' - ); - } - } - // make sure the xml is set and a string - if (isset($xmlField) - && ComponentbuilderHelper::checkString( - $xmlField - )) - { - $fieldset .= $xmlField; - } - } - } - - return $fieldset; + return $this->getFieldsetXML( + $fields, $extension->lang_prefix, $extension->key, $extension->key, + $this->globalPlaceholders, $dbkey + ); } public function getExtensionInstallClass(&$extension) diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index c2afe4063..300bde63a 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -13,7 +13,7 @@ defined('_JEXEC') or die('Restricted access'); /** - * Interpretation class + * Infusion class */ class Infusion extends Interpretation { @@ -365,25 +365,10 @@ class Infusion extends Interpretation // set the target $this->target = 'admin'; $this->lang = 'admin'; - // reset - $viewName_single = ''; - $viewName_list = ''; - // set single view - if (isset($view['settings']->name_single)) - { - $viewName_single = ComponentbuilderHelper::safeString( - $view['settings']->name_single - ); - } - - // set list view - if (isset($view['settings']->name_list)) - { - $viewName_list = ComponentbuilderHelper::safeString( - $view['settings']->name_list - ); - } + // set local names + $nameSingleCode = $view['settings']->name_single_code; + $nameListCode = $view['settings']->name_list_code; // set the view placeholders $this->setViewPlaceholders($view['settings']); @@ -396,57 +381,68 @@ class Infusion extends Interpretation && $view['edit_create_site_view'] > 0) { $site_edit_view_array[] = $this->_t(4) . "'" - . $viewName_single . "'"; + . $nameSingleCode . "'"; $this->lang = 'both'; // insure site view does not get removed $this->removeSiteEditFolder = false; } // check if help is being loaded - $this->checkHelp($viewName_single); + $this->checkHelp($nameSingleCode); // set custom admin view list links - $this->setCustomAdminViewListLink($view, $viewName_list); + $this->setCustomAdminViewListLink( + $view, $nameListCode + ); // set view array - $viewarray[] = $this->_t(4) . "'" . $viewName_single . "' => '" - . $viewName_list . "'"; + $viewarray[] = $this->_t(4) . "'" + . $nameSingleCode . "' => '" + . $nameListCode . "'"; // set the view names if (isset($view['settings']->name_single) && $view['settings']->name_single != 'null') { // set license per view if needed - $this->setLockLicensePer($viewName_single, $this->target); - $this->setLockLicensePer($viewName_list, $this->target); + $this->setLockLicensePer( + $nameSingleCode, $this->target + ); + $this->setLockLicensePer( + $nameListCode, $this->target + ); // Trigger Event: jcb_ce_onBeforeBuildAdminEditViewContent $this->triggerEvent( 'jcb_ce_onBeforeBuildAdminEditViewContent', array(&$this->componentContext, &$view, - &$viewName_single, &$viewName_list, + &$nameSingleCode, + &$nameListCode, &$this->fileContentStatic, - &$this->fileContentDynamic[$viewName_single], + &$this->fileContentDynamic[$nameSingleCode], &$this->placeholders, &$this->hhh) ); // FIELDSETS <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'FIELDSETS' . $this->hhh] = $this->setFieldSet( - $view, $this->componentCodeName, $viewName_single, - $viewName_list + $view, $this->componentCodeName, + $nameSingleCode, + $nameListCode ); // ACCESSCONTROL <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'ACCESSCONTROL' . $this->hhh] - = $this->setFieldSetAccessControl($viewName_single); + = $this->setFieldSetAccessControl( + $nameSingleCode + ); // LINKEDVIEWITEMS <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWITEMS' . $this->hhh] = ''; // ADDTOOLBAR <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'ADDTOOLBAR' . $this->hhh] = $this->setAddToolBar($view); @@ -454,29 +450,34 @@ class Infusion extends Interpretation $this->buildTheViewScript($view); // VIEW_SCRIPT - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'VIEW_SCRIPT' . $this->hhh] - = $this->setViewScript($viewName_single, 'fileScript'); + = $this->setViewScript( + $nameSingleCode, 'fileScript' + ); // EDITBODYSCRIPT - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'EDITBODYSCRIPT' . $this->hhh] = $this->setViewScript( - $viewName_single, 'footerScript' + $nameSingleCode, 'footerScript' ); // AJAXTOKE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'AJAXTOKE' . $this->hhh] - = $this->setAjaxToke($viewName_single); + = $this->setAjaxToke( + $nameSingleCode + ); // DOCUMENT_CUSTOM_PHP <<>> if ($phpDocument = $this->getCustomScriptBuilder( - 'php_document', $viewName_single, PHP_EOL, null, true, + 'php_document', $nameSingleCode, + PHP_EOL, null, true, false )) { - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'DOCUMENT_CUSTOM_PHP' . $this->hhh] = str_replace( '$document->', '$this->document->', $phpDocument @@ -486,111 +487,127 @@ class Infusion extends Interpretation } else { - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'DOCUMENT_CUSTOM_PHP' . $this->hhh] = ''; } // LINKEDVIEWTABLESCRIPTS <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWTABLESCRIPTS' . $this->hhh] = ''; // VALIDATEFIX <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'VALIDATIONFIX' . $this->hhh] = $this->setValidationFix( - $viewName_single, + $nameSingleCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] ); // EDITBODY <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'EDITBODY' . $this->hhh] = $this->setEditBody($view); - // EDITBODY <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + // EDITBODYFADEIN <<>> + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'EDITBODYFADEIN' . $this->hhh] = $this->setFadeInEfect($view); // JTABLECONSTRUCTOR <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JTABLECONSTRUCTOR' . $this->hhh] - = $this->setJtableConstructor($viewName_single); + = $this->setJtableConstructor( + $nameSingleCode + ); // JTABLEALIASCATEGORY <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JTABLEALIASCATEGORY' . $this->hhh] - = $this->setJtableAliasCategory($viewName_single); + = $this->setJtableAliasCategory( + $nameSingleCode + ); // METHOD_GET_ITEM <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'METHOD_GET_ITEM' . $this->hhh] - = $this->setMethodGetItem($viewName_single); + = $this->setMethodGetItem( + $nameSingleCode + ); // LINKEDVIEWGLOBAL <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWGLOBAL' . $this->hhh] = ''; // LINKEDVIEWMETHODS <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'LINKEDVIEWMETHODS' . $this->hhh] = ''; // JMODELADMIN_BEFORE_DELETE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JMODELADMIN_BEFORE_DELETE' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_before_delete', $viewName_single, PHP_EOL + 'php_before_delete', + $nameSingleCode, PHP_EOL ); // JMODELADMIN_AFTER_DELETE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JMODELADMIN_AFTER_DELETE' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_after_delete', $viewName_single, PHP_EOL . PHP_EOL + 'php_after_delete', $nameSingleCode, + PHP_EOL . PHP_EOL ); // JMODELADMIN_BEFORE_DELETE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JMODELADMIN_BEFORE_PUBLISH' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_before_publish', $viewName_single, PHP_EOL + 'php_before_publish', + $nameSingleCode, PHP_EOL ); // JMODELADMIN_AFTER_DELETE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JMODELADMIN_AFTER_PUBLISH' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_after_publish', $viewName_single, PHP_EOL . PHP_EOL + 'php_after_publish', + $nameSingleCode, PHP_EOL . PHP_EOL ); // CHECKBOX_SAVE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'CHECKBOX_SAVE' . $this->hhh] - = $this->setCheckboxSave($viewName_single); + = $this->setCheckboxSave( + $nameSingleCode + ); // METHOD_ITEM_SAVE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'METHOD_ITEM_SAVE' . $this->hhh] - = $this->setMethodItemSave($viewName_single); + = $this->setMethodItemSave( + $nameSingleCode + ); // POSTSAVEHOOK <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'POSTSAVEHOOK' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_postsavehook', $viewName_single, PHP_EOL, null, + 'php_postsavehook', $nameSingleCode, + PHP_EOL, null, true, PHP_EOL . $this->_t(2) . "return;", PHP_EOL . PHP_EOL . $this->_t(2) . "return;" ); // VIEWCSS <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'VIEWCSS' . $this->hhh] = $this->getCustomScriptBuilder( - 'css_view', $viewName_single, '', null, true + 'css_view', $nameSingleCode, '', + null, true ); // add css to front end @@ -600,59 +617,78 @@ class Infusion extends Interpretation ) && $view['edit_create_site_view'] > 0) { - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'SITE_VIEWCSS' . $this->hhh] - = $this->fileContentDynamic[$viewName_single][$this->hhh + = $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'VIEWCSS' . $this->hhh]; // check if we should add a create menu if ($view['edit_create_site_view'] == 2) { // SITE_MENU_XML <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'SITE_MENU_XML' . $this->hhh] = $this->setAdminViewMenu( - $viewName_single, $view + $nameSingleCode, $view ); } - // SITE_VIEW_CONTROLLER_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$viewName_single][$this->hhh + // SITE_ADMIN_VIEW_CONTROLLER_HEADER <<>> add the header details for the controller + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'SITE_ADMIN_VIEW_CONTROLLER_HEADER' . $this->hhh] = $this->setClassHeaders( - 'site.admin.view.controller', $viewName_single + 'site.admin.view.controller', + $nameSingleCode ); // SITE_ADMIN_VIEW_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'SITE_ADMIN_VIEW_MODEL_HEADER' . $this->hhh] = $this->setClassHeaders( - 'site.admin.view.model', $viewName_single + 'site.admin.view.model', + $nameSingleCode + ); + // SITE_ADMIN_VIEW_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$nameSingleCode][$this->hhh + . 'SITE_ADMIN_VIEW_HEADER' . $this->hhh] + = $this->setClassHeaders( + 'site.admin.view', + $nameSingleCode ); } // TABLAYOUTFIELDSARRAY <<>> add the tab layout fields array to the model - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'TABLAYOUTFIELDSARRAY' . $this->hhh] - = $this->getTabLayoutFieldsArray($viewName_single); + = $this->getTabLayoutFieldsArray( + $nameSingleCode + ); - // ADMIN_VIEW_CONTROLLER_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$viewName_single][$this->hhh + // ADMIN_VIEW_CONTROLLER_HEADER <<>> add the header details for the controller + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'ADMIN_VIEW_CONTROLLER_HEADER' . $this->hhh] = $this->setClassHeaders( - 'admin.view.controller', $viewName_single + 'admin.view.controller', + $nameSingleCode ); // ADMIN_VIEW_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'ADMIN_VIEW_MODEL_HEADER' . $this->hhh] = $this->setClassHeaders( - 'admin.view.model', $viewName_single + 'admin.view.model', $nameSingleCode + ); + // ADMIN_VIEW_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$nameSingleCode][$this->hhh + . 'ADMIN_VIEW_HEADER' . $this->hhh] + = $this->setClassHeaders( + 'admin.view', $nameSingleCode ); // Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent $this->triggerEvent( 'jcb_ce_onAfterBuildAdminEditViewContent', array(&$this->componentContext, &$view, - &$viewName_single, &$viewName_list, + &$nameSingleCode, + &$nameListCode, &$this->fileContentStatic, - &$this->fileContentDynamic[$viewName_single], + &$this->fileContentDynamic[$nameSingleCode], &$this->placeholders, &$this->hhh) ); } @@ -663,7 +699,7 @@ class Infusion extends Interpretation $this->lang = 'admin'; // ICOMOON <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ICOMOON' . $this->hhh] = $view['icomoon']; @@ -671,9 +707,10 @@ class Infusion extends Interpretation $this->triggerEvent( 'jcb_ce_onBeforeBuildAdminListViewContent', array(&$this->componentContext, &$view, - &$viewName_single, &$viewName_list, + &$nameSingleCode, + &$nameListCode, &$this->fileContentStatic, - &$this->fileContentDynamic[$viewName_list], + &$this->fileContentDynamic[$nameListCode], &$this->placeholders, &$this->hhh) ); @@ -681,117 +718,131 @@ class Infusion extends Interpretation if (isset($view['port']) && $view['port'] || 1 == $view['settings']->add_custom_import) { - $this->eximportView[$viewName_list] = true; + $this->eximportView[$nameListCode] + = true; if (1 == $view['settings']->add_custom_import) { // this view has custom import scripting - $this->importCustomScripts[$viewName_list] = true; + $this->importCustomScripts[$nameListCode] + = true; // set all custom scripts - $this->setImportCustomScripts($viewName_list); + $this->setImportCustomScripts( + $nameListCode + ); } } else { - $this->eximportView[$viewName_list] = false; + $this->eximportView[$nameListCode] + = false; } // set Auto check in function if (isset($view['checkin']) && $view['checkin'] == 1) { // AUTOCHECKIN <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'AUTOCHECKIN' . $this->hhh] = $this->setAutoCheckin( - $viewName_single, $this->componentCodeName + $nameSingleCode, + $this->componentCodeName ); // CHECKINCALL <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'CHECKINCALL' . $this->hhh] = $this->setCheckinCall(); } else { // AUTOCHECKIN <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'AUTOCHECKIN' . $this->hhh] = ''; // CHECKINCALL <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'CHECKINCALL' . $this->hhh] = ''; } // admin list file contnet - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_JAVASCRIPT_FILE' . $this->hhh] = $this->setViewScript( - $viewName_list, 'list_fileScript' + $nameListCode, 'list_fileScript' ); // ADMIN_CUSTOM_BUTTONS_LIST - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_CUSTOM_BUTTONS_LIST' . $this->hhh] = $this->setCustomButtons($view, 3, $this->_t(1)); - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST' . $this->hhh] - = $this->setFunctionOnlyButtons($viewName_list); + = $this->setFunctionOnlyButtons( + $nameListCode + ); // GET_ITEMS_METHOD_STRING_FIX <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'GET_ITEMS_METHOD_STRING_FIX' . $this->hhh] = $this->setGetItemsMethodStringFix( - $viewName_single, $viewName_list, + $nameSingleCode, + $nameListCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] ); // GET_ITEMS_METHOD_AFTER_ALL <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'GET_ITEMS_METHOD_AFTER_ALL' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_getitems_after_all', $viewName_single, PHP_EOL + 'php_getitems_after_all', + $nameSingleCode, PHP_EOL ); // SELECTIONTRANSLATIONFIX <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'SELECTIONTRANSLATIONFIX' . $this->hhh] = $this->setSelectionTranslationFix( - $viewName_list, + $nameListCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] ); // SELECTIONTRANSLATIONFIXFUNC <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'SELECTIONTRANSLATIONFIXFUNC' . $this->hhh] = $this->setSelectionTranslationFixFunc( - $viewName_list, + $nameListCode, $this->fileContentStatic[$this->hhh . 'Component' . $this->hhh] ); // FILTER_FIELDS <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'FILTER_FIELDS' . $this->hhh] - = $this->setFilterFields($viewName_list); + = $this->setFilterFieldsArray( + $nameSingleCode, + $nameListCode + ); // STOREDID <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'STOREDID' . $this->hhh] - = $this->setStoredId($viewName_list); + = $this->setStoredId( + $nameSingleCode, $nameListCode + ); // POPULATESTATE <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'POPULATESTATE' . $this->hhh] - = $this->setPopulateState($viewName_list); + = $this->setPopulateState( + $nameSingleCode, $nameListCode + ); // SORTFIELDS <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'SORTFIELDS' . $this->hhh] - = $this->setSortFields($viewName_list); - - // CATEGORYFILTER <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh - . 'CATEGORYFILTER' . $this->hhh] - = $this->setCategoryFilter($viewName_list); + = $this->setSortFields( + $nameListCode + ); // CATEGORY_VIEWS if (!isset( @@ -806,95 +857,156 @@ class Infusion extends Interpretation $this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh] .= $this->setRouterCategoryViews( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); - // OTHERFILTERS <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh - . 'OTHERFILTERS' . $this->hhh] - = $this->setOtherFilter($viewName_list); + // FILTERFIELDDISPLAYHELPER <<>> + $this->fileContentDynamic[$nameListCode][$this->hhh + . 'FILTERFIELDDISPLAYHELPER' . $this->hhh] + = $this->setFilterFieldSidebarDisplayHelper( + $nameSingleCode, + $nameListCode + ); + + // BATCHDISPLAYHELPER <<>> + $this->fileContentDynamic[$nameListCode][$this->hhh + . 'BATCHDISPLAYHELPER' . $this->hhh] + = $this->setBatchDisplayHelper( + $nameSingleCode, + $nameListCode + ); // FILTERFUNCTIONS <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'FILTERFUNCTIONS' . $this->hhh] - = $this->setFilterFunctions( - $viewName_single, $viewName_list + = $this->setFilterFieldHelper( + $nameSingleCode, + $nameListCode + ); + + // FIELDFILTERSETS <<>> + $this->fileContentDynamic['filter_' + . $nameListCode][$this->hhh + . 'FIELDFILTERSETS' . $this->hhh] + = $this->setFieldFilterSet( + $nameSingleCode, + $nameListCode + ); + + // FIELDLISTSETS <<>> + $this->fileContentDynamic['filter_' + . $nameListCode][$this->hhh + . 'FIELDLISTSETS' . $this->hhh] + = $this->setFieldFilterListSet( + $nameSingleCode, + $nameListCode ); // LISTQUERY <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'LISTQUERY' . $this->hhh] - = $this->setListQuery($viewName_single, $viewName_list); + = $this->setListQuery( + $nameSingleCode, + $nameListCode + ); // MODELEXPORTMETHOD <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'MODELEXPORTMETHOD' . $this->hhh] = $this->setGetItemsModelMethod( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // MODELEXIMPORTMETHOD <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'CONTROLLEREXIMPORTMETHOD' . $this->hhh] = $this->setControllerEximportMethod( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // EXPORTBUTTON <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'EXPORTBUTTON' . $this->hhh] = $this->setExportButton( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // IMPORTBUTTON <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'IMPORTBUTTON' . $this->hhh] = $this->setImportButton( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode + ); + + // VIEWS_DEFAULT_BODY <<>> + $this->fileContentDynamic[$nameListCode][$this->hhh + . 'VIEWS_DEFAULT_BODY' . $this->hhh] + = $this->setDefaultViewsBody( + $nameSingleCode, + $nameListCode ); // LISTHEAD <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'LISTHEAD' . $this->hhh] - = $this->setListHead($viewName_single, $viewName_list); + = $this->setListHead( + $nameSingleCode, + $nameListCode + ); // LISTBODY <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'LISTBODY' . $this->hhh] - = $this->setListBody($viewName_single, $viewName_list); + = $this->setListBody( + $nameSingleCode, + $nameListCode + ); // LISTCOLNR <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'LISTCOLNR' . $this->hhh] - = $this->setListColnr($viewName_list); + = $this->setListColnr( + $nameListCode + ); // JVIEWLISTCANDO <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'JVIEWLISTCANDO' . $this->hhh] = $this->setJviewListCanDo( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // VIEWSCSS <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'VIEWSCSS' . $this->hhh] = $this->getCustomScriptBuilder( - 'css_views', $viewName_single, '', null, true + 'css_views', $nameSingleCode, '', + null, true ); // ADMIN_DIPLAY_METHOD <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_DIPLAY_METHOD' . $this->hhh] - = $this->setAdminViewDisplayMethod($viewName_list); + = $this->setAdminViewDisplayMethod( + $nameListCode + ); // VIEWS_FOOTER_SCRIPT <<>> $scriptNote = PHP_EOL . '//' . $this->setLine(__LINE__) - . ' ' . $viewName_list . ' footer script'; - if ($footerScript = $this->getCustomScriptBuilder( - 'views_footer', $viewName_single, '', $scriptNote, true, - false, PHP_EOL - )) + . ' ' . $nameListCode + . ' footer script'; + if (($footerScript = $this->getCustomScriptBuilder( + 'views_footer', $nameSingleCode, '', + $scriptNote, true, + false, PHP_EOL + )) !== false + && ComponentbuilderHelper::checkString($footerScript)) { // only minfy if no php is added to the footer script if ($this->minify @@ -907,7 +1019,7 @@ class Infusion extends Interpretation // clear some memory unset($minifier); } - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'VIEWS_FOOTER_SCRIPT' . $this->hhh] = PHP_EOL . '"; @@ -916,138 +1028,164 @@ class Infusion extends Interpretation } else { - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'VIEWS_FOOTER_SCRIPT' . $this->hhh] = ''; } - // ADMIN_VIEWS_CONTROLLER_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$viewName_list][$this->hhh + // ADMIN_VIEWS_CONTROLLER_HEADER <<>> add the header details for the controller + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_VIEWS_CONTROLLER_HEADER' . $this->hhh] = $this->setClassHeaders( - 'admin.views.controller', $viewName_list + 'admin.views.controller', + $nameListCode ); // ADMIN_VIEWS_MODEL_HEADER <<>> add the header details for the model - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'ADMIN_VIEWS_MODEL_HEADER' . $this->hhh] = $this->setClassHeaders( - 'admin.views.model', $viewName_list + 'admin.views.model', $nameListCode + ); + // ADMIN_VIEWS_HEADER <<>> add the header details for the views + $this->fileContentDynamic[$nameListCode][$this->hhh + . 'ADMIN_VIEWS_HEADER' . $this->hhh] + = $this->setClassHeaders( + 'admin.views', $nameListCode ); // Trigger Event: jcb_ce_onAfterBuildAdminListViewContent $this->triggerEvent( 'jcb_ce_onAfterBuildAdminListViewContent', array(&$this->componentContext, &$view, - &$viewName_single, &$viewName_list, + &$nameSingleCode, + &$nameListCode, &$this->fileContentStatic, - &$this->fileContentDynamic[$viewName_list], + &$this->fileContentDynamic[$nameListCode], &$this->placeholders, &$this->hhh) ); } // set u fields used in batch - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'UNIQUEFIELDS' . $this->hhh] - = $this->setUniqueFields($viewName_single); + = $this->setUniqueFields( + $nameSingleCode + ); // TITLEALIASFIX <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'TITLEALIASFIX' . $this->hhh] - = $this->setAliasTitleFix($viewName_single); + = $this->setAliasTitleFix( + $nameSingleCode + ); // GENERATENEWTITLE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'GENERATENEWTITLE' . $this->hhh] - = $this->setGenerateNewTitle($viewName_single); + = $this->setGenerateNewTitle( + $nameSingleCode + ); // GENERATENEWALIAS <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'GENERATENEWALIAS' . $this->hhh] - = $this->setGenerateNewAlias($viewName_single); + = $this->setGenerateNewAlias( + $nameSingleCode + ); // MODEL_BATCH_COPY <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'MODEL_BATCH_COPY' . $this->hhh] - = $this->setBatchCopy($viewName_single); + = $this->setBatchCopy($nameSingleCode); // MODEL_BATCH_MOVE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'MODEL_BATCH_MOVE' . $this->hhh] - = $this->setBatchMove($viewName_single); + = $this->setBatchMove($nameSingleCode); // BATCH_ONCLICK_CANCEL_SCRIPT <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'BATCH_ONCLICK_CANCEL_SCRIPT' . $this->hhh] = ''; // TODO <-- must still be build // JCONTROLLERFORM_ALLOWADD <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JCONTROLLERFORM_ALLOWADD' . $this->hhh] = $this->setJcontrollerAllowAdd( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // JCONTROLLERFORM_BEFORECANCEL <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JCONTROLLERFORM_BEFORECANCEL' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_before_cancel', $viewName_single, PHP_EOL, null, null, + 'php_before_cancel', $nameSingleCode, + PHP_EOL, null, null, '' ); // JCONTROLLERFORM_AFTERCANCEL <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JCONTROLLERFORM_AFTERCANCEL' . $this->hhh] = $this->getCustomScriptBuilder( - 'php_after_cancel', $viewName_single, PHP_EOL, null, null, + 'php_after_cancel', $nameSingleCode, + PHP_EOL, null, null, '' ); // JCONTROLLERFORM_ALLOWEDIT <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JCONTROLLERFORM_ALLOWEDIT' . $this->hhh] = $this->setJcontrollerAllowEdit( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // JMODELADMIN_GETFORM <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JMODELADMIN_GETFORM' . $this->hhh] = $this->setJmodelAdminGetForm( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // JMODELADMIN_ALLOWEDIT <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JMODELADMIN_ALLOWEDIT' . $this->hhh] = $this->setJmodelAdminAllowEdit( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // JMODELADMIN_CANDELETE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JMODELADMIN_CANDELETE' . $this->hhh] = $this->setJmodelAdminCanDelete( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // JMODELADMIN_CANEDITSTATE <<>> - $this->fileContentDynamic[$viewName_single][$this->hhh + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'JMODELADMIN_CANEDITSTATE' . $this->hhh] = $this->setJmodelAdminCanEditState( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // set custom admin view Toolbare buttons // CUSTOM_ADMIN_DYNAMIC_BUTTONS <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'CUSTOM_ADMIN_DYNAMIC_BUTTONS' . $this->hhh] - = $this->setCustomAdminDynamicButton($viewName_list); + = $this->setCustomAdminDynamicButton( + $nameListCode + ); // CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh + $this->fileContentDynamic[$nameListCode][$this->hhh . 'CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER' . $this->hhh] = $this->setCustomAdminDynamicButtonController( - $viewName_list + $nameListCode ); // set helper router @@ -1062,7 +1200,10 @@ class Infusion extends Interpretation } $this->fileContentStatic[$this->hhh . 'ROUTEHELPER' . $this->hhh] - .= $this->setRouterHelp($viewName_single, $viewName_list); + .= $this->setRouterHelp( + $nameSingleCode, + $nameListCode + ); if (isset($view['edit_create_site_view']) && is_numeric( @@ -1074,11 +1215,13 @@ class Infusion extends Interpretation $this->fileContentStatic[$this->hhh . 'ROUTER_PARSE_SWITCH' . $this->hhh] .= $this->routerParseSwitch( - $viewName_single, null, false + $nameSingleCode, null, false ); $this->fileContentStatic[$this->hhh . 'ROUTER_BUILD_VIEWS' . $this->hhh] - .= $this->routerBuildViews($viewName_single); + .= $this->routerBuildViews( + $nameSingleCode + ); } // ACCESS_SECTIONS @@ -1094,7 +1237,8 @@ class Infusion extends Interpretation $this->fileContentStatic[$this->hhh . 'ACCESS_SECTIONS' . $this->hhh] .= $this->setAccessSectionsCategory( - $viewName_single, $viewName_list + $nameSingleCode, + $nameListCode ); // set the Joomla Fields ACCESS section if needed if (isset($view['joomla_fields']) @@ -1108,8 +1252,10 @@ class Infusion extends Interpretation // Trigger Event: jcb_ce_onAfterBuildAdminViewContent $this->triggerEvent( 'jcb_ce_onAfterBuildAdminViewContent', - array(&$this->componentContext, &$view, &$viewName_single, - &$viewName_list, &$this->fileContentStatic, + array(&$this->componentContext, &$view, + &$nameSingleCode, + &$nameListCode, + &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh) ); @@ -1343,7 +1489,6 @@ class Infusion extends Interpretation . 'CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT' . $this->hhh] = $this->setCustomViewSubmitButtonScript($view); - // setup the templates $this->setCustomViewTemplateBody($view); @@ -1364,11 +1509,12 @@ class Infusion extends Interpretation // set headers based on the main get type if ($view['settings']->main_get->gettype == 1) { - // CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER <<>> add the header details for the model + // CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER <<>> add the header details for the controller $this->fileContentDynamic[$view['settings']->code][$this->hhh . 'CUSTOM_ADMIN_VIEW_CONTROLLER_HEADER' . $this->hhh] = $this->setClassHeaders( - 'custom.admin.view.controller', $view['settings']->code + 'custom.admin.view.controller', + $view['settings']->code ); // CUSTOM_ADMIN_VIEW_MODEL_HEADER <<>> add the header details for the model $this->fileContentDynamic[$view['settings']->code][$this->hhh @@ -1376,14 +1522,21 @@ class Infusion extends Interpretation = $this->setClassHeaders( 'custom.admin.view.model', $view['settings']->code ); + // CUSTOM_ADMIN_VIEW_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$view['settings']->code][$this->hhh + . 'CUSTOM_ADMIN_VIEW_HEADER' . $this->hhh] + = $this->setClassHeaders( + 'custom.admin.view', $view['settings']->code + ); } elseif ($view['settings']->main_get->gettype == 2) { - // CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER <<>> add the header details for the model + // CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER <<>> add the header details for the controller $this->fileContentDynamic[$view['settings']->code][$this->hhh . 'CUSTOM_ADMIN_VIEWS_CONTROLLER_HEADER' . $this->hhh] = $this->setClassHeaders( - 'custom.admin.views.controller', $view['settings']->code + 'custom.admin.views.controller', + $view['settings']->code ); // CUSTOM_ADMIN_VIEWS_MODEL_HEADER <<>> add the header details for the model $this->fileContentDynamic[$view['settings']->code][$this->hhh @@ -1391,6 +1544,12 @@ class Infusion extends Interpretation = $this->setClassHeaders( 'custom.admin.views.model', $view['settings']->code ); + // CUSTOM_ADMIN_VIEWS_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$view['settings']->code][$this->hhh + . 'CUSTOM_ADMIN_VIEWS_HEADER' . $this->hhh] + = $this->setClassHeaders( + 'custom.admin.views', $view['settings']->code + ); } // Trigger Event: jcb_ce_onAfterBuildCustomAdminViewContent @@ -1689,7 +1848,7 @@ class Infusion extends Interpretation .= $this->setRouterHelp( $view['settings']->code, $view['settings']->code, true ); - // build route details + // build route details $this->fileContentStatic[$this->hhh . 'ROUTER_PARSE_SWITCH' . $this->hhh] .= $this->routerParseSwitch( @@ -1846,6 +2005,12 @@ class Infusion extends Interpretation = $this->setClassHeaders( 'site.view.model', $view['settings']->code ); + // SITE_VIEW_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$view['settings']->code][$this->hhh + . 'SITE_VIEW_HEADER' . $this->hhh] + = $this->setClassHeaders( + 'site.view', $view['settings']->code + ); } elseif ($view['settings']->main_get->gettype == 2) { @@ -1868,6 +2033,12 @@ class Infusion extends Interpretation = $this->setClassHeaders( 'site.views.model', $view['settings']->code ); + // SITE_VIEWS_HEADER <<>> add the header details for the view + $this->fileContentDynamic[$view['settings']->code][$this->hhh + . 'SITE_VIEWS_HEADER' . $this->hhh] + = $this->setClassHeaders( + 'site.views', $view['settings']->code + ); } // Trigger Event: jcb_ce_onAfterBuildSiteViewContent @@ -2076,7 +2247,7 @@ class Infusion extends Interpretation // MODDEFAULT $this->fileContentDynamic[$module->key][$this->hhh . 'MODDEFAULT' . $this->hhh] - = $this->getModDefault($module); + = $this->getModDefault($module, $module->key); // only add install script if needed if ($module->add_install_script) { @@ -2214,109 +2385,112 @@ class Infusion extends Interpretation $this->clearFromPlaceHolders('view'); // VIEW <<>> - if (isset($view->name_single)) + if (isset($view->name_single) && $view->name_single != 'null') { // set main keys - $viewName_single = ComponentbuilderHelper::safeString( - $view->name_single - ); - $viewName_u = ComponentbuilderHelper::safeString( + $nameSingleCode = $view->name_single_code; + $name_single_uppercase = ComponentbuilderHelper::safeString( $view->name_single, 'U' ); - $viewName_f = ComponentbuilderHelper::safeString( + $name_single_first_uppercase = ComponentbuilderHelper::safeString( $view->name_single, 'F' ); // set some place holder for the views $this->placeholders[$this->hhh . 'view' . $this->hhh] - = $viewName_single; - $this->placeholders[$this->hhh . 'View' . $this->hhh] = $viewName_f; - $this->placeholders[$this->hhh . 'VIEW' . $this->hhh] = $viewName_u; + = $nameSingleCode; + $this->placeholders[$this->hhh . 'View' . $this->hhh] + = $name_single_first_uppercase; + $this->placeholders[$this->hhh . 'VIEW' . $this->hhh] + = $name_single_uppercase; $this->placeholders[$this->bbb . 'view' . $this->ddd] - = $viewName_single; - $this->placeholders[$this->bbb . 'View' . $this->ddd] = $viewName_f; - $this->placeholders[$this->bbb . 'VIEW' . $this->ddd] = $viewName_u; + = $nameSingleCode; + $this->placeholders[$this->bbb . 'View' . $this->ddd] + = $name_single_first_uppercase; + $this->placeholders[$this->bbb . 'VIEW' . $this->ddd] + = $name_single_uppercase; } // VIEWS <<>> - if (isset($view->name_list)) + if (isset($view->name_list) && $view->name_list != 'null') { - $viewName_list = ComponentbuilderHelper::safeString( - $view->name_list - ); - $viewsName_u = ComponentbuilderHelper::safeString( + $nameListCode = $view->name_list_code; + $name_list_uppercase = ComponentbuilderHelper::safeString( $view->name_list, 'U' ); - $viewsName_f = ComponentbuilderHelper::safeString( + $name_list_first_uppercase = ComponentbuilderHelper::safeString( $view->name_list, 'F' ); // set some place holder for the views $this->placeholders[$this->hhh . 'views' . $this->hhh] - = $viewName_list; + = $nameListCode; $this->placeholders[$this->hhh . 'Views' . $this->hhh] - = $viewsName_f; + = $name_list_first_uppercase; $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh] - = $viewsName_u; + = $name_list_uppercase; $this->placeholders[$this->bbb . 'views' . $this->ddd] - = $viewName_list; + = $nameListCode; $this->placeholders[$this->bbb . 'Views' . $this->ddd] - = $viewsName_f; + = $name_list_first_uppercase; $this->placeholders[$this->bbb . 'VIEWS' . $this->ddd] - = $viewsName_u; + = $name_list_uppercase; } // view <<>> - if (isset($viewName_single)) + if (isset($nameSingleCode)) { - $this->fileContentDynamic[$viewName_single][$this->hhh . 'view' + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'view' . $this->hhh] - = $viewName_single; - $this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEW' + = $nameSingleCode; + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'VIEW' . $this->hhh] - = $viewName_u; - $this->fileContentDynamic[$viewName_single][$this->hhh . 'View' + = $name_single_uppercase; + $this->fileContentDynamic[$nameSingleCode][$this->hhh . 'View' . $this->hhh] - = $viewName_f; + = $name_single_first_uppercase; - if (isset($viewName_list)) + if (isset($nameListCode)) { - $this->fileContentDynamic[$viewName_list][$this->hhh . 'view' + $this->fileContentDynamic[$nameListCode][$this->hhh . 'view' . $this->hhh] - = $viewName_single; - $this->fileContentDynamic[$viewName_list][$this->hhh . 'VIEW' + = $nameSingleCode; + $this->fileContentDynamic[$nameListCode][$this->hhh . 'VIEW' . $this->hhh] - = $viewName_u; - $this->fileContentDynamic[$viewName_list][$this->hhh . 'View' + = $name_single_uppercase; + $this->fileContentDynamic[$nameListCode][$this->hhh . 'View' . $this->hhh] - = $viewName_f; + = $name_single_first_uppercase; } } // views <<>> - if (isset($viewName_list)) + if (isset($nameListCode)) { - $this->fileContentDynamic[$viewName_list][$this->hhh . 'views' + $this->fileContentDynamic[$nameListCode][$this->hhh . 'views' . $this->hhh] - = $viewName_list; - $this->fileContentDynamic[$viewName_list][$this->hhh . 'VIEWS' + = $nameListCode; + $this->fileContentDynamic[$nameListCode][$this->hhh . 'VIEWS' . $this->hhh] - = $viewsName_u; - $this->fileContentDynamic[$viewName_list][$this->hhh . 'Views' + = $name_list_uppercase; + $this->fileContentDynamic[$nameListCode][$this->hhh . 'Views' . $this->hhh] - = $viewsName_f; + = $name_list_first_uppercase; - if (isset($viewName_single)) + if (isset($nameSingleCode)) { - $this->fileContentDynamic[$viewName_single][$this->hhh . 'views' + $this->fileContentDynamic[$nameSingleCode][$this->hhh + . 'views' . $this->hhh] - = $viewName_list; - $this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEWS' + = $nameListCode; + $this->fileContentDynamic[$nameSingleCode][$this->hhh + . 'VIEWS' . $this->hhh] - = $viewsName_u; - $this->fileContentDynamic[$viewName_single][$this->hhh . 'Views' + = $name_list_uppercase; + $this->fileContentDynamic[$nameSingleCode][$this->hhh + . 'Views' . $this->hhh] - = $viewsName_f; + = $name_list_first_uppercase; } } } diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 94e03abf5..d825f5db3 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -313,7 +313,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD="Field" COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELDS="Fields" COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD_DESCRIPTION="Select a field" COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD_LABEL="Field" -COM_COMPONENTBUILDER_ADMIN_FIELDS_FILTER_DESCRIPTION="Select if the field is to be used as a filter in list view, if shown." +COM_COMPONENTBUILDER_ADMIN_FIELDS_FILTER_DESCRIPTION="Should this field be used as a filter in list view, if shown." COM_COMPONENTBUILDER_ADMIN_FIELDS_FILTER_LABEL="Filter" COM_COMPONENTBUILDER_ADMIN_FIELDS_FULL_WIDTH_IN_TAB="Full Width in Tab" COM_COMPONENTBUILDER_ADMIN_FIELDS_ID="Id" @@ -328,6 +328,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_ADMIN_FIELDS_MODIFIED_DATE_DESC="The date this Admin Fields was modified." COM_COMPONENTBUILDER_ADMIN_FIELDS_MODIFIED_DATE_LABEL="Modified Date" COM_COMPONENTBUILDER_ADMIN_FIELDS_NEW="A New Admin Fields" +COM_COMPONENTBUILDER_ADMIN_FIELDS_NO="No" COM_COMPONENTBUILDER_ADMIN_FIELDS_NONE_DB="None DB" COM_COMPONENTBUILDER_ADMIN_FIELDS_NOTE_ON_VIEWS_DESCRIPTION="id, asset_id, state, access, ordering, created_by, created, modified_by, modified, checked_out, checked_out_time, version, hits, metakey, metadesc, metadata (you don't need to add them again)
For more help please watch this tutorial." COM_COMPONENTBUILDER_ADMIN_FIELDS_NOTE_ON_VIEWS_LABEL="The following fields are added by default to all views." @@ -409,6 +410,8 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_UNDERNEATH_TABS="Underneath Tabs" COM_COMPONENTBUILDER_ADMIN_FIELDS_VERSION_DESC="A count of the number of times this Admin Fields has been revised." COM_COMPONENTBUILDER_ADMIN_FIELDS_VERSION_LABEL="Version" COM_COMPONENTBUILDER_ADMIN_FIELDS_VIEW="View" +COM_COMPONENTBUILDER_ADMIN_FIELDS_YES_MULTI="Yes (multi)" +COM_COMPONENTBUILDER_ADMIN_FIELDS_YES_SINGLE="Yes (single)" COM_COMPONENTBUILDER_ADMIN_VIEW="Admin View" COM_COMPONENTBUILDER_ADMIN_VIEWS="Admin Views" COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS="Admin Views Access" @@ -2277,6 +2280,7 @@ COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_UNFEATURED_1="%s Component Updat COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_UNPUBLISHED="%s Components Updates unpublished." COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Component Updates unpublished." COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS="Component Admin Views" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ABOVE_NEW="Above (new)" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ACCESS_DESCRIPTION="Select if this view
should use access." COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ACCESS_LABEL="Add Access" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADD="Add" @@ -2382,6 +2386,8 @@ COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILE_MINUS="File Minus" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILE_REMOVE="File Remove" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILE_TWO="File 2" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILTER="Filter" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILTER_DESCRIPTION="Select the type of filter to use in this list view." +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILTER_LABEL="Filter Type" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FIRST="First" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FLAG="Flag" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FLAG_THREE="Flag 3" @@ -2499,6 +2505,7 @@ COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SHARE="Share" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SHARE_ALT="Share Alt" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SHIELD="Shield" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SHUFFLE="Shuffle" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SIDE_OLD="Side (old)" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SIGNUP="Signup" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SMILEY="Smiley" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SMILEY_NEUTRAL="Smiley Neutral" @@ -3284,6 +3291,10 @@ COM_COMPONENTBUILDER_CONFIG_ALPHANUMERIC="Alphanumeric" COM_COMPONENTBUILDER_CONFIG_ALPHANUMERICDOT="Alphanumeric+dot" COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION="This User will be used to log the API call." COM_COMPONENTBUILDER_CONFIG_API_LABEL="API User" +COM_COMPONENTBUILDER_CONFIG_ASSETS_TABLE_FIX_DESCRIPTION="How to apply the assets table fix in JCB.
+SQL (add&remove) this is the default which adds the SQL fix and removes it once the component is uninstalled.
+Intelligent (add&remove+if) same as default, but on uninstall will only remove this fix if no other component needs it. Note that this option will only work with other components that also use the intelligent path." +COM_COMPONENTBUILDER_CONFIG_ASSETS_TABLE_FIX_LABEL="Assets Table Fix" COM_COMPONENTBUILDER_CONFIG_AUTHOR="Author Info" COM_COMPONENTBUILDER_CONFIG_AUTHOR_EMAIL_DESC="The email address of the author of this component." COM_COMPONENTBUILDER_CONFIG_AUTHOR_EMAIL_LABEL="Author Email" @@ -3371,6 +3382,7 @@ COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_OPTION_SIX="Never" COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_OPTION_THREE="Once a day" COM_COMPONENTBUILDER_CONFIG_CHECK_TIMER_OPTION_TWO="Every twelve hours" COM_COMPONENTBUILDER_CONFIG_COMPANY="Company" +COM_COMPONENTBUILDER_CONFIG_COMPILER="Compiler" COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_DESCRIPTION="Select the method to use when building the xml fields in the compiler. The SimpleXMLElement Class is best practice, and String Manipulation is faster and works without special extensions." COM_COMPONENTBUILDER_CONFIG_COMPILER_FIELD_BUILDER_TYPE_LABEL="Field Builder Type
(in compiler)" COM_COMPONENTBUILDER_CONFIG_COMPILER_FOLDER_PATH_DESCRIPTION="Here you can set the path to the compiler folder" @@ -3426,6 +3438,7 @@ COM_COMPONENTBUILDER_CONFIG_DKIM_VALUE_DESCRIPTION="This is the TXT value to use COM_COMPONENTBUILDER_CONFIG_DKIM_VALUE_HINT="v=DKIM1;k=rsa;g=*;s=email;h=sha1;t=s;p=PUBLICKEY" COM_COMPONENTBUILDER_CONFIG_DKIM_VALUE_LABEL="Value" COM_COMPONENTBUILDER_CONFIG_DONT_LOAD="Not" +COM_COMPONENTBUILDER_CONFIG_DO_NOT_ADD_FIX_EVER="Do not add fix ever" COM_COMPONENTBUILDER_CONFIG_DYNAMIC_GET_JOIN_DB_TABLE="Dynamic Get (join_db_table)" COM_COMPONENTBUILDER_CONFIG_DYNAMIC_GET_JOIN_VIEW_TABLE="Dynamic Get (join_view_table)" COM_COMPONENTBUILDER_CONFIG_EDITOR_DESCRIPTION="Select the editor you would like to use as the JCB global editor for all custom coding areas." @@ -3533,6 +3546,7 @@ COM_COMPONENTBUILDER_CONFIG_GRADIANT_LOAD="Gradient" COM_COMPONENTBUILDER_CONFIG_INACTIVE="Inactive" COM_COMPONENTBUILDER_CONFIG_INSTALL_DESCRIPTION="Component locally" COM_COMPONENTBUILDER_CONFIG_INSTALL_LABEL="Install" +COM_COMPONENTBUILDER_CONFIG_INTELLIGENT_ADDREMOVEIF="Intelligent (add&remove+if)" COM_COMPONENTBUILDER_CONFIG_JCB_COMMUNITY_PACKAGES="JCB Community Packages" COM_COMPONENTBUILDER_CONFIG_JCB_PACKAGE_DIRECTORIES_DESCRIPTION="Here you can manage what package directories show in the JCB package import area." COM_COMPONENTBUILDER_CONFIG_JCB_PACKAGE_DIRECTORIES_LABEL="Directories" @@ -3654,6 +3668,7 @@ COM_COMPONENTBUILDER_CONFIG_SMTPSECURE_LABEL="SMTP Security" COM_COMPONENTBUILDER_CONFIG_SMTPUSER_DESCRIPTION="Enter the username for access to the SMTP host." COM_COMPONENTBUILDER_CONFIG_SMTPUSER_HINT="email@demo.com" COM_COMPONENTBUILDER_CONFIG_SMTPUSER_LABEL="SMTP Username" +COM_COMPONENTBUILDER_CONFIG_SQL_ADDREMOVE="SQL (add&remove)" COM_COMPONENTBUILDER_CONFIG_SSL="SSL" COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_DESCRIPTION="How long should the data that is stored in the browser memory remain unchanged before it is removed and updated." COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_LABEL="Update Cycle" @@ -4798,7 +4813,7 @@ COM_COMPONENTBUILDER_EDIT_VERSIONS_DESC="Allows users in this group to edit vers COM_COMPONENTBUILDER_EDIT_VIEW="Edit View" COM_COMPONENTBUILDER_EMAIL="Email" COM_COMPONENTBUILDER_EMAIL_S="Email %s" -COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND="Email with the new key was send" +COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT="Email with the new key was sent" COM_COMPONENTBUILDER_EMCOMPANYEM_BSB="Company: %s" COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB="Copyright: %s" COM_COMPONENTBUILDER_EMEMAILEM_BSB="Email: %s" @@ -5329,6 +5344,214 @@ COM_COMPONENTBUILDER_FILE_BSB_WAS_MOVED_TO_BSB="File %s was moved to % COM_COMPONENTBUILDER_FILE_BSB_WAS_NOT_MOVED_TO_BSB="File %s was not moved to %s" COM_COMPONENTBUILDER_FILE_BSB_WAS_SUCCESSFULLY_UNLOCKED="File %s was successfully unlocked!" COM_COMPONENTBUILDER_FILTER="Filter" +COM_COMPONENTBUILDER_FILTER_ADMIN_VIEW_ASCENDING="Admin View ascending" +COM_COMPONENTBUILDER_FILTER_ADMIN_VIEW_DESCENDING="Admin View descending" +COM_COMPONENTBUILDER_FILTER_CLASS_EXTENDS_ASCENDING="Class Extends ascending" +COM_COMPONENTBUILDER_FILTER_CLASS_EXTENDS_DESCENDING="Class Extends descending" +COM_COMPONENTBUILDER_FILTER_COMMENT_TYPE_ASCENDING="Comment Type ascending" +COM_COMPONENTBUILDER_FILTER_COMMENT_TYPE_DESCENDING="Comment Type descending" +COM_COMPONENTBUILDER_FILTER_COMPANYNAME_ASCENDING="Companyname ascending" +COM_COMPONENTBUILDER_FILTER_COMPANYNAME_DESCENDING="Companyname descending" +COM_COMPONENTBUILDER_FILTER_COMPONENT_ASCENDING="Component ascending" +COM_COMPONENTBUILDER_FILTER_COMPONENT_DESCENDING="Component descending" +COM_COMPONENTBUILDER_FILTER_CONTEXT_ASCENDING="Context ascending" +COM_COMPONENTBUILDER_FILTER_CONTEXT_DESCENDING="Context descending" +COM_COMPONENTBUILDER_FILTER_DATATYPE_ASCENDING="Datatype ascending" +COM_COMPONENTBUILDER_FILTER_DATATYPE_DESCENDING="Datatype descending" +COM_COMPONENTBUILDER_FILTER_DESCRIPTION_ASCENDING="Description ascending" +COM_COMPONENTBUILDER_FILTER_DESCRIPTION_DESCENDING="Description descending" +COM_COMPONENTBUILDER_FILTER_DYNAMIC_GET_ASCENDING="Dynamic Get ascending" +COM_COMPONENTBUILDER_FILTER_DYNAMIC_GET_DESCENDING="Dynamic Get descending" +COM_COMPONENTBUILDER_FILTER_EXTENSION_TYPE_ASCENDING="Extension Type ascending" +COM_COMPONENTBUILDER_FILTER_EXTENSION_TYPE_DESCENDING="Extension Type descending" +COM_COMPONENTBUILDER_FILTER_FIELDS_CATEGORIES_ASCENDING="Fields Categories ascending" +COM_COMPONENTBUILDER_FILTER_FIELDS_CATEGORIES_DESCENDING="Fields Categories descending" +COM_COMPONENTBUILDER_FILTER_FIELDTYPES_CATEGORIES_ASCENDING="Fieldtypes Categories ascending" +COM_COMPONENTBUILDER_FILTER_FIELDTYPES_CATEGORIES_DESCENDING="Fieldtypes Categories descending" +COM_COMPONENTBUILDER_FILTER_FIELDTYPE_ASCENDING="Fieldtype ascending" +COM_COMPONENTBUILDER_FILTER_FIELDTYPE_DESCENDING="Fieldtype descending" +COM_COMPONENTBUILDER_FILTER_GETTYPE_ASCENDING="Gettype ascending" +COM_COMPONENTBUILDER_FILTER_GETTYPE_DESCENDING="Gettype descending" +COM_COMPONENTBUILDER_FILTER_HEADING_ASCENDING="Heading ascending" +COM_COMPONENTBUILDER_FILTER_HEADING_DESCENDING="Heading descending" +COM_COMPONENTBUILDER_FILTER_INDEXES_ASCENDING="Indexes ascending" +COM_COMPONENTBUILDER_FILTER_INDEXES_DESCENDING="Indexes descending" +COM_COMPONENTBUILDER_FILTER_JOOMLA_PLUGIN_GROUP_ASCENDING="Joomla Plugin Group ascending" +COM_COMPONENTBUILDER_FILTER_JOOMLA_PLUGIN_GROUP_DESCENDING="Joomla Plugin Group descending" +COM_COMPONENTBUILDER_FILTER_LANGTAG_ASCENDING="Langtag ascending" +COM_COMPONENTBUILDER_FILTER_LANGTAG_DESCENDING="Langtag descending" +COM_COMPONENTBUILDER_FILTER_LIBRARY_ASCENDING="Library ascending" +COM_COMPONENTBUILDER_FILTER_LIBRARY_DESCENDING="Library descending" +COM_COMPONENTBUILDER_FILTER_LOCATION_ASCENDING="Location ascending" +COM_COMPONENTBUILDER_FILTER_LOCATION_DESCENDING="Location descending" +COM_COMPONENTBUILDER_FILTER_MAIN_GET_ASCENDING="Main Get ascending" +COM_COMPONENTBUILDER_FILTER_MAIN_GET_DESCENDING="Main Get descending" +COM_COMPONENTBUILDER_FILTER_MAIN_SOURCE_ASCENDING="Main Source ascending" +COM_COMPONENTBUILDER_FILTER_MAIN_SOURCE_DESCENDING="Main Source descending" +COM_COMPONENTBUILDER_FILTER_NAME_ASCENDING="Name ascending" +COM_COMPONENTBUILDER_FILTER_NAME_CODE_ASCENDING="Name Code ascending" +COM_COMPONENTBUILDER_FILTER_NAME_CODE_DESCENDING="Name Code descending" +COM_COMPONENTBUILDER_FILTER_NAME_DESCENDING="Name descending" +COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_ASCENDING="Name Single ascending" +COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_DESCENDING="Name Single descending" +COM_COMPONENTBUILDER_FILTER_NULL_SWITCH_ASCENDING="Null Switch ascending" +COM_COMPONENTBUILDER_FILTER_NULL_SWITCH_DESCENDING="Null Switch descending" +COM_COMPONENTBUILDER_FILTER_PATH_ASCENDING="Path ascending" +COM_COMPONENTBUILDER_FILTER_PATH_DESCENDING="Path descending" +COM_COMPONENTBUILDER_FILTER_PROTOCOL_ASCENDING="Protocol ascending" +COM_COMPONENTBUILDER_FILTER_PROTOCOL_DESCENDING="Protocol descending" +COM_COMPONENTBUILDER_FILTER_PUBLISHED="Status" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_ADMINS_CUSTOM_TABS="Status options for admins custom tabs" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_ADMINS_FIELDS="Status options for admins fields" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_ADMINS_FIELDS_CONDITIONS="Status options for admins fields conditions" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_ADMINS_FIELDS_RELATIONS="Status options for admins fields relations" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_ADMIN_VIEWS="Status options for admin views" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_CLASS_EXTENDINGS="Status options for class extendings" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_CLASS_METHODS="Status options for class methods" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_CLASS_PROPERTIES="Status options for class properties" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_ADMIN_VIEWS="Status options for components admin views" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_CONFIG="Status options for components config" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_CUSTOM_ADMIN_MENUS="Status options for components custom admin menus" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_CUSTOM_ADMIN_VIEWS="Status options for components custom admin views" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_DASHBOARD="Status options for components dashboard" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_FILES_FOLDERS="Status options for components files folders" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_MODULES="Status options for components modules" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_MYSQL_TWEAKS="Status options for components mysql tweaks" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_PLACEHOLDERS="Status options for components placeholders" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_PLUGINS="Status options for components plugins" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_SITE_VIEWS="Status options for components site views" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_COMPONENTS_UPDATES="Status options for components updates" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_CUSTOM_ADMIN_VIEWS="Status options for custom admin views" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_CUSTOM_CODES="Status options for custom codes" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_DYNAMIC_GETS="Status options for dynamic gets" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_FIELDS="Status options for fields" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_FIELDTYPES="Status options for fieldtypes" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_HELP_DOCUMENTS="Status options for help documents" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_COMPONENTS="Status options for joomla components" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_MODULES="Status options for joomla modules" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_MODULES_FILES_FOLDERS_URLS="Status options for joomla modules files folders urls" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_MODULES_UPDATES="Status options for joomla modules updates" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_PLUGINS="Status options for joomla plugins" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_PLUGINS_FILES_FOLDERS_URLS="Status options for joomla plugins files folders urls" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_PLUGINS_UPDATES="Status options for joomla plugins updates" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_PLUGIN_GROUPS="Status options for joomla plugin groups" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_LANGUAGES="Status options for languages" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_LANGUAGE_TRANSLATIONS="Status options for language translations" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_LAYOUTS="Status options for layouts" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_LIBRARIES="Status options for libraries" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_LIBRARIES_CONFIG="Status options for libraries config" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_LIBRARIES_FILES_FOLDERS_URLS="Status options for libraries files folders urls" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_PLACEHOLDERS="Status options for placeholders" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_SERVERS="Status options for servers" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_SITE_VIEWS="Status options for site views" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_SNIPPETS="Status options for snippets" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_SNIPPET_TYPES="Status options for snippet types" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_TEMPLATES="Status options for templates" +COM_COMPONENTBUILDER_FILTER_PUBLISHED_VALIDATION_RULES="Status options for validation rules" +COM_COMPONENTBUILDER_FILTER_SEARCH="Searchjoomla components" +COM_COMPONENTBUILDER_FILTER_SEARCH_ADMINS_CUSTOM_TABS="Search the admin custom tabs items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_ADMINS_FIELDS="Search the admin fields items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_ADMINS_FIELDS_CONDITIONS="Search the admin fields conditions items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_ADMINS_FIELDS_RELATIONS="Search the admin fields relations items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_ADMIN_VIEWS="Search the admin view items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_CLASS_EXTENDINGS="Search the class extends items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_CLASS_METHODS="Search the class method items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_CLASS_PROPERTIES="Search the class property items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_ADMIN_VIEWS="Search the component admin views items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_CONFIG="Search the component config items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_CUSTOM_ADMIN_MENUS="Search the component custom admin menus items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_CUSTOM_ADMIN_VIEWS="Search the component custom admin views items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_DASHBOARD="Search the component dashboard items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_FILES_FOLDERS="Search the component files folders items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_MODULES="Search the component modules items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_MYSQL_TWEAKS="Search the component mysql tweaks items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_PLACEHOLDERS="Search the component placeholders items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_PLUGINS="Search the component plugins items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_SITE_VIEWS="Search the component site views items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_COMPONENTS_UPDATES="Search the component updates items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_CUSTOM_ADMIN_VIEWS="Search the custom admin view items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_CUSTOM_CODES="Search the custom code items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_DYNAMIC_GETS="Search the dynamic get items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_FIELDS="Search the field items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_FIELDTYPES="Search the fieldtype items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_HELP_DOCUMENTS="Search the help document items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_COMPONENTS="Search the joomla component items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_MODULES="Search the joomla module items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_MODULES_FILES_FOLDERS_URLS="Search the joomla module files folders urls items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_MODULES_UPDATES="Search the joomla module updates items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_PLUGINS="Search the joomla plugin items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_PLUGINS_FILES_FOLDERS_URLS="Search the joomla plugin files folders urls items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_PLUGINS_UPDATES="Search the joomla plugin updates items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_PLUGIN_GROUPS="Search the joomla plugin group items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_LANGUAGES="Search the language items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_LANGUAGE_TRANSLATIONS="Search the language translation items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_LAYOUTS="Search the layout items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_LIBRARIES="Search the library items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_LIBRARIES_CONFIG="Search the library config items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_LIBRARIES_FILES_FOLDERS_URLS="Search the library files folders urls items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_PLACEHOLDERS="Search the placeholder items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_SERVERS="Search the server items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_SITE_VIEWS="Search the site view items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_SNIPPETS="Search the snippet items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_SNIPPET_TYPES="Search the snippet type items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_TEMPLATES="Search the template items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SEARCH_VALIDATION_RULES="Search the validation rule items. Prefix with ID: to search for an item by ID." +COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS="Select Access" +COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTON="Select Add Custom Button" +COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_IMPORT="Select Add Custom Import" +COM_COMPONENTBUILDER_FILTER_SELECT_ADD_FADEIN="Select Add Fadein" +COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX="Select Add Php Ajax" +COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_VIEW="Select Add Php View" +COM_COMPONENTBUILDER_FILTER_SELECT_ADMIN_VIEW="Select Admin View" +COM_COMPONENTBUILDER_FILTER_SELECT_AUTHOR="Select Author" +COM_COMPONENTBUILDER_FILTER_SELECT_CLASS_EXTENDS="Select Class Extends" +COM_COMPONENTBUILDER_FILTER_SELECT_COMMENT_TYPE="Select Comment Type" +COM_COMPONENTBUILDER_FILTER_SELECT_COMPANYNAME="Select Companyname" +COM_COMPONENTBUILDER_FILTER_SELECT_COMPONENT="Select Component" +COM_COMPONENTBUILDER_FILTER_SELECT_DATATYPE="Select Datatype" +COM_COMPONENTBUILDER_FILTER_SELECT_DYNAMIC_GET="Select Dynamic Get" +COM_COMPONENTBUILDER_FILTER_SELECT_EXTENSION_TYPE="Select Extension Type" +COM_COMPONENTBUILDER_FILTER_SELECT_FIELDS_CATEGORIES="Select Fields Categories" +COM_COMPONENTBUILDER_FILTER_SELECT_FIELDTYPE="Select Fieldtype" +COM_COMPONENTBUILDER_FILTER_SELECT_FIELDTYPES_CATEGORIES="Select Fieldtypes Categories" +COM_COMPONENTBUILDER_FILTER_SELECT_GETTYPE="Select Gettype" +COM_COMPONENTBUILDER_FILTER_SELECT_HOW="Select How" +COM_COMPONENTBUILDER_FILTER_SELECT_INDEXES="Select Indexes" +COM_COMPONENTBUILDER_FILTER_SELECT_JOOMLA_PLUGIN_GROUP="Select Joomla Plugin Group" +COM_COMPONENTBUILDER_FILTER_SELECT_LIBRARY="Select Library" +COM_COMPONENTBUILDER_FILTER_SELECT_LOCATION="Select Location" +COM_COMPONENTBUILDER_FILTER_SELECT_MAIN_GET="Select Main Get" +COM_COMPONENTBUILDER_FILTER_SELECT_MAIN_SOURCE="Select Main Source" +COM_COMPONENTBUILDER_FILTER_SELECT_NAME="Select Name" +COM_COMPONENTBUILDER_FILTER_SELECT_NULL_SWITCH="Select Null Switch" +COM_COMPONENTBUILDER_FILTER_SELECT_PROTOCOL="Select Protocol" +COM_COMPONENTBUILDER_FILTER_SELECT_SITE_VIEW="Select Site View" +COM_COMPONENTBUILDER_FILTER_SELECT_STORE="Select Store" +COM_COMPONENTBUILDER_FILTER_SELECT_TARGET="Select Target" +COM_COMPONENTBUILDER_FILTER_SELECT_TYPE="Select Type" +COM_COMPONENTBUILDER_FILTER_SELECT_VISIBILITY="Select Visibility" +COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_ASCENDING="Short Description ascending" +COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_DESCENDING="Short Description descending" +COM_COMPONENTBUILDER_FILTER_SITE_VIEW_ASCENDING="Site View ascending" +COM_COMPONENTBUILDER_FILTER_SITE_VIEW_DESCENDING="Site View descending" +COM_COMPONENTBUILDER_FILTER_SOURCE_ASCENDING="Source ascending" +COM_COMPONENTBUILDER_FILTER_SOURCE_DESCENDING="Source descending" +COM_COMPONENTBUILDER_FILTER_STORE_ASCENDING="Store ascending" +COM_COMPONENTBUILDER_FILTER_STORE_DESCENDING="Store descending" +COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_ASCENDING="System Name ascending" +COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_DESCENDING="System Name descending" +COM_COMPONENTBUILDER_FILTER_TARGET_ASCENDING="Target ascending" +COM_COMPONENTBUILDER_FILTER_TARGET_DESCENDING="Target descending" +COM_COMPONENTBUILDER_FILTER_TITLE_ASCENDING="Title ascending" +COM_COMPONENTBUILDER_FILTER_TITLE_DESCENDING="Title descending" +COM_COMPONENTBUILDER_FILTER_TYPE_ASCENDING="Type ascending" +COM_COMPONENTBUILDER_FILTER_TYPE_DESCENDING="Type descending" +COM_COMPONENTBUILDER_FILTER_URL_ASCENDING="Url ascending" +COM_COMPONENTBUILDER_FILTER_URL_DESCENDING="Url descending" +COM_COMPONENTBUILDER_FILTER_VALUE_ASCENDING="Value ascending" +COM_COMPONENTBUILDER_FILTER_VALUE_DESCENDING="Value descending" +COM_COMPONENTBUILDER_FILTER_VISIBILITY_ASCENDING="Visibility ascending" +COM_COMPONENTBUILDER_FILTER_VISIBILITY_DESCENDING="Visibility descending" COM_COMPONENTBUILDER_FOLDER="Folder" COM_COMPONENTBUILDER_FOLDER_BSB_WAS_MOVED_TO_BSB="Folder %s was moved to %s" COM_COMPONENTBUILDER_FOLDER_BSB_WAS_NOT_MOVED_TO_BSB="Folder %s was not moved to %s" @@ -5684,6 +5907,11 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTWO="Add Uikit v2" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER="Add Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER_LABEL="Add Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADMIN_VIEWS="Admin Views" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX="Assets Table Fix" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_DESCRIPTION="How to apply the assets table fix in JCB.
+SQL (add&remove) this is the default which adds the SQL fix and removes it once the component is uninstalled.
+Intelligent (add&remove+if) same as default, but on uninstall will only remove this fix if no other component needs it. Note that this option will only work with other components that also use the intelligent path." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_LABEL="Assets Table Fix" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR="Author" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_DESCRIPTION="The Author's Name & Surname." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_HINT="Author Name & Surname Here" @@ -5769,6 +5997,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_DESCRIPTION="Add Description H COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_HINT="Add Description Here" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DETAILS="Details" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DO_NOT_ADD_FIX_EVER="Do not add fix ever" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC="Dynamic" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_BUILD_BETA="Dynamic Build (beta)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_INTEGRATION="Dynamic Integration" @@ -5805,6 +6034,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_DESCRIPTION="The component image (pr COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_LABEL="Component Image" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla Component Import JCB Packages Button Access" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC="Allows the users in this group to access the import jcb packages button." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_INTELLIGENT_ADDREMOVEIF="Intelligent (add&remove+if)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT="Javascript" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_DESCRIPTION="Add JavaScript for the entire back-end. Do not add the script tags." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_LABEL="Javascript" @@ -6021,6 +6251,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SHOW_DESCRIPTION="Select where you want th COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SHOW_LABEL="Show" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SITE_VIEWS="Site Views" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL="Sql" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_ADDREMOVE="SQL (add&remove)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_DESCRIPTION="Add your MySQL here!" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_HINT="// Add MySQL Table Dump Here" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_LABEL="MySQL - (Install)" @@ -9057,6 +9288,7 @@ COM_COMPONENTBUILDER_THE_ADMIN_FIELDS="The admin fields" COM_COMPONENTBUILDER_THE_ADMIN_FIELDS_CONDITIONS="The admin fields conditions" COM_COMPONENTBUILDER_THE_ADMIN_FIELDS_RELATIONS="The admin fields relations" COM_COMPONENTBUILDER_THE_AVAILABLE_VALIDATION_RULES_FOR_THE_VALIDATE_ATTRIBUTE_ARE="The available validation rules for the validate attribute are:" +COM_COMPONENTBUILDER_THE_BMULTI_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_MORE_THEN_ONE_VALUE_IN_THIS_FILTERFIELD_PLEASE_NOTE_THAT_THIS_OPTION_BONLY_WORKSB_WITH_THE_BNEWB_FILTERS_THAT_LOAD_ABOVE_THE_ADMIN_LIST_VIEW_YOU_CAN_SELECT_THE_NEW_FILTER_OPTION_WHENWHERE_YOU_ADD_THE_VIEW_TO_THE_COMPONENT="The multi filter selection option allows the user to select more then one value in this filter/field. Please note that this option only works with the new filters that load above the admin list view. You can select the new filter option when/where you add the view to the component." COM_COMPONENTBUILDER_THE_BNONE_DBB_OPTION_WILL_REMOVE_THIS_FIELD_FROM_BEING_SAVED_IN_THE_DATABASE="The None DB option will remove this field from being saved in the database." COM_COMPONENTBUILDER_THE_BONLY_IN_ADMIN_LIST_VIEWB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW_NOT_TO_ANY_LINKED_VIEWS="The Only in Admin List View option will only Add this field to the admin list view, not to any linked views." COM_COMPONENTBUILDER_THE_BONLY_IN_LINKED_LIST_VIEWSB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_LINKED_LIST_VIEW_IF_THIS_VIEW_GETS_LINKED_TO_OTHER_VIEW_NOT_TO_THIS_ADMIN_LIST_VIEW="The Only in Linked List Views option will only Add this field to the linked list view, if this view gets linked to other view, not to this admin list view." @@ -9066,6 +9298,7 @@ COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %sget($fields_tab_layout) ?: array( 'add_sql', 'sql', 'add_sql_uninstall', - 'sql_uninstall' + 'sql_uninstall', + 'assets_table_fix' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index 2bff5e023..642265c20 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -26,27 +26,34 @@ class ComponentbuilderModelAdmin_views extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.system_name','system_name', - 'a.name_single','name_single', - 'a.short_description','short_description', 'a.add_fadein','add_fadein', 'a.type','type', 'a.add_custom_button','add_custom_button', 'a.add_php_ajax','add_php_ajax', - 'a.add_custom_import','add_custom_import' + 'a.add_custom_import','add_custom_import', + 'a.system_name','system_name', + 'a.name_single','name_single', + 'a.short_description','short_description' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -56,48 +63,88 @@ class ComponentbuilderModelAdmin_views extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); - $this->setState('filter.system_name', $system_name); + } - $name_single = $this->getUserStateFromRequest($this->context . '.filter.name_single', 'filter_name_single'); - $this->setState('filter.name_single', $name_single); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); - $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); - $this->setState('filter.short_description', $short_description); + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $add_fadein = $this->getUserStateFromRequest($this->context . '.filter.add_fadein', 'filter_add_fadein'); - $this->setState('filter.add_fadein', $add_fadein); + if ($formSubmited) + { + $add_fadein = $app->input->post->get('add_fadein'); + $this->setState('filter.add_fadein', $add_fadein); + } $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); - $this->setState('filter.type', $type); + if ($formSubmited) + { + $type = $app->input->post->get('type'); + $this->setState('filter.type', $type); + } $add_custom_button = $this->getUserStateFromRequest($this->context . '.filter.add_custom_button', 'filter_add_custom_button'); - $this->setState('filter.add_custom_button', $add_custom_button); + if ($formSubmited) + { + $add_custom_button = $app->input->post->get('add_custom_button'); + $this->setState('filter.add_custom_button', $add_custom_button); + } $add_php_ajax = $this->getUserStateFromRequest($this->context . '.filter.add_php_ajax', 'filter_add_php_ajax'); - $this->setState('filter.add_php_ajax', $add_php_ajax); + if ($formSubmited) + { + $add_php_ajax = $app->input->post->get('add_php_ajax'); + $this->setState('filter.add_php_ajax', $add_php_ajax); + } $add_custom_import = $this->getUserStateFromRequest($this->context . '.filter.add_custom_import', 'filter_add_custom_import'); - $this->setState('filter.add_custom_import', $add_custom_import); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $add_custom_import = $app->input->post->get('add_custom_import'); + $this->setState('filter.add_custom_import', $add_custom_import); + } + + $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); + if ($formSubmited) + { + $system_name = $app->input->post->get('system_name'); + $this->setState('filter.system_name', $system_name); + } + + $name_single = $this->getUserStateFromRequest($this->context . '.filter.name_single', 'filter_name_single'); + if ($formSubmited) + { + $name_single = $app->input->post->get('name_single'); + $this->setState('filter.name_single', $name_single); + } + + $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); + if ($formSubmited) + { + $short_description = $app->input->post->get('short_description'); + $this->setState('filter.short_description', $short_description); + } // List state information. parent::populateState($ordering, $direction); @@ -269,9 +316,17 @@ class ComponentbuilderModelAdmin_views extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -295,29 +350,112 @@ class ComponentbuilderModelAdmin_views extends JModelList } // Filter by Add_fadein. - if ($add_fadein = $this->getState('filter.add_fadein')) + $_add_fadein = $this->getState('filter.add_fadein'); + if (is_numeric($_add_fadein)) { - $query->where('a.add_fadein = ' . $db->quote($db->escape($add_fadein))); + if (is_float($_add_fadein)) + { + $query->where('a.add_fadein = ' . (float) $_add_fadein); + } + else + { + $query->where('a.add_fadein = ' . (int) $_add_fadein); + } + } + elseif (ComponentbuilderHelper::checkString($_add_fadein)) + { + $query->where('a.add_fadein = ' . $db->quote($db->escape($_add_fadein))); } // Filter by Type. - if ($type = $this->getState('filter.type')) + $_type = $this->getState('filter.type'); + if (is_numeric($_type)) { - $query->where('a.type = ' . $db->quote($db->escape($type))); + if (is_float($_type)) + { + $query->where('a.type = ' . (float) $_type); + } + else + { + $query->where('a.type = ' . (int) $_type); + } + } + elseif (ComponentbuilderHelper::checkString($_type)) + { + $query->where('a.type = ' . $db->quote($db->escape($_type))); + } + elseif (ComponentbuilderHelper::checkArray($_type)) + { + // Secure the array for the query + $_type = array_map( function ($val) use(&$db) { + if (is_numeric($val)) + { + if (is_float($val)) + { + return (float) $val; + } + else + { + return (int) $val; + } + } + elseif (ComponentbuilderHelper::checkString($val)) + { + return $db->quote($db->escape($val)); + } + }, $_type); + // Filter by the Type Array. + $query->where('a.type IN (' . implode(',', $_type) . ')'); } // Filter by Add_custom_button. - if ($add_custom_button = $this->getState('filter.add_custom_button')) + $_add_custom_button = $this->getState('filter.add_custom_button'); + if (is_numeric($_add_custom_button)) { - $query->where('a.add_custom_button = ' . $db->quote($db->escape($add_custom_button))); + if (is_float($_add_custom_button)) + { + $query->where('a.add_custom_button = ' . (float) $_add_custom_button); + } + else + { + $query->where('a.add_custom_button = ' . (int) $_add_custom_button); + } + } + elseif (ComponentbuilderHelper::checkString($_add_custom_button)) + { + $query->where('a.add_custom_button = ' . $db->quote($db->escape($_add_custom_button))); } // Filter by Add_php_ajax. - if ($add_php_ajax = $this->getState('filter.add_php_ajax')) + $_add_php_ajax = $this->getState('filter.add_php_ajax'); + if (is_numeric($_add_php_ajax)) { - $query->where('a.add_php_ajax = ' . $db->quote($db->escape($add_php_ajax))); + if (is_float($_add_php_ajax)) + { + $query->where('a.add_php_ajax = ' . (float) $_add_php_ajax); + } + else + { + $query->where('a.add_php_ajax = ' . (int) $_add_php_ajax); + } + } + elseif (ComponentbuilderHelper::checkString($_add_php_ajax)) + { + $query->where('a.add_php_ajax = ' . $db->quote($db->escape($_add_php_ajax))); } // Filter by Add_custom_import. - if ($add_custom_import = $this->getState('filter.add_custom_import')) + $_add_custom_import = $this->getState('filter.add_custom_import'); + if (is_numeric($_add_custom_import)) { - $query->where('a.add_custom_import = ' . $db->quote($db->escape($add_custom_import))); + if (is_float($_add_custom_import)) + { + $query->where('a.add_custom_import = ' . (float) $_add_custom_import); + } + else + { + $query->where('a.add_custom_import = ' . (int) $_add_custom_import); + } + } + elseif (ComponentbuilderHelper::checkString($_add_custom_import)) + { + $query->where('a.add_custom_import = ' . $db->quote($db->escape($_add_custom_import))); } // Add the list ordering clause. @@ -541,17 +679,40 @@ class ComponentbuilderModelAdmin_views extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.system_name'); - $id .= ':' . $this->getState('filter.name_single'); - $id .= ':' . $this->getState('filter.short_description'); $id .= ':' . $this->getState('filter.add_fadein'); - $id .= ':' . $this->getState('filter.type'); + // Check if the value is an array + $_type = $this->getState('filter.type'); + if (ComponentbuilderHelper::checkArray($_type)) + { + $id .= ':' . implode(':', $_type); + } + // Check if this is only an number or string + elseif (is_numeric($_type) + || ComponentbuilderHelper::checkString($_type)) + { + $id .= ':' . $_type; + } $id .= ':' . $this->getState('filter.add_custom_button'); $id .= ':' . $this->getState('filter.add_php_ajax'); - $id .= ':' . $this->getState('filter.add_custom_import'); + $id .= ':' . $this->getState('filter.add_custom_import'); + $id .= ':' . $this->getState('filter.system_name'); + $id .= ':' . $this->getState('filter.name_single'); + $id .= ':' . $this->getState('filter.short_description'); return parent::getStoreId($id); } diff --git a/admin/models/admins_custom_tabs.php b/admin/models/admins_custom_tabs.php index 73f5cec10..883ac7992 100644 --- a/admin/models/admins_custom_tabs.php +++ b/admin/models/admins_custom_tabs.php @@ -26,6 +26,7 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelAdmins_custom_tabs extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/admins_fields.php b/admin/models/admins_fields.php index b96924318..fa70e06ac 100644 --- a/admin/models/admins_fields.php +++ b/admin/models/admins_fields.php @@ -26,6 +26,7 @@ class ComponentbuilderModelAdmins_fields extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelAdmins_fields extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelAdmins_fields extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelAdmins_fields extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelAdmins_fields extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelAdmins_fields extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/admins_fields_conditions.php b/admin/models/admins_fields_conditions.php index 1f2c190a4..5e67665e5 100644 --- a/admin/models/admins_fields_conditions.php +++ b/admin/models/admins_fields_conditions.php @@ -26,6 +26,7 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/admins_fields_relations.php b/admin/models/admins_fields_relations.php index ae99144ae..9fd123546 100644 --- a/admin/models/admins_fields_relations.php +++ b/admin/models/admins_fields_relations.php @@ -26,6 +26,7 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelAdmins_fields_relations extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/class_extendings.php b/admin/models/class_extendings.php index d8228daf9..0b2da5e46 100644 --- a/admin/models/class_extendings.php +++ b/admin/models/class_extendings.php @@ -26,21 +26,28 @@ class ComponentbuilderModelClass_extendings extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name', - 'a.extension_type','extension_type' + 'a.extension_type','extension_type', + 'a.name','name' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -50,30 +57,46 @@ class ComponentbuilderModelClass_extendings extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $extension_type = $this->getUserStateFromRequest($this->context . '.filter.extension_type', 'filter_extension_type'); - $this->setState('filter.extension_type', $extension_type); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $extension_type = $app->input->post->get('extension_type'); + $this->setState('filter.extension_type', $extension_type); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } // List state information. parent::populateState($ordering, $direction); @@ -187,9 +210,17 @@ class ComponentbuilderModelClass_extendings extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -213,14 +244,26 @@ class ComponentbuilderModelClass_extendings extends JModelList } // Filter by Extension_type. - if ($extension_type = $this->getState('filter.extension_type')) + $_extension_type = $this->getState('filter.extension_type'); + if (is_numeric($_extension_type)) { - $query->where('a.extension_type = ' . $db->quote($db->escape($extension_type))); + if (is_float($_extension_type)) + { + $query->where('a.extension_type = ' . (float) $_extension_type); + } + else + { + $query->where('a.extension_type = ' . (int) $_extension_type); + } + } + elseif (ComponentbuilderHelper::checkString($_extension_type)) + { + $query->where('a.extension_type = ' . $db->quote($db->escape($_extension_type))); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -241,11 +284,23 @@ class ComponentbuilderModelClass_extendings extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.extension_type'); + $id .= ':' . $this->getState('filter.extension_type'); + $id .= ':' . $this->getState('filter.name'); return parent::getStoreId($id); } diff --git a/admin/models/class_methods.php b/admin/models/class_methods.php index dbca552ae..93d89de09 100644 --- a/admin/models/class_methods.php +++ b/admin/models/class_methods.php @@ -26,22 +26,29 @@ class ComponentbuilderModelClass_methods extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name', 'a.visibility','visibility', - 'a.extension_type','extension_type' + 'a.extension_type','extension_type', + 'a.name','name' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -51,33 +58,53 @@ class ComponentbuilderModelClass_methods extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $visibility = $this->getUserStateFromRequest($this->context . '.filter.visibility', 'filter_visibility'); - $this->setState('filter.visibility', $visibility); + if ($formSubmited) + { + $visibility = $app->input->post->get('visibility'); + $this->setState('filter.visibility', $visibility); + } $extension_type = $this->getUserStateFromRequest($this->context . '.filter.extension_type', 'filter_extension_type'); - $this->setState('filter.extension_type', $extension_type); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $extension_type = $app->input->post->get('extension_type'); + $this->setState('filter.extension_type', $extension_type); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } // List state information. parent::populateState($ordering, $direction); @@ -211,9 +238,17 @@ class ComponentbuilderModelClass_methods extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -237,14 +272,38 @@ class ComponentbuilderModelClass_methods extends JModelList } // Filter by Visibility. - if ($visibility = $this->getState('filter.visibility')) + $_visibility = $this->getState('filter.visibility'); + if (is_numeric($_visibility)) { - $query->where('a.visibility = ' . $db->quote($db->escape($visibility))); + if (is_float($_visibility)) + { + $query->where('a.visibility = ' . (float) $_visibility); + } + else + { + $query->where('a.visibility = ' . (int) $_visibility); + } + } + elseif (ComponentbuilderHelper::checkString($_visibility)) + { + $query->where('a.visibility = ' . $db->quote($db->escape($_visibility))); } // Filter by Extension_type. - if ($extension_type = $this->getState('filter.extension_type')) + $_extension_type = $this->getState('filter.extension_type'); + if (is_numeric($_extension_type)) { - $query->where('a.extension_type = ' . $db->quote($db->escape($extension_type))); + if (is_float($_extension_type)) + { + $query->where('a.extension_type = ' . (float) $_extension_type); + } + else + { + $query->where('a.extension_type = ' . (int) $_extension_type); + } + } + elseif (ComponentbuilderHelper::checkString($_extension_type)) + { + $query->where('a.extension_type = ' . $db->quote($db->escape($_extension_type))); } // Add the list ordering clause. @@ -398,12 +457,24 @@ class ComponentbuilderModelClass_methods extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); $id .= ':' . $this->getState('filter.visibility'); - $id .= ':' . $this->getState('filter.extension_type'); + $id .= ':' . $this->getState('filter.extension_type'); + $id .= ':' . $this->getState('filter.name'); return parent::getStoreId($id); } diff --git a/admin/models/class_properties.php b/admin/models/class_properties.php index db8ae024e..5920ed840 100644 --- a/admin/models/class_properties.php +++ b/admin/models/class_properties.php @@ -26,22 +26,29 @@ class ComponentbuilderModelClass_properties extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name', 'a.visibility','visibility', - 'a.extension_type','extension_type' + 'a.extension_type','extension_type', + 'a.name','name' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -51,33 +58,53 @@ class ComponentbuilderModelClass_properties extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $visibility = $this->getUserStateFromRequest($this->context . '.filter.visibility', 'filter_visibility'); - $this->setState('filter.visibility', $visibility); + if ($formSubmited) + { + $visibility = $app->input->post->get('visibility'); + $this->setState('filter.visibility', $visibility); + } $extension_type = $this->getUserStateFromRequest($this->context . '.filter.extension_type', 'filter_extension_type'); - $this->setState('filter.extension_type', $extension_type); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $extension_type = $app->input->post->get('extension_type'); + $this->setState('filter.extension_type', $extension_type); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } // List state information. parent::populateState($ordering, $direction); @@ -211,9 +238,17 @@ class ComponentbuilderModelClass_properties extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -237,14 +272,38 @@ class ComponentbuilderModelClass_properties extends JModelList } // Filter by Visibility. - if ($visibility = $this->getState('filter.visibility')) + $_visibility = $this->getState('filter.visibility'); + if (is_numeric($_visibility)) { - $query->where('a.visibility = ' . $db->quote($db->escape($visibility))); + if (is_float($_visibility)) + { + $query->where('a.visibility = ' . (float) $_visibility); + } + else + { + $query->where('a.visibility = ' . (int) $_visibility); + } + } + elseif (ComponentbuilderHelper::checkString($_visibility)) + { + $query->where('a.visibility = ' . $db->quote($db->escape($_visibility))); } // Filter by Extension_type. - if ($extension_type = $this->getState('filter.extension_type')) + $_extension_type = $this->getState('filter.extension_type'); + if (is_numeric($_extension_type)) { - $query->where('a.extension_type = ' . $db->quote($db->escape($extension_type))); + if (is_float($_extension_type)) + { + $query->where('a.extension_type = ' . (float) $_extension_type); + } + else + { + $query->where('a.extension_type = ' . (int) $_extension_type); + } + } + elseif (ComponentbuilderHelper::checkString($_extension_type)) + { + $query->where('a.extension_type = ' . $db->quote($db->escape($_extension_type))); } // Add the list ordering clause. @@ -396,12 +455,24 @@ class ComponentbuilderModelClass_properties extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); $id .= ':' . $this->getState('filter.visibility'); - $id .= ':' . $this->getState('filter.extension_type'); + $id .= ':' . $this->getState('filter.extension_type'); + $id .= ':' . $this->getState('filter.name'); return parent::getStoreId($id); } diff --git a/admin/models/components_admin_views.php b/admin/models/components_admin_views.php index 247f542f1..af4c4dd08 100644 --- a/admin/models/components_admin_views.php +++ b/admin/models/components_admin_views.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_admin_views extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_admin_views extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_admin_views extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_admin_views extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_admin_views extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_admin_views extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_config.php b/admin/models/components_config.php index 4a479bae5..5d476d110 100644 --- a/admin/models/components_config.php +++ b/admin/models/components_config.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_config extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_config extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_config extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_config extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_config extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_config extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_custom_admin_menus.php b/admin/models/components_custom_admin_menus.php index e9e75e5eb..63d38a372 100644 --- a/admin/models/components_custom_admin_menus.php +++ b/admin/models/components_custom_admin_menus.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_custom_admin_menus extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_custom_admin_views.php b/admin/models/components_custom_admin_views.php index 86585c3fc..6bd59a66e 100644 --- a/admin/models/components_custom_admin_views.php +++ b/admin/models/components_custom_admin_views.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_custom_admin_views extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_dashboard.php b/admin/models/components_dashboard.php index e4596d1f8..d7b0e7e85 100644 --- a/admin/models/components_dashboard.php +++ b/admin/models/components_dashboard.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_dashboard extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_dashboard extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_dashboard extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_dashboard extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_dashboard extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_dashboard extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_files_folders.php b/admin/models/components_files_folders.php index eba543d17..7bf0f8c25 100644 --- a/admin/models/components_files_folders.php +++ b/admin/models/components_files_folders.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_files_folders extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_files_folders extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_files_folders extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_files_folders extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_files_folders extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_files_folders extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_modules.php b/admin/models/components_modules.php index 17ada308f..ea48f2ff7 100644 --- a/admin/models/components_modules.php +++ b/admin/models/components_modules.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_modules extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_modules extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_modules extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_modules extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_modules extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_modules extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_mysql_tweaks.php b/admin/models/components_mysql_tweaks.php index 8c7fd829c..e810ab174 100644 --- a/admin/models/components_mysql_tweaks.php +++ b/admin/models/components_mysql_tweaks.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_mysql_tweaks extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_placeholders.php b/admin/models/components_placeholders.php index 133ab63bf..9d8031246 100644 --- a/admin/models/components_placeholders.php +++ b/admin/models/components_placeholders.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_placeholders extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_placeholders extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_placeholders extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_placeholders extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_placeholders extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_placeholders extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_plugins.php b/admin/models/components_plugins.php index c8b66d814..3cea9f8cf 100644 --- a/admin/models/components_plugins.php +++ b/admin/models/components_plugins.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_plugins extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_plugins extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_plugins extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_plugins extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_plugins extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_plugins extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_site_views.php b/admin/models/components_site_views.php index 5b7a83804..2bc0d8597 100644 --- a/admin/models/components_site_views.php +++ b/admin/models/components_site_views.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_site_views extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_site_views extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_site_views extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_site_views extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_site_views extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_site_views extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/components_updates.php b/admin/models/components_updates.php index 407655642..280753460 100644 --- a/admin/models/components_updates.php +++ b/admin/models/components_updates.php @@ -26,6 +26,7 @@ class ComponentbuilderModelComponents_updates extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelComponents_updates extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelComponents_updates extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelComponents_updates extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelComponents_updates extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelComponents_updates extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/custom_admin_views.php b/admin/models/custom_admin_views.php index 447816d19..6c833886f 100644 --- a/admin/models/custom_admin_views.php +++ b/admin/models/custom_admin_views.php @@ -26,25 +26,32 @@ class ComponentbuilderModelCustom_admin_views extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', + 'g.name','main_get', + 'a.add_php_ajax','add_php_ajax', + 'a.add_custom_button','add_custom_button', 'a.system_name','system_name', 'a.name','name', - 'a.description','description', - 'g.name', - 'a.add_php_ajax','add_php_ajax', - 'a.add_custom_button','add_custom_button' + 'a.description','description' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -54,42 +61,74 @@ class ComponentbuilderModelCustom_admin_views extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); - $this->setState('filter.system_name', $system_name); + } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); - $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); - $this->setState('filter.description', $description); + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $main_get = $this->getUserStateFromRequest($this->context . '.filter.main_get', 'filter_main_get'); - $this->setState('filter.main_get', $main_get); + if ($formSubmited) + { + $main_get = $app->input->post->get('main_get'); + $this->setState('filter.main_get', $main_get); + } $add_php_ajax = $this->getUserStateFromRequest($this->context . '.filter.add_php_ajax', 'filter_add_php_ajax'); - $this->setState('filter.add_php_ajax', $add_php_ajax); + if ($formSubmited) + { + $add_php_ajax = $app->input->post->get('add_php_ajax'); + $this->setState('filter.add_php_ajax', $add_php_ajax); + } $add_custom_button = $this->getUserStateFromRequest($this->context . '.filter.add_custom_button', 'filter_add_custom_button'); - $this->setState('filter.add_custom_button', $add_custom_button); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $add_custom_button = $app->input->post->get('add_custom_button'); + $this->setState('filter.add_custom_button', $add_custom_button); + } + + $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); + if ($formSubmited) + { + $system_name = $app->input->post->get('system_name'); + $this->setState('filter.system_name', $system_name); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } // List state information. parent::populateState($ordering, $direction); @@ -220,9 +259,17 @@ class ComponentbuilderModelCustom_admin_views extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -245,20 +292,56 @@ class ComponentbuilderModelCustom_admin_views extends JModelList } } - // Filter by main_get. - if ($main_get = $this->getState('filter.main_get')) + // Filter by Main_get. + $_main_get = $this->getState('filter.main_get'); + if (is_numeric($_main_get)) { - $query->where('a.main_get = ' . $db->quote($db->escape($main_get))); + if (is_float($_main_get)) + { + $query->where('a.main_get = ' . (float) $_main_get); + } + else + { + $query->where('a.main_get = ' . (int) $_main_get); + } + } + elseif (ComponentbuilderHelper::checkString($_main_get)) + { + $query->where('a.main_get = ' . $db->quote($db->escape($_main_get))); } // Filter by Add_php_ajax. - if ($add_php_ajax = $this->getState('filter.add_php_ajax')) + $_add_php_ajax = $this->getState('filter.add_php_ajax'); + if (is_numeric($_add_php_ajax)) { - $query->where('a.add_php_ajax = ' . $db->quote($db->escape($add_php_ajax))); + if (is_float($_add_php_ajax)) + { + $query->where('a.add_php_ajax = ' . (float) $_add_php_ajax); + } + else + { + $query->where('a.add_php_ajax = ' . (int) $_add_php_ajax); + } + } + elseif (ComponentbuilderHelper::checkString($_add_php_ajax)) + { + $query->where('a.add_php_ajax = ' . $db->quote($db->escape($_add_php_ajax))); } // Filter by Add_custom_button. - if ($add_custom_button = $this->getState('filter.add_custom_button')) + $_add_custom_button = $this->getState('filter.add_custom_button'); + if (is_numeric($_add_custom_button)) { - $query->where('a.add_custom_button = ' . $db->quote($db->escape($add_custom_button))); + if (is_float($_add_custom_button)) + { + $query->where('a.add_custom_button = ' . (float) $_add_custom_button); + } + else + { + $query->where('a.add_custom_button = ' . (int) $_add_custom_button); + } + } + elseif (ComponentbuilderHelper::checkString($_add_custom_button)) + { + $query->where('a.add_custom_button = ' . $db->quote($db->escape($_add_custom_button))); } // Add the list ordering clause. @@ -430,15 +513,27 @@ class ComponentbuilderModelCustom_admin_views extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.system_name'); - $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.description'); $id .= ':' . $this->getState('filter.main_get'); $id .= ':' . $this->getState('filter.add_php_ajax'); - $id .= ':' . $this->getState('filter.add_custom_button'); + $id .= ':' . $this->getState('filter.add_custom_button'); + $id .= ':' . $this->getState('filter.system_name'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); return parent::getStoreId($id); } diff --git a/admin/models/custom_codes.php b/admin/models/custom_codes.php index 3c016267e..9a0d61bde 100644 --- a/admin/models/custom_codes.php +++ b/admin/models/custom_codes.php @@ -26,24 +26,31 @@ class ComponentbuilderModelCustom_codes extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'g.system_name', - 'a.path','path', + 'g.system_name','component', 'a.target','target', 'a.type','type', - 'a.comment_type','comment_type' + 'a.comment_type','comment_type', + 'a.path','path' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -53,39 +60,67 @@ class ComponentbuilderModelCustom_codes extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $component = $this->getUserStateFromRequest($this->context . '.filter.component', 'filter_component'); - $this->setState('filter.component', $component); + } - $path = $this->getUserStateFromRequest($this->context . '.filter.path', 'filter_path'); - $this->setState('filter.path', $path); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + + $component = $this->getUserStateFromRequest($this->context . '.filter.component', 'filter_component'); + if ($formSubmited) + { + $component = $app->input->post->get('component'); + $this->setState('filter.component', $component); + } $target = $this->getUserStateFromRequest($this->context . '.filter.target', 'filter_target'); - $this->setState('filter.target', $target); + if ($formSubmited) + { + $target = $app->input->post->get('target'); + $this->setState('filter.target', $target); + } $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); - $this->setState('filter.type', $type); + if ($formSubmited) + { + $type = $app->input->post->get('type'); + $this->setState('filter.type', $type); + } $comment_type = $this->getUserStateFromRequest($this->context . '.filter.comment_type', 'filter_comment_type'); - $this->setState('filter.comment_type', $comment_type); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $comment_type = $app->input->post->get('comment_type'); + $this->setState('filter.comment_type', $comment_type); + } + + $path = $this->getUserStateFromRequest($this->context . '.filter.path', 'filter_path'); + if ($formSubmited) + { + $path = $app->input->post->get('path'); + $this->setState('filter.path', $path); + } // List state information. parent::populateState($ordering, $direction); @@ -248,9 +283,17 @@ class ComponentbuilderModelCustom_codes extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -273,25 +316,73 @@ class ComponentbuilderModelCustom_codes extends JModelList } } - // Filter by component. - if ($component = $this->getState('filter.component')) + // Filter by Component. + $_component = $this->getState('filter.component'); + if (is_numeric($_component)) { - $query->where('a.component = ' . $db->quote($db->escape($component))); + if (is_float($_component)) + { + $query->where('a.component = ' . (float) $_component); + } + else + { + $query->where('a.component = ' . (int) $_component); + } + } + elseif (ComponentbuilderHelper::checkString($_component)) + { + $query->where('a.component = ' . $db->quote($db->escape($_component))); } // Filter by Target. - if ($target = $this->getState('filter.target')) + $_target = $this->getState('filter.target'); + if (is_numeric($_target)) { - $query->where('a.target = ' . $db->quote($db->escape($target))); + if (is_float($_target)) + { + $query->where('a.target = ' . (float) $_target); + } + else + { + $query->where('a.target = ' . (int) $_target); + } + } + elseif (ComponentbuilderHelper::checkString($_target)) + { + $query->where('a.target = ' . $db->quote($db->escape($_target))); } // Filter by Type. - if ($type = $this->getState('filter.type')) + $_type = $this->getState('filter.type'); + if (is_numeric($_type)) { - $query->where('a.type = ' . $db->quote($db->escape($type))); + if (is_float($_type)) + { + $query->where('a.type = ' . (float) $_type); + } + else + { + $query->where('a.type = ' . (int) $_type); + } + } + elseif (ComponentbuilderHelper::checkString($_type)) + { + $query->where('a.type = ' . $db->quote($db->escape($_type))); } // Filter by Comment_type. - if ($comment_type = $this->getState('filter.comment_type')) + $_comment_type = $this->getState('filter.comment_type'); + if (is_numeric($_comment_type)) { - $query->where('a.comment_type = ' . $db->quote($db->escape($comment_type))); + if (is_float($_comment_type)) + { + $query->where('a.comment_type = ' . (float) $_comment_type); + } + else + { + $query->where('a.comment_type = ' . (int) $_comment_type); + } + } + elseif (ComponentbuilderHelper::checkString($_comment_type)) + { + $query->where('a.comment_type = ' . $db->quote($db->escape($_comment_type))); } // Add the list ordering clause. @@ -458,14 +549,26 @@ class ComponentbuilderModelCustom_codes extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.component'); - $id .= ':' . $this->getState('filter.path'); $id .= ':' . $this->getState('filter.target'); $id .= ':' . $this->getState('filter.type'); - $id .= ':' . $this->getState('filter.comment_type'); + $id .= ':' . $this->getState('filter.comment_type'); + $id .= ':' . $this->getState('filter.path'); return parent::getStoreId($id); } diff --git a/admin/models/dynamic_gets.php b/admin/models/dynamic_gets.php index 9f66a6f5b..b6a2a3b44 100644 --- a/admin/models/dynamic_gets.php +++ b/admin/models/dynamic_gets.php @@ -26,22 +26,29 @@ class ComponentbuilderModelDynamic_gets extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name', 'a.main_source','main_source', - 'a.gettype','gettype' + 'a.gettype','gettype', + 'a.name','name' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -51,33 +58,53 @@ class ComponentbuilderModelDynamic_gets extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $main_source = $this->getUserStateFromRequest($this->context . '.filter.main_source', 'filter_main_source'); - $this->setState('filter.main_source', $main_source); + if ($formSubmited) + { + $main_source = $app->input->post->get('main_source'); + $this->setState('filter.main_source', $main_source); + } $gettype = $this->getUserStateFromRequest($this->context . '.filter.gettype', 'filter_gettype'); - $this->setState('filter.gettype', $gettype); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $gettype = $app->input->post->get('gettype'); + $this->setState('filter.gettype', $gettype); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } // List state information. parent::populateState($ordering, $direction); @@ -208,9 +235,17 @@ class ComponentbuilderModelDynamic_gets extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -234,14 +269,38 @@ class ComponentbuilderModelDynamic_gets extends JModelList } // Filter by Main_source. - if ($main_source = $this->getState('filter.main_source')) + $_main_source = $this->getState('filter.main_source'); + if (is_numeric($_main_source)) { - $query->where('a.main_source = ' . $db->quote($db->escape($main_source))); + if (is_float($_main_source)) + { + $query->where('a.main_source = ' . (float) $_main_source); + } + else + { + $query->where('a.main_source = ' . (int) $_main_source); + } + } + elseif (ComponentbuilderHelper::checkString($_main_source)) + { + $query->where('a.main_source = ' . $db->quote($db->escape($_main_source))); } // Filter by Gettype. - if ($gettype = $this->getState('filter.gettype')) + $_gettype = $this->getState('filter.gettype'); + if (is_numeric($_gettype)) { - $query->where('a.gettype = ' . $db->quote($db->escape($gettype))); + if (is_float($_gettype)) + { + $query->where('a.gettype = ' . (float) $_gettype); + } + else + { + $query->where('a.gettype = ' . (int) $_gettype); + } + } + elseif (ComponentbuilderHelper::checkString($_gettype)) + { + $query->where('a.gettype = ' . $db->quote($db->escape($_gettype))); } // Add the list ordering clause. @@ -405,12 +464,24 @@ class ComponentbuilderModelDynamic_gets extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); $id .= ':' . $this->getState('filter.main_source'); - $id .= ':' . $this->getState('filter.gettype'); + $id .= ':' . $this->getState('filter.gettype'); + $id .= ':' . $this->getState('filter.name'); return parent::getStoreId($id); } diff --git a/admin/models/fields.php b/admin/models/fields.php index b6b8225b6..297c33a20 100644 --- a/admin/models/fields.php +++ b/admin/models/fields.php @@ -26,28 +26,35 @@ class ComponentbuilderModelFields extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name', - 'g.name', + 'g.name','fieldtype', 'a.datatype','datatype', 'a.indexes','indexes', 'a.null_switch','null_switch', 'a.store','store', 'c.title','category_title', 'c.id', 'category_id', - 'a.catid', 'catid' + 'a.catid','catid', + 'a.name','name' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -57,24 +64,67 @@ class ComponentbuilderModelFields extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $fieldtype = $this->getUserStateFromRequest($this->context . '.filter.fieldtype', 'filter_fieldtype'); - $this->setState('filter.fieldtype', $fieldtype); + if ($formSubmited) + { + $fieldtype = $app->input->post->get('fieldtype'); + $this->setState('filter.fieldtype', $fieldtype); + } $datatype = $this->getUserStateFromRequest($this->context . '.filter.datatype', 'filter_datatype'); - $this->setState('filter.datatype', $datatype); + if ($formSubmited) + { + $datatype = $app->input->post->get('datatype'); + $this->setState('filter.datatype', $datatype); + } $indexes = $this->getUserStateFromRequest($this->context . '.filter.indexes', 'filter_indexes'); - $this->setState('filter.indexes', $indexes); + if ($formSubmited) + { + $indexes = $app->input->post->get('indexes'); + $this->setState('filter.indexes', $indexes); + } $null_switch = $this->getUserStateFromRequest($this->context . '.filter.null_switch', 'filter_null_switch'); - $this->setState('filter.null_switch', $null_switch); + if ($formSubmited) + { + $null_switch = $app->input->post->get('null_switch'); + $this->setState('filter.null_switch', $null_switch); + } $store = $this->getUserStateFromRequest($this->context . '.filter.store', 'filter_store'); - $this->setState('filter.store', $store); + if ($formSubmited) + { + $store = $app->input->post->get('store'); + $this->setState('filter.store', $store); + } $category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category'); $this->setState('filter.category', $category); @@ -82,26 +132,19 @@ class ComponentbuilderModelFields extends JModelList $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id'); $this->setState('filter.category_id', $categoryId); - $catid = $app->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); - $this->setState('filter.catid', $catid); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + $catid = $this->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); + if ($formSubmited) + { + $catid = $app->input->post->get('catid'); + $this->setState('filter.catid', $catid); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } // List state information. parent::populateState($ordering, $direction); @@ -287,9 +330,17 @@ class ComponentbuilderModelFields extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -312,30 +363,90 @@ class ComponentbuilderModelFields extends JModelList } } - // Filter by fieldtype. - if ($fieldtype = $this->getState('filter.fieldtype')) + // Filter by Fieldtype. + $_fieldtype = $this->getState('filter.fieldtype'); + if (is_numeric($_fieldtype)) { - $query->where('a.fieldtype = ' . $db->quote($db->escape($fieldtype))); + if (is_float($_fieldtype)) + { + $query->where('a.fieldtype = ' . (float) $_fieldtype); + } + else + { + $query->where('a.fieldtype = ' . (int) $_fieldtype); + } + } + elseif (ComponentbuilderHelper::checkString($_fieldtype)) + { + $query->where('a.fieldtype = ' . $db->quote($db->escape($_fieldtype))); } // Filter by Datatype. - if ($datatype = $this->getState('filter.datatype')) + $_datatype = $this->getState('filter.datatype'); + if (is_numeric($_datatype)) { - $query->where('a.datatype = ' . $db->quote($db->escape($datatype))); + if (is_float($_datatype)) + { + $query->where('a.datatype = ' . (float) $_datatype); + } + else + { + $query->where('a.datatype = ' . (int) $_datatype); + } + } + elseif (ComponentbuilderHelper::checkString($_datatype)) + { + $query->where('a.datatype = ' . $db->quote($db->escape($_datatype))); } // Filter by Indexes. - if ($indexes = $this->getState('filter.indexes')) + $_indexes = $this->getState('filter.indexes'); + if (is_numeric($_indexes)) { - $query->where('a.indexes = ' . $db->quote($db->escape($indexes))); + if (is_float($_indexes)) + { + $query->where('a.indexes = ' . (float) $_indexes); + } + else + { + $query->where('a.indexes = ' . (int) $_indexes); + } + } + elseif (ComponentbuilderHelper::checkString($_indexes)) + { + $query->where('a.indexes = ' . $db->quote($db->escape($_indexes))); } // Filter by Null_switch. - if ($null_switch = $this->getState('filter.null_switch')) + $_null_switch = $this->getState('filter.null_switch'); + if (is_numeric($_null_switch)) { - $query->where('a.null_switch = ' . $db->quote($db->escape($null_switch))); + if (is_float($_null_switch)) + { + $query->where('a.null_switch = ' . (float) $_null_switch); + } + else + { + $query->where('a.null_switch = ' . (int) $_null_switch); + } + } + elseif (ComponentbuilderHelper::checkString($_null_switch)) + { + $query->where('a.null_switch = ' . $db->quote($db->escape($_null_switch))); } // Filter by Store. - if ($store = $this->getState('filter.store')) + $_store = $this->getState('filter.store'); + if (is_numeric($_store)) { - $query->where('a.store = ' . $db->quote($db->escape($store))); + if (is_float($_store)) + { + $query->where('a.store = ' . (float) $_store); + } + else + { + $query->where('a.store = ' . (int) $_store); + } + } + elseif (ComponentbuilderHelper::checkString($_store)) + { + $query->where('a.store = ' . $db->quote($db->escape($_store))); } // Filter by a single or group of categories. @@ -354,9 +465,9 @@ class ComponentbuilderModelFields extends JModelList } elseif (is_array($categoryId)) { - ArrayHelper::toInteger($categoryId); + $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); - $query->where('a.category IN (' . $categoryId . ')'); + $query->where('a.catid IN (' . $categoryId . ')'); } @@ -521,18 +632,63 @@ class ComponentbuilderModelFields extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); $id .= ':' . $this->getState('filter.fieldtype'); $id .= ':' . $this->getState('filter.datatype'); $id .= ':' . $this->getState('filter.indexes'); $id .= ':' . $this->getState('filter.null_switch'); $id .= ':' . $this->getState('filter.store'); - $id .= ':' . $this->getState('filter.category'); - $id .= ':' . $this->getState('filter.category_id'); - $id .= ':' . $this->getState('filter.catid'); + // Check if the value is an array + $_category = $this->getState('filter.category'); + if (ComponentbuilderHelper::checkArray($_category)) + { + $id .= ':' . implode(':', $_category); + } + // Check if this is only an number or string + elseif (is_numeric($_category) + || ComponentbuilderHelper::checkString($_category)) + { + $id .= ':' . $_category; + } + // Check if the value is an array + $_category_id = $this->getState('filter.category_id'); + if (ComponentbuilderHelper::checkArray($_category_id)) + { + $id .= ':' . implode(':', $_category_id); + } + // Check if this is only an number or string + elseif (is_numeric($_category_id) + || ComponentbuilderHelper::checkString($_category_id)) + { + $id .= ':' . $_category_id; + } + // Check if the value is an array + $_catid = $this->getState('filter.catid'); + if (ComponentbuilderHelper::checkArray($_catid)) + { + $id .= ':' . implode(':', $_catid); + } + // Check if this is only an number or string + elseif (is_numeric($_catid) + || ComponentbuilderHelper::checkString($_catid)) + { + $id .= ':' . $_catid; + } + $id .= ':' . $this->getState('filter.name'); return parent::getStoreId($id); } diff --git a/admin/models/fields/adminviewsfilteraddcustombutton.php b/admin/models/fields/adminviewsfilteraddcustombutton.php new file mode 100644 index 000000000..1c5d4f8cf --- /dev/null +++ b/admin/models/fields/adminviewsfilteraddcustombutton.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Adminviewsfilteraddcustombutton Form Field class for the Componentbuilder component + */ +class JFormFieldAdminviewsfilteraddcustombutton extends JFormFieldList +{ + /** + * The adminviewsfilteraddcustombutton field type. + * + * @var string + */ + public $type = 'adminviewsfilteraddcustombutton'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_custom_button')); + $query->from($db->quoteName('#__componentbuilder_admin_view')); + $query->order($db->quoteName('add_custom_button') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTON') . ' -'); + + if ($results) + { + // get admin_viewsmodel + $model = ComponentbuilderHelper::getModel('admin_views'); + $results = array_unique($results); + foreach ($results as $add_custom_button) + { + // Translate the add_custom_button selection + $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); + // Now add the add_custom_button and its text to the options array + $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/adminviewsfilteraddcustomimport.php b/admin/models/fields/adminviewsfilteraddcustomimport.php new file mode 100644 index 000000000..d70b97b9c --- /dev/null +++ b/admin/models/fields/adminviewsfilteraddcustomimport.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Adminviewsfilteraddcustomimport Form Field class for the Componentbuilder component + */ +class JFormFieldAdminviewsfilteraddcustomimport extends JFormFieldList +{ + /** + * The adminviewsfilteraddcustomimport field type. + * + * @var string + */ + public $type = 'adminviewsfilteraddcustomimport'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_custom_import')); + $query->from($db->quoteName('#__componentbuilder_admin_view')); + $query->order($db->quoteName('add_custom_import') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_IMPORT') . ' -'); + + if ($results) + { + // get admin_viewsmodel + $model = ComponentbuilderHelper::getModel('admin_views'); + $results = array_unique($results); + foreach ($results as $add_custom_import) + { + // Translate the add_custom_import selection + $text = $model->selectionTranslation($add_custom_import,'add_custom_import'); + // Now add the add_custom_import and its text to the options array + $_filter[] = JHtml::_('select.option', $add_custom_import, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/adminviewsfilteraddfadein.php b/admin/models/fields/adminviewsfilteraddfadein.php new file mode 100644 index 000000000..6d56b2850 --- /dev/null +++ b/admin/models/fields/adminviewsfilteraddfadein.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Adminviewsfilteraddfadein Form Field class for the Componentbuilder component + */ +class JFormFieldAdminviewsfilteraddfadein extends JFormFieldList +{ + /** + * The adminviewsfilteraddfadein field type. + * + * @var string + */ + public $type = 'adminviewsfilteraddfadein'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_fadein')); + $query->from($db->quoteName('#__componentbuilder_admin_view')); + $query->order($db->quoteName('add_fadein') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_FADEIN') . ' -'); + + if ($results) + { + // get admin_viewsmodel + $model = ComponentbuilderHelper::getModel('admin_views'); + $results = array_unique($results); + foreach ($results as $add_fadein) + { + // Translate the add_fadein selection + $text = $model->selectionTranslation($add_fadein,'add_fadein'); + // Now add the add_fadein and its text to the options array + $_filter[] = JHtml::_('select.option', $add_fadein, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/adminviewsfilteraddphpajax.php b/admin/models/fields/adminviewsfilteraddphpajax.php new file mode 100644 index 000000000..256262d86 --- /dev/null +++ b/admin/models/fields/adminviewsfilteraddphpajax.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Adminviewsfilteraddphpajax Form Field class for the Componentbuilder component + */ +class JFormFieldAdminviewsfilteraddphpajax extends JFormFieldList +{ + /** + * The adminviewsfilteraddphpajax field type. + * + * @var string + */ + public $type = 'adminviewsfilteraddphpajax'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_php_ajax')); + $query->from($db->quoteName('#__componentbuilder_admin_view')); + $query->order($db->quoteName('add_php_ajax') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -'); + + if ($results) + { + // get admin_viewsmodel + $model = ComponentbuilderHelper::getModel('admin_views'); + $results = array_unique($results); + foreach ($results as $add_php_ajax) + { + // Translate the add_php_ajax selection + $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); + // Now add the add_php_ajax and its text to the options array + $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/adminviewsfiltertype.php b/admin/models/fields/adminviewsfiltertype.php new file mode 100644 index 000000000..ca04fe13a --- /dev/null +++ b/admin/models/fields/adminviewsfiltertype.php @@ -0,0 +1,70 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Adminviewsfiltertype Form Field class for the Componentbuilder component + */ +class JFormFieldAdminviewsfiltertype extends JFormFieldList +{ + /** + * The adminviewsfiltertype field type. + * + * @var string + */ + public $type = 'adminviewsfiltertype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('type')); + $query->from($db->quoteName('#__componentbuilder_admin_view')); + $query->order($db->quoteName('type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + + if ($results) + { + // get admin_viewsmodel + $model = ComponentbuilderHelper::getModel('admin_views'); + $results = array_unique($results); + foreach ($results as $type) + { + // Translate the type selection + $text = $model->selectionTranslation($type,'type'); + // Now add the type and its text to the options array + $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/classextendingsfilterextensiontype.php b/admin/models/fields/classextendingsfilterextensiontype.php new file mode 100644 index 000000000..03328f045 --- /dev/null +++ b/admin/models/fields/classextendingsfilterextensiontype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Classextendingsfilterextensiontype Form Field class for the Componentbuilder component + */ +class JFormFieldClassextendingsfilterextensiontype extends JFormFieldList +{ + /** + * The classextendingsfilterextensiontype field type. + * + * @var string + */ + public $type = 'classextendingsfilterextensiontype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('extension_type')); + $query->from($db->quoteName('#__componentbuilder_class_extends')); + $query->order($db->quoteName('extension_type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_EXTENSION_TYPE') . ' -'); + + if ($results) + { + // get class_extendingsmodel + $model = ComponentbuilderHelper::getModel('class_extendings'); + $results = array_unique($results); + foreach ($results as $extension_type) + { + // Translate the extension_type selection + $text = $model->selectionTranslation($extension_type,'extension_type'); + // Now add the extension_type and its text to the options array + $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/classmethodsfilterextensiontype.php b/admin/models/fields/classmethodsfilterextensiontype.php new file mode 100644 index 000000000..bdb0badd0 --- /dev/null +++ b/admin/models/fields/classmethodsfilterextensiontype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Classmethodsfilterextensiontype Form Field class for the Componentbuilder component + */ +class JFormFieldClassmethodsfilterextensiontype extends JFormFieldList +{ + /** + * The classmethodsfilterextensiontype field type. + * + * @var string + */ + public $type = 'classmethodsfilterextensiontype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('extension_type')); + $query->from($db->quoteName('#__componentbuilder_class_method')); + $query->order($db->quoteName('extension_type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_EXTENSION_TYPE') . ' -'); + + if ($results) + { + // get class_methodsmodel + $model = ComponentbuilderHelper::getModel('class_methods'); + $results = array_unique($results); + foreach ($results as $extension_type) + { + // Translate the extension_type selection + $text = $model->selectionTranslation($extension_type,'extension_type'); + // Now add the extension_type and its text to the options array + $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/classmethodsfiltervisibility.php b/admin/models/fields/classmethodsfiltervisibility.php new file mode 100644 index 000000000..f7ad02c29 --- /dev/null +++ b/admin/models/fields/classmethodsfiltervisibility.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Classmethodsfiltervisibility Form Field class for the Componentbuilder component + */ +class JFormFieldClassmethodsfiltervisibility extends JFormFieldList +{ + /** + * The classmethodsfiltervisibility field type. + * + * @var string + */ + public $type = 'classmethodsfiltervisibility'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('visibility')); + $query->from($db->quoteName('#__componentbuilder_class_method')); + $query->order($db->quoteName('visibility') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_VISIBILITY') . ' -'); + + if ($results) + { + // get class_methodsmodel + $model = ComponentbuilderHelper::getModel('class_methods'); + $results = array_unique($results); + foreach ($results as $visibility) + { + // Translate the visibility selection + $text = $model->selectionTranslation($visibility,'visibility'); + // Now add the visibility and its text to the options array + $_filter[] = JHtml::_('select.option', $visibility, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/classpropertiesfilterextensiontype.php b/admin/models/fields/classpropertiesfilterextensiontype.php new file mode 100644 index 000000000..23175fb16 --- /dev/null +++ b/admin/models/fields/classpropertiesfilterextensiontype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Classpropertiesfilterextensiontype Form Field class for the Componentbuilder component + */ +class JFormFieldClasspropertiesfilterextensiontype extends JFormFieldList +{ + /** + * The classpropertiesfilterextensiontype field type. + * + * @var string + */ + public $type = 'classpropertiesfilterextensiontype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('extension_type')); + $query->from($db->quoteName('#__componentbuilder_class_property')); + $query->order($db->quoteName('extension_type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_EXTENSION_TYPE') . ' -'); + + if ($results) + { + // get class_propertiesmodel + $model = ComponentbuilderHelper::getModel('class_properties'); + $results = array_unique($results); + foreach ($results as $extension_type) + { + // Translate the extension_type selection + $text = $model->selectionTranslation($extension_type,'extension_type'); + // Now add the extension_type and its text to the options array + $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/classpropertiesfiltervisibility.php b/admin/models/fields/classpropertiesfiltervisibility.php new file mode 100644 index 000000000..96575483a --- /dev/null +++ b/admin/models/fields/classpropertiesfiltervisibility.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Classpropertiesfiltervisibility Form Field class for the Componentbuilder component + */ +class JFormFieldClasspropertiesfiltervisibility extends JFormFieldList +{ + /** + * The classpropertiesfiltervisibility field type. + * + * @var string + */ + public $type = 'classpropertiesfiltervisibility'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('visibility')); + $query->from($db->quoteName('#__componentbuilder_class_property')); + $query->order($db->quoteName('visibility') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_VISIBILITY') . ' -'); + + if ($results) + { + // get class_propertiesmodel + $model = ComponentbuilderHelper::getModel('class_properties'); + $results = array_unique($results); + foreach ($results as $visibility) + { + // Translate the visibility selection + $text = $model->selectionTranslation($visibility,'visibility'); + // Now add the visibility and its text to the options array + $_filter[] = JHtml::_('select.option', $visibility, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/customadminviewsfilteraddcustombutton.php b/admin/models/fields/customadminviewsfilteraddcustombutton.php new file mode 100644 index 000000000..2b7141390 --- /dev/null +++ b/admin/models/fields/customadminviewsfilteraddcustombutton.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Customadminviewsfilteraddcustombutton Form Field class for the Componentbuilder component + */ +class JFormFieldCustomadminviewsfilteraddcustombutton extends JFormFieldList +{ + /** + * The customadminviewsfilteraddcustombutton field type. + * + * @var string + */ + public $type = 'customadminviewsfilteraddcustombutton'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_custom_button')); + $query->from($db->quoteName('#__componentbuilder_custom_admin_view')); + $query->order($db->quoteName('add_custom_button') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTON') . ' -'); + + if ($results) + { + // get custom_admin_viewsmodel + $model = ComponentbuilderHelper::getModel('custom_admin_views'); + $results = array_unique($results); + foreach ($results as $add_custom_button) + { + // Translate the add_custom_button selection + $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); + // Now add the add_custom_button and its text to the options array + $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/customadminviewsfilteraddphpajax.php b/admin/models/fields/customadminviewsfilteraddphpajax.php new file mode 100644 index 000000000..d5c6530a7 --- /dev/null +++ b/admin/models/fields/customadminviewsfilteraddphpajax.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Customadminviewsfilteraddphpajax Form Field class for the Componentbuilder component + */ +class JFormFieldCustomadminviewsfilteraddphpajax extends JFormFieldList +{ + /** + * The customadminviewsfilteraddphpajax field type. + * + * @var string + */ + public $type = 'customadminviewsfilteraddphpajax'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_php_ajax')); + $query->from($db->quoteName('#__componentbuilder_custom_admin_view')); + $query->order($db->quoteName('add_php_ajax') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -'); + + if ($results) + { + // get custom_admin_viewsmodel + $model = ComponentbuilderHelper::getModel('custom_admin_views'); + $results = array_unique($results); + foreach ($results as $add_php_ajax) + { + // Translate the add_php_ajax selection + $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); + // Now add the add_php_ajax and its text to the options array + $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/customcodesfiltercommenttype.php b/admin/models/fields/customcodesfiltercommenttype.php new file mode 100644 index 000000000..126e7769e --- /dev/null +++ b/admin/models/fields/customcodesfiltercommenttype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Customcodesfiltercommenttype Form Field class for the Componentbuilder component + */ +class JFormFieldCustomcodesfiltercommenttype extends JFormFieldList +{ + /** + * The customcodesfiltercommenttype field type. + * + * @var string + */ + public $type = 'customcodesfiltercommenttype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('comment_type')); + $query->from($db->quoteName('#__componentbuilder_custom_code')); + $query->order($db->quoteName('comment_type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_COMMENT_TYPE') . ' -'); + + if ($results) + { + // get custom_codesmodel + $model = ComponentbuilderHelper::getModel('custom_codes'); + $results = array_unique($results); + foreach ($results as $comment_type) + { + // Translate the comment_type selection + $text = $model->selectionTranslation($comment_type,'comment_type'); + // Now add the comment_type and its text to the options array + $_filter[] = JHtml::_('select.option', $comment_type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/customcodesfiltertarget.php b/admin/models/fields/customcodesfiltertarget.php new file mode 100644 index 000000000..4f36d830d --- /dev/null +++ b/admin/models/fields/customcodesfiltertarget.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Customcodesfiltertarget Form Field class for the Componentbuilder component + */ +class JFormFieldCustomcodesfiltertarget extends JFormFieldList +{ + /** + * The customcodesfiltertarget field type. + * + * @var string + */ + public $type = 'customcodesfiltertarget'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('target')); + $query->from($db->quoteName('#__componentbuilder_custom_code')); + $query->order($db->quoteName('target') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET') . ' -'); + + if ($results) + { + // get custom_codesmodel + $model = ComponentbuilderHelper::getModel('custom_codes'); + $results = array_unique($results); + foreach ($results as $target) + { + // Translate the target selection + $text = $model->selectionTranslation($target,'target'); + // Now add the target and its text to the options array + $_filter[] = JHtml::_('select.option', $target, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/customcodesfiltertype.php b/admin/models/fields/customcodesfiltertype.php new file mode 100644 index 000000000..11bf6965a --- /dev/null +++ b/admin/models/fields/customcodesfiltertype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Customcodesfiltertype Form Field class for the Componentbuilder component + */ +class JFormFieldCustomcodesfiltertype extends JFormFieldList +{ + /** + * The customcodesfiltertype field type. + * + * @var string + */ + public $type = 'customcodesfiltertype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('type')); + $query->from($db->quoteName('#__componentbuilder_custom_code')); + $query->order($db->quoteName('type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -'); + + if ($results) + { + // get custom_codesmodel + $model = ComponentbuilderHelper::getModel('custom_codes'); + $results = array_unique($results); + foreach ($results as $type) + { + // Translate the type selection + $text = $model->selectionTranslation($type,'type'); + // Now add the type and its text to the options array + $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/dynamicgetsfiltergettype.php b/admin/models/fields/dynamicgetsfiltergettype.php new file mode 100644 index 000000000..4dec0318d --- /dev/null +++ b/admin/models/fields/dynamicgetsfiltergettype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Dynamicgetsfiltergettype Form Field class for the Componentbuilder component + */ +class JFormFieldDynamicgetsfiltergettype extends JFormFieldList +{ + /** + * The dynamicgetsfiltergettype field type. + * + * @var string + */ + public $type = 'dynamicgetsfiltergettype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('gettype')); + $query->from($db->quoteName('#__componentbuilder_dynamic_get')); + $query->order($db->quoteName('gettype') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_GETTYPE') . ' -'); + + if ($results) + { + // get dynamic_getsmodel + $model = ComponentbuilderHelper::getModel('dynamic_gets'); + $results = array_unique($results); + foreach ($results as $gettype) + { + // Translate the gettype selection + $text = $model->selectionTranslation($gettype,'gettype'); + // Now add the gettype and its text to the options array + $_filter[] = JHtml::_('select.option', $gettype, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/dynamicgetsfiltermainsource.php b/admin/models/fields/dynamicgetsfiltermainsource.php new file mode 100644 index 000000000..7df765736 --- /dev/null +++ b/admin/models/fields/dynamicgetsfiltermainsource.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Dynamicgetsfiltermainsource Form Field class for the Componentbuilder component + */ +class JFormFieldDynamicgetsfiltermainsource extends JFormFieldList +{ + /** + * The dynamicgetsfiltermainsource field type. + * + * @var string + */ + public $type = 'dynamicgetsfiltermainsource'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('main_source')); + $query->from($db->quoteName('#__componentbuilder_dynamic_get')); + $query->order($db->quoteName('main_source') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_MAIN_SOURCE') . ' -'); + + if ($results) + { + // get dynamic_getsmodel + $model = ComponentbuilderHelper::getModel('dynamic_gets'); + $results = array_unique($results); + foreach ($results as $main_source) + { + // Translate the main_source selection + $text = $model->selectionTranslation($main_source,'main_source'); + // Now add the main_source and its text to the options array + $_filter[] = JHtml::_('select.option', $main_source, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/fieldsfilterdatatype.php b/admin/models/fields/fieldsfilterdatatype.php new file mode 100644 index 000000000..cd1216c50 --- /dev/null +++ b/admin/models/fields/fieldsfilterdatatype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Fieldsfilterdatatype Form Field class for the Componentbuilder component + */ +class JFormFieldFieldsfilterdatatype extends JFormFieldList +{ + /** + * The fieldsfilterdatatype field type. + * + * @var string + */ + public $type = 'fieldsfilterdatatype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('datatype')); + $query->from($db->quoteName('#__componentbuilder_field')); + $query->order($db->quoteName('datatype') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_DATATYPE') . ' -'); + + if ($results) + { + // get fieldsmodel + $model = ComponentbuilderHelper::getModel('fields'); + $results = array_unique($results); + foreach ($results as $datatype) + { + // Translate the datatype selection + $text = $model->selectionTranslation($datatype,'datatype'); + // Now add the datatype and its text to the options array + $_filter[] = JHtml::_('select.option', $datatype, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/fieldsfilterindexes.php b/admin/models/fields/fieldsfilterindexes.php new file mode 100644 index 000000000..6353c699b --- /dev/null +++ b/admin/models/fields/fieldsfilterindexes.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Fieldsfilterindexes Form Field class for the Componentbuilder component + */ +class JFormFieldFieldsfilterindexes extends JFormFieldList +{ + /** + * The fieldsfilterindexes field type. + * + * @var string + */ + public $type = 'fieldsfilterindexes'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('indexes')); + $query->from($db->quoteName('#__componentbuilder_field')); + $query->order($db->quoteName('indexes') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_INDEXES') . ' -'); + + if ($results) + { + // get fieldsmodel + $model = ComponentbuilderHelper::getModel('fields'); + $results = array_unique($results); + foreach ($results as $indexes) + { + // Translate the indexes selection + $text = $model->selectionTranslation($indexes,'indexes'); + // Now add the indexes and its text to the options array + $_filter[] = JHtml::_('select.option', $indexes, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/fieldsfilternullswitch.php b/admin/models/fields/fieldsfilternullswitch.php new file mode 100644 index 000000000..2b035ebab --- /dev/null +++ b/admin/models/fields/fieldsfilternullswitch.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Fieldsfilternullswitch Form Field class for the Componentbuilder component + */ +class JFormFieldFieldsfilternullswitch extends JFormFieldList +{ + /** + * The fieldsfilternullswitch field type. + * + * @var string + */ + public $type = 'fieldsfilternullswitch'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('null_switch')); + $query->from($db->quoteName('#__componentbuilder_field')); + $query->order($db->quoteName('null_switch') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_NULL_SWITCH') . ' -'); + + if ($results) + { + // get fieldsmodel + $model = ComponentbuilderHelper::getModel('fields'); + $results = array_unique($results); + foreach ($results as $null_switch) + { + // Translate the null_switch selection + $text = $model->selectionTranslation($null_switch,'null_switch'); + // Now add the null_switch and its text to the options array + $_filter[] = JHtml::_('select.option', $null_switch, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/fieldsfilterstore.php b/admin/models/fields/fieldsfilterstore.php new file mode 100644 index 000000000..ef6c7e296 --- /dev/null +++ b/admin/models/fields/fieldsfilterstore.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Fieldsfilterstore Form Field class for the Componentbuilder component + */ +class JFormFieldFieldsfilterstore extends JFormFieldList +{ + /** + * The fieldsfilterstore field type. + * + * @var string + */ + public $type = 'fieldsfilterstore'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('store')); + $query->from($db->quoteName('#__componentbuilder_field')); + $query->order($db->quoteName('store') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_STORE') . ' -'); + + if ($results) + { + // get fieldsmodel + $model = ComponentbuilderHelper::getModel('fields'); + $results = array_unique($results); + foreach ($results as $store) + { + // Translate the store selection + $text = $model->selectionTranslation($store,'store'); + // Now add the store and its text to the options array + $_filter[] = JHtml::_('select.option', $store, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/helpdocumentsfilterlocation.php b/admin/models/fields/helpdocumentsfilterlocation.php new file mode 100644 index 000000000..622365996 --- /dev/null +++ b/admin/models/fields/helpdocumentsfilterlocation.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Helpdocumentsfilterlocation Form Field class for the Componentbuilder component + */ +class JFormFieldHelpdocumentsfilterlocation extends JFormFieldList +{ + /** + * The helpdocumentsfilterlocation field type. + * + * @var string + */ + public $type = 'helpdocumentsfilterlocation'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('location')); + $query->from($db->quoteName('#__componentbuilder_help_document')); + $query->order($db->quoteName('location') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_LOCATION') . ' -'); + + if ($results) + { + // get help_documentsmodel + $model = ComponentbuilderHelper::getModel('help_documents'); + $results = array_unique($results); + foreach ($results as $location) + { + // Translate the location selection + $text = $model->selectionTranslation($location,'location'); + // Now add the location and its text to the options array + $_filter[] = JHtml::_('select.option', $location, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/helpdocumentsfiltertype.php b/admin/models/fields/helpdocumentsfiltertype.php new file mode 100644 index 000000000..c2df3b6b8 --- /dev/null +++ b/admin/models/fields/helpdocumentsfiltertype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Helpdocumentsfiltertype Form Field class for the Componentbuilder component + */ +class JFormFieldHelpdocumentsfiltertype extends JFormFieldList +{ + /** + * The helpdocumentsfiltertype field type. + * + * @var string + */ + public $type = 'helpdocumentsfiltertype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('type')); + $query->from($db->quoteName('#__componentbuilder_help_document')); + $query->order($db->quoteName('type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -'); + + if ($results) + { + // get help_documentsmodel + $model = ComponentbuilderHelper::getModel('help_documents'); + $results = array_unique($results); + foreach ($results as $type) + { + // Translate the type selection + $text = $model->selectionTranslation($type,'type'); + // Now add the type and its text to the options array + $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/joomlacomponentsfilterauthor.php b/admin/models/fields/joomlacomponentsfilterauthor.php new file mode 100644 index 000000000..77735e00e --- /dev/null +++ b/admin/models/fields/joomlacomponentsfilterauthor.php @@ -0,0 +1,67 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Joomlacomponentsfilterauthor Form Field class for the Componentbuilder component + */ +class JFormFieldJoomlacomponentsfilterauthor extends JFormFieldList +{ + /** + * The joomlacomponentsfilterauthor field type. + * + * @var string + */ + public $type = 'joomlacomponentsfilterauthor'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('author')); + $query->from($db->quoteName('#__componentbuilder_joomla_component')); + $query->order($db->quoteName('author') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_AUTHOR') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $author) + { + // Now add the author and its text to the options array + $_filter[] = JHtml::_('select.option', $author, $author); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/joomlacomponentsfiltercompanyname.php b/admin/models/fields/joomlacomponentsfiltercompanyname.php new file mode 100644 index 000000000..3b5b3e198 --- /dev/null +++ b/admin/models/fields/joomlacomponentsfiltercompanyname.php @@ -0,0 +1,67 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Joomlacomponentsfiltercompanyname Form Field class for the Componentbuilder component + */ +class JFormFieldJoomlacomponentsfiltercompanyname extends JFormFieldList +{ + /** + * The joomlacomponentsfiltercompanyname field type. + * + * @var string + */ + public $type = 'joomlacomponentsfiltercompanyname'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('companyname')); + $query->from($db->quoteName('#__componentbuilder_joomla_component')); + $query->order($db->quoteName('companyname') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_COMPANYNAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $companyname) + { + // Now add the companyname and its text to the options array + $_filter[] = JHtml::_('select.option', $companyname, $companyname); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/joomlamodulesfiltertarget.php b/admin/models/fields/joomlamodulesfiltertarget.php new file mode 100644 index 000000000..f2e182739 --- /dev/null +++ b/admin/models/fields/joomlamodulesfiltertarget.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Joomlamodulesfiltertarget Form Field class for the Componentbuilder component + */ +class JFormFieldJoomlamodulesfiltertarget extends JFormFieldList +{ + /** + * The joomlamodulesfiltertarget field type. + * + * @var string + */ + public $type = 'joomlamodulesfiltertarget'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('target')); + $query->from($db->quoteName('#__componentbuilder_joomla_module')); + $query->order($db->quoteName('target') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET') . ' -'); + + if ($results) + { + // get joomla_modulesmodel + $model = ComponentbuilderHelper::getModel('joomla_modules'); + $results = array_unique($results); + foreach ($results as $target) + { + // Translate the target selection + $text = $model->selectionTranslation($target,'target'); + // Now add the target and its text to the options array + $_filter[] = JHtml::_('select.option', $target, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/layoutsfilteraddphpview.php b/admin/models/fields/layoutsfilteraddphpview.php new file mode 100644 index 000000000..7336ce4f9 --- /dev/null +++ b/admin/models/fields/layoutsfilteraddphpview.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Layoutsfilteraddphpview Form Field class for the Componentbuilder component + */ +class JFormFieldLayoutsfilteraddphpview extends JFormFieldList +{ + /** + * The layoutsfilteraddphpview field type. + * + * @var string + */ + public $type = 'layoutsfilteraddphpview'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_php_view')); + $query->from($db->quoteName('#__componentbuilder_layout')); + $query->order($db->quoteName('add_php_view') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_VIEW') . ' -'); + + if ($results) + { + // get layoutsmodel + $model = ComponentbuilderHelper::getModel('layouts'); + $results = array_unique($results); + foreach ($results as $add_php_view) + { + // Translate the add_php_view selection + $text = $model->selectionTranslation($add_php_view,'add_php_view'); + // Now add the add_php_view and its text to the options array + $_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/librariesfiltertarget.php b/admin/models/fields/librariesfiltertarget.php new file mode 100644 index 000000000..a10d9003b --- /dev/null +++ b/admin/models/fields/librariesfiltertarget.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Librariesfiltertarget Form Field class for the Componentbuilder component + */ +class JFormFieldLibrariesfiltertarget extends JFormFieldList +{ + /** + * The librariesfiltertarget field type. + * + * @var string + */ + public $type = 'librariesfiltertarget'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('target')); + $query->from($db->quoteName('#__componentbuilder_library')); + $query->order($db->quoteName('target') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TARGET') . ' -'); + + if ($results) + { + // get librariesmodel + $model = ComponentbuilderHelper::getModel('libraries'); + $results = array_unique($results); + foreach ($results as $target) + { + // Translate the target selection + $text = $model->selectionTranslation($target,'target'); + // Now add the target and its text to the options array + $_filter[] = JHtml::_('select.option', $target, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/librariesfiltertype.php b/admin/models/fields/librariesfiltertype.php new file mode 100644 index 000000000..1fc9d61ab --- /dev/null +++ b/admin/models/fields/librariesfiltertype.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Librariesfiltertype Form Field class for the Componentbuilder component + */ +class JFormFieldLibrariesfiltertype extends JFormFieldList +{ + /** + * The librariesfiltertype field type. + * + * @var string + */ + public $type = 'librariesfiltertype'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('type')); + $query->from($db->quoteName('#__componentbuilder_library')); + $query->order($db->quoteName('type') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -'); + + if ($results) + { + // get librariesmodel + $model = ComponentbuilderHelper::getModel('libraries'); + $results = array_unique($results); + foreach ($results as $type) + { + // Translate the type selection + $text = $model->selectionTranslation($type,'type'); + // Now add the type and its text to the options array + $_filter[] = JHtml::_('select.option', $type, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/serversfiltername.php b/admin/models/fields/serversfiltername.php new file mode 100644 index 000000000..c46f59405 --- /dev/null +++ b/admin/models/fields/serversfiltername.php @@ -0,0 +1,67 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Serversfiltername Form Field class for the Componentbuilder component + */ +class JFormFieldServersfiltername extends JFormFieldList +{ + /** + * The serversfiltername field type. + * + * @var string + */ + public $type = 'serversfiltername'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('name')); + $query->from($db->quoteName('#__componentbuilder_server')); + $query->order($db->quoteName('name') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_NAME') . ' -'); + + if ($results) + { + $results = array_unique($results); + foreach ($results as $name) + { + // Now add the name and its text to the options array + $_filter[] = JHtml::_('select.option', $name, $name); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/serversfilterprotocol.php b/admin/models/fields/serversfilterprotocol.php new file mode 100644 index 000000000..0c28a0cbf --- /dev/null +++ b/admin/models/fields/serversfilterprotocol.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Serversfilterprotocol Form Field class for the Componentbuilder component + */ +class JFormFieldServersfilterprotocol extends JFormFieldList +{ + /** + * The serversfilterprotocol field type. + * + * @var string + */ + public $type = 'serversfilterprotocol'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('protocol')); + $query->from($db->quoteName('#__componentbuilder_server')); + $query->order($db->quoteName('protocol') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_PROTOCOL') . ' -'); + + if ($results) + { + // get serversmodel + $model = ComponentbuilderHelper::getModel('servers'); + $results = array_unique($results); + foreach ($results as $protocol) + { + // Translate the protocol selection + $text = $model->selectionTranslation($protocol,'protocol'); + // Now add the protocol and its text to the options array + $_filter[] = JHtml::_('select.option', $protocol, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/siteviewsfilteraddcustombutton.php b/admin/models/fields/siteviewsfilteraddcustombutton.php new file mode 100644 index 000000000..a7fd728c5 --- /dev/null +++ b/admin/models/fields/siteviewsfilteraddcustombutton.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Siteviewsfilteraddcustombutton Form Field class for the Componentbuilder component + */ +class JFormFieldSiteviewsfilteraddcustombutton extends JFormFieldList +{ + /** + * The siteviewsfilteraddcustombutton field type. + * + * @var string + */ + public $type = 'siteviewsfilteraddcustombutton'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_custom_button')); + $query->from($db->quoteName('#__componentbuilder_site_view')); + $query->order($db->quoteName('add_custom_button') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_CUSTOM_BUTTON') . ' -'); + + if ($results) + { + // get site_viewsmodel + $model = ComponentbuilderHelper::getModel('site_views'); + $results = array_unique($results); + foreach ($results as $add_custom_button) + { + // Translate the add_custom_button selection + $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); + // Now add the add_custom_button and its text to the options array + $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/siteviewsfilteraddphpajax.php b/admin/models/fields/siteviewsfilteraddphpajax.php new file mode 100644 index 000000000..2437db426 --- /dev/null +++ b/admin/models/fields/siteviewsfilteraddphpajax.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Siteviewsfilteraddphpajax Form Field class for the Componentbuilder component + */ +class JFormFieldSiteviewsfilteraddphpajax extends JFormFieldList +{ + /** + * The siteviewsfilteraddphpajax field type. + * + * @var string + */ + public $type = 'siteviewsfilteraddphpajax'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_php_ajax')); + $query->from($db->quoteName('#__componentbuilder_site_view')); + $query->order($db->quoteName('add_php_ajax') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_AJAX') . ' -'); + + if ($results) + { + // get site_viewsmodel + $model = ComponentbuilderHelper::getModel('site_views'); + $results = array_unique($results); + foreach ($results as $add_php_ajax) + { + // Translate the add_php_ajax selection + $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); + // Now add the add_php_ajax and its text to the options array + $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fields/templatesfilteraddphpview.php b/admin/models/fields/templatesfilteraddphpview.php new file mode 100644 index 000000000..66e29a52d --- /dev/null +++ b/admin/models/fields/templatesfilteraddphpview.php @@ -0,0 +1,71 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Templatesfilteraddphpview Form Field class for the Componentbuilder component + */ +class JFormFieldTemplatesfilteraddphpview extends JFormFieldList +{ + /** + * The templatesfilteraddphpview field type. + * + * @var string + */ + public $type = 'templatesfilteraddphpview'; + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + protected function getOptions() + { + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Select the text. + $query->select($db->quoteName('add_php_view')); + $query->from($db->quoteName('#__componentbuilder_template')); + $query->order($db->quoteName('add_php_view') . ' ASC'); + + // Reset the query using our newly populated query object. + $db->setQuery($query); + + $results = $db->loadColumn(); + $_filter = array(); + $_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ADD_PHP_VIEW') . ' -'); + + if ($results) + { + // get templatesmodel + $model = ComponentbuilderHelper::getModel('templates'); + $results = array_unique($results); + foreach ($results as $add_php_view) + { + // Translate the add_php_view selection + $text = $model->selectionTranslation($add_php_view,'add_php_view'); + // Now add the add_php_view and its text to the options array + $_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text)); + } + } + return $_filter; + } +} diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index f303e90b1..b79279e9f 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -288,9 +288,17 @@ class ComponentbuilderModelFieldtype extends JModelAdmin $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) diff --git a/admin/models/fieldtypes.php b/admin/models/fieldtypes.php index d4a5615aa..9546781aa 100644 --- a/admin/models/fieldtypes.php +++ b/admin/models/fieldtypes.php @@ -26,24 +26,31 @@ class ComponentbuilderModelFieldtypes extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name', - 'a.short_description','short_description', 'c.title','category_title', 'c.id', 'category_id', - 'a.catid', 'catid' + 'a.catid','catid', + 'a.name','name', + 'a.short_description','short_description' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -53,12 +60,32 @@ class ComponentbuilderModelFieldtypes extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } - $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); - $this->setState('filter.short_description', $short_description); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category'); $this->setState('filter.category', $category); @@ -66,26 +93,26 @@ class ComponentbuilderModelFieldtypes extends JModelList $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id'); $this->setState('filter.category_id', $categoryId); - $catid = $app->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); - $this->setState('filter.catid', $catid); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + $catid = $this->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); + if ($formSubmited) + { + $catid = $app->input->post->get('catid'); + $this->setState('filter.catid', $catid); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); + if ($formSubmited) + { + $short_description = $app->input->post->get('short_description'); + $this->setState('filter.short_description', $short_description); + } // List state information. parent::populateState($ordering, $direction); @@ -165,9 +192,17 @@ class ComponentbuilderModelFieldtypes extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -207,15 +242,15 @@ class ComponentbuilderModelFieldtypes extends JModelList } elseif (is_array($categoryId)) { - ArrayHelper::toInteger($categoryId); + $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); - $query->where('a.category IN (' . $categoryId . ')'); + $query->where('a.catid IN (' . $categoryId . ')'); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -358,14 +393,59 @@ class ComponentbuilderModelFieldtypes extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); + // Check if the value is an array + $_category = $this->getState('filter.category'); + if (ComponentbuilderHelper::checkArray($_category)) + { + $id .= ':' . implode(':', $_category); + } + // Check if this is only an number or string + elseif (is_numeric($_category) + || ComponentbuilderHelper::checkString($_category)) + { + $id .= ':' . $_category; + } + // Check if the value is an array + $_category_id = $this->getState('filter.category_id'); + if (ComponentbuilderHelper::checkArray($_category_id)) + { + $id .= ':' . implode(':', $_category_id); + } + // Check if this is only an number or string + elseif (is_numeric($_category_id) + || ComponentbuilderHelper::checkString($_category_id)) + { + $id .= ':' . $_category_id; + } + // Check if the value is an array + $_catid = $this->getState('filter.catid'); + if (ComponentbuilderHelper::checkArray($_catid)) + { + $id .= ':' . implode(':', $_catid); + } + // Check if this is only an number or string + elseif (is_numeric($_catid) + || ComponentbuilderHelper::checkString($_catid)) + { + $id .= ':' . $_catid; + } $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.short_description'); - $id .= ':' . $this->getState('filter.category'); - $id .= ':' . $this->getState('filter.category_id'); - $id .= ':' . $this->getState('filter.catid'); + $id .= ':' . $this->getState('filter.short_description'); return parent::getStoreId($id); } diff --git a/admin/models/forms/admin_fields.xml b/admin/models/forms/admin_fields.xml index 29917814f..6700869ad 100644 --- a/admin/models/forms/admin_fields.xml +++ b/admin/models/forms/admin_fields.xml @@ -196,16 +196,24 @@ description="COM_COMPONENTBUILDER_ADMIN_FIELDS_SEARCH_DESCRIPTION" class="inputbox" /> - + + class="fieldSmall" + multiple="false" + default="" + onchange="explainFilterBehaviour(this)"> + + + + + @@ -653,13 +653,28 @@ description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_PORT_DESCRIPTION" class="inputbox" /> + + + + + + - + @@ -336,42 +421,6 @@ - - - - - - - - - - - - - - - - + + - + + default="0" + required="true"> @@ -446,21 +485,22 @@ message="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_MESSAGE" hint="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_HINT" /> - + - - - - + type="editor" + name="php_helper_admin" + label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_ADMIN_LABEL" + description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_ADMIN_DESCRIPTION" + width="100%" + height="550px" + cols="15" + rows="80" + buttons="no" + syntax="php" + editor="codemirror|none" + filter="raw" + validate="code" + /> COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO - + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CUSTOM_USED_IN_CUSTOM_CODE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + - - - + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + type="radio" + name="add_sql" + label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL_LABEL" + class="btn-group btn-group-yesno" + default="0" + required="true"> + + + + - + + type="radio" + name="add_sql_uninstall" + label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL_UNINSTALL_LABEL" + class="btn-group btn-group-yesno" + default="0" + required="true"> + + + + - + + type="list" + name="assets_table_fix" + label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_LABEL" + description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_DESCRIPTION" + class="list_class" + multiple="false" + default="3"> + + + + + + input->get('layout')) { $this->context .= '.' . $layout; - } - $title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title'); - $this->setState('filter.title', $title); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); - $this->setState('filter.type', $type); + if ($formSubmited) + { + $type = $app->input->post->get('type'); + $this->setState('filter.type', $type); + } $location = $this->getUserStateFromRequest($this->context . '.filter.location', 'filter_location'); - $this->setState('filter.location', $location); + if ($formSubmited) + { + $location = $app->input->post->get('location'); + $this->setState('filter.location', $location); + } $admin_view = $this->getUserStateFromRequest($this->context . '.filter.admin_view', 'filter_admin_view'); - $this->setState('filter.admin_view', $admin_view); + if ($formSubmited) + { + $admin_view = $app->input->post->get('admin_view'); + $this->setState('filter.admin_view', $admin_view); + } $site_view = $this->getUserStateFromRequest($this->context . '.filter.site_view', 'filter_site_view'); - $this->setState('filter.site_view', $site_view); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $site_view = $app->input->post->get('site_view'); + $this->setState('filter.site_view', $site_view); + } + + $title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title'); + if ($formSubmited) + { + $title = $app->input->post->get('title'); + $this->setState('filter.title', $title); + } // List state information. parent::populateState($ordering, $direction); @@ -236,29 +270,77 @@ class ComponentbuilderModelHelp_documents extends JModelList } // Filter by Type. - if ($type = $this->getState('filter.type')) + $_type = $this->getState('filter.type'); + if (is_numeric($_type)) { - $query->where('a.type = ' . $db->quote($db->escape($type))); + if (is_float($_type)) + { + $query->where('a.type = ' . (float) $_type); + } + else + { + $query->where('a.type = ' . (int) $_type); + } + } + elseif (ComponentbuilderHelper::checkString($_type)) + { + $query->where('a.type = ' . $db->quote($db->escape($_type))); } // Filter by Location. - if ($location = $this->getState('filter.location')) + $_location = $this->getState('filter.location'); + if (is_numeric($_location)) { - $query->where('a.location = ' . $db->quote($db->escape($location))); + if (is_float($_location)) + { + $query->where('a.location = ' . (float) $_location); + } + else + { + $query->where('a.location = ' . (int) $_location); + } } - // Filter by admin_view. - if ($admin_view = $this->getState('filter.admin_view')) + elseif (ComponentbuilderHelper::checkString($_location)) { - $query->where('a.admin_view = ' . $db->quote($db->escape($admin_view))); + $query->where('a.location = ' . $db->quote($db->escape($_location))); } - // Filter by site_view. - if ($site_view = $this->getState('filter.site_view')) + // Filter by Admin_view. + $_admin_view = $this->getState('filter.admin_view'); + if (is_numeric($_admin_view)) { - $query->where('a.site_view = ' . $db->quote($db->escape($site_view))); + if (is_float($_admin_view)) + { + $query->where('a.admin_view = ' . (float) $_admin_view); + } + else + { + $query->where('a.admin_view = ' . (int) $_admin_view); + } + } + elseif (ComponentbuilderHelper::checkString($_admin_view)) + { + $query->where('a.admin_view = ' . $db->quote($db->escape($_admin_view))); + } + // Filter by Site_view. + $_site_view = $this->getState('filter.site_view'); + if (is_numeric($_site_view)) + { + if (is_float($_site_view)) + { + $query->where('a.site_view = ' . (float) $_site_view); + } + else + { + $query->where('a.site_view = ' . (int) $_site_view); + } + } + elseif (ComponentbuilderHelper::checkString($_site_view)) + { + $query->where('a.site_view = ' . $db->quote($db->escape($_site_view))); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -398,11 +480,11 @@ class ComponentbuilderModelHelp_documents extends JModelList $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.title'); $id .= ':' . $this->getState('filter.type'); $id .= ':' . $this->getState('filter.location'); $id .= ':' . $this->getState('filter.admin_view'); - $id .= ':' . $this->getState('filter.site_view'); + $id .= ':' . $this->getState('filter.site_view'); + $id .= ':' . $this->getState('filter.title'); return parent::getStoreId($id); } diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index 1df6a579f..65594932e 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -89,33 +89,13 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin 'css_site' ) ), - 'dynamic_integration' => array( - 'left' => array( - 'add_update_server', - 'update_server_url', - 'update_server_target', - 'note_update_server_note_ftp', - 'note_update_server_note_zip', - 'note_update_server_note_other', - 'update_server', - 'add_sales_server', - 'sales_server' - ), - 'right' => array( - 'translation_tool', - 'note_crowdin', - 'crowdin_project_identifier', - 'crowdin_project_api_key', - 'crowdin_username', - 'crowdin_account_api_key' - ) - ), 'mysql' => array( 'fullwidth' => array( 'add_sql', 'sql', 'add_sql_uninstall', - 'sql_uninstall' + 'sql_uninstall', + 'assets_table_fix' ) ), 'dash_install' => array( @@ -140,6 +120,27 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin 'php_method_uninstall' ) ), + 'dynamic_integration' => array( + 'left' => array( + 'add_update_server', + 'update_server_url', + 'update_server_target', + 'note_update_server_note_ftp', + 'note_update_server_note_zip', + 'note_update_server_note_other', + 'update_server', + 'add_sales_server', + 'sales_server' + ), + 'right' => array( + 'translation_tool', + 'note_crowdin', + 'crowdin_project_identifier', + 'crowdin_project_api_key', + 'crowdin_username', + 'crowdin_account_api_key' + ) + ), 'readme' => array( 'left' => array( 'addreadme', @@ -339,70 +340,34 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->buildcompsql)) - { - // base64 Decode buildcompsql. - $item->buildcompsql = base64_decode($item->buildcompsql); - } - - if (!empty($item->php_helper_both)) - { - // base64 Decode php_helper_both. - $item->php_helper_both = base64_decode($item->php_helper_both); - } - - if (!empty($item->php_helper_admin)) - { - // base64 Decode php_helper_admin. - $item->php_helper_admin = base64_decode($item->php_helper_admin); - } - - if (!empty($item->php_admin_event)) - { - // base64 Decode php_admin_event. - $item->php_admin_event = base64_decode($item->php_admin_event); - } - - if (!empty($item->php_helper_site)) - { - // base64 Decode php_helper_site. - $item->php_helper_site = base64_decode($item->php_helper_site); - } - if (!empty($item->php_site_event)) { // base64 Decode php_site_event. $item->php_site_event = base64_decode($item->php_site_event); } - if (!empty($item->javascript)) - { - // base64 Decode javascript. - $item->javascript = base64_decode($item->javascript); - } - if (!empty($item->css_admin)) { // base64 Decode css_admin. $item->css_admin = base64_decode($item->css_admin); } - if (!empty($item->css_site)) + if (!empty($item->php_helper_both)) { - // base64 Decode css_site. - $item->css_site = base64_decode($item->css_site); + // base64 Decode php_helper_both. + $item->php_helper_both = base64_decode($item->php_helper_both); } - if (!empty($item->php_preflight_install)) + if (!empty($item->php_admin_event)) { - // base64 Decode php_preflight_install. - $item->php_preflight_install = base64_decode($item->php_preflight_install); + // base64 Decode php_admin_event. + $item->php_admin_event = base64_decode($item->php_admin_event); } - if (!empty($item->php_preflight_update)) + if (!empty($item->sql_uninstall)) { - // base64 Decode php_preflight_update. - $item->php_preflight_update = base64_decode($item->php_preflight_update); + // base64 Decode sql_uninstall. + $item->sql_uninstall = base64_decode($item->sql_uninstall); } if (!empty($item->php_postflight_install)) @@ -411,10 +376,10 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin $item->php_postflight_install = base64_decode($item->php_postflight_install); } - if (!empty($item->php_postflight_update)) + if (!empty($item->php_preflight_install)) { - // base64 Decode php_postflight_update. - $item->php_postflight_update = base64_decode($item->php_postflight_update); + // base64 Decode php_preflight_install. + $item->php_preflight_install = base64_decode($item->php_preflight_install); } if (!empty($item->php_method_uninstall)) @@ -423,16 +388,52 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin $item->php_method_uninstall = base64_decode($item->php_method_uninstall); } + if (!empty($item->php_helper_admin)) + { + // base64 Decode php_helper_admin. + $item->php_helper_admin = base64_decode($item->php_helper_admin); + } + + if (!empty($item->php_helper_site)) + { + // base64 Decode php_helper_site. + $item->php_helper_site = base64_decode($item->php_helper_site); + } + + if (!empty($item->javascript)) + { + // base64 Decode javascript. + $item->javascript = base64_decode($item->javascript); + } + + if (!empty($item->css_site)) + { + // base64 Decode css_site. + $item->css_site = base64_decode($item->css_site); + } + + if (!empty($item->php_preflight_update)) + { + // base64 Decode php_preflight_update. + $item->php_preflight_update = base64_decode($item->php_preflight_update); + } + + if (!empty($item->php_postflight_update)) + { + // base64 Decode php_postflight_update. + $item->php_postflight_update = base64_decode($item->php_postflight_update); + } + if (!empty($item->sql)) { // base64 Decode sql. $item->sql = base64_decode($item->sql); } - if (!empty($item->sql_uninstall)) + if (!empty($item->buildcompsql)) { - // base64 Decode sql_uninstall. - $item->sql_uninstall = base64_decode($item->sql_uninstall); + // base64 Decode buildcompsql. + $item->buildcompsql = base64_decode($item->buildcompsql); } if (!empty($item->readme)) @@ -446,18 +447,18 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin // Get the encryption object. $basic = new FOFEncryptAes($basickey); - if (!empty($item->crowdin_username) && $basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true))) - { - // basic decrypt data crowdin_username. - $item->crowdin_username = rtrim($basic->decryptString($item->crowdin_username), "\0"); - } - if (!empty($item->whmcs_key) && $basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) { // basic decrypt data whmcs_key. $item->whmcs_key = rtrim($basic->decryptString($item->whmcs_key), "\0"); } + if (!empty($item->crowdin_username) && $basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true))) + { + // basic decrypt data crowdin_username. + $item->crowdin_username = rtrim($basic->decryptString($item->crowdin_username), "\0"); + } + if (!empty($item->export_key) && $basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true))) { // basic decrypt data export_key. @@ -1412,70 +1413,34 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin $data['addcontributors'] = ''; } - // Set the buildcompsql string to base64 string. - if (isset($data['buildcompsql'])) - { - $data['buildcompsql'] = base64_encode($data['buildcompsql']); - } - - // Set the php_helper_both string to base64 string. - if (isset($data['php_helper_both'])) - { - $data['php_helper_both'] = base64_encode($data['php_helper_both']); - } - - // Set the php_helper_admin string to base64 string. - if (isset($data['php_helper_admin'])) - { - $data['php_helper_admin'] = base64_encode($data['php_helper_admin']); - } - - // Set the php_admin_event string to base64 string. - if (isset($data['php_admin_event'])) - { - $data['php_admin_event'] = base64_encode($data['php_admin_event']); - } - - // Set the php_helper_site string to base64 string. - if (isset($data['php_helper_site'])) - { - $data['php_helper_site'] = base64_encode($data['php_helper_site']); - } - // Set the php_site_event string to base64 string. if (isset($data['php_site_event'])) { $data['php_site_event'] = base64_encode($data['php_site_event']); } - // Set the javascript string to base64 string. - if (isset($data['javascript'])) - { - $data['javascript'] = base64_encode($data['javascript']); - } - // Set the css_admin string to base64 string. if (isset($data['css_admin'])) { $data['css_admin'] = base64_encode($data['css_admin']); } - // Set the css_site string to base64 string. - if (isset($data['css_site'])) + // Set the php_helper_both string to base64 string. + if (isset($data['php_helper_both'])) { - $data['css_site'] = base64_encode($data['css_site']); + $data['php_helper_both'] = base64_encode($data['php_helper_both']); } - // Set the php_preflight_install string to base64 string. - if (isset($data['php_preflight_install'])) + // Set the php_admin_event string to base64 string. + if (isset($data['php_admin_event'])) { - $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); + $data['php_admin_event'] = base64_encode($data['php_admin_event']); } - // Set the php_preflight_update string to base64 string. - if (isset($data['php_preflight_update'])) + // Set the sql_uninstall string to base64 string. + if (isset($data['sql_uninstall'])) { - $data['php_preflight_update'] = base64_encode($data['php_preflight_update']); + $data['sql_uninstall'] = base64_encode($data['sql_uninstall']); } // Set the php_postflight_install string to base64 string. @@ -1484,10 +1449,10 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin $data['php_postflight_install'] = base64_encode($data['php_postflight_install']); } - // Set the php_postflight_update string to base64 string. - if (isset($data['php_postflight_update'])) + // Set the php_preflight_install string to base64 string. + if (isset($data['php_preflight_install'])) { - $data['php_postflight_update'] = base64_encode($data['php_postflight_update']); + $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); } // Set the php_method_uninstall string to base64 string. @@ -1496,16 +1461,52 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); } + // Set the php_helper_admin string to base64 string. + if (isset($data['php_helper_admin'])) + { + $data['php_helper_admin'] = base64_encode($data['php_helper_admin']); + } + + // Set the php_helper_site string to base64 string. + if (isset($data['php_helper_site'])) + { + $data['php_helper_site'] = base64_encode($data['php_helper_site']); + } + + // Set the javascript string to base64 string. + if (isset($data['javascript'])) + { + $data['javascript'] = base64_encode($data['javascript']); + } + + // Set the css_site string to base64 string. + if (isset($data['css_site'])) + { + $data['css_site'] = base64_encode($data['css_site']); + } + + // Set the php_preflight_update string to base64 string. + if (isset($data['php_preflight_update'])) + { + $data['php_preflight_update'] = base64_encode($data['php_preflight_update']); + } + + // Set the php_postflight_update string to base64 string. + if (isset($data['php_postflight_update'])) + { + $data['php_postflight_update'] = base64_encode($data['php_postflight_update']); + } + // Set the sql string to base64 string. if (isset($data['sql'])) { $data['sql'] = base64_encode($data['sql']); } - // Set the sql_uninstall string to base64 string. - if (isset($data['sql_uninstall'])) + // Set the buildcompsql string to base64 string. + if (isset($data['buildcompsql'])) { - $data['sql_uninstall'] = base64_encode($data['sql_uninstall']); + $data['buildcompsql'] = base64_encode($data['buildcompsql']); } // Set the readme string to base64 string. @@ -1519,18 +1520,18 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin // Get the encryption object $basic = new FOFEncryptAes($basickey); - // Encrypt data crowdin_username. - if (isset($data['crowdin_username']) && $basickey) - { - $data['crowdin_username'] = $basic->encryptString($data['crowdin_username']); - } - // Encrypt data whmcs_key. if (isset($data['whmcs_key']) && $basickey) { $data['whmcs_key'] = $basic->encryptString($data['whmcs_key']); } + // Encrypt data crowdin_username. + if (isset($data['crowdin_username']) && $basickey) + { + $data['crowdin_username'] = $basic->encryptString($data['crowdin_username']); + } + // Encrypt data export_key. if (isset($data['export_key']) && $basickey) { diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index 70a10a432..62072d7c9 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -26,14 +26,15 @@ class ComponentbuilderModelJoomla_components extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', + 'a.companyname','companyname', + 'a.author','author', 'a.system_name','system_name', 'a.name_code','name_code', - 'a.short_description','short_description', - 'a.companyname','companyname', - 'a.author','author' + 'a.short_description','short_description' ); } @@ -2075,11 +2076,17 @@ class ComponentbuilderModelJoomla_components extends JModelList return false; } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -2089,39 +2096,67 @@ class ComponentbuilderModelJoomla_components extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); - $this->setState('filter.system_name', $system_name); + } - $name_code = $this->getUserStateFromRequest($this->context . '.filter.name_code', 'filter_name_code'); - $this->setState('filter.name_code', $name_code); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); - $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); - $this->setState('filter.short_description', $short_description); + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $companyname = $this->getUserStateFromRequest($this->context . '.filter.companyname', 'filter_companyname'); - $this->setState('filter.companyname', $companyname); + if ($formSubmited) + { + $companyname = $app->input->post->get('companyname'); + $this->setState('filter.companyname', $companyname); + } $author = $this->getUserStateFromRequest($this->context . '.filter.author', 'filter_author'); - $this->setState('filter.author', $author); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $author = $app->input->post->get('author'); + $this->setState('filter.author', $author); + } + + $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); + if ($formSubmited) + { + $system_name = $app->input->post->get('system_name'); + $this->setState('filter.system_name', $system_name); + } + + $name_code = $this->getUserStateFromRequest($this->context . '.filter.name_code', 'filter_name_code'); + if ($formSubmited) + { + $name_code = $app->input->post->get('name_code'); + $this->setState('filter.name_code', $name_code); + } + + $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); + if ($formSubmited) + { + $short_description = $app->input->post->get('short_description'); + $this->setState('filter.short_description', $short_description); + } // List state information. parent::populateState($ordering, $direction); @@ -2199,9 +2234,17 @@ class ComponentbuilderModelJoomla_components extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -2225,14 +2268,38 @@ class ComponentbuilderModelJoomla_components extends JModelList } // Filter by Companyname. - if ($companyname = $this->getState('filter.companyname')) + $_companyname = $this->getState('filter.companyname'); + if (is_numeric($_companyname)) { - $query->where('a.companyname = ' . $db->quote($db->escape($companyname))); + if (is_float($_companyname)) + { + $query->where('a.companyname = ' . (float) $_companyname); + } + else + { + $query->where('a.companyname = ' . (int) $_companyname); + } + } + elseif (ComponentbuilderHelper::checkString($_companyname)) + { + $query->where('a.companyname = ' . $db->quote($db->escape($_companyname))); } // Filter by Author. - if ($author = $this->getState('filter.author')) + $_author = $this->getState('filter.author'); + if (is_numeric($_author)) { - $query->where('a.author = ' . $db->quote($db->escape($author))); + if (is_float($_author)) + { + $query->where('a.author = ' . (float) $_author); + } + else + { + $query->where('a.author = ' . (int) $_author); + } + } + elseif (ComponentbuilderHelper::checkString($_author)) + { + $query->where('a.author = ' . $db->quote($db->escape($_author))); } // Add the list ordering clause. @@ -2328,6 +2395,41 @@ class ComponentbuilderModelJoomla_components extends JModelList continue; } + // decode php_site_event + $item->php_site_event = base64_decode($item->php_site_event); + // decode css_admin + $item->css_admin = base64_decode($item->css_admin); + // decode php_helper_both + $item->php_helper_both = base64_decode($item->php_helper_both); + // decode php_admin_event + $item->php_admin_event = base64_decode($item->php_admin_event); + // decode sql_uninstall + $item->sql_uninstall = base64_decode($item->sql_uninstall); + // decode php_postflight_install + $item->php_postflight_install = base64_decode($item->php_postflight_install); + // decode php_preflight_install + $item->php_preflight_install = base64_decode($item->php_preflight_install); + // decode php_method_uninstall + $item->php_method_uninstall = base64_decode($item->php_method_uninstall); + // decode php_helper_admin + $item->php_helper_admin = base64_decode($item->php_helper_admin); + // decode php_helper_site + $item->php_helper_site = base64_decode($item->php_helper_site); + // decode javascript + $item->javascript = base64_decode($item->javascript); + // decode css_site + $item->css_site = base64_decode($item->css_site); + if ($basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) + { + // decrypt whmcs_key + $item->whmcs_key = $basic->decryptString($item->whmcs_key); + } + // decode php_preflight_update + $item->php_preflight_update = base64_decode($item->php_preflight_update); + // decode php_postflight_update + $item->php_postflight_update = base64_decode($item->php_postflight_update); + // decode sql + $item->sql = base64_decode($item->sql); if ($basickey && !is_numeric($item->crowdin_username) && $item->crowdin_username === base64_encode(base64_decode($item->crowdin_username, true))) { // decrypt crowdin_username @@ -2335,46 +2437,11 @@ class ComponentbuilderModelJoomla_components extends JModelList } // decode buildcompsql $item->buildcompsql = base64_decode($item->buildcompsql); - if ($basickey && !is_numeric($item->whmcs_key) && $item->whmcs_key === base64_encode(base64_decode($item->whmcs_key, true))) - { - // decrypt whmcs_key - $item->whmcs_key = $basic->decryptString($item->whmcs_key); - } - // decode php_helper_both - $item->php_helper_both = base64_decode($item->php_helper_both); - // decode php_helper_admin - $item->php_helper_admin = base64_decode($item->php_helper_admin); - // decode php_admin_event - $item->php_admin_event = base64_decode($item->php_admin_event); - // decode php_helper_site - $item->php_helper_site = base64_decode($item->php_helper_site); - // decode php_site_event - $item->php_site_event = base64_decode($item->php_site_event); - // decode javascript - $item->javascript = base64_decode($item->javascript); - // decode css_admin - $item->css_admin = base64_decode($item->css_admin); - // decode css_site - $item->css_site = base64_decode($item->css_site); - // decode php_preflight_install - $item->php_preflight_install = base64_decode($item->php_preflight_install); - // decode php_preflight_update - $item->php_preflight_update = base64_decode($item->php_preflight_update); if ($basickey && !is_numeric($item->export_key) && $item->export_key === base64_encode(base64_decode($item->export_key, true))) { // decrypt export_key $item->export_key = $basic->decryptString($item->export_key); } - // decode php_postflight_install - $item->php_postflight_install = base64_decode($item->php_postflight_install); - // decode php_postflight_update - $item->php_postflight_update = base64_decode($item->php_postflight_update); - // decode php_method_uninstall - $item->php_method_uninstall = base64_decode($item->php_method_uninstall); - // decode sql - $item->sql = base64_decode($item->sql); - // decode sql_uninstall - $item->sql_uninstall = base64_decode($item->sql_uninstall); // decode readme $item->readme = base64_decode($item->readme); if ($basickey && !is_numeric($item->crowdin_project_api_key) && $item->crowdin_project_api_key === base64_encode(base64_decode($item->crowdin_project_api_key, true))) @@ -2444,14 +2511,26 @@ class ComponentbuilderModelJoomla_components extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.companyname'); + $id .= ':' . $this->getState('filter.author'); $id .= ':' . $this->getState('filter.system_name'); $id .= ':' . $this->getState('filter.name_code'); - $id .= ':' . $this->getState('filter.short_description'); - $id .= ':' . $this->getState('filter.companyname'); - $id .= ':' . $this->getState('filter.author'); + $id .= ':' . $this->getState('filter.short_description'); return parent::getStoreId($id); } diff --git a/admin/models/joomla_modules.php b/admin/models/joomla_modules.php index b9aea2804..998cf15b5 100644 --- a/admin/models/joomla_modules.php +++ b/admin/models/joomla_modules.php @@ -26,22 +26,29 @@ class ComponentbuilderModelJoomla_modules extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', + 'a.target','target', 'a.system_name','system_name', - 'a.description','description', - 'a.target','target' + 'a.description','description' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -51,33 +58,53 @@ class ComponentbuilderModelJoomla_modules extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); - $this->setState('filter.system_name', $system_name); + } - $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); - $this->setState('filter.description', $description); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $target = $this->getUserStateFromRequest($this->context . '.filter.target', 'filter_target'); - $this->setState('filter.target', $target); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $target = $app->input->post->get('target'); + $this->setState('filter.target', $target); + } + + $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); + if ($formSubmited) + { + $system_name = $app->input->post->get('system_name'); + $this->setState('filter.system_name', $system_name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } // List state information. parent::populateState($ordering, $direction); @@ -189,9 +216,17 @@ class ComponentbuilderModelJoomla_modules extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -215,9 +250,21 @@ class ComponentbuilderModelJoomla_modules extends JModelList } // Filter by Target. - if ($target = $this->getState('filter.target')) + $_target = $this->getState('filter.target'); + if (is_numeric($_target)) { - $query->where('a.target = ' . $db->quote($db->escape($target))); + if (is_float($_target)) + { + $query->where('a.target = ' . (float) $_target); + } + else + { + $query->where('a.target = ' . (int) $_target); + } + } + elseif (ComponentbuilderHelper::checkString($_target)) + { + $query->where('a.target = ' . $db->quote($db->escape($_target))); } // Add the list ordering clause. @@ -243,12 +290,24 @@ class ComponentbuilderModelJoomla_modules extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.target'); $id .= ':' . $this->getState('filter.system_name'); - $id .= ':' . $this->getState('filter.description'); - $id .= ':' . $this->getState('filter.target'); + $id .= ':' . $this->getState('filter.description'); return parent::getStoreId($id); } diff --git a/admin/models/joomla_modules_files_folders_urls.php b/admin/models/joomla_modules_files_folders_urls.php index 346ec7db3..9c5894239 100644 --- a/admin/models/joomla_modules_files_folders_urls.php +++ b/admin/models/joomla_modules_files_folders_urls.php @@ -26,6 +26,7 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelJoomla_modules_files_folders_urls extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/joomla_modules_updates.php b/admin/models/joomla_modules_updates.php index 1550f283f..d7fa50f39 100644 --- a/admin/models/joomla_modules_updates.php +++ b/admin/models/joomla_modules_updates.php @@ -26,6 +26,7 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelJoomla_modules_updates extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/joomla_plugin_groups.php b/admin/models/joomla_plugin_groups.php index 2b76a3316..6a8061839 100644 --- a/admin/models/joomla_plugin_groups.php +++ b/admin/models/joomla_plugin_groups.php @@ -26,21 +26,28 @@ class ComponentbuilderModelJoomla_plugin_groups extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name', - 'g.name' + 'g.name','class_extends', + 'a.name','name' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -50,30 +57,46 @@ class ComponentbuilderModelJoomla_plugin_groups extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $class_extends = $this->getUserStateFromRequest($this->context . '.filter.class_extends', 'filter_class_extends'); - $this->setState('filter.class_extends', $class_extends); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $class_extends = $app->input->post->get('class_extends'); + $this->setState('filter.class_extends', $class_extends); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } // List state information. parent::populateState($ordering, $direction); @@ -134,9 +157,17 @@ class ComponentbuilderModelJoomla_plugin_groups extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -159,15 +190,27 @@ class ComponentbuilderModelJoomla_plugin_groups extends JModelList } } - // Filter by class_extends. - if ($class_extends = $this->getState('filter.class_extends')) + // Filter by Class_extends. + $_class_extends = $this->getState('filter.class_extends'); + if (is_numeric($_class_extends)) { - $query->where('a.class_extends = ' . $db->quote($db->escape($class_extends))); + if (is_float($_class_extends)) + { + $query->where('a.class_extends = ' . (float) $_class_extends); + } + else + { + $query->where('a.class_extends = ' . (int) $_class_extends); + } + } + elseif (ComponentbuilderHelper::checkString($_class_extends)) + { + $query->where('a.class_extends = ' . $db->quote($db->escape($_class_extends))); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -188,11 +231,23 @@ class ComponentbuilderModelJoomla_plugin_groups extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.class_extends'); + $id .= ':' . $this->getState('filter.class_extends'); + $id .= ':' . $this->getState('filter.name'); return parent::getStoreId($id); } diff --git a/admin/models/joomla_plugins.php b/admin/models/joomla_plugins.php index c121ad332..fe9ff6ca6 100644 --- a/admin/models/joomla_plugins.php +++ b/admin/models/joomla_plugins.php @@ -26,12 +26,13 @@ class ComponentbuilderModelJoomla_plugins extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.system_name','system_name', - 'g.name', - 'h.name' + 'g.name','class_extends', + 'h.name','joomla_plugin_group', + 'a.system_name','system_name' ); } @@ -207,11 +208,17 @@ class ComponentbuilderModelJoomla_plugins extends JModelList return true; } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -221,33 +228,53 @@ class ComponentbuilderModelJoomla_plugins extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); - $this->setState('filter.system_name', $system_name); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $class_extends = $this->getUserStateFromRequest($this->context . '.filter.class_extends', 'filter_class_extends'); - $this->setState('filter.class_extends', $class_extends); + if ($formSubmited) + { + $class_extends = $app->input->post->get('class_extends'); + $this->setState('filter.class_extends', $class_extends); + } $joomla_plugin_group = $this->getUserStateFromRequest($this->context . '.filter.joomla_plugin_group', 'filter_joomla_plugin_group'); - $this->setState('filter.joomla_plugin_group', $joomla_plugin_group); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $joomla_plugin_group = $app->input->post->get('joomla_plugin_group'); + $this->setState('filter.joomla_plugin_group', $joomla_plugin_group); + } + + $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); + if ($formSubmited) + { + $system_name = $app->input->post->get('system_name'); + $this->setState('filter.system_name', $system_name); + } // List state information. parent::populateState($ordering, $direction); @@ -333,9 +360,17 @@ class ComponentbuilderModelJoomla_plugins extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -358,15 +393,39 @@ class ComponentbuilderModelJoomla_plugins extends JModelList } } - // Filter by class_extends. - if ($class_extends = $this->getState('filter.class_extends')) + // Filter by Class_extends. + $_class_extends = $this->getState('filter.class_extends'); + if (is_numeric($_class_extends)) { - $query->where('a.class_extends = ' . $db->quote($db->escape($class_extends))); + if (is_float($_class_extends)) + { + $query->where('a.class_extends = ' . (float) $_class_extends); + } + else + { + $query->where('a.class_extends = ' . (int) $_class_extends); + } } - // Filter by joomla_plugin_group. - if ($joomla_plugin_group = $this->getState('filter.joomla_plugin_group')) + elseif (ComponentbuilderHelper::checkString($_class_extends)) { - $query->where('a.joomla_plugin_group = ' . $db->quote($db->escape($joomla_plugin_group))); + $query->where('a.class_extends = ' . $db->quote($db->escape($_class_extends))); + } + // Filter by Joomla_plugin_group. + $_joomla_plugin_group = $this->getState('filter.joomla_plugin_group'); + if (is_numeric($_joomla_plugin_group)) + { + if (is_float($_joomla_plugin_group)) + { + $query->where('a.joomla_plugin_group = ' . (float) $_joomla_plugin_group); + } + else + { + $query->where('a.joomla_plugin_group = ' . (int) $_joomla_plugin_group); + } + } + elseif (ComponentbuilderHelper::checkString($_joomla_plugin_group)) + { + $query->where('a.joomla_plugin_group = ' . $db->quote($db->escape($_joomla_plugin_group))); } // Add the list ordering clause. @@ -392,12 +451,24 @@ class ComponentbuilderModelJoomla_plugins extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.system_name'); $id .= ':' . $this->getState('filter.class_extends'); - $id .= ':' . $this->getState('filter.joomla_plugin_group'); + $id .= ':' . $this->getState('filter.joomla_plugin_group'); + $id .= ':' . $this->getState('filter.system_name'); return parent::getStoreId($id); } diff --git a/admin/models/joomla_plugins_files_folders_urls.php b/admin/models/joomla_plugins_files_folders_urls.php index 1abbe9f94..f4289c86d 100644 --- a/admin/models/joomla_plugins_files_folders_urls.php +++ b/admin/models/joomla_plugins_files_folders_urls.php @@ -26,6 +26,7 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelJoomla_plugins_files_folders_urls extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/joomla_plugins_updates.php b/admin/models/joomla_plugins_updates.php index 9582f7683..9494d0eb7 100644 --- a/admin/models/joomla_plugins_updates.php +++ b/admin/models/joomla_plugins_updates.php @@ -26,6 +26,7 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelJoomla_plugins_updates extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/language_translations.php b/admin/models/language_translations.php index d66135701..07b57d4e1 100644 --- a/admin/models/language_translations.php +++ b/admin/models/language_translations.php @@ -26,6 +26,7 @@ class ComponentbuilderModelLanguage_translations extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', @@ -35,11 +36,17 @@ class ComponentbuilderModelLanguage_translations extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -49,27 +56,39 @@ class ComponentbuilderModelLanguage_translations extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + $source = $this->getUserStateFromRequest($this->context . '.filter.source', 'filter_source'); - $this->setState('filter.source', $source); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $source = $app->input->post->get('source'); + $this->setState('filter.source', $source); + } // List state information. parent::populateState($ordering, $direction); @@ -201,9 +220,17 @@ class ComponentbuilderModelLanguage_translations extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -229,7 +256,7 @@ class ComponentbuilderModelLanguage_translations extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -423,6 +450,18 @@ class ComponentbuilderModelLanguage_translations extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/languages.php b/admin/models/languages.php index a232fecb2..d63634c04 100644 --- a/admin/models/languages.php +++ b/admin/models/languages.php @@ -26,6 +26,7 @@ class ComponentbuilderModelLanguages extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', @@ -159,11 +160,17 @@ class ComponentbuilderModelLanguages extends JModelList return $db->setQuery($query)->loadResult(); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -173,30 +180,46 @@ class ComponentbuilderModelLanguages extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } $langtag = $this->getUserStateFromRequest($this->context . '.filter.langtag', 'filter_langtag'); - $this->setState('filter.langtag', $langtag); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $langtag = $app->input->post->get('langtag'); + $this->setState('filter.langtag', $langtag); + } // List state information. parent::populateState($ordering, $direction); @@ -274,9 +297,17 @@ class ComponentbuilderModelLanguages extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -302,7 +333,7 @@ class ComponentbuilderModelLanguages extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -445,6 +476,18 @@ class ComponentbuilderModelLanguages extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/layouts.php b/admin/models/layouts.php index bbede2926..8a2872e5c 100644 --- a/admin/models/layouts.php +++ b/admin/models/layouts.php @@ -26,23 +26,30 @@ class ComponentbuilderModelLayouts extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', + 'g.name','dynamic_get', + 'a.add_php_view','add_php_view', 'a.name','name', - 'a.description','description', - 'g.name', - 'a.add_php_view','add_php_view' + 'a.description','description' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -52,36 +59,60 @@ class ComponentbuilderModelLayouts extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } - $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); - $this->setState('filter.description', $description); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $dynamic_get = $this->getUserStateFromRequest($this->context . '.filter.dynamic_get', 'filter_dynamic_get'); - $this->setState('filter.dynamic_get', $dynamic_get); + if ($formSubmited) + { + $dynamic_get = $app->input->post->get('dynamic_get'); + $this->setState('filter.dynamic_get', $dynamic_get); + } $add_php_view = $this->getUserStateFromRequest($this->context . '.filter.add_php_view', 'filter_add_php_view'); - $this->setState('filter.add_php_view', $add_php_view); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $add_php_view = $app->input->post->get('add_php_view'); + $this->setState('filter.add_php_view', $add_php_view); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } // List state information. parent::populateState($ordering, $direction); @@ -197,9 +228,17 @@ class ComponentbuilderModelLayouts extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -222,15 +261,39 @@ class ComponentbuilderModelLayouts extends JModelList } } - // Filter by dynamic_get. - if ($dynamic_get = $this->getState('filter.dynamic_get')) + // Filter by Dynamic_get. + $_dynamic_get = $this->getState('filter.dynamic_get'); + if (is_numeric($_dynamic_get)) { - $query->where('a.dynamic_get = ' . $db->quote($db->escape($dynamic_get))); + if (is_float($_dynamic_get)) + { + $query->where('a.dynamic_get = ' . (float) $_dynamic_get); + } + else + { + $query->where('a.dynamic_get = ' . (int) $_dynamic_get); + } + } + elseif (ComponentbuilderHelper::checkString($_dynamic_get)) + { + $query->where('a.dynamic_get = ' . $db->quote($db->escape($_dynamic_get))); } // Filter by Add_php_view. - if ($add_php_view = $this->getState('filter.add_php_view')) + $_add_php_view = $this->getState('filter.add_php_view'); + if (is_numeric($_add_php_view)) { - $query->where('a.add_php_view = ' . $db->quote($db->escape($add_php_view))); + if (is_float($_add_php_view)) + { + $query->where('a.add_php_view = ' . (float) $_add_php_view); + } + else + { + $query->where('a.add_php_view = ' . (int) $_add_php_view); + } + } + elseif (ComponentbuilderHelper::checkString($_add_php_view)) + { + $query->where('a.add_php_view = ' . $db->quote($db->escape($_add_php_view))); } // Add the list ordering clause. @@ -382,13 +445,25 @@ class ComponentbuilderModelLayouts extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.description'); $id .= ':' . $this->getState('filter.dynamic_get'); - $id .= ':' . $this->getState('filter.add_php_view'); + $id .= ':' . $this->getState('filter.add_php_view'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); return parent::getStoreId($id); } diff --git a/admin/models/libraries.php b/admin/models/libraries.php index 4ed002386..63d022c22 100644 --- a/admin/models/libraries.php +++ b/admin/models/libraries.php @@ -26,24 +26,31 @@ class ComponentbuilderModelLibraries extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.name','name', 'a.target','target', + 'a.how','how', 'a.type','type', - 'a.description','description', - 'a.how','how' + 'a.name','name', + 'a.description','description' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -53,39 +60,67 @@ class ComponentbuilderModelLibraries extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $target = $this->getUserStateFromRequest($this->context . '.filter.target', 'filter_target'); - $this->setState('filter.target', $target); - - $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); - $this->setState('filter.type', $type); - - $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); - $this->setState('filter.description', $description); + if ($formSubmited) + { + $target = $app->input->post->get('target'); + $this->setState('filter.target', $target); + } $how = $this->getUserStateFromRequest($this->context . '.filter.how', 'filter_how'); - $this->setState('filter.how', $how); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $how = $app->input->post->get('how'); + $this->setState('filter.how', $how); + } + + $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); + if ($formSubmited) + { + $type = $app->input->post->get('type'); + $this->setState('filter.type', $type); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } // List state information. parent::populateState($ordering, $direction); @@ -234,9 +269,17 @@ class ComponentbuilderModelLibraries extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -260,19 +303,55 @@ class ComponentbuilderModelLibraries extends JModelList } // Filter by Target. - if ($target = $this->getState('filter.target')) + $_target = $this->getState('filter.target'); + if (is_numeric($_target)) { - $query->where('a.target = ' . $db->quote($db->escape($target))); + if (is_float($_target)) + { + $query->where('a.target = ' . (float) $_target); + } + else + { + $query->where('a.target = ' . (int) $_target); + } } - // Filter by how. - if ($how = $this->getState('filter.how')) + elseif (ComponentbuilderHelper::checkString($_target)) { - $query->where('a.how = ' . $db->quote($db->escape($how))); + $query->where('a.target = ' . $db->quote($db->escape($_target))); + } + // Filter by How. + $_how = $this->getState('filter.how'); + if (is_numeric($_how)) + { + if (is_float($_how)) + { + $query->where('a.how = ' . (float) $_how); + } + else + { + $query->where('a.how = ' . (int) $_how); + } + } + elseif (ComponentbuilderHelper::checkString($_how)) + { + $query->where('a.how = ' . $db->quote($db->escape($_how))); } // Filter by Type. - if ($type = $this->getState('filter.type')) + $_type = $this->getState('filter.type'); + if (is_numeric($_type)) { - $query->where('a.type = ' . $db->quote($db->escape($type))); + if (is_float($_type)) + { + $query->where('a.type = ' . (float) $_type); + } + else + { + $query->where('a.type = ' . (int) $_type); + } + } + elseif (ComponentbuilderHelper::checkString($_type)) + { + $query->where('a.type = ' . $db->quote($db->escape($_type))); } // Add the list ordering clause. @@ -298,14 +377,26 @@ class ComponentbuilderModelLibraries extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); $id .= ':' . $this->getState('filter.target'); + $id .= ':' . $this->getState('filter.how'); $id .= ':' . $this->getState('filter.type'); - $id .= ':' . $this->getState('filter.description'); - $id .= ':' . $this->getState('filter.how'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); return parent::getStoreId($id); } diff --git a/admin/models/libraries_config.php b/admin/models/libraries_config.php index c390ab90f..4f3fa78dc 100644 --- a/admin/models/libraries_config.php +++ b/admin/models/libraries_config.php @@ -26,6 +26,7 @@ class ComponentbuilderModelLibraries_config extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelLibraries_config extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelLibraries_config extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelLibraries_config extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelLibraries_config extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelLibraries_config extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/libraries_files_folders_urls.php b/admin/models/libraries_files_folders_urls.php index 67e03d4b4..08092d837 100644 --- a/admin/models/libraries_files_folders_urls.php +++ b/admin/models/libraries_files_folders_urls.php @@ -26,6 +26,7 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by' @@ -34,11 +35,17 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -48,27 +55,33 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - // List state information. parent::populateState($ordering, $direction); } @@ -149,9 +162,17 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -162,7 +183,7 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -183,6 +204,18 @@ class ComponentbuilderModelLibraries_files_folders_urls extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/placeholders.php b/admin/models/placeholders.php index 153139148..6b970f9cc 100644 --- a/admin/models/placeholders.php +++ b/admin/models/placeholders.php @@ -26,6 +26,7 @@ class ComponentbuilderModelPlaceholders extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', @@ -36,11 +37,17 @@ class ComponentbuilderModelPlaceholders extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -50,30 +57,46 @@ class ComponentbuilderModelPlaceholders extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + $target = $this->getUserStateFromRequest($this->context . '.filter.target', 'filter_target'); - $this->setState('filter.target', $target); + if ($formSubmited) + { + $target = $app->input->post->get('target'); + $this->setState('filter.target', $target); + } $value = $this->getUserStateFromRequest($this->context . '.filter.value', 'filter_value'); - $this->setState('filter.value', $value); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $value = $app->input->post->get('value'); + $this->setState('filter.value', $value); + } // List state information. parent::populateState($ordering, $direction); @@ -153,9 +176,17 @@ class ComponentbuilderModelPlaceholders extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -326,6 +357,18 @@ class ComponentbuilderModelPlaceholders extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/server.php b/admin/models/server.php index dd6b3b2c9..3ea769427 100644 --- a/admin/models/server.php +++ b/admin/models/server.php @@ -224,9 +224,17 @@ class ComponentbuilderModelServer extends JModelAdmin $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) diff --git a/admin/models/servers.php b/admin/models/servers.php index f12905b60..929b17c6c 100644 --- a/admin/models/servers.php +++ b/admin/models/servers.php @@ -26,6 +26,7 @@ class ComponentbuilderModelServers extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', @@ -36,11 +37,17 @@ class ComponentbuilderModelServers extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -50,30 +57,46 @@ class ComponentbuilderModelServers extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } $protocol = $this->getUserStateFromRequest($this->context . '.filter.protocol', 'filter_protocol'); - $this->setState('filter.protocol', $protocol); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $protocol = $app->input->post->get('protocol'); + $this->setState('filter.protocol', $protocol); + } // List state information. parent::populateState($ordering, $direction); @@ -186,9 +209,17 @@ class ComponentbuilderModelServers extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -212,19 +243,43 @@ class ComponentbuilderModelServers extends JModelList } // Filter by Name. - if ($name = $this->getState('filter.name')) + $_name = $this->getState('filter.name'); + if (is_numeric($_name)) { - $query->where('a.name = ' . $db->quote($db->escape($name))); + if (is_float($_name)) + { + $query->where('a.name = ' . (float) $_name); + } + else + { + $query->where('a.name = ' . (int) $_name); + } + } + elseif (ComponentbuilderHelper::checkString($_name)) + { + $query->where('a.name = ' . $db->quote($db->escape($_name))); } // Filter by Protocol. - if ($protocol = $this->getState('filter.protocol')) + $_protocol = $this->getState('filter.protocol'); + if (is_numeric($_protocol)) { - $query->where('a.protocol = ' . $db->quote($db->escape($protocol))); + if (is_float($_protocol)) + { + $query->where('a.protocol = ' . (float) $_protocol); + } + else + { + $query->where('a.protocol = ' . (int) $_protocol); + } + } + elseif (ComponentbuilderHelper::checkString($_protocol)) + { + $query->where('a.protocol = ' . $db->quote($db->escape($_protocol))); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -417,6 +472,18 @@ class ComponentbuilderModelServers extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/site_views.php b/admin/models/site_views.php index 2ad2c53bb..e503dcd88 100644 --- a/admin/models/site_views.php +++ b/admin/models/site_views.php @@ -26,26 +26,33 @@ class ComponentbuilderModelSite_views extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', + 'g.name','main_get', + 'a.add_php_ajax','add_php_ajax', + 'a.add_custom_button','add_custom_button', 'a.system_name','system_name', 'a.name','name', 'a.description','description', - 'g.name', - 'a.context','context', - 'a.add_php_ajax','add_php_ajax', - 'a.add_custom_button','add_custom_button' + 'a.context','context' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -55,45 +62,81 @@ class ComponentbuilderModelSite_views extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); - $this->setState('filter.system_name', $system_name); + } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); - $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); - $this->setState('filter.description', $description); + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $main_get = $this->getUserStateFromRequest($this->context . '.filter.main_get', 'filter_main_get'); - $this->setState('filter.main_get', $main_get); - - $context = $this->getUserStateFromRequest($this->context . '.filter.context', 'filter_context'); - $this->setState('filter.context', $context); + if ($formSubmited) + { + $main_get = $app->input->post->get('main_get'); + $this->setState('filter.main_get', $main_get); + } $add_php_ajax = $this->getUserStateFromRequest($this->context . '.filter.add_php_ajax', 'filter_add_php_ajax'); - $this->setState('filter.add_php_ajax', $add_php_ajax); + if ($formSubmited) + { + $add_php_ajax = $app->input->post->get('add_php_ajax'); + $this->setState('filter.add_php_ajax', $add_php_ajax); + } $add_custom_button = $this->getUserStateFromRequest($this->context . '.filter.add_custom_button', 'filter_add_custom_button'); - $this->setState('filter.add_custom_button', $add_custom_button); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $add_custom_button = $app->input->post->get('add_custom_button'); + $this->setState('filter.add_custom_button', $add_custom_button); + } + + $system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name'); + if ($formSubmited) + { + $system_name = $app->input->post->get('system_name'); + $this->setState('filter.system_name', $system_name); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } + + $context = $this->getUserStateFromRequest($this->context . '.filter.context', 'filter_context'); + if ($formSubmited) + { + $context = $app->input->post->get('context'); + $this->setState('filter.context', $context); + } // List state information. parent::populateState($ordering, $direction); @@ -224,9 +267,17 @@ class ComponentbuilderModelSite_views extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -249,20 +300,56 @@ class ComponentbuilderModelSite_views extends JModelList } } - // Filter by main_get. - if ($main_get = $this->getState('filter.main_get')) + // Filter by Main_get. + $_main_get = $this->getState('filter.main_get'); + if (is_numeric($_main_get)) { - $query->where('a.main_get = ' . $db->quote($db->escape($main_get))); + if (is_float($_main_get)) + { + $query->where('a.main_get = ' . (float) $_main_get); + } + else + { + $query->where('a.main_get = ' . (int) $_main_get); + } + } + elseif (ComponentbuilderHelper::checkString($_main_get)) + { + $query->where('a.main_get = ' . $db->quote($db->escape($_main_get))); } // Filter by Add_php_ajax. - if ($add_php_ajax = $this->getState('filter.add_php_ajax')) + $_add_php_ajax = $this->getState('filter.add_php_ajax'); + if (is_numeric($_add_php_ajax)) { - $query->where('a.add_php_ajax = ' . $db->quote($db->escape($add_php_ajax))); + if (is_float($_add_php_ajax)) + { + $query->where('a.add_php_ajax = ' . (float) $_add_php_ajax); + } + else + { + $query->where('a.add_php_ajax = ' . (int) $_add_php_ajax); + } + } + elseif (ComponentbuilderHelper::checkString($_add_php_ajax)) + { + $query->where('a.add_php_ajax = ' . $db->quote($db->escape($_add_php_ajax))); } // Filter by Add_custom_button. - if ($add_custom_button = $this->getState('filter.add_custom_button')) + $_add_custom_button = $this->getState('filter.add_custom_button'); + if (is_numeric($_add_custom_button)) { - $query->where('a.add_custom_button = ' . $db->quote($db->escape($add_custom_button))); + if (is_float($_add_custom_button)) + { + $query->where('a.add_custom_button = ' . (float) $_add_custom_button); + } + else + { + $query->where('a.add_custom_button = ' . (int) $_add_custom_button); + } + } + elseif (ComponentbuilderHelper::checkString($_add_custom_button)) + { + $query->where('a.add_custom_button = ' . $db->quote($db->escape($_add_custom_button))); } // Add the list ordering clause. @@ -434,16 +521,28 @@ class ComponentbuilderModelSite_views extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.main_get'); + $id .= ':' . $this->getState('filter.add_php_ajax'); + $id .= ':' . $this->getState('filter.add_custom_button'); $id .= ':' . $this->getState('filter.system_name'); $id .= ':' . $this->getState('filter.name'); $id .= ':' . $this->getState('filter.description'); - $id .= ':' . $this->getState('filter.main_get'); - $id .= ':' . $this->getState('filter.context'); - $id .= ':' . $this->getState('filter.add_php_ajax'); - $id .= ':' . $this->getState('filter.add_custom_button'); + $id .= ':' . $this->getState('filter.context'); return parent::getStoreId($id); } diff --git a/admin/models/snippet_types.php b/admin/models/snippet_types.php index 41eaf84d9..a6a457a51 100644 --- a/admin/models/snippet_types.php +++ b/admin/models/snippet_types.php @@ -26,6 +26,7 @@ class ComponentbuilderModelSnippet_types extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', @@ -36,11 +37,17 @@ class ComponentbuilderModelSnippet_types extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -50,30 +57,46 @@ class ComponentbuilderModelSnippet_types extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); - $this->setState('filter.description', $description); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } // List state information. parent::populateState($ordering, $direction); @@ -151,9 +174,17 @@ class ComponentbuilderModelSnippet_types extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -179,7 +210,7 @@ class ComponentbuilderModelSnippet_types extends JModelList // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); + $orderDirn = $this->state->get('list.direction', 'desc'); if ($orderCol != '') { $query->order($db->escape($orderCol . ' ' . $orderDirn)); @@ -200,6 +231,18 @@ class ComponentbuilderModelSnippet_types extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/models/snippets.php b/admin/models/snippets.php index c2613b5ff..e88f8e1c7 100644 --- a/admin/models/snippets.php +++ b/admin/models/snippets.php @@ -26,14 +26,15 @@ class ComponentbuilderModelSnippets extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', + 'g.name','type', + 'h.name','library', 'a.name','name', 'a.url','url', - 'g.name', - 'a.heading','heading', - 'h.name' + 'a.heading','heading' ); } @@ -153,11 +154,17 @@ class ComponentbuilderModelSnippets extends JModelList } return false; } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -167,39 +174,67 @@ class ComponentbuilderModelSnippets extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } - $url = $this->getUserStateFromRequest($this->context . '.filter.url', 'filter_url'); - $this->setState('filter.url', $url); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); - $this->setState('filter.type', $type); - - $heading = $this->getUserStateFromRequest($this->context . '.filter.heading', 'filter_heading'); - $this->setState('filter.heading', $heading); + if ($formSubmited) + { + $type = $app->input->post->get('type'); + $this->setState('filter.type', $type); + } $library = $this->getUserStateFromRequest($this->context . '.filter.library', 'filter_library'); - $this->setState('filter.library', $library); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $library = $app->input->post->get('library'); + $this->setState('filter.library', $library); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $url = $this->getUserStateFromRequest($this->context . '.filter.url', 'filter_url'); + if ($formSubmited) + { + $url = $app->input->post->get('url'); + $this->setState('filter.url', $url); + } + + $heading = $this->getUserStateFromRequest($this->context . '.filter.heading', 'filter_heading'); + if ($formSubmited) + { + $heading = $app->input->post->get('heading'); + $this->setState('filter.heading', $heading); + } // List state information. parent::populateState($ordering, $direction); @@ -285,9 +320,17 @@ class ComponentbuilderModelSnippets extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -310,15 +353,39 @@ class ComponentbuilderModelSnippets extends JModelList } } - // Filter by type. - if ($type = $this->getState('filter.type')) + // Filter by Type. + $_type = $this->getState('filter.type'); + if (is_numeric($_type)) { - $query->where('a.type = ' . $db->quote($db->escape($type))); + if (is_float($_type)) + { + $query->where('a.type = ' . (float) $_type); + } + else + { + $query->where('a.type = ' . (int) $_type); + } } - // Filter by library. - if ($library = $this->getState('filter.library')) + elseif (ComponentbuilderHelper::checkString($_type)) { - $query->where('a.library = ' . $db->quote($db->escape($library))); + $query->where('a.type = ' . $db->quote($db->escape($_type))); + } + // Filter by Library. + $_library = $this->getState('filter.library'); + if (is_numeric($_library)) + { + if (is_float($_library)) + { + $query->where('a.library = ' . (float) $_library); + } + else + { + $query->where('a.library = ' . (int) $_library); + } + } + elseif (ComponentbuilderHelper::checkString($_library)) + { + $query->where('a.library = ' . $db->quote($db->escape($_library))); } // Add the list ordering clause. @@ -468,14 +535,26 @@ class ComponentbuilderModelSnippets extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); + $id .= ':' . $this->getState('filter.type'); + $id .= ':' . $this->getState('filter.library'); $id .= ':' . $this->getState('filter.name'); $id .= ':' . $this->getState('filter.url'); - $id .= ':' . $this->getState('filter.type'); - $id .= ':' . $this->getState('filter.heading'); - $id .= ':' . $this->getState('filter.library'); + $id .= ':' . $this->getState('filter.heading'); return parent::getStoreId($id); } diff --git a/admin/models/templates.php b/admin/models/templates.php index be7fc91a1..29e0521e8 100644 --- a/admin/models/templates.php +++ b/admin/models/templates.php @@ -26,23 +26,30 @@ class ComponentbuilderModelTemplates extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', + 'g.name','dynamic_get', + 'a.add_php_view','add_php_view', 'a.name','name', - 'a.description','description', - 'g.name', - 'a.add_php_view','add_php_view' + 'a.description','description' ); } parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -52,36 +59,60 @@ class ComponentbuilderModelTemplates extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + } - $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); - $this->setState('filter.description', $description); + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); $dynamic_get = $this->getUserStateFromRequest($this->context . '.filter.dynamic_get', 'filter_dynamic_get'); - $this->setState('filter.dynamic_get', $dynamic_get); + if ($formSubmited) + { + $dynamic_get = $app->input->post->get('dynamic_get'); + $this->setState('filter.dynamic_get', $dynamic_get); + } $add_php_view = $this->getUserStateFromRequest($this->context . '.filter.add_php_view', 'filter_add_php_view'); - $this->setState('filter.add_php_view', $add_php_view); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $add_php_view = $app->input->post->get('add_php_view'); + $this->setState('filter.add_php_view', $add_php_view); + } + + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } + + $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); + if ($formSubmited) + { + $description = $app->input->post->get('description'); + $this->setState('filter.description', $description); + } // List state information. parent::populateState($ordering, $direction); @@ -197,9 +228,17 @@ class ComponentbuilderModelTemplates extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -222,15 +261,39 @@ class ComponentbuilderModelTemplates extends JModelList } } - // Filter by dynamic_get. - if ($dynamic_get = $this->getState('filter.dynamic_get')) + // Filter by Dynamic_get. + $_dynamic_get = $this->getState('filter.dynamic_get'); + if (is_numeric($_dynamic_get)) { - $query->where('a.dynamic_get = ' . $db->quote($db->escape($dynamic_get))); + if (is_float($_dynamic_get)) + { + $query->where('a.dynamic_get = ' . (float) $_dynamic_get); + } + else + { + $query->where('a.dynamic_get = ' . (int) $_dynamic_get); + } + } + elseif (ComponentbuilderHelper::checkString($_dynamic_get)) + { + $query->where('a.dynamic_get = ' . $db->quote($db->escape($_dynamic_get))); } // Filter by Add_php_view. - if ($add_php_view = $this->getState('filter.add_php_view')) + $_add_php_view = $this->getState('filter.add_php_view'); + if (is_numeric($_add_php_view)) { - $query->where('a.add_php_view = ' . $db->quote($db->escape($add_php_view))); + if (is_float($_add_php_view)) + { + $query->where('a.add_php_view = ' . (float) $_add_php_view); + } + else + { + $query->where('a.add_php_view = ' . (int) $_add_php_view); + } + } + elseif (ComponentbuilderHelper::checkString($_add_php_view)) + { + $query->where('a.add_php_view = ' . $db->quote($db->escape($_add_php_view))); } // Add the list ordering clause. @@ -382,13 +445,25 @@ class ComponentbuilderModelTemplates extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.description'); $id .= ':' . $this->getState('filter.dynamic_get'); - $id .= ':' . $this->getState('filter.add_php_view'); + $id .= ':' . $this->getState('filter.add_php_view'); + $id .= ':' . $this->getState('filter.name'); + $id .= ':' . $this->getState('filter.description'); return parent::getStoreId($id); } diff --git a/admin/models/validation_rules.php b/admin/models/validation_rules.php index a2636f860..4b115e329 100644 --- a/admin/models/validation_rules.php +++ b/admin/models/validation_rules.php @@ -26,6 +26,7 @@ class ComponentbuilderModelValidation_rules extends JModelList $config['filter_fields'] = array( 'a.id','id', 'a.published','published', + 'a.access','access', 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', @@ -36,11 +37,17 @@ class ComponentbuilderModelValidation_rules extends JModelList parent::__construct($config); } - + /** * 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 + * */ protected function populateState($ordering = null, $direction = null) { @@ -50,30 +57,46 @@ class ComponentbuilderModelValidation_rules extends JModelList if ($layout = $app->input->get('layout')) { $this->context .= '.' . $layout; - } + } + + // Check if the form was submitted + $formSubmited = $app->input->post->get('form_submited'); + + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + if ($formSubmited) + { + $access = $app->input->post->get('access'); + $this->setState('filter.access', $access); + } + + $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); + $this->setState('filter.created_by', $created_by); + + $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); + $this->setState('filter.created', $created); + + $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); + $this->setState('filter.sorting', $sorting); + + $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); + $this->setState('filter.search', $search); + $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); + if ($formSubmited) + { + $name = $app->input->post->get('name'); + $this->setState('filter.name', $name); + } $short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description'); - $this->setState('filter.short_description', $short_description); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); + if ($formSubmited) + { + $short_description = $app->input->post->get('short_description'); + $this->setState('filter.short_description', $short_description); + } // List state information. parent::populateState($ordering, $direction); @@ -151,9 +174,17 @@ class ComponentbuilderModelValidation_rules extends JModelList $query->select('ag.title AS access_level'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); // Filter by access level. - if ($access = $this->getState('filter.access')) + $_access = $this->getState('filter.access'); + if ($_access && is_numeric($_access)) { - $query->where('a.access = ' . (int) $access); + $query->where('a.access = ' . (int) $_access); + } + elseif (ComponentbuilderHelper::checkArray($_access)) + { + // Secure the array for the query + $_access = ArrayHelper::toInteger($_access); + // Filter by the Access Array. + $query->where('a.access IN (' . implode(',', $_access) . ')'); } // Implement View Level Access if (!$user->authorise('core.options', 'com_componentbuilder')) @@ -324,6 +355,18 @@ class ComponentbuilderModelValidation_rules extends JModelList $id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); + // Check if the value is an array + $_access = $this->getState('filter.access'); + if (ComponentbuilderHelper::checkArray($_access)) + { + $id .= ':' . implode(':', $_access); + } + // Check if this is only an number or string + elseif (is_numeric($_access) + || ComponentbuilderHelper::checkString($_access)) + { + $id .= ':' . $_access; + } $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 54dcfed86..851c9676a 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -26,6 +26,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( `addfootable` TINYINT(1) NOT NULL DEFAULT 0, `addreadme` TINYINT(1) NOT NULL DEFAULT 0, `adduikit` TINYINT(1) NOT NULL DEFAULT 0, + `assets_table_fix` TINYINT(1) NOT NULL DEFAULT 3, `author` VARCHAR(255) NOT NULL DEFAULT '', `bom` CHAR(64) NOT NULL DEFAULT '', `buildcomp` TINYINT(1) NOT NULL DEFAULT 0, @@ -103,34 +104,35 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( PRIMARY KEY (`id`), KEY `idx_system_name` (`system_name`), KEY `idx_name_code` (`name_code`), - KEY `idx_add_php_helper_admin` (`add_php_helper_admin`), - KEY `idx_addfootable` (`addfootable`), - KEY `idx_add_sql` (`add_sql`), - KEY `idx_add_php_preflight_update` (`add_php_preflight_update`), - KEY `idx_add_css_site` (`add_css_site`), - KEY `idx_mvc_versiondate` (`mvc_versiondate`), KEY `idx_remove_line_breaks` (`remove_line_breaks`), - KEY `idx_add_placeholders` (`add_placeholders`), - KEY `idx_add_php_helper_site` (`add_php_helper_site`), - KEY `idx_add_javascript` (`add_javascript`), - KEY `idx_add_php_postflight_update` (`add_php_postflight_update`), - KEY `idx_addreadme` (`addreadme`), KEY `idx_debug_linenr` (`debug_linenr`), - KEY `idx_add_license` (`add_license`), - KEY `idx_license_type` (`license_type`), - KEY `idx_add_php_helper_both` (`add_php_helper_both`), - KEY `idx_add_admin_event` (`add_admin_event`), - KEY `idx_add_site_event` (`add_site_event`), - KEY `idx_add_css_admin` (`add_css_admin`), - KEY `idx_add_php_preflight_install` (`add_php_preflight_install`), - KEY `idx_add_php_postflight_install` (`add_php_postflight_install`), - KEY `idx_add_php_method_uninstall` (`add_php_method_uninstall`), - KEY `idx_add_sql_uninstall` (`add_sql_uninstall`), - KEY `idx_translation_tool` (`translation_tool`), + KEY `idx_mvc_versiondate` (`mvc_versiondate`), + KEY `idx_add_placeholders` (`add_placeholders`), KEY `idx_add_sales_server` (`add_sales_server`), KEY `idx_add_email_helper` (`add_email_helper`), + KEY `idx_add_license` (`add_license`), + KEY `idx_license_type` (`license_type`), + KEY `idx_addreadme` (`addreadme`), + KEY `idx_translation_tool` (`translation_tool`), + KEY `idx_addfootable` (`addfootable`), + KEY `idx_add_php_helper_both` (`add_php_helper_both`), + KEY `idx_add_php_helper_admin` (`add_php_helper_admin`), + KEY `idx_add_admin_event` (`add_admin_event`), + KEY `idx_add_php_helper_site` (`add_php_helper_site`), + KEY `idx_add_site_event` (`add_site_event`), + KEY `idx_add_javascript` (`add_javascript`), KEY `idx_add_menu_prefix` (`add_menu_prefix`), + KEY `idx_add_css_admin` (`add_css_admin`), KEY `idx_menu_prefix` (`menu_prefix`), + KEY `idx_add_css_site` (`add_css_site`), + KEY `idx_add_php_preflight_install` (`add_php_preflight_install`), + KEY `idx_add_php_preflight_update` (`add_php_preflight_update`), + KEY `idx_add_php_postflight_install` (`add_php_postflight_install`), + KEY `idx_add_php_postflight_update` (`add_php_postflight_update`), + KEY `idx_add_php_method_uninstall` (`add_php_method_uninstall`), + KEY `idx_add_sql` (`add_sql`), + KEY `idx_add_sql_uninstall` (`add_sql_uninstall`), + KEY `idx_assets_table_fix` (`assets_table_fix`), KEY `idx_emptycontributors` (`emptycontributors`), KEY `idx_add_update_server` (`add_update_server`), KEY `idx_update_server_target` (`update_server_target`), @@ -1906,14 +1908,14 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin_files_folders_urls -- INSERT INTO `#__componentbuilder_joomla_component` (`id`, `add_license`, `license_type`, `mvc_versiondate`, `add_css_admin`, `add_css_site`, `add_email_helper`, `add_javascript`, `add_php_helper_admin`, `add_php_helper_both`, `add_php_helper_site`, `add_php_postflight_install`, `add_php_method_uninstall`, `add_php_postflight_update`, `add_php_preflight_install`, `add_php_preflight_update`, `add_placeholders`, `add_sql`, `add_sql_uninstall`, `addfootable`, `adduikit`, `add_admin_event`, `add_site_event`, `add_update_server`, `add_sales_server`, `sales_server`, `update_server`, `update_server_target`, `update_server_url`, `php_admin_event`, `php_site_event`, `addreadme`, `readme`, `author`, `bom`, `buildcomp`, `buildcompsql`, `companyname`, `component_version`, `copyright`, `creatuserhelper`, `css_admin`, `css_site`, `dashboard`, `dashboard_type`, `debug_linenr`, `description`, `email`, `emptycontributors`, `export_buy_link`, `joomla_source_link`, `export_key`, `image`, `javascript`, `license`, `name`, `system_name`, `toignore`, `name_code`, `number`, `php_helper_admin`, `php_helper_both`, `php_helper_site`, `php_postflight_install`, `php_method_uninstall`, `php_postflight_update`, `php_preflight_install`, `php_preflight_update`, `short_description`, `sql`, `sql_uninstall`, `website`, `published`, `created`, `modified`, `hits`, `ordering`, `whmcs_key`, `whmcs_url`, `guid`) VALUES -(25, '', 1, '', '', '', '', '', '', '', 1, 1, '', '', '', '', '', '', '', '', 1, '', '', 1, '', '', '', 2, 'https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/demo_updateserver.xml', '', '', 1, 'IyAjIyNDb21wb25lbnRfbmFtZSMjIyAoIyMjVkVSU0lPTiMjIykNCg0KIVsjIyNDb21wb25lbnRfbmFtZSMjIyBpbWFnZV0oaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL25hbWliaWEvZGVtby1qb29tbGEtMy1jb21wb25lbnQvbWFzdGVyL2FkbWluL2Fzc2V0cy9pbWFnZXMvdmRtLWNvbXBvbmVudC5qcGcgIlRoZSAjIyNDb21wb25lbnRfbmFtZSMjIyIpDQoNCiMjI0RFU0NSSVBUSU9OIyMjDQoNCiMgQnVpbGQgRGV0YWlscw0KDQorICpDb21wYW55KjogWyMjI0NPTVBBTllOQU1FIyMjXSgjIyNBVVRIT1JXRUJTSVRFIyMjKQ0KKyAqQXV0aG9yKjogWyMjI0FVVEhPUiMjI10obWFpbHRvOiMjI0FVVEhPUkVNQUlMIyMjKQ0KKyAqTmFtZSo6IFsjIyNDb21wb25lbnRfbmFtZSMjI10oIyMjQVVUSE9SV0VCU0lURSMjIykNCisgKkZpcnN0IEJ1aWxkKjogIyMjQ1JFQVRJT05EQVRFIyMjDQorICpMYXN0IEJ1aWxkKjogIyMjQlVJTEREQVRFIyMjDQorICpWZXJzaW9uKjogIyMjVkVSU0lPTiMjIw0KKyAqQ29weXJpZ2h0KjogIyMjQ09QWVJJR0hUIyMjDQorICpMaWNlbnNlKjogIyMjTElDRU5TRSMjIw0KDQojIyBCdWlsZCBUaW1lDQoNCioqIyMjdG90YWxIb3VycyMjIyBIb3VycyoqIG9yICoqIyMjdG90YWxEYXlzIyMjIEVpZ2h0IEhvdXIgRGF5cyoqIChhY3R1YWwgdGltZSB0aGUgYXV0aG9yIHNhdmVkIC0NCmR1ZSB0byBbQXV0b21hdGVkIENvbXBvbmVudCBCdWlsZGVyXShodHRwczovL3d3dy52ZG0uaW8vam9vbWxhLWNvbXBvbmVudC1idWlsZGVyKSkNCg0KPiAoaWYgY3JlYXRpbmcgYSBmb2xkZXIgYW5kIGZpbGUgdG9vayAqKjUgc2Vjb25kcyoqIGFuZCB3cml0aW5nIG9uZSBsaW5lIG9mIGNvZGUgdG9vayAqKjEwIHNlY29uZHMqKiwNCj4gbmV2ZXIgbWFraW5nIG9uZSBtaXN0YWtlIG9yIHRha2luZyBhbnkgY29mZmVlIGJyZWFrLikNCg0KKyAqTGluZSBjb3VudCo6ICoqIyMjTElORV9DT1VOVCMjIyoqDQorICpGaWxlIGNvdW50KjogKiojIyNGSUxFX0NPVU5UIyMjKioNCisgKkZvbGRlciBjb3VudCo6ICoqIyMjRk9MREVSX0NPVU5UIyMjKioNCg0KKiojIyNhY3R1YWxIb3Vyc1NwZW50IyMjIEhvdXJzKiogb3IgKiojIyNhY3R1YWxEYXlzU3BlbnQjIyMgRWlnaHQgSG91ciBEYXlzKiogKHRoZSBhY3R1YWwgdGltZSB0aGUgYXV0aG9yIHNwZW50KQ0KDQo+ICh3aXRoIHRoZSBmb2xsb3dpbmcgYnJlYWsgZG93bjoNCj4gKipkZWJ1Z2dpbmcgQCMjI2RlYnVnZ2luZ0hvdXJzIyMjaG91cnMqKiA9IGNvZGluZ3RpbWUgLyA0Ow0KPiAqKnBsYW5uaW5nIEAjIyNwbGFubmluZ0hvdXJzIyMjaG91cnMqKiA9IGNvZGluZ3RpbWUgLyA3Ow0KPiAqKm1hcHBpbmcgQCMjI21hcHBpbmdIb3VycyMjI2hvdXJzKiogPSBjb2Rpbmd0aW1lIC8gMTA7DQo+ICoqb2ZmaWNlIEAjIyNvZmZpY2VIb3VycyMjI2hvdXJzKiogPSBjb2Rpbmd0aW1lIC8gNjspDQoNCioqIyMjYWN0dWFsVG90YWxIb3VycyMjIyBIb3VycyoqIG9yICoqIyMjYWN0dWFsVG90YWxEYXlzIyMjIEVpZ2h0IEhvdXIgRGF5cyoqDQooYSB0b3RhbCBvZiB0aGUgcmVhbGlzdGljIHRpbWUgZnJhbWUgZm9yIHRoaXMgcHJvamVjdCkNCg0KPiAoaWYgY3JlYXRpbmcgYSBmb2xkZXIgYW5kIGZpbGUgdG9vayAqKjUgc2Vjb25kcyoqIGFuZCB3cml0aW5nIG9uZSBsaW5lIG9mIGNvZGUgdG9vayAqKjEwIHNlY29uZHMqKiwNCj4gd2l0aCB0aGUgbm9ybWFsIGV2ZXJ5ZGF5IHJlYWxpdGllcyBhdCB0aGUgb2ZmaWNlLCB0aGF0IGluY2x1ZGVzIHRoZSBjb21wb25lbnQgcGxhbm5pbmcsIG1hcHBpbmcgJiBkZWJ1Z2dpbmcuKQ0KDQpQcm9qZWN0IGR1cmF0aW9uOiAqKiMjI3Byb2plY3RXZWVrVGltZSMjIyB3ZWVrcyoqIG9yICoqIyMjcHJvamVjdE1vbnRoVGltZSMjIyBtb250aHMqKg0KDQo+IFRoaXMgKipjb21wb25lbnQqKiB3YXMgYnVpbGQgd2l0aCBhIEpvb21sYSBbQXV0b21hdGVkIENvbXBvbmVudCBCdWlsZGVyXShodHRwczovL3d3dy52ZG0uaW8vam9vbWxhLWNvbXBvbmVudC1idWlsZGVyKS4NCj4gRGV2ZWxvcGVkIGJ5IFtMbGV3ZWxseW4gdmFuIGRlciBNZXJ3ZV0obWFpbHRvOmpvb21sYUB2ZG0uaW8pDQoNCiMjIERvbmF0aW9ucw0KDQpJZiB5b3Ugd2FudCB0byBzdXBwb3J0IHRoaXMgcHJvamVjdCwgcGxlYXNlIGNvbnNpZGVyIGRvbmF0aW5nOg0KICogUGF5UGFsOiBbcGF5cGFsLm1lL1tbW3BheXBhbG1lXV1dXShodHRwczovL3d3dy5wYXlwYWwubWUvW1tbcGF5cGFsbWVdXV0pDQogKiBCaXRjb2luOiBbW1tiaXRjb2luYWRkcmVzc11dXQ0KICogRXRoZXJldW06IFtbW2V0aGVyZXVtYWRkcmVzc11dXQ==', 'Llewellyn van der Merwe', 'default.txt', '', '', 'Vast Development Method', '2.0.3', 'Copyright (C) 2015. All Rights Reserved', '', '', '', '', 1, '', 'Just a basic demo of the most basic implementations of the [Joomla](http://www.joomla.org) Component Builder\'s ability.', 'joomla@vdm.io', '', '', 'https://github.com/namibia/demo-joomla-3-component', '01Ic5HmAsqKiFShcsOfnYAKPSgmtOI/eMgdvWC0kfbk=', 'images/vdm/demo500.jpg', '', 'GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html', 'Demo', 'Demo (public)', '.git', 'demo', 4, '', '', 'CS8qKg0KCSAqCUNoYW5nZSB0byBuaWNlIGZhbmN5IGRhdGUNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGZhbmN5RGF0ZSgkZGF0ZSkNCgl7DQoJCWlmICghc2VsZjo6aXNWYWxpZFRpbWVTdGFtcCgkZGF0ZSkpDQoJCXsNCgkJCSRkYXRlID0gc3RydG90aW1lKCRkYXRlKTsNCgkJfQ0KCQlyZXR1cm4gZGF0ZSgnalMgXG9cZiBGIFknLCRkYXRlKTsNCgl9DQoNCgkvKioNCgkgKglDaGFuZ2UgdG8gbmljZSBmYW5jeSB0aW1lIGFuZCBkYXRlDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmYW5jeURhdGVUaW1lKCR0aW1lKQ0KCXsNCgkJaWYgKCFzZWxmOjppc1ZhbGlkVGltZVN0YW1wKCR0aW1lKSkNCgkJew0KCQkJJHRpbWUgPSBzdHJ0b3RpbWUoJHRpbWUpOw0KCQl9DQoJCXJldHVybiBkYXRlKCcoRzppKSBqUyBcb1xmIEYgWScsJHRpbWUpOw0KCX0NCg0KCS8qKg0KCSAqCUNoYW5nZSB0byBuaWNlIGhvdXI6bWludXRlcyB0aW1lDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmYW5jeVRpbWUoJHRpbWUpDQoJew0KCQlpZiAoIXNlbGY6OmlzVmFsaWRUaW1lU3RhbXAoJHRpbWUpKQ0KCQl7DQoJCQkkdGltZSA9IHN0cnRvdGltZSgkdGltZSk7DQoJCX0NCgkJcmV0dXJuIGRhdGUoJ0c6aScsJHRpbWUpOw0KCX0NCg0KCS8qKg0KCSAqCUNoZWNrIGlmIHN0cmluZyBpcyBhIHZhbGlkIHRpbWUgc3RhbXANCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGlzVmFsaWRUaW1lU3RhbXAoJHRpbWVzdGFtcCkNCgl7DQoJCXJldHVybiAoKGludCkgJHRpbWVzdGFtcCA9PT0gJHRpbWVzdGFtcCkNCgkJJiYgKCR0aW1lc3RhbXAgPD0gUEhQX0lOVF9NQVgpDQoJCSYmICgkdGltZXN0YW1wID49IH5QSFBfSU5UX01BWCk7DQoJfQ0K', 'CQkvLyBHZXQgQXBwbGljYXRpb24gb2JqZWN0DQoJCSRhcHAgPSBKRmFjdG9yeTo6Z2V0QXBwbGljYXRpb24oKTsNCgkJJGFwcC0+ZW5xdWV1ZU1lc3NhZ2UoJ1RoaXMgaXMgYSBkZW1vIGNvbXBvbmVudCBkZXZlbG9wZWQgaW4gPGEgaHJlZj0iaHR0cDovL3ZkbS5iei9jb21wb25lbnQtYnVpbGRlciIgdGFnZXQ9Il9iYWxuayIgdGl0bGU9Ikpvb21sYSBDb21wb25lbnQgQnVpbGRlciI+SkNCPC9hPiEgWW91IGNhbiBidWlsZCBtb3JlIGNvbXBvbmVudHMgbGlrZSB0aGlzIHdpdGggSkNCLCBjaGVja291dCBvdXIgcGFnZSBvbiA8YSBocmVmPSJodHRwczovL2dpdGh1Yi5jb20vdmRtLWlvL0pvb21sYS1Db21wb25lbnQtQnVpbGRlciIgdGFnZXQ9Il9iYWxuayIgdGl0bGU9Ikpvb21sYSBDb21wb25lbnQgQnVpbGRlciI+Z2l0aHViPC9hPiBmb3IgbW9yZSBpbmZvLiBUaGUgZnV0dXJlIG9mIDxhIGhyZWY9Imh0dHA6Ly92ZG0uYnovY29tcG9uZW50LWJ1aWxkZXIiIHRhZ2V0PSJfYmFsbmsiIHRpdGxlPSJKb29tbGEgQ29tcG9uZW50IEJ1aWxkZXIiPkpvb21sYSBDb21wb25lbnQgRGV2ZWxvcG1lbnQ8L2E+IGlzIEhlcmUhJywgJ0luZm8nKTs=', '', '', '', '', 'Demo Component', '', '', 'https://www.vdm.io/', 1, '2016-10-18 11:44:09', '2020-07-28 02:08:36', '', 3, 'pCJuq1QDgFPzSyKTFTAdwr8vw/PPZ1Sj6pAJrjv7hdQ=', '', 'efde995e-60aa-4b39-b644-44349dfb660d'); +(25, '', 1, '', '', '', '', '', '', '', 1, 1, '', '', '', '', '', '', '', '', 1, '', '', 1, '', '', '', 2, 'https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/demo_updateserver.xml', '', '', 1, 'IyAjIyNDb21wb25lbnRfbmFtZSMjIyAoIyMjVkVSU0lPTiMjIykNCg0KIVsjIyNDb21wb25lbnRfbmFtZSMjIyBpbWFnZV0oaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL25hbWliaWEvZGVtby1qb29tbGEtMy1jb21wb25lbnQvbWFzdGVyL2FkbWluL2Fzc2V0cy9pbWFnZXMvdmRtLWNvbXBvbmVudC5qcGcgIlRoZSAjIyNDb21wb25lbnRfbmFtZSMjIyIpDQoNCiMjI0RFU0NSSVBUSU9OIyMjDQoNCiMgQnVpbGQgRGV0YWlscw0KDQorICpDb21wYW55KjogWyMjI0NPTVBBTllOQU1FIyMjXSgjIyNBVVRIT1JXRUJTSVRFIyMjKQ0KKyAqQXV0aG9yKjogWyMjI0FVVEhPUiMjI10obWFpbHRvOiMjI0FVVEhPUkVNQUlMIyMjKQ0KKyAqTmFtZSo6IFsjIyNDb21wb25lbnRfbmFtZSMjI10oIyMjQVVUSE9SV0VCU0lURSMjIykNCisgKkZpcnN0IEJ1aWxkKjogIyMjQ1JFQVRJT05EQVRFIyMjDQorICpMYXN0IEJ1aWxkKjogIyMjQlVJTEREQVRFIyMjDQorICpWZXJzaW9uKjogIyMjVkVSU0lPTiMjIw0KKyAqQ29weXJpZ2h0KjogIyMjQ09QWVJJR0hUIyMjDQorICpMaWNlbnNlKjogIyMjTElDRU5TRSMjIw0KDQojIyBCdWlsZCBUaW1lDQoNCioqIyMjdG90YWxIb3VycyMjIyBIb3VycyoqIG9yICoqIyMjdG90YWxEYXlzIyMjIEVpZ2h0IEhvdXIgRGF5cyoqIChhY3R1YWwgdGltZSB0aGUgYXV0aG9yIHNhdmVkIC0NCmR1ZSB0byBbQXV0b21hdGVkIENvbXBvbmVudCBCdWlsZGVyXShodHRwczovL3d3dy52ZG0uaW8vam9vbWxhLWNvbXBvbmVudC1idWlsZGVyKSkNCg0KPiAoaWYgY3JlYXRpbmcgYSBmb2xkZXIgYW5kIGZpbGUgdG9vayAqKjUgc2Vjb25kcyoqIGFuZCB3cml0aW5nIG9uZSBsaW5lIG9mIGNvZGUgdG9vayAqKjEwIHNlY29uZHMqKiwNCj4gbmV2ZXIgbWFraW5nIG9uZSBtaXN0YWtlIG9yIHRha2luZyBhbnkgY29mZmVlIGJyZWFrLikNCg0KKyAqTGluZSBjb3VudCo6ICoqIyMjTElORV9DT1VOVCMjIyoqDQorICpGaWxlIGNvdW50KjogKiojIyNGSUxFX0NPVU5UIyMjKioNCisgKkZvbGRlciBjb3VudCo6ICoqIyMjRk9MREVSX0NPVU5UIyMjKioNCg0KKiojIyNhY3R1YWxIb3Vyc1NwZW50IyMjIEhvdXJzKiogb3IgKiojIyNhY3R1YWxEYXlzU3BlbnQjIyMgRWlnaHQgSG91ciBEYXlzKiogKHRoZSBhY3R1YWwgdGltZSB0aGUgYXV0aG9yIHNwZW50KQ0KDQo+ICh3aXRoIHRoZSBmb2xsb3dpbmcgYnJlYWsgZG93bjoNCj4gKipkZWJ1Z2dpbmcgQCMjI2RlYnVnZ2luZ0hvdXJzIyMjaG91cnMqKiA9IGNvZGluZ3RpbWUgLyA0Ow0KPiAqKnBsYW5uaW5nIEAjIyNwbGFubmluZ0hvdXJzIyMjaG91cnMqKiA9IGNvZGluZ3RpbWUgLyA3Ow0KPiAqKm1hcHBpbmcgQCMjI21hcHBpbmdIb3VycyMjI2hvdXJzKiogPSBjb2Rpbmd0aW1lIC8gMTA7DQo+ICoqb2ZmaWNlIEAjIyNvZmZpY2VIb3VycyMjI2hvdXJzKiogPSBjb2Rpbmd0aW1lIC8gNjspDQoNCioqIyMjYWN0dWFsVG90YWxIb3VycyMjIyBIb3VycyoqIG9yICoqIyMjYWN0dWFsVG90YWxEYXlzIyMjIEVpZ2h0IEhvdXIgRGF5cyoqDQooYSB0b3RhbCBvZiB0aGUgcmVhbGlzdGljIHRpbWUgZnJhbWUgZm9yIHRoaXMgcHJvamVjdCkNCg0KPiAoaWYgY3JlYXRpbmcgYSBmb2xkZXIgYW5kIGZpbGUgdG9vayAqKjUgc2Vjb25kcyoqIGFuZCB3cml0aW5nIG9uZSBsaW5lIG9mIGNvZGUgdG9vayAqKjEwIHNlY29uZHMqKiwNCj4gd2l0aCB0aGUgbm9ybWFsIGV2ZXJ5ZGF5IHJlYWxpdGllcyBhdCB0aGUgb2ZmaWNlLCB0aGF0IGluY2x1ZGVzIHRoZSBjb21wb25lbnQgcGxhbm5pbmcsIG1hcHBpbmcgJiBkZWJ1Z2dpbmcuKQ0KDQpQcm9qZWN0IGR1cmF0aW9uOiAqKiMjI3Byb2plY3RXZWVrVGltZSMjIyB3ZWVrcyoqIG9yICoqIyMjcHJvamVjdE1vbnRoVGltZSMjIyBtb250aHMqKg0KDQo+IFRoaXMgKipjb21wb25lbnQqKiB3YXMgYnVpbGQgd2l0aCBhIEpvb21sYSBbQXV0b21hdGVkIENvbXBvbmVudCBCdWlsZGVyXShodHRwczovL3d3dy52ZG0uaW8vam9vbWxhLWNvbXBvbmVudC1idWlsZGVyKS4NCj4gRGV2ZWxvcGVkIGJ5IFtMbGV3ZWxseW4gdmFuIGRlciBNZXJ3ZV0obWFpbHRvOmpvb21sYUB2ZG0uaW8pDQoNCltDVVNUT01DT0RFPXJlYWRNRWNvbnRyaWJ1dG9yc10=', 'Llewellyn van der Merwe', 'default.txt', '', '', 'Vast Development Method', '2.0.3', 'Copyright (C) 2015. All Rights Reserved', '', '', '', '', 1, '', 'Just a basic demo of the most basic implementations of the [Joomla](http://www.joomla.org) Component Builder\'s ability.', 'joomla@vdm.io', '', '', 'https://github.com/Llewellynvdm/Joomla-Demo-Component', 'hcYWdyvSGveEnSAqqDG8ybLDgwZ50qMcicGZ3GYQkHc=', 'images/vdm/demo500.jpg', '', 'GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html', 'Demo', 'Demo (public)', '.git', 'demo', 4, '', '', 'CS8qKg0KCSAqCUNoYW5nZSB0byBuaWNlIGZhbmN5IGRhdGUNCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGZhbmN5RGF0ZSgkZGF0ZSkNCgl7DQoJCWlmICghc2VsZjo6aXNWYWxpZFRpbWVTdGFtcCgkZGF0ZSkpDQoJCXsNCgkJCSRkYXRlID0gc3RydG90aW1lKCRkYXRlKTsNCgkJfQ0KCQlyZXR1cm4gZGF0ZSgnalMgXG9cZiBGIFknLCRkYXRlKTsNCgl9DQoNCgkvKioNCgkgKglDaGFuZ2UgdG8gbmljZSBmYW5jeSB0aW1lIGFuZCBkYXRlDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmYW5jeURhdGVUaW1lKCR0aW1lKQ0KCXsNCgkJaWYgKCFzZWxmOjppc1ZhbGlkVGltZVN0YW1wKCR0aW1lKSkNCgkJew0KCQkJJHRpbWUgPSBzdHJ0b3RpbWUoJHRpbWUpOw0KCQl9DQoJCXJldHVybiBkYXRlKCcoRzppKSBqUyBcb1xmIEYgWScsJHRpbWUpOw0KCX0NCg0KCS8qKg0KCSAqCUNoYW5nZSB0byBuaWNlIGhvdXI6bWludXRlcyB0aW1lDQoJICovDQoJcHVibGljIHN0YXRpYyBmdW5jdGlvbiBmYW5jeVRpbWUoJHRpbWUpDQoJew0KCQlpZiAoIXNlbGY6OmlzVmFsaWRUaW1lU3RhbXAoJHRpbWUpKQ0KCQl7DQoJCQkkdGltZSA9IHN0cnRvdGltZSgkdGltZSk7DQoJCX0NCgkJcmV0dXJuIGRhdGUoJ0c6aScsJHRpbWUpOw0KCX0NCg0KCS8qKg0KCSAqCUNoZWNrIGlmIHN0cmluZyBpcyBhIHZhbGlkIHRpbWUgc3RhbXANCgkgKi8NCglwdWJsaWMgc3RhdGljIGZ1bmN0aW9uIGlzVmFsaWRUaW1lU3RhbXAoJHRpbWVzdGFtcCkNCgl7DQoJCXJldHVybiAoKGludCkgJHRpbWVzdGFtcCA9PT0gJHRpbWVzdGFtcCkNCgkJJiYgKCR0aW1lc3RhbXAgPD0gUEhQX0lOVF9NQVgpDQoJCSYmICgkdGltZXN0YW1wID49IH5QSFBfSU5UX01BWCk7DQoJfQ0K', 'CQkvLyBHZXQgQXBwbGljYXRpb24gb2JqZWN0DQoJCSRhcHAgPSBKRmFjdG9yeTo6Z2V0QXBwbGljYXRpb24oKTsNCgkJJGFwcC0+ZW5xdWV1ZU1lc3NhZ2UoJ1RoaXMgaXMgYSBkZW1vIGNvbXBvbmVudCBkZXZlbG9wZWQgaW4gPGEgaHJlZj0iaHR0cDovL3ZkbS5iei9jb21wb25lbnQtYnVpbGRlciIgdGFnZXQ9Il9iYWxuayIgdGl0bGU9Ikpvb21sYSBDb21wb25lbnQgQnVpbGRlciI+SkNCPC9hPiEgWW91IGNhbiBidWlsZCBtb3JlIGNvbXBvbmVudHMgbGlrZSB0aGlzIHdpdGggSkNCLCBjaGVja291dCBvdXIgcGFnZSBvbiA8YSBocmVmPSJodHRwczovL2dpdGh1Yi5jb20vdmRtLWlvL0pvb21sYS1Db21wb25lbnQtQnVpbGRlciIgdGFnZXQ9Il9iYWxuayIgdGl0bGU9Ikpvb21sYSBDb21wb25lbnQgQnVpbGRlciI+Z2l0aHViPC9hPiBmb3IgbW9yZSBpbmZvLiBUaGUgZnV0dXJlIG9mIDxhIGhyZWY9Imh0dHA6Ly92ZG0uYnovY29tcG9uZW50LWJ1aWxkZXIiIHRhZ2V0PSJfYmFsbmsiIHRpdGxlPSJKb29tbGEgQ29tcG9uZW50IEJ1aWxkZXIiPkpvb21sYSBDb21wb25lbnQgRGV2ZWxvcG1lbnQ8L2E+IGlzIEhlcmUhJywgJ0luZm8nKTs=', '', '', '', '', 'Demo Component', '', '', 'https://www.vdm.io/', 1, '2016-10-18 11:44:09', '2020-11-17 17:19:57', '', 10, 'G2Rww7JuEI+de+Bm1ljKg72Hgt3MUfutTh1P15UayKU=', '', 'efde995e-60aa-4b39-b644-44349dfb660d'); -- -- Dumping data for table `#__componentbuilder_admin_view` -- INSERT INTO `#__componentbuilder_admin_view` (`id`, `add_css_view`, `add_css_views`, `add_custom_button`, `add_custom_import`, `add_fadein`, `add_javascript_view_file`, `add_javascript_view_footer`, `add_javascript_views_file`, `add_javascript_views_footer`, `add_php_ajax`, `add_php_allowedit`, `add_php_batchcopy`, `add_php_batchmove`, `add_php_getitem`, `add_php_getitems`, `add_php_getitems_after_all`, `add_php_getlistquery`, `add_php_postsavehook`, `add_php_save`, `add_sql`, `addlinked_views`, `addpermissions`, `addtables`, `addtabs`, `add_php_before_delete`, `add_php_before_publish`, `add_php_document`, `add_php_after_delete`, `add_php_after_publish`, `php_before_delete`, `php_before_publish`, `php_controller`, `php_document`, `php_after_delete`, `php_after_publish`, `ajax_input`, `css_view`, `css_views`, `custom_button`, `description`, `html_import_view`, `icon`, `icon_add`, `icon_category`, `javascript_view_file`, `javascript_view_footer`, `javascript_views_file`, `javascript_views_footer`, `name_list`, `system_name`, `name_single`, `php_ajaxmethod`, `php_allowedit`, `php_batchcopy`, `php_batchmove`, `php_getitem`, `php_getitems`, `php_getitems_after_all`, `php_getlistquery`, `php_import`, `php_import_display`, `php_import_save`, `php_import_setdata`, `php_model`, `php_postsavehook`, `php_save`, `short_description`, `source`, `sql`, `type`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`, `guid`) VALUES -(109, '', '', '', '', 1, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '{}', '{\"addpermissions0\":{\"action\":\"view.edit\",\"implementation\":3},\"addpermissions1\":{\"action\":\"view.edit.own\",\"implementation\":3},\"addpermissions2\":{\"action\":\"view.edit.state\",\"implementation\":3},\"addpermissions3\":{\"action\":\"view.edit.created_by\",\"implementation\":3},\"addpermissions4\":{\"action\":\"view.edit.created\",\"implementation\":3},\"addpermissions5\":{\"action\":\"view.create\",\"implementation\":3},\"addpermissions6\":{\"action\":\"view.delete\",\"implementation\":3},\"addpermissions7\":{\"action\":\"view.access\",\"implementation\":3}}', '{}', '{\"addtabs0\":{\"name\":\"Details\"},\"addtabs1\":{\"name\":\"More\"}}', '', '', '', '', '', '', '', '', '', '', '', '{}', '', '', '{}', '', '', 'images/WoodMannequin-icon.png', 'images/WoodMannequin-icon-plus.png', '', '', '', '', '', 'Looks', 'Look', 'Look', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'The demo view', '', '', 1, '{\"fieldordering\":{\"add_admin_ordering\":\"0\",\"admin_ordering_fields\":{\"admin_ordering_fields0\":{\"field\":\"\",\"direction\":\"ASC\"}},\"add_linked_ordering\":\"0\",\"linked_ordering_fields\":{\"linked_ordering_fields0\":{\"field\":\"\",\"direction\":\"ASC\"}}},\"privacy\":{\"activate\":\"1\",\"permissions\":\"1\",\"anonymize\":\"0\",\"anonymize_fields\":[],\"user_link\":\"1\",\"custom_link\":\"$query->where($db->quoteName(\'created_by\') . \' = \' . $db->quote($user->id));\",\"other_user_field\":\"682\"}}', 1, '2016-10-18 11:44:46', '2020-05-21 14:39:27', 18, '', 16, 'c1053952-8a84-4398-aef1-41726f7c0043'); +(109, '', '', '', '', 1, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '{}', '{\"addpermissions0\":{\"action\":\"view.edit\",\"implementation\":3},\"addpermissions1\":{\"action\":\"view.edit.own\",\"implementation\":3},\"addpermissions2\":{\"action\":\"view.edit.state\",\"implementation\":3},\"addpermissions3\":{\"action\":\"view.edit.created_by\",\"implementation\":3},\"addpermissions4\":{\"action\":\"view.edit.created\",\"implementation\":3},\"addpermissions5\":{\"action\":\"view.create\",\"implementation\":3},\"addpermissions6\":{\"action\":\"view.delete\",\"implementation\":3},\"addpermissions7\":{\"action\":\"view.access\",\"implementation\":3}}', '{}', '{\"addtabs0\":{\"name\":\"Details\"},\"addtabs1\":{\"name\":\"More\"}}', '', '', '', '', '', '', '', '', '', '', '', '{}', '', '', '{}', '', '', 'images/WoodMannequin-icon.png', 'images/WoodMannequin-icon-plus.png', '', '', '', '', '', 'Looks', 'Look', 'Look', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'The demo view', '', '', 1, '{\"fieldordering\":{\"add_admin_ordering\":\"0\",\"admin_ordering_fields\":{\"admin_ordering_fields0\":{\"field\":\"\",\"direction\":\"ASC\"}},\"add_linked_ordering\":\"0\",\"linked_ordering_fields\":{\"linked_ordering_fields0\":{\"field\":\"\",\"direction\":\"ASC\"}}},\"privacy\":{\"activate\":\"1\",\"permissions\":\"1\",\"anonymize\":\"0\",\"anonymize_fields\":[],\"user_link\":\"1\",\"custom_link\":\"$query->where($db->quoteName(\'created_by\') . \' = \' . $db->quote($user->id));\",\"other_user_field\":\"682\"}}', 1, '2016-10-18 11:44:46', '2020-05-21 14:39:27', 18, '', 110, 'c1053952-8a84-4398-aef1-41726f7c0043'); @@ -2136,7 +2138,7 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `catid`, `description`, `name (3, '', 'The checkbox form field type provides a single checkbox. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Checkbox', '{\"properties0\":{\"name\":\"type\",\"example\":\"checkbox\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be checkbox\"},\"properties1\":{\"name\":\"name\",\"example\":\"show_title\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Show title\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"value\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"(optional) is the value of the parameter if this checkbox is set (usually 1).\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default value (usually 0 or 1).\"},\"properties5\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Show the title of the item\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties7\":{\"name\":\"class\",\"example\":\"inputbox\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties9\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (JavaScript use)\"}}', 'provides a single checkbox to be checked or unchecked', '', 1, 7, '', '', '10066262-b6e3-4f82-941e-cbe4f61ddd6c'), (4, '', 'The checkboxes form field type provides a set of checkboxes. Note: unlike most standard form field types, such as textfield or checkbox, this field is not an \"out of the box\" solution. It will create checkboxes for you, and submit their values in form of ', 'Checkboxes', '{\"properties0\":{\"name\":\"type\",\"example\":\"checkboxes\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be checkboxs\"},\"properties1\":{\"name\":\"name\",\"example\":\"toppings\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select Toppings\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"option\",\"example\":\"anch|Anchovies,chor|Chorizo,on|Onions,mush|Mushrooms\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default value.\"},\"properties5\":{\"name\":\"description\",\"example\":\"Select the topping of your choice\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides unlimited checkboxes that can be used for multi-select.', '', 1, 4, '', '', 'ac10859b-58da-4584-9682-36a6c2c8d04d'), (5, '', 'Provides a color picker. Enter the color as #ff00ff or pick it from the palet.', 'Color', '{\"properties0\":{\"name\":\"type\",\"example\":\"color\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be color.\"},\"properties1\":{\"name\":\"name\",\"example\":\"backgroundcolor\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"default\",\"example\":\"#FFFFFF\",\"adjustable\":\"1\",\"description\":\"(optional) provides a color when not set.\"},\"properties3\":{\"name\":\"label\",\"example\":\"Background\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties4\":{\"name\":\"description\",\"example\":\"Select the background color here.\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) tooltip for the form field.\"},\"properties5\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties6\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a color picker when clicking the input box.', '', 1, 5, '', '', '7f60f198-53e7-4fe9-813f-d1b6c553680e'), -(6, '', 'The list form field type provides a drop down list or a list box of other current component table entries. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Custom', '{\"properties0\":{\"name\":\"type\",\"example\":\"subjects\",\"mandatory\":\"1\",\"description\":\"(mandatory) can be anything, just not the same as any other default Joomla field type. You can also not use the \\\"_\\\" (underscore) or \\\"-\\\" (hyphen) in the type name, and no spaces.\"},\"properties1\":{\"name\":\"name\",\"example\":\"subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a Subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties5\":{\"name\":\"class\",\"example\":\"list_class\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties7\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties8\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties9\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties10\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties11\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties13\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"},\"properties14\":{\"name\":\"extends\",\"example\":\"list\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"The JFormField sub class that should be extended. The options are (\'list\',\'radio\',\'checkboxes\')\"},\"properties15\":{\"name\":\"button\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) to add new button next to field in edit view\"},\"properties16\":{\"name\":\"table\",\"example\":\"#__###component###_subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The table being linked to. The ###TABLE### placeholder holds the table in the php.\"},\"properties17\":{\"name\":\"component\",\"example\":\"com_###component###\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the component where this table is found. Must be com_users\"},\"properties18\":{\"name\":\"view\",\"example\":\"subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The single view name if the place this field is added.\"},\"properties19\":{\"name\":\"views\",\"example\":\"subjects\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The list view name if the place this field is added.\"},\"properties20\":{\"name\":\"value_field\",\"example\":\"name\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the text field in table linked to. The ###TEXT### placeholder holds the value_field in the php.\"},\"properties21\":{\"name\":\"key_field\",\"example\":\"id\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The field from the linked table to save in this table as the unique key. The ###ID### placeholder holds the key_field in the php.\"},\"properties22\":{\"name\":\"prime_php\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"This field makes sure that the PHP used here is used to build the field type, and other are custom fields with the same field type are ignored. So to avoid that they over write the PHP added here. You should only have one prime per\\/type. To disable remove the field or set to 0\"},\"properties23\":{\"name\":\"type_php_1\",\"example\":\"\\/\\/ Get the user object.\\r\\n\\t\\t$user = JFactory::getUser();\\r\\n\\t\\t\\/\\/ Get the databse object.\\r\\n\\t\\t$db = JFactory::getDBO();\\r\\n\\t\\t$query = $db->getQuery(true);\\r\\n\\t\\t$query->select($db->quoteName(array(\'a.###ID###\',\'a.###TEXT###\'),array(\'###ID###\',\'###CODE_TEXT###\')));\\r\\n\\t\\t$query->from($db->quoteName(\'###TABLE###\', \'a\'));\\r\\n\\t\\t$query->where($db->quoteName(\'a.published\') . \' = 1\');\\r\\n\\t\\t$query->order(\'a.###TEXT### ASC\');\\r\\n\\t\\t\\/\\/ Implement View Level Access (if set in table)\\r\\n\\t\\tif (!$user->authorise(\'core.options\', \'[[[com_component]]]\'))\\r\\n\\t\\t{\\r\\n\\t\\t\\t$columns = $db->getTableColumns(\'###TABLE###\');\\r\\n\\t\\t\\tif(isset($columns[\'access\']))\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$groups = implode(\',\', $user->getAuthorisedViewLevels());\\r\\n\\t\\t\\t\\t$query->where(\'a.access IN (\' . $groups . \')\');\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t\\t$db->setQuery((string)$query);\\r\\n\\t\\t$items = $db->loadObjectList();\\r\\n\\t\\t$options = array();\\r\\n\\t\\tif ($items)\\r\\n\\t\\t{\\r\\n\\t\\t\\t$options[] = JHtml::_(\'select.option\', \'\', \'Select an option\');\\r\\n\\t\\t\\tforeach($items as $item)\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$options[] = JHtml::_(\'select.option\', $item->###ID###, $item->###CODE_TEXT###);\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t\\treturn $options;\",\"adjustable\":\"1\",\"description\":\"The php for the getOptions method.\"}}', 'provides a drop down list of items entries.', '', 1, 25, '', '', 'dd2e1f4b-f5db-45e8-85fa-efd27bae7b6a'), +(6, '', 'The list form field type provides a drop down list or a list box of other current component table entries. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Custom', '{\"properties0\":{\"name\":\"type\",\"example\":\"subjects\",\"mandatory\":\"1\",\"description\":\"(mandatory) can be anything, just not the same as any other default Joomla field type. You can also not use the \\\"_\\\" (underscore) or \\\"-\\\" (hyphen) in the type name, and no spaces.\"},\"properties1\":{\"name\":\"name\",\"example\":\"subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a Subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties5\":{\"name\":\"class\",\"example\":\"list_class\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties7\":{\"name\":\"default\",\"example\":\"0\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties8\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties9\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties10\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties11\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties13\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"},\"properties14\":{\"name\":\"extends\",\"example\":\"list\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"The JFormField sub class that should be extended. The options are (\'list\',\'radio\',\'checkboxes\')\"},\"properties15\":{\"name\":\"button\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) to add new button next to field in edit view\"},\"properties16\":{\"name\":\"table\",\"example\":\"#__###component###_subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The table being linked to. The ###TABLE### placeholder holds the table in the php.\"},\"properties17\":{\"name\":\"component\",\"example\":\"com_###component###\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the component where this table is found. Must be com_users\"},\"properties18\":{\"name\":\"view\",\"example\":\"subject\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The single view name if the place this field is added.\"},\"properties19\":{\"name\":\"views\",\"example\":\"subjects\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The list view name if the place this field is added.\"},\"properties20\":{\"name\":\"value_field\",\"example\":\"name\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the text field in table linked to. The ###TEXT### placeholder holds the value_field in the php.\"},\"properties21\":{\"name\":\"key_field\",\"example\":\"id\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The field from the linked table to save in this table as the unique key. The ###ID### placeholder holds the key_field in the php.\"},\"properties22\":{\"name\":\"prime_php\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"This field makes sure that the PHP used here is used to build the field type, and other are custom fields with the same field type are ignored. So to avoid that they over write the PHP added here. You should only have one prime per\\/type. To disable remove the field or set to 0\"},\"properties23\":{\"name\":\"type_php_1\",\"example\":\"\\/\\/ Get the user object.\\r\\n\\t\\t$user = JFactory::getUser();\\r\\n\\t\\t\\/\\/ Get the databse object.\\r\\n\\t\\t$db = JFactory::getDBO();\\r\\n\\t\\t$query = $db->getQuery(true);\\r\\n\\t\\t$query->select($db->quoteName(array(\'a.###ID###\',\'a.###TEXT###\'),array(\'###ID###\',\'###CODE_TEXT###\')));\\r\\n\\t\\t$query->from($db->quoteName(\'###TABLE###\', \'a\'));\\r\\n\\t\\t$query->where($db->quoteName(\'a.published\') . \' = 1\');\\r\\n\\t\\t$query->order(\'a.###TEXT### ASC\');\\r\\n\\t\\t\\/\\/ Implement View Level Access (if set in table)\\r\\n\\t\\tif (!$user->authorise(\'core.options\', \'[[[com_component]]]\'))\\r\\n\\t\\t{\\r\\n\\t\\t\\t$columns = $db->getTableColumns(\'###TABLE###\');\\r\\n\\t\\t\\tif(isset($columns[\'access\']))\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$groups = implode(\',\', $user->getAuthorisedViewLevels());\\r\\n\\t\\t\\t\\t$query->where(\'a.access IN (\' . $groups . \')\');\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t\\t$db->setQuery((string)$query);\\r\\n\\t\\t$items = $db->loadObjectList();\\r\\n\\t\\t$options = array();\\r\\n\\t\\tif ($items)\\r\\n\\t\\t{\\r\\n\\t\\t\\tif ($this->multiple === false)\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$options[] = JHtml::_(\'select.option\', \'\', JText::(\'Select an option\'));\\r\\n\\t\\t\\t}\\r\\n\\t\\t\\tforeach($items as $item)\\r\\n\\t\\t\\t{\\r\\n\\t\\t\\t\\t$options[] = JHtml::_(\'select.option\', $item->###ID###, $item->###CODE_TEXT###);\\r\\n\\t\\t\\t}\\r\\n\\t\\t}\\r\\n\\t\\treturn $options;\",\"adjustable\":\"1\",\"description\":\"The php for the getOptions method.\"}}', 'provides a drop down list of items entries.', '', 1, 26, '', '', 'dd2e1f4b-f5db-45e8-85fa-efd27bae7b6a'), (7, '', 'The a list of users that can be targeting one or more groups and excluded users that already belongs to an item in a view.', 'CustomUser', '{\"properties0\":{\"name\":\"type\",\"example\":\"staffusers\",\"mandatory\":\"1\",\"description\":\"(mandatory) can be anything, just not the same as any other default Joomla field type.\"},\"properties1\":{\"name\":\"name\",\"example\":\"staff\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Staff\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties5\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties8\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties9\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"\"},\"properties10\":{\"name\":\"hint\",\"example\":\"select a user\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties12\":{\"name\":\"extends\",\"example\":\"user\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"The JFormField sub class that should be extended. The options are (\'list\',\'radio\',\'checkboxes\')\"},\"properties13\":{\"name\":\"table\",\"example\":\"#__users\",\"mandatory\":\"1\",\"description\":\"(mandatory) The table being linked to. Must be #__users\"},\"properties14\":{\"name\":\"component\",\"example\":\"com_users\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the component where this table is found. Must be com_users\"},\"properties15\":{\"name\":\"view\",\"example\":\"###view###\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The single view name if the place this field is added.\"},\"properties16\":{\"name\":\"views\",\"example\":\"###views###\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The list view name if the place this field is added.\"},\"properties17\":{\"name\":\"value_field\",\"example\":\"name\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The name of the text field in table linked to.\"},\"properties18\":{\"name\":\"key_field\",\"example\":\"id\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The field from the linked table to save in this table as the unique key.\"},\"properties19\":{\"name\":\"type_php_1\",\"example\":\"\\/\\/ set the groups array\",\"adjustable\":\"1\",\"description\":\"The php for the getGroups method.\"},\"properties20\":{\"name\":\"type_php_2\",\"example\":\"$groups = JComponentHelper::getParams(\'com_###component###\')->get(\'###type###\');\",\"adjustable\":\"1\",\"description\":\"The php for the getGroups method.\"},\"properties21\":{\"name\":\"type_php_3\",\"example\":\"return $groups;\",\"adjustable\":\"1\",\"description\":\"The php for the getGroups method.\"},\"properties22\":{\"name\":\"type_phpx_1\",\"example\":\"\\/\\/ To ensure that there is only one record per user\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties23\":{\"name\":\"type_phpx_2\",\"example\":\"\\/\\/ Get a db connection.\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties24\":{\"name\":\"type_phpx_3\",\"example\":\"$db = JFactory::getDbo();\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties25\":{\"name\":\"type_phpx_4\",\"example\":\"\\/\\/ Create a new query object.\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties26\":{\"name\":\"type_phpx_5\",\"example\":\"$query = $db->getQuery(true);\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties27\":{\"name\":\"type_phpx_6\",\"example\":\"\\/\\/ Select all records from the #__###component###_###view### table from ###CODE### column\\\".\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties28\":{\"name\":\"type_phpx_7\",\"example\":\"$query->select($db->quoteName(\'###CODE###\'));\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties29\":{\"name\":\"type_phpx_8\",\"example\":\"$query->from($db->quoteName(\'#__###component###_###view###\'));\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties30\":{\"name\":\"type_phpx_9\",\"example\":\"$db->setQuery($query);\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties31\":{\"name\":\"type_phpx_10\",\"example\":\"$db->execute();\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties32\":{\"name\":\"type_phpx_11\",\"example\":\"$found = $db->getNumRows();\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties33\":{\"name\":\"type_phpx_12\",\"example\":\"if ($found)\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties34\":{\"name\":\"type_phpx_13\",\"example\":\"{\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties35\":{\"name\":\"type_phpx_14\",\"example\":\"\\\\t\\/\\/ return all users already used\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties36\":{\"name\":\"type_phpx_15\",\"example\":\"\\\\treturn array_unique($db->loadColumn());\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties37\":{\"name\":\"type_phpx_16\",\"example\":\"}\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"},\"properties38\":{\"name\":\"type_phpx_17\",\"example\":\"return null;\",\"adjustable\":\"1\",\"description\":\"The php for the getExcluded method.\"}}', 'Provides list of users.', '', 1, 5, '', '', 'a4a39f70-070f-459c-be4b-0ac103a29b9a'), (8, '', 'The Editor field type provides a WYSIWYG editor.', 'Editor', '{\"properties0\":{\"name\":\"type\",\"example\":\"editor\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be editor.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mytextblock\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Test Field\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"Some text\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties5\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties6\":{\"name\":\"width\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) defines the width (in pixels) of the wysiwyg editor and defaults to 100%.\"},\"properties7\":{\"name\":\"height\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) defines the height (in pixels) of the wysiwyg editor and defaults to 250px.\"},\"properties8\":{\"name\":\"cols\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) defines the width of the editor (in columns).\"},\"properties9\":{\"name\":\"rows\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) defines the height of the editor (in rows).\"},\"properties10\":{\"name\":\"buttons\",\"example\":\"no\",\"adjustable\":\"1\",\"description\":\"(optional) can be an array of plugin buttons to be excluded or set to false. The default editors-xtd are: article, image, pagebreak and readmore.\"},\"properties11\":{\"name\":\"syntax\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) can be used to set the code syntax matching for this field.\"},\"properties12\":{\"name\":\"hide\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) array of plugin buttons to be hidden. eg... set buttons=\\\"true\\\" hide=\\\"readmore,pagebreak\\\"\"},\"properties13\":{\"name\":\"editor\",\"example\":\"codemirror|none\",\"adjustable\":\"1\",\"description\":\"specifies the editor to be used and can include two options (editor=\\\"desired|alternative\\\")\"},\"properties14\":{\"name\":\"filter\",\"example\":\"safehtml\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties15\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties16\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties17\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides an editor area field.', '', 1, 11, '', '', '51f288d2-6eaa-42bc-a182-a6f69b3032b8'), (9, '', 'The hidden form field type provides a hidden field for saving a field whose value cannot be altered directly by a user in the Administrator (it can be altered in code or by editing the params.ini file). If the parameter has a saved value this is entered i', 'Hidden', '{\"properties0\":{\"name\":\"type\",\"example\":\"hidden\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be hidden.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mysecretvariable\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"default\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the data which needs to be collected.\"},\"properties5\":{\"name\":\"filter\",\"example\":\"STRING\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties4\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"}}', 'provides a hidden field for saving a form field whose value cannot be altered directly by a user.', '', 1, 2, '', '', '82f1b5ca-bb9b-44d7-9a7a-9a03fb2a31dd'), @@ -2430,11 +2432,6 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_external_code` ( --- --- Always insure this column rules is large enough for all the access control values. --- -ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.'; - -- -- Always insure this column name is large enough for long component and view names. -- diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index a18ba7d43..5af4b7be1 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -47,3 +47,4 @@ DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin_updates`; DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin_files_folders_urls`; DROP TABLE IF EXISTS `#__componentbuilder_external_code`; + diff --git a/admin/sql/updates/mysql/2.12.1.sql b/admin/sql/updates/mysql/2.12.1.sql new file mode 100644 index 000000000..151db5231 --- /dev/null +++ b/admin/sql/updates/mysql/2.12.1.sql @@ -0,0 +1 @@ +ALTER TABLE `#__componentbuilder_joomla_component` ADD `assets_table_fix` TINYINT(1) NOT NULL DEFAULT 3 AFTER `adduikit`; diff --git a/admin/views/admin_custom_tabs/tmpl/edit.php b/admin/views/admin_custom_tabs/tmpl/edit.php index eb213b4fc..2bfa1093b 100644 --- a/admin/views/admin_custom_tabs/tmpl/edit.php +++ b/admin/views/admin_custom_tabs/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/admin_fields/tmpl/edit.php b/admin/views/admin_fields/tmpl/edit.php index 24949aa61..3c533d767 100644 --- a/admin/views/admin_fields/tmpl/edit.php +++ b/admin/views/admin_fields/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> @@ -129,11 +129,11 @@ function checkAdminBehaviour(field) { } // do some house cleaning jQuery('#'+subID+'__order_list').val(0).trigger('liszt:updated'); + jQuery('#'+subID+'__filter').val('').trigger('liszt:updated'); jQuery('#'+subID+'__title').prop('checked', false).trigger('change'); jQuery('#'+subID+'__alias').prop('checked', false).trigger('change'); jQuery('#'+subID+'__sort').prop('checked', false).trigger('change'); jQuery('#'+subID+'__search').prop('checked', false).trigger('change'); - jQuery('#'+subID+'__filter').prop('checked', false).trigger('change'); jQuery('#'+subID+'__link').prop('checked', false).trigger('change'); } else if (1 == value || 3 == value || 4 == value) { // get number of items @@ -159,8 +159,8 @@ function checkAdminBehaviour(field) { } else { // do some house cleaning jQuery('#'+subID+'__order_list').val(0).trigger('liszt:updated'); + jQuery('#'+subID+'__filter').val('').trigger('liszt:updated'); jQuery('#'+subID+'__sort').prop('checked', false).trigger('change'); - jQuery('#'+subID+'__filter').prop('checked', false).trigger('change'); jQuery('#'+subID+'__link').prop('checked', false).trigger('change'); } } @@ -277,4 +277,19 @@ function checkAlias(field) { } } } +// little script to check value and give notice +function explainFilterBehaviour(field) { + // get the ID + let id = jQuery(field).attr('id'); + // get value + let value = jQuery('#'+id).val(); + // set notice and do house cleaning + if (2 == value) { + // means multi option can be selected in the filter, this is just available with the new filters + jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THE_BMULTI_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_MORE_THEN_ONE_VALUE_IN_THIS_FILTERFIELD_PLEASE_NOTE_THAT_THIS_OPTION_BONLY_WORKSB_WITH_THE_BNEWB_FILTERS_THAT_LOAD_ABOVE_THE_ADMIN_LIST_VIEW_YOU_CAN_SELECT_THE_NEW_FILTER_OPTION_WHENWHERE_YOU_ADD_THE_VIEW_TO_THE_COMPONENT'), timeout: 10000, status: 'primary', pos: 'top-right'}); + } else if (1 == value) { + // means single option can be selected in the filter + jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_THE_BSINGLE_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_JUST_ONE_VALUE_IN_THIS_FILTERFIELD'), timeout: 5000, status: 'primary', pos: 'top-right'}); + } +} diff --git a/admin/views/admin_fields/view.html.php b/admin/views/admin_fields/view.html.php index a8c811eca..a7e522353 100644 --- a/admin/views/admin_fields/view.html.php +++ b/admin/views/admin_fields/view.html.php @@ -209,6 +209,8 @@ class ComponentbuilderViewAdmin_fields extends JViewLegacy JText::script('COM_COMPONENTBUILDER_THE_BONLY_IN_LINKED_LIST_VIEWSB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_LINKED_LIST_VIEW_IF_THIS_VIEW_GETS_LINKED_TO_OTHER_VIEW_NOT_TO_THIS_ADMIN_LIST_VIEW'); JText::script('COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_NOT_AVAILABLE_TO_THE_FIELD_IF_BNONE_DBB_OPTION_IS_SELECTED'); JText::script('COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_ONLY_AVAILABLE_TO_THE_FIELD_IF_BSHOW_IN_LIST_VIEWB_OPTION_IS_SELECTED'); + JText::script('COM_COMPONENTBUILDER_THE_BMULTI_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_MORE_THEN_ONE_VALUE_IN_THIS_FILTERFIELD_PLEASE_NOTE_THAT_THIS_OPTION_BONLY_WORKSB_WITH_THE_BNEWB_FILTERS_THAT_LOAD_ABOVE_THE_ADMIN_LIST_VIEW_YOU_CAN_SELECT_THE_NEW_FILTER_OPTION_WHENWHERE_YOU_ADD_THE_VIEW_TO_THE_COMPONENT'); + JText::script('COM_COMPONENTBUILDER_THE_BSINGLE_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_JUST_ONE_VALUE_IN_THIS_FILTERFIELD'); JText::script('view not acceptable. Error'); } } diff --git a/admin/views/admin_fields_conditions/tmpl/edit.php b/admin/views/admin_fields_conditions/tmpl/edit.php index 1ef755774..580efee01 100644 --- a/admin/views/admin_fields_conditions/tmpl/edit.php +++ b/admin/views/admin_fields_conditions/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/admin_fields_relations/tmpl/edit.php b/admin/views/admin_fields_relations/tmpl/edit.php index 9cdee6ac0..c21dc6239 100644 --- a/admin/views/admin_fields_relations/tmpl/edit.php +++ b/admin/views/admin_fields_relations/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/admin_view/tmpl/edit.php b/admin/views/admin_view/tmpl/edit.php index da0706cbf..73386976e 100644 --- a/admin/views/admin_view/tmpl/edit.php +++ b/admin/views/admin_view/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/admin_views/tmpl/default.php b/admin/views/admin_views/tmpl/default.php index 81bc87541..fe4741d7e 100644 --- a/admin/views/admin_views/tmpl/default.php +++ b/admin/views/admin_views/tmpl/default.php @@ -12,76 +12,58 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAdminviewsfiltertype', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_TYPE') . ' -')); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=admin_views.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'admin_viewList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> -
'; @@ -13805,15 +14254,18 @@ class Interpretation extends Fields } // add the defaults - if (!isset($this->fieldsNames[$viewName_single]['id'])) + if (!isset($this->fieldsNames[$nameSingleCode]['id'])) { - $data_type = (2 == $this->footableVersion) ? 'data-type="numeric"' + $data_type = (2 == $this->footableVersion) + ? 'data-type="numeric"' : 'data-type="number"'; - $head .= PHP_EOL . $this->_t(2) . '_t(2) . ''; - $head .= PHP_EOL . $this->_t(3) . "_t(3) . ""; - $head .= PHP_EOL . $this->_t(2) . "
- loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_ADMIN_VIEWS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/admin_views/tmpl/default_body.php b/admin/views/admin_views/tmpl/default_body.php index 68ff88010..2a4672bb4 100644 --- a/admin/views/admin_views/tmpl/default_body.php +++ b/admin/views/admin_views/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=admin_views&task=admin_view. get('admin_view.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/admin_views/tmpl/default_head.php b/admin/views/admin_views/tmpl/default_head.php index 621a037fd..67725fabb 100644 --- a/admin/views/admin_views/tmpl/default_head.php +++ b/admin/views/admin_views/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/admin_views/view.html.php b/admin/views/admin_views/view.html.php index 2df832309..ca53e2a15 100644 --- a/admin/views/admin_views/view.html.php +++ b/admin/views/admin_views/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewAdmin_views extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,189 +161,126 @@ class ComponentbuilderViewAdmin_views extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Add Fadein Selection - $this->add_fadeinOptions = $this->getTheAdd_fadeinSelections(); - // We do some sanitation for Add Fadein filter - if (ComponentbuilderHelper::checkArray($this->add_fadeinOptions) && - isset($this->add_fadeinOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_fadeinOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->add_fadeinOptions[0]); - } - // Only load Add Fadein filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_fadeinOptions)) - { - // Add Fadein Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_FADEIN_LABEL').' -', - 'filter_add_fadein', - JHtml::_('select.options', $this->add_fadeinOptions, 'value', 'text', $this->state->get('filter.add_fadein')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Add Fadein Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_FADEIN_LABEL').' -', - 'batch[add_fadein]', - JHtml::_('select.options', $this->add_fadeinOptions, 'value', 'text') - ); - } } - // Set Type Selection - $this->typeOptions = $this->getTheTypeSelections(); - // We do some sanitation for Type filter - if (ComponentbuilderHelper::checkArray($this->typeOptions) && - isset($this->typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->typeOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->typeOptions[0]); - } - // Only load Type filter if it has values - if (ComponentbuilderHelper::checkArray($this->typeOptions)) - { - // Type Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_TYPE_LABEL').' -', - 'filter_type', - JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Add Fadein batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Fadein Selection + $this->add_fadeinOptions = JFormHelper::loadFieldType('adminviewsfilteraddfadein')->options; + // We do some sanitation for Add Fadein filter + if (ComponentbuilderHelper::checkArray($this->add_fadeinOptions) && + isset($this->add_fadeinOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_fadeinOptions[0]->value)) { - // Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_TYPE_LABEL').' -', - 'batch[type]', - JHtml::_('select.options', $this->typeOptions, 'value', 'text') - ); + unset($this->add_fadeinOptions[0]); } - } - - // Set Add Custom Button Selection - $this->add_custom_buttonOptions = $this->getTheAdd_custom_buttonSelections(); - // We do some sanitation for Add Custom Button filter - if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions) && - isset($this->add_custom_buttonOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_custom_buttonOptions[0]->value)) - { - unset($this->add_custom_buttonOptions[0]); - } - // Only load Add Custom Button filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions)) - { - // Add Custom Button Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', - 'filter_add_custom_button', - JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text', $this->state->get('filter.add_custom_button')) + // Add Fadein Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_FADEIN_LABEL').' -', + 'batch[add_fadein]', + JHtml::_('select.options', $this->add_fadeinOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Type Selection + $this->typeOptions = JFormHelper::loadFieldType('adminviewsfiltertype')->options; + // We do some sanitation for Type filter + if (ComponentbuilderHelper::checkArray($this->typeOptions) && + isset($this->typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->typeOptions[0]->value)) { - // Add Custom Button Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', - 'batch[add_custom_button]', - JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text') - ); + unset($this->typeOptions[0]); } - } - - // Set Add Php Ajax Selection - $this->add_php_ajaxOptions = $this->getTheAdd_php_ajaxSelections(); - // We do some sanitation for Add Php Ajax filter - if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions) && - isset($this->add_php_ajaxOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_php_ajaxOptions[0]->value)) - { - unset($this->add_php_ajaxOptions[0]); - } - // Only load Add Php Ajax filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions)) - { - // Add Php Ajax Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AJAX_LABEL').' -', - 'filter_add_php_ajax', - JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text', $this->state->get('filter.add_php_ajax')) + // Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Add Custom Button batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Custom Button Selection + $this->add_custom_buttonOptions = JFormHelper::loadFieldType('adminviewsfilteraddcustombutton')->options; + // We do some sanitation for Add Custom Button filter + if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions) && + isset($this->add_custom_buttonOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_custom_buttonOptions[0]->value)) { - // Add Php Ajax Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AJAX_LABEL').' -', - 'batch[add_php_ajax]', - JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text') - ); + unset($this->add_custom_buttonOptions[0]); } - } - - // Set Add Custom Import Selection - $this->add_custom_importOptions = $this->getTheAdd_custom_importSelections(); - // We do some sanitation for Add Custom Import filter - if (ComponentbuilderHelper::checkArray($this->add_custom_importOptions) && - isset($this->add_custom_importOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_custom_importOptions[0]->value)) - { - unset($this->add_custom_importOptions[0]); - } - // Only load Add Custom Import filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_custom_importOptions)) - { - // Add Custom Import Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_IMPORT_LABEL').' -', - 'filter_add_custom_import', - JHtml::_('select.options', $this->add_custom_importOptions, 'value', 'text', $this->state->get('filter.add_custom_import')) + // Add Custom Button Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', + 'batch[add_custom_button]', + JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Add Php Ajax batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Php Ajax Selection + $this->add_php_ajaxOptions = JFormHelper::loadFieldType('adminviewsfilteraddphpajax')->options; + // We do some sanitation for Add Php Ajax filter + if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions) && + isset($this->add_php_ajaxOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_php_ajaxOptions[0]->value)) { - // Add Custom Import Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_IMPORT_LABEL').' -', - 'batch[add_custom_import]', - JHtml::_('select.options', $this->add_custom_importOptions, 'value', 'text') - ); + unset($this->add_php_ajaxOptions[0]); } + // Add Php Ajax Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_PHP_AJAX_LABEL').' -', + 'batch[add_php_ajax]', + JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text') + ); + } + + // Only load Add Custom Import batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Custom Import Selection + $this->add_custom_importOptions = JFormHelper::loadFieldType('adminviewsfilteraddcustomimport')->options; + // We do some sanitation for Add Custom Import filter + if (ComponentbuilderHelper::checkArray($this->add_custom_importOptions) && + isset($this->add_custom_importOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_custom_importOptions[0]->value)) + { + unset($this->add_custom_importOptions[0]); + } + // Add Custom Import Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_IMPORT_LABEL').' -', + 'batch[add_custom_import]', + JHtml::_('select.options', $this->add_custom_importOptions, 'value', 'text') + ); } } @@ -384,192 +325,12 @@ class ComponentbuilderViewAdmin_views extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.system_name' => JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_SYSTEM_NAME_LABEL'), 'a.name_single' => JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_LABEL'), 'a.short_description' => JText::_('COM_COMPONENTBUILDER_ADMIN_VIEW_SHORT_DESCRIPTION_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheAdd_fadeinSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_fadein')); - $query->from($db->quoteName('#__componentbuilder_admin_view')); - $query->order($db->quoteName('add_fadein') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_fadein) - { - // Translate the add_fadein selection - $text = $model->selectionTranslation($add_fadein,'add_fadein'); - // Now add the add_fadein and its text to the options array - $_filter[] = JHtml::_('select.option', $add_fadein, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheTypeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('type')); - $query->from($db->quoteName('#__componentbuilder_admin_view')); - $query->order($db->quoteName('type') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $type) - { - // Translate the type selection - $text = $model->selectionTranslation($type,'type'); - // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheAdd_custom_buttonSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_custom_button')); - $query->from($db->quoteName('#__componentbuilder_admin_view')); - $query->order($db->quoteName('add_custom_button') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_custom_button) - { - // Translate the add_custom_button selection - $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); - // Now add the add_custom_button and its text to the options array - $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheAdd_php_ajaxSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_php_ajax')); - $query->from($db->quoteName('#__componentbuilder_admin_view')); - $query->order($db->quoteName('add_php_ajax') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_php_ajax) - { - // Translate the add_php_ajax selection - $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); - // Now add the add_php_ajax and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheAdd_custom_importSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_custom_import')); - $query->from($db->quoteName('#__componentbuilder_admin_view')); - $query->order($db->quoteName('add_custom_import') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_custom_import) - { - // Translate the add_custom_import selection - $text = $model->selectionTranslation($add_custom_import,'add_custom_import'); - // Now add the add_custom_import and its text to the options array - $_filter[] = JHtml::_('select.option', $add_custom_import, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/admins_custom_tabs/tmpl/default.php b/admin/views/admins_custom_tabs/tmpl/default.php index cbe0eb57a..10dd8320f 100644 --- a/admin/views/admins_custom_tabs/tmpl/default.php +++ b/admin/views/admins_custom_tabs/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=admins_custom_tabs.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'admin_custom_tabsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/admins_custom_tabs/tmpl/default_body.php b/admin/views/admins_custom_tabs/tmpl/default_body.php index 6ee3388e5..bd8af1337 100644 --- a/admin/views/admins_custom_tabs/tmpl/default_body.php +++ b/admin/views/admins_custom_tabs/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=admins_custom_tabs&task=admi get('admin_custom_tabs.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/admins_custom_tabs/tmpl/default_head.php b/admin/views/admins_custom_tabs/tmpl/default_head.php index aa849a813..b29f76534 100644 --- a/admin/views/admins_custom_tabs/tmpl/default_head.php +++ b/admin/views/admins_custom_tabs/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/admins_custom_tabs/view.html.php b/admin/views/admins_custom_tabs/view.html.php index 826f01f50..7c2522a0d 100644 --- a/admin/views/admins_custom_tabs/view.html.php +++ b/admin/views/admins_custom_tabs/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewAdmins_custom_tabs extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewAdmins_custom_tabs extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewAdmins_custom_tabs extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/admins_fields/tmpl/default.php b/admin/views/admins_fields/tmpl/default.php index 61a8b37dd..3ece44ae4 100644 --- a/admin/views/admins_fields/tmpl/default.php +++ b/admin/views/admins_fields/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=admins_fields.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'admin_fieldsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/admins_fields/tmpl/default_body.php b/admin/views/admins_fields/tmpl/default_body.php index 50cab67ab..b1e5aba8f 100644 --- a/admin/views/admins_fields/tmpl/default_body.php +++ b/admin/views/admins_fields/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=admins_fields&task=admin_fie get('admin_fields.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/admins_fields/tmpl/default_head.php b/admin/views/admins_fields/tmpl/default_head.php index 087352029..bcd84b2c0 100644 --- a/admin/views/admins_fields/tmpl/default_head.php +++ b/admin/views/admins_fields/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/admins_fields/view.html.php b/admin/views/admins_fields/view.html.php index 602d3b89d..9224a35fd 100644 --- a/admin/views/admins_fields/view.html.php +++ b/admin/views/admins_fields/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewAdmins_fields extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewAdmins_fields extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewAdmins_fields extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/admins_fields_conditions/tmpl/default.php b/admin/views/admins_fields_conditions/tmpl/default.php index b04fdb62a..01eb8d8d5 100644 --- a/admin/views/admins_fields_conditions/tmpl/default.php +++ b/admin/views/admins_fields_conditions/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=admins_fields_conditions.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'admin_fields_conditionsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/admins_fields_conditions/tmpl/default_body.php b/admin/views/admins_fields_conditions/tmpl/default_body.php index 3b28f7d3d..20bfe6ec5 100644 --- a/admin/views/admins_fields_conditions/tmpl/default_body.php +++ b/admin/views/admins_fields_conditions/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=admins_fields_conditions&tas get('admin_fields_conditions.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/admins_fields_conditions/tmpl/default_head.php b/admin/views/admins_fields_conditions/tmpl/default_head.php index 9b77e90aa..4cb801025 100644 --- a/admin/views/admins_fields_conditions/tmpl/default_head.php +++ b/admin/views/admins_fields_conditions/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/admins_fields_conditions/view.html.php b/admin/views/admins_fields_conditions/view.html.php index 76e25b0c3..ab0e3a86f 100644 --- a/admin/views/admins_fields_conditions/view.html.php +++ b/admin/views/admins_fields_conditions/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewAdmins_fields_conditions extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewAdmins_fields_conditions extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewAdmins_fields_conditions extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/admins_fields_relations/tmpl/default.php b/admin/views/admins_fields_relations/tmpl/default.php index 457b13264..97e8a1e49 100644 --- a/admin/views/admins_fields_relations/tmpl/default.php +++ b/admin/views/admins_fields_relations/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=admins_fields_relations.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'admin_fields_relationsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/admins_fields_relations/tmpl/default_body.php b/admin/views/admins_fields_relations/tmpl/default_body.php index 0b49c1189..91e2953e3 100644 --- a/admin/views/admins_fields_relations/tmpl/default_body.php +++ b/admin/views/admins_fields_relations/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=admins_fields_relations&task get('admin_fields_relations.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/admins_fields_relations/tmpl/default_head.php b/admin/views/admins_fields_relations/tmpl/default_head.php index 7ed86a441..4478a3043 100644 --- a/admin/views/admins_fields_relations/tmpl/default_head.php +++ b/admin/views/admins_fields_relations/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/admins_fields_relations/view.html.php b/admin/views/admins_fields_relations/view.html.php index 836528945..7d22cf1df 100644 --- a/admin/views/admins_fields_relations/view.html.php +++ b/admin/views/admins_fields_relations/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewAdmins_fields_relations extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewAdmins_fields_relations extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewAdmins_fields_relations extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/class_extendings/tmpl/default.php b/admin/views/class_extendings/tmpl/default.php index cf196e3d1..d36e6945b 100644 --- a/admin/views/class_extendings/tmpl/default.php +++ b/admin/views/class_extendings/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=class_extendings.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'class_extendsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/class_extendings/tmpl/default_body.php b/admin/views/class_extendings/tmpl/default_body.php index 41e8bacc1..63c61ea8c 100644 --- a/admin/views/class_extendings/tmpl/default_body.php +++ b/admin/views/class_extendings/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=class_extendings&task=class_ get('class_extends.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/class_extendings/tmpl/default_head.php b/admin/views/class_extendings/tmpl/default_head.php index a0eb35c71..bb35648fe 100644 --- a/admin/views/class_extendings/tmpl/default_head.php +++ b/admin/views/class_extendings/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,14 +30,14 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -45,6 +45,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/class_extendings/view.html.php b/admin/views/class_extendings/view.html.php index 280e3a8a4..d1bfe51bb 100644 --- a/admin/views/class_extendings/view.html.php +++ b/admin/views/class_extendings/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewClass_extendings extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,69 +146,46 @@ class ComponentbuilderViewClass_extendings extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Extension Type Selection - $this->extension_typeOptions = $this->getTheExtension_typeSelections(); - // We do some sanitation for Extension Type filter - if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && - isset($this->extension_typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->extension_typeOptions[0]); - } - // Only load Extension Type filter if it has values - if (ComponentbuilderHelper::checkArray($this->extension_typeOptions)) - { - // Extension Type Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL').' -', - 'filter_extension_type', - JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text', $this->state->get('filter.extension_type')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Extension Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Extension Type Selection + $this->extension_typeOptions = JFormHelper::loadFieldType('classextendingsfilterextensiontype')->options; + // We do some sanitation for Extension Type filter + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && + isset($this->extension_typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) { - // Extension Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL').' -', - 'batch[extension_type]', - JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') - ); + unset($this->extension_typeOptions[0]); } + // Extension Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL').' -', + 'batch[extension_type]', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') + ); } } @@ -249,47 +230,11 @@ class ComponentbuilderViewClass_extendings extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_LABEL'), 'a.extension_type' => JText::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheExtension_typeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('extension_type')); - $query->from($db->quoteName('#__componentbuilder_class_extends')); - $query->order($db->quoteName('extension_type') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $extension_type) - { - // Translate the extension_type selection - $text = $model->selectionTranslation($extension_type,'extension_type'); - // Now add the extension_type and its text to the options array - $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/class_extends/tmpl/edit.php b/admin/views/class_extends/tmpl/edit.php index 8bbebc8a1..395f83c99 100644 --- a/admin/views/class_extends/tmpl/edit.php +++ b/admin/views/class_extends/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/class_method/tmpl/edit.php b/admin/views/class_method/tmpl/edit.php index 05a1ed5c9..55e781fad 100644 --- a/admin/views/class_method/tmpl/edit.php +++ b/admin/views/class_method/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/class_methods/tmpl/default.php b/admin/views/class_methods/tmpl/default.php index 95414bd34..cefe2cede 100644 --- a/admin/views/class_methods/tmpl/default.php +++ b/admin/views/class_methods/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=class_methods.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'class_methodList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CLASS_METHODS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/class_methods/tmpl/default_body.php b/admin/views/class_methods/tmpl/default_body.php index 16356746d..13ab49b99 100644 --- a/admin/views/class_methods/tmpl/default_body.php +++ b/admin/views/class_methods/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=class_methods&task=class_met get('class_method.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/class_methods/tmpl/default_head.php b/admin/views/class_methods/tmpl/default_head.php index 929bc3cc1..4269a7383 100644 --- a/admin/views/class_methods/tmpl/default_head.php +++ b/admin/views/class_methods/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/class_methods/view.html.php b/admin/views/class_methods/view.html.php index 4c8fd1d21..aadb6a920 100644 --- a/admin/views/class_methods/view.html.php +++ b/admin/views/class_methods/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewClass_methods extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -152,99 +156,66 @@ class ComponentbuilderViewClass_methods extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Visibility Selection - $this->visibilityOptions = $this->getTheVisibilitySelections(); - // We do some sanitation for Visibility filter - if (ComponentbuilderHelper::checkArray($this->visibilityOptions) && - isset($this->visibilityOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->visibilityOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->visibilityOptions[0]); - } - // Only load Visibility filter if it has values - if (ComponentbuilderHelper::checkArray($this->visibilityOptions)) - { - // Visibility Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL').' -', - 'filter_visibility', - JHtml::_('select.options', $this->visibilityOptions, 'value', 'text', $this->state->get('filter.visibility')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Visibility Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL').' -', - 'batch[visibility]', - JHtml::_('select.options', $this->visibilityOptions, 'value', 'text') - ); - } } - // Set Extension Type Selection - $this->extension_typeOptions = $this->getTheExtension_typeSelections(); - // We do some sanitation for Extension Type filter - if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && - isset($this->extension_typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->extension_typeOptions[0]); - } - // Only load Extension Type filter if it has values - if (ComponentbuilderHelper::checkArray($this->extension_typeOptions)) - { - // Extension Type Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL').' -', - 'filter_extension_type', - JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text', $this->state->get('filter.extension_type')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Visibility batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Visibility Selection + $this->visibilityOptions = JFormHelper::loadFieldType('classmethodsfiltervisibility')->options; + // We do some sanitation for Visibility filter + if (ComponentbuilderHelper::checkArray($this->visibilityOptions) && + isset($this->visibilityOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->visibilityOptions[0]->value)) { - // Extension Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL').' -', - 'batch[extension_type]', - JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') - ); + unset($this->visibilityOptions[0]); } + // Visibility Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL').' -', + 'batch[visibility]', + JHtml::_('select.options', $this->visibilityOptions, 'value', 'text') + ); + } + + // Only load Extension Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Extension Type Selection + $this->extension_typeOptions = JFormHelper::loadFieldType('classmethodsfilterextensiontype')->options; + // We do some sanitation for Extension Type filter + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && + isset($this->extension_typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + { + unset($this->extension_typeOptions[0]); + } + // Extension Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL').' -', + 'batch[extension_type]', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') + ); } } @@ -289,84 +260,12 @@ class ComponentbuilderViewClass_methods extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_NAME_LABEL'), 'a.visibility' => JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL'), 'a.extension_type' => JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheVisibilitySelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('visibility')); - $query->from($db->quoteName('#__componentbuilder_class_method')); - $query->order($db->quoteName('visibility') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $visibility) - { - // Translate the visibility selection - $text = $model->selectionTranslation($visibility,'visibility'); - // Now add the visibility and its text to the options array - $_filter[] = JHtml::_('select.option', $visibility, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheExtension_typeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('extension_type')); - $query->from($db->quoteName('#__componentbuilder_class_method')); - $query->order($db->quoteName('extension_type') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $extension_type) - { - // Translate the extension_type selection - $text = $model->selectionTranslation($extension_type,'extension_type'); - // Now add the extension_type and its text to the options array - $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/class_properties/tmpl/default.php b/admin/views/class_properties/tmpl/default.php index 42f995783..f7c38aaaf 100644 --- a/admin/views/class_properties/tmpl/default.php +++ b/admin/views/class_properties/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=class_properties.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'class_propertyList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTIES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/class_properties/tmpl/default_body.php b/admin/views/class_properties/tmpl/default_body.php index ab07f6591..c7b6256d4 100644 --- a/admin/views/class_properties/tmpl/default_body.php +++ b/admin/views/class_properties/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=class_properties&task=class_ get('class_property.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/class_properties/tmpl/default_head.php b/admin/views/class_properties/tmpl/default_head.php index 455f8bf58..e7c4f1994 100644 --- a/admin/views/class_properties/tmpl/default_head.php +++ b/admin/views/class_properties/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/class_properties/view.html.php b/admin/views/class_properties/view.html.php index 23bbe8de1..b58f64222 100644 --- a/admin/views/class_properties/view.html.php +++ b/admin/views/class_properties/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewClass_properties extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -152,99 +156,66 @@ class ComponentbuilderViewClass_properties extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Visibility Selection - $this->visibilityOptions = $this->getTheVisibilitySelections(); - // We do some sanitation for Visibility filter - if (ComponentbuilderHelper::checkArray($this->visibilityOptions) && - isset($this->visibilityOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->visibilityOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->visibilityOptions[0]); - } - // Only load Visibility filter if it has values - if (ComponentbuilderHelper::checkArray($this->visibilityOptions)) - { - // Visibility Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL').' -', - 'filter_visibility', - JHtml::_('select.options', $this->visibilityOptions, 'value', 'text', $this->state->get('filter.visibility')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Visibility Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL').' -', - 'batch[visibility]', - JHtml::_('select.options', $this->visibilityOptions, 'value', 'text') - ); - } } - // Set Extension Type Selection - $this->extension_typeOptions = $this->getTheExtension_typeSelections(); - // We do some sanitation for Extension Type filter - if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && - isset($this->extension_typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->extension_typeOptions[0]); - } - // Only load Extension Type filter if it has values - if (ComponentbuilderHelper::checkArray($this->extension_typeOptions)) - { - // Extension Type Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL').' -', - 'filter_extension_type', - JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text', $this->state->get('filter.extension_type')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Visibility batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Visibility Selection + $this->visibilityOptions = JFormHelper::loadFieldType('classpropertiesfiltervisibility')->options; + // We do some sanitation for Visibility filter + if (ComponentbuilderHelper::checkArray($this->visibilityOptions) && + isset($this->visibilityOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->visibilityOptions[0]->value)) { - // Extension Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL').' -', - 'batch[extension_type]', - JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') - ); + unset($this->visibilityOptions[0]); } + // Visibility Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL').' -', + 'batch[visibility]', + JHtml::_('select.options', $this->visibilityOptions, 'value', 'text') + ); + } + + // Only load Extension Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Extension Type Selection + $this->extension_typeOptions = JFormHelper::loadFieldType('classpropertiesfilterextensiontype')->options; + // We do some sanitation for Extension Type filter + if (ComponentbuilderHelper::checkArray($this->extension_typeOptions) && + isset($this->extension_typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->extension_typeOptions[0]->value)) + { + unset($this->extension_typeOptions[0]); + } + // Extension Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL').' -', + 'batch[extension_type]', + JHtml::_('select.options', $this->extension_typeOptions, 'value', 'text') + ); } } @@ -289,84 +260,12 @@ class ComponentbuilderViewClass_properties extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_LABEL'), 'a.visibility' => JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL'), 'a.extension_type' => JText::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheVisibilitySelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('visibility')); - $query->from($db->quoteName('#__componentbuilder_class_property')); - $query->order($db->quoteName('visibility') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $visibility) - { - // Translate the visibility selection - $text = $model->selectionTranslation($visibility,'visibility'); - // Now add the visibility and its text to the options array - $_filter[] = JHtml::_('select.option', $visibility, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheExtension_typeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('extension_type')); - $query->from($db->quoteName('#__componentbuilder_class_property')); - $query->order($db->quoteName('extension_type') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $extension_type) - { - // Translate the extension_type selection - $text = $model->selectionTranslation($extension_type,'extension_type'); - // Now add the extension_type and its text to the options array - $_filter[] = JHtml::_('select.option', $extension_type, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/class_property/tmpl/edit.php b/admin/views/class_property/tmpl/edit.php index c371b7f3d..eab4d5d26 100644 --- a/admin/views/class_property/tmpl/edit.php +++ b/admin/views/class_property/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/compiler/tmpl/default.php b/admin/views/compiler/tmpl/default.php index a58a36ea2..9cc8f7b7c 100644 --- a/admin/views/compiler/tmpl/default.php +++ b/admin/views/compiler/tmpl/default.php @@ -10,17 +10,17 @@ */ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); $this->app->input->set('hidemainmenu', false); $selectNotice = '

' . JText::_('COM_COMPONENTBUILDER_HI') . ' ' . $this->user->name . '

'; $selectNotice .= '

' . JText::_('COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONENT_THAT_YOU_WOULD_LIKE_TO_COMPILE') . '

'; - -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); ?> canDo->get('compiler.access')): ?>
diff --git a/admin/views/component_admin_views/tmpl/edit.php b/admin/views/component_admin_views/tmpl/edit.php index fcf93e100..5437546d9 100644 --- a/admin/views/component_admin_views/tmpl/edit.php +++ b/admin/views/component_admin_views/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_config/tmpl/edit.php b/admin/views/component_config/tmpl/edit.php index 756745e9c..30a39ce89 100644 --- a/admin/views/component_config/tmpl/edit.php +++ b/admin/views/component_config/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_custom_admin_menus/tmpl/edit.php b/admin/views/component_custom_admin_menus/tmpl/edit.php index 7edc56830..3ddccb0a7 100644 --- a/admin/views/component_custom_admin_menus/tmpl/edit.php +++ b/admin/views/component_custom_admin_menus/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_custom_admin_views/tmpl/edit.php b/admin/views/component_custom_admin_views/tmpl/edit.php index 6e7aab4bc..97243352a 100644 --- a/admin/views/component_custom_admin_views/tmpl/edit.php +++ b/admin/views/component_custom_admin_views/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_dashboard/tmpl/edit.php b/admin/views/component_dashboard/tmpl/edit.php index 3b737d6e8..200e80754 100644 --- a/admin/views/component_dashboard/tmpl/edit.php +++ b/admin/views/component_dashboard/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_files_folders/tmpl/edit.php b/admin/views/component_files_folders/tmpl/edit.php index f25b1e7fd..aa5625930 100644 --- a/admin/views/component_files_folders/tmpl/edit.php +++ b/admin/views/component_files_folders/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_modules/tmpl/edit.php b/admin/views/component_modules/tmpl/edit.php index c8b23313c..09b0a55cd 100644 --- a/admin/views/component_modules/tmpl/edit.php +++ b/admin/views/component_modules/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_mysql_tweaks/tmpl/edit.php b/admin/views/component_mysql_tweaks/tmpl/edit.php index a04dcd019..0005cb2f2 100644 --- a/admin/views/component_mysql_tweaks/tmpl/edit.php +++ b/admin/views/component_mysql_tweaks/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_placeholders/tmpl/edit.php b/admin/views/component_placeholders/tmpl/edit.php index 9776309e7..e4410466a 100644 --- a/admin/views/component_placeholders/tmpl/edit.php +++ b/admin/views/component_placeholders/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_plugins/tmpl/edit.php b/admin/views/component_plugins/tmpl/edit.php index f14227200..fdbe4e03b 100644 --- a/admin/views/component_plugins/tmpl/edit.php +++ b/admin/views/component_plugins/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_site_views/tmpl/edit.php b/admin/views/component_site_views/tmpl/edit.php index 3006ac614..ccb248ad4 100644 --- a/admin/views/component_site_views/tmpl/edit.php +++ b/admin/views/component_site_views/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/component_updates/tmpl/edit.php b/admin/views/component_updates/tmpl/edit.php index 998874f5b..3f7d82a8c 100644 --- a/admin/views/component_updates/tmpl/edit.php +++ b/admin/views/component_updates/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/components_admin_views/tmpl/default.php b/admin/views/components_admin_views/tmpl/default.php index 266415998..48980a4ca 100644 --- a/admin/views/components_admin_views/tmpl/default.php +++ b/admin/views/components_admin_views/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_admin_views.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_admin_viewsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - - -sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_admin_views/tmpl/default_body.php b/admin/views/components_admin_views/tmpl/default_body.php index 32ef39896..13c6df719 100644 --- a/admin/views/components_admin_views/tmpl/default_body.php +++ b/admin/views/components_admin_views/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_admin_views&task= get('component_admin_views.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_admin_views/tmpl/default_head.php b/admin/views/components_admin_views/tmpl/default_head.php index 32c323caa..b4515bb34 100644 --- a/admin/views/components_admin_views/tmpl/default_head.php +++ b/admin/views/components_admin_views/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_admin_views/view.html.php b/admin/views/components_admin_views/view.html.php index b2451a3b0..8d65799e2 100644 --- a/admin/views/components_admin_views/view.html.php +++ b/admin/views/components_admin_views/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_admin_views extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_admin_views extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_admin_views extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_config/tmpl/default.php b/admin/views/components_config/tmpl/default.php index 8edd52a0c..423d8486c 100644 --- a/admin/views/components_config/tmpl/default.php +++ b/admin/views/components_config/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_config.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_configList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_CONFIG_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_config/tmpl/default_body.php b/admin/views/components_config/tmpl/default_body.php index 787105352..b0a4e1ffa 100644 --- a/admin/views/components_config/tmpl/default_body.php +++ b/admin/views/components_config/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_config&task=compo get('component_config.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_config/tmpl/default_head.php b/admin/views/components_config/tmpl/default_head.php index 19bb34c25..10404bdd5 100644 --- a/admin/views/components_config/tmpl/default_head.php +++ b/admin/views/components_config/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_config/view.html.php b/admin/views/components_config/view.html.php index b3193256b..52110c6e9 100644 --- a/admin/views/components_config/view.html.php +++ b/admin/views/components_config/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_config extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_config extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_config extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_custom_admin_menus/tmpl/default.php b/admin/views/components_custom_admin_menus/tmpl/default.php index ea35f2709..574a4ab7a 100644 --- a/admin/views/components_custom_admin_menus/tmpl/default.php +++ b/admin/views/components_custom_admin_menus/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_custom_admin_menus.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_custom_admin_menusList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_custom_admin_menus/tmpl/default_body.php b/admin/views/components_custom_admin_menus/tmpl/default_body.php index 4ac3820d0..7cd7b7644 100644 --- a/admin/views/components_custom_admin_menus/tmpl/default_body.php +++ b/admin/views/components_custom_admin_menus/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_custom_admin_menu get('component_custom_admin_menus.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_custom_admin_menus/tmpl/default_head.php b/admin/views/components_custom_admin_menus/tmpl/default_head.php index e8cd208bc..57aa10b7d 100644 --- a/admin/views/components_custom_admin_menus/tmpl/default_head.php +++ b/admin/views/components_custom_admin_menus/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_custom_admin_menus/view.html.php b/admin/views/components_custom_admin_menus/view.html.php index 7d3d238e6..fae5588af 100644 --- a/admin/views/components_custom_admin_menus/view.html.php +++ b/admin/views/components_custom_admin_menus/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_custom_admin_menus extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_custom_admin_menus extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_custom_admin_menus extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_custom_admin_views/tmpl/default.php b/admin/views/components_custom_admin_views/tmpl/default.php index 0fde9afd2..4c8d67ea9 100644 --- a/admin/views/components_custom_admin_views/tmpl/default.php +++ b/admin/views/components_custom_admin_views/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_custom_admin_views.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_custom_admin_viewsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_custom_admin_views/tmpl/default_body.php b/admin/views/components_custom_admin_views/tmpl/default_body.php index fd6372b92..2951e29b2 100644 --- a/admin/views/components_custom_admin_views/tmpl/default_body.php +++ b/admin/views/components_custom_admin_views/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_custom_admin_view get('component_custom_admin_views.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_custom_admin_views/tmpl/default_head.php b/admin/views/components_custom_admin_views/tmpl/default_head.php index b171bddbc..ea3665f0c 100644 --- a/admin/views/components_custom_admin_views/tmpl/default_head.php +++ b/admin/views/components_custom_admin_views/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_custom_admin_views/view.html.php b/admin/views/components_custom_admin_views/view.html.php index 005aed9c6..bc028949e 100644 --- a/admin/views/components_custom_admin_views/view.html.php +++ b/admin/views/components_custom_admin_views/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_custom_admin_views extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_custom_admin_views extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_custom_admin_views extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_dashboard/tmpl/default.php b/admin/views/components_dashboard/tmpl/default.php index da24d5cdc..498f384d1 100644 --- a/admin/views/components_dashboard/tmpl/default.php +++ b/admin/views/components_dashboard/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_dashboard.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_dashboardList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_dashboard/tmpl/default_body.php b/admin/views/components_dashboard/tmpl/default_body.php index 0d47839d0..605f361da 100644 --- a/admin/views/components_dashboard/tmpl/default_body.php +++ b/admin/views/components_dashboard/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_dashboard&task=co get('component_dashboard.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_dashboard/tmpl/default_head.php b/admin/views/components_dashboard/tmpl/default_head.php index 618ea8dce..da9c070ea 100644 --- a/admin/views/components_dashboard/tmpl/default_head.php +++ b/admin/views/components_dashboard/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_dashboard/view.html.php b/admin/views/components_dashboard/view.html.php index b5b26ea2b..6e7c590ca 100644 --- a/admin/views/components_dashboard/view.html.php +++ b/admin/views/components_dashboard/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_dashboard extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_dashboard extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_dashboard extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_files_folders/tmpl/default.php b/admin/views/components_files_folders/tmpl/default.php index 1e6cb2418..852863acf 100644 --- a/admin/views/components_files_folders/tmpl/default.php +++ b/admin/views/components_files_folders/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_files_folders.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_files_foldersList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_files_folders/tmpl/default_body.php b/admin/views/components_files_folders/tmpl/default_body.php index ccf4b38d4..b86a3e2e5 100644 --- a/admin/views/components_files_folders/tmpl/default_body.php +++ b/admin/views/components_files_folders/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_files_folders&tas get('component_files_folders.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_files_folders/tmpl/default_head.php b/admin/views/components_files_folders/tmpl/default_head.php index 1b9c11dca..0b37bd86b 100644 --- a/admin/views/components_files_folders/tmpl/default_head.php +++ b/admin/views/components_files_folders/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_files_folders/view.html.php b/admin/views/components_files_folders/view.html.php index 394673df3..35bc76535 100644 --- a/admin/views/components_files_folders/view.html.php +++ b/admin/views/components_files_folders/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_files_folders extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_files_folders extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_files_folders extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_modules/tmpl/default.php b/admin/views/components_modules/tmpl/default.php index f048d2109..a36cf555b 100644 --- a/admin/views/components_modules/tmpl/default.php +++ b/admin/views/components_modules/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_modules.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_modulesList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_modules/tmpl/default_body.php b/admin/views/components_modules/tmpl/default_body.php index 6fb3c30d6..e5ccfc157 100644 --- a/admin/views/components_modules/tmpl/default_body.php +++ b/admin/views/components_modules/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_modules&task=comp get('component_modules.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_modules/tmpl/default_head.php b/admin/views/components_modules/tmpl/default_head.php index 85913a239..a4976daf0 100644 --- a/admin/views/components_modules/tmpl/default_head.php +++ b/admin/views/components_modules/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_modules/view.html.php b/admin/views/components_modules/view.html.php index 3fa8ec0e6..cd4f9617c 100644 --- a/admin/views/components_modules/view.html.php +++ b/admin/views/components_modules/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_modules extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_modules extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_modules extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_mysql_tweaks/tmpl/default.php b/admin/views/components_mysql_tweaks/tmpl/default.php index 62f392248..b01c46192 100644 --- a/admin/views/components_mysql_tweaks/tmpl/default.php +++ b/admin/views/components_mysql_tweaks/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_mysql_tweaks.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_mysql_tweaksList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_mysql_tweaks/tmpl/default_body.php b/admin/views/components_mysql_tweaks/tmpl/default_body.php index 01dc7d53b..8cb04f35c 100644 --- a/admin/views/components_mysql_tweaks/tmpl/default_body.php +++ b/admin/views/components_mysql_tweaks/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_mysql_tweaks&task get('component_mysql_tweaks.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_mysql_tweaks/tmpl/default_head.php b/admin/views/components_mysql_tweaks/tmpl/default_head.php index aca99e265..1c09bc8c6 100644 --- a/admin/views/components_mysql_tweaks/tmpl/default_head.php +++ b/admin/views/components_mysql_tweaks/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_mysql_tweaks/view.html.php b/admin/views/components_mysql_tweaks/view.html.php index 811e24274..8f99000be 100644 --- a/admin/views/components_mysql_tweaks/view.html.php +++ b/admin/views/components_mysql_tweaks/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_mysql_tweaks extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_mysql_tweaks extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_mysql_tweaks extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_placeholders/tmpl/default.php b/admin/views/components_placeholders/tmpl/default.php index 3612ef1b1..c89e720a3 100644 --- a/admin/views/components_placeholders/tmpl/default.php +++ b/admin/views/components_placeholders/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_placeholders.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_placeholdersList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_placeholders/tmpl/default_body.php b/admin/views/components_placeholders/tmpl/default_body.php index 5ca8905e7..193c33613 100644 --- a/admin/views/components_placeholders/tmpl/default_body.php +++ b/admin/views/components_placeholders/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_placeholders&task get('component_placeholders.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_placeholders/tmpl/default_head.php b/admin/views/components_placeholders/tmpl/default_head.php index 718c96bd0..fa984ea45 100644 --- a/admin/views/components_placeholders/tmpl/default_head.php +++ b/admin/views/components_placeholders/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_placeholders/view.html.php b/admin/views/components_placeholders/view.html.php index 1209ca0fe..e404ef607 100644 --- a/admin/views/components_placeholders/view.html.php +++ b/admin/views/components_placeholders/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_placeholders extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_placeholders extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_placeholders extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_plugins/tmpl/default.php b/admin/views/components_plugins/tmpl/default.php index f79c12620..60e35ed77 100644 --- a/admin/views/components_plugins/tmpl/default.php +++ b/admin/views/components_plugins/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_plugins.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_pluginsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_plugins/tmpl/default_body.php b/admin/views/components_plugins/tmpl/default_body.php index 0f41263a4..83ee9c3a6 100644 --- a/admin/views/components_plugins/tmpl/default_body.php +++ b/admin/views/components_plugins/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_plugins&task=comp get('component_plugins.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_plugins/tmpl/default_head.php b/admin/views/components_plugins/tmpl/default_head.php index a9e46c4fa..f5a6829b5 100644 --- a/admin/views/components_plugins/tmpl/default_head.php +++ b/admin/views/components_plugins/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_plugins/view.html.php b/admin/views/components_plugins/view.html.php index 8e925e30b..c50f55e9e 100644 --- a/admin/views/components_plugins/view.html.php +++ b/admin/views/components_plugins/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_plugins extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_plugins extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_plugins extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_site_views/tmpl/default.php b/admin/views/components_site_views/tmpl/default.php index f42d87bca..017e156d8 100644 --- a/admin/views/components_site_views/tmpl/default.php +++ b/admin/views/components_site_views/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_site_views.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_site_viewsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_site_views/tmpl/default_body.php b/admin/views/components_site_views/tmpl/default_body.php index 8c76f6567..0b9e5acb8 100644 --- a/admin/views/components_site_views/tmpl/default_body.php +++ b/admin/views/components_site_views/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_site_views&task=c get('component_site_views.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_site_views/tmpl/default_head.php b/admin/views/components_site_views/tmpl/default_head.php index 0dd72a58c..470cb9814 100644 --- a/admin/views/components_site_views/tmpl/default_head.php +++ b/admin/views/components_site_views/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_site_views/view.html.php b/admin/views/components_site_views/view.html.php index 91e959c01..4049b4b53 100644 --- a/admin/views/components_site_views/view.html.php +++ b/admin/views/components_site_views/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_site_views extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_site_views extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_site_views extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/components_updates/tmpl/default.php b/admin/views/components_updates/tmpl/default.php index 193c6b494..f6c024f60 100644 --- a/admin/views/components_updates/tmpl/default.php +++ b/admin/views/components_updates/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=components_updates.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'component_updatesList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_COMPONENTS_UPDATES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/components_updates/tmpl/default_body.php b/admin/views/components_updates/tmpl/default_body.php index 4c3624291..24bbccd85 100644 --- a/admin/views/components_updates/tmpl/default_body.php +++ b/admin/views/components_updates/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=components_updates&task=comp get('component_updates.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/components_updates/tmpl/default_head.php b/admin/views/components_updates/tmpl/default_head.php index d3d0312cb..0e9128ffc 100644 --- a/admin/views/components_updates/tmpl/default_head.php +++ b/admin/views/components_updates/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/components_updates/view.html.php b/admin/views/components_updates/view.html.php index c6761f65a..216ff9e24 100644 --- a/admin/views/components_updates/view.html.php +++ b/admin/views/components_updates/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewComponents_updates extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewComponents_updates extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewComponents_updates extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/custom_admin_view/tmpl/edit.php b/admin/views/custom_admin_view/tmpl/edit.php index 6571f0dd8..9c660c027 100644 --- a/admin/views/custom_admin_view/tmpl/edit.php +++ b/admin/views/custom_admin_view/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/custom_admin_views/tmpl/default.php b/admin/views/custom_admin_views/tmpl/default.php index e20fde714..74f9ce02d 100644 --- a/admin/views/custom_admin_views/tmpl/default.php +++ b/admin/views/custom_admin_views/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=custom_admin_views.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'custom_admin_viewList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/custom_admin_views/tmpl/default_body.php b/admin/views/custom_admin_views/tmpl/default_body.php index 1f23d8192..d9ef76bb4 100644 --- a/admin/views/custom_admin_views/tmpl/default_body.php +++ b/admin/views/custom_admin_views/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=custom_admin_views&task=cust get('core.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/custom_admin_views/tmpl/default_head.php b/admin/views/custom_admin_views/tmpl/default_head.php index 8a31858da..741b6f0a8 100644 --- a/admin/views/custom_admin_views/tmpl/default_head.php +++ b/admin/views/custom_admin_views/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,20 +30,20 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -51,6 +51,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/custom_admin_views/view.html.php b/admin/views/custom_admin_views/view.html.php index 381c261c1..d580d3ff7 100644 --- a/admin/views/custom_admin_views/view.html.php +++ b/admin/views/custom_admin_views/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewCustom_admin_views extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,129 +161,86 @@ class ComponentbuilderViewCustom_admin_views extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Main Get Name Selection - $this->main_getNameOptions = JFormHelper::loadFieldType('Maingets')->options; - // We do some sanitation for Main Get Name filter - if (ComponentbuilderHelper::checkArray($this->main_getNameOptions) && - isset($this->main_getNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->main_getNameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->main_getNameOptions[0]); - } - // Only load Main Get Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->main_getNameOptions)) - { - // Main Get Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL').' -', - 'filter_main_get', - JHtml::_('select.options', $this->main_getNameOptions, 'value', 'text', $this->state->get('filter.main_get')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Main Get Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL').' -', - 'batch[main_get]', - JHtml::_('select.options', $this->main_getNameOptions, 'value', 'text') - ); - } } - // Set Add Php Ajax Selection - $this->add_php_ajaxOptions = $this->getTheAdd_php_ajaxSelections(); - // We do some sanitation for Add Php Ajax filter - if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions) && - isset($this->add_php_ajaxOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_php_ajaxOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->add_php_ajaxOptions[0]); - } - // Only load Add Php Ajax filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions)) - { - // Add Php Ajax Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_AJAX_LABEL').' -', - 'filter_add_php_ajax', - JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text', $this->state->get('filter.add_php_ajax')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Main Get Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Main Get Name Selection + $this->main_getNameOptions = JFormHelper::loadFieldType('Maingets')->options; + // We do some sanitation for Main Get Name filter + if (ComponentbuilderHelper::checkArray($this->main_getNameOptions) && + isset($this->main_getNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->main_getNameOptions[0]->value)) { - // Add Php Ajax Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_AJAX_LABEL').' -', - 'batch[add_php_ajax]', - JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text') - ); + unset($this->main_getNameOptions[0]); } - } - - // Set Add Custom Button Selection - $this->add_custom_buttonOptions = $this->getTheAdd_custom_buttonSelections(); - // We do some sanitation for Add Custom Button filter - if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions) && - isset($this->add_custom_buttonOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_custom_buttonOptions[0]->value)) - { - unset($this->add_custom_buttonOptions[0]); - } - // Only load Add Custom Button filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions)) - { - // Add Custom Button Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', - 'filter_add_custom_button', - JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text', $this->state->get('filter.add_custom_button')) + // Main Get Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL').' -', + 'batch[main_get]', + JHtml::_('select.options', $this->main_getNameOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Add Php Ajax batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Php Ajax Selection + $this->add_php_ajaxOptions = JFormHelper::loadFieldType('customadminviewsfilteraddphpajax')->options; + // We do some sanitation for Add Php Ajax filter + if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions) && + isset($this->add_php_ajaxOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_php_ajaxOptions[0]->value)) { - // Add Custom Button Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', - 'batch[add_custom_button]', - JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text') - ); + unset($this->add_php_ajaxOptions[0]); } + // Add Php Ajax Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_AJAX_LABEL').' -', + 'batch[add_php_ajax]', + JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text') + ); + } + + // Only load Add Custom Button batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Custom Button Selection + $this->add_custom_buttonOptions = JFormHelper::loadFieldType('customadminviewsfilteraddcustombutton')->options; + // We do some sanitation for Add Custom Button filter + if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions) && + isset($this->add_custom_buttonOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_custom_buttonOptions[0]->value)) + { + unset($this->add_custom_buttonOptions[0]); + } + // Add Custom Button Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', + 'batch[add_custom_button]', + JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text') + ); } } @@ -324,7 +285,7 @@ class ComponentbuilderViewCustom_admin_views extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.system_name' => JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SYSTEM_NAME_LABEL'), 'a.name' => JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_LABEL'), @@ -332,77 +293,5 @@ class ComponentbuilderViewCustom_admin_views extends JViewLegacy 'g.name' => JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheAdd_php_ajaxSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_php_ajax')); - $query->from($db->quoteName('#__componentbuilder_custom_admin_view')); - $query->order($db->quoteName('add_php_ajax') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_php_ajax) - { - // Translate the add_php_ajax selection - $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); - // Now add the add_php_ajax and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheAdd_custom_buttonSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_custom_button')); - $query->from($db->quoteName('#__componentbuilder_custom_admin_view')); - $query->order($db->quoteName('add_custom_button') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_custom_button) - { - // Translate the add_custom_button selection - $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); - // Now add the add_custom_button and its text to the options array - $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/custom_code/tmpl/edit.php b/admin/views/custom_code/tmpl/edit.php index 13e16aba5..76306f33c 100644 --- a/admin/views/custom_code/tmpl/edit.php +++ b/admin/views/custom_code/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/custom_codes/tmpl/default.php b/admin/views/custom_codes/tmpl/default.php index f9214e15e..e08c1ca0d 100644 --- a/admin/views/custom_codes/tmpl/default.php +++ b/admin/views/custom_codes/tmpl/default.php @@ -12,76 +12,57 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=custom_codes.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'custom_codeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_CUSTOM_CODES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/custom_codes/tmpl/default_body.php b/admin/views/custom_codes/tmpl/default_body.php index e2a13cda3..5890c4e80 100644 --- a/admin/views/custom_codes/tmpl/default_body.php +++ b/admin/views/custom_codes/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=custom_codes&task=custom_cod get('custom_code.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/custom_codes/tmpl/default_head.php b/admin/views/custom_codes/tmpl/default_head.php index c14b79680..b5fcdb665 100644 --- a/admin/views/custom_codes/tmpl/default_head.php +++ b/admin/views/custom_codes/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,23 +30,23 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -54,6 +54,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/custom_codes/view.html.php b/admin/views/custom_codes/view.html.php index 5dd2c29fe..5258d068a 100644 --- a/admin/views/custom_codes/view.html.php +++ b/admin/views/custom_codes/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewCustom_codes extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,159 +161,106 @@ class ComponentbuilderViewCustom_codes extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Component System Name Selection - $this->componentSystem_nameOptions = JFormHelper::loadFieldType('Component')->options; - // We do some sanitation for Component System Name filter - if (ComponentbuilderHelper::checkArray($this->componentSystem_nameOptions) && - isset($this->componentSystem_nameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->componentSystem_nameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->componentSystem_nameOptions[0]); - } - // Only load Component System Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->componentSystem_nameOptions)) - { - // Component System Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL').' -', - 'filter_component', - JHtml::_('select.options', $this->componentSystem_nameOptions, 'value', 'text', $this->state->get('filter.component')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Component System Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL').' -', - 'batch[component]', - JHtml::_('select.options', $this->componentSystem_nameOptions, 'value', 'text') - ); - } } - // Set Target Selection - $this->targetOptions = $this->getTheTargetSelections(); - // We do some sanitation for Target filter - if (ComponentbuilderHelper::checkArray($this->targetOptions) && - isset($this->targetOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->targetOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->targetOptions[0]); - } - // Only load Target filter if it has values - if (ComponentbuilderHelper::checkArray($this->targetOptions)) - { - // Target Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_LABEL').' -', - 'filter_target', - JHtml::_('select.options', $this->targetOptions, 'value', 'text', $this->state->get('filter.target')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Component System Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Component System Name Selection + $this->componentSystem_nameOptions = JFormHelper::loadFieldType('Component')->options; + // We do some sanitation for Component System Name filter + if (ComponentbuilderHelper::checkArray($this->componentSystem_nameOptions) && + isset($this->componentSystem_nameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->componentSystem_nameOptions[0]->value)) { - // Target Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_LABEL').' -', - 'batch[target]', - JHtml::_('select.options', $this->targetOptions, 'value', 'text') - ); + unset($this->componentSystem_nameOptions[0]); } - } - - // Set Type Selection - $this->typeOptions = $this->getTheTypeSelections(); - // We do some sanitation for Type filter - if (ComponentbuilderHelper::checkArray($this->typeOptions) && - isset($this->typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->typeOptions[0]->value)) - { - unset($this->typeOptions[0]); - } - // Only load Type filter if it has values - if (ComponentbuilderHelper::checkArray($this->typeOptions)) - { - // Type Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL').' -', - 'filter_type', - JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')) + // Component System Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL').' -', + 'batch[component]', + JHtml::_('select.options', $this->componentSystem_nameOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Target batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Target Selection + $this->targetOptions = JFormHelper::loadFieldType('customcodesfiltertarget')->options; + // We do some sanitation for Target filter + if (ComponentbuilderHelper::checkArray($this->targetOptions) && + isset($this->targetOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->targetOptions[0]->value)) { - // Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL').' -', - 'batch[type]', - JHtml::_('select.options', $this->typeOptions, 'value', 'text') - ); + unset($this->targetOptions[0]); } - } - - // Set Comment Type Selection - $this->comment_typeOptions = $this->getTheComment_typeSelections(); - // We do some sanitation for Comment Type filter - if (ComponentbuilderHelper::checkArray($this->comment_typeOptions) && - isset($this->comment_typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->comment_typeOptions[0]->value)) - { - unset($this->comment_typeOptions[0]); - } - // Only load Comment Type filter if it has values - if (ComponentbuilderHelper::checkArray($this->comment_typeOptions)) - { - // Comment Type Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMMENT_TYPE_LABEL').' -', - 'filter_comment_type', - JHtml::_('select.options', $this->comment_typeOptions, 'value', 'text', $this->state->get('filter.comment_type')) + // Target Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_LABEL').' -', + 'batch[target]', + JHtml::_('select.options', $this->targetOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Type Selection + $this->typeOptions = JFormHelper::loadFieldType('customcodesfiltertype')->options; + // We do some sanitation for Type filter + if (ComponentbuilderHelper::checkArray($this->typeOptions) && + isset($this->typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->typeOptions[0]->value)) { - // Comment Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMMENT_TYPE_LABEL').' -', - 'batch[comment_type]', - JHtml::_('select.options', $this->comment_typeOptions, 'value', 'text') - ); + unset($this->typeOptions[0]); } + // Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeOptions, 'value', 'text') + ); + } + + // Only load Comment Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Comment Type Selection + $this->comment_typeOptions = JFormHelper::loadFieldType('customcodesfiltercommenttype')->options; + // We do some sanitation for Comment Type filter + if (ComponentbuilderHelper::checkArray($this->comment_typeOptions) && + isset($this->comment_typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->comment_typeOptions[0]->value)) + { + unset($this->comment_typeOptions[0]); + } + // Comment Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMMENT_TYPE_LABEL').' -', + 'batch[comment_type]', + JHtml::_('select.options', $this->comment_typeOptions, 'value', 'text') + ); } } @@ -354,7 +305,7 @@ class ComponentbuilderViewCustom_codes extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'g.system_name' => JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL'), 'a.path' => JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_PATH_LABEL'), @@ -363,113 +314,5 @@ class ComponentbuilderViewCustom_codes extends JViewLegacy 'a.comment_type' => JText::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMMENT_TYPE_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheTargetSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('target')); - $query->from($db->quoteName('#__componentbuilder_custom_code')); - $query->order($db->quoteName('target') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $target) - { - // Translate the target selection - $text = $model->selectionTranslation($target,'target'); - // Now add the target and its text to the options array - $_filter[] = JHtml::_('select.option', $target, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheTypeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('type')); - $query->from($db->quoteName('#__componentbuilder_custom_code')); - $query->order($db->quoteName('type') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $type) - { - // Translate the type selection - $text = $model->selectionTranslation($type,'type'); - // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheComment_typeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('comment_type')); - $query->from($db->quoteName('#__componentbuilder_custom_code')); - $query->order($db->quoteName('comment_type') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $comment_type) - { - // Translate the comment_type selection - $text = $model->selectionTranslation($comment_type,'comment_type'); - // Now add the comment_type and its text to the options array - $_filter[] = JHtml::_('select.option', $comment_type, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/dynamic_get/tmpl/edit.php b/admin/views/dynamic_get/tmpl/edit.php index 24243052a..8fcb98986 100644 --- a/admin/views/dynamic_get/tmpl/edit.php +++ b/admin/views/dynamic_get/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/dynamic_gets/tmpl/default.php b/admin/views/dynamic_gets/tmpl/default.php index 78a79ace1..db6a6f997 100644 --- a/admin/views/dynamic_gets/tmpl/default.php +++ b/admin/views/dynamic_gets/tmpl/default.php @@ -12,76 +12,57 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=dynamic_gets.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'dynamic_getList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_DYNAMIC_GETS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/dynamic_gets/tmpl/default_body.php b/admin/views/dynamic_gets/tmpl/default_body.php index 77e81b9bd..ed271eb16 100644 --- a/admin/views/dynamic_gets/tmpl/default_body.php +++ b/admin/views/dynamic_gets/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_ge get('dynamic_get.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/dynamic_gets/tmpl/default_head.php b/admin/views/dynamic_gets/tmpl/default_head.php index 933f12540..d1ab47390 100644 --- a/admin/views/dynamic_gets/tmpl/default_head.php +++ b/admin/views/dynamic_gets/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/dynamic_gets/view.html.php b/admin/views/dynamic_gets/view.html.php index 14e316411..6d6af0e0f 100644 --- a/admin/views/dynamic_gets/view.html.php +++ b/admin/views/dynamic_gets/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewDynamic_gets extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,99 +161,66 @@ class ComponentbuilderViewDynamic_gets extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Main Source Selection - $this->main_sourceOptions = $this->getTheMain_sourceSelections(); - // We do some sanitation for Main Source filter - if (ComponentbuilderHelper::checkArray($this->main_sourceOptions) && - isset($this->main_sourceOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->main_sourceOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->main_sourceOptions[0]); - } - // Only load Main Source filter if it has values - if (ComponentbuilderHelper::checkArray($this->main_sourceOptions)) - { - // Main Source Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_MAIN_SOURCE_LABEL').' -', - 'filter_main_source', - JHtml::_('select.options', $this->main_sourceOptions, 'value', 'text', $this->state->get('filter.main_source')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Main Source Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_MAIN_SOURCE_LABEL').' -', - 'batch[main_source]', - JHtml::_('select.options', $this->main_sourceOptions, 'value', 'text') - ); - } } - // Set Gettype Selection - $this->gettypeOptions = $this->getTheGettypeSelections(); - // We do some sanitation for Gettype filter - if (ComponentbuilderHelper::checkArray($this->gettypeOptions) && - isset($this->gettypeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->gettypeOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->gettypeOptions[0]); - } - // Only load Gettype filter if it has values - if (ComponentbuilderHelper::checkArray($this->gettypeOptions)) - { - // Gettype Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_GETTYPE_LABEL').' -', - 'filter_gettype', - JHtml::_('select.options', $this->gettypeOptions, 'value', 'text', $this->state->get('filter.gettype')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Main Source batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Main Source Selection + $this->main_sourceOptions = JFormHelper::loadFieldType('dynamicgetsfiltermainsource')->options; + // We do some sanitation for Main Source filter + if (ComponentbuilderHelper::checkArray($this->main_sourceOptions) && + isset($this->main_sourceOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->main_sourceOptions[0]->value)) { - // Gettype Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_GETTYPE_LABEL').' -', - 'batch[gettype]', - JHtml::_('select.options', $this->gettypeOptions, 'value', 'text') - ); + unset($this->main_sourceOptions[0]); } + // Main Source Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_MAIN_SOURCE_LABEL').' -', + 'batch[main_source]', + JHtml::_('select.options', $this->main_sourceOptions, 'value', 'text') + ); + } + + // Only load Gettype batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Gettype Selection + $this->gettypeOptions = JFormHelper::loadFieldType('dynamicgetsfiltergettype')->options; + // We do some sanitation for Gettype filter + if (ComponentbuilderHelper::checkArray($this->gettypeOptions) && + isset($this->gettypeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->gettypeOptions[0]->value)) + { + unset($this->gettypeOptions[0]); + } + // Gettype Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_GETTYPE_LABEL').' -', + 'batch[gettype]', + JHtml::_('select.options', $this->gettypeOptions, 'value', 'text') + ); } } @@ -294,84 +265,12 @@ class ComponentbuilderViewDynamic_gets extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_LABEL'), 'a.main_source' => JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_MAIN_SOURCE_LABEL'), 'a.gettype' => JText::_('COM_COMPONENTBUILDER_DYNAMIC_GET_GETTYPE_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheMain_sourceSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('main_source')); - $query->from($db->quoteName('#__componentbuilder_dynamic_get')); - $query->order($db->quoteName('main_source') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $main_source) - { - // Translate the main_source selection - $text = $model->selectionTranslation($main_source,'main_source'); - // Now add the main_source and its text to the options array - $_filter[] = JHtml::_('select.option', $main_source, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheGettypeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('gettype')); - $query->from($db->quoteName('#__componentbuilder_dynamic_get')); - $query->order($db->quoteName('gettype') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $gettype) - { - // Translate the gettype selection - $text = $model->selectionTranslation($gettype,'gettype'); - // Now add the gettype and its text to the options array - $_filter[] = JHtml::_('select.option', $gettype, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/field/tmpl/edit.php b/admin/views/field/tmpl/edit.php index ad01f1828..3fb9941fb 100644 --- a/admin/views/field/tmpl/edit.php +++ b/admin/views/field/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/fields/tmpl/default.php b/admin/views/fields/tmpl/default.php index 008cd39f0..4f406fd4d 100644 --- a/admin/views/fields/tmpl/default.php +++ b/admin/views/fields/tmpl/default.php @@ -12,76 +12,58 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleCategories', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_FIELDS_CATEGORIES') . ' -')); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=fields.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'fieldList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_FIELDS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_FIELDS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/fields/tmpl/default_body.php b/admin/views/fields/tmpl/default_body.php index 382ce7d16..721e46fb8 100644 --- a/admin/views/fields/tmpl/default_body.php +++ b/admin/views/fields/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; get('field.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/fields/tmpl/default_head.php b/admin/views/fields/tmpl/default_head.php index 0b0544523..16f3dd75b 100644 --- a/admin/views/fields/tmpl/default_head.php +++ b/admin/views/fields/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,29 +30,29 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -60,6 +60,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/fields/view.html.php b/admin/views/fields/view.html.php index bfa580282..409239037 100644 --- a/admin/views/fields/view.html.php +++ b/admin/views/fields/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewFields extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,47 +161,27 @@ class ComponentbuilderViewFields extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Category Filter. - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_CATEGORY'), - 'filter_category_id', - JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.field'), 'value', 'text', $this->state->get('filter.category_id')) - ); + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } if ($this->canBatch && $this->canCreate && $this->canEdit) { @@ -209,154 +193,104 @@ class ComponentbuilderViewFields extends JViewLegacy ); } - // Set Fieldtype Name Selection - $this->fieldtypeNameOptions = JFormHelper::loadFieldType('Fieldtypes')->options; - // We do some sanitation for Fieldtype Name filter - if (ComponentbuilderHelper::checkArray($this->fieldtypeNameOptions) && - isset($this->fieldtypeNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->fieldtypeNameOptions[0]->value)) + // Only load Fieldtype Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->fieldtypeNameOptions[0]); - } - // Only load Fieldtype Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->fieldtypeNameOptions)) - { - // Fieldtype Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL').' -', - 'filter_fieldtype', - JHtml::_('select.options', $this->fieldtypeNameOptions, 'value', 'text', $this->state->get('filter.fieldtype')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Set Fieldtype Name Selection + $this->fieldtypeNameOptions = JFormHelper::loadFieldType('Fieldtypes')->options; + // We do some sanitation for Fieldtype Name filter + if (ComponentbuilderHelper::checkArray($this->fieldtypeNameOptions) && + isset($this->fieldtypeNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->fieldtypeNameOptions[0]->value)) { - // Fieldtype Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL').' -', - 'batch[fieldtype]', - JHtml::_('select.options', $this->fieldtypeNameOptions, 'value', 'text') - ); + unset($this->fieldtypeNameOptions[0]); } - } - - // Set Datatype Selection - $this->datatypeOptions = $this->getTheDatatypeSelections(); - // We do some sanitation for Datatype filter - if (ComponentbuilderHelper::checkArray($this->datatypeOptions) && - isset($this->datatypeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->datatypeOptions[0]->value)) - { - unset($this->datatypeOptions[0]); - } - // Only load Datatype filter if it has values - if (ComponentbuilderHelper::checkArray($this->datatypeOptions)) - { - // Datatype Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_FIELD_DATATYPE_LABEL').' -', - 'filter_datatype', - JHtml::_('select.options', $this->datatypeOptions, 'value', 'text', $this->state->get('filter.datatype')) + // Fieldtype Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL').' -', + 'batch[fieldtype]', + JHtml::_('select.options', $this->fieldtypeNameOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Datatype batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Datatype Selection + $this->datatypeOptions = JFormHelper::loadFieldType('fieldsfilterdatatype')->options; + // We do some sanitation for Datatype filter + if (ComponentbuilderHelper::checkArray($this->datatypeOptions) && + isset($this->datatypeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->datatypeOptions[0]->value)) { - // Datatype Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_DATATYPE_LABEL').' -', - 'batch[datatype]', - JHtml::_('select.options', $this->datatypeOptions, 'value', 'text') - ); + unset($this->datatypeOptions[0]); } - } - - // Set Indexes Selection - $this->indexesOptions = $this->getTheIndexesSelections(); - // We do some sanitation for Indexes filter - if (ComponentbuilderHelper::checkArray($this->indexesOptions) && - isset($this->indexesOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->indexesOptions[0]->value)) - { - unset($this->indexesOptions[0]); - } - // Only load Indexes filter if it has values - if (ComponentbuilderHelper::checkArray($this->indexesOptions)) - { - // Indexes Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL').' -', - 'filter_indexes', - JHtml::_('select.options', $this->indexesOptions, 'value', 'text', $this->state->get('filter.indexes')) + // Datatype Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_DATATYPE_LABEL').' -', + 'batch[datatype]', + JHtml::_('select.options', $this->datatypeOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Indexes batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Indexes Selection + $this->indexesOptions = JFormHelper::loadFieldType('fieldsfilterindexes')->options; + // We do some sanitation for Indexes filter + if (ComponentbuilderHelper::checkArray($this->indexesOptions) && + isset($this->indexesOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->indexesOptions[0]->value)) { - // Indexes Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL').' -', - 'batch[indexes]', - JHtml::_('select.options', $this->indexesOptions, 'value', 'text') - ); + unset($this->indexesOptions[0]); } - } - - // Set Null Switch Selection - $this->null_switchOptions = $this->getTheNull_switchSelections(); - // We do some sanitation for Null Switch filter - if (ComponentbuilderHelper::checkArray($this->null_switchOptions) && - isset($this->null_switchOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->null_switchOptions[0]->value)) - { - unset($this->null_switchOptions[0]); - } - // Only load Null Switch filter if it has values - if (ComponentbuilderHelper::checkArray($this->null_switchOptions)) - { - // Null Switch Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL').' -', - 'filter_null_switch', - JHtml::_('select.options', $this->null_switchOptions, 'value', 'text', $this->state->get('filter.null_switch')) + // Indexes Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL').' -', + 'batch[indexes]', + JHtml::_('select.options', $this->indexesOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Null Switch batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Null Switch Selection + $this->null_switchOptions = JFormHelper::loadFieldType('fieldsfilternullswitch')->options; + // We do some sanitation for Null Switch filter + if (ComponentbuilderHelper::checkArray($this->null_switchOptions) && + isset($this->null_switchOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->null_switchOptions[0]->value)) { - // Null Switch Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL').' -', - 'batch[null_switch]', - JHtml::_('select.options', $this->null_switchOptions, 'value', 'text') - ); + unset($this->null_switchOptions[0]); } - } - - // Set Store Selection - $this->storeOptions = $this->getTheStoreSelections(); - // We do some sanitation for Store filter - if (ComponentbuilderHelper::checkArray($this->storeOptions) && - isset($this->storeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->storeOptions[0]->value)) - { - unset($this->storeOptions[0]); - } - // Only load Store filter if it has values - if (ComponentbuilderHelper::checkArray($this->storeOptions)) - { - // Store Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL').' -', - 'filter_store', - JHtml::_('select.options', $this->storeOptions, 'value', 'text', $this->state->get('filter.store')) + // Null Switch Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL').' -', + 'batch[null_switch]', + JHtml::_('select.options', $this->null_switchOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Store batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Store Selection + $this->storeOptions = JFormHelper::loadFieldType('fieldsfilterstore')->options; + // We do some sanitation for Store filter + if (ComponentbuilderHelper::checkArray($this->storeOptions) && + isset($this->storeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->storeOptions[0]->value)) { - // Store Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL').' -', - 'batch[store]', - JHtml::_('select.options', $this->storeOptions, 'value', 'text') - ); + unset($this->storeOptions[0]); } + // Store Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL').' -', + 'batch[store]', + JHtml::_('select.options', $this->storeOptions, 'value', 'text') + ); } } @@ -401,7 +335,7 @@ class ComponentbuilderViewFields extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_FIELD_NAME_LABEL'), 'g.name' => JText::_('COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL'), @@ -412,149 +346,5 @@ class ComponentbuilderViewFields extends JViewLegacy 'category_title' => JText::_('COM_COMPONENTBUILDER_FIELD_FIELDS_CATEGORIES'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheDatatypeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('datatype')); - $query->from($db->quoteName('#__componentbuilder_field')); - $query->order($db->quoteName('datatype') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $datatype) - { - // Translate the datatype selection - $text = $model->selectionTranslation($datatype,'datatype'); - // Now add the datatype and its text to the options array - $_filter[] = JHtml::_('select.option', $datatype, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheIndexesSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('indexes')); - $query->from($db->quoteName('#__componentbuilder_field')); - $query->order($db->quoteName('indexes') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $indexes) - { - // Translate the indexes selection - $text = $model->selectionTranslation($indexes,'indexes'); - // Now add the indexes and its text to the options array - $_filter[] = JHtml::_('select.option', $indexes, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheNull_switchSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('null_switch')); - $query->from($db->quoteName('#__componentbuilder_field')); - $query->order($db->quoteName('null_switch') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $null_switch) - { - // Translate the null_switch selection - $text = $model->selectionTranslation($null_switch,'null_switch'); - // Now add the null_switch and its text to the options array - $_filter[] = JHtml::_('select.option', $null_switch, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheStoreSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('store')); - $query->from($db->quoteName('#__componentbuilder_field')); - $query->order($db->quoteName('store') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $store) - { - // Translate the store selection - $text = $model->selectionTranslation($store,'store'); - // Now add the store and its text to the options array - $_filter[] = JHtml::_('select.option', $store, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/fieldtype/tmpl/edit.php b/admin/views/fieldtype/tmpl/edit.php index 39f606a97..93e0ef50a 100644 --- a/admin/views/fieldtype/tmpl/edit.php +++ b/admin/views/fieldtype/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/fieldtypes/tmpl/default.php b/admin/views/fieldtypes/tmpl/default.php index 876c961ce..3fd54c55e 100644 --- a/admin/views/fieldtypes/tmpl/default.php +++ b/admin/views/fieldtypes/tmpl/default.php @@ -12,74 +12,56 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleCategories', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_FIELDTYPES_CATEGORIES') . ' -')); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=fieldtypes.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'fieldtypeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_FIELDTYPES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_FIELDTYPES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/fieldtypes/tmpl/default_body.php b/admin/views/fieldtypes/tmpl/default_body.php index 887e1812f..3a2ca94cd 100644 --- a/admin/views/fieldtypes/tmpl/default_body.php +++ b/admin/views/fieldtypes/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=fieldtypes&task=fieldtype.ed get('fieldtype.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/fieldtypes/tmpl/default_head.php b/admin/views/fieldtypes/tmpl/default_head.php index 296445ed8..3924a1b10 100644 --- a/admin/views/fieldtypes/tmpl/default_head.php +++ b/admin/views/fieldtypes/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/fieldtypes/view.html.php b/admin/views/fieldtypes/view.html.php index fac139380..0e82d3893 100644 --- a/admin/views/fieldtypes/view.html.php +++ b/admin/views/fieldtypes/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -152,47 +156,27 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Category Filter. - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_CATEGORY'), - 'filter_category_id', - JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.fieldtype'), 'value', 'text', $this->state->get('filter.category_id')) - ); + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } if ($this->canBatch && $this->canCreate && $this->canEdit) { @@ -246,7 +230,7 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_FIELDTYPE_NAME_LABEL'), 'a.short_description' => JText::_('COM_COMPONENTBUILDER_FIELDTYPE_SHORT_DESCRIPTION_LABEL'), diff --git a/admin/views/get_snippets/tmpl/default.php b/admin/views/get_snippets/tmpl/default.php index e3e6dc816..73f6409c5 100644 --- a/admin/views/get_snippets/tmpl/default.php +++ b/admin/views/get_snippets/tmpl/default.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); ?> canDo->get('get_snippets.access')): ?> diff --git a/admin/views/help_document/tmpl/edit.php b/admin/views/help_document/tmpl/edit.php index 112643754..abb668680 100644 --- a/admin/views/help_document/tmpl/edit.php +++ b/admin/views/help_document/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/help_documents/tmpl/default.php b/admin/views/help_documents/tmpl/default.php index 9c79c938f..3643e866f 100644 --- a/admin/views/help_documents/tmpl/default.php +++ b/admin/views/help_documents/tmpl/default.php @@ -12,74 +12,54 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=help_documents.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'help_documentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/help_documents/tmpl/default_body.php b/admin/views/help_documents/tmpl/default_body.php index ff8cf72c0..5fc22a00f 100644 --- a/admin/views/help_documents/tmpl/default_body.php +++ b/admin/views/help_documents/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=help_documents&task=help_doc get('help_document.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/help_documents/tmpl/default_head.php b/admin/views/help_documents/tmpl/default_head.php index b8663587b..d037a443a 100644 --- a/admin/views/help_documents/tmpl/default_head.php +++ b/admin/views/help_documents/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,26 +30,26 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -57,6 +57,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/help_documents/view.html.php b/admin/views/help_documents/view.html.php index 6ddfa8ba3..d0f42796d 100644 --- a/admin/views/help_documents/view.html.php +++ b/admin/views/help_documents/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewHelp_documents extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -152,159 +156,96 @@ class ComponentbuilderViewHelp_documents extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Type Selection - $this->typeOptions = $this->getTheTypeSelections(); - // We do some sanitation for Type filter - if (ComponentbuilderHelper::checkArray($this->typeOptions) && - isset($this->typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->typeOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->typeOptions[0]); - } - // Only load Type filter if it has values - if (ComponentbuilderHelper::checkArray($this->typeOptions)) - { - // Type Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL').' -', - 'filter_type', - JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Type Selection + $this->typeOptions = JFormHelper::loadFieldType('helpdocumentsfiltertype')->options; + // We do some sanitation for Type filter + if (ComponentbuilderHelper::checkArray($this->typeOptions) && + isset($this->typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->typeOptions[0]->value)) { - // Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL').' -', - 'batch[type]', - JHtml::_('select.options', $this->typeOptions, 'value', 'text') - ); + unset($this->typeOptions[0]); } - } - - // Set Location Selection - $this->locationOptions = $this->getTheLocationSelections(); - // We do some sanitation for Location filter - if (ComponentbuilderHelper::checkArray($this->locationOptions) && - isset($this->locationOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->locationOptions[0]->value)) - { - unset($this->locationOptions[0]); - } - // Only load Location filter if it has values - if (ComponentbuilderHelper::checkArray($this->locationOptions)) - { - // Location Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_LOCATION_LABEL').' -', - 'filter_location', - JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location')) + // Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Location batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Location Selection + $this->locationOptions = JFormHelper::loadFieldType('helpdocumentsfilterlocation')->options; + // We do some sanitation for Location filter + if (ComponentbuilderHelper::checkArray($this->locationOptions) && + isset($this->locationOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->locationOptions[0]->value)) { - // Location Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_LOCATION_LABEL').' -', - 'batch[location]', - JHtml::_('select.options', $this->locationOptions, 'value', 'text') - ); + unset($this->locationOptions[0]); } - } - - // Set Admin View Selection - $this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->options; - // We do some sanitation for Admin View filter - if (ComponentbuilderHelper::checkArray($this->admin_viewOptions) && - isset($this->admin_viewOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->admin_viewOptions[0]->value)) - { - unset($this->admin_viewOptions[0]); - } - // Only load Admin View filter if it has values - if (ComponentbuilderHelper::checkArray($this->admin_viewOptions)) - { - // Admin View Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', - 'filter_admin_view', - JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view')) + // Location Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_LOCATION_LABEL').' -', + 'batch[location]', + JHtml::_('select.options', $this->locationOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Admin View batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Admin View Selection + $this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->options; + // We do some sanitation for Admin View filter + if (ComponentbuilderHelper::checkArray($this->admin_viewOptions) && + isset($this->admin_viewOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->admin_viewOptions[0]->value)) { - // Admin View Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', - 'batch[admin_view]', - JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text') - ); + unset($this->admin_viewOptions[0]); } - } - - // Set Site View Selection - $this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->options; - // We do some sanitation for Site View filter - if (ComponentbuilderHelper::checkArray($this->site_viewOptions) && - isset($this->site_viewOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->site_viewOptions[0]->value)) - { - unset($this->site_viewOptions[0]); - } - // Only load Site View filter if it has values - if (ComponentbuilderHelper::checkArray($this->site_viewOptions)) - { - // Site View Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', - 'filter_site_view', - JHtml::_('select.options', $this->site_viewOptions, 'value', 'text', $this->state->get('filter.site_view')) + // Admin View Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', + 'batch[admin_view]', + JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Site View batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Site View Selection + $this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->options; + // We do some sanitation for Site View filter + if (ComponentbuilderHelper::checkArray($this->site_viewOptions) && + isset($this->site_viewOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->site_viewOptions[0]->value)) { - // Site View Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', - 'batch[site_view]', - JHtml::_('select.options', $this->site_viewOptions, 'value', 'text') - ); + unset($this->site_viewOptions[0]); } + // Site View Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', + 'batch[site_view]', + JHtml::_('select.options', $this->site_viewOptions, 'value', 'text') + ); } } @@ -349,7 +290,7 @@ class ComponentbuilderViewHelp_documents extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.title' => JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TITLE_LABEL'), 'a.type' => JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL'), @@ -358,77 +299,5 @@ class ComponentbuilderViewHelp_documents extends JViewLegacy 'h.' => JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SITE_VIEW_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheTypeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('type')); - $query->from($db->quoteName('#__componentbuilder_help_document')); - $query->order($db->quoteName('type') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $type) - { - // Translate the type selection - $text = $model->selectionTranslation($type,'type'); - // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheLocationSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('location')); - $query->from($db->quoteName('#__componentbuilder_help_document')); - $query->order($db->quoteName('location') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $location) - { - // Translate the location selection - $text = $model->selectionTranslation($location,'location'); - // Now add the location and its text to the options array - $_filter[] = JHtml::_('select.option', $location, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/joomla_component/tmpl/edit.php b/admin/views/joomla_component/tmpl/edit.php index a4c3cf7e0..6d90b5c97 100644 --- a/admin/views/joomla_component/tmpl/edit.php +++ b/admin/views/joomla_component/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/joomla_components/tmpl/default.php b/admin/views/joomla_components/tmpl/default.php index ecc519339..290f70bc5 100644 --- a/admin/views/joomla_components/tmpl/default.php +++ b/admin/views/joomla_components/tmpl/default.php @@ -12,76 +12,57 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_components.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'joomla_componentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/joomla_components/tmpl/default_body.php b/admin/views/joomla_components/tmpl/default_body.php index e683e8291..6df319ced 100644 --- a/admin/views/joomla_components/tmpl/default_body.php +++ b/admin/views/joomla_components/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml get('joomla_component.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/joomla_components/tmpl/default_head.php b/admin/views/joomla_components/tmpl/default_head.php index aa3ac05a3..6b0db19fa 100644 --- a/admin/views/joomla_components/tmpl/default_head.php +++ b/admin/views/joomla_components/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,20 +30,20 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -51,6 +51,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/joomla_components/view.html.php b/admin/views/joomla_components/view.html.php index e95bc3295..bb15d6fc2 100644 --- a/admin/views/joomla_components/view.html.php +++ b/admin/views/joomla_components/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -182,99 +186,66 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Companyname Selection - $this->companynameOptions = $this->getTheCompanynameSelections(); - // We do some sanitation for Companyname filter - if (ComponentbuilderHelper::checkArray($this->companynameOptions) && - isset($this->companynameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->companynameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->companynameOptions[0]); - } - // Only load Companyname filter if it has values - if (ComponentbuilderHelper::checkArray($this->companynameOptions)) - { - // Companyname Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL').' -', - 'filter_companyname', - JHtml::_('select.options', $this->companynameOptions, 'value', 'text', $this->state->get('filter.companyname')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Companyname Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL').' -', - 'batch[companyname]', - JHtml::_('select.options', $this->companynameOptions, 'value', 'text') - ); - } } - // Set Author Selection - $this->authorOptions = $this->getTheAuthorSelections(); - // We do some sanitation for Author filter - if (ComponentbuilderHelper::checkArray($this->authorOptions) && - isset($this->authorOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->authorOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->authorOptions[0]); - } - // Only load Author filter if it has values - if (ComponentbuilderHelper::checkArray($this->authorOptions)) - { - // Author Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL').' -', - 'filter_author', - JHtml::_('select.options', $this->authorOptions, 'value', 'text', $this->state->get('filter.author')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Companyname batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Companyname Selection + $this->companynameOptions = JFormHelper::loadFieldType('joomlacomponentsfiltercompanyname')->options; + // We do some sanitation for Companyname filter + if (ComponentbuilderHelper::checkArray($this->companynameOptions) && + isset($this->companynameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->companynameOptions[0]->value)) { - // Author Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL').' -', - 'batch[author]', - JHtml::_('select.options', $this->authorOptions, 'value', 'text') - ); + unset($this->companynameOptions[0]); } + // Companyname Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL').' -', + 'batch[companyname]', + JHtml::_('select.options', $this->companynameOptions, 'value', 'text') + ); + } + + // Only load Author batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Author Selection + $this->authorOptions = JFormHelper::loadFieldType('joomlacomponentsfilterauthor')->options; + // We do some sanitation for Author filter + if (ComponentbuilderHelper::checkArray($this->authorOptions) && + isset($this->authorOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->authorOptions[0]->value)) + { + unset($this->authorOptions[0]); + } + // Author Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL').' -', + 'batch[author]', + JHtml::_('select.options', $this->authorOptions, 'value', 'text') + ); } } @@ -319,7 +290,7 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.system_name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SYSTEM_NAME_LABEL'), 'a.name_code' => JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_LABEL'), @@ -327,69 +298,5 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy 'a.companyname' => JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheCompanynameSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('companyname')); - $query->from($db->quoteName('#__componentbuilder_joomla_component')); - $query->order($db->quoteName('companyname') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - $results = array_unique($results); - $_filter = array(); - foreach ($results as $companyname) - { - // Now add the companyname and its text to the options array - $_filter[] = JHtml::_('select.option', $companyname, $companyname); - } - return $_filter; - } - return false; - } - - protected function getTheAuthorSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('author')); - $query->from($db->quoteName('#__componentbuilder_joomla_component')); - $query->order($db->quoteName('author') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - $results = array_unique($results); - $_filter = array(); - foreach ($results as $author) - { - // Now add the author and its text to the options array - $_filter[] = JHtml::_('select.option', $author, $author); - } - return $_filter; - } - return false; } } diff --git a/admin/views/joomla_module/tmpl/edit.php b/admin/views/joomla_module/tmpl/edit.php index 947b7d1f2..c7ef51da5 100644 --- a/admin/views/joomla_module/tmpl/edit.php +++ b/admin/views/joomla_module/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/joomla_module_files_folders_urls/tmpl/edit.php b/admin/views/joomla_module_files_folders_urls/tmpl/edit.php index 44f8f487f..85aed5226 100644 --- a/admin/views/joomla_module_files_folders_urls/tmpl/edit.php +++ b/admin/views/joomla_module_files_folders_urls/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/joomla_module_updates/tmpl/edit.php b/admin/views/joomla_module_updates/tmpl/edit.php index 63a069319..9eded0f5a 100644 --- a/admin/views/joomla_module_updates/tmpl/edit.php +++ b/admin/views/joomla_module_updates/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/joomla_modules/tmpl/default.php b/admin/views/joomla_modules/tmpl/default.php index 4100065a7..00c9a824c 100644 --- a/admin/views/joomla_modules/tmpl/default.php +++ b/admin/views/joomla_modules/tmpl/default.php @@ -12,76 +12,57 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_modules.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'joomla_moduleList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/joomla_modules/tmpl/default_body.php b/admin/views/joomla_modules/tmpl/default_body.php index 168f2ecfe..7fa1a073b 100644 --- a/admin/views/joomla_modules/tmpl/default_body.php +++ b/admin/views/joomla_modules/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_modules&task=joomla_m get('joomla_module.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/joomla_modules/tmpl/default_head.php b/admin/views/joomla_modules/tmpl/default_head.php index 2b16008a9..e4daeebfa 100644 --- a/admin/views/joomla_modules/tmpl/default_head.php +++ b/admin/views/joomla_modules/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/joomla_modules/view.html.php b/admin/views/joomla_modules/view.html.php index 3197a6050..9f1230d49 100644 --- a/admin/views/joomla_modules/view.html.php +++ b/admin/views/joomla_modules/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewJoomla_modules extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -152,69 +156,46 @@ class ComponentbuilderViewJoomla_modules extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Target Selection - $this->targetOptions = $this->getTheTargetSelections(); - // We do some sanitation for Target filter - if (ComponentbuilderHelper::checkArray($this->targetOptions) && - isset($this->targetOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->targetOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->targetOptions[0]); - } - // Only load Target filter if it has values - if (ComponentbuilderHelper::checkArray($this->targetOptions)) - { - // Target Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_LABEL').' -', - 'filter_target', - JHtml::_('select.options', $this->targetOptions, 'value', 'text', $this->state->get('filter.target')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Target batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Target Selection + $this->targetOptions = JFormHelper::loadFieldType('joomlamodulesfiltertarget')->options; + // We do some sanitation for Target filter + if (ComponentbuilderHelper::checkArray($this->targetOptions) && + isset($this->targetOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->targetOptions[0]->value)) { - // Target Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_LABEL').' -', - 'batch[target]', - JHtml::_('select.options', $this->targetOptions, 'value', 'text') - ); + unset($this->targetOptions[0]); } + // Target Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_LABEL').' -', + 'batch[target]', + JHtml::_('select.options', $this->targetOptions, 'value', 'text') + ); } } @@ -259,47 +240,11 @@ class ComponentbuilderViewJoomla_modules extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.system_name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_SYSTEM_NAME_LABEL'), 'a.description' => JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheTargetSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('target')); - $query->from($db->quoteName('#__componentbuilder_joomla_module')); - $query->order($db->quoteName('target') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $target) - { - // Translate the target selection - $text = $model->selectionTranslation($target,'target'); - // Now add the target and its text to the options array - $_filter[] = JHtml::_('select.option', $target, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/joomla_modules_files_folders_urls/tmpl/default.php b/admin/views/joomla_modules_files_folders_urls/tmpl/default.php index 76bf426a9..a72c6ff61 100644 --- a/admin/views/joomla_modules_files_folders_urls/tmpl/default.php +++ b/admin/views/joomla_modules_files_folders_urls/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_modules_files_folders_urls.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'joomla_module_files_folders_urlsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULES_FILES_FOLDERS_URLS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/joomla_modules_files_folders_urls/tmpl/default_body.php b/admin/views/joomla_modules_files_folders_urls/tmpl/default_body.php index 254c70908..86dce9f7e 100644 --- a/admin/views/joomla_modules_files_folders_urls/tmpl/default_body.php +++ b/admin/views/joomla_modules_files_folders_urls/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_modules_files_folders get('joomla_module_files_folders_urls.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/joomla_modules_files_folders_urls/tmpl/default_head.php b/admin/views/joomla_modules_files_folders_urls/tmpl/default_head.php index 37fcf012e..514e59d1c 100644 --- a/admin/views/joomla_modules_files_folders_urls/tmpl/default_head.php +++ b/admin/views/joomla_modules_files_folders_urls/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/joomla_modules_files_folders_urls/view.html.php b/admin/views/joomla_modules_files_folders_urls/view.html.php index 387682196..a4c88c052 100644 --- a/admin/views/joomla_modules_files_folders_urls/view.html.php +++ b/admin/views/joomla_modules_files_folders_urls/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewJoomla_modules_files_folders_urls extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewJoomla_modules_files_folders_urls extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewJoomla_modules_files_folders_urls extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/joomla_modules_updates/tmpl/default.php b/admin/views/joomla_modules_updates/tmpl/default.php index 6e2d69df4..bd1993404 100644 --- a/admin/views/joomla_modules_updates/tmpl/default.php +++ b/admin/views/joomla_modules_updates/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_modules_updates.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'joomla_module_updatesList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/joomla_modules_updates/tmpl/default_body.php b/admin/views/joomla_modules_updates/tmpl/default_body.php index 80fabcdb1..e12213e84 100644 --- a/admin/views/joomla_modules_updates/tmpl/default_body.php +++ b/admin/views/joomla_modules_updates/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_modules_updates&task= get('joomla_module_updates.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/joomla_modules_updates/tmpl/default_head.php b/admin/views/joomla_modules_updates/tmpl/default_head.php index d02614aaa..6fd993969 100644 --- a/admin/views/joomla_modules_updates/tmpl/default_head.php +++ b/admin/views/joomla_modules_updates/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/joomla_modules_updates/view.html.php b/admin/views/joomla_modules_updates/view.html.php index d5b90296e..d30a364ea 100644 --- a/admin/views/joomla_modules_updates/view.html.php +++ b/admin/views/joomla_modules_updates/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewJoomla_modules_updates extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewJoomla_modules_updates extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewJoomla_modules_updates extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/joomla_plugin/tmpl/edit.php b/admin/views/joomla_plugin/tmpl/edit.php index f173a8107..870412fd2 100644 --- a/admin/views/joomla_plugin/tmpl/edit.php +++ b/admin/views/joomla_plugin/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/joomla_plugin_files_folders_urls/tmpl/edit.php b/admin/views/joomla_plugin_files_folders_urls/tmpl/edit.php index f2df0079b..5bf462e70 100644 --- a/admin/views/joomla_plugin_files_folders_urls/tmpl/edit.php +++ b/admin/views/joomla_plugin_files_folders_urls/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/joomla_plugin_group/tmpl/edit.php b/admin/views/joomla_plugin_group/tmpl/edit.php index d5d007869..3c4c0ab32 100644 --- a/admin/views/joomla_plugin_group/tmpl/edit.php +++ b/admin/views/joomla_plugin_group/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/joomla_plugin_groups/tmpl/default.php b/admin/views/joomla_plugin_groups/tmpl/default.php index cb53414e7..7a1953a62 100644 --- a/admin/views/joomla_plugin_groups/tmpl/default.php +++ b/admin/views/joomla_plugin_groups/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_plugin_groups.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'joomla_plugin_groupList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUPS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/joomla_plugin_groups/tmpl/default_body.php b/admin/views/joomla_plugin_groups/tmpl/default_body.php index 31cd9d52f..644611690 100644 --- a/admin/views/joomla_plugin_groups/tmpl/default_body.php +++ b/admin/views/joomla_plugin_groups/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugin_groups&task=jo get('core.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/joomla_plugin_groups/tmpl/default_head.php b/admin/views/joomla_plugin_groups/tmpl/default_head.php index 6a567fd60..d308ef0b0 100644 --- a/admin/views/joomla_plugin_groups/tmpl/default_head.php +++ b/admin/views/joomla_plugin_groups/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,14 +30,14 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -45,6 +45,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/joomla_plugin_groups/view.html.php b/admin/views/joomla_plugin_groups/view.html.php index 378fdc96d..2a177a261 100644 --- a/admin/views/joomla_plugin_groups/view.html.php +++ b/admin/views/joomla_plugin_groups/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewJoomla_plugin_groups extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,69 +146,46 @@ class ComponentbuilderViewJoomla_plugin_groups extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Class Extends Name Selection - $this->class_extendsNameOptions = JFormHelper::loadFieldType('Classextends')->options; - // We do some sanitation for Class Extends Name filter - if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions) && - isset($this->class_extendsNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->class_extendsNameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->class_extendsNameOptions[0]); - } - // Only load Class Extends Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions)) - { - // Class Extends Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL').' -', - 'filter_class_extends', - JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text', $this->state->get('filter.class_extends')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); + } + + // Only load Class Extends Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Class Extends Name Selection + $this->class_extendsNameOptions = JFormHelper::loadFieldType('Classextends')->options; + // We do some sanitation for Class Extends Name filter + if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions) && + isset($this->class_extendsNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->class_extendsNameOptions[0]->value)) { - // Class Extends Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL').' -', - 'batch[class_extends]', - JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text') - ); + unset($this->class_extendsNameOptions[0]); } + // Class Extends Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL').' -', + 'batch[class_extends]', + JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text') + ); } } @@ -249,7 +230,7 @@ class ComponentbuilderViewJoomla_plugin_groups extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_NAME_LABEL'), 'g.name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_LABEL'), diff --git a/admin/views/joomla_plugin_updates/tmpl/edit.php b/admin/views/joomla_plugin_updates/tmpl/edit.php index 32b180cf0..c169b7826 100644 --- a/admin/views/joomla_plugin_updates/tmpl/edit.php +++ b/admin/views/joomla_plugin_updates/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/joomla_plugins/tmpl/default.php b/admin/views/joomla_plugins/tmpl/default.php index 67e1e8eac..fa8b1f174 100644 --- a/admin/views/joomla_plugins/tmpl/default.php +++ b/admin/views/joomla_plugins/tmpl/default.php @@ -12,76 +12,57 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_plugins.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'joomla_pluginList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/joomla_plugins/tmpl/default_body.php b/admin/views/joomla_plugins/tmpl/default_body.php index 818aff6aa..7c6882815 100644 --- a/admin/views/joomla_plugins/tmpl/default_body.php +++ b/admin/views/joomla_plugins/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_p get('joomla_plugin.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/joomla_plugins/tmpl/default_head.php b/admin/views/joomla_plugins/tmpl/default_head.php index a7c71047f..963e8030f 100644 --- a/admin/views/joomla_plugins/tmpl/default_head.php +++ b/admin/views/joomla_plugins/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/joomla_plugins/view.html.php b/admin/views/joomla_plugins/view.html.php index f75abb729..ecec23805 100644 --- a/admin/views/joomla_plugins/view.html.php +++ b/admin/views/joomla_plugins/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewJoomla_plugins extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -162,99 +166,66 @@ class ComponentbuilderViewJoomla_plugins extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Class Extends Name Selection - $this->class_extendsNameOptions = JFormHelper::loadFieldType('Classextends')->options; - // We do some sanitation for Class Extends Name filter - if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions) && - isset($this->class_extendsNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->class_extendsNameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->class_extendsNameOptions[0]); - } - // Only load Class Extends Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions)) - { - // Class Extends Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL').' -', - 'filter_class_extends', - JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text', $this->state->get('filter.class_extends')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Class Extends Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL').' -', - 'batch[class_extends]', - JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text') - ); - } } - // Set Joomla Plugin Group Name Selection - $this->joomla_plugin_groupNameOptions = JFormHelper::loadFieldType('Joomlaplugingroups')->options; - // We do some sanitation for Joomla Plugin Group Name filter - if (ComponentbuilderHelper::checkArray($this->joomla_plugin_groupNameOptions) && - isset($this->joomla_plugin_groupNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->joomla_plugin_groupNameOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->joomla_plugin_groupNameOptions[0]); - } - // Only load Joomla Plugin Group Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->joomla_plugin_groupNameOptions)) - { - // Joomla Plugin Group Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL').' -', - 'filter_joomla_plugin_group', - JHtml::_('select.options', $this->joomla_plugin_groupNameOptions, 'value', 'text', $this->state->get('filter.joomla_plugin_group')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Class Extends Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Class Extends Name Selection + $this->class_extendsNameOptions = JFormHelper::loadFieldType('Classextends')->options; + // We do some sanitation for Class Extends Name filter + if (ComponentbuilderHelper::checkArray($this->class_extendsNameOptions) && + isset($this->class_extendsNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->class_extendsNameOptions[0]->value)) { - // Joomla Plugin Group Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL').' -', - 'batch[joomla_plugin_group]', - JHtml::_('select.options', $this->joomla_plugin_groupNameOptions, 'value', 'text') - ); + unset($this->class_extendsNameOptions[0]); } + // Class Extends Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL').' -', + 'batch[class_extends]', + JHtml::_('select.options', $this->class_extendsNameOptions, 'value', 'text') + ); + } + + // Only load Joomla Plugin Group Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Joomla Plugin Group Name Selection + $this->joomla_plugin_groupNameOptions = JFormHelper::loadFieldType('Joomlaplugingroups')->options; + // We do some sanitation for Joomla Plugin Group Name filter + if (ComponentbuilderHelper::checkArray($this->joomla_plugin_groupNameOptions) && + isset($this->joomla_plugin_groupNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->joomla_plugin_groupNameOptions[0]->value)) + { + unset($this->joomla_plugin_groupNameOptions[0]); + } + // Joomla Plugin Group Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_JOOMLA_PLUGIN_GROUP_LABEL').' -', + 'batch[joomla_plugin_group]', + JHtml::_('select.options', $this->joomla_plugin_groupNameOptions, 'value', 'text') + ); } } @@ -299,7 +270,7 @@ class ComponentbuilderViewJoomla_plugins extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.system_name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_SYSTEM_NAME_LABEL'), 'g.name' => JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGIN_CLASS_EXTENDS_LABEL'), diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default.php index de710474c..74b584e22 100644 --- a/admin/views/joomla_plugins_files_folders_urls/tmpl/default.php +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_plugins_files_folders_urls.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'joomla_plugin_files_folders_urlsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_FILES_FOLDERS_URLS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_body.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_body.php index d58117038..774f10d47 100644 --- a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_body.php +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins_files_folders get('joomla_plugin_files_folders_urls.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_head.php b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_head.php index e0e6523ae..52e49a0a1 100644 --- a/admin/views/joomla_plugins_files_folders_urls/tmpl/default_head.php +++ b/admin/views/joomla_plugins_files_folders_urls/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/joomla_plugins_files_folders_urls/view.html.php b/admin/views/joomla_plugins_files_folders_urls/view.html.php index 1bf5a9ff3..3e7f8198d 100644 --- a/admin/views/joomla_plugins_files_folders_urls/view.html.php +++ b/admin/views/joomla_plugins_files_folders_urls/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewJoomla_plugins_files_folders_urls extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewJoomla_plugins_files_folders_urls extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewJoomla_plugins_files_folders_urls extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/joomla_plugins_updates/tmpl/default.php b/admin/views/joomla_plugins_updates/tmpl/default.php index 65d63db9b..4024e73da 100644 --- a/admin/views/joomla_plugins_updates/tmpl/default.php +++ b/admin/views/joomla_plugins_updates/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_plugins_updates.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'joomla_plugin_updatesList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/joomla_plugins_updates/tmpl/default_body.php b/admin/views/joomla_plugins_updates/tmpl/default_body.php index fa437ba08..528ccba48 100644 --- a/admin/views/joomla_plugins_updates/tmpl/default_body.php +++ b/admin/views/joomla_plugins_updates/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_plugins_updates&task= get('joomla_plugin_updates.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/joomla_plugins_updates/tmpl/default_head.php b/admin/views/joomla_plugins_updates/tmpl/default_head.php index 71a9ee727..1df2d570e 100644 --- a/admin/views/joomla_plugins_updates/tmpl/default_head.php +++ b/admin/views/joomla_plugins_updates/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/joomla_plugins_updates/view.html.php b/admin/views/joomla_plugins_updates/view.html.php index 5ed43dc26..c3616a9e1 100644 --- a/admin/views/joomla_plugins_updates/view.html.php +++ b/admin/views/joomla_plugins_updates/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewJoomla_plugins_updates extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewJoomla_plugins_updates extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewJoomla_plugins_updates extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/language/tmpl/edit.php b/admin/views/language/tmpl/edit.php index bacaef603..2b4e1d48f 100644 --- a/admin/views/language/tmpl/edit.php +++ b/admin/views/language/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/language_translation/tmpl/edit.php b/admin/views/language_translation/tmpl/edit.php index 738c8cdd1..dea2fd45d 100644 --- a/admin/views/language_translation/tmpl/edit.php +++ b/admin/views/language_translation/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/language_translations/tmpl/default.php b/admin/views/language_translations/tmpl/default.php index 2270d80e2..1391013ab 100644 --- a/admin/views/language_translations/tmpl/default.php +++ b/admin/views/language_translations/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=language_translations.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'language_translationList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/language_translations/tmpl/default_body.php b/admin/views/language_translations/tmpl/default_body.php index b6e538f32..55c0dffc4 100644 --- a/admin/views/language_translations/tmpl/default_body.php +++ b/admin/views/language_translations/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=language_translations&task=l get('language_translation.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/language_translations/tmpl/default_head.php b/admin/views/language_translations/tmpl/default_head.php index 17e59d12f..144310a3b 100644 --- a/admin/views/language_translations/tmpl/default_head.php +++ b/admin/views/language_translations/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,11 +30,11 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/language_translations/view.html.php b/admin/views/language_translations/view.html.php index 95b430c3f..51c3f0934 100644 --- a/admin/views/language_translations/view.html.php +++ b/admin/views/language_translations/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewLanguage_translations extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -152,39 +156,26 @@ class ComponentbuilderViewLanguage_translations extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -229,7 +220,7 @@ class ComponentbuilderViewLanguage_translations extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.source' => JText::_('COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_SOURCE_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') diff --git a/admin/views/languages/tmpl/default.php b/admin/views/languages/tmpl/default.php index f7bc1f9a7..0af1a813e 100644 --- a/admin/views/languages/tmpl/default.php +++ b/admin/views/languages/tmpl/default.php @@ -12,76 +12,57 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=languages.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'languageList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_LANGUAGES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_LANGUAGES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/languages/tmpl/default_body.php b/admin/views/languages/tmpl/default_body.php index 0043b84a5..28def2eec 100644 --- a/admin/views/languages/tmpl/default_body.php +++ b/admin/views/languages/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=languages&task=language.edit get('language.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/languages/tmpl/default_head.php b/admin/views/languages/tmpl/default_head.php index 07a32e556..e5d46179b 100644 --- a/admin/views/languages/tmpl/default_head.php +++ b/admin/views/languages/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,14 +30,14 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -45,6 +45,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/languages/view.html.php b/admin/views/languages/view.html.php index 356f0d7da..fb17e4fd1 100644 --- a/admin/views/languages/view.html.php +++ b/admin/views/languages/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewLanguages extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,39 +161,26 @@ class ComponentbuilderViewLanguages extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -234,7 +225,7 @@ class ComponentbuilderViewLanguages extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_LANGUAGE_NAME_LABEL'), 'a.langtag' => JText::_('COM_COMPONENTBUILDER_LANGUAGE_LANGTAG_LABEL'), diff --git a/admin/views/layout/tmpl/edit.php b/admin/views/layout/tmpl/edit.php index 66561f86c..05ae906cb 100644 --- a/admin/views/layout/tmpl/edit.php +++ b/admin/views/layout/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/layouts/tmpl/default.php b/admin/views/layouts/tmpl/default.php index 71c5e14b5..fa9ebdedd 100644 --- a/admin/views/layouts/tmpl/default.php +++ b/admin/views/layouts/tmpl/default.php @@ -12,76 +12,57 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=layouts.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'layoutList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_LAYOUTS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_LAYOUTS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/layouts/tmpl/default_body.php b/admin/views/layouts/tmpl/default_body.php index df8e197ac..324eb893f 100644 --- a/admin/views/layouts/tmpl/default_body.php +++ b/admin/views/layouts/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=layouts&task=layout.edit"; get('core.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/layouts/tmpl/default_head.php b/admin/views/layouts/tmpl/default_head.php index 6feaf4169..573ed5b96 100644 --- a/admin/views/layouts/tmpl/default_head.php +++ b/admin/views/layouts/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/layouts/view.html.php b/admin/views/layouts/view.html.php index b80e465c4..791cc662d 100644 --- a/admin/views/layouts/view.html.php +++ b/admin/views/layouts/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewLayouts extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,99 +161,66 @@ class ComponentbuilderViewLayouts extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Dynamic Get Name Selection - $this->dynamic_getNameOptions = JFormHelper::loadFieldType('Dynamicget')->options; - // We do some sanitation for Dynamic Get Name filter - if (ComponentbuilderHelper::checkArray($this->dynamic_getNameOptions) && - isset($this->dynamic_getNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->dynamic_getNameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->dynamic_getNameOptions[0]); - } - // Only load Dynamic Get Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->dynamic_getNameOptions)) - { - // Dynamic Get Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_LABEL').' -', - 'filter_dynamic_get', - JHtml::_('select.options', $this->dynamic_getNameOptions, 'value', 'text', $this->state->get('filter.dynamic_get')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Dynamic Get Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_LABEL').' -', - 'batch[dynamic_get]', - JHtml::_('select.options', $this->dynamic_getNameOptions, 'value', 'text') - ); - } } - // Set Add Php View Selection - $this->add_php_viewOptions = $this->getTheAdd_php_viewSelections(); - // We do some sanitation for Add Php View filter - if (ComponentbuilderHelper::checkArray($this->add_php_viewOptions) && - isset($this->add_php_viewOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_php_viewOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->add_php_viewOptions[0]); - } - // Only load Add Php View filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_php_viewOptions)) - { - // Add Php View Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_LAYOUT_ADD_PHP_VIEW_LABEL').' -', - 'filter_add_php_view', - JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text', $this->state->get('filter.add_php_view')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Dynamic Get Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Dynamic Get Name Selection + $this->dynamic_getNameOptions = JFormHelper::loadFieldType('Dynamicget')->options; + // We do some sanitation for Dynamic Get Name filter + if (ComponentbuilderHelper::checkArray($this->dynamic_getNameOptions) && + isset($this->dynamic_getNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->dynamic_getNameOptions[0]->value)) { - // Add Php View Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LAYOUT_ADD_PHP_VIEW_LABEL').' -', - 'batch[add_php_view]', - JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text') - ); + unset($this->dynamic_getNameOptions[0]); } + // Dynamic Get Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_LABEL').' -', + 'batch[dynamic_get]', + JHtml::_('select.options', $this->dynamic_getNameOptions, 'value', 'text') + ); + } + + // Only load Add Php View batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Php View Selection + $this->add_php_viewOptions = JFormHelper::loadFieldType('layoutsfilteraddphpview')->options; + // We do some sanitation for Add Php View filter + if (ComponentbuilderHelper::checkArray($this->add_php_viewOptions) && + isset($this->add_php_viewOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_php_viewOptions[0]->value)) + { + unset($this->add_php_viewOptions[0]); + } + // Add Php View Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LAYOUT_ADD_PHP_VIEW_LABEL').' -', + 'batch[add_php_view]', + JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text') + ); } } @@ -294,48 +265,12 @@ class ComponentbuilderViewLayouts extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_LAYOUT_NAME_LABEL'), 'a.description' => JText::_('COM_COMPONENTBUILDER_LAYOUT_DESCRIPTION_LABEL'), 'g.name' => JText::_('COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheAdd_php_viewSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_php_view')); - $query->from($db->quoteName('#__componentbuilder_layout')); - $query->order($db->quoteName('add_php_view') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_php_view) - { - // Translate the add_php_view selection - $text = $model->selectionTranslation($add_php_view,'add_php_view'); - // Now add the add_php_view and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/libraries/tmpl/default.php b/admin/views/libraries/tmpl/default.php index b68deb7d5..39839ef54 100644 --- a/admin/views/libraries/tmpl/default.php +++ b/admin/views/libraries/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=libraries.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'libraryList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_LIBRARIES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_LIBRARIES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/libraries/tmpl/default_body.php b/admin/views/libraries/tmpl/default_body.php index 428f950c1..4568b9829 100644 --- a/admin/views/libraries/tmpl/default_body.php +++ b/admin/views/libraries/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=libraries&task=library.edit" get('library.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/libraries/tmpl/default_head.php b/admin/views/libraries/tmpl/default_head.php index d683dc029..d5de3f87a 100644 --- a/admin/views/libraries/tmpl/default_head.php +++ b/admin/views/libraries/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,23 +30,23 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -54,6 +54,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/libraries/view.html.php b/admin/views/libraries/view.html.php index 387ad101e..5d5d8509f 100644 --- a/admin/views/libraries/view.html.php +++ b/admin/views/libraries/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewLibraries extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -147,129 +151,86 @@ class ComponentbuilderViewLibraries extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Target Selection - $this->targetOptions = $this->getTheTargetSelections(); - // We do some sanitation for Target filter - if (ComponentbuilderHelper::checkArray($this->targetOptions) && - isset($this->targetOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->targetOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->targetOptions[0]); - } - // Only load Target filter if it has values - if (ComponentbuilderHelper::checkArray($this->targetOptions)) - { - // Target Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_LIBRARY_TARGET_LABEL').' -', - 'filter_target', - JHtml::_('select.options', $this->targetOptions, 'value', 'text', $this->state->get('filter.target')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Target Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LIBRARY_TARGET_LABEL').' -', - 'batch[target]', - JHtml::_('select.options', $this->targetOptions, 'value', 'text') - ); - } } - // Set How Selection - $this->howOptions = JFormHelper::loadFieldType('Filebehaviour')->options; - // We do some sanitation for How filter - if (ComponentbuilderHelper::checkArray($this->howOptions) && - isset($this->howOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->howOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->howOptions[0]); - } - // Only load How filter if it has values - if (ComponentbuilderHelper::checkArray($this->howOptions)) - { - // How Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_LIBRARY_HOW_LABEL').' -', - 'filter_how', - JHtml::_('select.options', $this->howOptions, 'value', 'text', $this->state->get('filter.how')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Target batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Target Selection + $this->targetOptions = JFormHelper::loadFieldType('librariesfiltertarget')->options; + // We do some sanitation for Target filter + if (ComponentbuilderHelper::checkArray($this->targetOptions) && + isset($this->targetOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->targetOptions[0]->value)) { - // How Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LIBRARY_HOW_LABEL').' -', - 'batch[how]', - JHtml::_('select.options', $this->howOptions, 'value', 'text') - ); + unset($this->targetOptions[0]); } - } - - // Set Type Selection - $this->typeOptions = $this->getTheTypeSelections(); - // We do some sanitation for Type filter - if (ComponentbuilderHelper::checkArray($this->typeOptions) && - isset($this->typeOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->typeOptions[0]->value)) - { - unset($this->typeOptions[0]); - } - // Only load Type filter if it has values - if (ComponentbuilderHelper::checkArray($this->typeOptions)) - { - // Type Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_LIBRARY_TYPE_LABEL').' -', - 'filter_type', - JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type')) + // Target Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LIBRARY_TARGET_LABEL').' -', + 'batch[target]', + JHtml::_('select.options', $this->targetOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load How batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set How Selection + $this->howOptions = JFormHelper::loadFieldType('Filebehaviour')->options; + // We do some sanitation for How filter + if (ComponentbuilderHelper::checkArray($this->howOptions) && + isset($this->howOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->howOptions[0]->value)) { - // Type Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LIBRARY_TYPE_LABEL').' -', - 'batch[type]', - JHtml::_('select.options', $this->typeOptions, 'value', 'text') - ); + unset($this->howOptions[0]); } + // How Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LIBRARY_HOW_LABEL').' -', + 'batch[how]', + JHtml::_('select.options', $this->howOptions, 'value', 'text') + ); + } + + // Only load Type batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Type Selection + $this->typeOptions = JFormHelper::loadFieldType('librariesfiltertype')->options; + // We do some sanitation for Type filter + if (ComponentbuilderHelper::checkArray($this->typeOptions) && + isset($this->typeOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->typeOptions[0]->value)) + { + unset($this->typeOptions[0]); + } + // Type Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_LIBRARY_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeOptions, 'value', 'text') + ); } } @@ -314,7 +275,7 @@ class ComponentbuilderViewLibraries extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_LIBRARY_NAME_LABEL'), 'a.target' => JText::_('COM_COMPONENTBUILDER_LIBRARY_TARGET_LABEL'), @@ -322,77 +283,5 @@ class ComponentbuilderViewLibraries extends JViewLegacy 'a.description' => JText::_('COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheTargetSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('target')); - $query->from($db->quoteName('#__componentbuilder_library')); - $query->order($db->quoteName('target') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $target) - { - // Translate the target selection - $text = $model->selectionTranslation($target,'target'); - // Now add the target and its text to the options array - $_filter[] = JHtml::_('select.option', $target, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheTypeSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('type')); - $query->from($db->quoteName('#__componentbuilder_library')); - $query->order($db->quoteName('type') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $type) - { - // Translate the type selection - $text = $model->selectionTranslation($type,'type'); - // Now add the type and its text to the options array - $_filter[] = JHtml::_('select.option', $type, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/libraries_config/tmpl/default.php b/admin/views/libraries_config/tmpl/default.php index a0903a080..ca6c6b6c4 100644 --- a/admin/views/libraries_config/tmpl/default.php +++ b/admin/views/libraries_config/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=libraries_config.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'library_configList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_LIBRARIES_CONFIG_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/libraries_config/tmpl/default_body.php b/admin/views/libraries_config/tmpl/default_body.php index 128f2184c..c8eb0e3df 100644 --- a/admin/views/libraries_config/tmpl/default_body.php +++ b/admin/views/libraries_config/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=libraries_config&task=librar get('library_config.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/libraries_config/tmpl/default_head.php b/admin/views/libraries_config/tmpl/default_head.php index 9a3e55b2b..cb89a9464 100644 --- a/admin/views/libraries_config/tmpl/default_head.php +++ b/admin/views/libraries_config/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/libraries_config/view.html.php b/admin/views/libraries_config/view.html.php index e6acdf78a..16f1da1e4 100644 --- a/admin/views/libraries_config/view.html.php +++ b/admin/views/libraries_config/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewLibraries_config extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewLibraries_config extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewLibraries_config extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/libraries_files_folders_urls/tmpl/default.php b/admin/views/libraries_files_folders_urls/tmpl/default.php index 33e903268..340fd74a8 100644 --- a/admin/views/libraries_files_folders_urls/tmpl/default.php +++ b/admin/views/libraries_files_folders_urls/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=libraries_files_folders_urls.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'library_files_folders_urlsList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_LIBRARIES_FILES_FOLDERS_URLS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/libraries_files_folders_urls/tmpl/default_body.php b/admin/views/libraries_files_folders_urls/tmpl/default_body.php index c2f4b753d..000f40892 100644 --- a/admin/views/libraries_files_folders_urls/tmpl/default_body.php +++ b/admin/views/libraries_files_folders_urls/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=libraries_files_folders_urls get('library_files_folders_urls.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/libraries_files_folders_urls/tmpl/default_head.php b/admin/views/libraries_files_folders_urls/tmpl/default_head.php index 88a7012e6..a7ac240eb 100644 --- a/admin/views/libraries_files_folders_urls/tmpl/default_head.php +++ b/admin/views/libraries_files_folders_urls/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -34,7 +34,7 @@ defined('_JEXEC') or die('Restricted access'); canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -42,6 +42,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/libraries_files_folders_urls/view.html.php b/admin/views/libraries_files_folders_urls/view.html.php index 37a901234..39a348267 100644 --- a/admin/views/libraries_files_folders_urls/view.html.php +++ b/admin/views/libraries_files_folders_urls/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewLibraries_files_folders_urls extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewLibraries_files_folders_urls extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewLibraries_files_folders_urls extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.id' => JText::_('JGRID_HEADING_ID') ); diff --git a/admin/views/library/tmpl/edit.php b/admin/views/library/tmpl/edit.php index 1d7cb8eab..52caee2f3 100644 --- a/admin/views/library/tmpl/edit.php +++ b/admin/views/library/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/library_config/tmpl/edit.php b/admin/views/library_config/tmpl/edit.php index 74fede23e..5cce6c626 100644 --- a/admin/views/library_config/tmpl/edit.php +++ b/admin/views/library_config/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/library_files_folders_urls/tmpl/edit.php b/admin/views/library_files_folders_urls/tmpl/edit.php index 604258b5c..16afd0255 100644 --- a/admin/views/library_files_folders_urls/tmpl/edit.php +++ b/admin/views/library_files_folders_urls/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/placeholder/tmpl/edit.php b/admin/views/placeholder/tmpl/edit.php index 090122636..bc0ba7503 100644 --- a/admin/views/placeholder/tmpl/edit.php +++ b/admin/views/placeholder/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/placeholders/tmpl/default.php b/admin/views/placeholders/tmpl/default.php index 242a4833c..506c71d3b 100644 --- a/admin/views/placeholders/tmpl/default.php +++ b/admin/views/placeholders/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=placeholders.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'placeholderList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_PLACEHOLDERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/placeholders/tmpl/default_body.php b/admin/views/placeholders/tmpl/default_body.php index c9efd1b4c..d7a11c2bf 100644 --- a/admin/views/placeholders/tmpl/default_body.php +++ b/admin/views/placeholders/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=placeholders&task=placeholde get('placeholder.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/placeholders/tmpl/default_head.php b/admin/views/placeholders/tmpl/default_head.php index 314685539..bbef1d4e3 100644 --- a/admin/views/placeholders/tmpl/default_head.php +++ b/admin/views/placeholders/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,14 +30,14 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -45,6 +45,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/placeholders/view.html.php b/admin/views/placeholders/view.html.php index e2eaa3655..4bc1d8ee0 100644 --- a/admin/views/placeholders/view.html.php +++ b/admin/views/placeholders/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewPlaceholders extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -152,39 +156,26 @@ class ComponentbuilderViewPlaceholders extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -229,7 +220,7 @@ class ComponentbuilderViewPlaceholders extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.target' => JText::_('COM_COMPONENTBUILDER_PLACEHOLDER_TARGET_LABEL'), 'a.value' => JText::_('COM_COMPONENTBUILDER_PLACEHOLDER_VALUE_LABEL'), diff --git a/admin/views/server/tmpl/edit.php b/admin/views/server/tmpl/edit.php index 3595cdf68..98b972f0c 100644 --- a/admin/views/server/tmpl/edit.php +++ b/admin/views/server/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/servers/tmpl/default.php b/admin/views/servers/tmpl/default.php index cbb2a15bd..81cb77a97 100644 --- a/admin/views/servers/tmpl/default.php +++ b/admin/views/servers/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=servers.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'serverList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_SERVERS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_SERVERS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/servers/tmpl/default_body.php b/admin/views/servers/tmpl/default_body.php index e3dce61ea..e7630a42a 100644 --- a/admin/views/servers/tmpl/default_body.php +++ b/admin/views/servers/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=servers&task=server.edit"; get('server.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/servers/tmpl/default_head.php b/admin/views/servers/tmpl/default_head.php index 42f71a59f..2d8a3351e 100644 --- a/admin/views/servers/tmpl/default_head.php +++ b/admin/views/servers/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,14 +30,14 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -45,6 +45,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/servers/view.html.php b/admin/views/servers/view.html.php index 2283ddf6c..f5444b664 100644 --- a/admin/views/servers/view.html.php +++ b/admin/views/servers/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewServers extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -152,99 +156,66 @@ class ComponentbuilderViewServers extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Name Selection - $this->nameOptions = $this->getTheNameSelections(); - // We do some sanitation for Name filter - if (ComponentbuilderHelper::checkArray($this->nameOptions) && - isset($this->nameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->nameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->nameOptions[0]); - } - // Only load Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->nameOptions)) - { - // Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_SERVER_NAME_LABEL').' -', - 'filter_name', - JHtml::_('select.options', $this->nameOptions, 'value', 'text', $this->state->get('filter.name')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SERVER_NAME_LABEL').' -', - 'batch[name]', - JHtml::_('select.options', $this->nameOptions, 'value', 'text') - ); - } } - // Set Protocol Selection - $this->protocolOptions = $this->getTheProtocolSelections(); - // We do some sanitation for Protocol filter - if (ComponentbuilderHelper::checkArray($this->protocolOptions) && - isset($this->protocolOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->protocolOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->protocolOptions[0]); - } - // Only load Protocol filter if it has values - if (ComponentbuilderHelper::checkArray($this->protocolOptions)) - { - // Protocol Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_SERVER_PROTOCOL_LABEL').' -', - 'filter_protocol', - JHtml::_('select.options', $this->protocolOptions, 'value', 'text', $this->state->get('filter.protocol')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Name Selection + $this->nameOptions = JFormHelper::loadFieldType('serversfiltername')->options; + // We do some sanitation for Name filter + if (ComponentbuilderHelper::checkArray($this->nameOptions) && + isset($this->nameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->nameOptions[0]->value)) { - // Protocol Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SERVER_PROTOCOL_LABEL').' -', - 'batch[protocol]', - JHtml::_('select.options', $this->protocolOptions, 'value', 'text') - ); + unset($this->nameOptions[0]); } + // Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SERVER_NAME_LABEL').' -', + 'batch[name]', + JHtml::_('select.options', $this->nameOptions, 'value', 'text') + ); + } + + // Only load Protocol batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Protocol Selection + $this->protocolOptions = JFormHelper::loadFieldType('serversfilterprotocol')->options; + // We do some sanitation for Protocol filter + if (ComponentbuilderHelper::checkArray($this->protocolOptions) && + isset($this->protocolOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->protocolOptions[0]->value)) + { + unset($this->protocolOptions[0]); + } + // Protocol Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SERVER_PROTOCOL_LABEL').' -', + 'batch[protocol]', + JHtml::_('select.options', $this->protocolOptions, 'value', 'text') + ); } } @@ -289,79 +260,11 @@ class ComponentbuilderViewServers extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_SERVER_NAME_LABEL'), 'a.protocol' => JText::_('COM_COMPONENTBUILDER_SERVER_PROTOCOL_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheNameSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('name')); - $query->from($db->quoteName('#__componentbuilder_server')); - $query->order($db->quoteName('name') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - $results = array_unique($results); - $_filter = array(); - foreach ($results as $name) - { - // Now add the name and its text to the options array - $_filter[] = JHtml::_('select.option', $name, $name); - } - return $_filter; - } - return false; - } - - protected function getTheProtocolSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('protocol')); - $query->from($db->quoteName('#__componentbuilder_server')); - $query->order($db->quoteName('protocol') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $protocol) - { - // Translate the protocol selection - $text = $model->selectionTranslation($protocol,'protocol'); - // Now add the protocol and its text to the options array - $_filter[] = JHtml::_('select.option', $protocol, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/site_view/tmpl/edit.php b/admin/views/site_view/tmpl/edit.php index 60a99d2e2..6841ccbbd 100644 --- a/admin/views/site_view/tmpl/edit.php +++ b/admin/views/site_view/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/site_views/tmpl/default.php b/admin/views/site_views/tmpl/default.php index a9090f66c..526971e60 100644 --- a/admin/views/site_views/tmpl/default.php +++ b/admin/views/site_views/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=site_views.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'site_viewList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_SITE_VIEWS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/site_views/tmpl/default_body.php b/admin/views/site_views/tmpl/default_body.php index da5beac8e..e3bbf35a3 100644 --- a/admin/views/site_views/tmpl/default_body.php +++ b/admin/views/site_views/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=site_views&task=site_view.ed get('core.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/site_views/tmpl/default_head.php b/admin/views/site_views/tmpl/default_head.php index 173030ce5..ce088bc50 100644 --- a/admin/views/site_views/tmpl/default_head.php +++ b/admin/views/site_views/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,20 +30,20 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -51,6 +51,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/site_views/view.html.php b/admin/views/site_views/view.html.php index 2fe9ec51a..335d4b515 100644 --- a/admin/views/site_views/view.html.php +++ b/admin/views/site_views/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewSite_views extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,129 +161,86 @@ class ComponentbuilderViewSite_views extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Main Get Name Selection - $this->main_getNameOptions = JFormHelper::loadFieldType('Maingets')->options; - // We do some sanitation for Main Get Name filter - if (ComponentbuilderHelper::checkArray($this->main_getNameOptions) && - isset($this->main_getNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->main_getNameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->main_getNameOptions[0]); - } - // Only load Main Get Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->main_getNameOptions)) - { - // Main Get Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_MAIN_GET_LABEL').' -', - 'filter_main_get', - JHtml::_('select.options', $this->main_getNameOptions, 'value', 'text', $this->state->get('filter.main_get')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Main Get Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_MAIN_GET_LABEL').' -', - 'batch[main_get]', - JHtml::_('select.options', $this->main_getNameOptions, 'value', 'text') - ); - } } - // Set Add Php Ajax Selection - $this->add_php_ajaxOptions = $this->getTheAdd_php_ajaxSelections(); - // We do some sanitation for Add Php Ajax filter - if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions) && - isset($this->add_php_ajaxOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_php_ajaxOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->add_php_ajaxOptions[0]); - } - // Only load Add Php Ajax filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions)) - { - // Add Php Ajax Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_AJAX_LABEL').' -', - 'filter_add_php_ajax', - JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text', $this->state->get('filter.add_php_ajax')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Main Get Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Main Get Name Selection + $this->main_getNameOptions = JFormHelper::loadFieldType('Maingets')->options; + // We do some sanitation for Main Get Name filter + if (ComponentbuilderHelper::checkArray($this->main_getNameOptions) && + isset($this->main_getNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->main_getNameOptions[0]->value)) { - // Add Php Ajax Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_AJAX_LABEL').' -', - 'batch[add_php_ajax]', - JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text') - ); + unset($this->main_getNameOptions[0]); } - } - - // Set Add Custom Button Selection - $this->add_custom_buttonOptions = $this->getTheAdd_custom_buttonSelections(); - // We do some sanitation for Add Custom Button filter - if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions) && - isset($this->add_custom_buttonOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_custom_buttonOptions[0]->value)) - { - unset($this->add_custom_buttonOptions[0]); - } - // Only load Add Custom Button filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions)) - { - // Add Custom Button Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', - 'filter_add_custom_button', - JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text', $this->state->get('filter.add_custom_button')) + // Main Get Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_MAIN_GET_LABEL').' -', + 'batch[main_get]', + JHtml::_('select.options', $this->main_getNameOptions, 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Add Php Ajax batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Php Ajax Selection + $this->add_php_ajaxOptions = JFormHelper::loadFieldType('siteviewsfilteraddphpajax')->options; + // We do some sanitation for Add Php Ajax filter + if (ComponentbuilderHelper::checkArray($this->add_php_ajaxOptions) && + isset($this->add_php_ajaxOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_php_ajaxOptions[0]->value)) { - // Add Custom Button Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', - 'batch[add_custom_button]', - JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text') - ); + unset($this->add_php_ajaxOptions[0]); } + // Add Php Ajax Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_AJAX_LABEL').' -', + 'batch[add_php_ajax]', + JHtml::_('select.options', $this->add_php_ajaxOptions, 'value', 'text') + ); + } + + // Only load Add Custom Button batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Custom Button Selection + $this->add_custom_buttonOptions = JFormHelper::loadFieldType('siteviewsfilteraddcustombutton')->options; + // We do some sanitation for Add Custom Button filter + if (ComponentbuilderHelper::checkArray($this->add_custom_buttonOptions) && + isset($this->add_custom_buttonOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_custom_buttonOptions[0]->value)) + { + unset($this->add_custom_buttonOptions[0]); + } + // Add Custom Button Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON_LABEL').' -', + 'batch[add_custom_button]', + JHtml::_('select.options', $this->add_custom_buttonOptions, 'value', 'text') + ); } } @@ -324,7 +285,7 @@ class ComponentbuilderViewSite_views extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.system_name' => JText::_('COM_COMPONENTBUILDER_SITE_VIEW_SYSTEM_NAME_LABEL'), 'a.name' => JText::_('COM_COMPONENTBUILDER_SITE_VIEW_NAME_LABEL'), @@ -333,77 +294,5 @@ class ComponentbuilderViewSite_views extends JViewLegacy 'a.context' => JText::_('COM_COMPONENTBUILDER_SITE_VIEW_CONTEXT_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheAdd_php_ajaxSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_php_ajax')); - $query->from($db->quoteName('#__componentbuilder_site_view')); - $query->order($db->quoteName('add_php_ajax') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_php_ajax) - { - // Translate the add_php_ajax selection - $text = $model->selectionTranslation($add_php_ajax,'add_php_ajax'); - // Now add the add_php_ajax and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_ajax, JText::_($text)); - } - return $_filter; - } - return false; - } - - protected function getTheAdd_custom_buttonSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_custom_button')); - $query->from($db->quoteName('#__componentbuilder_site_view')); - $query->order($db->quoteName('add_custom_button') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_custom_button) - { - // Translate the add_custom_button selection - $text = $model->selectionTranslation($add_custom_button,'add_custom_button'); - // Now add the add_custom_button and its text to the options array - $_filter[] = JHtml::_('select.option', $add_custom_button, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/snippet/tmpl/edit.php b/admin/views/snippet/tmpl/edit.php index 3ec825be8..7720739f8 100644 --- a/admin/views/snippet/tmpl/edit.php +++ b/admin/views/snippet/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/snippet_type/tmpl/edit.php b/admin/views/snippet_type/tmpl/edit.php index c42121ab3..5d3760291 100644 --- a/admin/views/snippet_type/tmpl/edit.php +++ b/admin/views/snippet_type/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/snippet_types/tmpl/default.php b/admin/views/snippet_types/tmpl/default.php index 820ed9c04..00001adcc 100644 --- a/admin/views/snippet_types/tmpl/default.php +++ b/admin/views/snippet_types/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=snippet_types.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'snippet_typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/snippet_types/tmpl/default_body.php b/admin/views/snippet_types/tmpl/default_body.php index e8664c4ee..2236f64b0 100644 --- a/admin/views/snippet_types/tmpl/default_body.php +++ b/admin/views/snippet_types/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=snippet_types&task=snippet_t get('snippet_type.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/snippet_types/tmpl/default_head.php b/admin/views/snippet_types/tmpl/default_head.php index c862e11bf..75b22fb43 100644 --- a/admin/views/snippet_types/tmpl/default_head.php +++ b/admin/views/snippet_types/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,14 +30,14 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -45,6 +45,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/snippet_types/view.html.php b/admin/views/snippet_types/view.html.php index 9532233d7..9872b9c67 100644 --- a/admin/views/snippet_types/view.html.php +++ b/admin/views/snippet_types/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewSnippet_types extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -142,39 +146,26 @@ class ComponentbuilderViewSnippet_types extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -219,7 +210,7 @@ class ComponentbuilderViewSnippet_types extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_SNIPPET_TYPE_NAME_LABEL'), 'a.description' => JText::_('COM_COMPONENTBUILDER_SNIPPET_TYPE_DESCRIPTION_LABEL'), diff --git a/admin/views/snippets/tmpl/default.php b/admin/views/snippets/tmpl/default.php index 937eb60f0..684e26960 100644 --- a/admin/views/snippets/tmpl/default.php +++ b/admin/views/snippets/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=snippets.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'snippetList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_SNIPPETS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_SNIPPETS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/snippets/tmpl/default_body.php b/admin/views/snippets/tmpl/default_body.php index afdc15154..90ffba9e7 100644 --- a/admin/views/snippets/tmpl/default_body.php +++ b/admin/views/snippets/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=snippets&task=snippet.edit"; get('core.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/snippets/tmpl/default_head.php b/admin/views/snippets/tmpl/default_head.php index 5f334e595..169f2cdb3 100644 --- a/admin/views/snippets/tmpl/default_head.php +++ b/admin/views/snippets/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,23 +30,23 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -54,6 +54,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/snippets/view.html.php b/admin/views/snippets/view.html.php index f2cf6f21b..88fcaecb7 100644 --- a/admin/views/snippets/view.html.php +++ b/admin/views/snippets/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewSnippets extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -162,99 +166,66 @@ class ComponentbuilderViewSnippets extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Type Name Selection - $this->typeNameOptions = JFormHelper::loadFieldType('Snippettype')->options; - // We do some sanitation for Type Name filter - if (ComponentbuilderHelper::checkArray($this->typeNameOptions) && - isset($this->typeNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->typeNameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->typeNameOptions[0]); - } - // Only load Type Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->typeNameOptions)) - { - // Type Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_SNIPPET_TYPE_LABEL').' -', - 'filter_type', - JHtml::_('select.options', $this->typeNameOptions, 'value', 'text', $this->state->get('filter.type')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Type Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SNIPPET_TYPE_LABEL').' -', - 'batch[type]', - JHtml::_('select.options', $this->typeNameOptions, 'value', 'text') - ); - } } - // Set Library Name Selection - $this->libraryNameOptions = JFormHelper::loadFieldType('Library')->options; - // We do some sanitation for Library Name filter - if (ComponentbuilderHelper::checkArray($this->libraryNameOptions) && - isset($this->libraryNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->libraryNameOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->libraryNameOptions[0]); - } - // Only load Library Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->libraryNameOptions)) - { - // Library Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_SNIPPET_LIBRARY_LABEL').' -', - 'filter_library', - JHtml::_('select.options', $this->libraryNameOptions, 'value', 'text', $this->state->get('filter.library')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Type Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Type Name Selection + $this->typeNameOptions = JFormHelper::loadFieldType('Snippettype')->options; + // We do some sanitation for Type Name filter + if (ComponentbuilderHelper::checkArray($this->typeNameOptions) && + isset($this->typeNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->typeNameOptions[0]->value)) { - // Library Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SNIPPET_LIBRARY_LABEL').' -', - 'batch[library]', - JHtml::_('select.options', $this->libraryNameOptions, 'value', 'text') - ); + unset($this->typeNameOptions[0]); } + // Type Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SNIPPET_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeNameOptions, 'value', 'text') + ); + } + + // Only load Library Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Library Name Selection + $this->libraryNameOptions = JFormHelper::loadFieldType('Library')->options; + // We do some sanitation for Library Name filter + if (ComponentbuilderHelper::checkArray($this->libraryNameOptions) && + isset($this->libraryNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->libraryNameOptions[0]->value)) + { + unset($this->libraryNameOptions[0]); + } + // Library Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_SNIPPET_LIBRARY_LABEL').' -', + 'batch[library]', + JHtml::_('select.options', $this->libraryNameOptions, 'value', 'text') + ); } } @@ -299,7 +270,7 @@ class ComponentbuilderViewSnippets extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_SNIPPET_NAME_LABEL'), 'a.url' => JText::_('COM_COMPONENTBUILDER_SNIPPET_URL_LABEL'), diff --git a/admin/views/template/tmpl/edit.php b/admin/views/template/tmpl/edit.php index 8f7ee22d0..480f76f89 100644 --- a/admin/views/template/tmpl/edit.php +++ b/admin/views/template/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/templates/tmpl/default.php b/admin/views/templates/tmpl/default.php index 30a5e9324..ce8b84b48 100644 --- a/admin/views/templates/tmpl/default.php +++ b/admin/views/templates/tmpl/default.php @@ -12,76 +12,57 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=templates.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'templateList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_TEMPLATES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - + +sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_TEMPLATES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + \ No newline at end of file + diff --git a/admin/views/templates/tmpl/default_body.php b/admin/views/templates/tmpl/default_body.php index cb081e795..e7c7c3708 100644 --- a/admin/views/templates/tmpl/default_body.php +++ b/admin/views/templates/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=templates&task=template.edit get('core.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/templates/tmpl/default_head.php b/admin/views/templates/tmpl/default_head.php index 18ef3a02a..a80afaf10 100644 --- a/admin/views/templates/tmpl/default_head.php +++ b/admin/views/templates/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,17 +30,17 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -48,6 +48,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/templates/view.html.php b/admin/views/templates/view.html.php index 83e26eb5b..f1d2145ea 100644 --- a/admin/views/templates/view.html.php +++ b/admin/views/templates/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewTemplates extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,99 +161,66 @@ class ComponentbuilderViewTemplates extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); } - // Set Dynamic Get Name Selection - $this->dynamic_getNameOptions = JFormHelper::loadFieldType('Dynamicget')->options; - // We do some sanitation for Dynamic Get Name filter - if (ComponentbuilderHelper::checkArray($this->dynamic_getNameOptions) && - isset($this->dynamic_getNameOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->dynamic_getNameOptions[0]->value)) + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) { - unset($this->dynamic_getNameOptions[0]); - } - // Only load Dynamic Get Name filter if it has values - if (ComponentbuilderHelper::checkArray($this->dynamic_getNameOptions)) - { - // Dynamic Get Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL').' -', - 'filter_dynamic_get', - JHtml::_('select.options', $this->dynamic_getNameOptions, 'value', 'text', $this->state->get('filter.dynamic_get')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Dynamic Get Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL').' -', - 'batch[dynamic_get]', - JHtml::_('select.options', $this->dynamic_getNameOptions, 'value', 'text') - ); - } } - // Set Add Php View Selection - $this->add_php_viewOptions = $this->getTheAdd_php_viewSelections(); - // We do some sanitation for Add Php View filter - if (ComponentbuilderHelper::checkArray($this->add_php_viewOptions) && - isset($this->add_php_viewOptions[0]->value) && - !ComponentbuilderHelper::checkString($this->add_php_viewOptions[0]->value)) + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) { - unset($this->add_php_viewOptions[0]); - } - // Only load Add Php View filter if it has values - if (ComponentbuilderHelper::checkArray($this->add_php_viewOptions)) - { - // Add Php View Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_COMPONENTBUILDER_TEMPLATE_ADD_PHP_VIEW_LABEL').' -', - 'filter_add_php_view', - JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text', $this->state->get('filter.add_php_view')) + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); + } - if ($this->canBatch && $this->canCreate && $this->canEdit) + // Only load Dynamic Get Name batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Dynamic Get Name Selection + $this->dynamic_getNameOptions = JFormHelper::loadFieldType('Dynamicget')->options; + // We do some sanitation for Dynamic Get Name filter + if (ComponentbuilderHelper::checkArray($this->dynamic_getNameOptions) && + isset($this->dynamic_getNameOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->dynamic_getNameOptions[0]->value)) { - // Add Php View Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_COMPONENTBUILDER_TEMPLATE_ADD_PHP_VIEW_LABEL').' -', - 'batch[add_php_view]', - JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text') - ); + unset($this->dynamic_getNameOptions[0]); } + // Dynamic Get Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL').' -', + 'batch[dynamic_get]', + JHtml::_('select.options', $this->dynamic_getNameOptions, 'value', 'text') + ); + } + + // Only load Add Php View batch if create, edit, and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Set Add Php View Selection + $this->add_php_viewOptions = JFormHelper::loadFieldType('templatesfilteraddphpview')->options; + // We do some sanitation for Add Php View filter + if (ComponentbuilderHelper::checkArray($this->add_php_viewOptions) && + isset($this->add_php_viewOptions[0]->value) && + !ComponentbuilderHelper::checkString($this->add_php_viewOptions[0]->value)) + { + unset($this->add_php_viewOptions[0]); + } + // Add Php View Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_COMPONENTBUILDER_TEMPLATE_ADD_PHP_VIEW_LABEL').' -', + 'batch[add_php_view]', + JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text') + ); } } @@ -294,48 +265,12 @@ class ComponentbuilderViewTemplates extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_TEMPLATE_NAME_LABEL'), 'a.description' => JText::_('COM_COMPONENTBUILDER_TEMPLATE_DESCRIPTION_LABEL'), 'g.name' => JText::_('COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); - } - - protected function getTheAdd_php_viewSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('add_php_view')); - $query->from($db->quoteName('#__componentbuilder_template')); - $query->order($db->quoteName('add_php_view') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - // get model - $model = $this->getModel(); - $results = array_unique($results); - $_filter = array(); - foreach ($results as $add_php_view) - { - // Translate the add_php_view selection - $text = $model->selectionTranslation($add_php_view,'add_php_view'); - // Now add the add_php_view and its text to the options array - $_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text)); - } - return $_filter; - } - return false; } } diff --git a/admin/views/validation_rule/tmpl/edit.php b/admin/views/validation_rule/tmpl/edit.php index 1040aef74..682c05cde 100644 --- a/admin/views/validation_rule/tmpl/edit.php +++ b/admin/views/validation_rule/tmpl/edit.php @@ -12,10 +12,10 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); $componentParams = $this->params; // will be removed just use $this->params instead ?> diff --git a/admin/views/validation_rules/tmpl/default.php b/admin/views/validation_rules/tmpl/default.php index cfe4c2d20..23a3abfee 100644 --- a/admin/views/validation_rules/tmpl/default.php +++ b/admin/views/validation_rules/tmpl/default.php @@ -12,74 +12,55 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.multiselect'); +JHtml::_('dropdown.init'); +JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -')); JHtml::_('formbehavior.chosen', 'select'); - if ($this->saveOrder) { $saveOrderingUrl = 'index.php?option=com_componentbuilder&task=validation_rules.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'validation_ruleList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); } - ?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file +
+sidebar)): ?> +
+ sidebar; ?> +
+
+ +
+ + $this)); +?> +items)): ?> +
+ +
+ + + loadTemplate('head');?> + loadTemplate('foot');?> + loadTemplate('body');?> +
+ + canCreate && $this->canEdit) : ?> + JText::_('COM_COMPONENTBUILDER_VALIDATION_RULES_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + +
+ + + + diff --git a/admin/views/validation_rules/tmpl/default_body.php b/admin/views/validation_rules/tmpl/default_body.php index dd91f6f2d..f1787372c 100644 --- a/admin/views/validation_rules/tmpl/default_body.php +++ b/admin/views/validation_rules/tmpl/default_body.php @@ -25,11 +25,8 @@ $edit = "index.php?option=com_componentbuilder&view=validation_rules&task=valida get('validation_rule.edit.state')): ?> saveOrder) - { - $iconClass = ' inactive'; - } - else + $iconClass = ''; + if (!$this->saveOrder) { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); } diff --git a/admin/views/validation_rules/tmpl/default_head.php b/admin/views/validation_rules/tmpl/default_head.php index 177b3a7f9..9b9f8df60 100644 --- a/admin/views/validation_rules/tmpl/default_head.php +++ b/admin/views/validation_rules/tmpl/default_head.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -30,14 +30,14 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> canState): ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -45,6 +45,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> \ No newline at end of file diff --git a/admin/views/validation_rules/view.html.php b/admin/views/validation_rules/view.html.php index 0b1f3d44c..074a71c60 100644 --- a/admin/views/validation_rules/view.html.php +++ b/admin/views/validation_rules/view.html.php @@ -34,10 +34,14 @@ class ComponentbuilderViewValidation_rules extends JViewLegacy $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); + // Load the filter form from xml. + $this->filterForm = $this->get('FilterForm'); + // Load the active filters. + $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listDirn = $this->escape($this->state->get('list.direction', 'desc')); - $this->saveOrder = $this->listOrder == 'ordering'; + $this->saveOrder = $this->listOrder == 'a.ordering'; // set the return here value $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); // get global action permissions @@ -157,39 +161,26 @@ class ComponentbuilderViewValidation_rules extends JViewLegacy if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); + } + + // Only load published batch if state and batch is allowed + if ($this->canState && $this->canBatch) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), + 'batch[published]', + JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) + ); + } + + // Only load access batch if create, edit and batch is allowed + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + JHtmlBatch_::addListSelection( + JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), + 'batch[access]', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') + ); } } @@ -234,7 +225,7 @@ class ComponentbuilderViewValidation_rules extends JViewLegacy protected function getSortFields() { return array( - 'ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_LABEL'), 'a.short_description' => JText::_('COM_COMPONENTBUILDER_VALIDATION_RULE_SHORT_DESCRIPTION_LABEL'), diff --git a/componentbuilder.xml b/componentbuilder.xml index b9a632a5e..00f992252 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,19 +1,19 @@ COM_COMPONENTBUILDER - 29th October, 2020 + 12th December, 2020 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 2.11.7 + 2.12.2 Component Builder (v.2.11.7) +

Component Builder (v.2.12.2)

The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time. -Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!

+Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!

Created by Llewellyn van der Merwe
Development started 30th April, 2015

]]>
diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index 1007da153..abcd8ed98 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -990,10 +990,27 @@ Builds Complex Joomla Components com_componentbuilder component - 2.11.7 + 2.12.1 http://www.joomlacomponentbuilder.com - https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.11.7/JCB_v2.11.7.zip + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.2/JCB_v2.12.2.zip + + + stable + + Llewellyn van der Merwe + http://www.joomlacomponentbuilder.com + + + + Component Builder + Builds Complex Joomla Components + com_componentbuilder + component + 2.12.2 + http://www.joomlacomponentbuilder.com + + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.12.2/JCB_v2.12.2.zip stable diff --git a/script.php b/script.php index a598be82c..9791cda8d 100644 --- a/script.php +++ b/script.php @@ -75,7 +75,7 @@ class com_componentbuilderInstallerScript $joomla_component_done = $db->execute(); if ($joomla_component_done) { - // If succesfully remove Joomla_component add queued success message. + // If successfully remove Joomla_component add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_component) type alias was removed from the #__content_type table')); } @@ -90,7 +90,7 @@ class com_componentbuilderInstallerScript $joomla_component_done = $db->execute(); if ($joomla_component_done) { - // If succesfully remove Joomla_component add queued success message. + // If successfully remove Joomla_component add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_component) type alias was removed from the #__contentitem_tag_map table')); } @@ -105,7 +105,7 @@ class com_componentbuilderInstallerScript $joomla_component_done = $db->execute(); if ($joomla_component_done) { - // If succesfully remove Joomla_component add queued success message. + // If successfully removed Joomla_component add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_component) type alias was removed from the #__ucm_content table')); } @@ -161,7 +161,7 @@ class com_componentbuilderInstallerScript $joomla_module_done = $db->execute(); if ($joomla_module_done) { - // If succesfully remove Joomla_module add queued success message. + // If successfully remove Joomla_module add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module) type alias was removed from the #__content_type table')); } @@ -176,7 +176,7 @@ class com_componentbuilderInstallerScript $joomla_module_done = $db->execute(); if ($joomla_module_done) { - // If succesfully remove Joomla_module add queued success message. + // If successfully remove Joomla_module add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module) type alias was removed from the #__contentitem_tag_map table')); } @@ -191,7 +191,7 @@ class com_componentbuilderInstallerScript $joomla_module_done = $db->execute(); if ($joomla_module_done) { - // If succesfully remove Joomla_module add queued success message. + // If successfully removed Joomla_module add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module) type alias was removed from the #__ucm_content table')); } @@ -247,7 +247,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_done = $db->execute(); if ($joomla_plugin_done) { - // If succesfully remove Joomla_plugin add queued success message. + // If successfully remove Joomla_plugin add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the #__content_type table')); } @@ -262,7 +262,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_done = $db->execute(); if ($joomla_plugin_done) { - // If succesfully remove Joomla_plugin add queued success message. + // If successfully remove Joomla_plugin add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the #__contentitem_tag_map table')); } @@ -277,7 +277,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_done = $db->execute(); if ($joomla_plugin_done) { - // If succesfully remove Joomla_plugin add queued success message. + // If successfully removed Joomla_plugin add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin) type alias was removed from the #__ucm_content table')); } @@ -333,7 +333,7 @@ class com_componentbuilderInstallerScript $admin_view_done = $db->execute(); if ($admin_view_done) { - // If succesfully remove Admin_view add queued success message. + // If successfully remove Admin_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_view) type alias was removed from the #__content_type table')); } @@ -348,7 +348,7 @@ class com_componentbuilderInstallerScript $admin_view_done = $db->execute(); if ($admin_view_done) { - // If succesfully remove Admin_view add queued success message. + // If successfully remove Admin_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_view) type alias was removed from the #__contentitem_tag_map table')); } @@ -363,7 +363,7 @@ class com_componentbuilderInstallerScript $admin_view_done = $db->execute(); if ($admin_view_done) { - // If succesfully remove Admin_view add queued success message. + // If successfully removed Admin_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_view) type alias was removed from the #__ucm_content table')); } @@ -419,7 +419,7 @@ class com_componentbuilderInstallerScript $custom_admin_view_done = $db->execute(); if ($custom_admin_view_done) { - // If succesfully remove Custom_admin_view add queued success message. + // If successfully remove Custom_admin_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.custom_admin_view) type alias was removed from the #__content_type table')); } @@ -434,7 +434,7 @@ class com_componentbuilderInstallerScript $custom_admin_view_done = $db->execute(); if ($custom_admin_view_done) { - // If succesfully remove Custom_admin_view add queued success message. + // If successfully remove Custom_admin_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.custom_admin_view) type alias was removed from the #__contentitem_tag_map table')); } @@ -449,7 +449,7 @@ class com_componentbuilderInstallerScript $custom_admin_view_done = $db->execute(); if ($custom_admin_view_done) { - // If succesfully remove Custom_admin_view add queued success message. + // If successfully removed Custom_admin_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.custom_admin_view) type alias was removed from the #__ucm_content table')); } @@ -505,7 +505,7 @@ class com_componentbuilderInstallerScript $site_view_done = $db->execute(); if ($site_view_done) { - // If succesfully remove Site_view add queued success message. + // If successfully remove Site_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.site_view) type alias was removed from the #__content_type table')); } @@ -520,7 +520,7 @@ class com_componentbuilderInstallerScript $site_view_done = $db->execute(); if ($site_view_done) { - // If succesfully remove Site_view add queued success message. + // If successfully remove Site_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.site_view) type alias was removed from the #__contentitem_tag_map table')); } @@ -535,7 +535,7 @@ class com_componentbuilderInstallerScript $site_view_done = $db->execute(); if ($site_view_done) { - // If succesfully remove Site_view add queued success message. + // If successfully removed Site_view add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.site_view) type alias was removed from the #__ucm_content table')); } @@ -591,7 +591,7 @@ class com_componentbuilderInstallerScript $template_done = $db->execute(); if ($template_done) { - // If succesfully remove Template add queued success message. + // If successfully remove Template add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.template) type alias was removed from the #__content_type table')); } @@ -606,7 +606,7 @@ class com_componentbuilderInstallerScript $template_done = $db->execute(); if ($template_done) { - // If succesfully remove Template add queued success message. + // If successfully remove Template add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.template) type alias was removed from the #__contentitem_tag_map table')); } @@ -621,7 +621,7 @@ class com_componentbuilderInstallerScript $template_done = $db->execute(); if ($template_done) { - // If succesfully remove Template add queued success message. + // If successfully removed Template add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.template) type alias was removed from the #__ucm_content table')); } @@ -677,7 +677,7 @@ class com_componentbuilderInstallerScript $layout_done = $db->execute(); if ($layout_done) { - // If succesfully remove Layout add queued success message. + // If successfully remove Layout add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.layout) type alias was removed from the #__content_type table')); } @@ -692,7 +692,7 @@ class com_componentbuilderInstallerScript $layout_done = $db->execute(); if ($layout_done) { - // If succesfully remove Layout add queued success message. + // If successfully remove Layout add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.layout) type alias was removed from the #__contentitem_tag_map table')); } @@ -707,7 +707,7 @@ class com_componentbuilderInstallerScript $layout_done = $db->execute(); if ($layout_done) { - // If succesfully remove Layout add queued success message. + // If successfully removed Layout add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.layout) type alias was removed from the #__ucm_content table')); } @@ -763,7 +763,7 @@ class com_componentbuilderInstallerScript $dynamic_get_done = $db->execute(); if ($dynamic_get_done) { - // If succesfully remove Dynamic_get add queued success message. + // If successfully remove Dynamic_get add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.dynamic_get) type alias was removed from the #__content_type table')); } @@ -778,7 +778,7 @@ class com_componentbuilderInstallerScript $dynamic_get_done = $db->execute(); if ($dynamic_get_done) { - // If succesfully remove Dynamic_get add queued success message. + // If successfully remove Dynamic_get add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.dynamic_get) type alias was removed from the #__contentitem_tag_map table')); } @@ -793,7 +793,7 @@ class com_componentbuilderInstallerScript $dynamic_get_done = $db->execute(); if ($dynamic_get_done) { - // If succesfully remove Dynamic_get add queued success message. + // If successfully removed Dynamic_get add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.dynamic_get) type alias was removed from the #__ucm_content table')); } @@ -849,7 +849,7 @@ class com_componentbuilderInstallerScript $custom_code_done = $db->execute(); if ($custom_code_done) { - // If succesfully remove Custom_code add queued success message. + // If successfully remove Custom_code add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.custom_code) type alias was removed from the #__content_type table')); } @@ -864,7 +864,7 @@ class com_componentbuilderInstallerScript $custom_code_done = $db->execute(); if ($custom_code_done) { - // If succesfully remove Custom_code add queued success message. + // If successfully remove Custom_code add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.custom_code) type alias was removed from the #__contentitem_tag_map table')); } @@ -879,7 +879,7 @@ class com_componentbuilderInstallerScript $custom_code_done = $db->execute(); if ($custom_code_done) { - // If succesfully remove Custom_code add queued success message. + // If successfully removed Custom_code add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.custom_code) type alias was removed from the #__ucm_content table')); } @@ -935,7 +935,7 @@ class com_componentbuilderInstallerScript $class_property_done = $db->execute(); if ($class_property_done) { - // If succesfully remove Class_property add queued success message. + // If successfully remove Class_property add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_property) type alias was removed from the #__content_type table')); } @@ -950,7 +950,7 @@ class com_componentbuilderInstallerScript $class_property_done = $db->execute(); if ($class_property_done) { - // If succesfully remove Class_property add queued success message. + // If successfully remove Class_property add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_property) type alias was removed from the #__contentitem_tag_map table')); } @@ -965,7 +965,7 @@ class com_componentbuilderInstallerScript $class_property_done = $db->execute(); if ($class_property_done) { - // If succesfully remove Class_property add queued success message. + // If successfully removed Class_property add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_property) type alias was removed from the #__ucm_content table')); } @@ -1021,7 +1021,7 @@ class com_componentbuilderInstallerScript $class_method_done = $db->execute(); if ($class_method_done) { - // If succesfully remove Class_method add queued success message. + // If successfully remove Class_method add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_method) type alias was removed from the #__content_type table')); } @@ -1036,7 +1036,7 @@ class com_componentbuilderInstallerScript $class_method_done = $db->execute(); if ($class_method_done) { - // If succesfully remove Class_method add queued success message. + // If successfully remove Class_method add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_method) type alias was removed from the #__contentitem_tag_map table')); } @@ -1051,7 +1051,7 @@ class com_componentbuilderInstallerScript $class_method_done = $db->execute(); if ($class_method_done) { - // If succesfully remove Class_method add queued success message. + // If successfully removed Class_method add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_method) type alias was removed from the #__ucm_content table')); } @@ -1107,7 +1107,7 @@ class com_componentbuilderInstallerScript $placeholder_done = $db->execute(); if ($placeholder_done) { - // If succesfully remove Placeholder add queued success message. + // If successfully remove Placeholder add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.placeholder) type alias was removed from the #__content_type table')); } @@ -1122,7 +1122,7 @@ class com_componentbuilderInstallerScript $placeholder_done = $db->execute(); if ($placeholder_done) { - // If succesfully remove Placeholder add queued success message. + // If successfully remove Placeholder add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.placeholder) type alias was removed from the #__contentitem_tag_map table')); } @@ -1137,7 +1137,7 @@ class com_componentbuilderInstallerScript $placeholder_done = $db->execute(); if ($placeholder_done) { - // If succesfully remove Placeholder add queued success message. + // If successfully removed Placeholder add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.placeholder) type alias was removed from the #__ucm_content table')); } @@ -1193,7 +1193,7 @@ class com_componentbuilderInstallerScript $library_done = $db->execute(); if ($library_done) { - // If succesfully remove Library add queued success message. + // If successfully remove Library add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library) type alias was removed from the #__content_type table')); } @@ -1208,7 +1208,7 @@ class com_componentbuilderInstallerScript $library_done = $db->execute(); if ($library_done) { - // If succesfully remove Library add queued success message. + // If successfully remove Library add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library) type alias was removed from the #__contentitem_tag_map table')); } @@ -1223,7 +1223,7 @@ class com_componentbuilderInstallerScript $library_done = $db->execute(); if ($library_done) { - // If succesfully remove Library add queued success message. + // If successfully removed Library add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library) type alias was removed from the #__ucm_content table')); } @@ -1279,7 +1279,7 @@ class com_componentbuilderInstallerScript $snippet_done = $db->execute(); if ($snippet_done) { - // If succesfully remove Snippet add queued success message. + // If successfully remove Snippet add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.snippet) type alias was removed from the #__content_type table')); } @@ -1294,7 +1294,7 @@ class com_componentbuilderInstallerScript $snippet_done = $db->execute(); if ($snippet_done) { - // If succesfully remove Snippet add queued success message. + // If successfully remove Snippet add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.snippet) type alias was removed from the #__contentitem_tag_map table')); } @@ -1309,7 +1309,7 @@ class com_componentbuilderInstallerScript $snippet_done = $db->execute(); if ($snippet_done) { - // If succesfully remove Snippet add queued success message. + // If successfully removed Snippet add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.snippet) type alias was removed from the #__ucm_content table')); } @@ -1365,7 +1365,7 @@ class com_componentbuilderInstallerScript $validation_rule_done = $db->execute(); if ($validation_rule_done) { - // If succesfully remove Validation_rule add queued success message. + // If successfully remove Validation_rule add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.validation_rule) type alias was removed from the #__content_type table')); } @@ -1380,7 +1380,7 @@ class com_componentbuilderInstallerScript $validation_rule_done = $db->execute(); if ($validation_rule_done) { - // If succesfully remove Validation_rule add queued success message. + // If successfully remove Validation_rule add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.validation_rule) type alias was removed from the #__contentitem_tag_map table')); } @@ -1395,7 +1395,7 @@ class com_componentbuilderInstallerScript $validation_rule_done = $db->execute(); if ($validation_rule_done) { - // If succesfully remove Validation_rule add queued success message. + // If successfully removed Validation_rule add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.validation_rule) type alias was removed from the #__ucm_content table')); } @@ -1451,7 +1451,7 @@ class com_componentbuilderInstallerScript $field_done = $db->execute(); if ($field_done) { - // If succesfully remove Field add queued success message. + // If successfully remove Field add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.field) type alias was removed from the #__content_type table')); } @@ -1466,7 +1466,7 @@ class com_componentbuilderInstallerScript $field_done = $db->execute(); if ($field_done) { - // If succesfully remove Field add queued success message. + // If successfully remove Field add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.field) type alias was removed from the #__contentitem_tag_map table')); } @@ -1481,7 +1481,7 @@ class com_componentbuilderInstallerScript $field_done = $db->execute(); if ($field_done) { - // If succesfully remove Field add queued success message. + // If successfully removed Field add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.field) type alias was removed from the #__ucm_content table')); } @@ -1537,7 +1537,7 @@ class com_componentbuilderInstallerScript $field_catid_done = $db->execute(); if ($field_catid_done) { - // If succesfully remove Field catid add queued success message. + // If successfully remove Field catid add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.field.category) type alias was removed from the #__content_type table')); } @@ -1552,7 +1552,7 @@ class com_componentbuilderInstallerScript $field_catid_done = $db->execute(); if ($field_catid_done) { - // If succesfully remove Field catid add queued success message. + // If successfully remove Field catid add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.field.category) type alias was removed from the #__contentitem_tag_map table')); } @@ -1567,7 +1567,7 @@ class com_componentbuilderInstallerScript $field_catid_done = $db->execute(); if ($field_catid_done) { - // If succesfully remove Field catid add queued success message. + // If successfully removed Field catid add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.field.category) type alias was removed from the #__ucm_content table')); } @@ -1623,7 +1623,7 @@ class com_componentbuilderInstallerScript $fieldtype_done = $db->execute(); if ($fieldtype_done) { - // If succesfully remove Fieldtype add queued success message. + // If successfully remove Fieldtype add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.fieldtype) type alias was removed from the #__content_type table')); } @@ -1638,7 +1638,7 @@ class com_componentbuilderInstallerScript $fieldtype_done = $db->execute(); if ($fieldtype_done) { - // If succesfully remove Fieldtype add queued success message. + // If successfully remove Fieldtype add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.fieldtype) type alias was removed from the #__contentitem_tag_map table')); } @@ -1653,7 +1653,7 @@ class com_componentbuilderInstallerScript $fieldtype_done = $db->execute(); if ($fieldtype_done) { - // If succesfully remove Fieldtype add queued success message. + // If successfully removed Fieldtype add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.fieldtype) type alias was removed from the #__ucm_content table')); } @@ -1709,7 +1709,7 @@ class com_componentbuilderInstallerScript $fieldtype_catid_done = $db->execute(); if ($fieldtype_catid_done) { - // If succesfully remove Fieldtype catid add queued success message. + // If successfully remove Fieldtype catid add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.fieldtype.category) type alias was removed from the #__content_type table')); } @@ -1724,7 +1724,7 @@ class com_componentbuilderInstallerScript $fieldtype_catid_done = $db->execute(); if ($fieldtype_catid_done) { - // If succesfully remove Fieldtype catid add queued success message. + // If successfully remove Fieldtype catid add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.fieldtype.category) type alias was removed from the #__contentitem_tag_map table')); } @@ -1739,7 +1739,7 @@ class com_componentbuilderInstallerScript $fieldtype_catid_done = $db->execute(); if ($fieldtype_catid_done) { - // If succesfully remove Fieldtype catid add queued success message. + // If successfully removed Fieldtype catid add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.fieldtype.category) type alias was removed from the #__ucm_content table')); } @@ -1795,7 +1795,7 @@ class com_componentbuilderInstallerScript $language_translation_done = $db->execute(); if ($language_translation_done) { - // If succesfully remove Language_translation add queued success message. + // If successfully remove Language_translation add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.language_translation) type alias was removed from the #__content_type table')); } @@ -1810,7 +1810,7 @@ class com_componentbuilderInstallerScript $language_translation_done = $db->execute(); if ($language_translation_done) { - // If succesfully remove Language_translation add queued success message. + // If successfully remove Language_translation add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.language_translation) type alias was removed from the #__contentitem_tag_map table')); } @@ -1825,7 +1825,7 @@ class com_componentbuilderInstallerScript $language_translation_done = $db->execute(); if ($language_translation_done) { - // If succesfully remove Language_translation add queued success message. + // If successfully removed Language_translation add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.language_translation) type alias was removed from the #__ucm_content table')); } @@ -1881,7 +1881,7 @@ class com_componentbuilderInstallerScript $language_done = $db->execute(); if ($language_done) { - // If succesfully remove Language add queued success message. + // If successfully remove Language add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.language) type alias was removed from the #__content_type table')); } @@ -1896,7 +1896,7 @@ class com_componentbuilderInstallerScript $language_done = $db->execute(); if ($language_done) { - // If succesfully remove Language add queued success message. + // If successfully remove Language add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.language) type alias was removed from the #__contentitem_tag_map table')); } @@ -1911,7 +1911,7 @@ class com_componentbuilderInstallerScript $language_done = $db->execute(); if ($language_done) { - // If succesfully remove Language add queued success message. + // If successfully removed Language add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.language) type alias was removed from the #__ucm_content table')); } @@ -1967,7 +1967,7 @@ class com_componentbuilderInstallerScript $server_done = $db->execute(); if ($server_done) { - // If succesfully remove Server add queued success message. + // If successfully remove Server add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.server) type alias was removed from the #__content_type table')); } @@ -1982,7 +1982,7 @@ class com_componentbuilderInstallerScript $server_done = $db->execute(); if ($server_done) { - // If succesfully remove Server add queued success message. + // If successfully remove Server add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.server) type alias was removed from the #__contentitem_tag_map table')); } @@ -1997,7 +1997,7 @@ class com_componentbuilderInstallerScript $server_done = $db->execute(); if ($server_done) { - // If succesfully remove Server add queued success message. + // If successfully removed Server add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.server) type alias was removed from the #__ucm_content table')); } @@ -2053,7 +2053,7 @@ class com_componentbuilderInstallerScript $help_document_done = $db->execute(); if ($help_document_done) { - // If succesfully remove Help_document add queued success message. + // If successfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.help_document) type alias was removed from the #__content_type table')); } @@ -2068,7 +2068,7 @@ class com_componentbuilderInstallerScript $help_document_done = $db->execute(); if ($help_document_done) { - // If succesfully remove Help_document add queued success message. + // If successfully remove Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.help_document) type alias was removed from the #__contentitem_tag_map table')); } @@ -2083,7 +2083,7 @@ class com_componentbuilderInstallerScript $help_document_done = $db->execute(); if ($help_document_done) { - // If succesfully remove Help_document add queued success message. + // If successfully removed Help_document add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.help_document) type alias was removed from the #__ucm_content table')); } @@ -2139,7 +2139,7 @@ class com_componentbuilderInstallerScript $admin_fields_done = $db->execute(); if ($admin_fields_done) { - // If succesfully remove Admin_fields add queued success message. + // If successfully remove Admin_fields add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields) type alias was removed from the #__content_type table')); } @@ -2154,7 +2154,7 @@ class com_componentbuilderInstallerScript $admin_fields_done = $db->execute(); if ($admin_fields_done) { - // If succesfully remove Admin_fields add queued success message. + // If successfully remove Admin_fields add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields) type alias was removed from the #__contentitem_tag_map table')); } @@ -2169,7 +2169,7 @@ class com_componentbuilderInstallerScript $admin_fields_done = $db->execute(); if ($admin_fields_done) { - // If succesfully remove Admin_fields add queued success message. + // If successfully removed Admin_fields add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields) type alias was removed from the #__ucm_content table')); } @@ -2225,7 +2225,7 @@ class com_componentbuilderInstallerScript $admin_fields_conditions_done = $db->execute(); if ($admin_fields_conditions_done) { - // If succesfully remove Admin_fields_conditions add queued success message. + // If successfully remove Admin_fields_conditions add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields_conditions) type alias was removed from the #__content_type table')); } @@ -2240,7 +2240,7 @@ class com_componentbuilderInstallerScript $admin_fields_conditions_done = $db->execute(); if ($admin_fields_conditions_done) { - // If succesfully remove Admin_fields_conditions add queued success message. + // If successfully remove Admin_fields_conditions add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields_conditions) type alias was removed from the #__contentitem_tag_map table')); } @@ -2255,7 +2255,7 @@ class com_componentbuilderInstallerScript $admin_fields_conditions_done = $db->execute(); if ($admin_fields_conditions_done) { - // If succesfully remove Admin_fields_conditions add queued success message. + // If successfully removed Admin_fields_conditions add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields_conditions) type alias was removed from the #__ucm_content table')); } @@ -2311,7 +2311,7 @@ class com_componentbuilderInstallerScript $admin_fields_relations_done = $db->execute(); if ($admin_fields_relations_done) { - // If succesfully remove Admin_fields_relations add queued success message. + // If successfully remove Admin_fields_relations add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields_relations) type alias was removed from the #__content_type table')); } @@ -2326,7 +2326,7 @@ class com_componentbuilderInstallerScript $admin_fields_relations_done = $db->execute(); if ($admin_fields_relations_done) { - // If succesfully remove Admin_fields_relations add queued success message. + // If successfully remove Admin_fields_relations add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields_relations) type alias was removed from the #__contentitem_tag_map table')); } @@ -2341,7 +2341,7 @@ class com_componentbuilderInstallerScript $admin_fields_relations_done = $db->execute(); if ($admin_fields_relations_done) { - // If succesfully remove Admin_fields_relations add queued success message. + // If successfully removed Admin_fields_relations add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_fields_relations) type alias was removed from the #__ucm_content table')); } @@ -2397,7 +2397,7 @@ class com_componentbuilderInstallerScript $admin_custom_tabs_done = $db->execute(); if ($admin_custom_tabs_done) { - // If succesfully remove Admin_custom_tabs add queued success message. + // If successfully remove Admin_custom_tabs add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_custom_tabs) type alias was removed from the #__content_type table')); } @@ -2412,7 +2412,7 @@ class com_componentbuilderInstallerScript $admin_custom_tabs_done = $db->execute(); if ($admin_custom_tabs_done) { - // If succesfully remove Admin_custom_tabs add queued success message. + // If successfully remove Admin_custom_tabs add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_custom_tabs) type alias was removed from the #__contentitem_tag_map table')); } @@ -2427,7 +2427,7 @@ class com_componentbuilderInstallerScript $admin_custom_tabs_done = $db->execute(); if ($admin_custom_tabs_done) { - // If succesfully remove Admin_custom_tabs add queued success message. + // If successfully removed Admin_custom_tabs add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.admin_custom_tabs) type alias was removed from the #__ucm_content table')); } @@ -2483,7 +2483,7 @@ class com_componentbuilderInstallerScript $component_admin_views_done = $db->execute(); if ($component_admin_views_done) { - // If succesfully remove Component_admin_views add queued success message. + // If successfully remove Component_admin_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_admin_views) type alias was removed from the #__content_type table')); } @@ -2498,7 +2498,7 @@ class com_componentbuilderInstallerScript $component_admin_views_done = $db->execute(); if ($component_admin_views_done) { - // If succesfully remove Component_admin_views add queued success message. + // If successfully remove Component_admin_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_admin_views) type alias was removed from the #__contentitem_tag_map table')); } @@ -2513,7 +2513,7 @@ class com_componentbuilderInstallerScript $component_admin_views_done = $db->execute(); if ($component_admin_views_done) { - // If succesfully remove Component_admin_views add queued success message. + // If successfully removed Component_admin_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_admin_views) type alias was removed from the #__ucm_content table')); } @@ -2569,7 +2569,7 @@ class com_componentbuilderInstallerScript $component_site_views_done = $db->execute(); if ($component_site_views_done) { - // If succesfully remove Component_site_views add queued success message. + // If successfully remove Component_site_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_site_views) type alias was removed from the #__content_type table')); } @@ -2584,7 +2584,7 @@ class com_componentbuilderInstallerScript $component_site_views_done = $db->execute(); if ($component_site_views_done) { - // If succesfully remove Component_site_views add queued success message. + // If successfully remove Component_site_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_site_views) type alias was removed from the #__contentitem_tag_map table')); } @@ -2599,7 +2599,7 @@ class com_componentbuilderInstallerScript $component_site_views_done = $db->execute(); if ($component_site_views_done) { - // If succesfully remove Component_site_views add queued success message. + // If successfully removed Component_site_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_site_views) type alias was removed from the #__ucm_content table')); } @@ -2655,7 +2655,7 @@ class com_componentbuilderInstallerScript $component_custom_admin_views_done = $db->execute(); if ($component_custom_admin_views_done) { - // If succesfully remove Component_custom_admin_views add queued success message. + // If successfully remove Component_custom_admin_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_custom_admin_views) type alias was removed from the #__content_type table')); } @@ -2670,7 +2670,7 @@ class com_componentbuilderInstallerScript $component_custom_admin_views_done = $db->execute(); if ($component_custom_admin_views_done) { - // If succesfully remove Component_custom_admin_views add queued success message. + // If successfully remove Component_custom_admin_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_custom_admin_views) type alias was removed from the #__contentitem_tag_map table')); } @@ -2685,7 +2685,7 @@ class com_componentbuilderInstallerScript $component_custom_admin_views_done = $db->execute(); if ($component_custom_admin_views_done) { - // If succesfully remove Component_custom_admin_views add queued success message. + // If successfully removed Component_custom_admin_views add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_custom_admin_views) type alias was removed from the #__ucm_content table')); } @@ -2741,7 +2741,7 @@ class com_componentbuilderInstallerScript $component_updates_done = $db->execute(); if ($component_updates_done) { - // If succesfully remove Component_updates add queued success message. + // If successfully remove Component_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_updates) type alias was removed from the #__content_type table')); } @@ -2756,7 +2756,7 @@ class com_componentbuilderInstallerScript $component_updates_done = $db->execute(); if ($component_updates_done) { - // If succesfully remove Component_updates add queued success message. + // If successfully remove Component_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_updates) type alias was removed from the #__contentitem_tag_map table')); } @@ -2771,7 +2771,7 @@ class com_componentbuilderInstallerScript $component_updates_done = $db->execute(); if ($component_updates_done) { - // If succesfully remove Component_updates add queued success message. + // If successfully removed Component_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_updates) type alias was removed from the #__ucm_content table')); } @@ -2827,7 +2827,7 @@ class com_componentbuilderInstallerScript $component_mysql_tweaks_done = $db->execute(); if ($component_mysql_tweaks_done) { - // If succesfully remove Component_mysql_tweaks add queued success message. + // If successfully remove Component_mysql_tweaks add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_mysql_tweaks) type alias was removed from the #__content_type table')); } @@ -2842,7 +2842,7 @@ class com_componentbuilderInstallerScript $component_mysql_tweaks_done = $db->execute(); if ($component_mysql_tweaks_done) { - // If succesfully remove Component_mysql_tweaks add queued success message. + // If successfully remove Component_mysql_tweaks add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_mysql_tweaks) type alias was removed from the #__contentitem_tag_map table')); } @@ -2857,7 +2857,7 @@ class com_componentbuilderInstallerScript $component_mysql_tweaks_done = $db->execute(); if ($component_mysql_tweaks_done) { - // If succesfully remove Component_mysql_tweaks add queued success message. + // If successfully removed Component_mysql_tweaks add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_mysql_tweaks) type alias was removed from the #__ucm_content table')); } @@ -2913,7 +2913,7 @@ class com_componentbuilderInstallerScript $component_custom_admin_menus_done = $db->execute(); if ($component_custom_admin_menus_done) { - // If succesfully remove Component_custom_admin_menus add queued success message. + // If successfully remove Component_custom_admin_menus add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_custom_admin_menus) type alias was removed from the #__content_type table')); } @@ -2928,7 +2928,7 @@ class com_componentbuilderInstallerScript $component_custom_admin_menus_done = $db->execute(); if ($component_custom_admin_menus_done) { - // If succesfully remove Component_custom_admin_menus add queued success message. + // If successfully remove Component_custom_admin_menus add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_custom_admin_menus) type alias was removed from the #__contentitem_tag_map table')); } @@ -2943,7 +2943,7 @@ class com_componentbuilderInstallerScript $component_custom_admin_menus_done = $db->execute(); if ($component_custom_admin_menus_done) { - // If succesfully remove Component_custom_admin_menus add queued success message. + // If successfully removed Component_custom_admin_menus add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_custom_admin_menus) type alias was removed from the #__ucm_content table')); } @@ -2999,7 +2999,7 @@ class com_componentbuilderInstallerScript $component_config_done = $db->execute(); if ($component_config_done) { - // If succesfully remove Component_config add queued success message. + // If successfully remove Component_config add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_config) type alias was removed from the #__content_type table')); } @@ -3014,7 +3014,7 @@ class com_componentbuilderInstallerScript $component_config_done = $db->execute(); if ($component_config_done) { - // If succesfully remove Component_config add queued success message. + // If successfully remove Component_config add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_config) type alias was removed from the #__contentitem_tag_map table')); } @@ -3029,7 +3029,7 @@ class com_componentbuilderInstallerScript $component_config_done = $db->execute(); if ($component_config_done) { - // If succesfully remove Component_config add queued success message. + // If successfully removed Component_config add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_config) type alias was removed from the #__ucm_content table')); } @@ -3085,7 +3085,7 @@ class com_componentbuilderInstallerScript $component_dashboard_done = $db->execute(); if ($component_dashboard_done) { - // If succesfully remove Component_dashboard add queued success message. + // If successfully remove Component_dashboard add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_dashboard) type alias was removed from the #__content_type table')); } @@ -3100,7 +3100,7 @@ class com_componentbuilderInstallerScript $component_dashboard_done = $db->execute(); if ($component_dashboard_done) { - // If succesfully remove Component_dashboard add queued success message. + // If successfully remove Component_dashboard add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_dashboard) type alias was removed from the #__contentitem_tag_map table')); } @@ -3115,7 +3115,7 @@ class com_componentbuilderInstallerScript $component_dashboard_done = $db->execute(); if ($component_dashboard_done) { - // If succesfully remove Component_dashboard add queued success message. + // If successfully removed Component_dashboard add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_dashboard) type alias was removed from the #__ucm_content table')); } @@ -3171,7 +3171,7 @@ class com_componentbuilderInstallerScript $component_files_folders_done = $db->execute(); if ($component_files_folders_done) { - // If succesfully remove Component_files_folders add queued success message. + // If successfully remove Component_files_folders add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_files_folders) type alias was removed from the #__content_type table')); } @@ -3186,7 +3186,7 @@ class com_componentbuilderInstallerScript $component_files_folders_done = $db->execute(); if ($component_files_folders_done) { - // If succesfully remove Component_files_folders add queued success message. + // If successfully remove Component_files_folders add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_files_folders) type alias was removed from the #__contentitem_tag_map table')); } @@ -3201,7 +3201,7 @@ class com_componentbuilderInstallerScript $component_files_folders_done = $db->execute(); if ($component_files_folders_done) { - // If succesfully remove Component_files_folders add queued success message. + // If successfully removed Component_files_folders add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_files_folders) type alias was removed from the #__ucm_content table')); } @@ -3257,7 +3257,7 @@ class com_componentbuilderInstallerScript $component_placeholders_done = $db->execute(); if ($component_placeholders_done) { - // If succesfully remove Component_placeholders add queued success message. + // If successfully remove Component_placeholders add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_placeholders) type alias was removed from the #__content_type table')); } @@ -3272,7 +3272,7 @@ class com_componentbuilderInstallerScript $component_placeholders_done = $db->execute(); if ($component_placeholders_done) { - // If succesfully remove Component_placeholders add queued success message. + // If successfully remove Component_placeholders add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_placeholders) type alias was removed from the #__contentitem_tag_map table')); } @@ -3287,7 +3287,7 @@ class com_componentbuilderInstallerScript $component_placeholders_done = $db->execute(); if ($component_placeholders_done) { - // If succesfully remove Component_placeholders add queued success message. + // If successfully removed Component_placeholders add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_placeholders) type alias was removed from the #__ucm_content table')); } @@ -3343,7 +3343,7 @@ class com_componentbuilderInstallerScript $component_plugins_done = $db->execute(); if ($component_plugins_done) { - // If succesfully remove Component_plugins add queued success message. + // If successfully remove Component_plugins add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the #__content_type table')); } @@ -3358,7 +3358,7 @@ class com_componentbuilderInstallerScript $component_plugins_done = $db->execute(); if ($component_plugins_done) { - // If succesfully remove Component_plugins add queued success message. + // If successfully remove Component_plugins add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the #__contentitem_tag_map table')); } @@ -3373,7 +3373,7 @@ class com_componentbuilderInstallerScript $component_plugins_done = $db->execute(); if ($component_plugins_done) { - // If succesfully remove Component_plugins add queued success message. + // If successfully removed Component_plugins add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_plugins) type alias was removed from the #__ucm_content table')); } @@ -3429,7 +3429,7 @@ class com_componentbuilderInstallerScript $component_modules_done = $db->execute(); if ($component_modules_done) { - // If succesfully remove Component_modules add queued success message. + // If successfully remove Component_modules add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_modules) type alias was removed from the #__content_type table')); } @@ -3444,7 +3444,7 @@ class com_componentbuilderInstallerScript $component_modules_done = $db->execute(); if ($component_modules_done) { - // If succesfully remove Component_modules add queued success message. + // If successfully remove Component_modules add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_modules) type alias was removed from the #__contentitem_tag_map table')); } @@ -3459,7 +3459,7 @@ class com_componentbuilderInstallerScript $component_modules_done = $db->execute(); if ($component_modules_done) { - // If succesfully remove Component_modules add queued success message. + // If successfully removed Component_modules add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.component_modules) type alias was removed from the #__ucm_content table')); } @@ -3515,7 +3515,7 @@ class com_componentbuilderInstallerScript $snippet_type_done = $db->execute(); if ($snippet_type_done) { - // If succesfully remove Snippet_type add queued success message. + // If successfully remove Snippet_type add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.snippet_type) type alias was removed from the #__content_type table')); } @@ -3530,7 +3530,7 @@ class com_componentbuilderInstallerScript $snippet_type_done = $db->execute(); if ($snippet_type_done) { - // If succesfully remove Snippet_type add queued success message. + // If successfully remove Snippet_type add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.snippet_type) type alias was removed from the #__contentitem_tag_map table')); } @@ -3545,7 +3545,7 @@ class com_componentbuilderInstallerScript $snippet_type_done = $db->execute(); if ($snippet_type_done) { - // If succesfully remove Snippet_type add queued success message. + // If successfully removed Snippet_type add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.snippet_type) type alias was removed from the #__ucm_content table')); } @@ -3601,7 +3601,7 @@ class com_componentbuilderInstallerScript $library_config_done = $db->execute(); if ($library_config_done) { - // If succesfully remove Library_config add queued success message. + // If successfully remove Library_config add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library_config) type alias was removed from the #__content_type table')); } @@ -3616,7 +3616,7 @@ class com_componentbuilderInstallerScript $library_config_done = $db->execute(); if ($library_config_done) { - // If succesfully remove Library_config add queued success message. + // If successfully remove Library_config add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library_config) type alias was removed from the #__contentitem_tag_map table')); } @@ -3631,7 +3631,7 @@ class com_componentbuilderInstallerScript $library_config_done = $db->execute(); if ($library_config_done) { - // If succesfully remove Library_config add queued success message. + // If successfully removed Library_config add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library_config) type alias was removed from the #__ucm_content table')); } @@ -3687,7 +3687,7 @@ class com_componentbuilderInstallerScript $library_files_folders_urls_done = $db->execute(); if ($library_files_folders_urls_done) { - // If succesfully remove Library_files_folders_urls add queued success message. + // If successfully remove Library_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library_files_folders_urls) type alias was removed from the #__content_type table')); } @@ -3702,7 +3702,7 @@ class com_componentbuilderInstallerScript $library_files_folders_urls_done = $db->execute(); if ($library_files_folders_urls_done) { - // If succesfully remove Library_files_folders_urls add queued success message. + // If successfully remove Library_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library_files_folders_urls) type alias was removed from the #__contentitem_tag_map table')); } @@ -3717,7 +3717,7 @@ class com_componentbuilderInstallerScript $library_files_folders_urls_done = $db->execute(); if ($library_files_folders_urls_done) { - // If succesfully remove Library_files_folders_urls add queued success message. + // If successfully removed Library_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.library_files_folders_urls) type alias was removed from the #__ucm_content table')); } @@ -3773,7 +3773,7 @@ class com_componentbuilderInstallerScript $class_extends_done = $db->execute(); if ($class_extends_done) { - // If succesfully remove Class_extends add queued success message. + // If successfully remove Class_extends add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_extends) type alias was removed from the #__content_type table')); } @@ -3788,7 +3788,7 @@ class com_componentbuilderInstallerScript $class_extends_done = $db->execute(); if ($class_extends_done) { - // If succesfully remove Class_extends add queued success message. + // If successfully remove Class_extends add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_extends) type alias was removed from the #__contentitem_tag_map table')); } @@ -3803,7 +3803,7 @@ class com_componentbuilderInstallerScript $class_extends_done = $db->execute(); if ($class_extends_done) { - // If succesfully remove Class_extends add queued success message. + // If successfully removed Class_extends add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.class_extends) type alias was removed from the #__ucm_content table')); } @@ -3859,7 +3859,7 @@ class com_componentbuilderInstallerScript $joomla_module_updates_done = $db->execute(); if ($joomla_module_updates_done) { - // If succesfully remove Joomla_module_updates add queued success message. + // If successfully remove Joomla_module_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module_updates) type alias was removed from the #__content_type table')); } @@ -3874,7 +3874,7 @@ class com_componentbuilderInstallerScript $joomla_module_updates_done = $db->execute(); if ($joomla_module_updates_done) { - // If succesfully remove Joomla_module_updates add queued success message. + // If successfully remove Joomla_module_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module_updates) type alias was removed from the #__contentitem_tag_map table')); } @@ -3889,7 +3889,7 @@ class com_componentbuilderInstallerScript $joomla_module_updates_done = $db->execute(); if ($joomla_module_updates_done) { - // If succesfully remove Joomla_module_updates add queued success message. + // If successfully removed Joomla_module_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module_updates) type alias was removed from the #__ucm_content table')); } @@ -3945,7 +3945,7 @@ class com_componentbuilderInstallerScript $joomla_module_files_folders_urls_done = $db->execute(); if ($joomla_module_files_folders_urls_done) { - // If succesfully remove Joomla_module_files_folders_urls add queued success message. + // If successfully remove Joomla_module_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module_files_folders_urls) type alias was removed from the #__content_type table')); } @@ -3960,7 +3960,7 @@ class com_componentbuilderInstallerScript $joomla_module_files_folders_urls_done = $db->execute(); if ($joomla_module_files_folders_urls_done) { - // If succesfully remove Joomla_module_files_folders_urls add queued success message. + // If successfully remove Joomla_module_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module_files_folders_urls) type alias was removed from the #__contentitem_tag_map table')); } @@ -3975,7 +3975,7 @@ class com_componentbuilderInstallerScript $joomla_module_files_folders_urls_done = $db->execute(); if ($joomla_module_files_folders_urls_done) { - // If succesfully remove Joomla_module_files_folders_urls add queued success message. + // If successfully removed Joomla_module_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_module_files_folders_urls) type alias was removed from the #__ucm_content table')); } @@ -4031,7 +4031,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_group_done = $db->execute(); if ($joomla_plugin_group_done) { - // If succesfully remove Joomla_plugin_group add queued success message. + // If successfully remove Joomla_plugin_group add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_group) type alias was removed from the #__content_type table')); } @@ -4046,7 +4046,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_group_done = $db->execute(); if ($joomla_plugin_group_done) { - // If succesfully remove Joomla_plugin_group add queued success message. + // If successfully remove Joomla_plugin_group add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_group) type alias was removed from the #__contentitem_tag_map table')); } @@ -4061,7 +4061,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_group_done = $db->execute(); if ($joomla_plugin_group_done) { - // If succesfully remove Joomla_plugin_group add queued success message. + // If successfully removed Joomla_plugin_group add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_group) type alias was removed from the #__ucm_content table')); } @@ -4117,7 +4117,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_updates_done = $db->execute(); if ($joomla_plugin_updates_done) { - // If succesfully remove Joomla_plugin_updates add queued success message. + // If successfully remove Joomla_plugin_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_updates) type alias was removed from the #__content_type table')); } @@ -4132,7 +4132,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_updates_done = $db->execute(); if ($joomla_plugin_updates_done) { - // If succesfully remove Joomla_plugin_updates add queued success message. + // If successfully remove Joomla_plugin_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_updates) type alias was removed from the #__contentitem_tag_map table')); } @@ -4147,7 +4147,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_updates_done = $db->execute(); if ($joomla_plugin_updates_done) { - // If succesfully remove Joomla_plugin_updates add queued success message. + // If successfully removed Joomla_plugin_updates add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_updates) type alias was removed from the #__ucm_content table')); } @@ -4203,7 +4203,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_files_folders_urls_done = $db->execute(); if ($joomla_plugin_files_folders_urls_done) { - // If succesfully remove Joomla_plugin_files_folders_urls add queued success message. + // If successfully remove Joomla_plugin_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_files_folders_urls) type alias was removed from the #__content_type table')); } @@ -4218,7 +4218,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_files_folders_urls_done = $db->execute(); if ($joomla_plugin_files_folders_urls_done) { - // If succesfully remove Joomla_plugin_files_folders_urls add queued success message. + // If successfully remove Joomla_plugin_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_files_folders_urls) type alias was removed from the #__contentitem_tag_map table')); } @@ -4233,7 +4233,7 @@ class com_componentbuilderInstallerScript $joomla_plugin_files_folders_urls_done = $db->execute(); if ($joomla_plugin_files_folders_urls_done) { - // If succesfully remove Joomla_plugin_files_folders_urls add queued success message. + // If successfully removed Joomla_plugin_files_folders_urls add queued success message. $app->enqueueMessage(JText::_('The (com_componentbuilder.joomla_plugin_files_folders_urls) type alias was removed from the #__ucm_content table')); } @@ -4277,10 +4277,31 @@ class com_componentbuilderInstallerScript $joomla_plugin_files_folders_urls_done = $db->execute(); if ($joomla_plugin_files_folders_urls_done) { - // If succesfully remove componentbuilder add queued success message. + // If successfully removed componentbuilder add queued success message. $app->enqueueMessage(JText::_('All related items was removed from the #__assets table')); } + // Get the biggest rule column in the assets table at this point. + $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $db->setQuery($get_rule_length); + if ($db->execute()) + { + $rule_length = $db->loadResult(); + // Check the size of the rules column + if ($rule_length < 5120) + { + // Revert the assets table rules column back to the default + $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; + $db->setQuery($revert_rule); + $db->execute(); + $app->enqueueMessage(JText::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); + } + else + { + + $app->enqueueMessage(JText::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); + } + } // Set db if not set already. if (!isset($db)) @@ -6003,9 +6024,9 @@ class com_componentbuilderInstallerScript $joomla_component->type_title = 'Componentbuilder Joomla_component'; $joomla_component->type_alias = 'com_componentbuilder.joomla_component'; $joomla_component->table = '{"special": {"dbtable": "#__componentbuilder_joomla_component","key": "id","type": "Joomla_component","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_helper_both","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","add_php_helper_admin":"add_php_helper_admin","addfootable":"addfootable","crowdin_username":"crowdin_username","update_server_url":"update_server_url","add_sql":"add_sql","add_php_preflight_update":"add_php_preflight_update","add_css_site":"add_css_site","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","add_php_helper_site":"add_php_helper_site","add_javascript":"add_javascript","description":"description","dashboard":"dashboard","author":"author","add_php_postflight_update":"add_php_postflight_update","email":"email","addreadme":"addreadme","website":"website","debug_linenr":"debug_linenr","add_license":"add_license","buildcompsql":"buildcompsql","license_type":"license_type","add_php_helper_both":"add_php_helper_both","add_admin_event":"add_admin_event","whmcs_key":"whmcs_key","add_site_event":"add_site_event","whmcs_url":"whmcs_url","add_css_admin":"add_css_admin","whmcs_buy_link":"whmcs_buy_link","dashboard_type":"dashboard_type","license":"license","add_php_preflight_install":"add_php_preflight_install","bom":"bom","add_php_postflight_install":"add_php_postflight_install","image":"image","add_php_method_uninstall":"add_php_method_uninstall","copyright":"copyright","add_sql_uninstall":"add_sql_uninstall","translation_tool":"translation_tool","component_version":"component_version","add_sales_server":"add_sales_server","not_required":"not_required","crowdin_project_identifier":"crowdin_project_identifier","add_email_helper":"add_email_helper","php_helper_both":"php_helper_both","php_helper_admin":"php_helper_admin","php_admin_event":"php_admin_event","php_helper_site":"php_helper_site","php_site_event":"php_site_event","add_menu_prefix":"add_menu_prefix","javascript":"javascript","menu_prefix":"menu_prefix","css_admin":"css_admin","css_site":"css_site","toignore":"toignore","php_preflight_install":"php_preflight_install","php_preflight_update":"php_preflight_update","export_key":"export_key","php_postflight_install":"php_postflight_install","joomla_source_link":"joomla_source_link","php_postflight_update":"php_postflight_update","export_buy_link":"export_buy_link","php_method_uninstall":"php_method_uninstall","sql":"sql","sql_uninstall":"sql_uninstall","readme":"readme","emptycontributors":"emptycontributors","add_update_server":"add_update_server","number":"number","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","crowdin_project_api_key":"crowdin_project_api_key","crowdin_account_api_key":"crowdin_account_api_key","creatuserhelper":"creatuserhelper","buildcomp":"buildcomp","adduikit":"adduikit","guid":"guid","name":"name"}}'; + $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_site_event","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","php_site_event":"php_site_event","css_admin":"css_admin","php_helper_both":"php_helper_both","php_admin_event":"php_admin_event","sql_uninstall":"sql_uninstall","remove_line_breaks":"remove_line_breaks","description":"description","php_postflight_install":"php_postflight_install","debug_linenr":"debug_linenr","mvc_versiondate":"mvc_versiondate","php_preflight_install":"php_preflight_install","crowdin_project_identifier":"crowdin_project_identifier","php_method_uninstall":"php_method_uninstall","component_version":"component_version","add_placeholders":"add_placeholders","add_sales_server":"add_sales_server","author":"author","email":"email","add_email_helper":"add_email_helper","website":"website","php_helper_admin":"php_helper_admin","add_license":"add_license","php_helper_site":"php_helper_site","license_type":"license_type","javascript":"javascript","css_site":"css_site","whmcs_key":"whmcs_key","whmcs_url":"whmcs_url","php_preflight_update":"php_preflight_update","whmcs_buy_link":"whmcs_buy_link","php_postflight_update":"php_postflight_update","license":"license","sql":"sql","bom":"bom","addreadme":"addreadme","image":"image","update_server_url":"update_server_url","copyright":"copyright","not_required":"not_required","translation_tool":"translation_tool","crowdin_username":"crowdin_username","buildcompsql":"buildcompsql","addfootable":"addfootable","add_php_helper_both":"add_php_helper_both","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_javascript":"add_javascript","add_menu_prefix":"add_menu_prefix","add_css_admin":"add_css_admin","menu_prefix":"menu_prefix","add_css_site":"add_css_site","dashboard_type":"dashboard_type","dashboard":"dashboard","toignore":"toignore","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","add_php_postflight_install":"add_php_postflight_install","export_key":"export_key","add_php_postflight_update":"add_php_postflight_update","joomla_source_link":"joomla_source_link","add_php_method_uninstall":"add_php_method_uninstall","export_buy_link":"export_buy_link","add_sql":"add_sql","add_sql_uninstall":"add_sql_uninstall","assets_table_fix":"assets_table_fix","readme":"readme","emptycontributors":"emptycontributors","add_update_server":"add_update_server","number":"number","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","crowdin_project_api_key":"crowdin_project_api_key","crowdin_account_api_key":"crowdin_account_api_key","creatuserhelper":"creatuserhelper","buildcomp":"buildcomp","adduikit":"adduikit","guid":"guid","name":"name"}}'; $joomla_component->router = 'ComponentbuilderHelperRoute::getJoomla_componentRoute'; - $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add_php_helper_admin","addfootable","add_sql","add_php_preflight_update","add_css_site","mvc_versiondate","remove_line_breaks","add_placeholders","add_php_helper_site","add_javascript","add_php_postflight_update","addreadme","debug_linenr","add_license","license_type","add_php_helper_both","add_admin_event","add_site_event","add_css_admin","dashboard_type","add_php_preflight_install","add_php_postflight_install","add_php_method_uninstall","add_sql_uninstall","translation_tool","add_sales_server","add_email_helper","emptycontributors","add_update_server","number","update_server_target","update_server","sales_server","creatuserhelper","buildcomp","adduikit"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; + $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","remove_line_breaks","debug_linenr","mvc_versiondate","add_placeholders","add_sales_server","add_email_helper","add_license","license_type","addreadme","translation_tool","addfootable","add_php_helper_both","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","emptycontributors","add_update_server","number","update_server_target","update_server","sales_server","creatuserhelper","buildcomp","adduikit"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $joomla_component_Inserted = $db->insertObject('#__content_types', $joomla_component); @@ -6591,7 +6612,7 @@ class com_componentbuilderInstallerScript $query = $db->getQuery(true); // Field to update. $fields = array( - $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","subform_layouts":"default","editor":"none","manage_jcb_package_directories":"2","add_menu_prefix":"1","menu_prefix":"»","minify":"0","set_browser_storage":"1","storage_time_to_live":"global","language":"en-GB","percentagelanguageadd":"50","export_language_strings":"1","compiler_field_builder_type":"2","field_name_builder":"1","type_name_builder":"1","development_method":"1","expansion":"0","return_options_build":"2","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'), + $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","subform_layouts":"default","editor":"none","manage_jcb_package_directories":"2","set_browser_storage":"1","storage_time_to_live":"global","add_menu_prefix":"1","menu_prefix":"»","minify":"0","language":"en-GB","percentagelanguageadd":"50","export_language_strings":"1","assets_table_fix":"1","compiler_field_builder_type":"2","field_name_builder":"1","type_name_builder":"1","development_method":"1","expansion":"0","return_options_build":"2","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'), ); // Condition. $conditions = array( @@ -6601,6 +6622,22 @@ class com_componentbuilderInstallerScript $db->setQuery($query); $allDone = $db->execute(); + // Get the biggest rule column in the assets table at this point. + $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; + $db->setQuery($get_rule_length); + if ($db->execute()) + { + $rule_length = $db->loadResult(); + // Check the size of the rules column + if ($rule_length <= 94240) + { + // Fix the assets table rules column size + $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to MEDIUMTEXT by JCB';"; + $db->setQuery($fix_rules_size); + $db->execute(); + $app->enqueueMessage(JText::_('The #__assets table rules column was resized to the MEDIUMTEXT datatype for the components possible large permission rules.')); + } + } echo ' '; @@ -7428,9 +7465,9 @@ class com_componentbuilderInstallerScript $joomla_component->type_title = 'Componentbuilder Joomla_component'; $joomla_component->type_alias = 'com_componentbuilder.joomla_component'; $joomla_component->table = '{"special": {"dbtable": "#__componentbuilder_joomla_component","key": "id","type": "Joomla_component","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_helper_both","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","add_php_helper_admin":"add_php_helper_admin","addfootable":"addfootable","crowdin_username":"crowdin_username","update_server_url":"update_server_url","add_sql":"add_sql","add_php_preflight_update":"add_php_preflight_update","add_css_site":"add_css_site","mvc_versiondate":"mvc_versiondate","remove_line_breaks":"remove_line_breaks","add_placeholders":"add_placeholders","add_php_helper_site":"add_php_helper_site","add_javascript":"add_javascript","description":"description","dashboard":"dashboard","author":"author","add_php_postflight_update":"add_php_postflight_update","email":"email","addreadme":"addreadme","website":"website","debug_linenr":"debug_linenr","add_license":"add_license","buildcompsql":"buildcompsql","license_type":"license_type","add_php_helper_both":"add_php_helper_both","add_admin_event":"add_admin_event","whmcs_key":"whmcs_key","add_site_event":"add_site_event","whmcs_url":"whmcs_url","add_css_admin":"add_css_admin","whmcs_buy_link":"whmcs_buy_link","dashboard_type":"dashboard_type","license":"license","add_php_preflight_install":"add_php_preflight_install","bom":"bom","add_php_postflight_install":"add_php_postflight_install","image":"image","add_php_method_uninstall":"add_php_method_uninstall","copyright":"copyright","add_sql_uninstall":"add_sql_uninstall","translation_tool":"translation_tool","component_version":"component_version","add_sales_server":"add_sales_server","not_required":"not_required","crowdin_project_identifier":"crowdin_project_identifier","add_email_helper":"add_email_helper","php_helper_both":"php_helper_both","php_helper_admin":"php_helper_admin","php_admin_event":"php_admin_event","php_helper_site":"php_helper_site","php_site_event":"php_site_event","add_menu_prefix":"add_menu_prefix","javascript":"javascript","menu_prefix":"menu_prefix","css_admin":"css_admin","css_site":"css_site","toignore":"toignore","php_preflight_install":"php_preflight_install","php_preflight_update":"php_preflight_update","export_key":"export_key","php_postflight_install":"php_postflight_install","joomla_source_link":"joomla_source_link","php_postflight_update":"php_postflight_update","export_buy_link":"export_buy_link","php_method_uninstall":"php_method_uninstall","sql":"sql","sql_uninstall":"sql_uninstall","readme":"readme","emptycontributors":"emptycontributors","add_update_server":"add_update_server","number":"number","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","crowdin_project_api_key":"crowdin_project_api_key","crowdin_account_api_key":"crowdin_account_api_key","creatuserhelper":"creatuserhelper","buildcomp":"buildcomp","adduikit":"adduikit","guid":"guid","name":"name"}}'; + $joomla_component->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "system_name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "php_site_event","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_code":"name_code","short_description":"short_description","companyname":"companyname","php_site_event":"php_site_event","css_admin":"css_admin","php_helper_both":"php_helper_both","php_admin_event":"php_admin_event","sql_uninstall":"sql_uninstall","remove_line_breaks":"remove_line_breaks","description":"description","php_postflight_install":"php_postflight_install","debug_linenr":"debug_linenr","mvc_versiondate":"mvc_versiondate","php_preflight_install":"php_preflight_install","crowdin_project_identifier":"crowdin_project_identifier","php_method_uninstall":"php_method_uninstall","component_version":"component_version","add_placeholders":"add_placeholders","add_sales_server":"add_sales_server","author":"author","email":"email","add_email_helper":"add_email_helper","website":"website","php_helper_admin":"php_helper_admin","add_license":"add_license","php_helper_site":"php_helper_site","license_type":"license_type","javascript":"javascript","css_site":"css_site","whmcs_key":"whmcs_key","whmcs_url":"whmcs_url","php_preflight_update":"php_preflight_update","whmcs_buy_link":"whmcs_buy_link","php_postflight_update":"php_postflight_update","license":"license","sql":"sql","bom":"bom","addreadme":"addreadme","image":"image","update_server_url":"update_server_url","copyright":"copyright","not_required":"not_required","translation_tool":"translation_tool","crowdin_username":"crowdin_username","buildcompsql":"buildcompsql","addfootable":"addfootable","add_php_helper_both":"add_php_helper_both","add_php_helper_admin":"add_php_helper_admin","add_admin_event":"add_admin_event","add_php_helper_site":"add_php_helper_site","add_site_event":"add_site_event","add_javascript":"add_javascript","add_menu_prefix":"add_menu_prefix","add_css_admin":"add_css_admin","menu_prefix":"menu_prefix","add_css_site":"add_css_site","dashboard_type":"dashboard_type","dashboard":"dashboard","toignore":"toignore","add_php_preflight_install":"add_php_preflight_install","add_php_preflight_update":"add_php_preflight_update","add_php_postflight_install":"add_php_postflight_install","export_key":"export_key","add_php_postflight_update":"add_php_postflight_update","joomla_source_link":"joomla_source_link","add_php_method_uninstall":"add_php_method_uninstall","export_buy_link":"export_buy_link","add_sql":"add_sql","add_sql_uninstall":"add_sql_uninstall","assets_table_fix":"assets_table_fix","readme":"readme","emptycontributors":"emptycontributors","add_update_server":"add_update_server","number":"number","update_server_target":"update_server_target","update_server":"update_server","sales_server":"sales_server","crowdin_project_api_key":"crowdin_project_api_key","crowdin_account_api_key":"crowdin_account_api_key","creatuserhelper":"creatuserhelper","buildcomp":"buildcomp","adduikit":"adduikit","guid":"guid","name":"name"}}'; $joomla_component->router = 'ComponentbuilderHelperRoute::getJoomla_componentRoute'; - $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add_php_helper_admin","addfootable","add_sql","add_php_preflight_update","add_css_site","mvc_versiondate","remove_line_breaks","add_placeholders","add_php_helper_site","add_javascript","add_php_postflight_update","addreadme","debug_linenr","add_license","license_type","add_php_helper_both","add_admin_event","add_site_event","add_css_admin","dashboard_type","add_php_preflight_install","add_php_postflight_install","add_php_method_uninstall","add_sql_uninstall","translation_tool","add_sales_server","add_email_helper","emptycontributors","add_update_server","number","update_server_target","update_server","sales_server","creatuserhelper","buildcomp","adduikit"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; + $joomla_component->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/joomla_component.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","remove_line_breaks","debug_linenr","mvc_versiondate","add_placeholders","add_sales_server","add_email_helper","add_license","license_type","addreadme","translation_tool","addfootable","add_php_helper_both","add_php_helper_admin","add_admin_event","add_php_helper_site","add_site_event","add_javascript","add_css_admin","add_css_site","dashboard_type","add_php_preflight_install","add_php_preflight_update","add_php_postflight_install","add_php_postflight_update","add_php_method_uninstall","add_sql","add_sql_uninstall","assets_table_fix","emptycontributors","add_update_server","number","update_server_target","update_server","sales_server","creatuserhelper","buildcomp","adduikit"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "dashboard","targetTable": "#__componentbuilder_custom_admin_view","targetColumn": "","displayColumn": "system_name"},{"sourceColumn": "update_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "sales_server","targetTable": "#__componentbuilder_server","targetColumn": "id","displayColumn": "name"}]}'; // Check if joomla_component type is already in content_type DB. $joomla_component_id = null; @@ -9213,7 +9250,7 @@ class com_componentbuilderInstallerScript echo ' -

Upgrade to Version 2.11.7 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 2.12.2 Was Successful! Let us know if anything is not working as expected.

'; // Set db if not set already. if (!isset($db)) diff --git a/site/controllers/api.php b/site/controllers/api.php index df5a7a0ce..e8fecabc7 100644 --- a/site/controllers/api.php +++ b/site/controllers/api.php @@ -368,7 +368,7 @@ class ComponentbuilderControllerApi extends JControllerForm $subject = JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY'); // email the message componentbuilderEmail::send($email, $subject, componentbuilderEmail::setTableBody($message, $subject), $plainText, 1); - $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND'); + $backupNotice[] = JText::_('COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT'); } else { diff --git a/site/language/en-GB/en-GB.com_componentbuilder.ini b/site/language/en-GB/en-GB.com_componentbuilder.ini index e6d145027..08b50de4a 100644 --- a/site/language/en-GB/en-GB.com_componentbuilder.ini +++ b/site/language/en-GB/en-GB.com_componentbuilder.ini @@ -25,7 +25,7 @@ COM_COMPONENTBUILDER_DTWEBSITEDTDDSDD="
Website
%s
" COM_COMPONENTBUILDER_EDIT="Edit" COM_COMPONENTBUILDER_EDIT_S="Edit %s" COM_COMPONENTBUILDER_EMAIL_S="Email: %s" -COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND="Email with the new key was send" +COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SENT="Email with the new key was sent" COM_COMPONENTBUILDER_EMCOMPANYEM_BSB="Company: %s" COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB="Copyright: %s" COM_COMPONENTBUILDER_EMEMAILEM_BSB="Email: %s" diff --git a/site/views/api/tmpl/default.php b/site/views/api/tmpl/default.php index 4213956ce..c9b7fea36 100644 --- a/site/views/api/tmpl/default.php +++ b/site/views/api/tmpl/default.php @@ -12,6 +12,7 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); + ?>
diff --git a/site/views/api/view.html.php b/site/views/api/view.html.php index 24ebcf871..064990e54 100644 --- a/site/views/api/view.html.php +++ b/site/views/api/view.html.php @@ -85,8 +85,6 @@ class ComponentbuilderViewApi extends JViewLegacy */ protected function addToolBar() { - // adding the joomla toolbar to the front - JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php'); // set help url for this view if found $help_url = ComponentbuilderHelper::getHelpUrl('api');