Fix the update server #978 issue. Fixed the change log to load all entries, not just the last one. Fixed #983 so that database updates are created when adding a new adminview. Moved a few builder arrays to the Compiler Registry. Adds super powers to JCB. Adds Gitea API library. Improves Power filters. Fix #991 to add the Utilities service class. Adds Superpower Key (SPK) replacement feature. Adds Superpower search (GREP) feature. Adds Power Insert/Update Classe. Fix #995 that all update sites are using the correct URL.
This commit is contained in:
@ -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.1.19) 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.1.24) 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)
|
||||
|
||||
@ -106,8 +106,8 @@ Where can you get support and help?
|
||||
- [Hello World](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45).
|
||||
- [Discussions](https://github.com/vdm-io/Joomla-Component-Builder/discussions).
|
||||
- [Wiki](https://git.vdm.dev/joomla/Component-Builder/wiki).
|
||||
- [Issues](https://git.vdm.dev/joomla/Component-Builder/issues).
|
||||
- [Issues Stream](https://t.me/jcb_issues). ^^
|
||||
- [Issues](https://git.vdm.dev/joomla/Component-Builder/issues). ^^
|
||||
- [Issues Stream](https://t.me/jcb_issues).
|
||||
- [Updates](https://t.me/jcb_updates).
|
||||
- [User Group](https://t.me/jcb_group).
|
||||
- [Announcement](https://t.me/Joomla_component_builder).
|
||||
@ -144,14 +144,14 @@ 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*: 27th February, 2023
|
||||
+ *Version*: 3.1.19
|
||||
+ *Last Build*: 2nd May, 2023
|
||||
+ *Version*: 3.1.24
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **366135**
|
||||
+ *Field count*: **2021**
|
||||
+ *File count*: **2339**
|
||||
+ *Folder count*: **411**
|
||||
+ *Line count*: **557762**
|
||||
+ *Field count*: **2041**
|
||||
+ *File count*: **3930**
|
||||
+ *Folder count*: **432**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -483,7 +483,10 @@
|
||||
<action name="placeholder.export" title="COM_COMPONENTBUILDER_PLACEHOLDERS_EXPORT" description="COM_COMPONENTBUILDER_PLACEHOLDERS_EXPORT_DESC" />
|
||||
<action name="placeholder.import" title="COM_COMPONENTBUILDER_PLACEHOLDERS_IMPORT" description="COM_COMPONENTBUILDER_PLACEHOLDERS_IMPORT_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.reset" title="COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="power.run_expansion" title="COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS_DESC" />
|
||||
<action name="power.sync" title="COM_COMPONENTBUILDER_POWER_SYNC_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_POWER_SYNC_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" />
|
||||
<action name="power.create" title="COM_COMPONENTBUILDER_POWERS_CREATE" description="COM_COMPONENTBUILDER_POWERS_CREATE_DESC" />
|
||||
|
196
admin/config.xml
196
admin/config.xml
@ -679,6 +679,202 @@
|
||||
default=""
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="super_power_custom_config"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWER">
|
||||
|
||||
<!-- Note_not_ready_super_powers Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_not_ready_super_powers" label="COM_COMPONENTBUILDER_CONFIG_NOTE_NOT_READY_SUPER_POWERS_LABEL" heading="h2" class="alert alert-error note_not_ready_super_powers" />
|
||||
<!-- Super_powers_documentation Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="super_powers_documentation"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_DOCUMENTATION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_DOCUMENTATION_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_SHOW</option>
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_HIDE</option>
|
||||
</field>
|
||||
<!-- Note_super_powers Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_super_powers" label="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_DESCRIPTION" heading="h4" class="alert alert-info note_super_powers" showon="super_powers_documentation:1" />
|
||||
<!-- Powers_repository Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="powers_repository"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_POWERS_REPOSITORY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_POWERS_REPOSITORY_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_YES</option>
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_NO</option>
|
||||
</field>
|
||||
<!-- Super_powers_repositories Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="super_powers_repositories"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_REPOSITORIES_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_REPOSITORIES_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
required="true"
|
||||
showon="powers_repository:1">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_YES</option>
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_NO</option>
|
||||
</field>
|
||||
<!-- Note_super_powers_repositories Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_super_powers_repositories" label="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_SUPER_POWERS_REPOSITORIES_DESCRIPTION" heading="h4" class="alert alert-info note_super_powers_repositories" showon="powers_repository:1[AND]super_powers_repositories:1" />
|
||||
<!-- Approved_paths Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
name="approved_paths"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_APPROVED_PATHS_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
buttons="add,remove,move"
|
||||
icon="list"
|
||||
max="30"
|
||||
min="1"
|
||||
showon="powers_repository:1[AND]super_powers_repositories:1">
|
||||
<form hidden="true" name="list_approved_paths_modal" repeat="true">
|
||||
<!-- Owner Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="owner"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_OWNER_LABEL"
|
||||
size="70"
|
||||
maxlength="150"
|
||||
class="text_area span12"
|
||||
readonly="false"
|
||||
filter="CMD"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_OWNER_HINT"
|
||||
autocomplete="on"
|
||||
/>
|
||||
<!-- Repo Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="repo"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_REPO_LABEL"
|
||||
size="70"
|
||||
maxlength="150"
|
||||
class="text_area span12"
|
||||
readonly="false"
|
||||
filter="CMD"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_REPO_HINT"
|
||||
autocomplete="on"
|
||||
/>
|
||||
<!-- Branch Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="branch"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_BRANCH_LABEL"
|
||||
size="70"
|
||||
maxlength="150"
|
||||
default="default"
|
||||
class="text_area span12"
|
||||
readonly="false"
|
||||
filter="CMD"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_BRANCH_HINT"
|
||||
autocomplete="on"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Note_powers_repository_path Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_powers_repository_path" label="COM_COMPONENTBUILDER_CONFIG_NOTE_POWERS_REPOSITORY_PATH_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_POWERS_REPOSITORY_PATH_DESCRIPTION" heading="h4" class="alert alert-info note_powers_repository_path" showon="powers_repository:1" />
|
||||
<!-- Local_powers_repository_path Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="local_powers_repository_path"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_LABEL"
|
||||
size="70"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="false"
|
||||
filter="PATH"
|
||||
message="COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_LOCAL_POWERS_REPOSITORY_PATH_HINT"
|
||||
autocomplete="on"
|
||||
showon="powers_repository:1"
|
||||
/>
|
||||
<!-- Add_custom_gitea_url Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="add_custom_gitea_url"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_ADD_CUSTOM_GITEA_URL_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_ADD_CUSTOM_GITEA_URL_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_GITVDMDEV</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_CONFIG_CUSTOMGITEA</option>
|
||||
</field>
|
||||
<!-- Note_custom_gitea_url Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_custom_gitea_url" label="COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_GITEA_URL_LABEL" description="COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_GITEA_URL_DESCRIPTION" heading="h3" class="alert alert-success note_custom_gitea_url" showon="add_custom_gitea_url:2" />
|
||||
<!-- Custom_gitea_url Field. Type: Url. (joomla) -->
|
||||
<field
|
||||
type="url"
|
||||
name="custom_gitea_url"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_LABEL"
|
||||
size="70"
|
||||
maxlength="150"
|
||||
default="https://git.vdm.dev"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="url"
|
||||
validated="url"
|
||||
scheme="http,https"
|
||||
message="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_URL_HINT"
|
||||
autocomplete="on"
|
||||
showon="add_custom_gitea_url:2"
|
||||
/>
|
||||
<!-- Custom_gitea_token Field. Type: Password. (joomla) -->
|
||||
<field
|
||||
type="password"
|
||||
name="custom_gitea_token"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_LABEL"
|
||||
size="128"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_DESCRIPTION"
|
||||
message="Error! Please add token here."
|
||||
class="text_area"
|
||||
readonly="false"
|
||||
disabled="false"
|
||||
required="false"
|
||||
filter="STRING"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_CUSTOM_GITEA_TOKEN_HINT"
|
||||
autocomplete="off"
|
||||
showon="add_custom_gitea_url:2"
|
||||
/>
|
||||
<!-- Super_powers_core Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="super_powers_core"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_LABEL"
|
||||
size="70"
|
||||
maxlength="150"
|
||||
default="joomla/super-powers"
|
||||
class="text_area"
|
||||
filter="PATH"
|
||||
hint="COM_COMPONENTBUILDER_CONFIG_SUPER_POWERS_CORE_HINT"
|
||||
autocomplete="on"
|
||||
showon="add_custom_gitea_url:2"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="compiler_custom_config"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_COMPILER">
|
||||
|
@ -42,6 +42,94 @@ class ComponentbuilderControllerPower extends FormController
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
public function syncPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// get IDS of the selected powers
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if there is any selections
|
||||
if (empty($item['id']))
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_NOT_SAVED').'</h1>';
|
||||
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = \JRoute::_(
|
||||
'index.php?option=com_componentbuilder&view=power'
|
||||
. $this->getRedirectToItemAppend(), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if user has the right
|
||||
$user = JFactory::getUser();
|
||||
if($user->authorise('power.sync', 'com_componentbuilder'))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_SYNC_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
|
||||
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = \JRoute::_(
|
||||
'index.php?option=com_componentbuilder&view=power'
|
||||
. $this->getRedirectToItemAppend($item['id']), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message);
|
||||
return true;
|
||||
}
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url);
|
||||
return false;
|
||||
}
|
||||
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// get IDS of the selected powers
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if there is any selections
|
||||
if (empty($item['id']))
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_NOT_SAVED').'</h1>';
|
||||
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = \JRoute::_(
|
||||
'index.php?option=com_componentbuilder&view=power'
|
||||
. $this->getRedirectToItemAppend(), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if user has the right
|
||||
$user = JFactory::getUser();
|
||||
if($user->authorise('power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_RESET_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
|
||||
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = \JRoute::_(
|
||||
'index.php?option=com_componentbuilder&view=power'
|
||||
. $this->getRedirectToItemAppend($item['id']), false
|
||||
);
|
||||
$this->setRedirect($redirect_url, $message);
|
||||
return true;
|
||||
}
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
|
@ -83,5 +83,109 @@ class ComponentbuilderControllerPowers extends AdminController
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if user has the right
|
||||
$user = JFactory::getUser();
|
||||
if($user->authorise('power.init', 'com_componentbuilder'))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_INIT_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
|
||||
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message);
|
||||
return true;
|
||||
}
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url);
|
||||
return false;
|
||||
}
|
||||
|
||||
public function syncPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// get IDS of the selected powers
|
||||
$pks = $this->input->post->get('cid', [], 'array');
|
||||
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
|
||||
// check if there is any selections
|
||||
if ($pks == [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if user has the right
|
||||
$user = JFactory::getUser();
|
||||
if($user->authorise('power.sync', 'com_componentbuilder'))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_SYNC_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
|
||||
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message);
|
||||
return true;
|
||||
}
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url);
|
||||
return false;
|
||||
}
|
||||
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// get IDS of the selected powers
|
||||
$pks = $this->input->post->get('cid', [], 'array');
|
||||
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
|
||||
// check if there is any selections
|
||||
if ($pks == [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if user has the right
|
||||
$user = JFactory::getUser();
|
||||
if($user->authorise('power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_THIS_RESET_FEATURE_IS_STILL_UNDER_DEVELOPMENT').'</h1>';
|
||||
$message .= '<p>'.JText::sprintf('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_SOON_ANDOR_FOLLOW_THE_PROGRESS_ON_SGITVDMDEVA', '<a href="https://git.vdm.dev/joomla/Component-Builder/issues/984" target="_blank">').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url, $message);
|
||||
return true;
|
||||
}
|
||||
// set redirect
|
||||
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
$this->setRedirect($redirect_url);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -603,6 +603,31 @@ class Compiler extends Infusion
|
||||
}
|
||||
}
|
||||
}
|
||||
// do super powers details if found
|
||||
if (ArrayHelper::check(CFactory::_('Power')->superpowers))
|
||||
{
|
||||
foreach (CFactory::_('Power')->superpowers as $path => $powers)
|
||||
{
|
||||
$key = StringHelper::safe($path);
|
||||
if (CFactory::_('Utilities.Files')->exists($key))
|
||||
{
|
||||
// update the power files
|
||||
foreach (CFactory::_('Utilities.Files')->get($key) as $power_file)
|
||||
{
|
||||
if (File::exists($power_file['path']))
|
||||
{
|
||||
$this->setFileContent(
|
||||
$power_file['name'], $power_file['path'],
|
||||
$bom, $key
|
||||
);
|
||||
}
|
||||
}
|
||||
// free up some memory
|
||||
CFactory::_('Utilities.Files')->remove($key);
|
||||
CFactory::_('Content')->remove_($key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -680,6 +705,9 @@ class Compiler extends Infusion
|
||||
&$view)
|
||||
);
|
||||
|
||||
// inject any super powers found
|
||||
$answer = CFactory::_('Power.Injector')->power($answer);
|
||||
|
||||
// add answer back to file
|
||||
CFactory::_('Utilities.File')->write($path, $answer);
|
||||
|
||||
@ -1384,7 +1412,7 @@ class Compiler extends Infusion
|
||||
if ($found && !$foundEnd)
|
||||
{
|
||||
$replace[] = (int) $lineBites[$lineNumber];
|
||||
// we musk keep last three lines to dynamic find target entry
|
||||
// we must keep last three lines to dynamic find target entry
|
||||
$fingerPrint[$lineNumber] = trim($lineContent);
|
||||
// check lines each time if it fits our target
|
||||
if (count((array) $fingerPrint) === $sizeEnd
|
||||
@ -1413,7 +1441,7 @@ class Compiler extends Infusion
|
||||
{
|
||||
$replace[] = (int) $lineBites[$lineNumber];
|
||||
}
|
||||
// we musk keep last three lines to dynamic find target entry
|
||||
// we must keep last three lines to dynamic find target entry
|
||||
$fingerPrint[$lineNumber] = trim($lineContent);
|
||||
// check lines each time if it fits our target
|
||||
if (count((array) $fingerPrint) === $size && !$found)
|
||||
@ -1535,7 +1563,7 @@ class Compiler extends Infusion
|
||||
$code = PHP_EOL . $commentType . implode(
|
||||
$_commentType . PHP_EOL . $commentType, $code
|
||||
) . $_commentType . PHP_EOL;
|
||||
// get place holders
|
||||
// get placeholders
|
||||
$placeholder = CFactory::_('Placeholder')->keys(
|
||||
(int) $target['comment_type'] . $target['type'], $target['id']
|
||||
);
|
||||
@ -1554,37 +1582,55 @@ class Compiler extends Infusion
|
||||
$this->addDataToFile($file, $data, (int) array_sum($bitBucket));
|
||||
}
|
||||
|
||||
// Thanks to http://stackoverflow.com/a/16813550/1429677
|
||||
protected function addDataToFile($file, $data, $position, $replace = null)
|
||||
/**
|
||||
* Inserts or replaces data in a file at a specific position.
|
||||
* Thanks to http://stackoverflow.com/a/16813550/1429677
|
||||
*
|
||||
* @param string $file The path of the file to modify
|
||||
* @param string $data The data to insert or replace
|
||||
* @param int $position The position in the file where the data should be inserted or replaced
|
||||
* @param int|null $replace The number of bytes to replace; if null, data will be inserted
|
||||
*
|
||||
* @return void
|
||||
* @throws RuntimeException if unable to open the file
|
||||
*/
|
||||
protected function addDataToFile(string $file, string $data, int $position, ?int $replace = null)
|
||||
{
|
||||
// start the process
|
||||
$fpFile = fopen($file, "rw+");
|
||||
$fpTemp = fopen('php://temp', "rw+");
|
||||
// make a copy of the file
|
||||
stream_copy_to_stream($fpFile, $fpTemp);
|
||||
// move to the position where we should add the data
|
||||
fseek($fpFile, $position);
|
||||
// Add the data
|
||||
fwrite($fpFile, (string) $data);
|
||||
// truncate file at the end of the data that was added
|
||||
$remove = MathHelper::bc(
|
||||
'add', $position, mb_strlen((string) $data, '8bit')
|
||||
);
|
||||
ftruncate($fpFile, $remove);
|
||||
// check if this was a replacement of data
|
||||
if ($replace)
|
||||
// Open the file and a temporary stream
|
||||
$actual_file = fopen($file, "rw+");
|
||||
if ($actual_file === false)
|
||||
{
|
||||
$position = MathHelper::bc(
|
||||
'add', $position, $replace
|
||||
);
|
||||
throw new RuntimeException("Unable to open the file: {$file}");
|
||||
}
|
||||
// move to the position of the data that should remain below the new data
|
||||
fseek($fpTemp, $position);
|
||||
// copy that remaining data to the file
|
||||
stream_copy_to_stream($fpTemp, $fpFile); // @Jack
|
||||
// done close both files
|
||||
fclose($fpFile);
|
||||
fclose($fpTemp);
|
||||
|
||||
$temp_file = fopen('php://temp', "rw+");
|
||||
|
||||
// Make a copy of the file in the temporary stream
|
||||
stream_copy_to_stream($actual_file, $temp_file);
|
||||
|
||||
// Move to the position where the data should be added
|
||||
fseek($actual_file, $position);
|
||||
|
||||
// Add the data
|
||||
fwrite($actual_file, $data);
|
||||
|
||||
// Truncate the file at the end of the added data if replacing
|
||||
$data_length = mb_strlen($data, '8bit');
|
||||
$remove = MathHelper::bc('add', $position, $data_length);
|
||||
ftruncate($actual_file, $remove);
|
||||
|
||||
// check if this was a replacement of data
|
||||
$position = MathHelper::bc('add', $position, $replace ?: 0);
|
||||
|
||||
// Move to the position of the remaining data in the temporary stream
|
||||
fseek($temp_file, $position);
|
||||
|
||||
// Copy the remaining data from the temporary stream to the file
|
||||
stream_copy_to_stream($temp_file, $actual_file);
|
||||
|
||||
// Close both file handles
|
||||
fclose($actual_file);
|
||||
fclose($temp_file);
|
||||
|
||||
// any help to improve this is welcome...
|
||||
}
|
||||
|
@ -1144,8 +1144,13 @@ class Get
|
||||
));
|
||||
}
|
||||
|
||||
// get powers *+*+*+*+*+*+*+*PRO
|
||||
// load powers *+*+*+*+*+*+*+*
|
||||
CFactory::_('Power')->load($this->linkedPowers);
|
||||
// load any other super powers that was found
|
||||
if (($super_powers = CFactory::_('Power.Extractor')->get_()) !== null)
|
||||
{
|
||||
CFactory::_('Power')->load($super_powers);
|
||||
}
|
||||
// set the percentage when a language can be added
|
||||
$this->percentageLanguageAdd = (int) $this->params->get(
|
||||
'percentagelanguageadd', 50
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -23,9 +23,9 @@ if (file_exists($composer_autoloader))
|
||||
spl_autoload_register(function ($class) {
|
||||
// project-specific base directories and namespace prefix
|
||||
$search = [
|
||||
'libraries/jcb_powers/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
|
||||
'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla',
|
||||
'libraries/jcb_powers/VDM.Minify' => 'VDM\\Minify',
|
||||
'libraries/jcb_powers/VDM.Gitea' => 'VDM\\Gitea',
|
||||
'libraries/jcb_powers/VDM.Psr' => 'VDM\\Psr'
|
||||
];
|
||||
// Start the search and load if found
|
||||
@ -5523,571 +5523,6 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get extensions grouped list xml
|
||||
**/
|
||||
public static function getExtensionGroupedListXml()
|
||||
{
|
||||
// the extension types
|
||||
$extensions = array(
|
||||
'joomla_component' => 'COM_COMPONENTBUILDER_COMPONENT',
|
||||
'joomla_module' => 'COM_COMPONENTBUILDER_MODULE',
|
||||
'joomla_plugin' => 'COM_COMPONENTBUILDER_PLUGIN'
|
||||
);
|
||||
// get the extension values
|
||||
foreach ($extensions as $extension => $label)
|
||||
{
|
||||
${$extension} = self::getByTypeTheIdsSystemNames($extension);
|
||||
}
|
||||
|
||||
$xml = new DOMDocument();
|
||||
$xml->formatOutput = true;
|
||||
|
||||
$root = $xml->createElement('field');
|
||||
$root->setAttributeNode(new DOMAttr('name', 'extension'));
|
||||
$root->setAttributeNode(new DOMAttr('type', 'groupedlist'));
|
||||
$root->setAttributeNode(new DOMAttr('onchange', 'this.form.submit();'));
|
||||
|
||||
$root
|
||||
->appendChild($xml->createElement('option', '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_EXTENSION') . ' -'))
|
||||
->setAttributeNode(new DOMAttr('value', ''));
|
||||
|
||||
foreach ($extensions as $extension => $label)
|
||||
{
|
||||
$extension_node = $xml->createElement('group');
|
||||
$extension_node->setAttributeNode(new DOMAttr('label', $label));
|
||||
if (!self::checkArray(${$extension}))
|
||||
{
|
||||
$extension_node
|
||||
->appendChild($xml->createElement('option', '- ' . JText::_('COM_COMPONENTBUILDER_NONE') . ' -'))
|
||||
->setAttributeNode(new DOMAttr('disabled', 'true'));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (${$extension} as $id => $element)
|
||||
{
|
||||
$extension_node
|
||||
->appendChild($xml->createElement('option', $element))
|
||||
->setAttributeNode(new DOMAttr('value', $extension . '__' . $id));
|
||||
}
|
||||
}
|
||||
$root->appendChild($extension_node);
|
||||
}
|
||||
$xml->appendChild($root);
|
||||
return $xml->saveXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* get by type the ids and system names
|
||||
**/
|
||||
public static function getByTypeTheIdsSystemNames($type, $limiter = null)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query
|
||||
->select($db->quoteName(array('id', 'system_name')))
|
||||
->from($db->quoteName('#__componentbuilder_' . $type))
|
||||
->where($db->quoteName('published') . ' >= 1')
|
||||
->order($db->quoteName('modified') . ' desc')
|
||||
->order($db->quoteName('created') . ' desc');
|
||||
// check if we have a limter for admin views
|
||||
if ($type === 'admin_view' && $limiter)
|
||||
{
|
||||
// first get all views
|
||||
$adminviewIds = array();
|
||||
// if this is a plugin or a module, then no views
|
||||
if (strpos($limiter, 'joomla_component') !== false)
|
||||
{
|
||||
$component = (int) str_replace('joomla_component__', '', $limiter);
|
||||
// get the views of this component
|
||||
if ($addViews = self::getVar('component_admin_views', (int) $component, 'joomla_component', 'addadmin_views'))
|
||||
{
|
||||
if (self::checkJson($addViews))
|
||||
{
|
||||
$addViews = json_decode($addViews, true);
|
||||
if (self::checkArray($addViews))
|
||||
{
|
||||
foreach($addViews as $addView)
|
||||
{
|
||||
if (isset($addView['adminview']))
|
||||
{
|
||||
$adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// now check if we still have admin views
|
||||
if (self::checkArray($adminviewIds))
|
||||
{
|
||||
$query->where($db->quoteName('id') . ' IN (' . implode(',', $adminviewIds) . ')');
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
return $db->loadAssocList('id', 'system_name');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get any area linked IDs
|
||||
*/
|
||||
public static function getAreaLinkedIDs($extension, $type)
|
||||
{
|
||||
// What ever...
|
||||
if ($type === 'joomla_component_admin_views')
|
||||
{
|
||||
return self::getComponentAdminViewsIDs($extension);
|
||||
}
|
||||
elseif ($type === 'joomla_component_custom_admin_views')
|
||||
{
|
||||
return self::getComponentCustomAdminViewsIDs($extension);
|
||||
}
|
||||
elseif ($type === 'joomla_component_site_views')
|
||||
{
|
||||
return self::getComponentSiteViewsIDs($extension);
|
||||
}
|
||||
elseif ($type === 'joomla_component')
|
||||
{
|
||||
return self::getComponentFieldsIDs($extension);
|
||||
}
|
||||
elseif ($type === 'joomla_module')
|
||||
{
|
||||
return self::getModuleFieldsIDs($extension);
|
||||
}
|
||||
elseif ($type === 'joomla_plugin')
|
||||
{
|
||||
return self::getPluginFieldsIDs($extension);
|
||||
}
|
||||
elseif ($type === 'admin_view')
|
||||
{
|
||||
return self::getAdminViewFieldsIDs($extension);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get a component admin views IDs
|
||||
*/
|
||||
public static function getComponentAdminViewsIDs($id)
|
||||
{
|
||||
// get all this components views
|
||||
$adminviewIds = array();
|
||||
// get the views of this component
|
||||
if ($addViews = self::getVar('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views'))
|
||||
{
|
||||
if (self::checkJson($addViews))
|
||||
{
|
||||
$addViews = json_decode($addViews, true);
|
||||
if (self::checkArray($addViews))
|
||||
{
|
||||
foreach($addViews as $addView)
|
||||
{
|
||||
if (isset($addView['adminview']))
|
||||
{
|
||||
$adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that we have fields
|
||||
if (self::checkArray($adminviewIds))
|
||||
{
|
||||
return array_values($adminviewIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get a component custom admin views IDs
|
||||
*/
|
||||
public static function getComponentCustomAdminViewsIDs($id)
|
||||
{
|
||||
// get all this components views
|
||||
$adminviewIds = array();
|
||||
// get the views of this component
|
||||
if ($addViews = self::getVar('component_custom_admin_views', (int) $id, 'joomla_component', 'addcustom_admin_views'))
|
||||
{
|
||||
if (self::checkJson($addViews))
|
||||
{
|
||||
$addViews = json_decode($addViews, true);
|
||||
if (self::checkArray($addViews))
|
||||
{
|
||||
foreach($addViews as $addView)
|
||||
{
|
||||
if (isset($addView['customadminview']))
|
||||
{
|
||||
$adminviewIds[(int) $addView['customadminview']] = (int) $addView['customadminview'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that we have fields
|
||||
if (self::checkArray($adminviewIds))
|
||||
{
|
||||
return array_values($adminviewIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get a component site views IDs
|
||||
*/
|
||||
public static function getComponentSiteViewsIDs($id)
|
||||
{
|
||||
// get all this components views
|
||||
$adminviewIds = array();
|
||||
// get the views of this component
|
||||
if ($addViews = self::getVar('component_site_views', (int) $id, 'joomla_component', 'addsite_views'))
|
||||
{
|
||||
if (self::checkJson($addViews))
|
||||
{
|
||||
$addViews = json_decode($addViews, true);
|
||||
if (self::checkArray($addViews))
|
||||
{
|
||||
foreach($addViews as $addView)
|
||||
{
|
||||
if (isset($addView['siteview']))
|
||||
{
|
||||
$adminviewIds[(int) $addView['siteview']] = (int) $addView['siteview'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that we have fields
|
||||
if (self::checkArray($adminviewIds))
|
||||
{
|
||||
return array_values($adminviewIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get a component fields IDs
|
||||
*/
|
||||
public static function getComponentFieldsIDs($id)
|
||||
{
|
||||
// we start the field array
|
||||
$fieldIds = array();
|
||||
// first get all views
|
||||
$adminviewIds = array();
|
||||
// get the views of this component
|
||||
if ($addViews = self::getVar('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views'))
|
||||
{
|
||||
if (self::checkJson($addViews))
|
||||
{
|
||||
$addViews = json_decode($addViews, true);
|
||||
if (self::checkArray($addViews))
|
||||
{
|
||||
foreach($addViews as $addView)
|
||||
{
|
||||
if (isset($addView['adminview']))
|
||||
{
|
||||
$adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that we have views
|
||||
if (self::checkArray($adminviewIds))
|
||||
{
|
||||
foreach ($adminviewIds as $adminView)
|
||||
{
|
||||
// get all the fields linked to the admin view
|
||||
if ($addFields = self::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields'))
|
||||
{
|
||||
if (self::checkJson($addFields))
|
||||
{
|
||||
$addFields = json_decode($addFields, true);
|
||||
if (self::checkArray($addFields))
|
||||
{
|
||||
foreach($addFields as $addField)
|
||||
{
|
||||
if (isset($addField['field']))
|
||||
{
|
||||
$fieldIds[(int) $addField['field']] = (int) $addField['field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// get config values
|
||||
if ($addconfig = self::getVar('component_config', (int) $id, 'joomla_component', 'addconfig'))
|
||||
{
|
||||
if (self::checkJson($addconfig))
|
||||
{
|
||||
$addconfig = json_decode($addconfig, true);
|
||||
if (self::checkArray($addconfig))
|
||||
{
|
||||
foreach($addconfig as $addconf)
|
||||
{
|
||||
if (isset($addconf['field']))
|
||||
{
|
||||
$fieldIds[(int) $addconf['field']] = (int) $addconf['field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that we have fields
|
||||
if (self::checkArray($fieldIds))
|
||||
{
|
||||
return array_values($fieldIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get a module fields IDs
|
||||
*/
|
||||
public static function getModuleFieldsIDs($id)
|
||||
{
|
||||
// we start the field array
|
||||
$fieldIds = array();
|
||||
if ($fields = self::getVar('joomla_module', (int) $id, 'id', 'fields'))
|
||||
{
|
||||
if (self::checkJson($fields))
|
||||
{
|
||||
$fields = json_decode($fields, true);
|
||||
if (self::checkArray($fields))
|
||||
{
|
||||
foreach($fields as $form)
|
||||
{
|
||||
if (isset($form['fields']) && self::checkArray($form['fields']))
|
||||
{
|
||||
foreach ($form['fields'] as $field)
|
||||
{
|
||||
if (isset($field['field']))
|
||||
{
|
||||
$fieldIds[(int) $field['field']] = (int) $field['field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that we have fields
|
||||
if (self::checkArray($fieldIds))
|
||||
{
|
||||
return array_values($fieldIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get a plugin fields IDs
|
||||
*/
|
||||
public static function getPluginFieldsIDs($id)
|
||||
{
|
||||
// we start the field array
|
||||
$fieldIds = array();
|
||||
if ($fields = self::getVar('joomla_plugin', (int) $id, 'id', 'fields'))
|
||||
{
|
||||
if (self::checkJson($fields))
|
||||
{
|
||||
$fields = json_decode($fields, true);
|
||||
if (self::checkArray($fields))
|
||||
{
|
||||
foreach($fields as $form)
|
||||
{
|
||||
if (isset($form['fields']) && self::checkArray($form['fields']))
|
||||
{
|
||||
foreach ($form['fields'] as $field)
|
||||
{
|
||||
if (isset($field['field']))
|
||||
{
|
||||
$fieldIds[(int) $field['field']] = (int) $field['field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that we have fields
|
||||
if (self::checkArray($fieldIds))
|
||||
{
|
||||
return array_values($fieldIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get an admin view fields IDs
|
||||
*/
|
||||
public static function getAdminViewFieldsIDs($id)
|
||||
{
|
||||
// we start the field array
|
||||
$fieldIds = array();
|
||||
// get all the fields linked to the admin view
|
||||
if ($addFields = self::getVar('admin_fields', (int) $id, 'admin_view', 'addfields'))
|
||||
{
|
||||
if (self::checkJson($addFields))
|
||||
{
|
||||
$addFields = json_decode($addFields, true);
|
||||
if (self::checkArray($addFields))
|
||||
{
|
||||
foreach($addFields as $addField)
|
||||
{
|
||||
if (isset($addField['field']))
|
||||
{
|
||||
$fieldIds[(int) $addField['field']] = (int) $addField['field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check that we have fields
|
||||
if (self::checkArray($fieldIds))
|
||||
{
|
||||
return array_values($fieldIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get translation extension ids
|
||||
**/
|
||||
public static function getTranslationExtensionsIds($extension, $type)
|
||||
{
|
||||
// only allow these columns (extension types)
|
||||
$columns = array(
|
||||
'joomla_component' => 'components',
|
||||
'joomla_module' => 'modules',
|
||||
'joomla_plugin' => 'plugins'
|
||||
);
|
||||
// check if the column name is correct
|
||||
if (isset($columns[$type]))
|
||||
{
|
||||
$column = $columns[$type];
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query
|
||||
->select($db->quoteName(array('id', $column)))
|
||||
->from($db->quoteName('#__componentbuilder_language_translation'))
|
||||
->where($db->quoteName($column) . ' != ' . $db->quote(''));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$results = $db->loadAssocList();
|
||||
$matches = array();
|
||||
foreach ($results as $k => $v)
|
||||
{
|
||||
$value = json_decode($v[$column], true);
|
||||
if (in_array($extension, $value))
|
||||
{
|
||||
$matches[$v['id']] = $v['id'];
|
||||
}
|
||||
}
|
||||
// Checks that we found matches
|
||||
if (self::checkArray($matches))
|
||||
{
|
||||
return array_values($matches);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get translation ids
|
||||
**/
|
||||
public static function getTranslationIds($language, $translated = true)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__componentbuilder_language_translation'));
|
||||
|
||||
// Build the where condition
|
||||
if ($translated === true) // Translated
|
||||
{
|
||||
if ($language === 'all')
|
||||
{
|
||||
if (($languages = self::getAvailableLanguages()) !== false)
|
||||
{
|
||||
$wheres = array();
|
||||
foreach ($languages as $k => $v)
|
||||
{
|
||||
$wheres[] = $db->quoteName('translation') . ' LIKE ' . $db->quote('%' . $k . '%');
|
||||
}
|
||||
$query->where($wheres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where($db->quoteName('translation') . ' LIKE ' . $db->quote('%' . $language . '%'));
|
||||
}
|
||||
}
|
||||
else // Not translated
|
||||
{
|
||||
if ($language === 'none')
|
||||
{
|
||||
$query->where(
|
||||
array(
|
||||
$db->quoteName('translation') . ' = ' . $db->quote(''),
|
||||
$db->quoteName('translation') . ' = ' . $db->quote('[]'),
|
||||
$db->quoteName('translation') . ' = ' . $db->quote('{}')
|
||||
), 'OR'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where($db->quoteName('translation') . ' NOT LIKE ' . $db->quote('%' . $language . '%'));
|
||||
}
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
return array_unique($db->loadColumn());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get available languages
|
||||
**/
|
||||
public static function getAvailableLanguages()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query
|
||||
->select($db->quoteName(array('langtag', 'name')))
|
||||
->from($db->quoteName('#__componentbuilder_language'))
|
||||
->where($db->quoteName('published') . ' = 1')
|
||||
->order($db->quoteName('name') . ' desc');
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
return $db->loadAssocList('langtag', 'name');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a row already exist
|
||||
*
|
||||
|
File diff suppressed because one or more lines are too long
@ -1012,8 +1012,14 @@ COM_COMPONENTBUILDER_POWERS_EDIT_VERSION="Powers Edit Version"
|
||||
COM_COMPONENTBUILDER_POWERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version powers"
|
||||
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_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_RUN_EXPANSION_BUTTON_ACCESS="Power Run Expansion Button Access"
|
||||
COM_COMPONENTBUILDER_POWER_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
|
||||
COM_COMPONENTBUILDER_POWER_SYNC_BUTTON_ACCESS="Power Sync Button Access"
|
||||
COM_COMPONENTBUILDER_POWER_SYNC_BUTTON_ACCESS_DESC="Allows the users in this group to access the sync button."
|
||||
COM_COMPONENTBUILDER_SEARCH_ACCESS="Search Access"
|
||||
COM_COMPONENTBUILDER_SEARCH_ACCESS_DESC="Allows the users in this group to access search."
|
||||
COM_COMPONENTBUILDER_SEARCH_COMPILER_BUTTON_ACCESS="Search Compiler Button Access"
|
||||
|
@ -12,7 +12,7 @@
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die('Restricted access');
|
||||
|
||||
// Different support requests/appreciation
|
||||
// Different support requests/appreciation
|
||||
$support = [
|
||||
JText::_("COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_JCB_IS_A_CRUCIAL_TOOL_FOR_PHP_PROGRAMMERS_WHO_USE_JOOMLA_TO_EARN_A_LIVING_BY_MAKING_A_BFINANCIAL_DONATIONB_YOU_CAN_SUPPORT_THE_GROWTH_AND_CONTINUITY_OF_THIS_VITAL_RESOURCE_AND_ENSURE_ITS_RELEVANCE_FOR_YEARS_TO_COME_YOUR_CONTRIBUTION_NO_MATTER_HOW_BIG_OR_SMALL_WILL_BE_DEEPLY_APPRECIATED_BY_THE_PROJECTS_TEAM_AND_THE_WIDER_COMMUNITY"),
|
||||
JText::_("COM_COMPONENTBUILDER_THE_CONTINUED_SUPPORT_OF_INDIVIDUALS_LIKE_YOU_HAS_ALLOWED_JOOMLA_COMPONENT_BUILDER_JCB_TO_THRIVE_FOR_SEVEN_YEARS_SINCE_GOING_PUBLIC_YOUR_CONTRIBUTIONS_HAVE_BEEN_CRUCIAL_IN_ENSURING_THE_GROWTH_AND_RELEVANCE_OF_THIS_VITAL_TOOL_FOR_PHP_PROGRAMMERS_THANK_YOU_FOR_YOUR_SUPPORT_AND_FOR_BEING_A_PART_OF_JCBS_JOURNEY"),
|
||||
|
43
admin/layouts/power/super_power_left.php
Normal file
43
admin/layouts/power/super_power_left.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?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('Restricted access');
|
||||
|
||||
// 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(
|
||||
'approved',
|
||||
'approved_paths'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?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; ?>
|
||||
<?php endif; ?>
|
42
admin/layouts/power/super_power_right.php
Normal file
42
admin/layouts/power/super_power_right.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?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('Restricted access');
|
||||
|
||||
// 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(
|
||||
'note_approved_paths'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: array();
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<?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; ?>
|
||||
<?php endif; ?>
|
@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
|
||||
|
||||
/**
|
||||
* Admin_views List Model
|
||||
@ -70,7 +72,7 @@ class ComponentbuilderModelAdmin_views extends ListModel
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
|
||||
);
|
||||
// check if we have joomla components
|
||||
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
|
||||
if (($joomla_components = JCBFilterHelper::names('joomla_component')) !== null)
|
||||
{
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
|
||||
@ -79,7 +81,7 @@ class ComponentbuilderModelAdmin_views extends ListModel
|
||||
$options = $options + $joomla_components;
|
||||
}
|
||||
|
||||
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
|
||||
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
|
||||
$form->setValue(
|
||||
'joomla_component',
|
||||
'filter',
|
||||
@ -88,7 +90,8 @@ class ComponentbuilderModelAdmin_views extends ListModel
|
||||
array_push($this->filter_fields, 'joomla_component');
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
@ -354,7 +357,7 @@ class ComponentbuilderModelAdmin_views extends ListModel
|
||||
$filter_joomla_component = $this->state->get("filter.joomla_component");
|
||||
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_admin_views')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_admin_views')) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
@ -589,7 +592,7 @@ class ComponentbuilderModelAdmin_views extends ListModel
|
||||
$filter_joomla_component = $this->state->get("filter.joomla_component");
|
||||
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_admin_views')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_admin_views')) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Gitea\Gitea;
|
||||
use VDM\Joomla\Gitea\Factory as GiteaFactory;
|
||||
use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Utilities\FileHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
@ -175,11 +175,18 @@ class ComponentbuilderModelAjax extends ListModel
|
||||
// check if url exist
|
||||
if ($info = FileHelper::getContent($url, false))
|
||||
{
|
||||
if ((($info_ = PackageFactory::_('Crypt')->decrypt($info, 'local')) !== null && JsonHelper::check($info_)) ||
|
||||
(($info_ = PackageFactory::_('Crypt')->decrypt($info, 'local.legacy')) !== null && JsonHelper::check($info_)) ||
|
||||
(($info_ = PackageFactory::_('Crypt')->decrypt($info, 'local.fof')) !== null && JsonHelper::check($info_)))
|
||||
$_info = PackageFactory::_('Crypt')->decrypt($info, 'local.legacy');
|
||||
|
||||
// check if we had success
|
||||
if (!JsonHelper::check($_info))
|
||||
{
|
||||
$info = json_decode($info_, true);
|
||||
$_info = PackageFactory::_('Crypt')->decrypt($info, 'local.fof');
|
||||
}
|
||||
|
||||
// check if we have json
|
||||
if (JsonHelper::check($_info))
|
||||
{
|
||||
$info = json_decode($_info, true);
|
||||
|
||||
return [
|
||||
'owner' => PackageFactory::_('Display.Details')->owner($info, true),
|
||||
@ -268,25 +275,16 @@ class ComponentbuilderModelAjax extends ListModel
|
||||
|
||||
public function getWiki($name = 'Home')
|
||||
{
|
||||
// get the token if set
|
||||
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
|
||||
|
||||
// setup a registry
|
||||
$options = new Registry;
|
||||
|
||||
// only add if token is set
|
||||
if ($token)
|
||||
{
|
||||
$options->set('access.token', $token);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// get gitea object
|
||||
$gitea = new Gitea($options);
|
||||
// load the API details
|
||||
GiteaFactory::_('Gitea.Repository.Wiki')->load_('https://git.vdm.dev', '');
|
||||
|
||||
// get the gitea wiki page TODO: we hard coded the page name
|
||||
$page = $gitea->repo->wiki->getHtml('joomla', 'Component-Builder', 'Home');
|
||||
// get the gitea wiki page im markdown
|
||||
$wiki = GiteaFactory::_('Gitea.Repository.Wiki')->get('joomla', 'Component-Builder', 'Home');
|
||||
|
||||
// now render the page in HTML
|
||||
$page = GiteaFactory::_('Gitea.Miscellaneous.Markdown')->render($wiki->content, true);
|
||||
}
|
||||
catch (DomainException $e)
|
||||
{
|
||||
@ -323,20 +321,18 @@ class ComponentbuilderModelAjax extends ListModel
|
||||
public function getVersion($version = null)
|
||||
{
|
||||
// get the token if set
|
||||
$token = JComponentHelper::getParams('com_componentbuilder')->get('gitea_token', false);
|
||||
$token = $this->app_params->get('gitea_token', false);
|
||||
|
||||
// only add if token is set
|
||||
if ($token)
|
||||
{
|
||||
// setup a registry
|
||||
$options = new Registry;
|
||||
$options->set('access.token', $token);
|
||||
// get the gitea http
|
||||
try
|
||||
{
|
||||
// get gitea object
|
||||
$gitea = new Gitea($options);
|
||||
// get a list of all the repos tags
|
||||
$tags = $gitea->repo->getListTags('joomla', 'Component-Builder');
|
||||
// load the API details
|
||||
GiteaFactory::_('Gitea.Repository.Tags')->load_('https://git.vdm.dev', $token);
|
||||
|
||||
// get the repository tags
|
||||
$tags = GiteaFactory::_('Gitea.Repository.Tags')->list('joomla', 'Component-Builder');
|
||||
}
|
||||
catch (DomainException $e)
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Gitea\Gitea;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
||||
|
||||
/**
|
||||
* Custom_admin_views List Model
|
||||
@ -68,7 +70,7 @@ class ComponentbuilderModelCustom_admin_views extends ListModel
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
|
||||
);
|
||||
// check if we have joomla components
|
||||
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
|
||||
if (($joomla_components = JCBFilterHelper::names('joomla_component')) !== null)
|
||||
{
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
|
||||
@ -77,7 +79,7 @@ class ComponentbuilderModelCustom_admin_views extends ListModel
|
||||
$options = $options + $joomla_components;
|
||||
}
|
||||
|
||||
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
|
||||
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
|
||||
$form->setValue(
|
||||
'joomla_component',
|
||||
'filter',
|
||||
@ -293,7 +295,7 @@ class ComponentbuilderModelCustom_admin_views extends ListModel
|
||||
$filter_joomla_component = $this->state->get("filter.joomla_component");
|
||||
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_custom_admin_views')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_custom_admin_views')) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
@ -498,7 +500,7 @@ class ComponentbuilderModelCustom_admin_views extends ListModel
|
||||
$filter_joomla_component = $this->state->get("filter.joomla_component");
|
||||
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_custom_admin_views')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_custom_admin_views')) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
||||
|
||||
/**
|
||||
* Fields List Model
|
||||
@ -63,7 +65,7 @@ class ComponentbuilderModelFields extends ListModel
|
||||
|
||||
// Create the "extension" filter
|
||||
$form->setField(new SimpleXMLElement(
|
||||
ComponentbuilderHelper::getExtensionGroupedListXml()
|
||||
JCBFilterHelper::extensions()
|
||||
),'filter');
|
||||
$form->setValue(
|
||||
'extension',
|
||||
@ -82,7 +84,7 @@ class ComponentbuilderModelFields extends ListModel
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_ADMIN_VIEWS_FOUND') . ' -'
|
||||
);
|
||||
// check if we have admin views (and limit to an extension if it is set)
|
||||
if (($admin_views = ComponentbuilderHelper::getByTypeTheIdsSystemNames('admin_view', $this->state->get("filter.extension"))) !== false)
|
||||
if (($admin_views = JCBFilterHelper::names('admin_view', $this->state->get("filter.extension"))) !== null)
|
||||
{
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_ADMIN_VIEW') . ' -'
|
||||
@ -91,7 +93,7 @@ class ComponentbuilderModelFields extends ListModel
|
||||
$options = $options + $admin_views;
|
||||
}
|
||||
|
||||
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
|
||||
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
|
||||
$form->setValue(
|
||||
'admin_view',
|
||||
'filter',
|
||||
@ -100,7 +102,8 @@ class ComponentbuilderModelFields extends ListModel
|
||||
array_push($this->filter_fields, 'admin_view');
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
@ -379,7 +382,7 @@ class ComponentbuilderModelFields extends ListModel
|
||||
{
|
||||
// column name, and id
|
||||
$type_extension = explode('__', $filter_extension);
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $type_extension[1], (string) $type_extension[0])) !== null)
|
||||
{
|
||||
$field_ids = $ids;
|
||||
}
|
||||
@ -395,7 +398,7 @@ class ComponentbuilderModelFields extends ListModel
|
||||
$filter_admin_view = $this->state->get("filter.admin_view");
|
||||
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_admin_view, 'admin_view')) !== null)
|
||||
{
|
||||
// view will return less fields, so we ignore the component
|
||||
$field_ids = $ids;
|
||||
@ -644,7 +647,7 @@ class ComponentbuilderModelFields extends ListModel
|
||||
{
|
||||
// column name, and id
|
||||
$type_extension = explode('__', $filter_extension);
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $type_extension[1], (string) $type_extension[0])) !== null)
|
||||
{
|
||||
$field_ids = $ids;
|
||||
}
|
||||
@ -660,7 +663,7 @@ class ComponentbuilderModelFields extends ListModel
|
||||
$filter_admin_view = $this->state->get("filter.admin_view");
|
||||
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_admin_view, 'admin_view')) !== null)
|
||||
{
|
||||
// view will return less fields, so we ignore the component
|
||||
$field_ids = $ids;
|
||||
|
@ -17,16 +17,16 @@ jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Powersfilterpowerversion Form Field class for the Componentbuilder component
|
||||
* Powersfilterapproved Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldPowersfilterpowerversion extends JFormFieldList
|
||||
class JFormFieldPowersfilterapproved extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The powersfilterpowerversion field type.
|
||||
* The powersfilterapproved field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'powersfilterpowerversion';
|
||||
public $type = 'powersfilterapproved';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
@ -42,24 +42,28 @@ class JFormFieldPowersfilterpowerversion extends JFormFieldList
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the text.
|
||||
$query->select($db->quoteName('power_version'));
|
||||
$query->select($db->quoteName('approved'));
|
||||
$query->from($db->quoteName('#__componentbuilder_power'));
|
||||
$query->order($db->quoteName('power_version') . ' ASC');
|
||||
$query->order($db->quoteName('approved') . ' ASC');
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
|
||||
$results = $db->loadColumn();
|
||||
$_filter = array();
|
||||
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_VERSION') . ' -');
|
||||
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_SUPER_POWER') . ' -');
|
||||
|
||||
if ($results)
|
||||
{
|
||||
// get powersmodel
|
||||
$model = ComponentbuilderHelper::getModel('powers');
|
||||
$results = array_unique($results);
|
||||
foreach ($results as $power_version)
|
||||
foreach ($results as $approved)
|
||||
{
|
||||
// Now add the power_version and its text to the options array
|
||||
$_filter[] = JHtml::_('select.option', $power_version, $power_version);
|
||||
// Translate the approved selection
|
||||
$text = $model->selectionTranslation($approved,'approved');
|
||||
// Now add the approved and its text to the options array
|
||||
$_filter[] = JHtml::_('select.option', $approved, JText::_($text));
|
||||
}
|
||||
}
|
||||
return $_filter;
|
100
admin/models/fields/superpowerpaths.php
Normal file
100
admin/models/fields/superpowerpaths.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?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('Restricted access');
|
||||
|
||||
// Import the checkboxes field type classes needed
|
||||
|
||||
JFormHelper::loadFieldClass('checkboxes');
|
||||
use VDM\Joomla\Utilities\Component\Helper;
|
||||
|
||||
/**
|
||||
* Superpowerpaths Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldSuperpowerpaths extends JFormFieldCheckboxes
|
||||
{
|
||||
/**
|
||||
* The superpowerpaths field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'superpowerpaths';
|
||||
|
||||
// A DynamicCheckboxes@ Field
|
||||
|
||||
/**
|
||||
* Method to get the data to be passed to the layout for rendering.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
protected function getLayoutData()
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
// True if the field has 'value' set. In other words, it has been stored, don't use the default values.
|
||||
$hasValue = (isset($this->value) && !empty($this->value));
|
||||
|
||||
// If a value has been stored, use it. Otherwise, use the defaults.
|
||||
$checkedOptions = $hasValue ? $this->value : $this->checkedOptions;
|
||||
|
||||
// get the form options
|
||||
$options = [];
|
||||
|
||||
// get the component params
|
||||
$params = Helper::getParams();
|
||||
$activate = $params->get('super_powers_repositories', 0);
|
||||
|
||||
// set the default
|
||||
$default = $params->get('super_powers_core', 'joomla/super-powers');
|
||||
|
||||
// must have one / in the path
|
||||
if (strpos($default, '/') !== false)
|
||||
{
|
||||
$tmp = new stdClass;
|
||||
$tmp->text = $tmp->value = trim($default);
|
||||
$tmp->checked = false;
|
||||
$options[$tmp->value] = $tmp;
|
||||
}
|
||||
|
||||
if ($activate == 1)
|
||||
{
|
||||
$subform = $params->get($this->fieldname);
|
||||
|
||||
// add the paths found in global settings
|
||||
if (is_object($subform))
|
||||
{
|
||||
foreach ($subform as $value)
|
||||
{
|
||||
if (isset($value->owner) && strlen($value->owner) > 1 &&
|
||||
isset($value->repo) && strlen($value->repo) > 1)
|
||||
{
|
||||
$tmp = new stdClass;
|
||||
$tmp->text = $tmp->value = trim($value->owner) . '/' . trim($value->repo);
|
||||
$tmp->checked = false;
|
||||
|
||||
$options[$tmp->value] = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$extraData = array(
|
||||
'checkedOptions' => is_array($checkedOptions) ? $checkedOptions : explode(',', (string) $checkedOptions),
|
||||
'hasValue' => $hasValue,
|
||||
'options' => array_values($options)
|
||||
);
|
||||
|
||||
return array_merge($data, $extraData);
|
||||
}
|
||||
}
|
@ -271,7 +271,7 @@ class ComponentbuilderModelFieldtype extends AdminModel
|
||||
{
|
||||
// column name, and id
|
||||
$type_extension = explode('__', $filter_extension);
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $type_extension[1], (string) $type_extension[0])) !== null)
|
||||
{
|
||||
$field_ids = $ids;
|
||||
}
|
||||
@ -287,7 +287,7 @@ class ComponentbuilderModelFieldtype extends AdminModel
|
||||
$filter_admin_view = $this->state->get("filter.admin_view");
|
||||
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_admin_view, 'admin_view')) !== null)
|
||||
{
|
||||
// view will return less fields, so we ignore the component
|
||||
$field_ids = $ids;
|
||||
|
@ -86,8 +86,8 @@
|
||||
<option value="a.published DESC">JSTATUS_DESC</option>
|
||||
<option value="a.system_name ASC">COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_ASCENDING</option>
|
||||
<option value="a.system_name DESC">COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_DESCENDING</option>
|
||||
<option value="a.name_single ASC">COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORD_NAMING_CONVENTIONS_ASCENDING</option>
|
||||
<option value="a.name_single DESC">COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORD_NAMING_CONVENTIONS_DESCENDING</option>
|
||||
<option value="a.name_single ASC">COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORDNAMING_CONVENTIONS_ASCENDING</option>
|
||||
<option value="a.name_single DESC">COM_COMPONENTBUILDER_FILTER_NAME_SINGLE_RECORDNAMING_CONVENTIONS_DESCENDING</option>
|
||||
<option value="a.short_description ASC">COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_ASCENDING</option>
|
||||
<option value="a.short_description DESC">COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_DESCENDING</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
|
@ -66,8 +66,8 @@
|
||||
<option value="a.published DESC">JSTATUS_DESC</option>
|
||||
<option value="a.system_name ASC">COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_ASCENDING</option>
|
||||
<option value="a.system_name DESC">COM_COMPONENTBUILDER_FILTER_SYSTEM_NAME_DESCENDING</option>
|
||||
<option value="a.name_code ASC">COM_COMPONENTBUILDER_FILTER_NAME_IN_CODE_NAMING_CONVENTIONS_ASCENDING</option>
|
||||
<option value="a.name_code DESC">COM_COMPONENTBUILDER_FILTER_NAME_IN_CODE_NAMING_CONVENTIONS_DESCENDING</option>
|
||||
<option value="a.name_code ASC">COM_COMPONENTBUILDER_FILTER_NAME_IN_CODENAMING_CONVENTIONS_ASCENDING</option>
|
||||
<option value="a.name_code DESC">COM_COMPONENTBUILDER_FILTER_NAME_IN_CODENAMING_CONVENTIONS_DESCENDING</option>
|
||||
<option value="a.short_description ASC">COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_ASCENDING</option>
|
||||
<option value="a.short_description DESC">COM_COMPONENTBUILDER_FILTER_SHORT_DESCRIPTION_DESCENDING</option>
|
||||
<option value="a.companyname ASC">COM_COMPONENTBUILDER_FILTER_COMPANY_NAME_ASCENDING</option>
|
||||
|
@ -39,16 +39,9 @@
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="powersfilterpowerversion"
|
||||
name="power_version"
|
||||
label="COM_COMPONENTBUILDER_POWER_POWER_VERSION_LABEL"
|
||||
multiple="false"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="classpowers"
|
||||
name="extends"
|
||||
label="COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL"
|
||||
type="powersfilterapproved"
|
||||
name="approved"
|
||||
label="COM_COMPONENTBUILDER_POWER_APPROVED_LABEL"
|
||||
multiple="false"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
|
@ -159,6 +159,38 @@
|
||||
message="COM_COMPONENTBUILDER_POWER_POWER_VERSION_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_POWER_POWER_VERSION_HINT"
|
||||
/>
|
||||
<!-- Not_required Field. Type: Hidden. (joomla) -->
|
||||
<field
|
||||
type="hidden"
|
||||
name="not_required"
|
||||
default="一_一"
|
||||
/>
|
||||
<!-- Method_selection Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
name="method_selection"
|
||||
label="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
buttons="add,remove,move"
|
||||
description="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_DESCRIPTION"
|
||||
icon="list"
|
||||
max="150"
|
||||
min="0">
|
||||
<form hidden="true" name="list_method_selection_modal" repeat="true">
|
||||
<!-- Method Field. Type: Pluginsclassmethods. (custom) -->
|
||||
<field
|
||||
type="pluginsclassmethods"
|
||||
name="method"
|
||||
label="COM_COMPONENTBUILDER_POWER_METHOD_LABEL"
|
||||
class="list_class span12 method_selection_list"
|
||||
multiple="false"
|
||||
default="0"
|
||||
onchange="getClassCode(this, 'method');"
|
||||
button="false"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Load_selection Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
@ -184,20 +216,8 @@
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Load_powers_note Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="load_powers_note" label="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_DESCRIPTION" heading="h4" class="alert alert-info load_powers_note" />
|
||||
<!-- Description Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="description"
|
||||
label="COM_COMPONENTBUILDER_POWER_DESCRIPTION_LABEL"
|
||||
rows="11"
|
||||
cols="10"
|
||||
description="COM_COMPONENTBUILDER_POWER_DESCRIPTION_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="HTML"
|
||||
hint="COM_COMPONENTBUILDER_POWER_DESCRIPTION_HINT"
|
||||
/>
|
||||
<!-- Note_linked_to_notice Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_linked_to_notice" label="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_DESCRIPTION" heading="h4" class="note_linked_to_notice" />
|
||||
<!-- Licensing_template Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
@ -211,6 +231,20 @@
|
||||
validate="code"
|
||||
showon="add_licensing_template:2"
|
||||
/>
|
||||
<!-- Description Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="description"
|
||||
label="COM_COMPONENTBUILDER_POWER_DESCRIPTION_LABEL"
|
||||
rows="11"
|
||||
cols="10"
|
||||
description="COM_COMPONENTBUILDER_POWER_DESCRIPTION_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="HTML"
|
||||
hint="COM_COMPONENTBUILDER_POWER_DESCRIPTION_HINT"
|
||||
/>
|
||||
<!-- Note_approved_paths Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_approved_paths" label="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_DESCRIPTION" heading="h4" class="alert alert-info note_approved_paths" showon="approved:1" />
|
||||
<!-- Composer Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
@ -268,6 +302,33 @@
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Extends Field. Type: Classpowers. (custom) -->
|
||||
<field
|
||||
type="classpowers"
|
||||
name="extends"
|
||||
label="COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL"
|
||||
description="COM_COMPONENTBUILDER_POWER_EXTENDS_DESCRIPTION"
|
||||
class="list_class span12"
|
||||
multiple="false"
|
||||
default="0"
|
||||
showon="type:class[OR]type:abstract class[OR]type:final class"
|
||||
button="true"
|
||||
/>
|
||||
<!-- Approved Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="approved"
|
||||
label="COM_COMPONENTBUILDER_POWER_APPROVED_LABEL"
|
||||
description="COM_COMPONENTBUILDER_POWER_APPROVED_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_POWER_NOT_APPROVED</option>
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_POWER_APPROVED</option>
|
||||
</field>
|
||||
<!-- Property_selection Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
@ -308,6 +369,20 @@
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_POWER_NO</option>
|
||||
</field>
|
||||
<!-- Extends_custom Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="extends_custom"
|
||||
label="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_MESSAGE"
|
||||
autocomplete="on"
|
||||
showon="extends:-1[AND]type!:trait[AND]type!:interface"
|
||||
/>
|
||||
<!-- Implements_custom Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
@ -334,66 +409,6 @@
|
||||
showon="type!:interface[AND]type!:trait"
|
||||
button="true"
|
||||
/>
|
||||
<!-- Extends_custom Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="extends_custom"
|
||||
label="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_POWER_EXTENDS_CUSTOM_MESSAGE"
|
||||
autocomplete="on"
|
||||
showon="extends:-1[AND]type!:trait[AND]type!:interface"
|
||||
/>
|
||||
<!-- Extends Field. Type: Classpowers. (custom) -->
|
||||
<field
|
||||
type="classpowers"
|
||||
name="extends"
|
||||
label="COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL"
|
||||
description="COM_COMPONENTBUILDER_POWER_EXTENDS_DESCRIPTION"
|
||||
class="list_class span12"
|
||||
multiple="false"
|
||||
default="0"
|
||||
showon="type:class[OR]type:abstract class[OR]type:final class"
|
||||
button="true"
|
||||
/>
|
||||
<!-- Note_linked_to_notice Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_linked_to_notice" label="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_DESCRIPTION" heading="h4" class="note_linked_to_notice" />
|
||||
<!-- Not_required Field. Type: Hidden. (joomla) -->
|
||||
<field
|
||||
type="hidden"
|
||||
name="not_required"
|
||||
default="一_一"
|
||||
/>
|
||||
<!-- Method_selection Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
name="method_selection"
|
||||
label="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
buttons="add,remove,move"
|
||||
description="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_DESCRIPTION"
|
||||
icon="list"
|
||||
max="150"
|
||||
min="0">
|
||||
<form hidden="true" name="list_method_selection_modal" repeat="true">
|
||||
<!-- Method Field. Type: Pluginsclassmethods. (custom) -->
|
||||
<field
|
||||
type="pluginsclassmethods"
|
||||
name="method"
|
||||
label="COM_COMPONENTBUILDER_POWER_METHOD_LABEL"
|
||||
class="list_class span12 method_selection_list"
|
||||
multiple="false"
|
||||
default="0"
|
||||
onchange="getClassCode(this, 'method');"
|
||||
button="false"
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Namespace_details Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="namespace_details" label="COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_LABEL" description="COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_DESCRIPTION" heading="h4" class="alert alert-success namespace_details" />
|
||||
<!-- Head Field. Type: Editor. (joomla) -->
|
||||
@ -413,8 +428,18 @@
|
||||
required="false"
|
||||
validate="code"
|
||||
/>
|
||||
<!-- Autoload_composer_note Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="autoload_composer_note" label="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_DESCRIPTION" heading="h4" class="alert alert-info autoload_composer_note" />
|
||||
<!-- Approved_paths Field. Type: Superpowerpaths. (custom) -->
|
||||
<field
|
||||
type="superpowerpaths"
|
||||
name="approved_paths"
|
||||
label="COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_LABEL"
|
||||
description="COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_DESCRIPTION"
|
||||
required="false"
|
||||
showon="approved:1">
|
||||
<!-- Option Set. -->
|
||||
<option value="joomla/super-powers">
|
||||
COM_COMPONENTBUILDER_POWER_JOOMLASUPERPOWERS</option>
|
||||
</field>
|
||||
<!-- Use_selection Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
@ -452,21 +477,8 @@
|
||||
/>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Add_licensing_template Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="add_licensing_template"
|
||||
label="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_POWER_USE_GLOBAL</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_POWER_OVERRIDE</option>
|
||||
</field>
|
||||
<!-- Autoload_composer_note Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="autoload_composer_note" label="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_DESCRIPTION" heading="h4" class="alert alert-info autoload_composer_note" />
|
||||
<!-- Main_class_code Field. Type: Editor. (joomla) -->
|
||||
<field
|
||||
type="editor"
|
||||
@ -483,6 +495,23 @@
|
||||
filter="raw"
|
||||
validate="code"
|
||||
/>
|
||||
<!-- Add_licensing_template Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="add_licensing_template"
|
||||
label="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_POWER_USE_GLOBAL</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_POWER_OVERRIDE</option>
|
||||
</field>
|
||||
<!-- Load_powers_note Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="load_powers_note" label="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_DESCRIPTION" heading="h4" class="alert alert-info load_powers_note" />
|
||||
<!-- Guid Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
|
@ -1122,7 +1122,7 @@ class ComponentbuilderModelImport_joomla_components extends BaseDatabaseModel
|
||||
return $data_;
|
||||
}
|
||||
|
||||
$this->app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_ENCRYPT_DATAHTWO_THIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLABR_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEONEONENINE_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB'), 'error');
|
||||
$this->app->enqueueMessage(Text::_('COM_COMPONENTBUILDER_HTWOWE_COULD_NOT_OPEN_THE_ENCRYPT_DATAHTWO_THIS_COULD_BE_DUE_TO_THE_FOFENCRYPTION_THAT_IS_NO_LONGER_SUPPORTED_IN_JOOMLABR_PLEASE_EXPORT_YOUR_PACKAGES_WITH_JCB_VTHREEONEONEEIGHT_OR_HIGHER_TO_BE_ABLE_TO_IMPORT_IT_INTO_THIS_VERSION_OF_JCB'), 'error');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
||||
|
||||
/**
|
||||
* Language_translations List Model
|
||||
@ -55,7 +57,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
|
||||
// Create the "extension" filter
|
||||
$form->setField(new SimpleXMLElement(
|
||||
ComponentbuilderHelper::getExtensionGroupedListXml()
|
||||
JCBFilterHelper::extensions()
|
||||
),'filter');
|
||||
$form->setValue(
|
||||
'extension',
|
||||
@ -75,7 +77,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -'
|
||||
);
|
||||
// check if we have languages set
|
||||
if (($languages = ComponentbuilderHelper::getAvailableLanguages()) !== false)
|
||||
if (($languages = JCBFilterHelper::languages()) !== null)
|
||||
{
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_TRANSLATED_IN') . ' -',
|
||||
@ -85,7 +87,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$options = array_merge($options, $languages);
|
||||
}
|
||||
|
||||
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
|
||||
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
|
||||
$form->setValue(
|
||||
'translated',
|
||||
'filter',
|
||||
@ -114,7 +116,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$options = array_merge($options, $languages);
|
||||
}
|
||||
|
||||
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
|
||||
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
|
||||
$form->setValue(
|
||||
'not_translated',
|
||||
'filter',
|
||||
@ -300,7 +302,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$filter_translated = $this->state->get("filter.translated");
|
||||
if ($filter_translated !== null && !empty($filter_translated))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getTranslationIds($filter_translated)) !== false)
|
||||
if (($ids = JCBFilterHelper::translations($filter_translated)) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
@ -315,7 +317,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$filter_not_translated = $this->state->get("filter.not_translated");
|
||||
if ($filter_not_translated !== null && !empty($filter_not_translated))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getTranslationIds($filter_not_translated, false)) !== false)
|
||||
if (($ids = JCBFilterHelper::translations($filter_not_translated, false)) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',',$ids) . ')');
|
||||
}
|
||||
@ -332,7 +334,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
{
|
||||
// column name, and id
|
||||
$type_extension = explode('__', $filter_extension);
|
||||
if (($ids = ComponentbuilderHelper::getTranslationExtensionsIds($type_extension[1], $type_extension[0])) !== false)
|
||||
if (($ids = JCBFilterHelper::translation((int) $type_extension[1], $type_extension[0])) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
@ -459,7 +461,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$filter_translated = $this->state->get("filter.translated");
|
||||
if ($filter_translated !== null && !empty($filter_translated))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getTranslationIds($filter_translated)) !== false)
|
||||
if (($ids = JCBFilterHelper::translations($filter_translated)) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
@ -474,7 +476,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$filter_not_translated = $this->state->get("filter.not_translated");
|
||||
if ($filter_not_translated !== null && !empty($filter_not_translated))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getTranslationIds($filter_not_translated, false)) !== false)
|
||||
if (($ids = JCBFilterHelper::translations($filter_not_translated, false)) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',',$ids) . ')');
|
||||
}
|
||||
@ -491,7 +493,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
{
|
||||
// column name, and id
|
||||
$type_extension = explode('__', $filter_extension);
|
||||
if (($ids = ComponentbuilderHelper::getTranslationExtensionsIds($type_extension[1], $type_extension[0])) !== false)
|
||||
if (($ids = JCBFilterHelper::translation((int) $type_extension[1], $type_extension[0])) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
|
@ -16,6 +16,9 @@ use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
|
||||
/**
|
||||
* Componentbuilder Power Admin Model
|
||||
@ -65,6 +68,15 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
'licensing_template'
|
||||
)
|
||||
),
|
||||
'super_power' => array(
|
||||
'left' => array(
|
||||
'approved',
|
||||
'approved_paths'
|
||||
),
|
||||
'right' => array(
|
||||
'note_approved_paths'
|
||||
)
|
||||
),
|
||||
'composer' => array(
|
||||
'fullwidth' => array(
|
||||
'autoload_composer_note',
|
||||
@ -202,6 +214,14 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$item->main_class_code = base64_decode($item->main_class_code);
|
||||
}
|
||||
|
||||
if (!empty($item->method_selection))
|
||||
{
|
||||
// Convert the method_selection field to an array.
|
||||
$method_selection = new Registry;
|
||||
$method_selection->loadString($item->method_selection);
|
||||
$item->method_selection = $method_selection->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->load_selection))
|
||||
{
|
||||
// Convert the load_selection field to an array.
|
||||
@ -234,14 +254,6 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$item->implements = $implements->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->method_selection))
|
||||
{
|
||||
// Convert the method_selection field to an array.
|
||||
$method_selection = new Registry;
|
||||
$method_selection->loadString($item->method_selection);
|
||||
$item->method_selection = $method_selection->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->use_selection))
|
||||
{
|
||||
// Convert the use_selection field to an array.
|
||||
@ -250,6 +262,12 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$item->use_selection = $use_selection->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->approved_paths))
|
||||
{
|
||||
// JSON Decode approved_paths.
|
||||
$item->approved_paths = json_decode($item->approved_paths);
|
||||
}
|
||||
|
||||
|
||||
if (empty($item->id))
|
||||
{
|
||||
@ -1003,24 +1021,30 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the empty approved_paths item to data
|
||||
if (!isset($data['approved_paths']))
|
||||
{
|
||||
$data['approved_paths'] = '';
|
||||
}
|
||||
|
||||
// check if the name has placeholder
|
||||
if (strpos($data['name'], '[[[') === false && strpos($data['name'], '###') === false)
|
||||
{
|
||||
// make sure the name is safe to be used as a function name
|
||||
$data['name'] = ComponentbuilderHelper::safeClassFunctionName($data['name']);
|
||||
$data['name'] = ClassfunctionHelper::safe($data['name']);
|
||||
}
|
||||
// if system name is empty create from name
|
||||
if (empty($data['system_name']) || !ComponentbuilderHelper::checkString($data['system_name']))
|
||||
if (empty($data['system_name']) || !UtilitiesStringHelper::check($data['system_name']))
|
||||
{
|
||||
$data['system_name'] = $data['name'];
|
||||
}
|
||||
// must set the version if empty
|
||||
if (empty($data['power_version']) && $data['id'] > 0 && ($power_version = ComponentbuilderHelper::getVar('power', $data['id'], 'id', 'power_version')) !== false)
|
||||
if (empty($data['power_version']) && $data['id'] > 0 && ($power_version = GetHelper::var('power', $data['id'], 'id', 'power_version')) !== false)
|
||||
{
|
||||
$data['power_version'] = $power_version;
|
||||
}
|
||||
// we must preserve versions (so that a change to the version number must result in save as copy)
|
||||
elseif ($data['id'] > 0 && ($old_version = ComponentbuilderHelper::getVar('power', $data['id'], 'id', 'power_version')) && $data['power_version'] != $old_version)
|
||||
elseif ($data['id'] > 0 && ($old_version = GetHelper::var('power', $data['id'], 'id', 'power_version')) && $data['power_version'] != $old_version)
|
||||
{
|
||||
// lets check if we already have this version
|
||||
if (($existing_id = ComponentbuilderHelper::checkExist('power', ['power_version' => $data['power_version'], 'name' => $data['name'], 'namespace' => $data['namespace']])) !== false)
|
||||
@ -1051,6 +1075,19 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
}
|
||||
|
||||
|
||||
// Set the method_selection items to data.
|
||||
if (isset($data['method_selection']) && is_array($data['method_selection']))
|
||||
{
|
||||
$method_selection = new JRegistry;
|
||||
$method_selection->loadArray($data['method_selection']);
|
||||
$data['method_selection'] = (string) $method_selection;
|
||||
}
|
||||
elseif (!isset($data['method_selection']))
|
||||
{
|
||||
// Set the empty method_selection to data
|
||||
$data['method_selection'] = '';
|
||||
}
|
||||
|
||||
// Set the load_selection items to data.
|
||||
if (isset($data['load_selection']) && is_array($data['load_selection']))
|
||||
{
|
||||
@ -1103,19 +1140,6 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$data['implements'] = '';
|
||||
}
|
||||
|
||||
// Set the method_selection items to data.
|
||||
if (isset($data['method_selection']) && is_array($data['method_selection']))
|
||||
{
|
||||
$method_selection = new JRegistry;
|
||||
$method_selection->loadArray($data['method_selection']);
|
||||
$data['method_selection'] = (string) $method_selection;
|
||||
}
|
||||
elseif (!isset($data['method_selection']))
|
||||
{
|
||||
// Set the empty method_selection to data
|
||||
$data['method_selection'] = '';
|
||||
}
|
||||
|
||||
// Set the use_selection items to data.
|
||||
if (isset($data['use_selection']) && is_array($data['use_selection']))
|
||||
{
|
||||
@ -1129,6 +1153,12 @@ class ComponentbuilderModelPower extends AdminModel
|
||||
$data['use_selection'] = '';
|
||||
}
|
||||
|
||||
// Set the approved_paths string to JSON string.
|
||||
if (isset($data['approved_paths']))
|
||||
{
|
||||
$data['approved_paths'] = (string) json_encode($data['approved_paths']);
|
||||
}
|
||||
|
||||
// Set the licensing_template string to base64 string.
|
||||
if (isset($data['licensing_template']))
|
||||
{
|
||||
|
@ -14,6 +14,9 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\Component\Helper as JCBHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
|
||||
|
||||
/**
|
||||
* Powers List Model
|
||||
@ -32,16 +35,123 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'a.type','type',
|
||||
'a.power_version','power_version',
|
||||
'h.name','extends',
|
||||
'a.approved','approved',
|
||||
'a.system_name','system_name',
|
||||
'a.namespace','namespace'
|
||||
'a.namespace','namespace',
|
||||
'a.power_version','power_version'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filter form - Override the parent method
|
||||
*
|
||||
* @param array $data data
|
||||
* @param boolean $loadData load current data
|
||||
*
|
||||
* @return \JForm|boolean The \JForm object or false on error
|
||||
*
|
||||
* @since JCB 2.12.5
|
||||
*/
|
||||
public function getFilterForm($data = array(), $loadData = true)
|
||||
{
|
||||
// load form from the parent class
|
||||
$form = parent::getFilterForm($data, $loadData);
|
||||
|
||||
// Create the "admin_view" filter
|
||||
$attributes = array(
|
||||
'name' => 'namegroup',
|
||||
'type' => 'list',
|
||||
'onchange' => 'this.form.submit();',
|
||||
);
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_NAMESPACE_FOUND') . ' -'
|
||||
);
|
||||
// check if we have namespace (and limit to an extension if it is set)
|
||||
if (($namespaces = JCBFilterHelper::namespaces()) !== null)
|
||||
{
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_A_NAMESPACE') . ' -'
|
||||
);
|
||||
// make sure we do not lose the key values in normal merge
|
||||
$options = $options + $namespaces;
|
||||
}
|
||||
|
||||
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
|
||||
$form->setValue(
|
||||
'namegroup',
|
||||
'filter',
|
||||
$this->state->get("filter.namegroup")
|
||||
);
|
||||
array_push($this->filter_fields, 'namegroup');
|
||||
|
||||
// get the component params
|
||||
$params = JCBHelper::getParams();
|
||||
$activate = $params->get('super_powers_repositories', 0);
|
||||
if ($activate == 1)
|
||||
{
|
||||
$subform = $params->get('approved_paths', null);
|
||||
|
||||
// create approved paths filter
|
||||
$attributes = array(
|
||||
'name' => 'approved_paths',
|
||||
'type' => 'list',
|
||||
'onchange' => 'this.form.submit();',
|
||||
);
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_PATHS_FOUND') . ' -'
|
||||
);
|
||||
|
||||
// add the paths found in global settings
|
||||
if (is_object($subform))
|
||||
{
|
||||
$core = $params->get('super_powers_core', 'joomla/super-powers');
|
||||
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_APPROVED_PATH') . ' -',
|
||||
$core => $core
|
||||
);
|
||||
|
||||
foreach ($subform as $value)
|
||||
{
|
||||
if (isset($value->owner) && strlen($value->owner) > 1 &&
|
||||
isset($value->repo) && strlen($value->repo) > 1)
|
||||
{
|
||||
$value = trim($value->owner) . '/' . trim($value->repo);
|
||||
|
||||
$options[$value] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$form->setField(JCBFormHelper::xml($attributes, $options), 'filter');
|
||||
$form->setValue(
|
||||
'approved_paths',
|
||||
'filter',
|
||||
$this->state->get("filter.approved_paths")
|
||||
);
|
||||
array_push($this->filter_fields, 'approved_paths');
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a power can be used in linking
|
||||
*
|
||||
* @param string $type the type of power
|
||||
*
|
||||
* @return bool
|
||||
* @since JCB 3.1.23
|
||||
*/
|
||||
protected function isSuperPower(string $type): bool
|
||||
{
|
||||
return in_array($type, ['class', 'abstract class', 'final class', 'trait']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
@ -95,18 +205,11 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
$this->setState('filter.type', $type);
|
||||
}
|
||||
|
||||
$power_version = $this->getUserStateFromRequest($this->context . '.filter.power_version', 'filter_power_version');
|
||||
$approved = $this->getUserStateFromRequest($this->context . '.filter.approved', 'filter_approved');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$power_version = $app->input->post->get('power_version');
|
||||
$this->setState('filter.power_version', $power_version);
|
||||
}
|
||||
|
||||
$extends = $this->getUserStateFromRequest($this->context . '.filter.extends', 'filter_extends');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$extends = $app->input->post->get('extends');
|
||||
$this->setState('filter.extends', $extends);
|
||||
$approved = $app->input->post->get('approved');
|
||||
$this->setState('filter.approved', $approved);
|
||||
}
|
||||
|
||||
$system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name');
|
||||
@ -123,6 +226,13 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
$this->setState('filter.namespace', $namespace);
|
||||
}
|
||||
|
||||
$power_version = $this->getUserStateFromRequest($this->context . '.filter.power_version', 'filter_power_version');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$power_version = $app->input->post->get('power_version');
|
||||
$this->setState('filter.power_version', $power_version);
|
||||
}
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
@ -158,6 +268,11 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
continue;
|
||||
}
|
||||
|
||||
// create the GUID placeholder key
|
||||
if ($this->isSuperPower($item->type))
|
||||
{
|
||||
$item->super_power_key = 'Super_'.'_'.'_' . str_replace('-', '_', $item->guid) . '_'.'_'.'_Power';
|
||||
}
|
||||
// remove dots
|
||||
$item->namespace = str_replace('.','\\', $item->namespace);
|
||||
}
|
||||
@ -170,6 +285,8 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
{
|
||||
// convert type
|
||||
$item->type = $this->selectionTranslation($item->type, 'type');
|
||||
// convert approved
|
||||
$item->approved = $this->selectionTranslation($item->approved, 'approved');
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,6 +318,19 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
return $typeArray[$value];
|
||||
}
|
||||
}
|
||||
// Array of approved language strings
|
||||
if ($name === 'approved')
|
||||
{
|
||||
$approvedArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_POWER_NOT_APPROVED',
|
||||
1 => 'COM_COMPONENTBUILDER_POWER_APPROVED'
|
||||
);
|
||||
// Now check if value is found in this array
|
||||
if (isset($approvedArray[$value]) && ComponentbuilderHelper::checkString($approvedArray[$value]))
|
||||
{
|
||||
return $approvedArray[$value];
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@ -223,9 +353,43 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
// From the componentbuilder_item table
|
||||
$query->from($db->quoteName('#__componentbuilder_power', 'a'));
|
||||
|
||||
// do not use these filters in the export method
|
||||
if (!isset($_export) || !$_export)
|
||||
{
|
||||
// Filtering "namegroup"
|
||||
$filter_namegroup = $this->state->get("filter.namegroup");
|
||||
if ($filter_namegroup !== null && !empty($filter_namegroup))
|
||||
{
|
||||
if (($ids = JCBFilterHelper::namegroup($filter_namegroup)) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is none
|
||||
$query->where($db->quoteName('a.id') . ' = ' . 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Filtering "approved paths"
|
||||
$filter_approved_paths = $this->state->get("filter.approved_paths");
|
||||
if ($filter_approved_paths !== null && !empty($filter_approved_paths))
|
||||
{
|
||||
if (($ids = JCBFilterHelper::paths($filter_approved_paths)) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is none
|
||||
$query->where($db->quoteName('a.id') . ' = ' . 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From the componentbuilder_power table.
|
||||
$query->select($db->quoteName(['h.name','h.id'],['extends_name','extends_id']));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_power', 'h') . ' ON (' . $db->quoteName('a.extends') . ' = ' . $db->quoteName('h.guid') . ')');
|
||||
$query->select($db->quoteName(['g.name','g.id'],['extends_name','extends_id']));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_power', 'g') . ' ON (' . $db->quoteName('a.extends') . ' = ' . $db->quoteName('g.guid') . ')');
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.published');
|
||||
@ -271,7 +435,7 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.system_name LIKE '.$search.' OR a.type LIKE '.$search.' OR a.description LIKE '.$search.' OR a.extends_custom LIKE '.$search.' OR a.extends LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.name LIKE '.$search.')');
|
||||
$query->where('(a.system_name LIKE '.$search.' OR a.type LIKE '.$search.' OR a.description LIKE '.$search.' OR a.extends LIKE '.$search.' OR a.extends_custom LIKE '.$search.' OR a.approved_paths LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.name LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,39 +479,22 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
// Filter by the Type Array.
|
||||
$query->where('a.type IN (' . implode(',', $_type) . ')');
|
||||
}
|
||||
// Filter by Power_version.
|
||||
$_power_version = $this->getState('filter.power_version');
|
||||
if (is_numeric($_power_version))
|
||||
// Filter by Approved.
|
||||
$_approved = $this->getState('filter.approved');
|
||||
if (is_numeric($_approved))
|
||||
{
|
||||
if (is_float($_power_version))
|
||||
if (is_float($_approved))
|
||||
{
|
||||
$query->where('a.power_version = ' . (float) $_power_version);
|
||||
$query->where('a.approved = ' . (float) $_approved);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.power_version = ' . (int) $_power_version);
|
||||
$query->where('a.approved = ' . (int) $_approved);
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkString($_power_version))
|
||||
elseif (ComponentbuilderHelper::checkString($_approved))
|
||||
{
|
||||
$query->where('a.power_version = ' . $db->quote($db->escape($_power_version)));
|
||||
}
|
||||
// Filter by Extends.
|
||||
$_extends = $this->getState('filter.extends');
|
||||
if (is_numeric($_extends))
|
||||
{
|
||||
if (is_float($_extends))
|
||||
{
|
||||
$query->where('a.extends = ' . (float) $_extends);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.extends = ' . (int) $_extends);
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkString($_extends))
|
||||
{
|
||||
$query->where('a.extends = ' . $db->quote($db->escape($_extends)));
|
||||
$query->where('a.approved = ' . $db->quote($db->escape($_approved)));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
@ -400,10 +547,10 @@ class ComponentbuilderModelPowers extends ListModel
|
||||
{
|
||||
$id .= ':' . $_type;
|
||||
}
|
||||
$id .= ':' . $this->getState('filter.power_version');
|
||||
$id .= ':' . $this->getState('filter.extends');
|
||||
$id .= ':' . $this->getState('filter.approved');
|
||||
$id .= ':' . $this->getState('filter.system_name');
|
||||
$id .= ':' . $this->getState('filter.namespace');
|
||||
$id .= ':' . $this->getState('filter.power_version');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FormHelper as JCBFormHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
||||
|
||||
/**
|
||||
* Site_views List Model
|
||||
@ -69,7 +71,7 @@ class ComponentbuilderModelSite_views extends ListModel
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
|
||||
);
|
||||
// check if we have joomla components
|
||||
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
|
||||
if (($joomla_components = JCBFilterHelper::names('joomla_component')) !== null)
|
||||
{
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
|
||||
@ -78,7 +80,7 @@ class ComponentbuilderModelSite_views extends ListModel
|
||||
$options = $options + $joomla_components;
|
||||
}
|
||||
|
||||
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
|
||||
$form->setField(JCBFormHelper::xml($attributes, $options),'filter');
|
||||
$form->setValue(
|
||||
'joomla_component',
|
||||
'filter',
|
||||
@ -301,7 +303,7 @@ class ComponentbuilderModelSite_views extends ListModel
|
||||
$filter_joomla_component = $this->state->get("filter.joomla_component");
|
||||
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_site_views')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_site_views')) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
@ -506,7 +508,7 @@ class ComponentbuilderModelSite_views extends ListModel
|
||||
$filter_joomla_component = $this->state->get("filter.joomla_component");
|
||||
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
|
||||
{
|
||||
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_site_views')) !== false)
|
||||
if (($ids = JCBFilterHelper::linked((int) $filter_joomla_component, 'joomla_component_site_views')) !== null)
|
||||
{
|
||||
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
1
admin/sql/updates/mysql/3.1.19.sql
Normal file
1
admin/sql/updates/mysql/3.1.19.sql
Normal file
@ -0,0 +1 @@
|
||||
|
2
admin/sql/updates/mysql/3.1.21.sql
Normal file
2
admin/sql/updates/mysql/3.1.21.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE `#__componentbuilder_power` ADD `approved` TINYINT(1) NOT NULL DEFAULT 0 AFTER `add_licensing_template`;
|
||||
ALTER TABLE `#__componentbuilder_power` ADD `approved_paths` TEXT NOT NULL AFTER `approved`;
|
@ -11,6 +11,7 @@
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.formvalidator');
|
||||
@ -125,7 +126,7 @@ jQuery('<div id="compiling"></div>')
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif; ?>
|
||||
<?php if (ComponentbuilderHelper::checkString($this->SuccessMessage)): ?>
|
||||
<?php if (StringHelper::check($this->SuccessMessage)): ?>
|
||||
<div class="alert alert-success">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<?php echo $this->SuccessMessage; ?>
|
||||
|
@ -356,6 +356,45 @@ class ComponentbuilderViewCompiler extends HtmlView
|
||||
$form->setField($xml, null, true, 'advanced');
|
||||
}
|
||||
|
||||
// powers repository attributes
|
||||
$attributes = [
|
||||
'type' => 'radio',
|
||||
'name' => 'powers_repository',
|
||||
'label' => 'COM_COMPONENTBUILDER_ACTIVATE_SUPER_POWERS',
|
||||
'class' => 'btn-group btn-group-yesno',
|
||||
'description' => 'COM_COMPONENTBUILDER_THIS_ADDS_POWERS_TO_A_LOCAL_REPOSITORY_FOLDER_ALL_BAPPROVEDB_POWERS_LINKED_TO_THIS_COMPONENT_WILL_BE_MOVED_TO_YOUR_BLOCALB_POWERS_REPOSITORY_FOLDER_INTO_THEIR_SELECTIVE_TARGET_PATHS_THIS_LOCAL_FOLDER_PATH_MUST_BE_SET_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_BSUPER_POWERB_TAB',
|
||||
'default' => '2',
|
||||
'showon' => 'show_advanced_options:1'];
|
||||
// start the repository options
|
||||
$options = [
|
||||
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
|
||||
'1' => 'COM_COMPONENTBUILDER_YES',
|
||||
'0' => 'COM_COMPONENTBUILDER_NO'];
|
||||
|
||||
// add to form
|
||||
$xml = ComponentbuilderHelper::getFieldXML($attributes, $options);
|
||||
if ($xml instanceof SimpleXMLElement)
|
||||
{
|
||||
$form->setField($xml, null, true, 'advanced');
|
||||
}
|
||||
|
||||
// powers local path to repositories attributes
|
||||
$attributes = [
|
||||
'type' => 'text',
|
||||
'name' => 'local_powers_repository_path',
|
||||
'label' => 'COM_COMPONENTBUILDER_LOCAL_POWERS_REPOSITORY_PATH',
|
||||
'class' => 'btn-group btn-group-yesno',
|
||||
'description' => 'COM_COMPONENTBUILDER_HERE_YOU_CAN_SET_THE_PATH_TO_THE_SUPER_POWERS_LOCAL_REPOSITORY_FOLDER_WHERE_BLAYERCOREB_AND_ALL_TARGETED_BLAYEROWNB_SUB_PATHS_WILL_BE_PLACED_WITH_THEIR_SELECTIVE_BSWITCHAPPROVEDB_POWERS',
|
||||
'default' => $this->params->get('local_powers_repository_path', ''),
|
||||
'showon' => 'show_advanced_options:1[AND]powers_repository:1'];
|
||||
|
||||
// add to form
|
||||
$xml = ComponentbuilderHelper::getFieldXML($attributes);
|
||||
if ($xml instanceof SimpleXMLElement)
|
||||
{
|
||||
$form->setField($xml, null, true, 'advanced');
|
||||
}
|
||||
|
||||
// Indentation attributes
|
||||
$attributes = [
|
||||
'type' => 'radio',
|
||||
|
@ -64,6 +64,17 @@ $componentParams = $this->params; // will be removed just use $this->params inst
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'powerTab', 'super_power', JText::_('COM_COMPONENTBUILDER_POWER_SUPER_POWER', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('power.super_power_left', $this); ?>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('power.super_power_right', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'powerTab', 'composer', JText::_('COM_COMPONENTBUILDER_POWER_COMPOSER', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
</div>
|
||||
|
@ -146,6 +146,16 @@ class ComponentbuilderViewPower extends HtmlView
|
||||
{
|
||||
JToolBarHelper::custom('power.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('power.sync'))
|
||||
{
|
||||
// add Sync button.
|
||||
JToolBarHelper::custom('power.syncPowers', 'loop custom-button-syncpowers', '', 'COM_COMPONENTBUILDER_SYNC', false);
|
||||
}
|
||||
if ($this->canDo->get('power.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
JToolBarHelper::custom('power.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
JToolBarHelper::cancel('power.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ $edit = "index.php?option=com_componentbuilder&view=powers&task=power.edit";
|
||||
<?php else: ?>
|
||||
<?php echo $this->escape($item->system_name); ?>
|
||||
<?php endif; ?><br /><small>GUID:
|
||||
<?php echo $this->escape($item->guid); ?></small>
|
||||
<?php echo $this->escape($item->guid); ?><?php if(isset($item->super_power_key)): ?><br />SPK: <?php echo $item->super_power_key; ?><?php endif; ?></small>
|
||||
</div>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
@ -81,7 +81,8 @@ $edit = "index.php?option=com_componentbuilder&view=powers&task=power.edit";
|
||||
<?php else: ?>
|
||||
<?php echo $this->escape($item->extends_name); ?>
|
||||
<?php endif; ?><?php elseif ($item->extends === '-1') : ?><br /><?php echo JText::_('COM_COMPONENTBUILDER_EXTENDS'); ?>:
|
||||
<?php echo $this->escape($item->extends_custom); ?><?php endif; ?>
|
||||
<?php echo $this->escape($item->extends_custom); ?><?php endif; ?><br /><?php echo JText::_('COM_COMPONENTBUILDER_SUPER_POWER'); ?>:
|
||||
<?php echo JText::_($item->approved); ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
|
@ -141,6 +141,21 @@ class ComponentbuilderViewPowers extends HtmlView
|
||||
// add Run Expansion button.
|
||||
JToolBarHelper::custom('powers.runExpansion', 'expand-2 custom-button-runexpansion', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false);
|
||||
}
|
||||
if ($this->user->authorise('power.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
JToolBarHelper::custom('powers.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('power.sync', 'com_componentbuilder'))
|
||||
{
|
||||
// add Sync button.
|
||||
JToolBarHelper::custom('powers.syncPowers', 'loop custom-button-syncpowers', '', 'COM_COMPONENTBUILDER_SYNC', false);
|
||||
}
|
||||
if ($this->user->authorise('power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
JToolBarHelper::custom('powers.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('powers');
|
||||
@ -195,43 +210,23 @@ class ComponentbuilderViewPowers extends HtmlView
|
||||
);
|
||||
}
|
||||
|
||||
// Only load Power Version batch if create, edit, and batch is allowed
|
||||
// Only load Approved batch if create, edit, and batch is allowed
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
{
|
||||
// Set Power Version Selection
|
||||
$this->power_versionOptions = JFormHelper::loadFieldType('powersfilterpowerversion')->options;
|
||||
// We do some sanitation for Power Version filter
|
||||
if (ComponentbuilderHelper::checkArray($this->power_versionOptions) &&
|
||||
isset($this->power_versionOptions[0]->value) &&
|
||||
!ComponentbuilderHelper::checkString($this->power_versionOptions[0]->value))
|
||||
// Set Approved Selection
|
||||
$this->approvedOptions = JFormHelper::loadFieldType('powersfilterapproved')->options;
|
||||
// We do some sanitation for Approved filter
|
||||
if (ComponentbuilderHelper::checkArray($this->approvedOptions) &&
|
||||
isset($this->approvedOptions[0]->value) &&
|
||||
!ComponentbuilderHelper::checkString($this->approvedOptions[0]->value))
|
||||
{
|
||||
unset($this->power_versionOptions[0]);
|
||||
unset($this->approvedOptions[0]);
|
||||
}
|
||||
// Power Version Batch Selection
|
||||
// Approved Batch Selection
|
||||
JHtmlBatch_::addListSelection(
|
||||
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_POWER_POWER_VERSION_LABEL').' -',
|
||||
'batch[power_version]',
|
||||
JHtml::_('select.options', $this->power_versionOptions, 'value', 'text')
|
||||
);
|
||||
}
|
||||
|
||||
// Only load Extends Name batch if create, edit, and batch is allowed
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
{
|
||||
// Set Extends Name Selection
|
||||
$this->extendsNameOptions = JFormHelper::loadFieldType('Classpowers')->options;
|
||||
// We do some sanitation for Extends Name filter
|
||||
if (ComponentbuilderHelper::checkArray($this->extendsNameOptions) &&
|
||||
isset($this->extendsNameOptions[0]->value) &&
|
||||
!ComponentbuilderHelper::checkString($this->extendsNameOptions[0]->value))
|
||||
{
|
||||
unset($this->extendsNameOptions[0]);
|
||||
}
|
||||
// Extends Name Batch Selection
|
||||
JHtmlBatch_::addListSelection(
|
||||
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL').' -',
|
||||
'batch[extends]',
|
||||
JHtml::_('select.options', $this->extendsNameOptions, 'value', 'text')
|
||||
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_POWER_APPROVED_LABEL').' -',
|
||||
'batch[approved]',
|
||||
JHtml::_('select.options', $this->approvedOptions, 'value', 'text')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user