From 37d3f1425ea79a5ac5565c43f457a8cf26b1da3e Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 7 Jun 2019 16:59:27 +0200 Subject: [PATCH] fixed gh-419 to correctly load the category filter (extention and view name) --- README.md | 2 +- admin/README.txt | 2 +- admin/helpers/compiler/a_Get.php | 8 +++++--- admin/helpers/compiler/e_Interpretation.php | 20 ++++++-------------- admin/helpers/compiler/f_Infusion.php | 2 +- admin/views/fields/view.html.php | 4 ++-- admin/views/fieldtypes/view.html.php | 4 ++-- componentbuilder.xml | 2 +- 8 files changed, 19 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 31233e8df..47dc1de05 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ 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*: 5th June, 2019 ++ *Last Build*: 7th June, 2019 + *Version*: 2.9.18 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/README.txt b/admin/README.txt index 31233e8df..47dc1de05 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -146,7 +146,7 @@ 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*: 5th June, 2019 ++ *Last Build*: 7th June, 2019 + *Version*: 2.9.18 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index dc9b2c255..3d5c81d8b 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -2900,11 +2900,13 @@ class Get if (ComponentbuilderHelper::checkString($listViewName)) { // check if we should use another Text Name as this views name - $otherName = ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'); - $otherViews = ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'); - $otherView = ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'); + $otherName = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'), $this->placeholders); + $otherViews = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'), $this->placeholders); + $otherView = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'), $this->placeholders); + // This is to link other view category if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView)) { + // set other category details $this->catOtherName[$listViewName] = array( 'name' => ComponentbuilderHelper::safeString($otherName), 'views' => ComponentbuilderHelper::safeString($otherViews), diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index f80750831..4c7798ac5 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -10947,21 +10947,13 @@ class Interpretation extends Fields return ''; } - public function setCategoryFilter($viewName_single, $viewName_list) + public function setCategoryFilter($viewName_list) { - if (isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list])) + if (isset($this->categoryBuilder[$viewName_list]) + && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list]) + && isset($this->categoryBuilder[$viewName_list]['extension'])) { - // check if category has another name - if (isset($this->catOtherName[$viewName_list]) && ComponentbuilderHelper::checkArray($this->catOtherName[$viewName_list])) - { - $targetView = "." . $this->catOtherName[$viewName_list]['view']; - } - else - { - $targetView = "." . $viewName_single; - } // set component name - $component = ComponentbuilderHelper::safeString($this->componentData->name_code); $COPMONENT = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U'); // set filter $filter = array(); @@ -10969,7 +10961,7 @@ class Interpretation extends Fields $filter[] = $this->_t(2) . "JHtmlSidebar::addFilter("; $filter[] = $this->_t(3) . "JText:" . ":_('JOPTION_SELECT_CATEGORY'),"; $filter[] = $this->_t(3) . "'filter_category_id',"; - $filter[] = $this->_t(3) . "JHtml::_('select.options', JHtml::_('category.options', 'com_" . $component . $targetView . "'), 'value', 'text', \$this->state->get('filter.category_id'))"; + $filter[] = $this->_t(3) . "JHtml::_('select.options', JHtml::_('category.options', '" . $this->categoryBuilder[$viewName_list]['extension'] . "'), 'value', 'text', \$this->state->get('filter.category_id'))"; $filter[] = $this->_t(2) . ");"; @@ -10979,7 +10971,7 @@ class Interpretation extends Fields $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', 'com_" . $component . $targetView . "'), 'value', 'text')"; + $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) . "}"; diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 38abc6df4..af5d955c4 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -438,7 +438,7 @@ class Infusion extends Interpretation $this->fileContentDynamic[$viewName_list][$this->hhh . 'SORTFIELDS' . $this->hhh] = $this->setSortFields($viewName_list); // CATEGORYFILTER <<>> - $this->fileContentDynamic[$viewName_list][$this->hhh . 'CATEGORYFILTER' . $this->hhh] = $this->setCategoryFilter($viewName_single, $viewName_list); + $this->fileContentDynamic[$viewName_list][$this->hhh . 'CATEGORYFILTER' . $this->hhh] = $this->setCategoryFilter($viewName_list); // CATEGORY_VIEWS if (!isset($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh])) diff --git a/admin/views/fields/view.html.php b/admin/views/fields/view.html.php index 95dae2132..a6aa8de80 100644 --- a/admin/views/fields/view.html.php +++ b/admin/views/fields/view.html.php @@ -195,7 +195,7 @@ class ComponentbuilderViewFields extends JViewLegacy 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')) + JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.fields'), 'value', 'text', $this->state->get('filter.category_id')) ); if ($this->canBatch && $this->canCreate && $this->canEdit) @@ -204,7 +204,7 @@ class ComponentbuilderViewFields extends JViewLegacy JHtmlBatch_::addListSelection( JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_CATEGORY'), 'batch[category]', - JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.field'), 'value', 'text') + JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.fields'), 'value', 'text') ); } diff --git a/admin/views/fieldtypes/view.html.php b/admin/views/fieldtypes/view.html.php index defc9c4e6..683e0e33f 100644 --- a/admin/views/fieldtypes/view.html.php +++ b/admin/views/fieldtypes/view.html.php @@ -190,7 +190,7 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy 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')) + JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.fieldtypes'), 'value', 'text', $this->state->get('filter.category_id')) ); if ($this->canBatch && $this->canCreate && $this->canEdit) @@ -199,7 +199,7 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy JHtmlBatch_::addListSelection( JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_CATEGORY'), 'batch[category]', - JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.fieldtype'), 'value', 'text') + JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.fieldtypes'), 'value', 'text') ); } } diff --git a/componentbuilder.xml b/componentbuilder.xml index 49d873d22..fdc2500c6 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 5th June, 2019 + 7th June, 2019 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com