Release of v4.0.3-alpha1

Add push option to powers area.
This commit is contained in:
2024-08-20 22:33:47 +02:00
parent b8b885444c
commit 443a2aac58
29 changed files with 1479 additions and 105 deletions

View File

@@ -3,13 +3,13 @@
This is a [Joomla 4.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/master/admin/assets/images/jcb-banner.jpg "The Component Builder")
![Component Builder image](https://git.vdm.dev/joomla/Component-Builder/raw/branch/5.x/admin/assets/images/jcb-banner.jpg "The Component Builder")
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.
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.2) 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.3-alpha1) 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*: 16th August, 2024
+ *Version*: 4.0.2
+ *Last Build*: 20th August, 2024
+ *Version*: 4.0.3-alpha1
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **824275**
+ *Field count*: **2094**
+ *File count*: **5732**
+ *Line count*: **828072**
+ *Field count*: **2098**
+ *File count*: **5739**
+ *Folder count*: **606**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).

View File

@@ -465,6 +465,7 @@
<action name="placeholder.version" title="COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_PLACEHOLDERS_EDIT_VERSION_DESC" />
<action name="placeholder.submenu" title="COM_COMPONENTBUILDER_PLACEHOLDERS_SUBMENU" description="COM_COMPONENTBUILDER_PLACEHOLDERS_SUBMENU_DESC" />
<action name="power.init" title="COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS_DESC" />
<action name="power.push" title="COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS_DESC" />
<action name="power.reset" title="COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS_DESC" />
<action name="power.access" title="COM_COMPONENTBUILDER_POWERS_ACCESS" description="COM_COMPONENTBUILDER_POWERS_ACCESS_DESC" />
<action name="power.batch" title="COM_COMPONENTBUILDER_POWERS_BATCH_USE" description="COM_COMPONENTBUILDER_POWERS_BATCH_USE_DESC" />

View File

