Resolved gh-384 to enable category and any other field that inherit from the basic list type to be able to have options added.

This commit is contained in:
Llewellyn van der Merwe 2019-03-05 09:51:52 +02:00
parent 098c82c222
commit a5de53c5fa
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
8 changed files with 79 additions and 72 deletions

View File

@ -146,11 +146,11 @@ 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*: 4th March, 2019 + *Last Build*: 5th March, 2019
+ *Version*: 2.9.13 + *Version*: 2.9.13
+ *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
+ *Line count*: **203595** + *Line count*: **203581**
+ *Field count*: **1114** + *Field count*: **1114**
+ *File count*: **1337** + *File count*: **1337**
+ *Folder count*: **209** + *Folder count*: **209**

View File

@ -146,11 +146,11 @@ 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*: 4th March, 2019 + *Last Build*: 5th March, 2019
+ *Version*: 2.9.13 + *Version*: 2.9.13
+ *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
+ *Line count*: **203595** + *Line count*: **203581**
+ *Field count*: **1114** + *Field count*: **1114**
+ *File count*: **1337** + *File count*: **1337**
+ *Folder count*: **209** + *Folder count*: **209**

View File

@ -57,8 +57,6 @@
folder="editors" folder="editors"
filter="cmd" filter="cmd"
/> />
<!-- No Manual Options Were Added In Field Settings. -->
<!-- Spacer_hr_one Field. Type: Spacer. A None Database Field. (joomla) --> <!-- Spacer_hr_one Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_one" hr="true" class="spacer_hr_one" /> <field type="spacer" name="spacer_hr_one" hr="true" class="spacer_hr_one" />
<!-- Manage_jcb_package_directories Field. Type: Radio. (joomla) --> <!-- Manage_jcb_package_directories Field. Type: Radio. (joomla) -->

View File

@ -1992,17 +1992,24 @@ class Get
{ {
if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 && ComponentbuilderHelper::checkString($view->$scripter)) if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 && ComponentbuilderHelper::checkString($view->$scripter))
{ {
$view->$scripter = $this->setDynamicValues(base64_decode($view->$scripter)); $view->{$scripter} = $this->setDynamicValues(base64_decode($view->{$scripter}));
$scripter_target = str_replace('javascript_', '', $scripter); $scripter_target = str_replace('javascript_', '', $scripter);
if (!isset($this->customScriptBuilder[$scripter_target][$name_single])) if (!isset($this->customScriptBuilder[$scripter_target]) || !isset($this->customScriptBuilder[$scripter_target][$name_single]))
{ {
// check if the script is set
if (!isset($this->customScriptBuilder[$scripter_target])) if (!isset($this->customScriptBuilder[$scripter_target]))
{ {
$this->customScriptBuilder[$scripter_target] = array(); $this->customScriptBuilder[$scripter_target] = array();
} }
$this->customScriptBuilder[$scripter_target][$name_single] = ''; // check if the script view is set
if (!isset($this->customScriptBuilder[$scripter_target][$name_single]))
{
$this->customScriptBuilder[$scripter_target][$name_single] = '';
}
} }
$this->customScriptBuilder[$scripter_target][$name_single] .= PHP_EOL . $view->$scripter; // load the script to class array
$this->customScriptBuilder[$scripter_target][$name_single] .= PHP_EOL . $view->{$scripter};
// check if a token must be set
if (strpos($view->$scripter, "token") !== false || strpos($view->$scripter, "task=ajax") !== false) if (strpos($view->$scripter, "token") !== false || strpos($view->$scripter, "task=ajax") !== false)
{ {
if (!$this->customScriptBuilder['token'][$name_single]) if (!$this->customScriptBuilder['token'][$name_single])
@ -2010,21 +2017,32 @@ class Get
$this->customScriptBuilder['token'][$name_single] = true; $this->customScriptBuilder['token'][$name_single] = true;
} }
} }
unset($view->$scripter); unset($view->{$scripter});
} }
} }
// add_css // add_css
$addArrayC = array('css_view', 'css_views'); $addArrayC = array('css_view', 'css_views');
foreach ($addArrayC as $scripter) foreach ($addArrayC as $scripter)
{ {
if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1) if (isset($view->{'add_' . $scripter}) && $view->{'add_' . $scripter} == 1 && ComponentbuilderHelper::checkString($view->{$scripter}))
{ {
if (!isset($this->customScriptBuilder[$scripter][$name_single])) $view->{$scripter} = $this->setDynamicValues(base64_decode($view->{$scripter}));
if (!isset($this->customScriptBuilder[$scripter]) || !isset($this->customScriptBuilder[$scripter][$name_single]))
{ {
$this->customScriptBuilder[$scripter][$name_single] = ''; // check if the script is set
if (!isset($this->customScriptBuilder[$scripter]))
{
$this->customScriptBuilder[$scripter] = array();
}
// check if the script view is set
if (!isset($this->customScriptBuilder[$scripter][$name_single]))
{
$this->customScriptBuilder[$scripter][$name_single] = '';
}
} }
$this->customScriptBuilder[$scripter][$name_single] .= PHP_EOL . base64_decode($view->$scripter); // load the script to class array
unset($view->$scripter); $this->customScriptBuilder[$scripter][$name_single] .= PHP_EOL . $view->{$scripter};
unset($view->{$scripter});
} }
} }
// add_php // add_php

