diff --git a/CHANGELOG.md b/CHANGELOG.md index a66b80a50..f85ab540d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v3.2.0-beta5 + +- Add custom file file mapping for Joomla 4 and 5 + # v3.2.0-beta4 - Add Preferred Joomla Version to Components diff --git a/README.md b/README.md index 54ed30d2f..2e329316f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,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 save you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.0-beta4) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.0-beta5) 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,13 +144,13 @@ 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*: 7th March, 2024 -+ *Version*: 3.2.0-beta4 ++ *Last Build*: 9th March, 2024 ++ *Version*: 3.2.0-beta5 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **741812** ++ *Line count*: **742015** + *Field count*: **2078** -+ *File count*: **5204** ++ *File count*: **5205** + *Folder count*: **462** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com). diff --git a/admin/README.txt b/admin/README.txt index 54ed30d2f..2e329316f 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -9,7 +9,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 save you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.0-beta4) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (3.2.0-beta5) 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,13 +144,13 @@ 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*: 7th March, 2024 -+ *Version*: 3.2.0-beta4 ++ *Last Build*: 9th March, 2024 ++ *Version*: 3.2.0-beta5 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **741812** ++ *Line count*: **742015** + *Field count*: **2078** -+ *File count*: **5204** ++ *File count*: **5205** + *Folder count*: **462** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com). diff --git a/admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php b/admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php index e22861b20..bc59999f0 100644 --- a/admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php +++ b/admin/compiler/joomla_4/ADMIN_VIEWS_HTML.php @@ -141,7 +141,7 @@ class HtmlView extends BaseHtmlView * @since 1.6 */ protected function _prepareDocument(): void - { + {###JQUERY### $this->getDocument()->setTitle(Text::_('COM_###COMPONENT###_###VIEWS###')); // add styles foreach ($this->styles as $style) diff --git a/admin/compiler/joomla_4/ADMIN_VIEW_HTML.php b/admin/compiler/joomla_4/ADMIN_VIEW_HTML.php index 648861428..34750b530 100644 --- a/admin/compiler/joomla_4/ADMIN_VIEW_HTML.php +++ b/admin/compiler/joomla_4/ADMIN_VIEW_HTML.php @@ -126,7 +126,7 @@ class HtmlView extends BaseHtmlView * @since 1.6 */ protected function _prepareDocument(): void - { + {###JQUERY### $isNew = ($this->item->id < 1); $this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT')); // add styles diff --git a/admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php b/admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php index 0c4cc095d..d48f41976 100644 --- a/admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php +++ b/admin/compiler/joomla_4/SITE_ADMIN_VIEW_HTML.php @@ -28,7 +28,7 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Site\View\### class HtmlView extends BaseHtmlView { /** - * Display the view + * ###View### view display method * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * @@ -42,8 +42,9 @@ class HtmlView extends BaseHtmlView // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); - $this->script = $this->get('Script'); $this->state = $this->get('State'); + $this->styles = $this->get('Styles'); + $this->scripts = $this->get('Scripts'); // get action permissions $this->canDo = ###Component###Helper::getActions('###view###', $this->item); // get input @@ -93,9 +94,8 @@ class HtmlView extends BaseHtmlView * @since 1.6 */ protected function addToolbar(): void - {###ADDTOOLBAR### - // now initiate the toolbar - $this->toolbar = Toolbar::getInstance(); + { + ###ADDTOOLBAR### } /** @@ -125,14 +125,18 @@ class HtmlView extends BaseHtmlView * @since 1.6 */ protected function _prepareDocument(): void - { + {###JQUERY### $isNew = ($this->item->id < 1); $this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT')); - // the default style of this view - Html::_('stylesheet', "components/com_###component###/assets/css/###view###.css", ['version' => 'auto']);###AJAXTOKE######LINKEDVIEWTABLESCRIPTS### - // default javascript of this view - Html::_('script', $this->script, ['version' => 'auto']); - Html::_('script', "components/com_###component###/views/###view###/submitbutton.js", ['version' => 'auto']);###DOCUMENT_CUSTOM_PHP### - Text::script('view not acceptable. Error'); + // add styles + foreach ($this->styles as $style) + { + Html::_('stylesheet', $style, ['version' => 'auto']); + }###AJAXTOKE######LINKEDVIEWTABLESCRIPTS### + // add scripts + foreach ($this->scripts as $script) + { + Html::_('script', $script, ['version' => 'auto']); + }###DOCUMENT_CUSTOM_PHP### } } diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 6ac3d0bb9..d28089d84 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -1335,7 +1335,6 @@ COM_COMPONENTBUILDER_BECOME_A_CONTRIBUTOR="Become a Contributor" COM_COMPONENTBUILDER_BEHAVIOUR="Behaviour" COM_COMPONENTBUILDER_BEHIND="Behind" COM_COMPONENTBUILDER_BEHIND_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BOLDER_MODIFIED_DATEB_THEN_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE="Behind means your local snippet (with the same name, library and type) has a older modified date then the community snippet (with the same name, library and type)." -COM_COMPONENTBUILDER_BETA_RELEASE="Beta Release" COM_COMPONENTBUILDER_BE_A_PART_OF_JCB="Be a Part of JCB" COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE="Be cautious! Do not continue unless you trust the origin of this package!" COM_COMPONENTBUILDER_BFIELD_TYPEB_IDS_MISMATCH_IN_BSB="Field type id:%s mismatch in %s." @@ -7862,6 +7861,7 @@ COM_COMPONENTBUILDER_POWER_VERSION_DESC="A count of the number of times this Pow COM_COMPONENTBUILDER_POWER_VERSION_LABEL="Version" COM_COMPONENTBUILDER_POWER_YES="Yes" COM_COMPONENTBUILDER_PPOWER_BGUIDSB_NOT_FOUNDP="

