diff --git a/README.md b/README.md index 2454f5841..4fb3c3ca1 100644 --- a/README.md +++ b/README.md @@ -143,11 +143,11 @@ 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*: 21st February, 2021 ++ *Last Build*: 4th March, 2021 + *Version*: 2.12.7 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **292151** ++ *Line count*: **292184** + *Field count*: **1629** + *File count*: **1935** + *Folder count*: **322** diff --git a/admin/README.txt b/admin/README.txt index 2454f5841..4fb3c3ca1 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -143,11 +143,11 @@ 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*: 21st February, 2021 ++ *Last Build*: 4th March, 2021 + *Version*: 2.12.7 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **292151** ++ *Line count*: **292184** + *Field count*: **1629** + *File count*: **1935** + *Folder count*: **322** diff --git a/admin/controllers/compiler.php b/admin/controllers/compiler.php index ddf057408..244637444 100644 --- a/admin/controllers/compiler.php +++ b/admin/controllers/compiler.php @@ -255,8 +255,10 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $message[] = '

Remember! This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!

'; } $message[] = '

Compilation took '.$model->compiler->secondsCompiled.' seconds to complete.

'; + // pass the message via the user state... wow this is painful + $app->setUserState('com_componentbuilder.success_message', implode(PHP_EOL, $message)); // set redirect - $this->setRedirect($redirect_url, implode(PHP_EOL, $message), 'message'); + $this->setRedirect($redirect_url, '

Successful Build!