View File

@ -1274,6 +1274,7 @@ class Fields extends Structure
} }
} }
} }
// if options were found
if (ComponentbuilderHelper::checkString($optionSet)) if (ComponentbuilderHelper::checkString($optionSet))
{ {
$field .= '>'; $field .= '>';
@ -1281,16 +1282,17 @@ class Fields extends Structure
$field .= $optionSet; $field .= $optionSet;
$field .= PHP_EOL . $this->_t(2) . $taber . "</field>"; $field .= PHP_EOL . $this->_t(2) . $taber . "</field>";
} }
elseif ($typeName === 'sql') // if no options found and must have a list of options
elseif (ComponentbuilderHelper::fieldCheck($typeName, 'list'))
{ {
$optionArray = false; $optionArray = false;
$field .= PHP_EOL . $this->_t(2) . $taber . "/>"; $field .= PHP_EOL . $this->_t(2) . $taber . "/>";
$field .= PHP_EOL . $this->_t(2) . $taber . "<!--" . $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings. -->" . PHP_EOL;
} }
else else
{ {
$optionArray = false; $optionArray = false;
$field .= PHP_EOL . $this->_t(2) . $taber . "/>"; $field .= PHP_EOL . $this->_t(2) . $taber . "/>";
$field .= PHP_EOL . $this->_t(2) . $taber . "<!--" . $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings. -->" . PHP_EOL;
} }
} }
elseif ($setType === 'plain') elseif ($setType === 'plain')
@ -1663,7 +1665,8 @@ class Fields extends Structure
} }
} }
} }
if (!$field->fieldXML->count()) // if no options found and must have a list of options
if (!$field->fieldXML->count() && ComponentbuilderHelper::fieldCheck($typeName, 'list'))
{ {
ComponentbuilderHelper::xmlComment($field->fieldXML, $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings."); ComponentbuilderHelper::xmlComment($field->fieldXML, $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings.");
} }

View File

