From 861347318dadf753b967c52f27799104376d5a1f Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 13 Aug 2020 03:03:56 +0200 Subject: [PATCH] Fixed the Categories link on the dashboard to follow the new single list view naming convention. --- README.md | 8 ++-- admin/README.txt | 8 ++-- admin/compiler/joomla_3/DASHJModelList.php | 42 ++++++++++++-------- admin/helpers/compiler/a_Get.php | 4 +- admin/helpers/compiler/c_Fields.php | 6 +-- admin/helpers/compiler/e_Interpretation.php | 20 ++++++---- admin/models/componentbuilder.php | 44 +++++++++++++-------- componentbuilder.xml | 6 +-- componentbuilder_update_server.xml | 4 +- script.php | 2 +- 10 files changed, 85 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index a32154a87..36fb849ae 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo 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! -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.3) 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.11.4) 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) @@ -144,11 +144,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*: 8th August, 2020 -+ *Version*: 2.11.3 ++ *Last Build*: 13th August, 2020 ++ *Version*: 2.11.4 + *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*: **283076** ++ *Line count*: **283086** + *Field count*: **1527** + *File count*: **1785** + *Folder count*: **295** diff --git a/admin/README.txt b/admin/README.txt index a32154a87..36fb849ae 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo 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! -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.3) 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.11.4) 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) @@ -144,11 +144,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*: 8th August, 2020 -+ *Version*: 2.11.3 ++ *Last Build*: 13th August, 2020 ++ *Version*: 2.11.4 + *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*: **283076** ++ *Line count*: **283086** + *Field count*: **1527** + *File count*: **1785** + *Folder count*: **295** diff --git a/admin/compiler/joomla_3/DASHJModelList.php b/admin/compiler/joomla_3/DASHJModelList.php index 88344de16..13d6e016b 100644 --- a/admin/compiler/joomla_3/DASHJModelList.php +++ b/admin/compiler/joomla_3/DASHJModelList.php @@ -51,8 +51,8 @@ class ###Component###Model###Component### extends JModelList $viewName = $name; $alt = $name; $url = $url; - $image = $name.'.'.$type; - $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U'); + $image = $name . '.' . $type; + $name = 'COM_###COMPONENT###_DASHBOARD_' . ###Component###Helper::safeString($name,'U'); } } // internal views @@ -74,17 +74,27 @@ class ###Component###Model###Component### extends JModelList switch($action) { case 'add': - $url = 'index.php?option=com_###component###&view='.$name.'&layout=edit'; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; + $url = 'index.php?option=com_###component###&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_ADD'; $add = true; break; default: - $url = 'index.php?option=com_categories&view=categories&extension=com_###component###.'.$name; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; - $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_'.###Component###Helper::safeString($action,'U'); + // check for new convention (more stable) + if (strpos($action, '_qpo0O0oqp_') !== false) + { + list($action, $extension) = (array) explode('_qpo0O0oqp_', $action); + $extension = str_replace('_po0O0oq_', '.', $extension); + } + else + { + $extension = 'com_###component###.' . $name; + } + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_###COMPONENT###_DASHBOARD_' . ###Component###Helper::safeString($name,'U') . '_' . ###Component###Helper::safeString($action,'U'); break; } } @@ -92,9 +102,9 @@ class ###Component###Model###Component### extends JModelList { $viewName = $name; $alt = $name; - $url = 'index.php?option=com_###component###&view='.$name; - $image = $name.'.'.$type; - $name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U'); + $url = 'index.php?option=com_###component###&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_###COMPONENT###_DASHBOARD_' . ###Component###Helper::safeString($name,'U'); $hover = false; } } @@ -102,8 +112,8 @@ class ###Component###Model###Component### extends JModelList { $viewName = $view; $alt = $view; - $url = 'index.php?option=com_###component###&view='.$view; - $image = $view.'.png'; + $url = 'index.php?option=com_###component###&view=' . $view; + $image = $view . '.png'; $name = ucwords($view).'

