Release of v3.2.2-alpha3

Fix permission issue for admin views. Add extending options to interfaces.
This commit is contained in:
2024-06-05 16:29:28 +02:00
parent dfaaf15ca9
commit b67e534b9f
43 changed files with 1676 additions and 674 deletions

View File

@ -1259,7 +1259,7 @@ class ComponentbuilderModelAjax extends ListModel
array('table' => 'custom_admin_view', 'tables' => 'custom_admin_views', 'fields' => array('params' => 'custom_admin_view_headers:power_:power', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW'),
array('table' => 'joomla_component', 'tables' => 'joomla_components', 'fields' => array('params' => 'joomla_component_headers:power_:power', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT'),
array('table' => 'component_dashboard', 'tables' => 'components_dashboard', 'fields' => array('params' => 'component_dashboard_headers:power_:power', 'joomla_component' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD', 'linked_name' => 'system_name'),
array('table' => 'power', 'tables' => 'powers', 'fields' => array('extends' => 'GUID', 'implements' => 'ARRAY', 'use_selection' => 'use', 'load_selection' => 'load', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_POWER')
array('table' => 'power', 'tables' => 'powers', 'fields' => array('extends' => 'GUID', 'extendsinterfaces' => 'ARRAY', 'implements' => 'ARRAY', 'use_selection' => 'use', 'load_selection' => 'load', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_POWER')
)
);

View File

@ -144,11 +144,11 @@ class JFormFieldInterfacepowers extends JFormFieldList
protected function getOptions()
{
// Get the user object.
$user = JFactory::getUser();
$user = Factory::getUser();
// Get the databse object.
$db = JFactory::getDBO();
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.guid','a.name','a.system_name','a.type','a.power_version'),array('guid','implements_name','system_name','type','version')));
$query->select($db->quoteName(array('a.guid','a.name','a.system_name','a.type','a.power_version'),array('guid','extendsinterfaces_name','system_name','type','version')));
$query->from($db->quoteName('#__componentbuilder_power', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->where($db->quoteName('a.type') . ' = ' . $db->quote('interface'));
@ -165,7 +165,7 @@ class JFormFieldInterfacepowers extends JFormFieldList
}
}
// get the input
$jinput = JFactory::getApplication()->input;
$jinput = Factory::getApplication()->input;
// get the id
$power_id = $jinput->getInt('id', 0);
// if we have an id we remove all classes of the same namespace and name
@ -176,19 +176,24 @@ class JFormFieldInterfacepowers extends JFormFieldList
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
// set the other option to enter text
$options[] = JHtml::_('select.option', -1, JText::_('COM_COMPONENTBUILDER_SET_CUSTOM'));
// if none was found, we add this to set an alternative to set custom
if (!$items)
{
$options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_NONE_FOUND'));
}
if ($items)
{
if ($this->multiple === false)
{
$options[] = JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
$options[] = Html::_('select.option', '', Text::_('COM_COMPONENTBUILDER_SELECT_AN_OPTION'));
}
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->guid, $item->system_name . ' (v' . $item->version . ') [' . $item->type . ' ' . $item->implements_name . ']');
$options[] = Html::_('select.option', $item->guid, $item->system_name . ' [' . $item->type . ' ' . $item->extendsinterfaces_name . '] (v' . $item->version . ')');
}
}
// set the other option to enter text
$options[] = Html::_('select.option', -1, Text::_('COM_COMPONENTBUILDER_SET_CUSTOM'));
return $options;
}
}

View File

@ -120,6 +120,7 @@
name="groups"
label="COM_COMPONENTBUILDER_HELP_DOCUMENT_GROUPS_LABEL"
description="COM_COMPONENTBUILDER_HELP_DOCUMENT_GROUPS_DESCRIPTION"
layout="joomla.form.field.list-fancy-select"
required="true"
multiple="true"
/>

View File

@ -160,38 +160,6 @@
message="COM_COMPONENTBUILDER_POWER_POWER_VERSION_MESSAGE"
hint="COM_COMPONENTBUILDER_POWER_POWER_VERSION_HINT"
/>
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="一_一"
/>
<!-- Method_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="method_selection"
label="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_DESCRIPTION"
icon="list"
max="150"
min="0">
<form hidden="true" name="list_method_selection_modal" repeat="true">
<!-- Method Field. Type: Powersclassmethods. (custom) -->
<field
type="powersclassmethods"
name="method"
label="COM_COMPONENTBUILDER_POWER_METHOD_LABEL"
class="list_class span12 method_selection_list"
multiple="false"
default="0"
onchange="getClassCode(this, 'method');"
button="false"
/>
</form>
</field>
<!-- Load_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -219,19 +187,6 @@
</field>
<!-- Note_linked_to_notice Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_linked_to_notice" label="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_LINKED_TO_NOTICE_DESCRIPTION" heading="h4" class="note_linked_to_notice" />
<!-- Licensing_template Field. Type: Textarea. (joomla) -->
<field
type="textarea"
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"
/>
<!-- Description Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -244,8 +199,8 @@
filter="HTML"
hint="COM_COMPONENTBUILDER_POWER_DESCRIPTION_HINT"
/>
<!-- Note_approved_paths Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_approved_paths" label="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_DESCRIPTION" heading="h4" class="alert alert-info note_approved_paths" showon="approved:1" />
<!-- Load_powers_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="load_powers_note" label="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_DESCRIPTION" heading="h4" class="alert alert-info load_powers_note" />
<!-- Composer Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -303,18 +258,18 @@
</field>
</form>
</field>
<!-- Extends Field. Type: Classpowers. (custom) -->
<!-- Licensing_template Field. Type: Textarea. (joomla) -->
<field
type="classpowers"
name="extends"
label="COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL"
description="COM_COMPONENTBUILDER_POWER_EXTENDS_DESCRIPTION"
class="list_class span12"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default="0"
showon="type:class[OR]type:abstract class[OR]type:final class"
button="true"
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"
/>
<!-- Approved Field. Type: Radio. (joomla) -->
<field
@ -331,32 +286,20 @@
<option value="1">
COM_COMPONENTBUILDER_POWER_APPROVED</option>
</field>
<!-- Property_selection Field. Type: Subform. (joomla) -->
<!-- Extendsinterfaces_custom Field. Type: Text. (joomla) -->
<field
type="subform"
name="property_selection"
label="COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_DESCRIPTION"
icon="list"
max="150"
min="0">
<form hidden="true" name="list_property_selection_modal" repeat="true">
<!-- Property Field. Type: Powersclassproperties. (custom) -->
<field
type="powersclassproperties"
name="property"
label="COM_COMPONENTBUILDER_POWER_PROPERTY_LABEL"
class="list_class span12 property_selection_list"
multiple="false"
default="0"
onchange="getClassCode(this, 'property');"
button="false"
/>
</form>
</field>
type="text"
name="extendsinterfaces_custom"
label="COM_COMPONENTBUILDER_POWER_EXTENDSINTERFACES_CUSTOM_LABEL"
size="50"
maxlength="150"
description="COM_COMPONENTBUILDER_POWER_EXTENDSINTERFACES_CUSTOM_DESCRIPTION"
class="text_area span12"
filter="STRING"
message="COM_COMPONENTBUILDER_POWER_EXTENDSINTERFACES_CUSTOM_MESSAGE"
autocomplete="on"
showon="extendsinterfaces:-1[AND]type:interface"
/>
<!-- Add_head Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -371,6 +314,19 @@
<option value="0">
COM_COMPONENTBUILDER_POWER_NO</option>
</field>
<!-- Extends Field. Type: Classpowers. (custom) -->
<field
type="classpowers"
name="extends"
label="COM_COMPONENTBUILDER_POWER_EXTENDS_LABEL"
description="COM_COMPONENTBUILDER_POWER_EXTENDS_DESCRIPTION"
class="list_class span12"
layout="joomla.form.field.list-fancy-select"
multiple="false"
default="0"
showon="type:class[OR]type:abstract class[OR]type:final class"
button="true"
/>
<!-- Extends_custom Field. Type: Text. (joomla) -->
<field
type="text"
@ -412,8 +368,93 @@
showon="type!:interface[AND]type!:trait"
button="true"
/>
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="一_一"
/>
<!-- Note_approved_paths Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_approved_paths" label="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_LABEL" description="COM_COMPONENTBUILDER_POWER_NOTE_APPROVED_PATHS_DESCRIPTION" heading="h4" class="alert alert-info note_approved_paths" showon="approved:1" />
<!-- Property_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="property_selection"
label="COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_PROPERTY_SELECTION_DESCRIPTION"
icon="list"
max="150"
min="0">
<form hidden="true" name="list_property_selection_modal" repeat="true">
<!-- Property Field. Type: Powersclassproperties. (custom) -->
<field
type="powersclassproperties"
name="property"
label="COM_COMPONENTBUILDER_POWER_PROPERTY_LABEL"
class="list_class span12 property_selection_list"
multiple="false"
default="0"
onchange="getClassCode(this, 'property');"
button="false"
/>
</form>
</field>
<!-- Extendsinterfaces Field. Type: Interfacepowers. (custom) -->
<field
type="interfacepowers"
name="extendsinterfaces"
label="COM_COMPONENTBUILDER_POWER_EXTENDSINTERFACES_LABEL"
description="COM_COMPONENTBUILDER_POWER_EXTENDSINTERFACES_DESCRIPTION"
class="list_class span12"
layout="joomla.form.field.list-fancy-select"
multiple="true"
default="0"
showon="type:interface"
button="true"
/>
<!-- Method_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
name="method_selection"
label="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_POWER_METHOD_SELECTION_DESCRIPTION"
icon="list"
max="150"
min="0">
<form hidden="true" name="list_method_selection_modal" repeat="true">
<!-- Method Field. Type: Powersclassmethods. (custom) -->
<field
type="powersclassmethods"
name="method"
label="COM_COMPONENTBUILDER_POWER_METHOD_LABEL"
class="list_class span12 method_selection_list"
multiple="false"
default="0"
onchange="getClassCode(this, 'method');"
button="false"
/>
</form>
</field>
<!-- Namespace_details Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="namespace_details" label="COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_LABEL" description="COM_COMPONENTBUILDER_POWER_NAMESPACE_DETAILS_DESCRIPTION" heading="h4" class="alert alert-success namespace_details" />
<!-- Approved_paths Field. Type: Superpowerpaths. (custom) -->
<field
type="superpowerpaths"
name="approved_paths"
label="COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_LABEL"
description="COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_DESCRIPTION"
required="false"
showon="approved:1">
<!-- Option Set. -->
<option value="joomla/super-powers">
COM_COMPONENTBUILDER_POWER_JOOMLASUPERPOWERS</option>
</field>
<!-- Head Field. Type: Editor. (joomla) -->
<field
type="editor"
@ -431,18 +472,8 @@
required="false"
validate="code"
/>
<!-- Approved_paths Field. Type: Superpowerpaths. (custom) -->
<field
type="superpowerpaths"
name="approved_paths"
label="COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_LABEL"
description="COM_COMPONENTBUILDER_POWER_APPROVED_PATHS_DESCRIPTION"
required="false"
showon="approved:1">
<!-- Option Set. -->
<option value="joomla/super-powers">
COM_COMPONENTBUILDER_POWER_JOOMLASUPERPOWERS</option>
</field>
<!-- Autoload_composer_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="autoload_composer_note" label="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_DESCRIPTION" heading="h4" class="alert alert-info autoload_composer_note" />
<!-- Use_selection Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -480,8 +511,21 @@
/>
</form>
</field>
<!-- Autoload_composer_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="autoload_composer_note" label="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_AUTOLOAD_COMPOSER_NOTE_DESCRIPTION" heading="h4" class="alert alert-info autoload_composer_note" />
<!-- 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>
<!-- Main_class_code Field. Type: Editor. (joomla) -->
<field
type="editor"
@ -498,23 +542,6 @@
filter="raw"
validate="code"
/>
<!-- Add_licensing_template Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_licensing_template"
label="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_LABEL"
description="COM_COMPONENTBUILDER_POWER_ADD_LICENSING_TEMPLATE_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_POWER_USE_GLOBAL</option>
<option value="2">
COM_COMPONENTBUILDER_POWER_OVERRIDE</option>
</field>
<!-- Load_powers_note Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="load_powers_note" label="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_LABEL" description="COM_COMPONENTBUILDER_POWER_LOAD_POWERS_NOTE_DESCRIPTION" heading="h4" class="alert alert-info load_powers_note" />
<!-- Guid Field. Type: Text. (joomla) -->
<field
type="text"

View File

@ -42,8 +42,8 @@ class ComponentbuilderModelJoomla_power extends AdminModel
protected $tabLayoutFields = array(
'joomla_power' => array(
'fullwidth' => array(
'description',
'settings'
'settings',
'description'
),
'above' => array(
'system_name'

View File

@ -49,6 +49,8 @@ class ComponentbuilderModelPower extends AdminModel
'description',
'extends',
'extends_custom',
'extendsinterfaces',
'extendsinterfaces_custom',
'implements',
'implements_custom',
'namespace',
@ -74,6 +76,12 @@ class ComponentbuilderModelPower extends AdminModel
'power_version'
)
),
'composer' => array(
'fullwidth' => array(
'autoload_composer_note',
'composer'
)
),
'licensing' => array(
'fullwidth' => array(
'add_licensing_template',
@ -88,12 +96,6 @@ class ComponentbuilderModelPower extends AdminModel
'right' => array(
'note_approved_paths'
)
),
'composer' => array(
'fullwidth' => array(
'autoload_composer_note',
'composer'
)
)
);
@ -225,14 +227,6 @@ class ComponentbuilderModelPower extends AdminModel
$item->main_class_code = base64_decode($item->main_class_code);
}
if (!empty($item->method_selection))
{
// Convert the method_selection field to an array.
$method_selection = new Registry;
$method_selection->loadString($item->method_selection);
$item->method_selection = $method_selection->toArray();
}
if (!empty($item->load_selection))
{
// Convert the load_selection field to an array.
@ -249,6 +243,14 @@ class ComponentbuilderModelPower extends AdminModel
$item->composer = $composer->toArray();
}
if (!empty($item->implements))
{
// Convert the implements field to an array.
$implements = new Registry;
$implements->loadString($item->implements);
$item->implements = $implements->toArray();
}
if (!empty($item->property_selection))
{
// Convert the property_selection field to an array.
@ -257,12 +259,20 @@ class ComponentbuilderModelPower extends AdminModel
$item->property_selection = $property_selection->toArray();
}
if (!empty($item->implements))
if (!empty($item->extendsinterfaces))
{
// Convert the implements field to an array.
$implements = new Registry;
$implements->loadString($item->implements);
$item->implements = $implements->toArray();
// Convert the extendsinterfaces field to an array.
$extendsinterfaces = new Registry;
$extendsinterfaces->loadString($item->extendsinterfaces);
$item->extendsinterfaces = $extendsinterfaces->toArray();
}
if (!empty($item->method_selection))
{
// Convert the method_selection field to an array.
$method_selection = new Registry;
$method_selection->loadString($item->method_selection);
$item->method_selection = $method_selection->toArray();
}
if (!empty($item->use_selection))
@ -1092,19 +1102,6 @@ class ComponentbuilderModelPower extends AdminModel
$data['guid'] = (string) GuidHelper::get();
}
// Set the method_selection items to data.
if (isset($data['method_selection']) && is_array($data['method_selection']))
{
$method_selection = new Registry;
$method_selection->loadArray($data['method_selection']);
$data['method_selection'] = (string) $method_selection;
}
elseif (!isset($data['method_selection']))
{
// Set the empty method_selection to data
$data['method_selection'] = '';
}
// Set the load_selection items to data.
if (isset($data['load_selection']) && is_array($data['load_selection']))
{
@ -1131,6 +1128,19 @@ class ComponentbuilderModelPower extends AdminModel
$data['composer'] = '';
}
// Set the implements items to data.
if (isset($data['implements']) && is_array($data['implements']))
{
$implements = new Registry;
$implements->loadArray($data['implements']);
$data['implements'] = (string) $implements;
}
elseif (!isset($data['implements']))
{
// Set the empty implements to data
$data['implements'] = '';
}
// Set the property_selection items to data.
if (isset($data['property_selection']) && is_array($data['property_selection']))
{
@ -1144,17 +1154,30 @@ class ComponentbuilderModelPower extends AdminModel
$data['property_selection'] = '';
}
// Set the implements items to data.
if (isset($data['implements']) && is_array($data['implements']))
// Set the extendsinterfaces items to data.
if (isset($data['extendsinterfaces']) && is_array($data['extendsinterfaces']))
{
$implements = new Registry;
$implements->loadArray($data['implements']);
$data['implements'] = (string) $implements;
$extendsinterfaces = new Registry;
$extendsinterfaces->loadArray($data['extendsinterfaces']);
$data['extendsinterfaces'] = (string) $extendsinterfaces;
}
elseif (!isset($data['implements']))
elseif (!isset($data['extendsinterfaces']))
{
// Set the empty implements to data
$data['implements'] = '';
// Set the empty extendsinterfaces to data
$data['extendsinterfaces'] = '';
}
// Set the method_selection items to data.
if (isset($data['method_selection']) && is_array($data['method_selection']))
{
$method_selection = new Registry;
$method_selection->loadArray($data['method_selection']);
$data['method_selection'] = (string) $method_selection;
}
elseif (!isset($data['method_selection']))
{
// Set the empty method_selection to data
$data['method_selection'] = '';
}
// Set the use_selection items to data.

View File

@ -443,7 +443,7 @@ class ComponentbuilderModelPowers extends ListModel
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
$query->where('(a.system_name LIKE '.$search.' OR a.type LIKE '.$search.' OR a.description LIKE '.$search.' OR a.extends LIKE '.$search.' OR a.extends_custom LIKE '.$search.' OR a.approved_paths LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.name LIKE '.$search.')');
$query->where('(a.system_name LIKE '.$search.' OR a.type LIKE '.$search.' OR a.description LIKE '.$search.' OR a.extendsinterfaces_custom LIKE '.$search.' OR a.extends LIKE '.$search.' OR a.extends_custom LIKE '.$search.' OR a.extendsinterfaces LIKE '.$search.' OR a.approved_paths LIKE '.$search.' OR a.guid LIKE '.$search.' OR a.name LIKE '.$search.')');
}
}