@ -2545,42 +2545,36 @@ abstract class ComponentbuilderHelper
**/ **/
protected static $fieldGroups = array( protected static $fieldGroups = array(
'default' => array( 'default' => array(
'accesslevel', 'cachehandler', 'calendar', 'captcha', 'category', 'checkbox', 'accesslevel', 'cachehandler', 'calendar', 'captcha', 'category', 'checkbox', 'checkboxes', 'chromestyle',
'checkboxes', 'color', 'combo', 'componentlayout', 'contentlanguage', 'editor', 'color', 'combo', 'componentlayout', 'contentlanguage', 'contenttype', 'databaseconnection', // 'components', (TODO) must be added but still in use as a custom field in JCB
'chromestyle', 'contenttype', 'databaseconnection', 'editors', 'email', 'file', 'editor', 'editors', 'email', 'file', 'file', 'filelist', 'folderlist', 'groupedlist', 'headertag', 'helpsite', 'hidden', 'imagelist',
'filelist', 'folderlist', 'groupedlist', 'hidden', 'file', 'headertag', 'helpsite', 'integer', 'language', 'list', 'media', 'menu', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition',
'imagelist', 'integer', 'language', 'list', 'media', 'menu', 'note', 'number', 'password', 'moduletag', 'note', 'number', 'password', 'plugins', 'predefinedlist', 'radio', 'range', 'repeatable', 'rules',
'plugins', 'radio', 'repeatable', 'range', 'rules', 'subform', 'sessionhandler', 'spacer', 'sql', 'tag', 'sessionhandler', 'spacer', 'sql', 'subform', 'tag', 'tel', 'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
'tel', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition', 'moduletag',
'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
), ),
'plain' => array( 'plain' => array(
'accesslevel', 'checkbox', 'cachehandler', 'calendar', 'category', 'chromestyle', 'color', 'cachehandler', 'calendar', 'checkbox', 'chromestyle', 'color', 'componentlayout', 'contenttype', 'editor', 'editors',
'contenttype', 'combo', 'componentlayout', 'databaseconnection', 'editor', 'editors', 'email', 'file', 'headertag', 'helpsite', 'hidden', 'integer', 'language', 'media', 'menu', 'menuitem', 'meter', 'modulelayout',
'email', 'file', 'filelist', 'folderlist', 'headertag', 'helpsite', 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'tag', 'tel', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
'hidden', 'imagelist', 'integer', 'language', 'media', 'menu', ),
'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'option' => array(
'sessionhandler', 'tag', 'tel', 'text', 'textarea', 'accesslevel', 'category', 'checkboxes', 'combo', 'contentlanguage', 'databaseconnection', // 'components', (TODO) must be added but still in use as a custom field in JCB
'timezone', 'url', 'user', 'usergroup' 'filelist', 'folderlist', 'imagelist', 'list', 'plugins', 'predefinedlist', 'radio', 'sessionhandler', 'sql'
), ),
'text' => array( 'text' => array(
'calendar','color','editor','email','password','tel','text','textarea','url','number','range' 'calendar', 'color', 'editor', 'email', 'number', 'password', 'range', 'tel', 'text', 'textarea', 'url'
), ),
'list' => array( 'list' => array(
'checkboxes','checkbox','list','radio' 'checkbox', 'checkboxes', 'list', 'radio'
), ),
'dynamic' => array( 'dynamic' => array(
'category','headertag','tag','rules','user','file','filelist','folderlist','imagelist','integer','timezone','media','meter' 'category', 'file', 'filelist', 'folderlist', 'headertag', 'imagelist', 'integer', 'media', 'meter', 'rules', 'tag', 'timezone', 'user'
), ),
'spacer' => array( 'spacer' => array(
'note', 'spacer' 'note', 'spacer'
), ),
'option' => array(
'plugins', 'checkboxes', 'contentlanguage', 'list', 'radio', 'sql'
),
'special' => array( 'special' => array(
'contentlanguage', 'groupedlist', 'moduleposition', 'plugin', 'contentlanguage', 'groupedlist', 'moduleposition', 'plugin', 'repeatable', 'subform', 'templatestyle'
'repeatable', 'templatestyle', 'subform'
) )
); );

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>4th March, 2019</creationDate> <creationDate>5th March, 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>

View File