Power guid:%s not found!

" +COM_COMPONENTBUILDER_PRE_RELEASE="Pre Release" COM_COMPONENTBUILDER_PROPERTIES="Properties" COM_COMPONENTBUILDER_PROPERTIESBR_SMALLHERE_YOU_CAN_SET_THE_PROPERTIES_FOR_THIS_FIELDSMALL="Properties
Here you can set the properties for this field." COM_COMPONENTBUILDER_PROPERTY="Property" diff --git a/admin/layouts/jcbnoticeboardtabs.php b/admin/layouts/jcbnoticeboardtabs.php index 7749c2545..7e7693314 100644 --- a/admin/layouts/jcbnoticeboardtabs.php +++ b/admin/layouts/jcbnoticeboardtabs.php @@ -24,11 +24,11 @@ use Joomla\CMS\Layout\LayoutHelper; $displayData['active'] . '-noticeboard')); ?> -
+
-
+
diff --git a/admin/layouts/table.php b/admin/layouts/table.php index 53c005383..c5609cdde 100644 --- a/admin/layouts/table.php +++ b/admin/layouts/table.php @@ -21,11 +21,12 @@ use VDM\Joomla\Utilities\StringHelper; $table_id = (isset($displayData['id'])) ? $displayData['id'] : StringHelper::random(7); $name = (isset($displayData['name'])) ? $displayData['name'] : false; $table_class = (isset($displayData['table_class'])) ? $displayData['table_class'] : 'uk-table'; +$table_container_class = (isset($displayData['table_container_class'])) ? $displayData['table_container_class'] : 'uk-overflow-auto'; $headers = (isset($displayData['headers'])) ? $displayData['headers'] : [Text::_('COM_COMPONENTBUILDER_NO'), Text::_('COM_COMPONENTBUILDER_HEADERS'), Text::_('COM_COMPONENTBUILDER_FOUND')]; $items = (isset($displayData['items'])) ? $displayData['items'] : 6; ?> -
+
diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 74d024ac0..9d214fa51 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -321,7 +321,7 @@ class ComponentbuilderModelAjax extends ListModel // now check if this version is out dated if ($current_version === $local_version) { - return ['notice' => '' . Text::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '']; + return ['notice' => ' ' . Text::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '']; } else { @@ -332,14 +332,14 @@ class ComponentbuilderModelAjax extends ListModel ($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) || ($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2])) { - return ['notice' => '' . Text::_('COM_COMPONENTBUILDER_BETA_RELEASE') . '']; + return ['notice' => ' ' . Text::_('COM_COMPONENTBUILDER_PRE_RELEASE') . '']; } else { // download link of the latest version $download = "https://git.vdm.dev/api/v1/repos/joomla/Component-Builder/archive/" . $tags[0]->name . ".zip"; - return ['notice' => '' . Text::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '!  ' . Text::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '! ' . Text::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!']; } } diff --git a/admin/models/fields/dbtables.php b/admin/models/fields/dbtables.php index b38f94c20..4d679ddd7 100644 --- a/admin/models/fields/dbtables.php +++ b/admin/models/fields/dbtables.php @@ -40,14 +40,14 @@ class JFormFieldDbtables extends JFormFieldList protected function getOptions() { // get db object - $db = JFactory::getDBO(); + $db = Factory::getDBO(); // get all tables $tables= $db->getTableList(); // get config - $config = JFactory::getConfig(); - $dbprefix = version_compare(JVERSION,'3.0','lt') ? $config->getValue('config.dbprefix') : $config->get('dbprefix'); + $config = Factory::getConfig(); + $dbprefix = \version_compare(JVERSION,'3.0','lt') ? $config->getValue('config.dbprefix') : $config->get('dbprefix'); $options = array(); - $options[] = JHtml::_('select.option', '', 'Select an option'); + $options[] = Html::_('select.option', '', 'Select an option'); for ($i=0; $i < count($tables); $i++) { //only tables with primary key @@ -55,7 +55,7 @@ class JFormFieldDbtables extends JFormFieldList if ($db->loadResult()) { $key = $i+1; - $options[$key] = new stdClass; + $options[$key] = new \stdClass; $options[$key]->value = str_replace($dbprefix, '', $tables[$i]); $options[$key]->text = $tables[$i]; } diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index 949d7d971..3a32a348c 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -961,7 +961,8 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'component_dashboard' => 'joomla_component', 'component_files_folders' => 'joomla_component', 'component_placeholders' => 'joomla_component', - 'custom_code' => 'component' + 'custom_code' => 'component', + 'component_router' => 'joomla_component' ); foreach($_tablesArray as $_updateTable => $_key) { @@ -1010,7 +1011,8 @@ class ComponentbuilderModelJoomla_component extends AdminModel 'component_dashboard' => 'joomla_component', 'component_files_folders' => 'joomla_component', 'component_placeholders' => 'joomla_component', - 'custom_code' => 'component' + 'custom_code' => 'component', + 'component_router' => 'joomla_component' ); foreach($_tablesArray as $_updateTable => $_key) { diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 20b0f2a4c..7a553cf40 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -326,7 +326,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_power` ( `add_head` TINYINT(1) NOT NULL DEFAULT 0, `add_licensing_template` TINYINT(1) NOT NULL DEFAULT 1, `approved` TINYINT(1) NOT NULL DEFAULT 0, - `approved_paths` TEXT NOT NULL, + `approved_paths` TEXT NULL, `composer` TEXT NULL, `description` TEXT NULL, `extends` VARCHAR(36) NOT NULL DEFAULT '', @@ -1177,11 +1177,11 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_fieldtype` ( CREATE TABLE IF NOT EXISTS `#__componentbuilder_language_translation` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `components` TEXT NOT NULL, - `modules` TEXT NOT NULL, - `plugins` TEXT NOT NULL, + `components` TEXT NULL, + `modules` TEXT NULL, + `plugins` TEXT NULL, `source` MEDIUMTEXT NOT NULL, - `translation` TEXT NOT NULL, + `translation` TEXT NULL, `params` text NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -2528,7 +2528,8 @@ INSERT INTO `#__componentbuilder_library_files_folders_urls` (`id`, `addfiles`, (8, '{}', '{}', '{\"addurls2\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/1.10.21\\/js\\/jquery.dataTables.min.js\",\"type\":2},\"addurls1\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/1.10.21\\/css\\/dataTables.uikit.min.css\",\"type\":2}}', 11, '', 1, '2020-06-27 21:34:44', '0000-00-00 00:00:00', 1, '', 7), (9, '{}', '{}', '{\"addurls3\":{\"url\":\"http:\\/\\/code.jquery.com\\/ui\\/1.11.1\\/themes\\/smoothness\\/jquery-ui.css\",\"type\":2},\"addurls0\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/jquery-ui-timepicker-addon\\/1.6.3\\/jquery-ui-timepicker-addon.min.css\",\"type\":2},\"addurls1\":{\"url\":\"http:\\/\\/code.jquery.com\\/ui\\/1.11.1\\/jquery-ui.min.js\",\"type\":2},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/jquery-ui-timepicker-addon\\/1.6.3\\/jquery-ui-timepicker-addon.min.js\",\"type\":2}}', 12, '', 1, '2020-06-29 00:00:44', '2020-06-29 04:32:57', 4, '', 8), (10, '{}', '{}', '{\"addurls0\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/v\\/dt\\/jszip-2.5.0\\/dt-1.11.5\\/b-2.2.2\\/b-colvis-2.2.2\\/b-html5-2.2.2\\/b-print-2.2.2\\/cr-1.5.5\\/date-1.1.2\\/fc-4.0.2\\/fh-3.2.2\\/kt-2.6.4\\/r-2.2.9\\/rg-1.1.4\\/rr-1.2.8\\/sc-2.0.5\\/sb-1.3.2\\/sp-2.0.0\\/sl-1.3.4\\/sr-1.1.0\\/datatables.min.css\",\"type\":3},\"addurls1\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/pdfmake\\/0.1.36\\/pdfmake.min.js\",\"type\":3},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/pdfmake\\/0.1.36\\/vfs_fonts.js\",\"type\":3},\"addurls3\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/v\\/dt\\/jszip-2.5.0\\/dt-1.11.5\\/b-2.2.2\\/b-colvis-2.2.2\\/b-html5-2.2.2\\/b-print-2.2.2\\/cr-1.5.5\\/date-1.1.2\\/fc-4.0.2\\/fh-3.2.2\\/kt-2.6.4\\/r-2.2.9\\/rg-1.1.4\\/rr-1.2.8\\/sc-2.0.5\\/sb-1.3.2\\/sp-2.0.0\\/sl-1.3.4\\/sr-1.1.0\\/datatables.min.js\",\"type\":3}}', 13, '', 1, '2022-10-17 20:56:24', '0000-00-00 00:00:00', 1, '', 9), -(11, '{}', '{}', '{\"addurls0\":{\"url\":\"https:\\/\\/cdn.jsdelivr.net\\/npm\\/nouislider\\/dist\\/nouislider.min.css\",\"type\":2},\"addurls1\":{\"url\":\"https:\\/\\/cdn.jsdelivr.net\\/npm\\/nouislider\\/dist\\/nouislider.min.js\",\"type\":2}}', 14, '', 1, '2023-06-26 15:02:42', '2023-07-24 18:11:41', 3, '', 10); +(11, '{}', '{}', '{\"addurls0\":{\"url\":\"https:\\/\\/cdn.jsdelivr.net\\/npm\\/nouislider\\/dist\\/nouislider.min.css\",\"type\":2},\"addurls1\":{\"url\":\"https:\\/\\/cdn.jsdelivr.net\\/npm\\/nouislider\\/dist\\/nouislider.min.js\",\"type\":2}}', 14, '', 1, '2023-06-26 15:02:42', '2023-07-24 18:11:41', 3, '', 10), +(12, '{}', '{}', '{\"addurls4\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/v\\/bs5\\/jszip-3.10.1\\/dt-2.0.2\\/b-3.0.1\\/b-colvis-3.0.1\\/b-html5-3.0.1\\/b-print-3.0.1\\/cr-2.0.0\\/date-1.5.2\\/fc-5.0.0\\/fh-4.0.1\\/kt-2.12.0\\/r-3.0.0\\/rg-1.5.0\\/rr-1.5.0\\/sc-2.4.1\\/sb-1.7.0\\/sp-2.3.0\\/sl-2.0.0\\/sr-1.4.0\\/datatables.min.css\",\"type\":3},\"addurls1\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/pdfmake\\/0.2.7\\/pdfmake.min.js\",\"type\":3},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/pdfmake\\/0.2.7\\/vfs_fonts.js\",\"type\":3},\"addurls3\":{\"url\":\"https:\\/\\/cdn.datatables.net\\/v\\/bs5\\/jszip-3.10.1\\/dt-2.0.2\\/b-3.0.1\\/b-colvis-3.0.1\\/b-html5-3.0.1\\/b-print-3.0.1\\/cr-2.0.0\\/date-1.5.2\\/fc-5.0.0\\/fh-4.0.1\\/kt-2.12.0\\/r-3.0.0\\/rg-1.5.0\\/rr-1.5.0\\/sc-2.4.1\\/sb-1.7.0\\/sp-2.3.0\\/sl-2.0.0\\/sr-1.4.0\\/datatables.min.js\",\"type\":3}}', 15, '', 1, '2024-03-09 16:27:28', '2024-03-09 16:29:30', 2, '', 9); CREATE TABLE IF NOT EXISTS `#__componentbuilder_external_code` ( diff --git a/admin/sql/updates/mysql/3.2.0-beta4.sql b/admin/sql/updates/mysql/3.2.0-beta4.sql new file mode 100644 index 000000000..376a853c3 --- /dev/null +++ b/admin/sql/updates/mysql/3.2.0-beta4.sql @@ -0,0 +1 @@ +ALTER TABLE `#__componentbuilder_joomla_component` ADD `preferred_joomla_version` INT(11) NOT NULL DEFAULT 3 AFTER `php_site_event`; diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index 058e1692c..d139f8f64 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -657,7 +657,7 @@ class ComponentbuilderViewCompiler extends HtmlView // add the document default css file Html::_('stylesheet', 'administrator/components/com_componentbuilder/assets/css/compiler.css', ['version' => 'auto']); // Set the Custom JS script to view - $this->document->addScriptDeclaration(" + $this->getDocument()->addScriptDeclaration(" function getComponentDetails_server(id) { let getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.getComponentDetails&format=json&raw=true\"); let request = new URLSearchParams(); diff --git a/admin/views/joomla_component/view.html.php b/admin/views/joomla_component/view.html.php index 10eb75b79..98b2ef178 100644 --- a/admin/views/joomla_component/view.html.php +++ b/admin/views/joomla_component/view.html.php @@ -215,9 +215,9 @@ class ComponentbuilderViewJoomla_component extends HtmlView Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']); Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']); // add var key - $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); + $this->getDocument()->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); // add return_here - $this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';"); + $this->getDocument()->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';"); Text::script('view not acceptable. Error'); } diff --git a/admin/views/search/tmpl/default.php b/admin/views/search/tmpl/default.php index 8ff6d21cf..d3faf5f51 100644 --- a/admin/views/search/tmpl/default.php +++ b/admin/views/search/tmpl/default.php @@ -17,11 +17,12 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\HTML\HTMLHelper as Html; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; -use VDM\Joomla\Utilities\ArrayHelper; Html::addIncludePath(JPATH_COMPONENT.'/helpers/html'); Html::_('behavior.formvalidator'); Html::_('formbehavior.chosen', 'select'); Html::_('behavior.keepalive'); +use Joomla\CMS\Session\Session; +use VDM\Joomla\Utilities\ArrayHelper; // allow main menu selection $this->app->input->set('hidemainmenu', false); @@ -159,7 +160,7 @@ $search_value = $this->form->getField('search_value'); const searchTables = item['tables']); ?>; // the search Ajax URLs -const UrlAjax = '&format=json&raw=true&=1&task=ajax.'; +const UrlAjax = '&format=json&raw=true&=1&task=ajax.'; // the search URL const UrlSearch = ''; diff --git a/admin/views/search/view.html.php b/admin/views/search/view.html.php index dd5df636f..e492287a6 100644 --- a/admin/views/search/view.html.php +++ b/admin/views/search/view.html.php @@ -24,6 +24,7 @@ use Joomla\CMS\Filesystem\File; use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory; use Joomla\CMS\Form\Form; use VDM\Joomla\Utilities\ArrayHelper; +use VDM\Joomla\Utilities\FormHelper; use VDM\Joomla\Utilities\StringHelper; /** @@ -149,7 +150,7 @@ class ComponentbuilderViewSearch extends HtmlView 2 => 'COM_COMPONENTBUILDER_REPLACE', 0 => 'COM_COMPONENTBUILDER_CLEAR']; // add to form - $xml = ComponentbuilderHelper::getFieldXML($attributes, $options); + $xml = FormHelper::xml($attributes, $options); if ($xml instanceof SimpleXMLElement) { $form->setField($xml, null, true, 'search'); @@ -170,7 +171,7 @@ class ComponentbuilderViewSearch extends HtmlView 'autocomplete' => true, 'default' => $this->urlvalues['search_value']]; // add to form - $xml = ComponentbuilderHelper::getFieldXML($attributes); + $xml = FormHelper::xml($attributes); if ($xml instanceof SimpleXMLElement) { $form->setField($xml, null, true, 'search'); @@ -192,7 +193,7 @@ class ComponentbuilderViewSearch extends HtmlView 'showon' => 'type_search:2', 'default' => $this->urlvalues['replace_value']]; // add to form - $xml = ComponentbuilderHelper::getFieldXML($attributes); + $xml = FormHelper::xml($attributes); if ($xml instanceof SimpleXMLElement) { $form->setField($xml, null, true, 'search'); @@ -227,7 +228,7 @@ class ComponentbuilderViewSearch extends HtmlView 'whole_word' => 'COM_COMPONENTBUILDER_WHOLE_WORD', 'regex_search' => 'COM_COMPONENTBUILDER_REGEX_SEARCH']; // add to form - $xml = ComponentbuilderHelper::getFieldXML($attributes, $options); + $xml = FormHelper::xml($attributes, $options); if ($xml instanceof SimpleXMLElement) { $form->setField($xml, null, true, 'settings'); @@ -253,7 +254,7 @@ class ComponentbuilderViewSearch extends HtmlView $options[(int) $component->id] = $this->escape($component->name); } // add to form - $xml = ComponentbuilderHelper::getFieldXML($attributes, $options); + $xml = FormHelper::xml($attributes, $options); if ($xml instanceof SimpleXMLElement) { $form->setField($xml, null, true, 'settings'); @@ -277,7 +278,7 @@ class ComponentbuilderViewSearch extends HtmlView $options[$table] = $this->escape($table); } // add to form - $xml = ComponentbuilderHelper::getFieldXML($attributes, $options); + $xml = FormHelper::xml($attributes, $options); if ($xml instanceof SimpleXMLElement) { $form->setField($xml, null, true, 'settings'); @@ -296,7 +297,7 @@ class ComponentbuilderViewSearch extends HtmlView 'filter' => 'raw', 'editor' => 'codemirror|none']; // add to form - $xml = ComponentbuilderHelper::getFieldXML($attributes, $options); + $xml = FormHelper::xml($attributes, $options); if ($xml instanceof SimpleXMLElement) { $form->setField($xml, null, true, 'view'); diff --git a/componentbuilder.xml b/componentbuilder.xml index 6139189f6..4522d5274 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,15 +1,15 @@ COM_COMPONENTBUILDER - 7th March, 2024 + 9th March, 2024 Llewellyn van der Merwe joomla@vdm.io https://dev.vdm.io Copyright (C) 2015 Vast Development Method. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 3.2.0-beta4 + 3.2.0-beta5 Component Builder (v.3.2.0-beta4) +