'; $hover = false; } @@ -115,7 +125,7 @@ class ###Component###Model###Component### extends JModelList $dashboard_list = false; $accessTo = ''; $accessAdd = ''; - // acces checking start + // access checking start $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? ###Component###Helper::checkString($viewAccess[$viewName.'.create']):false; $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? ###Component###Helper::checkString($viewAccess[$viewName.'.access']):false; // set main controllers @@ -130,7 +140,7 @@ class ###Component###Model###Component### extends JModelList { $accessAdd = 'core.create'; } - // check if acces to view is set + // check if access to view is set if ($accessAccess) { $accessTo = $viewAccess[$viewName.'.access']; diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index abac157a0..aa7b6d73d 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -4038,7 +4038,7 @@ class Get { $field['permission'] = array($field['permission']); } - // set unigue name keeper + // set unique name keeper if ($listViewName) { $this->setUniqueNameCounter( @@ -4176,7 +4176,7 @@ class Get ); // set the name of the field $name = ComponentbuilderHelper::safeFieldName($field['settings']->name); - // check that we have the poperties + // check that we have the properties if (ComponentbuilderHelper::checkArray($field['settings']->properties)) { foreach ($field['settings']->properties as $property) diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index ed834cccf..e7fc6fff3 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -4438,7 +4438,7 @@ class Fields extends Structure } else { - // set lang (just incase) + // set lang (just in case) $listLangName = $langView . '_' . ComponentbuilderHelper::safeFieldName($name, true); // add to lang array @@ -4654,7 +4654,7 @@ class Fields extends Structure $this->app->enqueueMessage( JText::sprintf( '

Category targeting view mismatch

- The +