@@ -426,7 +426,7 @@ class ###Component###Model###View### extends AdminModel
*
* @since 3.0
*/
protected function generateUnique($field,$value)
protected function generateUnique($field, $value)
{
// set field value unique
$table = $this->getTable();

View File

@@ -210,6 +210,51 @@
validate="guid"
hint="COM_COMPONENTBUILDER_REPOSITORY_GUID_HINT"
/>
<!-- Addplaceholders Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addplaceholders"
label="COM_COMPONENTBUILDER_REPOSITORY_ADDPLACEHOLDERS_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
description="COM_COMPONENTBUILDER_REPOSITORY_ADDPLACEHOLDERS_DESCRIPTION"
default=""
icon="list">
<form hidden="true" name="list_addplaceholders_modal" repeat="true">
<!-- Target Field. Type: Text. (joomla) -->
<field
type="text"
name="target"
label="COM_COMPONENTBUILDER_REPOSITORY_TARGET_LABEL"
size="50"
maxlength="150"
description="COM_COMPONENTBUILDER_REPOSITORY_TARGET_DESCRIPTION"
class="text_area"
required="true"
filter="STRING"
message="COM_COMPONENTBUILDER_REPOSITORY_TARGET_MESSAGE"
hint="COM_COMPONENTBUILDER_REPOSITORY_TARGET_HINT"
autocomplete="off"
/>
<!-- Value Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="value"
label="COM_COMPONENTBUILDER_REPOSITORY_VALUE_LABEL"
rows="1"
cols="5"
default="default text"
description="COM_COMPONENTBUILDER_REPOSITORY_VALUE_DESCRIPTION"
message="COM_COMPONENTBUILDER_REPOSITORY_VALUE_MESSAGE"
class="text_area span12"
filter="RAW"
hint="COM_COMPONENTBUILDER_REPOSITORY_VALUE_HINT"
required="true"
/>
</form>
</field>
<!-- Placeholder_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="placeholder_note" label="COM_COMPONENTBUILDER_REPOSITORY_PLACEHOLDER_NOTE_LABEL" description="COM_COMPONENTBUILDER_REPOSITORY_PLACEHOLDER_NOTE_DESCRIPTION" heading="h4" class="alert alert-info placeholder_note" />
<!-- Access_repo Field. Type: Radio. (joomla) -->
<field
type="radio"

View File

@@ -7875,6 +7875,8 @@ COM_COMPONENTBUILDER_POWER_PROPERTY_LABEL="Properties"
COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_DESCRIPTION="Select properties you want to use in your power."
COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_LABEL="Property Selection"
COM_COMPONENTBUILDER_POWER_PUBLISHING="Publishing"
COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS="Power Push Button Access"
COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS="Power Reset Button Access"
COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
COM_COMPONENTBUILDER_POWER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Power to customise the alias."
@@ -7973,6 +7975,8 @@ COM_COMPONENTBUILDER_REPOSITORIES_SUBMENU_DESC="Allows the users in this group t
COM_COMPONENTBUILDER_REPOSITORY="Repository"
COM_COMPONENTBUILDER_REPOSITORY_ACCESS_REPO_DESCRIPTION="Set the access options to this repository"
COM_COMPONENTBUILDER_REPOSITORY_ACCESS_REPO_LABEL="Access"
COM_COMPONENTBUILDER_REPOSITORY_ADDPLACEHOLDERS_DESCRIPTION="Set dnamic placeholders for this component."
COM_COMPONENTBUILDER_REPOSITORY_ADDPLACEHOLDERS_LABEL="Placeholders"
COM_COMPONENTBUILDER_REPOSITORY_BASE_DESCRIPTION="Enter Base URL"
COM_COMPONENTBUILDER_REPOSITORY_BASE_HINT="https://git.vdm.dev"
COM_COMPONENTBUILDER_REPOSITORY_BASE_LABEL="Base URL"
@@ -8004,6 +8008,9 @@ COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_LABEL="Organisation"
COM_COMPONENTBUILDER_REPOSITORY_ORGANISATION_MESSAGE="Error! Please add organisation here."
COM_COMPONENTBUILDER_REPOSITORY_OVERRIDE="Override"
COM_COMPONENTBUILDER_REPOSITORY_PERMISSION="Permissions"
COM_COMPONENTBUILDER_REPOSITORY_PLACEHOLDERS="Placeholders"
COM_COMPONENTBUILDER_REPOSITORY_PLACEHOLDER_NOTE_DESCRIPTION="<p>When powers are connected to components, we utilize global placeholders. These placeholders are linked to the specific component, allowing for dynamic updates to any placeholders found within the powers. However, when we directly <b>push</b> powers from the powers area to this repository, we require <b>placeholders</b> that are specific to this repository.</p><p>You can add these repository-specific placeholders here. Please note that these placeholders are only utilized during direct pushes from the powers area and are not considered during the compilation of any component. Although you can use the same placeholders to ensure consistent outcomes, they technically have no direct relationship with the components.</p>"
COM_COMPONENTBUILDER_REPOSITORY_PLACEHOLDER_NOTE_LABEL="The Repository Placeholders"
COM_COMPONENTBUILDER_REPOSITORY_PUBLISHING="Publishing"
COM_COMPONENTBUILDER_REPOSITORY_READ_BRANCH_DESCRIPTION="The read branch to use in the API calls."
COM_COMPONENTBUILDER_REPOSITORY_READ_BRANCH_HINT="[master]"
@@ -8020,7 +8027,9 @@ COM_COMPONENTBUILDER_REPOSITORY_SYSTEM_NAME_HINT="The System Name Here"
COM_COMPONENTBUILDER_REPOSITORY_SYSTEM_NAME_LABEL="System Name"
COM_COMPONENTBUILDER_REPOSITORY_SYSTEM_NAME_MESSAGE="Error! Please add some text here."
COM_COMPONENTBUILDER_REPOSITORY_TARGET_DESCRIPTION="The target content this repository holds."
COM_COMPONENTBUILDER_REPOSITORY_TARGET_HINT="coral"
COM_COMPONENTBUILDER_REPOSITORY_TARGET_LABEL="Target Content"
COM_COMPONENTBUILDER_REPOSITORY_TARGET_MESSAGE="Error! That target placeholder text already exist. Please add an unique placeholder target."
COM_COMPONENTBUILDER_REPOSITORY_TOKEN_DESCRIPTION="This token is used to access the api."
COM_COMPONENTBUILDER_REPOSITORY_TOKEN_HINT="Access Tokens"
COM_COMPONENTBUILDER_REPOSITORY_TOKEN_LABEL="Access Token"
@@ -8030,6 +8039,10 @@ COM_COMPONENTBUILDER_REPOSITORY_USERNAME_DESCRIPTION="The username to use in the
COM_COMPONENTBUILDER_REPOSITORY_USERNAME_HINT="Username"
COM_COMPONENTBUILDER_REPOSITORY_USERNAME_LABEL="Username"
COM_COMPONENTBUILDER_REPOSITORY_USERNAME_MESSAGE="Error! Please add username here."
COM_COMPONENTBUILDER_REPOSITORY_VALUE_DESCRIPTION="Set the text you would like to set as the replacement value for the targeted placeholder."
COM_COMPONENTBUILDER_REPOSITORY_VALUE_HINT="membersmanager"
COM_COMPONENTBUILDER_REPOSITORY_VALUE_LABEL="Set String Value"
COM_COMPONENTBUILDER_REPOSITORY_VALUE_MESSAGE="Error! Please add some set target value here."
COM_COMPONENTBUILDER_REPOSITORY_VERSION_DESC="A count of the number of times this Repository has been revised."
COM_COMPONENTBUILDER_REPOSITORY_VERSION_LABEL="Version"
COM_COMPONENTBUILDER_REPOSITORY_WRITE_BRANCH_DESCRIPTION="The write branch to use in the API calls. This can be the same as the read branch."
@@ -9039,6 +9052,7 @@ COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_PUSHED="These Jo
COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET="These Joomla powers have successfully been reset."
COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_NOT_AVAILABLE_TO_THE_FIELD_IF_BNONE_DBB_OPTION_IS_SELECTED="These options are not available to the field if <b>None DB</b> option is selected."
COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_ONLY_AVAILABLE_TO_THE_FIELD_IF_BSHOW_IN_LIST_VIEWB_OPTION_IS_SELECTED="These options are only available to the field if <b>Show in list view</b> option is selected."
COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_PUSHED="These powers have successfully been pushed."
COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET="These powers have successfully been reset."
COM_COMPONENTBUILDER_THE_ADMIN_CUSTOM_TABS="The admin custom tabs"
COM_COMPONENTBUILDER_THE_ADMIN_FIELDS="The admin fields"
@@ -9103,12 +9117,15 @@ COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE="The package key is: <code>%s<
COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S="The package key is: %s"
COM_COMPONENTBUILDER_THE_PLUGIN_FILES_FOLDERS="The plugin files & folders"
COM_COMPONENTBUILDER_THE_PLUGIN_UPDATES="The plugin updates"
COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_PUSHED="The power has successfully been pushed."
COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_RESET="The power has successfully been reset."
COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER="The private key field could not be loaded for <b>%s</b> server!"
COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER="The private key file could not be loaded/found for <b>%s</b> server!"
COM_COMPONENTBUILDER_THE_PRO_BOARD_IS_LOADING="The pro board is loading"
COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_JOOMLA_POWERS_HAS_FAILED="The push of these Joomla powers has failed."
COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_POWERS_HAS_FAILED="The push of these powers has failed."
COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_JOOMLA_POWER_HAS_FAILED="The push of this Joomla power has failed."
COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_POWER_HAS_FAILED="The push of this power has failed."
COM_COMPONENTBUILDER_THE_README_IS_LOADING="The readme is loading"
COM_COMPONENTBUILDER_THE_REPLACE_PROCESS_HAD_AN_ERROR_WITH_TABLE="The replace process had an error with table"
COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_POWERS_HAS_FAILED="The reset of these Joomla powers has failed."
@@ -9365,6 +9382,7 @@ COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT="You do
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_MODULE="You do not have permission to install the module!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN="You do not have permission to install the plugin!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_PUSH_THIS_JOOMLA_POWER="You do not have permission to push this Joomla power"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_PUSH_THIS_POWER="You do not have permission to push this power"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_JOOMLA_POWER="You do not have permission to reset this Joomla power"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_POWER="You do not have permission to reset this power"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE="You do not have permission to run the get boilerplate module!"

View File

@@ -981,6 +981,8 @@ COM_COMPONENTBUILDER_POWERS_SUBMENU="Powers Submenu"
COM_COMPONENTBUILDER_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of power"
COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS="Power Init Button Access"
COM_COMPONENTBUILDER_POWER_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS="Power Push Button Access"
COM_COMPONENTBUILDER_POWER_PUSH_BUTTON_ACCESS_DESC="Allows the users in this group to access the push button."
COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS="Power Reset Button Access"
COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
COM_COMPONENTBUILDER_REPOSITORIES_ACCESS="Repositories Access"

View File

@@ -0,0 +1,45 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die;
// get the form
$form = $displayData->getForm();
// get the layout fields override method name (from layout path/ID)
$layout_path_array = explode('.', $this->getLayoutId());
// Since we cannot pass the layout and tab names as parameters to the model method
// this name combination of tab and layout in the method name is the only work around
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
// example of layout name: details_left.php
// example of method name: getFields_details_left()
$fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: array(
'placeholder_note',
'addplaceholders'
);
$hiddenFields = $displayData->get('hidden_fields') ?: [];
?>
<?php if ($fields && count((array) $fields)) :?>
<div class="form-vertical">
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>

View File

@@ -1302,6 +1302,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_repository` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
`access_repo` TINYINT(1) NOT NULL DEFAULT 0,
`addplaceholders` TEXT NOT NULL,
`base` VARCHAR(255) NOT NULL DEFAULT '',
`guid` VARCHAR(36) NOT NULL DEFAULT '',
`organisation` VARCHAR(255) NOT NULL DEFAULT '',
@@ -2475,8 +2476,8 @@ INSERT INTO `#__componentbuilder_language` (`id`, `langtag`, `name`, `params`, `
INSERT INTO `#__componentbuilder_repository` (`id`, `system_name`, `organisation`, `repository`, `target`, `type`, `base`, `guid`, `read_branch`, `access`, `ordering`, `published`, `modified`, `created`, `params`) VALUES
(1, 'Super Powers', 'joomla', 'super-powers', 1, 1, 'https://git.vdm.dev', '1a1b6f3d-f16c-431a-b270-7a8a80cc7f56', 'master', 1, 1, 1, '2024-06-10 11:13:46', '2024-06-10 10:59:35', ''),
(2, 'JCB Compiler', 'joomla', 'jcb-compiler', 1, 1, 'https://git.vdm.dev', 'd12c7672-7b75-4a59-a5f3-c33f1a2f929b', 'master', 1, 2, 1, '2024-06-15 17:43:09', '2024-06-10 11:01:06', ''),
(3, 'JCB Packager', 'joomla', 'jcb-packager', 1, 1, 'https://git.vdm.dev', 'd8155014-5734-4fb5-9ccb-6bb33367ef78', 'master', 1, 3, 1, '2024-06-15 17:43:09', '2024-06-10 11:01:35', ''),
(2, 'JCB Compiler', 'joomla', 'jcb-compiler', 1, 1, 'https://git.vdm.dev', 'd12c7672-7b75-4a59-a5f3-c33f1a2f929b', 'master', 1, 2, 1, '2024-08-20 09:34:58', '2024-06-10 11:01:06', ''),
(3, 'JCB Packager', 'joomla', 'jcb-packager', 1, 1, 'https://git.vdm.dev', 'd8155014-5734-4fb5-9ccb-6bb33367ef78', 'master', 1, 3, 1, '2024-08-20 08:33:21', '2024-06-10 11:01:35', ''),
(4, 'PHP Seclib', 'joomla', 'phpseclib', 1, 1, 'https://git.vdm.dev', 'e63d916c-81c1-4a56-a73f-584174b36c87', 'master', 1, 4, 1, '2024-06-15 17:43:09', '2024-06-10 11:02:03', ''),
(5, 'JCB Search', 'joomla', 'search', 1, 1, 'https://git.vdm.dev', '6e57dc23-a17d-4937-bdbf-639ae1b8409f', 'master', 1, 5, 1, '2024-06-15 17:43:09', '2024-06-10 11:02:43', ''),
(6, 'Gitea', 'joomla', 'gitea', 1, 1, 'https://git.vdm.dev', 'a0cbfb8a-b427-48eb-b493-a02b34854019', 'master', 1, 6, 1, '2024-06-15 17:43:09', '2024-06-10 11:03:09', ''),

View File

@@ -0,0 +1 @@

View File

@@ -105,7 +105,7 @@ class Joomla_powerController extends FormController
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('power.reset', 'com_componentbuilder'))
elseif($user->authorise('joomla_power.reset', 'com_componentbuilder'))
{
try {
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Get')->reset([$guid]))
@@ -180,7 +180,7 @@ class Joomla_powerController extends FormController
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('power.push', 'com_componentbuilder'))
elseif($user->authorise('joomla_power.push', 'com_componentbuilder'))
{
try {
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Set')->items([$guid]))

View File

@@ -80,7 +80,7 @@ class Joomla_powersController extends AdminController
$status = 'error';
$success = false;
if($user->authorise('power.init', 'com_componentbuilder'))
if($user->authorise('joomla_power.init', 'com_componentbuilder'))
{
try {
if (JoomlaPowerFactory::_('Joomla.Power.Remote.Get')->init())
@@ -153,7 +153,7 @@ class Joomla_powersController extends AdminController
// check if user has the right
$user = Factory::getUser();
if($user->authorise('power.reset', 'com_componentbuilder'))
if($user->authorise('joomla_power.reset', 'com_componentbuilder'))
{
$guids = GetHelper::vars('joomla_power', $pks, 'id', 'guid');
@@ -232,7 +232,7 @@ class Joomla_powersController extends AdminController
// check if user has the right
$user = Factory::getUser();
if($user->authorise('power.push', 'com_componentbuilder'))
if($user->authorise('joomla_power.push', 'com_componentbuilder'))
{
$guids = GetHelper::vars('joomla_power', $pks, 'id', 'guid');

View File

@@ -130,6 +130,81 @@ class PowerController extends FormController
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
/**
* Pushes the specified power.
*
* 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 power.
* 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 power.
* 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');
// check if user has the right
$user = Factory::getUser();
// set default error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_PUSH_THIS_POWER') . '</p>';
$status = 'error';
$success = false;
// load the ID
$id = $item['id'] ?? null;
$guid = $item['guid'] ?? null;
// check if there is any selections
if ($id === null || $guid === null)
{
// set error message
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
}
elseif($user->authorise('power.push', 'com_componentbuilder'))
{
try {
if (PowerFactory::_('Power.Remote.Set')->items([$guid]))
{
// set success message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_POWER_HAS_SUCCESSFULLY_BEEN_PUSHED').'</p>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THIS_POWER_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
}
// set redirect
$redirect_url = Route::_(
'index.php?option=com_componentbuilder&view=power'
. $this->getRedirectToItemAppend($id), $success
);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}

View File

@@ -173,6 +173,85 @@ class PowersController extends AdminController
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);
return $success;
}
/**
* Pushes the selected powers.
*
* This function performs several checks and operations:
* 1. It verifies the authenticity of the request to prevent request forgery.
* 2. It retrieves the IDs of the selected powers from the user input.
* 3. It sanitizes the input by converting the IDs to integers.
* 4. It checks whether any powers have been selected.
* 5. It checks whether the current user has the necessary permissions to push the selected powers.
* 6. If the user is authorized and powers are selected, it attempts to push the selected powers.
* 7. Depending on the result of the push operation, it sets the appropriate success or error message.
* 8. 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 IDS of the selected powers
$pks = $this->input->post->get('cid', [], 'array');
// Sanitize the input
ArrayHelper::toInteger($pks);
// check if there is any selections
if ($pks === [])
{
// set error message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url, $message, 'error');
return false;
}
$status = 'error';
$success = false;
// check if user has the right
$user = Factory::getUser();
if($user->authorise('power.push', 'com_componentbuilder'))
{
$guids = GetHelper::vars('power', $pks, 'id', 'guid');
try {
if (PowerFactory::_('Power.Remote.Set')->items($guids))
{
// set success message
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_POWERS_HAVE_SUCCESSFULLY_BEEN_PUSHED').'</p>';
$status = 'success';
$success = true;
}
else
{
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_PUSH_OF_THESE_POWERS_HAS_FAILED') . '</p>';
}
} catch (\Exception $e) {
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PUSH_FAILED') . '</h1>';
$message .= '<p>' . \htmlspecialchars($e->getMessage()) . '</p>';
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', $success);
$this->setRedirect($redirect_url, $message, $status);
return $success;
}
// set redirect
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
$this->setRedirect($redirect_url);

View File

@@ -71,6 +71,12 @@ class RepositoryModel extends AdminModel
'target',
'access_repo'
)
),
'placeholders' => array(
'fullwidth' => array(
'placeholder_note',
'addplaceholders'
)
)
);
@@ -154,6 +160,14 @@ class RepositoryModel extends AdminModel
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->addplaceholders))
{
// Convert the addplaceholders field to an array.
$addplaceholders = new Registry;
$addplaceholders->loadString($item->addplaceholders);
$item->addplaceholders = $addplaceholders->toArray();
}
}
return $item;
@@ -893,6 +907,19 @@ class RepositoryModel extends AdminModel
$data['guid'] = (string) GuidHelper::get();
}
// Set the addplaceholders items to data.
if (isset($data['addplaceholders']) && is_array($data['addplaceholders']))
{
$addplaceholders = new Registry;
$addplaceholders->loadArray($data['addplaceholders']);
$data['addplaceholders'] = (string) $addplaceholders;
}
elseif (!isset($data['addplaceholders']))
{
// Set the empty addplaceholders to data
$data['addplaceholders'] = '';
}
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))
{

View File

@@ -258,6 +258,11 @@ class HtmlView extends BaseHtmlView
// add Reset button.
ToolbarHelper::custom('power.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
}
if ($this->canDo->get('power.push'))
{
// add Push button.
ToolbarHelper::custom('power.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
}
ToolbarHelper::cancel('power.cancel', 'JTOOLBAR_CLOSE');
}
}

View File

@@ -208,6 +208,11 @@ class HtmlView extends BaseHtmlView
// add Reset button.
ToolbarHelper::custom('powers.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
}
if ($this->user->authorise('power.push', 'com_componentbuilder'))
{
// add Push button.
ToolbarHelper::custom('powers.pushPowers', 'share custom-button-pushpowers', '', 'COM_COMPONENTBUILDER_PUSH', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('powers');

View File

@@ -59,6 +59,16 @@ defined('_JEXEC') or die;
</div>
<?php echo Html::_('uitab.endTab'); ?>
<?php echo Html::_('uitab.addTab', 'repositoryTab', 'placeholders', Text::_('COM_COMPONENTBUILDER_REPOSITORY_PLACEHOLDERS', true)); ?>
<div class="row">
</div>
<div class="row">
<div class="col-md-12">
<?php echo LayoutHelper::render('repository.placeholders_fullwidth', $this); ?>
</div>
</div>
<?php echo Html::_('uitab.endTab'); ?>
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
<?php $this->tab_name = 'repositoryTab'; ?>
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>