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.
parent
d6c73987f5
commit
df16b2e3ad
15
CHANGELOG.md
15
CHANGELOG.md
|
@ -10,3 +10,18 @@
|
|||
- We fixed the readme placeholder issue #978.
|
||||
- We fixed the empty server url issue #978.
|
||||
- Fixed Package import to now use the phplibsec version 3
|
||||
|
||||
# v3.1.24
|
||||
|
||||
- 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 Classes
|
||||
- Fix #995 that all update sites are using the correct URL
|
18
README.md
18
README.md
|
@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
|
|||
|
||||
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
|
||||
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (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)
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -84,4 +84,108 @@ class ComponentbuilderControllerPowers extends AdminController
|
|||
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)
|
||||
|
@ -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
|
||||
|
|
|
@ -34,6 +34,7 @@ class Fields extends Structure
|
|||
* Metadate Switch
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.meta_data');
|
||||
*/
|
||||
public $metadataBuilder = array();
|
||||
|
||||
|
@ -41,6 +42,7 @@ class Fields extends Structure
|
|||
* View access Switch
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.access_switch');
|
||||
*/
|
||||
public $accessBuilder = array();
|
||||
|
||||
|
@ -48,6 +50,7 @@ class Fields extends Structure
|
|||
* edit view tabs counter
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.tab_counter');
|
||||
*/
|
||||
public $tabCounter = array();
|
||||
|
||||
|
@ -55,6 +58,7 @@ class Fields extends Structure
|
|||
* layout builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.layout');
|
||||
*/
|
||||
public $layoutBuilder = array();
|
||||
|
||||
|
@ -62,6 +66,7 @@ class Fields extends Structure
|
|||
* permissions builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.has_permissions');
|
||||
*/
|
||||
public $hasPermissions = array();
|
||||
|
||||
|
@ -83,6 +88,7 @@ class Fields extends Structure
|
|||
* list of fields that are not being escaped
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.do_not_escape');
|
||||
*/
|
||||
public $doNotEscape = array();
|
||||
|
||||
|
@ -90,6 +96,7 @@ class Fields extends Structure
|
|||
* list of classes used in the list view for the fields
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->set('builder.list_field_class');
|
||||
*/
|
||||
public $listFieldClass = array();
|
||||
|
||||
|
@ -97,6 +104,7 @@ class Fields extends Structure
|
|||
* tags builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.tags');
|
||||
*/
|
||||
public $tagsBuilder = array();
|
||||
|
||||
|
@ -104,6 +112,7 @@ class Fields extends Structure
|
|||
* query builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.database_tables');
|
||||
*/
|
||||
public $queryBuilder = array();
|
||||
|
||||
|
@ -111,6 +120,7 @@ class Fields extends Structure
|
|||
* unique keys for database field
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.database_unique_keys');
|
||||
*/
|
||||
public $dbUniqueKeys = array();
|
||||
|
||||
|
@ -118,6 +128,7 @@ class Fields extends Structure
|
|||
* unique guid swtich
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.database_unique_guid');
|
||||
*/
|
||||
public $dbUniqueGuid = array();
|
||||
|
||||
|
@ -125,6 +136,7 @@ class Fields extends Structure
|
|||
* keys for database field
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.database_keys');
|
||||
*/
|
||||
public $dbKeys = array();
|
||||
|
||||
|
@ -132,6 +144,7 @@ class Fields extends Structure
|
|||
* history builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.history');
|
||||
*/
|
||||
public $historyBuilder = array();
|
||||
|
||||
|
@ -139,6 +152,7 @@ class Fields extends Structure
|
|||
* alias builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 CFactory::_('Registry')->get('builder.alias');
|
||||
*/
|
||||
public $aliasBuilder = array();
|
||||
|
||||
|
@ -146,6 +160,7 @@ class Fields extends Structure
|
|||
* title builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 CFactory::_('Registry')->get('builder.title');
|
||||
*/
|
||||
public $titleBuilder = array();
|
||||
|
||||
|
@ -161,6 +176,7 @@ class Fields extends Structure
|
|||
* custom Builder List
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.custom_list');
|
||||
*/
|
||||
public $customBuilderList = array();
|
||||
|
||||
|
@ -168,6 +184,7 @@ class Fields extends Structure
|
|||
* Hidden Fields Builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.hidden_fields');
|
||||
*/
|
||||
public $hiddenFieldsBuilder = array();
|
||||
|
||||
|
@ -175,6 +192,7 @@ class Fields extends Structure
|
|||
* INT Field Builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.integer_fields');
|
||||
*/
|
||||
public $intFieldsBuilder = array();
|
||||
|
||||
|
@ -182,6 +200,7 @@ class Fields extends Structure
|
|||
* Dynamic Fields Builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.dynamic_fields');
|
||||
*/
|
||||
public $dynamicfieldsBuilder = array();
|
||||
|
||||
|
@ -189,6 +208,7 @@ class Fields extends Structure
|
|||
* Main text Builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.main_text_field');
|
||||
*/
|
||||
public $maintextBuilder = array();
|
||||
|
||||
|
@ -203,6 +223,7 @@ class Fields extends Structure
|
|||
* Custom Field Links Builder
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.custom_field_links');
|
||||
*/
|
||||
public $customFieldLinksBuilder = array();
|
||||
|
||||
|
@ -357,6 +378,7 @@ class Fields extends Structure
|
|||
* Set Field Names
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.field_names');
|
||||
*/
|
||||
public $fieldsNames = array();
|
||||
|
||||
|
@ -364,6 +386,7 @@ class Fields extends Structure
|
|||
* Default Fields set to publishing
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->set('builder.new_publishing_fields');
|
||||
*/
|
||||
public $newPublishingFields = array();
|
||||
|
||||
|
@ -371,6 +394,7 @@ class Fields extends Structure
|
|||
* Default Fields set to publishing
|
||||
*
|
||||
* @var array
|
||||
* @deprecated 3.3 Use CFactory::_('Registry')->get('builder.moved_publishing_fields');
|
||||
*/
|
||||
public $movedPublishingFields = array();
|
||||
|
||||
|
@ -395,12 +419,13 @@ class Fields extends Structure
|
|||
// add metadata to the view
|
||||
if (isset($view['metadata']) && $view['metadata'])
|
||||
{
|
||||
$this->metadataBuilder[$nameSingleCode] = $nameListCode;
|
||||
CFactory::_('Registry')->set('builder.meta_data.' . $nameSingleCode, $nameListCode);
|
||||
}
|
||||
// add access to the view
|
||||
if (isset($view['access']) && $view['access'])
|
||||
{
|
||||
$this->accessBuilder[$nameSingleCode] = $nameListCode;
|
||||
CFactory::_('Registry')->set('builder.access_switch.' . $nameSingleCode, true);
|
||||
CFactory::_('Registry')->set('builder.access_switch_list.' . $nameListCode, true);
|
||||
}
|
||||
// main lang prefix
|
||||
$langView = CFactory::_('Config')->lang_prefix . '_'
|
||||
|
@ -647,7 +672,7 @@ class Fields extends Structure
|
|||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Id Field. Type: Text (joomla) -->";
|
||||
// if id is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['id']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.id'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<field";
|
||||
$fieldSet[] = Indent::_(3) . "name=" . '"id"';
|
||||
|
@ -661,7 +686,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if created is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['created']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.created'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Date Created Field. Type: Calendar (joomla) -->";
|
||||
|
@ -684,7 +709,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if created_by is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['created_by']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.created_by'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " User Created Field. Type: User (joomla) -->";
|
||||
|
@ -704,7 +729,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if published is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['published']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.published'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Published Field. Type: List (joomla) -->";
|
||||
|
@ -731,7 +756,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if modified is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['modified']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.modified'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Date Modified Field. Type: Calendar (joomla) -->";
|
||||
|
@ -746,7 +771,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if modified_by is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['modified_by']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.modified_by'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " User Modified Field. Type: User (joomla) -->";
|
||||
|
@ -764,11 +789,8 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// check if view has access
|
||||
if (isset($this->accessBuilder[$nameSingleCode])
|
||||
&& StringHelper::check(
|
||||
$this->accessBuilder[$nameSingleCode]
|
||||
)
|
||||
&& !isset($this->fieldsNames[$nameSingleCode]['access']))
|
||||
if (CFactory::_('Registry')->exists('builder.access_switch.' . $nameSingleCode)
|
||||
&& !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.access'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Access Field. Type: Accesslevel (joomla) -->";
|
||||
|
@ -787,7 +809,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if ordering is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['ordering']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.ordering'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Ordering Field. Type: Numbers (joomla) -->";
|
||||
|
@ -810,7 +832,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if version is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['version']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.version'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Version Field. Type: Text (joomla) -->";
|
||||
|
@ -830,13 +852,10 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// check if metadata is added to this view
|
||||
if (isset($this->metadataBuilder[$nameSingleCode])
|
||||
&& StringHelper::check(
|
||||
$this->metadataBuilder[$nameSingleCode]
|
||||
))
|
||||
if (CFactory::_('Registry')->isString('builder.meta_data.' . $nameSingleCode))
|
||||
{
|
||||
// metakey
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['metakey']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.metakey'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Metakey Field. Type: Textarea (joomla) -->";
|
||||
|
@ -854,7 +873,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// metadesc
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['metadesc']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.metadesc'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(2) . "<!--" . Line::_(__Line__, __Class__)
|
||||
. " Metadesc Field. Type: Textarea (joomla) -->";
|
||||
|
@ -874,7 +893,7 @@ class Fields extends Structure
|
|||
}
|
||||
// fix the permissions field "title" issue gh-629
|
||||
// check if the the title is not already set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['title'])
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.title')
|
||||
&& $this->hasPermissionsSet($view, $nameSingleCode))
|
||||
{
|
||||
// set the field/tab name
|
||||
|
@ -916,14 +935,11 @@ class Fields extends Structure
|
|||
// close fieldset
|
||||
$fieldSet[] = Indent::_(1) . "</fieldset>";
|
||||
// check if metadata is added to this view
|
||||
if (isset($this->metadataBuilder[$nameSingleCode])
|
||||
&& StringHelper::check(
|
||||
$this->metadataBuilder[$nameSingleCode]
|
||||
))
|
||||
if (CFactory::_('Registry')->isString('builder.meta_data.' . $nameSingleCode))
|
||||
{
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['robots'])
|
||||
|| !isset($this->fieldsNames[$nameSingleCode]['rights'])
|
||||
|| !isset($this->fieldsNames[$nameSingleCode]['author']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.robots')
|
||||
|| !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.rights')
|
||||
|| !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.author'))
|
||||
{
|
||||
$fieldSet[] = PHP_EOL . Indent::_(1) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
|
@ -934,7 +950,7 @@ class Fields extends Structure
|
|||
$fieldSet[] = Indent::_(3)
|
||||
. 'label="JGLOBAL_FIELDSET_METADATA_OPTIONS">';
|
||||
// robots
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['robots']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.robots'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(3) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
|
@ -960,7 +976,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// author
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['author']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.author'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(3) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
|
@ -975,7 +991,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// rights
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['rights']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.rights'))
|
||||
{
|
||||
$fieldSet[] = Indent::_(3) . "<!--" . Line::_(
|
||||
__LINE__,__CLASS__
|
||||
|
@ -1069,7 +1085,7 @@ class Fields extends Structure
|
|||
Line::_(__Line__, __Class__) . " Id Field. Type: Text (joomla)"
|
||||
);
|
||||
// if id is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['id']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.id'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'id',
|
||||
|
@ -1087,7 +1103,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if created is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['created']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.created'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'created',
|
||||
|
@ -1109,7 +1125,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if created_by is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['created_by']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.created_by'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'created_by',
|
||||
|
@ -1128,7 +1144,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if published is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['published']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.published'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'published',
|
||||
|
@ -1155,7 +1171,7 @@ class Fields extends Structure
|
|||
}
|
||||
}
|
||||
// if modified is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['modified']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.modified'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'modified',
|
||||
|
@ -1178,7 +1194,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if modified_by is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['modified_by']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.modified_by'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'modified_by',
|
||||
|
@ -1199,11 +1215,8 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// check if view has access
|
||||
if (isset($this->accessBuilder[$nameSingleCode])
|
||||
&& StringHelper::check(
|
||||
$this->accessBuilder[$nameSingleCode]
|
||||
)
|
||||
&& !isset($this->fieldsNames[$nameSingleCode]['access']))
|
||||
if (CFactory::_('Registry')->exists('builder.access_switch.' . $nameSingleCode)
|
||||
&& !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.access'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'access',
|
||||
|
@ -1224,7 +1237,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if ordering is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['ordering']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.ordering'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'ordering',
|
||||
|
@ -1247,7 +1260,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// if version is not set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['version']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.version'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'version',
|
||||
|
@ -1269,13 +1282,10 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// check if metadata is added to this view
|
||||
if (isset($this->metadataBuilder[$nameSingleCode])
|
||||
&& StringHelper::check(
|
||||
$this->metadataBuilder[$nameSingleCode]
|
||||
))
|
||||
if (CFactory::_('Registry')->isString('builder.meta_data.' . $nameSingleCode))
|
||||
{
|
||||
// metakey
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['metakey']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.metakey'))
|
||||
{
|
||||
$attributes = array(
|
||||
'name' => 'metakey',
|
||||
|
@ -1297,7 +1307,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// metadesc
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['metadesc']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.metadesc'))
|
||||
{
|
||||
$attributes['name'] = 'metadesc';
|
||||
$attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL';
|
||||
|
@ -1316,7 +1326,7 @@ class Fields extends Structure
|
|||
}
|
||||
// fix the permissions field "title" issue gh-629
|
||||
// check if the the title is not already set
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['title'])
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.title')
|
||||
&& $this->hasPermissionsSet($view, $nameSingleCode))
|
||||
{
|
||||
// set the field/tab name
|
||||
|
@ -1369,14 +1379,11 @@ class Fields extends Structure
|
|||
}
|
||||
}
|
||||
// check if metadata is added to this view
|
||||
if (isset($this->metadataBuilder[$nameSingleCode])
|
||||
&& StringHelper::check(
|
||||
$this->metadataBuilder[$nameSingleCode]
|
||||
))
|
||||
if (CFactory::_('Registry')->isString('builder.meta_data.' . $nameSingleCode))
|
||||
{
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['robots'])
|
||||
|| !isset($this->fieldsNames[$nameSingleCode]['author'])
|
||||
|| !isset($this->fieldsNames[$nameSingleCode]['rights']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.robots')
|
||||
|| !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.author')
|
||||
|| !CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.rights'))
|
||||
{
|
||||
ComponentbuilderHelper::xmlComment(
|
||||
$fieldSetXML, Line::_(__Line__, __Class__) . " Metadata Fields"
|
||||
|
@ -1392,7 +1399,7 @@ class Fields extends Structure
|
|||
'label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS'
|
||||
);
|
||||
// robots
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['robots']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.robots'))
|
||||
{
|
||||
ComponentbuilderHelper::xmlComment(
|
||||
$fieldsFieldSetXML, Line::_(__Line__, __Class__)
|
||||
|
@ -1425,7 +1432,7 @@ class Fields extends Structure
|
|||
}
|
||||
}
|
||||
// author
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['author']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.author'))
|
||||
{
|
||||
ComponentbuilderHelper::xmlComment(
|
||||
$fieldsFieldSetXML, Line::_(__Line__, __Class__)
|
||||
|
@ -1446,7 +1453,7 @@ class Fields extends Structure
|
|||
CFactory::_('Utilities.Counter')->field++;
|
||||
}
|
||||
// rights
|
||||
if (!isset($this->fieldsNames[$nameSingleCode]['rights']))
|
||||
if (!CFactory::_('Registry')->isString('builder.field_names.' . $nameSingleCode . '.rights'))
|
||||
{
|
||||
ComponentbuilderHelper::xmlComment(
|
||||
$fieldsFieldSetXML, Line::_(__Line__, __Class__)
|
||||
|
@ -1488,16 +1495,14 @@ class Fields extends Structure
|
|||
protected function hasPermissionsSet(&$view, &$nameSingleCode)
|
||||
{
|
||||
// first check if we have checked this already
|
||||
if (!isset($this->hasPermissions[$nameSingleCode]))
|
||||
if (!CFactory::_('Registry')->exists('builder.has_permissions.' . $nameSingleCode))
|
||||
{
|
||||
// default is false
|
||||
$this->hasPermissions[$nameSingleCode] = false;
|
||||
// when a view has history, it has permissions
|
||||
// since it tracks the version access
|
||||
if (isset($view['history']) && $view['history'] == 1)
|
||||
{
|
||||
// set the permission for later
|
||||
$this->hasPermissions[$nameSingleCode] = true;
|
||||
CFactory::_('Registry')->set('builder.has_permissions.' . $nameSingleCode, true);
|
||||
|
||||
// break out here
|
||||
return true;
|
||||
|
@ -1520,7 +1525,7 @@ class Fields extends Structure
|
|||
))
|
||||
{
|
||||
// set the permission for later
|
||||
$this->hasPermissions[$nameSingleCode] = true;
|
||||
CFactory::_('Registry')->set('builder.has_permissions.' . $nameSingleCode, true);
|
||||
|
||||
// break out here
|
||||
return true;
|
||||
|
@ -1543,7 +1548,7 @@ class Fields extends Structure
|
|||
))
|
||||
{
|
||||
// set the permission for later
|
||||
$this->hasPermissions[$nameSingleCode] = true;
|
||||
CFactory::_('Registry')->set('builder.has_permissions.' . $nameSingleCode, true);
|
||||
|
||||
// break out here
|
||||
return true;
|
||||
|
@ -1552,7 +1557,7 @@ class Fields extends Structure
|
|||
}
|
||||
}
|
||||
|
||||
return $this->hasPermissions[$nameSingleCode];
|
||||
return CFactory::_('Registry')->exists('builder.has_permissions.' . $nameSingleCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1565,7 +1570,7 @@ class Fields extends Structure
|
|||
*/
|
||||
public function setFieldsNames(&$view, &$name)
|
||||
{
|
||||
$this->fieldsNames[$view][$name] = $name;
|
||||
CFactory::_('Registry')->set('builder.field_names.' . $view . '.' . $name, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3934,21 +3939,15 @@ class Fields extends Structure
|
|||
// as zero is expected to behave
|
||||
if ($field['order_edit'] == 0)
|
||||
{
|
||||
if (!isset($this->zeroOrderFix[$nameSingleCode]))
|
||||
// get the value
|
||||
$zero_counter = CFactory::_('Registry')->get('builder.zero_order_fix.' . $nameSingleCode . '.' . $field['tab'], -999);
|
||||
if ($zero_counter != -999)
|
||||
{
|
||||
$this->zeroOrderFix[$nameSingleCode] = array();
|
||||
$zero_counter++;
|
||||
}
|
||||
if (!isset($this->zeroOrderFix[$nameSingleCode][(int) $field['tab']]))
|
||||
{
|
||||
$this->zeroOrderFix[$nameSingleCode][(int) $field['tab']]
|
||||
= -999;
|
||||
}
|
||||