Release of v5.1.1-alpha5

Refactor initialization flow to accommodate future scalability and integration with all designated areas. Refactor the Creator Builders class. Refactor the FieldString and FieldXML classes.
This commit is contained in:
2025-05-13 13:39:32 +00:00
parent 0b7e68d14e
commit 3b502eb09b
336 changed files with 22863 additions and 20677 deletions

View File

@ -24,8 +24,8 @@ use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Data\Factory as DataFactory;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Data\Factory as DataFactory;
// No direct access to this file
\defined('_JEXEC') or die;
@ -80,6 +80,129 @@ class LibraryController extends FormController
*/
protected int $refid;
/**
* Method to edit an existing record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key
* (sometimes required to avoid router collisions).
*
* @return boolean True if access level check and checkout passes, false otherwise.
*
* @since 1.6
*/
public function edit($key = null, $urlVar = null)
{
// for modal title key selection (unique key to do mapping)
$titleKey = $this->input->get('titleKey', 'id', 'word');
$guid = null;
$value = null;
// Determine the name of the primary key for the data.
if (empty($key))
{
$model = $this->getModel();
$table = $model->getTable();
$key = $table->getKeyName();
}
if ($titleKey === 'guid')
{
$guid = $this->input->get('guid', null, 'string');
}
if ($guid !== null && GuidHelper::valid($guid))
{
$value = GuidHelper::item($guid, 'library', 'a.' . $key, 'componentbuilder');
}
if ($value !== null)
{
$this->input->set($key, $value);
}
return parent::edit($key, $urlVar);
}
/**
* Resets the specified Library.
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It retrieves the item data posted by the user.
* 3. It checks whether the current user has the necessary permissions to reset the Library.
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
* 5. If the user is authorized and the identifiers are valid, it attempts to reset the specified Library.
* 6. Depending on the result of the reset operation, it sets the appropriate success or error message.
* 7. It redirects the user to a specified URL with the result message and status.
*
* @return bool True on successful reset, false on failure.
*/
public function resetPowers()
{
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// get Item posted
$item = $this->input->post->get('jform', array(), 'array');
// load the ID
$id = $item['id'] ?? null;
// set default in development message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_RESET_BOTH_DEMO_AND_USERCREATED_LIBRARY_WITHIN_THIS_JCB_INSTANCE') . '</p>';
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=library'
. $this->getRedirectToItemAppend($id), false
);
$this->setRedirect($redirect_url, $message, 'success');
return true;
}
/**
* Pushes the specified Library.
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It retrieves the item data posted by the user.
* 3. It checks whether the current user has the necessary permissions to push the Library.
* 4. It validates the presence of the necessary item identifiers (ID and GUID).
* 5. If the user is authorized and the identifiers are valid, it attempts to push the specified Library.
* 6. Depending on the result of the push operation, it sets the appropriate success or error message.
* 7. It redirects the user to a specified URL with the result message and status.
*
* @return bool True on successful push, false on failure.
*/
public function pushPowers()
{
// Check for request forgeries
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
// get Item posted
$item = $this->input->post->get('jform', array(), 'array');
// load the ID
$id = $item['id'] ?? null;
// set default in development message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_STILL_IN_DEVELOPMENT') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_ONCE_COMPLETED_THIS_FEATURE_WILL_ALLOW_YOU_TO_PUSH_USERCREATED_LIBRARY_FROM_THIS_JCB_INSTANCE_TO_YOUR_CONFIGURED_REPOSITORIES') . '</p>';
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=library'
. $this->getRedirectToItemAppend($id), false
);
$this->setRedirect($redirect_url, $message, 'success');
return true;
}
/**
* Method override to check if you can add a new record.
*