From c53ece2a2d221ae6ee7b58ab9568ace2c4cb0f99 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 16 Sep 2022 23:41:41 +0200 Subject: [PATCH] Adds more classes, and refactoring to the search feature. Adds test search to search page. #952 --- README.md | 8 +- admin/README.txt | 8 +- .../en-GB/en-GB.com_componentbuilder.ini | 1 - admin/models/ajax.php | 16 +- admin/views/search/tmpl/default.php | 25 +- componentbuilder.xml | 2 +- .../src/Componentbuilder/Search/Agent.php | 2 +- .../Componentbuilder/Search/Agent/Replace.php | 2 +- .../Componentbuilder/Search/Agent/Search.php | 253 ++++++++++++++++-- .../Componentbuilder/Search/Agent/Update.php | 115 ++++++-- .../src/Componentbuilder/Search/Config.php | 8 +- .../Search/Interfaces/FindInterface.php | 3 +- .../Search/Interfaces/ModelInterface.php | 10 +- .../Search/Interfaces/SearchInterface.php | 56 ++++ .../Search/Interfaces/SearchTypeInterface.php | 43 +++ .../src/Componentbuilder/Search/Model.php | 51 +++- .../src/Componentbuilder/Search/Model/Get.php | 10 +- .../Componentbuilder/Search/Service/Agent.php | 6 +- .../Search/Service/Search.php | 77 ++++++ .../Componentbuilder/Search/Type/Basic.php | 127 +++++++++ .../Componentbuilder/Search/Type/Regex.php | 112 ++++++++ .../Componentbuilder/Search/Type/index.html | 1 + 22 files changed, 845 insertions(+), 91 deletions(-) create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Interfaces/SearchInterface.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Interfaces/SearchTypeInterface.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Type/Basic.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Type/Regex.php create mode 100644 libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Type/index.html diff --git a/README.md b/README.md index 20ac6437d..342c18d3f 100644 --- a/README.md +++ b/README.md @@ -140,14 +140,14 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 14th September, 2022 ++ *Last Build*: 16th September, 2022 + *Version*: 3.1.5 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **330282** ++ *Line count*: **331035** + *Field count*: **2002** -+ *File count*: **2161** -+ *Folder count*: **374** ++ *File count*: **2166** ++ *Folder count*: **375** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/README.txt b/admin/README.txt index 20ac6437d..342c18d3f 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -140,14 +140,14 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 14th September, 2022 ++ *Last Build*: 16th September, 2022 + *Version*: 3.1.5 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **330282** ++ *Line count*: **331035** + *Field count*: **2002** -+ *File count*: **2161** -+ *Folder count*: **374** ++ *File count*: **2166** ++ *Folder count*: **375** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 5d19974ee..8fb1a0828 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -7760,7 +7760,6 @@ COM_COMPONENTBUILDER_MODEL_AFTER_MODELLING="Model (after modelling)" COM_COMPONENTBUILDER_MODEL_BEFORE_MODELLING="Model (before modelling)" COM_COMPONENTBUILDER_MODULE="Module" COM_COMPONENTBUILDER_MODULES="Modules" -COM_COMPONENTBUILDER_MORE_SOON="More soon" COM_COMPONENTBUILDER_MOVE="Move" COM_COMPONENTBUILDER_NAME="Name" COM_COMPONENTBUILDER_NAME_ASC="Name (Asc)" diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 9c3ce9a3e..b347bafa8 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -3622,17 +3622,17 @@ class ComponentbuilderModelAjax extends ListModel int $matchCase, int $wholeWord, int $regexSearch, int $componentId): ?array { // check if this is a valid table - if (SearchFactory('Table')->exist($tableName)) + if (SearchFactory::_('Table')->exist($tableName)) { // load the configurations - SearchFactory('Config')->table_name = $tableName; - SearchFactory('Config')->search_value = $searchValue; - SearchFactory('Config')->match_case = $matchCase; - SearchFactory('Config')->whole_word = $wholeWord; - SearchFactory('Config')->regex_search = $regexSearch; - SearchFactory('Config')->component_id = $componentId; + SearchFactory::_('Config')->table_name = $tableName; + SearchFactory::_('Config')->search_value = $searchValue; + SearchFactory::_('Config')->match_case = $matchCase; + SearchFactory::_('Config')->whole_word = $wholeWord; + SearchFactory::_('Config')->regex_search = $regexSearch; + SearchFactory::_('Config')->component_id = $componentId; - if (($items = SearchFactory('Agent')->find()) !== null) + if (($items = SearchFactory::_('Agent')->find()) !== null) { return ['success' => JText::sprintf('COM_COMPONENTBUILDER_WE_FOUND_SOME_INSTANCES_IN_S', $tableName), 'items' => $items]; } diff --git a/admin/views/search/tmpl/default.php b/admin/views/search/tmpl/default.php index d28ecae59..5413d57c0 100644 --- a/admin/views/search/tmpl/default.php +++ b/admin/views/search/tmpl/default.php @@ -16,6 +16,7 @@ JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); +use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory; ?> canDo->get('search.access')): ?>