Release of v5.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. Fix the admin.css file loading on dashboard. #1112. Fix dynamic get data-type default to 0. #1110.
This commit is contained in:
Robot 2024-04-30 19:21:28 +02:00
parent 8ab5f2daf4
commit a24b5a0757
Signed by untrusted user: Robot
GPG Key ID: 14DECD44E7E1BB95
15 changed files with 271 additions and 60 deletions

View File

@ -1,9 +1,11 @@
# v5.0.0-rc2
# v5.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.
- Fix the admin.css file loading on dashboard. #1112
- Fix dynamic get data-type default to 0. #1110
# v5.0.0-beta
@ -43,12 +45,14 @@
- Add power path override option on component level.
- Fix the sql build feature. #1032
# 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.
- Fix the admin.css file loading on dashboard. #1112
- Fix dynamic get data-type default to 0. #1110
# v3.2.0

View File

@ -3210,7 +3210,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 5.0.0-rc2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
<h3>Upgrade to Version 5.0.0-rc3 Was Successful! Let us know if anything is not working as expected.</h3></div>';
// Add/Update component in the action logs extensions table.
$this->setActionLogsExtensions();

View File

@ -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 (5.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 (5.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*: 5.0.0-rc2
+ *Version*: 5.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*: **745955**
+ *Line count*: **746213**
+ *Field count*: **2097**
+ *File count*: **5289**
+ *Folder count*: **528**

View File

@ -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 (5.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 (5.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*: 5.0.0-rc2
+ *Version*: 5.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*: **745955**
+ *Line count*: **746213**
+ *Field count*: **2097**
+ *File count*: **5289**
+ *Folder count*: **528**

View File

@ -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###
}

View File

@ -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']);
}
}
}

View File

@ -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"
/>

View File

@ -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"
/>

View File

@ -148,6 +148,9 @@ class DynamicgetField extends ListField
*/
protected function getOptions()
{
// 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')));
@ -156,11 +159,13 @@ class DynamicgetField extends ListField
$query->order('a.name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
$options = [];
if ($items)
{
$options[] = Html::_('select.option', '', 'Select an option');
$model = ComponentbuilderHelper::getModel('dynamic_gets');
if ($this->multiple === false)
{
$options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
}
foreach($items as $item)
{
$type = $model->selectionTranslation($item->type,'gettype');

View File

@ -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()
{

View File

@ -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']);
}
}
}

View File

@ -7,9 +7,9 @@
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>5.0.0-rc2</version>
<version>5.0.0-rc3</version>
<description><![CDATA[
<h1>Component Builder (v.5.0.0-rc2)</h1>
<h1>Component Builder (v.5.0.0-rc3)</h1>
<div style="clear: both;"></div>
<p>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.

View File

@ -23,10 +23,10 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>4.0.0-rc2</version>
<version>4.0.0-rc3</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.0-rc2.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.0-rc3.zip</downloadurl>
</downloads>
<tags>
<tag>beta</tag>
@ -77,10 +77,10 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>5.0.0-rc2</version>
<version>5.0.0-rc3</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-rc2.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v5.0.0-rc3.zip</downloadurl>
</downloads>
<tags>
<tag>releasecandidate</tag>

View File

@ -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);
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);
}
}