Release of v5.0.0-beta3
Add Joomla powers for namespace dynamic management.
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 (5.0.0-beta2) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (5.0.0-beta3) with **ALL** its features and **ALL** concepts totally open-source and free!
|
||||
|
||||
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
|
||||
|
||||
@ -144,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*: 9th April, 2024
|
||||
+ *Version*: 5.0.0-beta2
|
||||
+ *Last Build*: 16th April, 2024
|
||||
+ *Version*: 5.0.0-beta3
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **730207**
|
||||
+ *Field count*: **2080**
|
||||
+ *File count*: **5133**
|
||||
+ *Folder count*: **518**
|
||||
+ *Line count*: **743151**
|
||||
+ *Field count*: **2095**
|
||||
+ *File count*: **5279**
|
||||
+ *Folder count*: **530**
|
||||
|
||||
> 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:joomla@vdm.io)
|
||||
|
@ -418,6 +418,19 @@
|
||||
<action name="joomla_plugin_updates.edit.own" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_OWN_DESC" />
|
||||
<action name="joomla_plugin_updates.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_STATE_DESC" />
|
||||
<action name="joomla_plugin_updates.version" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_EDIT_VERSION_DESC" />
|
||||
<action name="joomla_power.init" title="COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_power.reset" title="COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS_DESC" />
|
||||
<action name="joomla_power.access" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS_DESC" />
|
||||
<action name="joomla_power.batch" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE_DESC" />
|
||||
<action name="joomla_power.create" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE_DESC" />
|
||||
<action name="joomla_power.delete" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE_DESC" />
|
||||
<action name="joomla_power.edit" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_DESC" />
|
||||
<action name="joomla_power.edit.created_by" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY_DESC" />
|
||||
<action name="joomla_power.edit.created" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE_DESC" />
|
||||
<action name="joomla_power.edit.own" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN_DESC" />
|
||||
<action name="joomla_power.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE_DESC" />
|
||||
<action name="joomla_power.version" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION_DESC" />
|
||||
<action name="joomla_power.submenu" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU_DESC" />
|
||||
<action name="language.build" title="COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS_DESC" />
|
||||
<action name="language_translation.access" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC" />
|
||||
<action name="language_translation.batch" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC" />
|
||||
@ -607,6 +620,17 @@
|
||||
<action name="joomla_plugin.access" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_ACCESS_DESC" />
|
||||
<action name="joomla_plugin.version" title="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_PLUGINS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="joomla_power">
|
||||
<action name="joomla_power.edit" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_DESC" />
|
||||
<action name="joomla_power.edit.own" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN_DESC" />
|
||||
<action name="joomla_power.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE_DESC" />
|
||||
<action name="joomla_power.edit.created_by" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY_DESC" />
|
||||
<action name="joomla_power.edit.created" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE_DESC" />
|
||||
<action name="joomla_power.create" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE_DESC" />
|
||||
<action name="joomla_power.delete" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE_DESC" />
|
||||
<action name="joomla_power.access" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS_DESC" />
|
||||
<action name="joomla_power.version" title="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="power">
|
||||
<action name="power.edit" title="COM_COMPONENTBUILDER_POWERS_EDIT" description="COM_COMPONENTBUILDER_POWERS_EDIT_DESC" />
|
||||
<action name="power.edit.own" title="COM_COMPONENTBUILDER_POWERS_EDIT_OWN" description="COM_COMPONENTBUILDER_POWERS_EDIT_OWN_DESC" />
|
||||
|
13
admin/assets/css/joomla_power.css
Normal file
13
admin/assets/css/joomla_power.css
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
13
admin/assets/css/joomla_powers.css
Normal file
13
admin/assets/css/joomla_powers.css
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
@ -695,8 +695,6 @@
|
||||
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"
|
||||
|
64
admin/forms/filter_joomla_powers.xml
Normal file
64
admin/forms/filter_joomla_powers.xml
Normal file
@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
|
||||
addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field"
|
||||
>
|
||||
<fields name="filter">
|
||||
<field
|
||||
type="text"
|
||||
name="search"
|
||||
inputmode="search"
|
||||
label="COM_COMPONENTBUILDER_FILTER_SEARCH"
|
||||
description="COM_COMPONENTBUILDER_FILTER_SEARCH_JOOMLA_POWERS"
|
||||
hint="JSEARCH_FILTER"
|
||||
/>
|
||||
<field
|
||||
type="status"
|
||||
name="published"
|
||||
label="COM_COMPONENTBUILDER_FILTER_PUBLISHED"
|
||||
description="COM_COMPONENTBUILDER_FILTER_PUBLISHED_JOOMLA_POWERS"
|
||||
class="js-select-submit-on-change"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
</field>
|
||||
<field
|
||||
type="accesslevel"
|
||||
name="access"
|
||||
label="JGRID_HEADING_ACCESS"
|
||||
hint="JOPTION_SELECT_ACCESS"
|
||||
multiple="true"
|
||||
class="js-select-submit-on-change"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
/>
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
</fields>
|
||||
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="list"
|
||||
label="JGLOBAL_SORT_BY"
|
||||
class="js-select-submit-on-change"
|
||||
default="a.id desc"
|
||||
validate="options"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.published ASC">JSTATUS_ASC</option>
|
||||
<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.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
label="JGLOBAL_LIST_LIMIT"
|
||||
default="25"
|
||||
class="js-select-submit-on-change"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
213
admin/forms/joomla_power.xml
Normal file
213
admin/forms/joomla_power.xml
Normal file
@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
|
||||
addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field"
|
||||
>
|
||||
<config>
|
||||
<inlinehelp button="show"/>
|
||||
</config>
|
||||
<fieldset name="details">
|
||||
<!-- Default Fields. -->
|
||||
<!-- Id Field. Type: Text (joomla) -->
|
||||
<field
|
||||
name="id"
|
||||
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
|
||||
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
|
||||
readonly="true"
|
||||
/>
|
||||
<!-- Date Created Field. Type: Calendar (joomla) -->
|
||||
<field
|
||||
name="created"
|
||||
type="calendar"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_CREATED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_CREATED_DATE_DESC"
|
||||
size="22"
|
||||
format="%Y-%m-%d %H:%M:%S"
|
||||
filter="user_utc"
|
||||
/>
|
||||
<!-- User Created Field. Type: User (joomla) -->
|
||||
<field
|
||||
name="created_by"
|
||||
type="user"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_CREATED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_CREATED_BY_DESC"
|
||||
/>
|
||||
<!-- Published Field. Type: List (joomla) -->
|
||||
<field name="published" type="list" label="JSTATUS"
|
||||
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
|
||||
filter="intval" size="1" default="1" >
|
||||
<option value="1">
|
||||
JPUBLISHED</option>
|
||||
<option value="0">
|
||||
JUNPUBLISHED</option>
|
||||
<option value="2">
|
||||
JARCHIVED</option>
|
||||
<option value="-2">
|
||||
JTRASHED</option>
|
||||
</field>
|
||||
<!-- Date Modified Field. Type: Calendar (joomla) -->
|
||||
<field name="modified" type="calendar" class="readonly"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_MODIFIED_DATE_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_POWER_MODIFIED_DATE_DESC"
|
||||
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
|
||||
<!-- User Modified Field. Type: User (joomla) -->
|
||||
<field name="modified_by" type="user"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_MODIFIED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_MODIFIED_BY_DESC"
|
||||
class="readonly"
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
type="number"
|
||||
class="inputbox validate-ordering"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_ORDERING_LABEL"
|
||||
description=""
|
||||
default="0"
|
||||
size="6"
|
||||
required="false"
|
||||
/>
|
||||
<!-- Version Field. Type: Text (joomla) -->
|
||||
<field
|
||||
name="version"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_VERSION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_VERSION_DESC"
|
||||
size="6"
|
||||
default="1"
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Was added due to Permissions JS needing a Title field -->
|
||||
<!-- Let us know at gh-629 should this change -->
|
||||
<!-- https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235 -->
|
||||
<field
|
||||
name="title"
|
||||
type="hidden"
|
||||
default="componentbuilder joomla_power"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- System_name Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="system_name"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
default=""
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_HINT"
|
||||
/>
|
||||
<!-- Settings Field. Type: Subform. (joomla) -->
|
||||
<field
|
||||
type="subform"
|
||||
name="settings"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_SETTINGS_LABEL"
|
||||
layout="joomla.form.field.subform.repeatable-table"
|
||||
multiple="true"
|
||||
buttons="add,remove,move"
|
||||
icon="list"
|
||||
max="10"
|
||||
min="1">
|
||||
<form hidden="true" name="list_settings_modal" repeat="true">
|
||||
<!-- Namespace Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="namespace"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_NAMESPACE_LABEL"
|
||||
size="250"
|
||||
maxlength="250"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_NAMESPACE_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
required="true"
|
||||
filter="STRING"
|
||||
message="COM_COMPONENTBUILDER_JOOMLA_POWER_NAMESPACE_MESSAGE"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_NAMESPACE_HINT"
|
||||
autocomplete="on"
|
||||
/>
|
||||
<!-- Joomla_version Field. Type: List. (joomla) -->
|
||||
<field
|
||||
type="list"
|
||||
name="joomla_version"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_VERSION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_VERSION_DESCRIPTION"
|
||||
class="list_class"
|
||||
layout="joomla.form.field.list-fancy-select"
|
||||
multiple="false"
|
||||
required="true"
|
||||
default="0">
|
||||
<!-- Option Set. -->
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWER_ALL</option>
|
||||
<option value="3">
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_3</option>
|
||||
<option value="4">
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_4</option>
|
||||
<option value="5">
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_5</option>
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
<!-- Guid Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="guid"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_LABEL"
|
||||
size="40"
|
||||
maxlength="40"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="true"
|
||||
filter="CMD"
|
||||
validate="guid"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_GUID_HINT"
|
||||
/>
|
||||
<!-- Description Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="description"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_LABEL"
|
||||
rows="11"
|
||||
cols="10"
|
||||
description="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="HTML"
|
||||
hint="COM_COMPONENTBUILDER_JOOMLA_POWER_DESCRIPTION_HINT"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<!-- Access Control Fields. -->
|
||||
<fieldset name="accesscontrol">
|
||||
<!-- Asset Id Field. Type: Hidden (joomla) -->
|
||||
<field
|
||||
name="asset_id"
|
||||
type="hidden"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Rules Field. Type: Rules (joomla) -->
|
||||
<field
|
||||
name="rules"
|
||||
type="rules"
|
||||
label="Permissions in relation to this joomla_power"
|
||||
translate_label="false"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
class="inputbox"
|
||||
component="com_componentbuilder"
|
||||
section="joomla_power"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
File diff suppressed because one or more lines are too long
@ -826,6 +826,32 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS="Joomla Plugin Prope
|
||||
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PROPERTIES_BUTTON_ACCESS_DESC="Allows the users in this group to access the properties button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS="Joomla Plugin Run Expansion Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_RUN_EXPANSION_BUTTON_ACCESS_DESC="Allows the users in this group to access the run expansion button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS="Joomla Powers Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_ACCESS_DESC="Allows the users in this group to access access joomla powers"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE="Joomla Powers Batch Use"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_BATCH_USE_DESC="Allows the users in this group to use batch copy/update method of batch joomla powers"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE="Joomla Powers Create"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_CREATE_DESC="Allows the users in this group to create create joomla powers"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE="Joomla Powers Delete"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_DELETE_DESC="Allows the users in this group to delete delete joomla powers"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT="Joomla Powers Edit"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY="Joomla Powers Edit Created By"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by joomla powers"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE="Joomla Powers Edit Created Date"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created joomla powers"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_DESC="Allows the users in this group to edit the joomla power"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN="Joomla Powers Edit Own"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own joomla powers created by them"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE="Joomla Powers Edit State"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the joomla power"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION="Joomla Powers Edit Version"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version joomla powers"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU="Joomla Powers Submenu"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWERS_SUBMENU_DESC="Allows the users in this group to submenu of joomla power"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS="Joomla Power Init Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWER_INIT_BUTTON_ACCESS_DESC="Allows the users in this group to access the init button."
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS="Joomla Power Reset Button Access"
|
||||
COM_COMPONENTBUILDER_JOOMLA_POWER_RESET_BUTTON_ACCESS_DESC="Allows the users in this group to access the reset button."
|
||||
COM_COMPONENTBUILDER_LANGUAGES_ACCESS="Languages Access"
|
||||
COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC="Allows the users in this group to access access languages"
|
||||
COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE="Languages Batch Use"
|
||||
@ -976,6 +1002,7 @@ COM_COMPONENTBUILDER_MENU_HELP_DOCUMENTS="Help Documents"
|
||||
COM_COMPONENTBUILDER_MENU_JOOMLA_COMPONENTS="Joomla Components"
|
||||
COM_COMPONENTBUILDER_MENU_JOOMLA_MODULES="Joomla Modules"
|
||||
COM_COMPONENTBUILDER_MENU_JOOMLA_PLUGINS="Joomla Plugins"
|
||||
COM_COMPONENTBUILDER_MENU_JOOMLA_POWERS="Joomla Powers"
|
||||
COM_COMPONENTBUILDER_MENU_LANGUAGE_TRANSLATIONS="Language Translations"
|
||||
COM_COMPONENTBUILDER_MENU_LAYOUTS="Layouts"
|
||||
COM_COMPONENTBUILDER_MENU_LIBRARIES="Libraries"
|
||||
|
1
admin/layouts/joomla_power/index.html
Normal file
1
admin/layouts/joomla_power/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
52
admin/layouts/joomla_power/joomla_power_above.php
Normal file
52
admin/layouts/joomla_power/joomla_power_above.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: [
|
||||
'system_name'
|
||||
];
|
||||
|
||||
// Ensure $fields is treated as an array and count its size.
|
||||
$size = count((array) $fields);
|
||||
|
||||
// Use a ternary operator to determine the class.
|
||||
// If there are 1 to 4 fields, set the class to divide the 12-grid column equally among the fields.
|
||||
// For more than 4 fields, default to four columns (3-grid each) for medium and larger screens.
|
||||
$css_class = ($size > 0 && $size <= 4) ? 'col-12 col-md-' . round(12 / $size) : 'col-12 col-md-3';
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: [];
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="row title-alias form-vertical mb-3">
|
||||
<?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, ['class' => $css_class . ' control-wrapper-' . $field]); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
45
admin/layouts/joomla_power/joomla_power_fullwidth.php
Normal file
45
admin/layouts/joomla_power/joomla_power_fullwidth.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'description',
|
||||
'settings'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: [];
|
||||
|
||||
?>
|
||||
<?php if ($fields && count((array) $fields)) :?>
|
||||
<div class="form-vertical">
|
||||
<?php foreach($fields as $field): ?>
|
||||
<?php if (in_array($field, $hiddenFields)) : ?>
|
||||
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
47
admin/layouts/joomla_power/publishing.php
Normal file
47
admin/layouts/joomla_power/publishing.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'guid',
|
||||
'title',
|
||||
'created',
|
||||
'created_by',
|
||||
'modified',
|
||||
'modified_by'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: [];
|
||||
|
||||
?>
|
||||
<?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; ?>
|
47
admin/layouts/joomla_power/publlshing.php
Normal file
47
admin/layouts/joomla_power/publlshing.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// get the form
|
||||
$form = $displayData->getForm();
|
||||
|
||||
// get the layout fields override method name (from layout path/ID)
|
||||
$layout_path_array = explode('.', $this->getLayoutId());
|
||||
// Since we cannot pass the layout and tab names as parameters to the model method
|
||||
// this name combination of tab and layout in the method name is the only work around
|
||||
// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name.
|
||||
// example of layout name: details_left.php
|
||||
// example of method name: getFields_details_left()
|
||||
$fields_tab_layout = 'fields_' . $layout_path_array[1];
|
||||
|
||||
// get the fields
|
||||
$fields = $displayData->get($fields_tab_layout) ?: array(
|
||||
'published',
|
||||
'ordering',
|
||||
'access',
|
||||
'version',
|
||||
'hits',
|
||||
'id'
|
||||
);
|
||||
|
||||
$hiddenFields = $displayData->get('hidden_fields') ?: [];
|
||||
|
||||
?>
|
||||
<?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; ?>
|
@ -22,7 +22,60 @@ if (file_exists($composer_autoloader))
|
||||
\spl_autoload_register(function ($class) {
|
||||
// project-specific base directories and namespace prefix
|
||||
$search = [
|
||||
'libraries/vendor_jcb/VDM.Joomla.Openai' => 'VDM\\Joomla\\Openai',
|
||||
'libraries/vendor_jcb/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
|
||||
'libraries/vendor_jcb/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
|
||||
'libraries/vendor_jcb/VDM.Joomla' => 'VDM\\Joomla',
|
||||
'libraries/vendor_jcb/VDM.Minify' => 'VDM\\Minify',
|
||||
'libraries/vendor_jcb/VDM.Psr' => 'VDM\\Psr'
|
||||
];
|
||||
// Start the search and load if found
|
||||
$found = false;
|
||||
$found_base_dir = "";
|
||||
$found_len = 0;
|
||||
foreach ($search as $base_dir => $prefix)
|
||||
{
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) === 0)
|
||||
{
|
||||
// we have a match so load the values
|
||||
$found = true;
|
||||
$found_base_dir = $base_dir;
|
||||
$found_len = $len;
|
||||
// done here
|
||||
break;
|
||||
}
|
||||
}
|
||||
// check if we found a match
|
||||
if (!$found)
|
||||
{
|
||||
// not found so move to the next registered autoloader
|
||||
return;
|
||||
}
|
||||
// get the relative class name
|
||||
$relative_class = substr($class, $found_len);
|
||||
// replace the namespace prefix with the base directory, replace namespace
|
||||
// separators with directory separators in the relative class name, append
|
||||
// with .php
|
||||
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
|
||||
// if the file exists, require it
|
||||
if (file_exists($file))
|
||||
{
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
|
||||
// add the autoloader for the composer classes
|
||||
$composer_autoloader = JPATH_LIBRARIES . '/phpseclib3/vendor/autoload.php';
|
||||
if (file_exists($composer_autoloader))
|
||||
{
|
||||
require_once $composer_autoloader;
|
||||
}
|
||||
|
||||
// register additional namespace
|
||||
\spl_autoload_register(function ($class) {
|
||||
// project-specific base directories and namespace prefix
|
||||
$search = [
|
||||
'libraries/vendor_jcb/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
|
||||
'libraries/vendor_jcb/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
|
||||
'libraries/vendor_jcb/VDM.Joomla' => 'VDM\\Joomla',
|
||||
|
@ -326,6 +326,35 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_plugin` (
|
||||
KEY `idx_state` (`published`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_power` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
|
||||
`description` TEXT NULL,
|
||||
`guid` VARCHAR(36) NOT NULL DEFAULT '',
|
||||
`settings` TEXT NOT NULL,
|
||||
`system_name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`params` text NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`created` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
`modified` DATETIME DEFAULT NULL,
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`checked_out_time` DATETIME DEFAULT NULL,
|
||||
`version` INT(10) unsigned NOT NULL DEFAULT 1,
|
||||
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`access` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_system_name` (`system_name`),
|
||||
KEY `idx_guid` (`guid`),
|
||||
KEY `idx_access` (`access`),
|
||||
KEY `idx_checkout` (`checked_out`),
|
||||
KEY `idx_createdby` (`created_by`),
|
||||
KEY `idx_modifiedby` (`modified_by`),
|
||||
KEY `idx_state` (`published`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__componentbuilder_power` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
|
||||
@ -5560,7 +5589,8 @@ INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`,
|
||||
(3372, '', '', '', '', '', '', 'Other', 3, 11, '', 'INT', '', '', '', 'Preferred Joomla Version', 'NOT NULL', '', 15, '\"<field\\n\\ttype=\\\"number\\\"\\n\\tname=\\\"preferred_joomla_version\\\"\\n\\tlabel=\\\"Preferred Joomla Version\\\"\\n\\tdefault=\\\"3\\\"\\n\\tclass=\\\"text_area\\\"\\n\\tmin=\\\"3\\\"\\n\\tmax=\\\"5\\\"\\n\\tstep=\\\"1\\\"\\n\\/>\"', 1, '2024-03-07 13:11:01', '2024-03-07 13:12:26', 2, '', 1055, 'e30ca545-0ccd-4925-b34d-96bc27d6a27c', '', '', '', '', ''),
|
||||
(3373, '', '', '', '', '', '', 'Other', 3, 11, '', 'INT', '', '', '', 'Joomla Version', 'NOT NULL', '', 11, '\"<field\\n\\ttype=\\\"list\\\"\\n\\tname=\\\"joomla_version\\\"\\n\\tlabel=\\\"Joomla Version\\\"\\n\\tdescription=\\\"Joomla Target\\\"\\n\\tclass=\\\"list_class\\\"\\n\\tlayout=\\\"joomla.form.field.list-fancy-select\\\"\\n\\tmultiple=\\\"false\\\"\\n\\trequired=\\\"true\\\"\\n\\toption=\\\"0|All,3|Joomla 3,4|Joomla 4,5|Joomla 5\\\"\\n\\tdefault=\\\"0\\\"\\n\\/>\"', 1, '2024-03-27 12:06:23', '2024-03-27 12:07:26', 2, '', 1055, 'e2d5b5aa-5d88-4224-b93f-ad517b59f75b', '', '', '', '', ''),
|
||||
(3374, '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add JCB Powers Path', 'NOT NULL', '', 17, '\"<field\\n\\ttype=\\\"radio\\\"\\n\\tname=\\\"add_jcb_powers_path\\\"\\n\\tlabel=\\\"JCB Powers Path\\\"\\n\\tdescription=\\\"Would you like to override the global jcb powers path for this component?\\\"\\n\\tclass=\\\"btn-group btn-group-yesno\\\"\\n\\toption=\\\"|Global,1|Override\\\"\\n\\tdefault=\\\"\\\"\\n\\/>\"', 1, '2024-04-03 10:50:50', '2023-10-23 10:36:09', 1, '', 192, 'a6c65a43-e305-42c1-bd9d-5db5e4920185', '', '', '', '', ''),
|
||||
(3375, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'JCB Powers Path (component)', 'NOT NULL', '', 24, '\"<field\\n\\ttype=\\\"text\\\"\\n\\tname=\\\"jcb_powers_path\\\"\\n\\tlabel=\\\"JCB Powers Path<br \\/><small>example: <code>libraries\\/jcb_powers<\\/code><\\/small>\\\"\\n\\tsize=\\\"70\\\"\\n\\tmaxlength=\\\"150\\\"\\n\\tdescription=\\\"Here you can set the path to the powers folder. Recommended that you always place it inside the <b>libraries<\\/b>. You don\'t need to add a full path here, so <b>libraries\\/jcb_powers<\\/b> will mean <i>\\/home\\/username\\/public_html\\/libraries\\/jcb_powers<\\/i> when installed. You should always use two folders here, libraries + one more for example: <br \\/><code>libraries\\/jcb_powers<\\/code>\\\"\\n\\tclass=\\\"text_area\\\"\\n\\tfilter=\\\"PATH\\\"\\n\\tmessage=\\\"Error! Please add folder path here.\\\"\\n\\thint=\\\"libraries\\/jcb_powers\\\"\\n\\tshowon=\\\"add_jcb_powers_path:1\\\"\\n\\tautocomplete=\\\"on\\\"\\n\\/>\"', 1, '2024-04-03 10:51:37', '2021-12-01 00:51:37', 1, '', 641, '763e5bdf-d4d3-449b-bb36-de2623d81540', '', '', '', '', '');
|
||||
(3375, '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'JCB Powers Path (component)', 'NOT NULL', '', 24, '\"<field\\n\\ttype=\\\"text\\\"\\n\\tname=\\\"jcb_powers_path\\\"\\n\\tlabel=\\\"JCB Powers Path<br \\/><small>example: <code>libraries\\/jcb_powers<\\/code><\\/small>\\\"\\n\\tsize=\\\"70\\\"\\n\\tmaxlength=\\\"150\\\"\\n\\tdescription=\\\"Here you can set the path to the powers folder. Recommended that you always place it inside the <b>libraries<\\/b>. You don\'t need to add a full path here, so <b>libraries\\/jcb_powers<\\/b> will mean <i>\\/home\\/username\\/public_html\\/libraries\\/jcb_powers<\\/i> when installed. You should always use two folders here, libraries + one more for example: <br \\/><code>libraries\\/jcb_powers<\\/code>\\\"\\n\\tclass=\\\"text_area\\\"\\n\\tfilter=\\\"PATH\\\"\\n\\tmessage=\\\"Error! Please add folder path here.\\\"\\n\\thint=\\\"libraries\\/jcb_powers\\\"\\n\\tshowon=\\\"add_jcb_powers_path:1\\\"\\n\\tautocomplete=\\\"on\\\"\\n\\/>\"', 1, '2024-04-03 10:51:37', '2021-12-01 00:51:37', 1, '', 641, '763e5bdf-d4d3-449b-bb36-de2623d81540', '', '', '', '', ''),
|
||||
(3376, '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Namespace Settings.', 'NOT NULL', '', 35, '\"<field\\n\\ttype=\\\"subform\\\"\\n\\tname=\\\"settings\\\"\\n\\tlabel=\\\"Settings\\\"\\n\\tlayout=\\\"joomla.form.field.subform.repeatable-table\\\"\\n\\tmultiple=\\\"true\\\"\\n\\tbuttons=\\\"add,remove,move\\\"\\n\\tfields=\\\"2947,3373\\\"\\n\\ticon=\\\"list\\\"\\n\\tmax=\\\"10\\\"\\n\\tmin=\\\"1\\\"\\n\\/>\"', 1, '2024-04-09 14:33:01', '2024-04-09 14:34:03', 2, '', 1057, 'a1033166-8112-45f9-8af8-c15a53d30c04', '', '', '', '', '');
|
||||
|
||||
--
|
||||
-- Dumping data for table `#__componentbuilder_fieldtype`
|
||||
@ -5595,7 +5625,7 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `description`, `name`, `prope
|
||||
(26, 'The timezones form field type provides a drop down list of time zones. If the field has a value saved, this value is displayed when the page is first loaded. If not, the default value (if any) is selected.', 'Timezone', '{\"properties0\":{\"name\":\"type\",\"example\":\"timezone\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be timezone.\"},\"properties1\":{\"name\":\"name\",\"example\":\"timezone\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Timezone\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default time zone. For example, use \'-10\' for \'(UTC -10:00) Hawaii\'.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties5\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a drop down list of time zones.', '', 1, 3, '', '', 'ed8d8cf4-cb05-49cc-95ef-4ef275f539f9'),
|
||||
(27, 'This field essentially is a text field with the type of url. If a fully qualified url (that is one with a scheme and domain such as http://example.com) is entered and it uses idn (that is uses characters that are non ascii such as ê or Ψ) it will translat', 'URL', '{\"properties0\":{\"name\":\"type\",\"example\":\"url\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be url.\"},\"properties1\":{\"name\":\"name\",\"example\":\"website\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Website\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties4\":{\"name\":\"maxlength\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) limits the number of characters that may be entered.\"},\"properties5\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Enter website address\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties7\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties8\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties10\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties11\":{\"name\":\"relative\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) set to true for relative URLs\"},\"properties12\":{\"name\":\"filter\",\"example\":\"url\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties13\":{\"name\":\"validated\",\"example\":\"url\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties14\":{\"name\":\"scheme\",\"example\":\"http,https,mailto\",\"adjustable\":\"1\",\"description\":\"(optional) Validates that the value is a URL with a valid scheme (which can be restricted by the optional comma-separated field \'scheme\'), and passes a basic syntax check.\"},\"properties15\":{\"name\":\"message\",\"example\":\"Error! Please add website here.\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties16\":{\"name\":\"hint\",\"example\":\"Your Website Here\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The placeholder to display inside the text box.\"},\"properties19\":{\"name\":\"autocomplete\",\"example\":\"on\",\"adjustable\":\"1\",\"description\":\"(optional) The autocomplete state for the form field. If \'off\' element will not be automatically completed by browser.\"},\"properties17\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+ https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"},\"properties18\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a URL text input field.', '', 1, 10, '', '', '8df6e07e-2b16-43ed-a18d-2059fa44cdf1'),
|
||||
(28, 'The user form field type provides a modal select box of users.', 'User', '{\"properties0\":{\"name\":\"type\",\"example\":\"user\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be user.\"},\"properties1\":{\"name\":\"name\",\"example\":\"user\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"User\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a modal list of users.', '', 1, 4, '', '', 'b0641980-5e78-42f6-972f-86aa607db23e'),
|
||||
(29, 'The usergroup form field type provides a modal select box of user groups.', 'Usergrouplist', '{\"properties0\":{\"name\":\"type\",\"example\":\"usergrouplist\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be usergroup.\"},\"properties1\":{\"name\":\"name\",\"example\":\"usergroup\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Group\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Select a group\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the field required true if yes.\"},\"properties7\":{\"name\":\"multiple\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) If set to multiple then allows more than one usergroup to be selected.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a drop down list of user groups.', '', 1, 4, '', '', 'e2f31181-fbb3-4c3a-859d-72b6b0cff308'),
|
||||
(29, 'The usergroup form field type provides a modal select box of user groups.', 'Usergrouplist', '{\"properties0\":{\"name\":\"type\",\"example\":\"usergrouplist\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be usergroup.\"},\"properties1\":{\"name\":\"name\",\"example\":\"usergroup\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Group\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Select a group\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties9\":{\"name\":\"layout\",\"example\":\"joomla.form.field.list-fancy-select\",\"adjustable\":\"1\",\"description\":\"(optional) (translatable) is the layout, for example joomla.form.field.list-fancy-select.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the field required true if yes.\"},\"properties10\":{\"name\":\"checksuperusergroup\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"(optional) is boolean to omit Super User groups. Values 1 or 0.\"},\"properties7\":{\"name\":\"multiple\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) If set to multiple then allows more than one usergroup to be selected.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'provides a drop down list of user groups.', '', 1, 5, '', '', 'e2f31181-fbb3-4c3a-859d-72b6b0cff308'),
|
||||
(30, 'The filelist form field type provides a drop down list of files from a specified directory. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.\r\n\r\nBy default, the first item on the', 'Filelist', '{\"properties0\":{\"name\":\"type\",\"example\":\"filelist\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be filelist.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfile\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a file\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"directory\",\"example\":\"images\\/stories\",\"adjustable\":\"1\",\"description\":\"(optional) is the filesystem path to the directory containing the files to be listed. If omitted the directory given by JPATH_ROOT is assumed.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default file name.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a regular expression string which is used to filter the list of files selected for inclusion in the drop-down list. If omitted, all files in the directory are included. The filter argument expression is applied before the exclude argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties7\":{\"name\":\"exclude\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a regular expression string which is used to exclude files from the list. The exclude argument expression is applied after the filter argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties8\":{\"name\":\"stripext\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true then file name extensions will be stripped from the file names listed. Also note that the file name will be saved without the extension too.\"},\"properties9\":{\"name\":\"hide_none\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Do not use -\' item is omitted from the drop-down list.\"},\"properties10\":{\"name\":\"hide_default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Use default -\' item is omitted from the drop-down list.\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'Provides a drop down list of files from a specified directory.', '', 1, 4, '', 1, '0c80df15-52c6-4647-983b-4bb4888a2edf'),
|
||||
(31, 'The folderlist form field type provides a drop down list of folders from a specfied directory. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.\r\n\r\nBy default, the first item on ', 'Folderlist', '{\"properties0\":{\"name\":\"type\",\"example\":\"folderlist\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be folderlist.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfolder\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a folder\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"directory\",\"example\":\"images\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the filesystem path to the directory containing the folders to be listed.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default folder name.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a regular expression string which is used to filter the list of folders selected for inclusion in the drop-down list. If omitted, all folders in the directory are included. The filter argument expression is applied before the exclude argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties7\":{\"name\":\"exclude\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a regular expression string which is used to exclude folders from the list. The exclude argument expression is applied after the filter argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties8\":{\"name\":\"hide_none\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Do not use -\' item is omitted from the drop-down list.\"},\"properties9\":{\"name\":\"hide_default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Use default -\' item is omitted from the drop-down list.\"},\"properties10\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field. https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'Provides a drop down list of folders from a specified directory.', '', 1, 4, '', 2, 'd3ab2ae4-9370-4497-ae6d-dee2e0b74b7a'),
|
||||
(32, 'Note: When using the file input type you should always add the attribute enctype=\"multipart/form-data\" to your form tag. Otherwise, the uploaded files will not be attached correctly.\r\n\r\nNote 2: You can put a soft limit file size by adding a hidden field with name=\"MAX_FILE_SIZE\" and value the maximum allowed bytes which is handled by php, but you must also handle it in your code with or without it.', 'File', '{\"properties0\":{\"name\":\"type\",\"example\":\"file\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be file.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfilevalue\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Enter some text\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Choose an image from your computer with maximum 100KB\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value, but doesn\'t mean much for a file.\"},\"properties5\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the file box in characters.\"},\"properties6\":{\"name\":\"accept\",\"example\":\"image\\/*\",\"adjustable\":\"1\",\"description\":\"(optional) Tells the browser what MIME types your form will allow to be uploaded.\"},\"properties7\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties8\":{\"name\":\"labelclass\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) adds a CSS class for form field\'s label; for Joomla 2.5.4+\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute\"},\"properties10\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"},\"properties11\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) For Joomla form validating it to be filled in\"},\"properties12\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Whether to Joomla validate the field according to rules\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+ https:\\/\\/joomla.stackexchange.com\\/a\\/17682\\/2166\"}}', 'Provides an input field for files', '', 1, 9, '', 3, '6da71c1e-119c-4e0d-a309-f3e52ecfa1d1'),
|
||||
|
@ -1,6 +1,7 @@
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_joomla_component`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_joomla_module`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_joomla_plugin`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_joomla_power`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_power`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_admin_view`;
|
||||
DROP TABLE IF EXISTS `#__componentbuilder_custom_admin_view`;
|
||||
|
28
admin/sql/updates/mysql/5.0.0-beta2.sql
Normal file
28
admin/sql/updates/mysql/5.0.0-beta2.sql
Normal file
@ -0,0 +1,28 @@
|
||||
CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_power` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
|
||||
`description` TEXT NULL,
|
||||
`guid` VARCHAR(36) NOT NULL DEFAULT '',
|
||||
`settings` TEXT NOT NULL,
|
||||
`system_name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`params` text NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`created` DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
`modified` DATETIME DEFAULT NULL,
|
||||
`checked_out` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
`checked_out_time` DATETIME DEFAULT NULL,
|
||||
`version` INT(10) unsigned NOT NULL DEFAULT 1,
|
||||
`hits` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`access` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_system_name` (`system_name`),
|
||||
KEY `idx_guid` (`guid`),
|
||||
KEY `idx_access` (`access`),
|
||||
KEY `idx_checkout` (`checked_out`),
|
||||
KEY `idx_createdby` (`created_by`),
|
||||
KEY `idx_modifiedby` (`modified_by`),
|
||||
KEY `idx_state` (`published`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
|
400
admin/src/Controller/Joomla_powerController.php
Normal file
400
admin/src/Controller/Joomla_powerController.php
Normal file
@ -0,0 +1,400 @@
|
||||
<?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
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Form\FormFactoryInterface;
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\Input\Input;
|
||||
use Joomla\CMS\Versioning\VersionableControllerTrait;
|
||||
use Joomla\CMS\MVC\Controller\FormController;
|
||||
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Factory as JoomlaPowerFactory;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Joomla_power Form Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Joomla_powerController extends FormController
|
||||
{
|
||||
use VersionableControllerTrait;
|
||||
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_POWER';
|
||||
|
||||
/**
|
||||
* Current or most recently performed task.
|
||||
*
|
||||
* @var string
|
||||
* @since 12.2
|
||||
* @note Replaces _task.
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* The URL view list variable.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $view_list = 'joomla_powers';
|
||||
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get Item posted
|
||||
$item = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RESET_THIS_JOOMLA_POWER') . '</p>';
|
||||
$status = 'error';
|
||||
$success = false;
|
||||
|
||||
// load the ID
|
||||
$id = $item['id'] ?? null;
|
||||
$guid = $item['guid'] ?? null;
|
||||
|
||||
// check if there is any selections
|
||||
if ($id === null || $guid === null)
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_NOT_SAVED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_MUST_FIRST_SAVE_THE_JOOMLA_POWER_BEFORE_YOU_CAN_USE_THIS_FEATURE') . '</p>';
|
||||
}
|
||||
elseif($user->authorise('power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
if (JoomlaPowerFactory::_('Joomlapower')->reset([$guid]))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THE_JOOMLA_POWER_HAS_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THIS_JOOMLA_POWER_HAS_FAILED') . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_(
|
||||
'index.php?option=com_componentbuilder&view=joomla_power'
|
||||
. $this->getRedirectToItemAppend($id), $success
|
||||
);
|
||||
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can add a new record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowAdd($data = [])
|
||||
{
|
||||
// Get user object.
|
||||
$user = $this->app->getIdentity();
|
||||
// Access check.
|
||||
$access = $user->authorise('joomla_power.access', 'com_componentbuilder');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// In the absence of better information, revert to the component permissions.
|
||||
return $user->authorise('joomla_power.create', $this->option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function allowEdit($data = [], $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = $this->app->getIdentity();
|
||||
// get record id.
|
||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||
|
||||
|
||||
// Access check.
|
||||
$access = ($user->authorise('joomla_power.access', 'com_componentbuilder.joomla_power.' . (int) $recordId) && $user->authorise('joomla_power.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('joomla_power.edit', 'com_componentbuilder.joomla_power.' . (int) $recordId);
|
||||
if (!$permission)
|
||||
{
|
||||
if ($user->authorise('joomla_power.edit.own', 'com_componentbuilder.joomla_power.' . $recordId))
|
||||
{
|
||||
// Now test the owner is the user.
|
||||
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
|
||||
if (empty($ownerId))
|
||||
{
|
||||
// Need to do a lookup from the model.
|
||||
$record = $this->getModel()->getItem($recordId);
|
||||
|
||||
if (empty($record))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$ownerId = $record->created_by;
|
||||
}
|
||||
|
||||
// If the owner matches 'me' then allow.
|
||||
if ($ownerId == $user->id)
|
||||
{
|
||||
if ($user->authorise('joomla_power.edit.own', 'com_componentbuilder'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Since there is no permission, revert to the component permissions.
|
||||
return $user->authorise('joomla_power.edit', $this->option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL arguments to append to an item redirect.
|
||||
*
|
||||
* @param integer $recordId The primary key id for the item.
|
||||
* @param string $urlVar The name of the URL variable for the id.
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string) $ref . '&refid='. (int) $refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append = '&ref='. (string) $ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to run batch operations.
|
||||
*
|
||||
* @param object $model The model.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function batch($model = null)
|
||||
{
|
||||
Session::checkToken() or jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// Set the model
|
||||
$model = $this->getModel('Joomla_power', '', []);
|
||||
|
||||
// Preset the redirect
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=joomla_powers' . $this->getRedirectToListAppend(), false));
|
||||
|
||||
return parent::batch($model);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to cancel an edit.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
*
|
||||
* @return boolean True if access level checks pass, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if (!is_null($return) && Uri::isInternal(base64_decode($return)))
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save a record.
|
||||
*
|
||||
* @param string $key The name of the primary key of the URL variable.
|
||||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
|
||||
*
|
||||
* @return boolean True if successful, false otherwise.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && Uri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string) $this->ref . '&layout=edit&id=' . (int) $this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string) $this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
Route::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that allows child controller access to model data
|
||||
* after the data has been saved.
|
||||
*
|
||||
* @param BaseDatabaseModel &$model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 11.1
|
||||
*/
|
||||
protected function postSaveHook(BaseDatabaseModel $model, $validData = [])
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
154
admin/src/Controller/Joomla_powersController.php
Normal file
154
admin/src/Controller/Joomla_powersController.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?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
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Controller;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\JoomlaPower\Factory as JoomlaPowerFactory;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Joomla_powers Admin Controller
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Joomla_powersController extends AdminController
|
||||
{
|
||||
/**
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_POWERS';
|
||||
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Joomla_power', $prefix = 'Administrator', $config = ['ignore_request' => true])
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set default error message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_PERMISSION_DENIED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INITIALIZE_JOOMLA_POWERS') . '</p>';
|
||||
$status = 'error';
|
||||
$success = false;
|
||||
|
||||
if($user->authorise('power.init', 'com_componentbuilder'))
|
||||
{
|
||||
if (JoomlaPowerFactory::_('Joomlapower')->init())
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_SUCCESSFULLY_INITIALIZED_ALL_REMOTE_JOOMLA_POWERS') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_LOCAL_DATABASE_JOOMLA_POWERS_HAS_SUCCESSFULLY_BEEN_SYNCED_WITH_THE_REMOTE_REPOSITORIES') . '</p>';
|
||||
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_INITIALIZATION_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_INITIALIZATION_OF_THIS_JOOMLA_POWERS_HAS_FAILED') . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', $success);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// get IDS of the selected powers
|
||||
$pks = $this->input->post->get('cid', [], 'array');
|
||||
|
||||
// Sanitize the input
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// check if there is any selections
|
||||
if ($pks === [])
|
||||
{
|
||||
// set error message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_NO_SELECTION_DETECTED').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_PLEASE_FIRST_MAKE_A_SELECTION_FROM_THE_LIST').'</p>';
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
$status = 'error';
|
||||
$success = false;
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
if($user->authorise('power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
$guids = GetHelper::vars('joomla_power', $pks, 'id', 'guid');
|
||||
|
||||
if (JoomlaPowerFactory::_('Joomlapower')->reset($guids))
|
||||
{
|
||||
// set success message
|
||||
$message = '<h1>'.Text::_('COM_COMPONENTBUILDER_SUCCESS').'</h1>';
|
||||
$message .= '<p>'.Text::_('COM_COMPONENTBUILDER_THESE_JOOMLA_POWERS_HAVE_SUCCESSFULLY_BEEN_RESET').'</p>';
|
||||
$status = 'success';
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<h1>' . Text::_('COM_COMPONENTBUILDER_RESET_FAILED') . '</h1>';
|
||||
$message .= '<p>' . Text::_('COM_COMPONENTBUILDER_THE_RESET_OF_THESE_JOOMLA_POWERS_HAS_FAILED') . '</p>';
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', $success);
|
||||
$this->setRedirect($redirect_url, $message, $status);
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
// set redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_powers', false);
|
||||
$this->setRedirect($redirect_url);
|
||||
return $success;
|
||||
}
|
||||
}
|
@ -23,7 +23,60 @@ if (file_exists($composer_autoloader))
|
||||
\spl_autoload_register(function ($class) {
|
||||
// project-specific base directories and namespace prefix
|
||||
$search = [
|
||||
'libraries/vendor_jcb/VDM.Joomla.Openai' => 'VDM\\Joomla\\Openai',
|
||||
'libraries/vendor_jcb/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
|
||||
'libraries/vendor_jcb/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
|
||||
'libraries/vendor_jcb/VDM.Joomla' => 'VDM\\Joomla',
|
||||
'libraries/vendor_jcb/VDM.Minify' => 'VDM\\Minify',
|
||||
'libraries/vendor_jcb/VDM.Psr' => 'VDM\\Psr'
|
||||
];
|
||||
// Start the search and load if found
|
||||
$found = false;
|
||||
$found_base_dir = "";
|
||||
$found_len = 0;
|
||||
foreach ($search as $base_dir => $prefix)
|
||||
{
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) === 0)
|
||||
{
|
||||
// we have a match so load the values
|
||||
$found = true;
|
||||
$found_base_dir = $base_dir;
|
||||
$found_len = $len;
|
||||
// done here
|
||||
break;
|
||||
}
|
||||
}
|
||||
// check if we found a match
|
||||
if (!$found)
|
||||
{
|
||||
// not found so move to the next registered autoloader
|
||||
return;
|
||||
}
|
||||
// get the relative class name
|
||||
$relative_class = substr($class, $found_len);
|
||||
// replace the namespace prefix with the base directory, replace namespace
|
||||
// separators with directory separators in the relative class name, append
|
||||
// with .php
|
||||
$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
|
||||
// if the file exists, require it
|
||||
if (file_exists($file))
|
||||
{
|
||||
require $file;
|
||||
}
|
||||
});
|
||||
|
||||
// add the autoloader for the composer classes
|
||||
$composer_autoloader = JPATH_LIBRARIES . '/phpseclib3/vendor/autoload.php';
|
||||
if (file_exists($composer_autoloader))
|
||||
{
|
||||
require_once $composer_autoloader;
|
||||
}
|
||||
|
||||
// register additional namespace
|
||||
\spl_autoload_register(function ($class) {
|
||||
// project-specific base directories and namespace prefix
|
||||
$search = [
|
||||
'libraries/vendor_jcb/VDM.Joomla.Gitea' => 'VDM\\Joomla\\Gitea',
|
||||
'libraries/vendor_jcb/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
|
||||
'libraries/vendor_jcb/VDM.Joomla' => 'VDM\\Joomla',
|
||||
@ -6142,6 +6195,10 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
\JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_PLUGINS'), 'index.php?option=com_componentbuilder&view=joomla_plugins', $submenu === 'joomla_plugins');
|
||||
}
|
||||
if ($user->authorise('joomla_power.access', 'com_componentbuilder') && $user->authorise('joomla_power.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
\JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_POWERS'), 'index.php?option=com_componentbuilder&view=joomla_powers', $submenu === 'joomla_powers');
|
||||
}
|
||||
if ($user->authorise('power.access', 'com_componentbuilder') && $user->authorise('power.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
\JHtmlSidebar::addEntry(Text::_('COM_COMPONENTBUILDER_SUBMENU_POWERS'), 'index.php?option=com_componentbuilder&view=powers', $submenu === 'powers');
|
||||
|
@ -351,34 +351,47 @@ class AjaxModel extends ListModel
|
||||
// do we have tags returned
|
||||
if (isset($tags[0]) && isset($tags[0]->name))
|
||||
{
|
||||
// get the version
|
||||
// get the local version
|
||||
$manifest = ComponentbuilderHelper::manifest();
|
||||
$local_version = (string) $manifest->version;
|
||||
$current_version = trim($tags[0]->name, 'vV');
|
||||
$latest_version = '1.0.0';
|
||||
$download_link = "https://git.vdm.dev/api/v1/joomla/Component-Builder";
|
||||
|
||||
// Filter tags by major version matching the local version's major number
|
||||
$major_version = explode('.', $local_version)[0];
|
||||
$filtered_tags = array_filter($tags, function($tag) use ($major_version) {
|
||||
return strpos($tag->name, "v$major_version") === 0;
|
||||
});
|
||||
|
||||
if (!empty($filtered_tags))
|
||||
{
|
||||
// Sort versions to find the latest one
|
||||
usort($filtered_tags, function($a, $b) {
|
||||
return \version_compare($b->name, $a->name);
|
||||
});
|
||||
|
||||
$latest_version = trim($filtered_tags[0]->name, 'vV');
|
||||
|
||||
// download link of the latest version
|
||||
$download_link = $filtered_tags[0]->zipball_url;
|
||||
}
|
||||
|
||||
// now check if this version is out dated
|
||||
if ($current_version === $local_version)
|
||||
if (\version_compare($local_version, $latest_version) === 0)
|
||||
{
|
||||
return ['notice' => '<small><span style="color:green;"><span class="icon-shield"></span> ' . Text::_('COM_COMPONENTBUILDER_UP_TO_DATE') . '</span></small>'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if this is beta version
|
||||
$current_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $current_version));
|
||||
$local_array = array_map(function ($v) { return (int) $v; }, (array) explode('.', $local_version));
|
||||
if (($local_array[0] > $current_array[0]) ||
|
||||
($local_array[0] == $current_array[0] && $local_array[1] > $current_array[1]) ||
|
||||
($local_array[0] == $current_array[0] && $local_array[1] == $current_array[1] && $local_array[2] > $current_array[2]))
|
||||
if (\version_compare($local_version, $latest_version) > 0)
|
||||
{
|
||||
return ['notice' => '<small><span style="color:#F7B033;"><span class="icon-wrench"></span> ' . Text::_('COM_COMPONENTBUILDER_PRE_RELEASE') . '</span></small>'];
|
||||
}
|
||||
else
|
||||
{
|
||||
// download link of the latest version
|
||||
$download = "https://git.vdm.dev/api/v1/repos/joomla/Component-Builder/archive/" . $tags[0]->name . ".zip";
|
||||
|
||||
return ['notice' => '<small><span style="color:red;"><span class="icon-warning-circle"></span> ' . Text::_('COM_COMPONENTBUILDER_OUT_OF_DATE') . '!</span> <a style="color:green;" href="' .
|
||||
$download . '" title="' . Text::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '">' . Text::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>'];
|
||||
$download_link . '" title="' . Text::_('COM_COMPONENTBUILDER_YOU_CAN_DIRECTLY_DOWNLOAD_THE_LATEST_UPDATE_OR_USE_THE_JOOMLA_UPDATE_AREA') . '">' . Text::_('COM_COMPONENTBUILDER_DOWNLOAD_UPDATE') . '!</a></small>'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,10 @@ class ComponentbuilderModel extends ListModel
|
||||
'joomla_plugin.access' => 'joomla_plugin.access',
|
||||
'joomla_plugins.submenu' => 'joomla_plugin.submenu',
|
||||
'joomla_plugins.dashboard_list' => 'joomla_plugin.dashboard_list',
|
||||
'joomla_power.create' => 'joomla_power.create',
|
||||
'joomla_powers.access' => 'joomla_power.access',
|
||||
'joomla_power.access' => 'joomla_power.access',
|
||||
'joomla_powers.submenu' => 'joomla_power.submenu',
|
||||
'power.create' => 'power.create',
|
||||
'powers.access' => 'power.access',
|
||||
'power.access' => 'power.access',
|
||||
|
@ -1461,9 +1461,11 @@ class Joomla_componentModel extends AdminModel
|
||||
{
|
||||
$data['system_name'] = $data['name'];
|
||||
}
|
||||
|
||||
// make sure that the component code name is safe.
|
||||
$data['name_code'] = ComponentCodeNameHelper::safe($data['name_code']);
|
||||
if (isset($data['name_code']) && is_string($data['name_code']))
|
||||
{
|
||||
$data['name_code'] = ComponentCodeNameHelper::safe($data['name_code']);
|
||||
}
|
||||
|
||||
// Set the GUID if empty or not valid
|
||||
if (empty($data['guid']) && $data['id'] > 0)
|
||||
|
979
admin/src/Model/Joomla_powerModel.php
Normal file
979
admin/src/Model/Joomla_powerModel.php
Normal file
@ -0,0 +1,979 @@
|
||||
<?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
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Model;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Application\CMSApplicationInterface;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\Filter\InputFilter;
|
||||
use Joomla\CMS\Filter\OutputFilter;
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\CMS\UCM\UCMType;
|
||||
use Joomla\CMS\Versioning\VersionableModelTrait;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\Input\Input;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\CMS\Helper\TagsHelper;
|
||||
use VDM\Joomla\Utilities\GuidHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder Joomla_power Admin Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Joomla_powerModel extends AdminModel
|
||||
{
|
||||
use VersionableModelTrait;
|
||||
|
||||
/**
|
||||
* The tab layout fields array.
|
||||
*
|
||||
* @var array
|
||||
* @since 3.0.0
|
||||
*/
|
||||
protected $tabLayoutFields = array(
|
||||
'joomla_power' => array(
|
||||
'fullwidth' => array(
|
||||
'description',
|
||||
'settings'
|
||||
),
|
||||
'above' => array(
|
||||
'system_name'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'administrator/components/com_componentbuilder/assets/css/admin.css',
|
||||
'administrator/components/com_componentbuilder/assets/css/joomla_power.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'administrator/components/com_componentbuilder/assets/js/admin.js',
|
||||
'media/com_componentbuilder/js/joomla_power.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string The prefix to use with controller messages.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER';
|
||||
|
||||
/**
|
||||
* The type alias for this content type.
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2
|
||||
*/
|
||||
public $typeAlias = 'com_componentbuilder.joomla_power';
|
||||
|
||||
/**
|
||||
* Returns a Table object, always creating it
|
||||
*
|
||||
* @param type $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return Table A database object
|
||||
* @since 3.0
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getTable($type = 'joomla_power', $prefix = 'Administrator', $config = [])
|
||||
{
|
||||
// get instance of the table
|
||||
return parent::getTable($type, $prefix, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a single record.
|
||||
*
|
||||
* @param integer $pk The id of the primary key.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
if ($item = parent::getItem($pk))
|
||||
{
|
||||
if (!empty($item->params) && !is_array($item->params))
|
||||
{
|
||||
// Convert the params field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->params);
|
||||
$item->params = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->metadata))
|
||||
{
|
||||
// Convert the metadata field to an array.
|
||||
$registry = new Registry;
|
||||
$registry->loadString($item->metadata);
|
||||
$item->metadata = $registry->toArray();
|
||||
}
|
||||
|
||||
if (!empty($item->settings))
|
||||
{
|
||||
// Convert the settings field to an array.
|
||||
$settings = new Registry;
|
||||
$settings->loadString($item->settings);
|
||||
$item->settings = $settings->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return Form|boolean A Form object on success, false on failure
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = [], $loadData = true, $options = ['control' => 'jform'])
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
// check if xpath was set in options
|
||||
$xpath = false;
|
||||
if (isset($options['xpath']))
|
||||
{
|
||||
$xpath = $options['xpath'];
|
||||
unset($options['xpath']);
|
||||
}
|
||||
// check if clear form was set in options
|
||||
$clear = false;
|
||||
if (isset($options['clear']))
|
||||
{
|
||||
$clear = $options['clear'];
|
||||
unset($options['clear']);
|
||||
}
|
||||
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_componentbuilder.joomla_power', 'joomla_power', $options, $clear, $xpath);
|
||||
|
||||
if (empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$jinput = Factory::getApplication()->input;
|
||||
|
||||
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
|
||||
if ($jinput->get('a_id'))
|
||||
{
|
||||
$id = $jinput->get('a_id', 0, 'INT');
|
||||
}
|
||||
// The back end uses id so we use that the rest of the time and set it to 0 by default.
|
||||
else
|
||||
{
|
||||
$id = $jinput->get('id', 0, 'INT');
|
||||
}
|
||||
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
|
||||
// Check for existing item.
|
||||
// Modify the form based on Edit State access controls.
|
||||
if ($id != 0 && (!$user->authorise('joomla_power.edit.state', 'com_componentbuilder.joomla_power.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('joomla_power.edit.state', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('ordering', 'disabled', 'true');
|
||||
$form->setFieldAttribute('published', 'disabled', 'true');
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('ordering', 'filter', 'unset');
|
||||
$form->setFieldAttribute('published', 'filter', 'unset');
|
||||
}
|
||||
// If this is a new item insure the greated by is set.
|
||||
if (0 == $id)
|
||||
{
|
||||
// Set the created_by to this user
|
||||
$form->setValue('created_by', null, $user->id);
|
||||
}
|
||||
// Modify the form based on Edit Creaded By access controls.
|
||||
if ($id != 0 && (!$user->authorise('joomla_power.edit.created_by', 'com_componentbuilder.joomla_power.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('joomla_power.edit.created_by', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('created_by', 'disabled', 'true');
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('created_by', 'readonly', 'true');
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('created_by', 'filter', 'unset');
|
||||
}
|
||||
// Modify the form based on Edit Creaded Date access controls.
|
||||
if ($id != 0 && (!$user->authorise('joomla_power.edit.created', 'com_componentbuilder.joomla_power.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('joomla_power.edit.created', 'com_componentbuilder')))
|
||||
{
|
||||
// Disable fields for display.
|
||||
$form->setFieldAttribute('created', 'disabled', 'true');
|
||||
// Disable fields while saving.
|
||||
$form->setFieldAttribute('created', 'filter', 'unset');
|
||||
}
|
||||
// Only load these values if no id is found
|
||||
if (0 == $id)
|
||||
{
|
||||
// Set redirected view name
|
||||
$redirectedView = $jinput->get('ref', null, 'STRING');
|
||||
// Set field name (or fall back to view name)
|
||||
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
|
||||
// Set redirected view id
|
||||
$redirectedId = $jinput->get('refid', 0, 'INT');
|
||||
// Set field id (or fall back to redirected view id)
|
||||
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
|
||||
if (0 != $redirectedValue && $redirectedField)
|
||||
{
|
||||
// Now set the local-redirected field default value
|
||||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Only load the GUID if new item (or empty)
|
||||
if (0 == $id || !($val = $form->getValue('guid')))
|
||||
{
|
||||
$form->setValue('guid', null, GuidHelper::get());
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can be deleted.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canDelete($record)
|
||||
{
|
||||
if (empty($record->id) || ($record->published != -2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// The record has been set. Check the record permissions.
|
||||
return $this->getCurrentUser()->authorise('joomla_power.delete', 'com_componentbuilder.joomla_power.' . (int) $record->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to test whether a record can have its state edited.
|
||||
*
|
||||
* @param object $record A record object.
|
||||
*
|
||||
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = $this->getCurrentUser();
|
||||
$recordId = $record->id ?? 0;
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('joomla_power.edit.state', 'com_componentbuilder.joomla_power.' . (int) $recordId);
|
||||
if (!$permission && !is_null($permission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// In the absence of better information, revert to the component permissions.
|
||||
return $user->authorise('joomla_power.edit.state', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method override to check if you can edit an existing record.
|
||||
*
|
||||
* @param array $data An array of input data.
|
||||
* @param string $key The name of the key for the primary key.
|
||||
*
|
||||
* @return boolean
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function allowEdit($data = [], $key = 'id')
|
||||
{
|
||||
// Check specific edit permission then general edit permission.
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
|
||||
return $user->authorise('joomla_power.edit', 'com_componentbuilder.joomla_power.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_power.edit', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param Table $table A Table object.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = Factory::getDate();
|
||||
$user = $this->getCurrentUser();
|
||||
|
||||
if (isset($table->name))
|
||||
{
|
||||
$table->name = \htmlspecialchars_decode($table->name, ENT_QUOTES);
|
||||
}
|
||||
|
||||
if (isset($table->alias) && empty($table->alias))
|
||||
{
|
||||
$table->generateAlias();
|
||||
}
|
||||
|
||||
if (empty($table->id))
|
||||
{
|
||||
$table->created = $date->toSql();
|
||||
// set the user
|
||||
if ($table->created_by == 0 || empty($table->created_by))
|
||||
{
|
||||
$table->created_by = $user->id;
|
||||
}
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering))
|
||||
{
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__componentbuilder_joomla_power'));
|
||||
$db->setQuery($query);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->modified = $date->toSql();
|
||||
$table->modified_by = $user->id;
|
||||
}
|
||||
|
||||
if (!empty($table->id))
|
||||
{
|
||||
// Increment the items version number.
|
||||
$table->version++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = Factory::getApplication()->getUserState('com_componentbuilder.edit.joomla_power.data', []);
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
// run the perprocess of the data
|
||||
$this->preprocessData('com_componentbuilder.joomla_power', $data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the unique fields of this table.
|
||||
*
|
||||
* @return mixed An array of field names, boolean false if none is set.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function getUniqueFields()
|
||||
{
|
||||
return array('guid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to delete one or more records.
|
||||
*
|
||||
* @param array &$pks An array of record primary keys.
|
||||
*
|
||||
* @return boolean True if successful, false if an error occurs
|
||||
* @since 12.2
|
||||
*/
|
||||
public function delete(&$pks)
|
||||
{
|
||||
if (!parent::delete($pks))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the published state of one or more records.
|
||||
*
|
||||
* @param array &$pks A list of the primary keys to change.
|
||||
* @param integer $value The value of the published state.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
* @since 12.2
|
||||
*/
|
||||
public function publish(&$pks, $value = 1)
|
||||
{
|
||||
if (!parent::publish($pks, $value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to perform batch operations on an item or a set of items.
|
||||
*
|
||||
* @param array $commands An array of commands to perform.
|
||||
* @param array $pks An array of item ids.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean Returns true on success, false on failure.
|
||||
* @since 12.2
|
||||
*/
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
// Sanitize ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true))
|
||||
{
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks))
|
||||
{
|
||||
$this->setError(Text::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user ??= $this->getCurrentUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new UCMType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_power');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new UCMType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands, $pks, $contexts);
|
||||
|
||||
if (is_array($result))
|
||||
{
|
||||
foreach ($result as $old => $new)
|
||||
{
|
||||
$contexts[$new] = $contexts[$old];
|
||||
}
|
||||
$pks = array_values($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done)
|
||||
{
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch copy items to a new category or current.
|
||||
*
|
||||
* @param integer $values The new values.
|
||||
* @param array $pks An array of row IDs.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return mixed An array of new IDs on success, boolean false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function batchCopy($values, $pks, $contexts)
|
||||
{
|
||||
if (empty($this->batchSet))
|
||||
{
|
||||
// Set some needed variables.
|
||||
$this->user = Factory::getApplication()->getIdentity();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_power');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('joomla_power.create') && !$this->canDo->get('joomla_power.batch'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get list of unique fields
|
||||
$uniqueFields = $this->getUniqueFields();
|
||||
// remove move_copy from array
|
||||
unset($values['move_copy']);
|
||||
|
||||
// make sure published is set
|
||||
if (!isset($values['published']))
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
elseif (isset($values['published']) && !$this->canDo->get('joomla_power.edit.state'))
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
|
||||
$newIds = [];
|
||||
// Parent exists so let's proceed
|
||||
while (!empty($pks))
|
||||
{
|
||||
// Pop the first ID off the stack
|
||||
$pk = array_shift($pks);
|
||||
|
||||
$this->table->reset();
|
||||
|
||||
// only allow copy if user may edit this item.
|
||||
if (!$this->user->authorise('joomla_power.edit', $contexts[$pk]))
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check that the row actually exists
|
||||
if (!$this->table->load($pk))
|
||||
{
|
||||
if ($error = $this->table->getError())
|
||||
{
|
||||
// Fatal error
|
||||
$this->setError($error);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Only for strings
|
||||
if (UtilitiesStringHelper::check($this->table->system_name) && !is_numeric($this->table->system_name))
|
||||
{
|
||||
$this->table->system_name = $this->generateUnique('system_name',$this->table->system_name);
|
||||
}
|
||||
|
||||
// insert all set values
|
||||
if (UtilitiesArrayHelper::check($values))
|
||||
{
|
||||
foreach ($values as $key => $value)
|
||||
{
|
||||
if (strlen($value) > 0 && isset($this->table->$key))
|
||||
{
|
||||
$this->table->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update all unique fields
|
||||
if (UtilitiesArrayHelper::check($uniqueFields))
|
||||
{
|
||||
foreach ($uniqueFields as $uniqueField)
|
||||
{
|
||||
$this->table->$uniqueField = $this->generateUnique($uniqueField,$this->table->$uniqueField);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the ID because we are making a copy
|
||||
$this->table->id = 0;
|
||||
|
||||
// TODO: Deal with ordering?
|
||||
// $this->table->ordering = 1;
|
||||
|
||||
// Check the row.
|
||||
if (!$this->table->check())
|
||||
{
|
||||
$this->setError($this->table->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->type))
|
||||
{
|
||||
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$this->table->store())
|
||||
{
|
||||
$this->setError($this->table->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the new item ID
|
||||
$newId = $this->table->get('id');
|
||||
|
||||
// Add the new ID to the array
|
||||
$newIds[$pk] = $newId;
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return $newIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch move items to a new category
|
||||
*
|
||||
* @param integer $value The new category ID.
|
||||
* @param array $pks An array of row IDs.
|
||||
* @param array $contexts An array of item contexts.
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function batchMove($values, $pks, $contexts)
|
||||
{
|
||||
if (empty($this->batchSet))
|
||||
{
|
||||
// Set some needed variables.
|
||||
$this->user = Factory::getApplication()->getIdentity();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_power');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('joomla_power.edit') && !$this->canDo->get('joomla_power.batch'))
|
||||
{
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// make sure published only updates if user has the permission.
|
||||
if (isset($values['published']) && !$this->canDo->get('joomla_power.edit.state'))
|
||||
{
|
||||
unset($values['published']);
|
||||
}
|
||||
// remove move_copy from array
|
||||
unset($values['move_copy']);
|
||||
|
||||
// Parent exists so we proceed
|
||||
foreach ($pks as $pk)
|
||||
{
|
||||
if (!$this->user->authorise('joomla_power.edit', $contexts[$pk]))
|
||||
{
|
||||
$this->setError(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that the row actually exists
|
||||
if (!$this->table->load($pk))
|
||||
{
|
||||
if ($error = $this->table->getError())
|
||||
{
|
||||
// Fatal error
|
||||
$this->setError($error);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not fatal error
|
||||
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// insert all set values.
|
||||
if (UtilitiesArrayHelper::check($values))
|
||||
{
|
||||
foreach ($values as $key => $value)
|
||||
{
|
||||
// Do special action for access.
|
||||
if ('access' === $key && strlen($value) > 0)
|
||||
{
|
||||
$this->table->$key = $value;
|
||||
}
|
||||
elseif (strlen($value) > 0 && isset($this->table->$key))
|
||||
{
|
||||
$this->table->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check the row.
|
||||
if (!$this->table->check())
|
||||
{
|
||||
$this->setError($this->table->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->type))
|
||||
{
|
||||
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$this->table->store())
|
||||
{
|
||||
$this->setError($this->table->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to save the form data.
|
||||
*
|
||||
* @param array $data The form data.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$input = Factory::getApplication()->getInput();
|
||||
$filter = InputFilter::getInstance();
|
||||
|
||||
// set the metadata to the Item Data
|
||||
if (isset($data['metadata']) && isset($data['metadata']['author']))
|
||||
{
|
||||
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
|
||||
|
||||
$metadata = new Registry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
|
||||
// Set the GUID if empty or not valid
|
||||
if (empty($data['guid']) && $data['id'] > 0)
|
||||
{
|
||||
// get the existing one
|
||||
$data['guid'] = (string) GetHelper::var('joomla_power', $data['id'], 'id', 'guid');
|
||||
}
|
||||
|
||||
// Set the GUID if empty or not valid
|
||||
while (!GuidHelper::valid($data['guid'], "joomla_power", $data['id']))
|
||||
{
|
||||
// must always be set
|
||||
$data['guid'] = (string) GuidHelper::get();
|
||||
}
|
||||
|
||||
// Set the settings items to data.
|
||||
if (isset($data['settings']) && is_array($data['settings']))
|
||||
{
|
||||
$settings = new Registry;
|
||||
$settings->loadArray($data['settings']);
|
||||
$data['settings'] = (string) $settings;
|
||||
}
|
||||
elseif (!isset($data['settings']))
|
||||
{
|
||||
// Set the empty settings to data
|
||||
$data['settings'] = '';
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new Registry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
// Alter the unique field for save as copy
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other unique fields
|
||||
$uniqueFields = $this->getUniqueFields();
|
||||
if (UtilitiesArrayHelper::check($uniqueFields))
|
||||
{
|
||||
foreach ($uniqueFields as $uniqueField)
|
||||
{
|
||||
$data[$uniqueField] = $this->generateUnique($uniqueField,$data[$uniqueField]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a unique value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUnique($field, $value)
|
||||
{
|
||||
// set field value unique
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load([$field => $value]))
|
||||
{
|
||||
$value = StringHelper::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title
|
||||
*
|
||||
* @param string $title The title.
|
||||
*
|
||||
* @return array Contains the modified title and alias.
|
||||
*
|
||||
*/
|
||||
protected function _generateNewTitle($title)
|
||||
{
|
||||
|
||||
// Alter the title
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(['title' => $title]))
|
||||
{
|
||||
$title = StringHelper::increment($title);
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
407
admin/src/Model/Joomla_powersModel.php
Normal file
407
admin/src/Model/Joomla_powersModel.php
Normal file
@ -0,0 +1,407 @@
|
||||
<?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
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Model;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Application\CMSApplicationInterface;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\User\User;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\Input\Input;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use Joomla\CMS\Helper\TagsHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Joomla_powers List Model
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Joomla_powersModel extends ListModel
|
||||
{
|
||||
/**
|
||||
* The application object.
|
||||
*
|
||||
* @var CMSApplicationInterface The application instance.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected CMSApplicationInterface $app;
|
||||
|
||||
/**
|
||||
* The styles array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $styles = [
|
||||
'administrator/components/com_componentbuilder/assets/css/admin.css',
|
||||
'administrator/components/com_componentbuilder/assets/css/joomla_powers.css'
|
||||
];
|
||||
|
||||
/**
|
||||
* The scripts array.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.3
|
||||
*/
|
||||
protected array $scripts = [
|
||||
'administrator/components/com_componentbuilder/assets/js/admin.js'
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
|
||||
* @param ?MVCFactoryInterface $factory The factory.
|
||||
*
|
||||
* @since 1.6
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($config = [], MVCFactoryInterface $factory = null)
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'a.id','id',
|
||||
'a.published','published',
|
||||
'a.access','access',
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'a.system_name','system_name'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config, $factory);
|
||||
|
||||
$this->app ??= Factory::getApplication();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
* @since 1.7.0
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = $this->app;
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
|
||||
// Check if the form was submitted
|
||||
$formSubmited = $app->input->post->get('form_submited');
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$access = $app->input->post->get('access');
|
||||
$this->setState('filter.access', $access);
|
||||
}
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||
$this->setState('filter.published', $published);
|
||||
|
||||
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
|
||||
$this->setState('filter.created_by', $created_by);
|
||||
|
||||
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
|
||||
$this->setState('filter.created', $created);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$system_name = $this->getUserStateFromRequest($this->context . '.filter.system_name', 'filter_system_name');
|
||||
if ($formSubmited)
|
||||
{
|
||||
$system_name = $app->input->post->get('system_name');
|
||||
$this->setState('filter.system_name', $system_name);
|
||||
}
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// Check in items
|
||||
$this->checkInNow();
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// Set values to display correctly.
|
||||
if (UtilitiesArrayHelper::check($items))
|
||||
{
|
||||
// Get the user object if not set.
|
||||
if (!isset($user) || !ObjectHelper::check($user))
|
||||
{
|
||||
$user = $this->getCurrentUser();
|
||||
}
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
// Remove items the user can't access.
|
||||
$access = ($user->authorise('joomla_power.access', 'com_componentbuilder.joomla_power.' . (int) $item->id) && $user->authorise('joomla_power.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// create the GUID placeholder key
|
||||
$item->joomla_power_key = 'Joomla_'.'_'.'_' . str_replace('-', '_', $item->guid) . '_'.'_'.'_Power';
|
||||
}
|
||||
}
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = $this->getCurrentUser();
|
||||
// Create a new query object.
|
||||
$db = $this->getDatabase();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
$query->select('a.*');
|
||||
|
||||
// From the componentbuilder_item table
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_power', 'a'));
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.published');
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.published = ' . (int) $published);
|
||||
}
|
||||
elseif ($published === '')
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
$_access = $this->getState('filter.access');
|
||||
if ($_access && is_numeric($_access))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $_access);
|
||||
}
|
||||
elseif (UtilitiesArrayHelper::check($_access))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_access = ArrayHelper::toInteger($_access);
|
||||
// Filter by the Access Array.
|
||||
$query->where('a.access IN (' . implode(',', $_access) . ')');
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
{
|
||||
if (stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('a.id = ' . (int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search) . '%');
|
||||
$query->where('(a.system_name LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.description LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->getState('list.ordering', 'a.id');
|
||||
$orderDirn = $this->getState('list.direction', 'desc');
|
||||
if ($orderCol != '')
|
||||
{
|
||||
// Check that the order direction is valid encase we have a field called direction as part of filers.
|
||||
$orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc';
|
||||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.id');
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
// Check if the value is an array
|
||||
$_access = $this->getState('filter.access');
|
||||
if (UtilitiesArrayHelper::check($_access))
|
||||
{
|
||||
$id .= ':' . implode(':', $_access);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_access)
|
||||
|| StringHelper::check($_access))
|
||||
{
|
||||
$id .= ':' . $_access;
|
||||
}
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.system_name');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the styles that have to be included on the view
|
||||
*
|
||||
* @return array styles files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getStyles(): array
|
||||
{
|
||||
return $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the styles that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setStyles(string $path): void
|
||||
{
|
||||
$this->styles[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the view
|
||||
*
|
||||
* @return array script files
|
||||
* @since 4.3
|
||||
*/
|
||||
public function getScripts(): array
|
||||
{
|
||||
return $this->scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set the script that have to be included on the view
|
||||
*
|
||||
* @return void
|
||||
* @since 4.3
|
||||
*/
|
||||
public function setScript(string $path): void
|
||||
{
|
||||
$this->scripts[] = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query to checkin all items left checked out longer then a set time.
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function checkInNow(): bool
|
||||
{
|
||||
// Get set check in time
|
||||
$time = ComponentHelper::getParams('com_componentbuilder')->get('check_in');
|
||||
|
||||
if ($time)
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = $this->getDatabase();
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_power'));
|
||||
// Only select items that are checked out.
|
||||
$query->where($db->quoteName('checked_out') . '!=0');
|
||||
$db->setQuery($query, 0, 1);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// Get Yesterdays date.
|
||||
$date = Factory::getDate()->modify($time)->toSql();
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Fields to update.
|
||||
$fields = array(
|
||||
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
|
||||
$db->quoteName('checked_out') . '=0'
|
||||
);
|
||||
|
||||
// Conditions for which records should be updated.
|
||||
$conditions = array(
|
||||
$db->quoteName('checked_out') . '!=0',
|
||||
$db->quoteName('checked_out_time') . '<\''.$date.'\''
|
||||
);
|
||||
|
||||
// Check table.
|
||||
$query->update($db->quoteName('#__componentbuilder_joomla_power'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
377
admin/src/Table/Joomla_powerTable.php
Normal file
377
admin/src/Table/Joomla_powerTable.php
Normal file
@ -0,0 +1,377 @@
|
||||
<?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
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\Table;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\String\PunycodeHelper;
|
||||
use Joomla\CMS\Access\Access as AccessRules;
|
||||
use Joomla\CMS\Access\Rules;
|
||||
use Joomla\CMS\Tag\TaggableTableInterface;
|
||||
use Joomla\CMS\Tag\TaggableTableTrait;
|
||||
use Joomla\CMS\User\CurrentUserInterface;
|
||||
use Joomla\CMS\User\CurrentUserTrait;
|
||||
use Joomla\CMS\Versioning\VersionableTableInterface;
|
||||
use Joomla\CMS\Application\ApplicationHelper;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\Database\DatabaseDriver;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Joomla_powers Table class
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class Joomla_powerTable extends Table implements VersionableTableInterface, TaggableTableInterface, CurrentUserInterface
|
||||
{
|
||||
use TaggableTableTrait;
|
||||
use CurrentUserTrait;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DatabaseDriver $db Database connector object
|
||||
* @param ?DispatcherInterface $dispatcher Event dispatcher for this table
|
||||
*
|
||||
* @param object Database connector object
|
||||
* @since 4.0
|
||||
*/
|
||||
function __construct(DatabaseDriver $db, ?DispatcherInterface $dispatcher = null)
|
||||
{
|
||||
// The type alias generally is the internal component name with the
|
||||
// content type. Ex.: com_content.article
|
||||
$this->typeAlias = 'com_componentbuilder.joomla_power';
|
||||
|
||||
// Ensure the params and metadata in json encoded in the bind method
|
||||
$this->_jsonEncode = ['params', 'metadata'];
|
||||
|
||||
// Indicates that columns fully support the NULL value in the database
|
||||
// $this->_supportNullValue = true; // hmmm will keep an eye on this ;)
|
||||
|
||||
parent::__construct('#__componentbuilder_joomla_power', 'id', $db, $dispatcher);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to bind an associative array or object to the Table instance.This
|
||||
* method only binds properties that are publicly accessible and optionally
|
||||
* takes an array of properties to ignore when binding.
|
||||
*
|
||||
* @param array|object $src An associative array or object to bind to the Table instance.
|
||||
* @param array|string $ignore An optional array or space separated list of properties to ignore while binding.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @since 1.7.0
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new AccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Joomla_power table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
*
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = Factory::getDate()->toSql();
|
||||
$userId = $this->getCurrentUser()->id;
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date;
|
||||
$this->modified_by = $userId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// New joomla_power. A joomla_power created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date;
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $userId;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = new self($this->getDbo(), $this->getDispatcher());
|
||||
|
||||
if ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_ERROR_UNIQUE_ALIAS'));
|
||||
|
||||
if ($table->published === -2)
|
||||
{
|
||||
$this->setError(Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_ERROR_UNIQUE_ALIAS_TRASHED'));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = PunycodeHelper::urlToPunycode($this->url);
|
||||
}
|
||||
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = PunycodeHelper::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*
|
||||
* @see \Joomla\CMS\Table\Table::check
|
||||
* @since 1.5
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
try {
|
||||
parent::check();
|
||||
} catch (\Exception $e) {
|
||||
$this->setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = new self($this->getDbo(), $this->getDispatcher());
|
||||
|
||||
while ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = [];
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty AccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_componentbuilder.joomla_power.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return AccessRules The AccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = Factory::getContainer()->get(DatabaseInterface::class);
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return AccessRules::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof AccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = [];
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the AccessRules object for the asset rules.
|
||||
$rules = new AccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return AccessRules::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type alias for the history table
|
||||
*
|
||||
* The type alias generally is the internal component name with the
|
||||
* content type. Ex.: com_content.article
|
||||
*
|
||||
* @return string The alias as described above
|
||||
*
|
||||
* @since 3.10.0
|
||||
*/
|
||||
public function getTypeAlias()
|
||||
{
|
||||
return $this->typeAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form table_name.id
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.7.0
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
|
||||
return $this->getTypeAlias() . '.' . (int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the parent asset under which to register this one.
|
||||
*
|
||||
* By default, all assets are registered to the ROOT node with ID, which will default to 1 if none exists.
|
||||
* An extended class can define a table and ID to lookup. If the asset does not exist it will be created.
|
||||
*
|
||||
* @param Table $table A Table object for the asset parent.
|
||||
* @param integer $id Id to look up
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
* @since 1.7.0
|
||||
*/
|
||||
protected function _getAssetParentId(Table $table = null, $id = null)
|
||||
{
|
||||
/** @var Asset $assets */
|
||||
$assets = self::getInstance('Asset', 'JTable', ['dbo' => $this->getDbo()]);
|
||||
$rootId = $assets->getRootId();
|
||||
|
||||
// load the componentbuilder asset
|
||||
$assets->loadByName('com_componentbuilder');
|
||||
|
||||
return $assets->id ?? $rootId ?? 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* This view does not actually have an alias
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function generateAlias()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
236
admin/src/View/Joomla_power/HtmlView.php
Normal file
236
admin/src/View/Joomla_power/HtmlView.php
Normal file
@ -0,0 +1,236 @@
|
||||
<?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
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\View\Joomla_power;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Toolbar\Toolbar;
|
||||
use Joomla\CMS\Form\FormHelper;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Joomla_power Html View class
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* Joomla_power view display method
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// set params
|
||||
$this->params = ComponentHelper::getParams('com_componentbuilder');
|
||||
$this->useCoreUI = true;
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_power', $this->item);
|
||||
// get input
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that referred to this item
|
||||
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string) $this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string) $return;
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
Factory::getApplication()->input->set('hidemainmenu', true);
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
$userId = $user->id;
|
||||
$isNew = $this->item->id == 0;
|
||||
|
||||
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_POWER_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_POWER_EDIT'), 'pencil-2 article-add');
|
||||
// Built the actions for new and existing records.
|
||||
if (StringHelper::check($this->referral))
|
||||
{
|
||||
if ($this->canDo->get('joomla_power.create') && $isNew)
|
||||
{
|
||||
// We can create the record.
|
||||
ToolbarHelper::save('joomla_power.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
elseif ($this->canDo->get('joomla_power.edit'))
|
||||
{
|
||||
// We can save the record.
|
||||
ToolbarHelper::save('joomla_power.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($isNew)
|
||||
{
|
||||
// Do not creat but cancel.
|
||||
ToolbarHelper::cancel('joomla_power.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
else
|
||||
{
|
||||
// We can close it.
|
||||
ToolbarHelper::cancel('joomla_power.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($isNew)
|
||||
{
|
||||
// For new records, check the create permission.
|
||||
if ($this->canDo->get('joomla_power.create'))
|
||||
{
|
||||
ToolbarHelper::apply('joomla_power.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('joomla_power.save', 'JTOOLBAR_SAVE');
|
||||
ToolbarHelper::custom('joomla_power.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
};
|
||||
ToolbarHelper::cancel('joomla_power.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->canDo->get('joomla_power.edit'))
|
||||
{
|
||||
// We can save the new record
|
||||
ToolbarHelper::apply('joomla_power.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('joomla_power.save', 'JTOOLBAR_SAVE');
|
||||
// We can save this record, but check the create permission to see
|
||||
// if we can return to make a new one.
|
||||
if ($this->canDo->get('joomla_power.create'))
|
||||
{
|
||||
ToolbarHelper::custom('joomla_power.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
}
|
||||
}
|
||||
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('joomla_power.version'));
|
||||
if ($this->state->params->get('save_history', 1) && $this->canDo->get('joomla_power.edit') && $canVersion)
|
||||
{
|
||||
ToolbarHelper::versions('com_componentbuilder.joomla_power', $this->item->id);
|
||||
}
|
||||
if ($this->canDo->get('joomla_power.create'))
|
||||
{
|
||||
ToolbarHelper::custom('joomla_power.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
if ($this->canDo->get('joomla_power.reset'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('joomla_power.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
ToolbarHelper::cancel('joomla_power.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
ToolbarHelper::divider();
|
||||
ToolbarHelper::inlinehelp();
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_power');
|
||||
if (StringHelper::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = true, int $length = 30)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{
|
||||
// Load jQuery
|
||||
Html::_('jquery.framework');
|
||||
$isNew = ($this->item->id < 1);
|
||||
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_JOOMLA_POWER_NEW' : 'COM_COMPONENTBUILDER_JOOMLA_POWER_EDIT'));
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}
|
||||
}
|
||||
}
|
1
admin/src/View/Joomla_power/index.html
Normal file
1
admin/src/View/Joomla_power/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
227
admin/src/View/Joomla_powers/HtmlView.php
Normal file
227
admin/src/View/Joomla_powers/HtmlView.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?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
|
||||
*/
|
||||
namespace VDM\Component\Componentbuilder\Administrator\View\Joomla_powers;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Toolbar\Toolbar;
|
||||
use Joomla\CMS\Form\FormHelper;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
use Joomla\CMS\Document\Document;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Componentbuilder Html View class for the Joomla_powers
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* Joomla_powers view display method
|
||||
*
|
||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Assign data to the view
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
$this->styles = $this->get('Styles');
|
||||
$this->scripts = $this->get('Scripts');
|
||||
$this->user ??= Factory::getApplication()->getIdentity();
|
||||
// Load the filter form from xml.
|
||||
$this->filterForm = $this->get('FilterForm');
|
||||
// Load the active filters.
|
||||
$this->activeFilters = $this->get('ActiveFilters');
|
||||
// Add the list ordering clause.
|
||||
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
|
||||
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
|
||||
$this->saveOrder = $this->listOrder == 'a.ordering';
|
||||
// set the return here value
|
||||
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
|
||||
// get global action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('joomla_power');
|
||||
$this->canEdit = $this->canDo->get('joomla_power.edit');
|
||||
$this->canState = $this->canDo->get('joomla_power.edit.state');
|
||||
$this->canCreate = $this->canDo->get('joomla_power.create');
|
||||
$this->canDelete = $this->canDo->get('joomla_power.delete');
|
||||
$this->canBatch = ($this->canDo->get('joomla_power.batch') && $this->canDo->get('core.batch'));
|
||||
|
||||
// If we don't have items we load the empty state
|
||||
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
|
||||
{
|
||||
$this->setLayout('emptystate');
|
||||
}
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->addToolbar();
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new \Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Set the html view document stuff
|
||||
$this->_prepareDocument();
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_JOOMLA_POWERS'), 'joomla');
|
||||
|
||||
if ($this->canCreate)
|
||||
{
|
||||
ToolbarHelper::addNew('joomla_power.add');
|
||||
}
|
||||
|
||||
// Only load if there are items
|
||||
if (ArrayHelper::check($this->items))
|
||||
{
|
||||
if ($this->canEdit)
|
||||
{
|
||||
ToolbarHelper::editList('joomla_power.edit');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
ToolbarHelper::publishList('joomla_powers.publish');
|
||||
ToolbarHelper::unpublishList('joomla_powers.unpublish');
|
||||
ToolbarHelper::archiveList('joomla_powers.archive');
|
||||
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
ToolbarHelper::checkin('joomla_powers.checkin');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
ToolbarHelper::deleteList('', 'joomla_powers.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
ToolbarHelper::trash('joomla_powers.trash');
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('joomla_power.init', 'com_componentbuilder'))
|
||||
{
|
||||
// add Init button.
|
||||
ToolbarHelper::custom('joomla_powers.initPowers', 'health custom-button-initpowers', '', 'COM_COMPONENTBUILDER_INIT', false);
|
||||
}
|
||||
if ($this->user->authorise('joomla_power.reset', 'com_componentbuilder'))
|
||||
{
|
||||
// add Reset button.
|
||||
ToolbarHelper::custom('joomla_powers.resetPowers', 'joomla custom-button-resetpowers', '', 'COM_COMPONENTBUILDER_RESET', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('joomla_powers');
|
||||
if (StringHelper::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_componentbuilder');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare some document related stuff.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function _prepareDocument(): void
|
||||
{
|
||||
// Load jQuery
|
||||
Html::_('jquery.framework');
|
||||
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_JOOMLA_POWERS'));
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
* @param bool $shorten The switch to shorten.
|
||||
* @param int $length The shorting length.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function escape($var, bool $shorten = true, int $length = 50)
|
||||
{
|
||||
if (!is_string($var))
|
||||
{
|
||||
return $var;
|
||||
}
|
||||
|
||||
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array containing the field name to sort by as the key and display text as value
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
return array(
|
||||
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
|
||||
'a.published' => Text::_('JSTATUS'),
|
||||
'a.system_name' => Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_SYSTEM_NAME_LABEL'),
|
||||
'a.id' => Text::_('JGRID_HEADING_ID')
|
||||
);
|
||||
}
|
||||
}
|
1
admin/src/View/Joomla_powers/index.html
Normal file
1
admin/src/View/Joomla_powers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
105
admin/tmpl/joomla_power/default.php
Normal file
105
admin/tmpl/joomla_power/default.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->getDocument()->getWebAssetManager();
|
||||
$wa->useScript('keepalive')->useScript('form.validate');
|
||||
Html::_('bootstrap.tooltip');
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// waiting spinner
|
||||
var outerDiv = document.querySelector('body');
|
||||
var loadingDiv = document.createElement('div');
|
||||
loadingDiv.id = 'loading';
|
||||
loadingDiv.style.cssText = "background: rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat; top: " + (outerDiv.getBoundingClientRect().top + window.pageYOffset) + "px; left: " + (outerDiv.getBoundingClientRect().left + window.pageXOffset) + "px; width: " + outerDiv.offsetWidth + "px; height: " + outerDiv.offsetHeight + "px; position: fixed; opacity: 0.80; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); filter: alpha(opacity=80); display: none;";
|
||||
outerDiv.appendChild(loadingDiv);
|
||||
loadingDiv.style.display = 'block';
|
||||
// when page is ready remove and show
|
||||
window.addEventListener('load', function() {
|
||||
var componentLoader = document.getElementById('componentbuilder_loader');
|
||||
if (componentLoader) componentLoader.style.display = 'block';
|
||||
loadingDiv.style.display = 'none';
|
||||
});
|
||||
</script>
|
||||
<div id="componentbuilder_loader" style="display: none;">
|
||||
<form action="<?php echo Route::_('index.php?option=com_componentbuilder&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<?php echo LayoutHelper::render('joomla_power.joomla_power_above', $this); ?>
|
||||
<div class="main-card">
|
||||
|
||||
<?php echo Html::_('uitab.startTabSet', 'joomla_powerTab', ['active' => 'joomla_power', 'recall' => true]); ?>
|
||||
|
||||
<?php echo Html::_('uitab.addTab', 'joomla_powerTab', 'joomla_power', Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_JOOMLA_POWER', true)); ?>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php echo LayoutHelper::render('joomla_power.joomla_power_fullwidth', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo Html::_('uitab.endTab'); ?>
|
||||
|
||||
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
|
||||
<?php $this->tab_name = 'joomla_powerTab'; ?>
|
||||
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
|
||||
|
||||
<?php if ($this->canDo->get('joomla_power.edit.created_by') || $this->canDo->get('joomla_power.edit.created') || $this->canDo->get('joomla_power.edit.state') || ($this->canDo->get('joomla_power.delete') && $this->canDo->get('joomla_power.edit.state'))) : ?>
|
||||
<?php echo Html::_('uitab.addTab', 'joomla_powerTab', 'publishing', Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_PUBLISHING', true)); ?>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<?php echo LayoutHelper::render('joomla_power.publishing', $this); ?>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<?php echo LayoutHelper::render('joomla_power.publlshing', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo Html::_('uitab.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->canDo->get('core.admin')) : ?>
|
||||
<?php echo Html::_('uitab.addTab', 'joomla_powerTab', 'permissions', Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_PERMISSION', true)); ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<fieldset class="adminform">
|
||||
<div class="adminformlist">
|
||||
<?php foreach ($this->form->getFieldset('accesscontrol') as $field): ?>
|
||||
<div>
|
||||
<?php echo $field->label; echo $field->input;?>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo Html::_('uitab.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo Html::_('uitab.endTabSet'); ?>
|
||||
|
||||
<div>
|
||||
<input type="hidden" name="task" value="joomla_power.edit" />
|
||||
<?php echo Html::_('form.token'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
1
admin/tmpl/joomla_power/index.html
Normal file
1
admin/tmpl/joomla_power/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
51
admin/tmpl/joomla_powers/default.php
Normal file
51
admin/tmpl/joomla_powers/default.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_componentbuilder&task=joomla_powers.saveOrderAjax&tmpl=component';
|
||||
Html::_('sortablelist.sortable', 'joomla_powerList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo Route::_('index.php?option=com_componentbuilder&view=joomla_powers'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<div id="j-main-container">
|
||||
<?php
|
||||
// Add the trash helper layout
|
||||
echo LayoutHelper::render('trashhelper', $this);
|
||||
// Add the searchtools
|
||||
echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this));
|
||||
?>
|
||||
<?php if (empty($this->items)): ?>
|
||||
<div class="alert alert-no-items">
|
||||
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<table class="table table-striped" id="joomla_powerList">
|
||||
<thead><?php echo $this->loadTemplate('head');?></thead>
|
||||
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
|
||||
<tbody><?php echo $this->loadTemplate('body');?></tbody>
|
||||
</table>
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo Html::_('form.token'); ?>
|
||||
</form>
|
99
admin/tmpl/joomla_powers/default_body.php
Normal file
99
admin/tmpl/joomla_powers/default_body.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$edit = "index.php?option=com_componentbuilder&view=joomla_powers&task=joomla_power.edit";
|
||||
|
||||
?>
|
||||
<?php foreach ($this->items as $i => $item): ?>
|
||||
<?php
|
||||
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
|
||||
$userChkOut = Factory::getContainer()->
|
||||
get(\Joomla\CMS\User\UserFactoryInterface::class)->
|
||||
loadUserById($item->checked_out);
|
||||
$canDo = ComponentbuilderHelper::getActions('joomla_power',$item,'joomla_powers');
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="order nowrap center hidden-phone">
|
||||
<?php if ($canDo->get('joomla_power.edit.state')): ?>
|
||||
<?php
|
||||
$iconClass = '';
|
||||
if (!$this->saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
<span class="sortable-handler<?php echo $iconClass; ?>">
|
||||
<i class="icon-menu"></i>
|
||||
</span>
|
||||
<?php if ($this->saveOrder) : ?>
|
||||
<input type="text" style="display:none" name="order[]" size="5"
|
||||
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
⋮
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="nowrap center">
|
||||
<?php if ($canDo->get('joomla_power.edit')): ?>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php if ($canCheckin) : ?>
|
||||
<?php echo Html::_('grid.id', $i, $item->id); ?>
|
||||
<?php else: ?>
|
||||
□
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo Html::_('grid.id', $i, $item->id); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
□
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="nowrap">
|
||||
<div>
|
||||
<?php if ($canDo->get('joomla_power.edit')): ?>
|
||||
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->system_name); ?></a>
|
||||
<?php if ($item->checked_out): ?>
|
||||
<?php echo Html::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'joomla_powers.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo $this->escape($item->system_name); ?>
|
||||
<?php endif; ?><br /><small>GUID:
|
||||
<?php echo $this->escape($item->guid); ?><?php if(isset($item->joomla_power_key)): ?><br />JPK: <?php echo $item->joomla_power_key; ?><?php endif; ?></small>
|
||||
</div>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php if ($canDo->get('joomla_power.edit.state')) : ?>
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php if ($canCheckin) : ?>
|
||||
<?php echo Html::_('jgrid.published', $item->published, $i, 'joomla_powers.', true, 'cb'); ?>
|
||||
<?php else: ?>
|
||||
<?php echo Html::_('jgrid.published', $item->published, $i, 'joomla_powers.', false, 'cb'); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo Html::_('jgrid.published', $item->published, $i, 'joomla_powers.', true, 'cb'); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo Html::_('jgrid.published', $item->published, $i, 'joomla_powers.', false, 'cb'); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="nowrap center hidden-phone">
|
||||
<?php echo $item->id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
18
admin/tmpl/joomla_powers/default_foot.php
Normal file
18
admin/tmpl/joomla_powers/default_foot.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?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;
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="5"><?php echo $this->pagination->getListFooter(); ?></td>
|
||||
</tr>
|
50
admin/tmpl/joomla_powers/default_head.php
Normal file
50
admin/tmpl/joomla_powers/default_head.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<?php if ($this->canEdit&& $this->canState): ?>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo Html::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
|
||||
</th>
|
||||
<th width="20" class="nowrap center">
|
||||
<?php echo Html::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th width="20" class="nowrap center hidden-phone">
|
||||
▾
|
||||
</th>
|
||||
<th width="20" class="nowrap center">
|
||||
■
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th class="nowrap" >
|
||||
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_JOOMLA_POWERS_NAME', 'a.system_name', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<?php if ($this->canState): ?>
|
||||
<th width="10" class="nowrap center" >
|
||||
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_JOOMLA_POWER_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th width="10" class="nowrap center" >
|
||||
<?php echo Text::_('COM_COMPONENTBUILDER_JOOMLA_POWER_STATUS'); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th width="5" class="nowrap center hidden-phone" >
|
||||
<?php echo Html::_('searchtools.sort', 'COM_COMPONENTBUILDER_JOOMLA_POWER_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
48
admin/tmpl/joomla_powers/default_toolbar.php
Normal file
48
admin/tmpl/joomla_powers/default_toolbar.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo Text::_('Search');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo Text::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo Html::tooltipText('Search Joomla_powers'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo Html::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo Html::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo Text::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo Text::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($this->listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo Text::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($this->listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo Text::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo Text::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo Text::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo Html::_('select.options', $this->getSortFields(), 'value', 'text', $this->listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
28
admin/tmpl/joomla_powers/emptystate.php
Normal file
28
admin/tmpl/joomla_powers/emptystate.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$displayData = [
|
||||
'textPrefix' => 'COM_COMPONENTBUILDER_JOOMLA_POWERS',
|
||||
'formURL' => 'index.php?option=com_componentbuilder&view=joomla_powers',
|
||||
'icon' => 'icon-joomla',
|
||||
];
|
||||
|
||||
if ($this->user->authorise('joomla_power.create', 'com_componentbuilder'))
|
||||
{
|
||||
$displayData['createURL'] = 'index.php?option=com_componentbuilder&task=joomla_power.add';
|
||||
}
|
||||
|
||||
echo LayoutHelper::render('joomla.content.emptystate', $displayData);
|
1
admin/tmpl/joomla_powers/index.html
Normal file
1
admin/tmpl/joomla_powers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
Reference in New Issue
Block a user