', 'message'); $app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']); // check if we have modules if ($add_module_install) @@ -278,6 +280,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', ''); + $app->setUserState('com_componentbuilder.success_message', ''); // set redirect $this->setRedirect($redirect_url, $message); } @@ -318,6 +321,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', ''); + $app->setUserState('com_componentbuilder.success_message', ''); // loop and install all extensions found foreach ($fileNames as $fileName) @@ -372,6 +376,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', ''); + $app->setUserState('com_componentbuilder.success_message', ''); if ($this->installExtension($fileName)) { @@ -409,6 +414,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', ''); + $app->setUserState('com_componentbuilder.success_message', ''); if (ComponentbuilderHelper::checkArray($fileNames)) { @@ -451,6 +457,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', ''); + $app->setUserState('com_componentbuilder.success_message', ''); if (ComponentbuilderHelper::checkArray($fileNames)) { @@ -564,6 +571,14 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin { $message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); $this->setRedirect($redirect_url, $message, 'message'); + // get application + $app = JFactory::getApplication(); + // wipe out the user c-m-p since we are done with them all + $app->setUserState('com_componentbuilder.component_folder_name', ''); + $app->setUserState('com_componentbuilder.modules_folder_name', ''); + $app->setUserState('com_componentbuilder.plugins_folder_name', ''); + $app->setUserState('com_componentbuilder.success_message', ''); + return true; } } diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index c5248a3ca..8b9298533 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -172,6 +172,14 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin { $message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); $this->setRedirect($redirect_url, $message, 'message'); + // get application + $app = JFactory::getApplication(); + // wipe out the user c-m-p since we are done with them all + $app->setUserState('com_componentbuilder.component_folder_name', ''); + $app->setUserState('com_componentbuilder.modules_folder_name', ''); + $app->setUserState('com_componentbuilder.plugins_folder_name', ''); + $app->setUserState('com_componentbuilder.success_message', ''); + return true; } } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 7178b25f1..830ad7254 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -1315,21 +1315,24 @@ class Fields extends Structure $tab_name = "publishing"; $attributes = array( - 'name' => $field_name, - 'type' => 'hidden', - 'default' => $component . ' ' . $nameSingleCode + 'name' => $field_name, + 'type' => 'hidden', + 'default' => $component . ' ' . $nameSingleCode ); ComponentbuilderHelper::xmlComment( $fieldSetXML, - $this->setLine(__LINE__) . " Was added due to Permissions JS needing a Title field" + $this->setLine(__LINE__) + . " Was added due to Permissions JS needing a Title field" ); ComponentbuilderHelper::xmlComment( $fieldSetXML, - $this->setLine(__LINE__) . " Let us know at gh-629 should this change" + $this->setLine(__LINE__) + . " Let us know at gh-629 should this change" ); ComponentbuilderHelper::xmlComment( $fieldSetXML, - $this->setLine(__LINE__) . " https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235" + $this->setLine(__LINE__) + . " https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235" ); $fieldXML = $fieldSetXML->addChild('field'); ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); @@ -1486,6 +1489,7 @@ class Fields extends Structure { // set the permission for later $this->hasPermissions[$nameSingleCode] = true; + // break out here return true; } @@ -1508,6 +1512,7 @@ class Fields extends Structure { // set the permission for later $this->hasPermissions[$nameSingleCode] = true; + // break out here return true; } @@ -1530,12 +1535,14 @@ class Fields extends Structure { // set the permission for later $this->hasPermissions[$nameSingleCode] = true; + // break out here return true; } } } } + return $this->hasPermissions[$nameSingleCode]; } @@ -4981,7 +4988,8 @@ class Fields extends Structure // load the category builder - TODO must move all to single view $this->categoryBuilder[$nameListCode] = array('code' => $name, 'name' => $listLangName, - 'extension' => $_extension); + 'extension' => $_extension, + 'filter' => $field['filter']); // also set code name for title alias fix $this->catCodeBuilder[$nameSingleCode] = array('code' => $name, 'views' => $otherViews, @@ -5800,7 +5808,9 @@ class Fields extends Structure && ComponentbuilderHelper::checkArray( $this->categoryBuilder[$nameListCode] ) - && isset($this->categoryBuilder[$nameListCode]['extension'])) + && isset($this->categoryBuilder[$nameListCode]['extension']) + && isset($this->categoryBuilder[$nameListCode]['filter']) + && $this->categoryBuilder[$nameListCode]['filter'] >= 1) { $field_filter_sets[] = $this->_t(2) . '_t(3) . 'type="category"'; diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 1b09a000e..bef848bac 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -15723,10 +15723,13 @@ class Interpretation extends Fields { $categoryCodeName = $this->categoryBuilder[$nameListCode]['code']; $addCategory = true; + $addCategoryFilter + = $this->categoryBuilder[$nameListCode]['filter']; } else { - $addCategory = false; + $addCategory = false; + $addCategoryFilter = 0; } // setup the query $query = "//" . $this->setLine(__LINE__) . " Get the user object."; @@ -15842,7 +15845,7 @@ class Interpretation extends Fields // set other filters $query .= $this->setFilterQuery($nameListCode); // add the category - if ($addCategory) + if ($addCategory && $addCategoryFilter >= 1) { $query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( __LINE__ @@ -18653,7 +18656,9 @@ class Interpretation extends Fields && ComponentbuilderHelper::checkArray( $this->categoryBuilder[$nameListCode] ) - && isset($this->categoryBuilder[$nameListCode]['extension'])) + && isset($this->categoryBuilder[$nameListCode]['extension']) + && isset($this->categoryBuilder[$nameListCode]['filter']) + && $this->categoryBuilder[$nameListCode]['filter'] >= 1) { // set filter $filter[] = PHP_EOL . $this->_t(2) . "//" @@ -22442,7 +22447,9 @@ class Interpretation extends Fields && ComponentbuilderHelper::checkArray( $this->categoryBuilder[$nameListCode] ) - && isset($this->categoryBuilder[$nameListCode]['extension'])) + && isset($this->categoryBuilder[$nameListCode]['extension']) + && isset($this->categoryBuilder[$nameListCode]['filter']) + && $this->categoryBuilder[$nameListCode]['filter'] >= 1) { // is found so add it $add_category = true; @@ -22466,18 +22473,28 @@ class Interpretation extends Fields if (isset($filter['multi']) && $filter['multi'] == 2) { + // if this is a category we should make sure it must be added + if (!$add_category && $filter['type'] === 'category') + { + continue; + } + elseif ($add_category && $filter['type'] === 'category') + { + // already added here so no need to add again + $add_category = false; + } + // check if this was an access field + elseif ($filter['type'] === 'accesslevel') + { + // already added here so no need to add again + $add_access_levels = false; + } // 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') { diff --git a/admin/models/compiler.php b/admin/models/compiler.php index 75e025c42..b30f0b8f9 100644 --- a/admin/models/compiler.php +++ b/admin/models/compiler.php @@ -154,7 +154,7 @@ class ComponentbuilderModelCompiler extends JModelList $db->setQuery($query); // return the result return $db->loadObjectList(); - } + } public function getCompilerAnimations(&$errorMessage) { diff --git a/admin/views/compiler/tmpl/default.php b/admin/views/compiler/tmpl/default.php index 9dbaa950c..675ee5e39 100644 --- a/admin/views/compiler/tmpl/default.php +++ b/admin/views/compiler/tmpl/default.php @@ -50,7 +50,10 @@ Joomla.submitbutton = function(task, key) } // set the task value form.task.value = task; - form.submit(); + // seems we need a little delay here + setTimeout(function() { + form.submit(); + }, 100); // some ui movements if (task == 'compiler.compiler'){ // get the component name @@ -124,6 +127,12 @@ jQuery('
')
+ SuccessMessage)): ?> +
+ + SuccessMessage; ?> +
+

diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index 356e1a3b3..16bc936d6 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -37,6 +37,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=compiler'); $this->sidebar = JHtmlSidebar::render(); } + $this->SuccessMessage = $this->app->getUserState('com_componentbuilder.success_message', false); $this->Components = $this->get('Components'); $this->form = $this->setForm(); // set the compiler artwork from global settings diff --git a/componentbuilder.xml b/componentbuilder.xml index aef74da7d..34e2e80c5 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 21st February, 2021 + 4th March, 2021 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com