The category field in (%s) admin view has a mismatching target view.
To correct the mismatch, the extension value %s in the field must be changed to %s @@ -5080,7 +5080,7 @@ class Fields extends Structure { // reset the php bucket $phpBucket = ''; - // only set if avaliable + // only set if available if (isset($data['custom']['php' . $x]) && ComponentbuilderHelper::checkArray( $data['custom']['php' . $x] diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index f6f8ef717..e54d777ad 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -21165,6 +21165,7 @@ class Interpretation extends Fields $this->setLangContent($this->lang, $langKey, $langName); $counter++; } + // dashboard link to category on dashboard is build here if (isset($this->categoryBuilder[$name_list]) && ComponentbuilderHelper::checkArray( $this->categoryBuilder[$name_list] @@ -21194,8 +21195,13 @@ class Interpretation extends Fields $otherViews, 'W' ); } + // only load this category once if (!in_array($otherViews, $catArray)) { + // set the extension key string, new convention (more stable) + $_key_extension = str_replace('.', '_po0O0oq_', + $this->categoryBuilder[$name_list]['extension']); + // add to lang $langKey = $this->langPrefix . '_DASHBOARD_' . ComponentbuilderHelper::safeString( @@ -21223,12 +21229,12 @@ class Interpretation extends Fields if ($counter == 0) { $icons .= "'" . $type . $otherViews . "." . $catCode - . "'"; + . '_qpo0O0oqp_' . $_key_extension . "'"; } else { $icons .= ", '" . $type . $otherViews . "." - . $catCode . "'"; + . $catCode . '_qpo0O0oqp_' . $_key_extension . "'"; } $counter++; // make sure we add a category only once @@ -21770,14 +21776,14 @@ class Interpretation extends Fields ) && !in_array($otherViews, $catArray)) { - // get the extention array - $_extetion_array = (array) explode( + // get the extension array + $_extension_array = (array) explode( '.', $this->categoryBuilder[$nameList]['extension'] ); - // set the meny selection - if (isset($_extetion_array[1])) + // set the menu selection + if (isset($_extension_array[1])) { - $_menu = "categories." . trim($_extetion_array[1]); + $_menu = "categories." . trim($_extension_array[1]); } else { diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index 7c829435c..6fd81fc5a 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -25,7 +25,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList $icons = array(); // view groups array $viewGroups = array( - 'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_modules', 'png.joomla_plugins', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.servers', 'png.help_documents') + 'main' => array('png.compiler', 'png.joomla_components', 'png.joomla_modules', 'png.joomla_plugins', 'png||importjcbpackages||index.php?option=com_componentbuilder&view=joomla_components&task=joomla_components.smartImport', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.placeholders', 'png.libraries', 'png.snippets', 'png.get_snippets', 'png.validation_rules', 'png.field.add', 'png.fields', 'png.fields.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_field', 'png.fieldtypes', 'png.fieldtypes.catid_qpo0O0oqp_com_componentbuilder_po0O0oq_fieldtype', 'png.language_translations', 'png.servers', 'png.help_documents') ); // view access array $viewAccess = array( @@ -232,8 +232,8 @@ class ComponentbuilderModelComponentbuilder extends JModelList $viewName = $name; $alt = $name; $url = $url; - $image = $name.'.'.$type; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U'); + $image = $name . '.' . $type; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name,'U'); } } // internal views @@ -255,17 +255,27 @@ class ComponentbuilderModelComponentbuilder extends JModelList switch($action) { case 'add': - $url = 'index.php?option=com_componentbuilder&view='.$name.'&layout=edit'; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; + $url = 'index.php?option=com_componentbuilder&view=' . $name . '&layout=edit'; + $image = $name . '_' . $action. '.' . $type; + $alt = $name . ' ' . $action; $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_ADD'; $add = true; break; default: - $url = 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.'.$name; - $image = $name.'_'.$action.'.'.$type; - $alt = $name.' '.$action; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_'.ComponentbuilderHelper::safeString($action,'U'); + // check for new convention (more stable) + if (strpos($action, '_qpo0O0oqp_') !== false) + { + list($action, $extension) = (array) explode('_qpo0O0oqp_', $action); + $extension = str_replace('_po0O0oq_', '.', $extension); + } + else + { + $extension = 'com_componentbuilder.' . $name; + } + $url = 'index.php?option=com_categories&view=categories&extension=' . $extension; + $image = $name . '_' . $action . '.' . $type; + $alt = $viewName . ' ' . $action; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name,'U') . '_' . ComponentbuilderHelper::safeString($action,'U'); break; } } @@ -273,9 +283,9 @@ class ComponentbuilderModelComponentbuilder extends JModelList { $viewName = $name; $alt = $name; - $url = 'index.php?option=com_componentbuilder&view='.$name; - $image = $name.'.'.$type; - $name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U'); + $url = 'index.php?option=com_componentbuilder&view=' . $name; + $image = $name . '.' . $type; + $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name,'U'); $hover = false; } } @@ -283,8 +293,8 @@ class ComponentbuilderModelComponentbuilder extends JModelList { $viewName = $view; $alt = $view; - $url = 'index.php?option=com_componentbuilder&view='.$view; - $image = $view.'.png'; + $url = 'index.php?option=com_componentbuilder&view=' . $view; + $image = $view . '.png'; $name = ucwords($view).'

'; $hover = false; } @@ -296,7 +306,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList $dashboard_list = false; $accessTo = ''; $accessAdd = ''; - // acces checking start + // access checking start $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? ComponentbuilderHelper::checkString($viewAccess[$viewName.'.create']):false; $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? ComponentbuilderHelper::checkString($viewAccess[$viewName.'.access']):false; // set main controllers @@ -311,7 +321,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList { $accessAdd = 'core.create'; } - // check if acces to view is set + // check if access to view is set if ($accessAccess) { $accessTo = $viewAccess[$viewName.'.access']; diff --git a/componentbuilder.xml b/componentbuilder.xml index 887d848fa..fdf4978f3 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,15 +1,15 @@ COM_COMPONENTBUILDER - 8th August, 2020 + 13th August, 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.3 + 2.11.4 Component Builder (v.2.11.3) +

Component Builder (v.2.11.4)

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. diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index 8a9b95539..a139216fd 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -956,10 +956,10 @@ Builds Complex Joomla Components com_componentbuilder component - 2.11.3 + 2.11.4 http://www.joomlacomponentbuilder.com - https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.11.3/JCB_v2.11.3.zip + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.11.4/JCB_v2.11.4.zip stable diff --git a/script.php b/script.php index fed12042f..e76d0441a 100644 --- a/script.php +++ b/script.php @@ -9213,7 +9213,7 @@ class com_componentbuilderInstallerScript echo ' -

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

'; +

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

'; // Set db if not set already. if (!isset($db))