fixed gh-419 to correctly load the category filter (extention and view name)

This commit is contained in:
Llewellyn van der Merwe 2019-06-07 16:59:27 +02:00
parent 4a878e32ef
commit 37d3f1425e
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
8 changed files with 19 additions and 25 deletions

View File

@ -146,7 +146,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 5th June, 2019 + *Last Build*: 7th June, 2019
+ *Version*: 2.9.18 + *Version*: 2.9.18
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -146,7 +146,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 5th June, 2019 + *Last Build*: 7th June, 2019
+ *Version*: 2.9.18 + *Version*: 2.9.18
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -2900,11 +2900,13 @@ class Get
if (ComponentbuilderHelper::checkString($listViewName)) if (ComponentbuilderHelper::checkString($listViewName))
{ {
// check if we should use another Text Name as this views name // check if we should use another Text Name as this views name
$otherName = ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'); $otherName = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'), $this->placeholders);
$otherViews = ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'); $otherViews = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'), $this->placeholders);
$otherView = ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'); $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)) if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView))
{ {
// set other category details
$this->catOtherName[$listViewName] = array( $this->catOtherName[$listViewName] = array(
'name' => ComponentbuilderHelper::safeString($otherName), 'name' => ComponentbuilderHelper::safeString($otherName),
'views' => ComponentbuilderHelper::safeString($otherViews), 'views' => ComponentbuilderHelper::safeString($otherViews),

View File

@ -10947,21 +10947,13 @@ class Interpretation extends Fields
return ''; 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 // set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$COPMONENT = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U'); $COPMONENT = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U');
// set filter // set filter
$filter = array(); $filter = array();
@ -10969,7 +10961,7 @@ class Interpretation extends Fields
$filter[] = $this->_t(2) . "JHtmlSidebar::addFilter("; $filter[] = $this->_t(2) . "JHtmlSidebar::addFilter(";
$filter[] = $this->_t(3) . "JText:" . ":_('JOPTION_SELECT_CATEGORY'),"; $filter[] = $this->_t(3) . "JText:" . ":_('JOPTION_SELECT_CATEGORY'),";
$filter[] = $this->_t(3) . "'filter_category_id',"; $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) . ");"; $filter[] = $this->_t(2) . ");";
@ -10979,7 +10971,7 @@ class Interpretation extends Fields
$filter[] = $this->_t(3) . "JHtmlBatch_::addListSelection("; $filter[] = $this->_t(3) . "JHtmlBatch_::addListSelection(";
$filter[] = $this->_t(4) . "JText:" . ":_('COM_" . $COPMONENT . "_KEEP_ORIGINAL_CATEGORY'),"; $filter[] = $this->_t(4) . "JText:" . ":_('COM_" . $COPMONENT . "_KEEP_ORIGINAL_CATEGORY'),";
$filter[] = $this->_t(4) . "'batch[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(3) . ");";
$filter[] = $this->_t(2) . "}"; $filter[] = $this->_t(2) . "}";

View File

@ -438,7 +438,7 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_list][$this->hhh . 'SORTFIELDS' . $this->hhh] = $this->setSortFields($viewName_list); $this->fileContentDynamic[$viewName_list][$this->hhh . 'SORTFIELDS' . $this->hhh] = $this->setSortFields($viewName_list);
// CATEGORYFILTER <<<DYNAMIC>>> // CATEGORYFILTER <<<DYNAMIC>>>
$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 // CATEGORY_VIEWS
if (!isset($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh])) if (!isset($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh]))

View File

@ -195,7 +195,7 @@ class ComponentbuilderViewFields extends JViewLegacy
JHtmlSidebar::addFilter( JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_CATEGORY'), JText::_('JOPTION_SELECT_CATEGORY'),
'filter_category_id', '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) if ($this->canBatch && $this->canCreate && $this->canEdit)
@ -204,7 +204,7 @@ class ComponentbuilderViewFields extends JViewLegacy
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_CATEGORY'), JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_CATEGORY'),
'batch[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')
); );
} }

View File

@ -190,7 +190,7 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy
JHtmlSidebar::addFilter( JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_CATEGORY'), JText::_('JOPTION_SELECT_CATEGORY'),
'filter_category_id', '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) if ($this->canBatch && $this->canCreate && $this->canEdit)
@ -199,7 +199,7 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_CATEGORY'), JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_CATEGORY'),
'batch[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')
); );
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>5th June, 2019</creationDate> <creationDate>7th June, 2019</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>