Adds licensing template option to the powers area.

This commit is contained in:
2022-09-20 13:06:03 +02:00
parent f4fccfe761
commit 5537a868e3
119 changed files with 1244 additions and 1069 deletions

View File

@ -202,44 +202,6 @@
filter="raw"
validate="code"
/>
<!-- Use_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="use_selection"
label="COM_COMPONENTBUILDER_POWER_USE_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_USE_SELECTION_DESCRIPTION"
icon="list"
max="30"
min="0"
showon="type!:interface">
<form hidden="true" name="list_use_selection_modal" repeat="true">
<!-- Use Field. Type: Namespaces. (custom) -->
<field
type="namespaces"
name="use"
label="COM_COMPONENTBUILDER_POWER_USE_LABEL"
class="list_class span12"
multiple="false"
default="0"
button="false"
/>
<!-- As Field. Type: Text. (joomla) -->
<field
type="text"
name="as"
label="COM_COMPONENTBUILDER_POWER_AS_LABEL"
size="10"
maxlength="50"
default="default"
class="text_area"
filter="STRING"
autocomplete="on"
/>
</form>
</field>
<!-- Description Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -252,6 +214,19 @@
filter="HTML"
hint="COM_COMPONENTBUILDER_POWER_DESCRIPTION_HINT"
/>
<!-- Licensing_template Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="licensing_template"
label="COM_COMPONENTBUILDER_POWER_LICENSING_TEMPLATE_LABEL"
rows="10"
cols="10"
class="text_area span12"
filter="RAW"
hint="COM_COMPONENTBUILDER_POWER_LICENSING_TEMPLATE_HINT"
validate="code"
showon="add_licensing_template:2"
/>
<!-- Property_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -397,6 +372,59 @@
required="false"
validate="code"
/>
<!-- Add_licensing_template Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_licensing_template"
label="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL"
description="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_POWER_USE_GLOBAL</option>
<option value="2">
COM_COMPONENTBUILDER_POWER_OVERRIDE</option>
</field>
<!-- Use_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="use_selection"
label="COM_COMPONENTBUILDER_POWER_USE_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_USE_SELECTION_DESCRIPTION"
icon="list"
max="30"
min="0"
showon="type!:interface">
<form hidden="true" name="list_use_selection_modal" repeat="true">
<!-- Use Field. Type: Namespaces. (custom) -->
<field
type="namespaces"
name="use"
label="COM_COMPONENTBUILDER_POWER_USE_LABEL"
class="list_class span12"
multiple="false"
default="0"
button="false"
/>
<!-- As Field. Type: Text. (joomla) -->
<field
type="text"
name="as"
label="COM_COMPONENTBUILDER_POWER_AS_LABEL"
size="10"
maxlength="50"
default="default"
class="text_area"
filter="STRING"
autocomplete="on"
/>
</form>
</field>
<!-- Guid Field. Type: Text. (joomla) -->
<field
type="text"

View File

@ -58,6 +58,12 @@ class ComponentbuilderModelPower extends AdminModel
'type',
'power_version'
)
),
'licensing' => array(
'fullwidth' => array(
'add_licensing_template',
'licensing_template'
)
)
);
@ -178,6 +184,12 @@ class ComponentbuilderModelPower extends AdminModel
$item->main_class_code = base64_decode($item->main_class_code);
}
if (!empty($item->licensing_template))
{
// base64 Decode licensing_template.
$item->licensing_template = base64_decode($item->licensing_template);
}
if (!empty($item->head))
{
// base64 Decode head.
@ -192,14 +204,6 @@ class ComponentbuilderModelPower extends AdminModel
$item->load_selection = $load_selection->toArray();
}
if (!empty($item->use_selection))
{
// Convert the use_selection field to an array.
$use_selection = new Registry;
$use_selection->loadString($item->use_selection);
$item->use_selection = $use_selection->toArray();
}
if (!empty($item->property_selection))
{
// Convert the property_selection field to an array.
@ -224,6 +228,14 @@ class ComponentbuilderModelPower extends AdminModel
$item->method_selection = $method_selection->toArray();
}
if (!empty($item->use_selection))
{
// Convert the use_selection field to an array.
$use_selection = new Registry;
$use_selection->loadString($item->use_selection);
$item->use_selection = $use_selection->toArray();
}
if (empty($item->id))
{
@ -1038,19 +1050,6 @@ class ComponentbuilderModelPower extends AdminModel
$data['load_selection'] = '';
}
// Set the use_selection items to data.
if (isset($data['use_selection']) && is_array($data['use_selection']))
{
$use_selection = new JRegistry;
$use_selection->loadArray($data['use_selection']);
$data['use_selection'] = (string) $use_selection;
}
elseif (!isset($data['use_selection']))
{
// Set the empty use_selection to data
$data['use_selection'] = '';
}
// Set the property_selection items to data.
if (isset($data['property_selection']) && is_array($data['property_selection']))
{
@ -1090,12 +1089,31 @@ class ComponentbuilderModelPower extends AdminModel
$data['method_selection'] = '';
}
// Set the use_selection items to data.
if (isset($data['use_selection']) && is_array($data['use_selection']))
{
$use_selection = new JRegistry;
$use_selection->loadArray($data['use_selection']);
$data['use_selection'] = (string) $use_selection;
}
elseif (!isset($data['use_selection']))
{
// Set the empty use_selection to data
$data['use_selection'] = '';
}
// Set the main_class_code string to base64 string.
if (isset($data['main_class_code']))
{
$data['main_class_code'] = base64_encode($data['main_class_code']);
}
// Set the licensing_template string to base64 string.
if (isset($data['licensing_template']))
{
$data['licensing_template'] = base64_encode($data['licensing_template']);
}
// Set the head string to base64 string.
if (isset($data['head']))
{