diff --git a/CHANGELOG.md b/CHANGELOG.md
index 253e50644..c5c9dbb16 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,11 @@
-# v4.0.0-rc2
+# v4.0.0-rc3
- Improved the Schema Table update engine (more).
- Fix autoloader timing, and loading.
- Implement the Joomla Powers in JCB code, to move away from JClasses.
-- Remove the SQL update, to only use the Schema updates of table columns to avoid collusion.
+- Remove the SQL update, to only use the Schema updates of table columns to avoid collusion.
+- Fix the admin.css file loading on dashboard. #1112
+- Fix dynamic get data-type default to 0. #1110
# v4.0.0-beta
diff --git a/ComponentbuilderInstallerScript.php b/ComponentbuilderInstallerScript.php
index 2b3e75d78..e58304f2d 100644
--- a/ComponentbuilderInstallerScript.php
+++ b/ComponentbuilderInstallerScript.php
@@ -3210,7 +3210,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
echo '
-
Upgrade to Version 4.0.0-rc2 Was Successful! Let us know if anything is not working as expected.
';
+ Upgrade to Version 4.0.0-rc3 Was Successful! Let us know if anything is not working as expected.
';
// Add/Update component in the action logs extensions table.
$this->setActionLogsExtensions();
diff --git a/README.md b/README.md
index 500d1dca5..04e05cc87 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 (4.0.0-rc2) 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 (4.0.0-rc3) 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)
@@ -145,10 +145,10 @@ TODO
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 30th April, 2024
-+ *Version*: 4.0.0-rc2
++ *Version*: 4.0.0-rc3
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
-+ *Line count*: **745929**
++ *Line count*: **746185**
+ *Field count*: **2097**
+ *File count*: **5288**
+ *Folder count*: **528**
diff --git a/admin/README.txt b/admin/README.txt
index 500d1dca5..04e05cc87 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 (4.0.0-rc2) 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 (4.0.0-rc3) 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)
@@ -145,10 +145,10 @@ TODO
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 30th April, 2024
-+ *Version*: 4.0.0-rc2
++ *Version*: 4.0.0-rc3
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
-+ *Line count*: **745929**
++ *Line count*: **746185**
+ *Field count*: **2097**
+ *File count*: **5288**
+ *Folder count*: **528**
diff --git a/admin/compiler/joomla_4/DASH_MODEL.php b/admin/compiler/joomla_4/DASH_MODEL.php
index 5e14fff76..4cbaf38a2 100644
--- a/admin/compiler/joomla_4/DASH_MODEL.php
+++ b/admin/compiler/joomla_4/DASH_MODEL.php
@@ -27,6 +27,27 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
*/
class ###Component###Model extends ListModel
{
+ /**
+ * The styles array.
+ *
+ * @var array
+ * @since 4.3
+ */
+ protected array $styles = [
+ 'administrator/components/com_###component###/assets/css/admin.css',
+ 'administrator/components/com_###component###/assets/css/dashboard.css'
+ ];
+
+ /**
+ * The scripts array.
+ *
+ * @var array
+ * @since 4.3
+ */
+ protected array $scripts = [
+ 'administrator/components/com_###component###/assets/js/admin.js'
+ ];
+
public function getIcons()
{
// load user for access menus
@@ -221,5 +242,49 @@ class ###Component###Model extends ListModel
}
}
return $icons;
+ }
+
+ /**
+ * Method to get the styles that have to be included on the view
+ *
+ * @return array styles files
+ * @since 4.3
+ */
+ public function getStyles(): array
+ {
+ return $this->styles;
+ }
+
+ /**
+ * Method to set the styles that have to be included on the view
+ *
+ * @return void
+ * @since 4.3
+ */
+ public function setStyles(string $path): void
+ {
+ $this->styles[] = $path;
+ }
+
+ /**
+ * Method to get the script that have to be included on the view
+ *
+ * @return array script files
+ * @since 4.3
+ */
+ public function getScripts(): array
+ {
+ return $this->scripts;
+ }
+
+ /**
+ * Method to set the script that have to be included on the view
+ *
+ * @return void
+ * @since 4.3
+ */
+ public function setScript(string $path): void
+ {
+ $this->scripts[] = $path;
}###DASH_MODEL_METHODS###
}
diff --git a/admin/compiler/joomla_4/DASH_VIEW_HTML.php b/admin/compiler/joomla_4/DASH_VIEW_HTML.php
index 8e6decf8b..db91cf460 100644
--- a/admin/compiler/joomla_4/DASH_VIEW_HTML.php
+++ b/admin/compiler/joomla_4/DASH_VIEW_HTML.php
@@ -35,6 +35,8 @@ class HtmlView extends BaseHtmlView
{
// Assign data to the view
$this->icons = $this->get('Icons');
+ $this->styles = $this->get('Styles');
+ $this->scripts = $this->get('Scripts');
$this->contributors = ###Component###Helper::getContributors();
// get the manifest details of the component
@@ -90,11 +92,17 @@ class HtmlView extends BaseHtmlView
{
// set page title
$this->getDocument()->setTitle(Text::_('COM_###COMPONENT###_DASHBOARD'));
-
// add manifest to page JavaScript
$this->getDocument()->addScriptDeclaration("var manifest = JSON.parse('" . json_encode($this->manifest) . "');", "text/javascript");
-
- // add dashboard style sheets
- Html::_('stylesheet', "administrator/components/com_###component###/assets/css/dashboard.css", ['version' => 'auto']);
+ // add styles
+ foreach ($this->styles as $style)
+ {
+ Html::_('stylesheet', $style, ['version' => 'auto']);
+ }
+ // add scripts
+ foreach ($this->scripts as $script)
+ {
+ Html::_('script', $script, ['version' => 'auto']);
+ }
}
}
diff --git a/admin/forms/layout.xml b/admin/forms/layout.xml
index 4f50376b3..6b3690f00 100644
--- a/admin/forms/layout.xml
+++ b/admin/forms/layout.xml
@@ -136,7 +136,7 @@
label="COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_LABEL"
description="COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_DESCRIPTION"
multiple="false"
- default=""
+ default="0"
required="false"
button="true"
/>
diff --git a/admin/forms/template.xml b/admin/forms/template.xml
index 207341566..5887b7bc4 100644
--- a/admin/forms/template.xml
+++ b/admin/forms/template.xml
@@ -136,7 +136,7 @@
label="COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL"
description="COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_DESCRIPTION"
multiple="false"
- default=""
+ default="0"
required="false"
button="true"
/>
diff --git a/admin/src/Field/DynamicgetField.php b/admin/src/Field/DynamicgetField.php
index 2df29fe89..0e13f11ac 100644
--- a/admin/src/Field/DynamicgetField.php
+++ b/admin/src/Field/DynamicgetField.php
@@ -148,25 +148,30 @@ class DynamicgetField extends ListField
*/
protected function getOptions()
{
- $db = Factory::getDBO();
- $query = $db->getQuery(true);
- $query->select($db->quoteName(array('a.id','a.name','a.gettype'),array('id','dynamic_get_name','type')));
- $query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a'));
- $query->where($db->quoteName('a.published') . ' = 1');
-$query->order('a.name ASC');
- $db->setQuery((string)$query);
- $items = $db->loadObjectList();
- $options = array();
- if ($items)
- {
- $options[] = Html::_('select.option', '', 'Select an option');
- $model = ComponentbuilderHelper::getModel('dynamic_gets');
- foreach($items as $item)
- {
- $type = $model->selectionTranslation($item->type,'gettype');
- $options[] = Html::_('select.option', $item->id, $item->dynamic_get_name . ' (' . Text::_($type) . ')' );
- }
- }
+ // Get the user object.
+ $user = Factory::getApplication()->getIdentity();
+ // Get the databse object.
+ $db = Factory::getDBO();
+ $query = $db->getQuery(true);
+ $query->select($db->quoteName(array('a.id','a.name','a.gettype'),array('id','dynamic_get_name','type')));
+ $query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a'));
+ $query->where($db->quoteName('a.published') . ' = 1');
+ $query->order('a.name ASC');
+ $db->setQuery((string)$query);
+ $items = $db->loadObjectList();
+ $options = [];
+ if ($items)
+ {
+ if ($this->multiple === false)
+ {
+ $options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
+ }
+ foreach($items as $item)
+ {
+ $type = $model->selectionTranslation($item->type,'gettype');
+ $options[] = Html::_('select.option', $item->id, $item->dynamic_get_name . ' (' . Text::_($type) . ')' );
+ }
+ }
return $options;
}
}
diff --git a/admin/src/Model/ComponentbuilderModel.php b/admin/src/Model/ComponentbuilderModel.php
index 0c84f7ee8..7c6791ded 100644
--- a/admin/src/Model/ComponentbuilderModel.php
+++ b/admin/src/Model/ComponentbuilderModel.php
@@ -38,6 +38,27 @@ use VDM\Joomla\Utilities\StringHelper;
*/
class ComponentbuilderModel extends ListModel
{
+ /**
+ * The styles array.
+ *
+ * @var array
+ * @since 4.3
+ */
+ protected array $styles = [
+ 'administrator/components/com_componentbuilder/assets/css/admin.css',
+ 'administrator/components/com_componentbuilder/assets/css/dashboard.css'
+ ];
+
+ /**
+ * The scripts array.
+ *
+ * @var array
+ * @since 4.3
+ */
+ protected array $scripts = [
+ 'administrator/components/com_componentbuilder/assets/js/admin.js'
+ ];
+
public function getIcons()
{
// load user for access menus
@@ -432,6 +453,50 @@ class ComponentbuilderModel extends ListModel
return $icons;
}
+ /**
+ * Method to get the styles that have to be included on the view
+ *
+ * @return array styles files
+ * @since 4.3
+ */
+ public function getStyles(): array
+ {
+ return $this->styles;
+ }
+
+ /**
+ * Method to set the styles that have to be included on the view
+ *
+ * @return void
+ * @since 4.3
+ */
+ public function setStyles(string $path): void
+ {
+ $this->styles[] = $path;
+ }
+
+ /**
+ * Method to get the script that have to be included on the view
+ *
+ * @return array script files
+ * @since 4.3
+ */
+ public function getScripts(): array
+ {
+ return $this->scripts;
+ }
+
+ /**
+ * Method to set the script that have to be included on the view
+ *
+ * @return void
+ * @since 4.3
+ */
+ public function setScript(string $path): void
+ {
+ $this->scripts[] = $path;
+ }
+
public function getWiki()
{
diff --git a/admin/src/View/Componentbuilder/HtmlView.php b/admin/src/View/Componentbuilder/HtmlView.php
index 4d878d056..fe8755b3e 100644
--- a/admin/src/View/Componentbuilder/HtmlView.php
+++ b/admin/src/View/Componentbuilder/HtmlView.php
@@ -37,6 +37,8 @@ class HtmlView extends BaseHtmlView
{
// Assign data to the view
$this->icons = $this->get('Icons');
+ $this->styles = $this->get('Styles');
+ $this->scripts = $this->get('Scripts');
$this->contributors = ComponentbuilderHelper::getContributors();
// get the manifest details of the component
@@ -96,11 +98,17 @@ class HtmlView extends BaseHtmlView
{
// set page title
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_DASHBOARD'));
-
// add manifest to page JavaScript
$this->getDocument()->addScriptDeclaration("var manifest = JSON.parse('" . json_encode($this->manifest) . "');", "text/javascript");
-
- // add dashboard style sheets
- Html::_('stylesheet', "administrator/components/com_componentbuilder/assets/css/dashboard.css", ['version' => 'auto']);
+ // add styles
+ foreach ($this->styles as $style)
+ {
+ Html::_('stylesheet', $style, ['version' => 'auto']);
+ }
+ // add scripts
+ foreach ($this->scripts as $script)
+ {
+ Html::_('script', $script, ['version' => 'auto']);
+ }
}
}
diff --git a/componentbuilder.xml b/componentbuilder.xml
index d614cf5ba..81baa0795 100644
--- a/componentbuilder.xml
+++ b/componentbuilder.xml
@@ -7,9 +7,9 @@
https://dev.vdm.io
Copyright (C) 2015 Vast Development Method. All rights reserved.
GNU General Public License version 2 or later; see LICENSE.txt
- 4.0.0-rc2
+ 4.0.0-rc3
Component Builder (v.4.0.0-rc2)
+ Component Builder (v.4.0.0-rc3)
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 b57283f58..f97bead05 100644
--- a/componentbuilder_update_server.xml
+++ b/componentbuilder_update_server.xml
@@ -59,10 +59,10 @@
pkg_component_builder
package
site
- 4.0.0-rc2
+ 4.0.0-rc3
https://dev.vdm.io
- https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.0-rc2.zip
+ https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.0-rc3.zip
releasecandidate
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Schema.php b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Schema.php
index 95d427abf..694bbc927 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Schema.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Schema.php
@@ -342,9 +342,16 @@ abstract class Schema implements SchemaInterface
'current' => $current->Type,
'expected' => $expected['type']
];
+ }
- // check if update of default values is needed
- $this->checkDefault($table, $column);
+ // check if update of default values is needed
+ if ($this->checkDefault($table, $column) && !isset($requireUpdate[$column]))
+ {
+ $requireUpdate[$column] = [
+ 'column' => $column,
+ 'current' => $current->Type,
+ 'expected' => $expected['type']
+ ];
}
}
@@ -402,29 +409,23 @@ abstract class Schema implements SchemaInterface
* @param string $table The table to update.
* @param string $column The column/field to check.
*
- * @return void
+ * @return bool
* @since 3.2.1
*/
- protected function checkDefault(string $table, string $column): void
+ protected function checkDefault(string $table, string $column): bool
{
// Retrieve the expected column configuration
$expected = $this->table->get($table, $column, 'db');
// Skip updates if the column is auto_increment
- if (isset($expected['auto_increment']) && $expected['auto_increment'])
+ if (isset($expected['auto_increment']) && $expected['auto_increment'] === true)
{
- return;
+ return false;
}
// Retrieve the current column configuration
$current = $this->columns[$column];
- // Check if default should be empty and current default is null, skip processing
- if (strtoupper($expected['default']) === 'EMPTY' && $current->Default === NULL)
- {
- return;
- }
-
// Determine the new default value based on the expected settings
$type = $expected['type'] ?? 'TEXT';
$db_default = isset($expected['default']) ? $expected['default'] : null;
@@ -434,7 +435,17 @@ abstract class Schema implements SchemaInterface
if (is_numeric($newDefault) && $this->adjustExistingDefaults($table, $column, $current->Default, $newDefault))
{
$this->success[] = "Success: updated the ($column) defaults in $table table.";
+
+ return true;
}
+
+ if (is_string($expected['default']) && strtoupper($expected['default']) === 'EMPTY' &&
+ is_string($current->Default) && strpos($current->Default, 'EMPTY') !== false)
+ {
+ return true; // little fix
+ }
+
+ return false;
}
/**
@@ -680,7 +691,7 @@ abstract class Schema implements SchemaInterface
*/
protected function getDefaultValue(string $type, ?string $defaultValue, bool $pure = false): string
{
- if ($defaultValue === null || strtoupper($defaultValue) === 'EMPTY')
+ if ($defaultValue === null)
{
return '';
}
@@ -692,7 +703,52 @@ abstract class Schema implements SchemaInterface
}
// Apply and quote the default value
- return $pure ? $defaultValue : " DEFAULT " . $this->db->quote($defaultValue);
+ $sql_default = $this->quote($defaultValue);
+ return $pure ? $defaultValue : " DEFAULT $sql_default";
+ }
+
+ /**
+ * Set a value based on data type
+ *
+ * @param mixed $value The value to set
+ *
+ * @return mixed
+ * @since 3.2.0
+ **/
+ protected function quote($value)
+ {
+ if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
+ {
+ return 'NULL';
+ }
+
+ if (is_string($value) && strtoupper($value) === 'EMPTY')
+ {
+ return "''";
+ }
+ elseif (is_numeric($value))
+ {
+ if (filter_var($value, FILTER_VALIDATE_INT))
+ {
+ return (int) $value;
+ }
+ elseif (filter_var($value, FILTER_VALIDATE_FLOAT))
+ {
+ return (float) $value;
+ }
+ }
+ elseif (is_bool($value)) // not sure if this will work well (but its correct)
+ {
+ return $value ? 'TRUE' : 'FALSE';
+ }
+ // For date and datetime values
+ elseif ($value instanceof \DateTime)
+ {
+ return $this->db->quote($value->format('Y-m-d H:i:s'));
+ }
+
+ // For other data types, just escape it
+ return $this->db->quote($value);
}
}