@ -2545,42 +2545,36 @@ abstract class ComponentbuilderHelper
**/ **/
protected static $fieldGroups = array( protected static $fieldGroups = array(
'default' => array( 'default' => array(
'accesslevel', 'cachehandler', 'calendar', 'captcha', 'category', 'checkbox', 'accesslevel', 'cachehandler', 'calendar', 'captcha', 'category', 'checkbox', 'checkboxes', 'chromestyle',
'checkboxes', 'color', 'combo', 'componentlayout', 'contentlanguage', 'editor', 'color', 'combo', 'componentlayout', 'contentlanguage', 'contenttype', 'databaseconnection', // 'components', (TODO) must be added but still in use as a custom field in JCB
'chromestyle', 'contenttype', 'databaseconnection', 'editors', 'email', 'file', 'editor', 'editors', 'email', 'file', 'file', 'filelist', 'folderlist', 'groupedlist', 'headertag', 'helpsite', 'hidden', 'imagelist',
'filelist', 'folderlist', 'groupedlist', 'hidden', 'file', 'headertag', 'helpsite', 'integer', 'language', 'list', 'media', 'menu', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition',
'imagelist', 'integer', 'language', 'list', 'media', 'menu', 'note', 'number', 'password', 'moduletag', 'note', 'number', 'password', 'plugins', 'predefinedlist', 'radio', 'range', 'repeatable', 'rules',
'plugins', 'radio', 'repeatable', 'range', 'rules', 'subform', 'sessionhandler', 'spacer', 'sql', 'tag', 'sessionhandler', 'spacer', 'sql', 'subform', 'tag', 'tel', 'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
'tel', 'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduleposition', 'moduletag',
'templatestyle', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
), ),
'plain' => array( 'plain' => array(
'accesslevel', 'checkbox', 'cachehandler', 'calendar', 'category', 'chromestyle', 'color', 'cachehandler', 'calendar', 'checkbox', 'chromestyle', 'color', 'componentlayout', 'contenttype', 'editor', 'editors',
'contenttype', 'combo', 'componentlayout', 'databaseconnection', 'editor', 'editors', 'email', 'file', 'headertag', 'helpsite', 'hidden', 'integer', 'language', 'media', 'menu', 'menuitem', 'meter', 'modulelayout',
'email', 'file', 'filelist', 'folderlist', 'headertag', 'helpsite', 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'tag', 'tel', 'text', 'textarea', 'timezone', 'url', 'user', 'usergroup'
'hidden', 'imagelist', 'integer', 'language', 'media', 'menu', ),
'menuitem', 'meter', 'modulelayout', 'moduleorder', 'moduletag', 'number', 'password', 'range', 'rules', 'option' => array(
'sessionhandler', 'tag', 'tel', 'text', 'textarea', 'accesslevel', 'category', 'checkboxes', 'combo', 'contentlanguage', 'databaseconnection', // 'components', (TODO) must be added but still in use as a custom field in JCB
'timezone', 'url', 'user', 'usergroup' 'filelist', 'folderlist', 'imagelist', 'list', 'plugins', 'predefinedlist', 'radio', 'sessionhandler', 'sql'
), ),
'text' => array( 'text' => array(
'calendar','color','editor','email','password','tel','text','textarea','url','number','range' 'calendar', 'color', 'editor', 'email', 'number', 'password', 'range', 'tel', 'text', 'textarea', 'url'
), ),
'list' => array( 'list' => array(
'checkboxes','checkbox','list','radio' 'checkbox', 'checkboxes', 'list', 'radio'
), ),
'dynamic' => array( 'dynamic' => array(
'category','headertag','tag','rules','user','file','filelist','folderlist','imagelist','integer','timezone','media','meter' 'category', 'file', 'filelist', 'folderlist', 'headertag', 'imagelist', 'integer', 'media', 'meter', 'rules', 'tag', 'timezone', 'user'
), ),
'spacer' => array( 'spacer' => array(
'note', 'spacer' 'note', 'spacer'
), ),
'option' => array(
'plugins', 'checkboxes', 'contentlanguage', 'list', 'radio', 'sql'
),
'special' => array( 'special' => array(
'contentlanguage', 'groupedlist', 'moduleposition', 'plugin', 'contentlanguage', 'groupedlist', 'moduleposition', 'plugin', 'repeatable', 'subform', 'templatestyle'
'repeatable', 'templatestyle', 'subform'
) )
); );