Component Builder (v.3.2.0-beta5)

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 3e2fa4896..5818eb907 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -1595,4 +1595,22 @@ https://dev.vdm.io + + Component Builder + Builds Complex Joomla Components + pkg_component_builder + package + site + 3.2.0-beta5 + https://dev.vdm.io + + https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v3.2.0-beta5.zip + + + beta + + Llewellyn van der Merwe + https://dev.vdm.io + + \ No newline at end of file diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/CustomFieldTypeFile.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/CustomFieldTypeFile.php index 0226fdfc2..2ec77fed4 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/CustomFieldTypeFile.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Creator/CustomFieldTypeFile.php @@ -645,21 +645,48 @@ final class CustomFieldTypeFile $core_fields = $this->corefield->get(); $extends = $this->extends; - + $found = null; foreach ($core_fields as $core_field) { $field = strtolower((string) $core_field); if ($extends === $field) { - $this->fieldmap[$extends] = $core_field; - - return $core_field; + $found = $core_field; + break; } } - $this->fieldmap[$extends] = StringHelper::safe($extends, 'F'); + $extends = $found ?? StringHelper::safe($extends, 'F'); - return $this->fieldmap[$extends]; + if ($this->config->get('joomla_version', 3) != 3) + { + $fix = strtolower($extends); + + if ('checkboxes' === $fix) + { + $extends = 'CheckboxesField'; + } + elseif ('list' === $fix) + { + $extends = 'FormField'; + } + elseif ('radio' === $fix) + { + $extends = 'RadioField'; + } + elseif ('combo' === $fix) + { + $extends = 'ComboField'; + } + elseif (strpos($extends, 'Field') === false) + { + $extends = StringHelper::safe($extends, 'F') . 'Field'; + } + } + + $this->fieldmap[$this->extends] = $extends; + + return $extends; } /** diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php index 4b163f1ad..db37a3e20 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php @@ -600,6 +600,13 @@ class Infusion extends Interpretation ) ); + // AJAXTOKE <<>> + CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|AJAXTOKE', + $this->setAjaxToke( + $nameSingleCode + ) + ); + // add css to front end if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) @@ -681,6 +688,13 @@ class Infusion extends Interpretation ) ); + // JQUERY <<>> + CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|JQUERY', + $this->setJquery( + $nameSingleCode + ) + ); + // Trigger Event: jcb_ce_onAfterBuildAdminEditViewContent CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildAdminEditViewContent',[&$view, &$nameSingleCode, &$nameListCode] @@ -1015,6 +1029,13 @@ class Infusion extends Interpretation ) ); + // JQUERY <<>> + CFactory::_('Compiler.Builder.Content.Multi')->set($nameListCode . '|JQUERY', + $this->setJquery( + $nameSingleCode + ) + ); + // Trigger Event: jcb_ce_onAfterBuildAdminListViewContent CFactory::_('Event')->trigger( 'jcb_ce_onAfterBuildAdminListViewContent', [&$view, &$nameSingleCode, &$nameListCode] diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php index 6a9fd36a1..1e11ffa4f 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php @@ -5654,7 +5654,7 @@ class Interpretation extends Fields . " Add the needed Javascript to insure that the buttons work."; $script[] = Indent::_(2) . "Html::_('behavior.framework', true);"; $script[] = Indent::_(2) - . "\$this->document->addScriptDeclaration(\"Joomla.submitbutton = function(task){if (task == ''){ return false; } else { Joomla.submitform(task); return true; }}\");"; + . "\$this->getDocument()->addScriptDeclaration(\"Joomla.submitbutton = function(task){if (task == ''){ return false; } else { Joomla.submitform(task); return true; }}\");"; // return the script return PHP_EOL . implode(PHP_EOL, $script); @@ -5780,7 +5780,7 @@ class Interpretation extends Fields $script = PHP_EOL . Indent::_(2) . "//" . Line::_( __LINE__,__CLASS__ ) . " Set the Custom JS script to view" . PHP_EOL - . Indent::_(2) . '$this->document->addScriptDeclaration("'; + . Indent::_(2) . '$this->getDocument()->addScriptDeclaration("'; $jsDocument = PHP_EOL . Indent::_(3) . str_replace( '"', '\"', implode( PHP_EOL . Indent::_(3), @@ -17760,6 +17760,19 @@ class Interpretation extends Fields return $methods; } + public function setJquery(&$view) + { + $addJQuery = ''; + if (true) // TODO we just add it everywhere for now. + { + $addJQuery .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__, __Class__) + . " Load jQuery"; + $addJQuery .= PHP_EOL . Indent::_(2) . "Html::_('jquery.framework');"; + } + + return $addJQuery; + } + /** * build filter functions * diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Power/Database/Load.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Power/Database/Load.php index 42f5632d8..778fdf1f2 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Power/Database/Load.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Power/Database/Load.php @@ -73,7 +73,7 @@ final class Load { return $this->model->value( $this->load->value( - ["a.${field}" => $field], + ["a.{$field}" => $field], ['a' => 'power'], $this->prefix($keys) ), diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Database/Insert.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Database/Insert.php index afce63c7c..89106bf0a 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Database/Insert.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Database/Insert.php @@ -55,10 +55,9 @@ class Insert implements InsertInterface /** * Database object to query local DB * - * @var \JDatabaseDriver * @since 3.2.0 **/ - protected \JDatabaseDriver $db; + protected $db; /** * Constructor @@ -66,17 +65,16 @@ class Insert implements InsertInterface * @param Config|null $config The search config object. * @param Table|null $table The search table object. * @param Model|null $model The search get model object. - * @param \JDatabaseDriver|null $db The database object. * * @since 3.2.0 */ public function __construct(?Config $config = null, ?Table $table = null, - ?Model $model = null, ?\JDatabaseDriver $db = null) + ?Model $model = null) { $this->config = $config ?: Factory::_('Config'); $this->table = $table ?: Factory::_('Table'); $this->model = $model ?: Factory::_('Insert.Model'); - $this->db = $db ?: JoomlaFactory::getDbo(); + $this->db = JoomlaFactory::getDbo(); } /** diff --git a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Model/Load.php b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Model/Load.php index 07dd04bd4..a1149a26e 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Model/Load.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Search/Model/Load.php @@ -119,13 +119,35 @@ class Load extends Model implements ModelInterface */ protected function validateAfter(&$value, ?string $field = null, ?string $table = null): bool { + // Start note to self + // Yes we don't search in the field->xml (field) PHP because the xml is messy + // first of all we need to change that storage method :((( seriously + // and the actual PHP is stored in the xml as base64 with a [__.o0=base64=Oo.__] key in front of it + // if I can go back and drag you around by your ear... I will, but okay you did not know better. + // Listen you have tried to fix this a few times already (I lost count) and by the time you realize how it works + // two hours have been wasted, and you usually only then realize why it's not fixed in the first place... o boy... just walk now! + // since unless you have three days don't even look further, this is a huge issue/mess + // and while I agree it needs fixing, it will not take a few hours... but days + // End note to self + // check values if (StringHelper::check($value) || ArrayHelper::check($value, true)) { return true; } + // remove empty values return false; + + // Start another note to self + // If you're still here + // the problem is not opening the PHP in the xml, + // it is storing it with the updated changes... if any are made via the search-update methods + // so the only way to fix this is to change the whole way the xml values in the field table is stored. + // Yes, that is right... all the way back to the field view... and then to update all places you open that xml values + // and get the values out of the xml string and use them, and if you've forgotten, that is nearly everywhere, + // and so let the refactoring of the foundation begin... there I saved you another 3 hours. + // End another note to self } /** diff --git a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FormHelper.php b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FormHelper.php index a2f48fd41..b21d71c3c 100644 --- a/libraries/jcb_powers/VDM.Joomla/src/Utilities/FormHelper.php +++ b/libraries/jcb_powers/VDM.Joomla/src/Utilities/FormHelper.php @@ -75,24 +75,24 @@ abstract class FormHelper // element was not returned return; } - switch (get_class($node)) + + if ($node instanceof \stdClass) { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::comment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::append($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = \dom_import_simplexml($xml); - $domNode = \dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = \simplexml_import_dom($domXML); - break; + if (property_exists($node, 'comment')) + { + self::comment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::append($xml, $node->fieldXML); + } + } + elseif ($node instanceof \SimpleXMLElement) + { + $domXML = \dom_import_simplexml($xml); + $domNode = \dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = \simplexml_import_dom($domXML); } } @@ -127,7 +127,7 @@ abstract class FormHelper { foreach ($attributes as $key => $value) { - $xml->addAttribute($key, $value); + $xml->addAttribute($key, $value ?? ''); } } @@ -145,7 +145,7 @@ abstract class FormHelper foreach ($options as $key => $value) { $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); + $addOption->addAttribute('value', $key ?? ''); $addOption[] = $value; } } diff --git a/script.php b/script.php index 1e5f01245..994e52e31 100644 --- a/script.php +++ b/script.php @@ -9618,7 +9618,7 @@ class Com_ComponentbuilderInstallerScript echo '

-

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

'; +

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

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