Release of v4.0.0-alpha7

Fix the search area layout. Fix the search area code line selection. Fix the input edit button for custom fields. Add the new layout to list fields (GUI UPDATE). Start fixing the field view in Joomla 4. #1096.
This commit is contained in:
2024-03-26 22:31:36 +02:00
parent 543fb2b2e2
commit 23af2f0b29
56 changed files with 4062 additions and 253 deletions

View File

@@ -42,23 +42,24 @@ class ArticlesField extends ListField
*/
protected function getOptions()
{
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias')));
$query->from($db->quoteName('#__content', 'a'));
$query->where($db->quoteName('a.state') . ' = 1');
$query->order('a.title ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = Html::_('select.option', '', 'Select an Article');
foreach($items as $item)
{
$options[] = Html::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')');
}
}
return $options;
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.title','a.alias'),array('id','article_title','alias')));
$query->from($db->quoteName('#__content', 'a'));
$query->where($db->quoteName('a.state') . ' = 1');
$query->order('a.title ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = Html::_('select.option', '', 'Select an Article');
foreach($items as $item)
{
$options[] = Html::_('select.option', $item->id, $item->article_title . ' (' . $item->alias . ')');
}
}
return $options;
}
}

View File

@@ -96,7 +96,7 @@ class ClassextendsField extends ListField
if ($user->authorise('class_extends.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class ClasspowersField extends ListField
if ($user->authorise('power.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -42,25 +42,26 @@ class CustomgetsField extends ListField
*/
protected function getOptions()
{
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name','a.gettype'),array('id','custom_get_name','type')));
$query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a'));
$query->where($db->quoteName('a.published') . ' = 1');
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name','a.gettype'),array('id','custom_get_name','type')));
$query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a'));
$query->where($db->quoteName('a.published') . ' = 1');
$query->where('( '.$db->quoteName('a.gettype') . ' = 3 OR ' . $db->quoteName('a.gettype') . ' = 4 )');
$query->order('a.name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$model = ComponentbuilderHelper::getModel('dynamic_gets');
foreach($items as $item)
{
$type = $model->selectionTranslation($item->type,'gettype');
$options[] = Html::_('select.option', $item->id, $item->custom_get_name . ' (' . Text::_($type) . ')' );
}
}
return $options;
$query->order('a.name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$model = ComponentbuilderHelper::getModel('dynamic_gets');
foreach($items as $item)
{
$type = $model->selectionTranslation($item->type,'gettype');
$options[] = Html::_('select.option', $item->id, $item->custom_get_name . ' (' . Text::_($type) . ')' );
}
}
return $options;
}
}

View File

@@ -96,7 +96,7 @@ class DynamicgetField extends ListField
if ($user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class ExcludedlanguagesField extends ListField
if ($user->authorise('language.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class FieldtypesField extends ListField
if ($user->authorise('fieldtype.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class InterfacepowersField extends ListField
if ($user->authorise('power.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class JoomlacomponentField extends ListField
if ($user->authorise('joomla_component.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class JoomlaplugingroupsField extends ListField
if ($user->authorise('core.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class JoomlapluginsField extends ListField
if ($user->authorise('joomla_plugin.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class LibrariesField extends ListField
if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class LibrariesxField extends ListField
if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class LibraryField extends ListField
if ($user->authorise('library.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class MaingetsField extends ListField
if ($user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class ServersField extends ListField
if ($user->authorise('server.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -96,7 +96,7 @@ class SnippetsField extends ListField
if ($user->authorise('core.edit', 'com_componentbuilder') && $app->isClient('administrator')) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small btn-outline-success button-select hasTooltip" title="'.Text::sprintf('COM_COMPONENTBUILDER_EDIT_S', $button_label).'" style="display: none; border-radius: 0px 4px 4px 0px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "

View File

@@ -35,8 +35,10 @@ use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Utilities\Base64Helper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper;
use VDM\Joomla\Utilities\FormHelper;
// No direct access to this file
\defined('_JEXEC') or die;
@@ -541,16 +543,16 @@ class AjaxModel extends ListModel
// we get the plugin group, or the powers
if ($key == 1)
{
return ComponentbuilderHelper::getVars('class_' . $type, $id, 'joomla_plugin_group', 'id');
return GetHelper::vars('class_' . $type, $id, 'joomla_plugin_group', 'id');
}
elseif ($key == 2)
{
return ComponentbuilderHelper::getVars('class_' . $type, 'powers', 'extension_type', 'id');
return GetHelper::vars('class_' . $type, 'powers', 'extension_type', 'id');
}
}
elseif ('joomla_plugin_group' === $type)
{
return ComponentbuilderHelper::getVars($type, $id, 'class_extends', 'id');
return GetHelper::vars($type, $id, 'class_extends', 'id');
}
return false;
}
@@ -562,8 +564,7 @@ class AjaxModel extends ListModel
return base64_decode($head);
}
return false;
}
}
// Used in admin_view
protected $rowNumbers = array(
@@ -1597,9 +1598,9 @@ class AjaxModel extends ListModel
protected function linkedGuid($guid, $setGuid): bool
{
// check if GUID is valid
if ($guid && ComponentbuilderHelper::validGUID($guid))
if ($guid && GuidHelper::valid($guid))
{
if (is_string($setGuid) && ComponentbuilderHelper::validGUID($setGuid) && $guid === $setGuid)
if (is_string($setGuid) && GuidHelper::valid($setGuid) && $guid === $setGuid)
{
return true;
}
@@ -1617,7 +1618,7 @@ class AjaxModel extends ListModel
* @var array
* @since 3.0.13
*/
protected $viewid = array();
protected $viewid = [];
/**
* Get the view details via the session
@@ -1650,9 +1651,9 @@ class AjaxModel extends ListModel
}
}
// set GUID if found
if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false && method_exists('ComponentbuilderHelper', 'validGUID'))
if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false)
{
if (ComponentbuilderHelper::validGUID($guid))
if (GuidHelper::valid($guid))
{
$this->viewid[$call]['a_guid'] = $guid;
}
@@ -3198,7 +3199,7 @@ class AjaxModel extends ListModel
// get the full path to rule file
$path = JPATH_LIBRARIES . '/src/Form/Rule/'.$name.'Rule.php';
// get all the code
if ($code = ComponentbuilderHelper::getFileContents($path))
if ($code = FileHelper::getContent($path))
{
// remove the class details and the ending }
$codeArray = (array) explode("FormRule\n{\n", $code);
@@ -3399,7 +3400,7 @@ class AjaxModel extends ListModel
'filter' => 'RAW',
'hint' => 'COM_COMPONENTBUILDER__ADD_YOUR_PHP_SCRIPT_HERE');
// load the textarea attributes
ComponentbuilderHelper::xmlAddAttributes($textareaXML, $textareaAttribute);
FormHelper::attributes($textareaXML, $textareaAttribute);
// setup subform with values
$textarea->setup($textareaXML, $default);
@@ -3424,7 +3425,7 @@ class AjaxModel extends ListModel
'icon' => 'list',
'max' => (UtilitiesArrayHelper::check($nameListOptions)) ? (int) count($nameListOptions) : 4);
// load the subform attributes
ComponentbuilderHelper::xmlAddAttributes($subformXML, $subformAttribute);
FormHelper::attributes($subformXML, $subformAttribute);
// now add the subform child form
$childForm = $subformXML->addChild('form');
// child form attributes
@@ -3433,7 +3434,7 @@ class AjaxModel extends ListModel
'name' => 'list_properties',
'repeat' => 'true');
// load the child form attributes
ComponentbuilderHelper::xmlAddAttributes($childForm, $childFormAttribute);
FormHelper::attributes($childForm, $childFormAttribute);
// start building the name field XML
$nameXML = new \SimpleXMLElement('<field/>');
@@ -3452,20 +3453,21 @@ class AjaxModel extends ListModel
$nameAttribute['description'] = 'COM_COMPONENTBUILDER_SELECTION';
$nameAttribute['multiple'] = 'false';
$nameAttribute['onchange'] = "getFieldPropertyDesc(this, '".$name."')";
$nameAttribute['layout'] = 'joomla.form.field.list-fancy-select';
}
else
{
$nameAttribute['hint'] = 'COM_COMPONENTBUILDER_PROPERTY_NAME';
}
// load the subform attributes
ComponentbuilderHelper::xmlAddAttributes($nameXML, $nameAttribute);
FormHelper::attributes($nameXML, $nameAttribute);
// add name list if found
if (UtilitiesArrayHelper::check($nameListOptions))
{
ComponentbuilderHelper::xmlAddOptions($nameXML, $nameListOptions);
FormHelper::options($nameXML, $nameListOptions);
}
// now add the fields to the child form
ComponentbuilderHelper::xmlAppend($childForm, $nameXML);
FormHelper::append($childForm, $nameXML);
// start building the name field XML
$valueXML = new \SimpleXMLElement('<field/>');
@@ -3480,9 +3482,9 @@ class AjaxModel extends ListModel
'filter' => 'STRING',
'hint' => 'COM_COMPONENTBUILDER_PROPERTY_VALUE');
// load the subform attributes
ComponentbuilderHelper::xmlAddAttributes($valueXML, $valueAttribute);
FormHelper::attributes($valueXML, $valueAttribute);
// now add the fields to the child form
ComponentbuilderHelper::xmlAppend($childForm, $valueXML);
FormHelper::append($childForm, $valueXML);
// start building the desc field XML
$descXML = new \SimpleXMLElement('<field/>');
@@ -3498,9 +3500,9 @@ class AjaxModel extends ListModel
'filter' => 'WORD',
'hint' => 'COM_COMPONENTBUILDER_SELECT_A_PROPERTY');
// load the desc attributes
ComponentbuilderHelper::xmlAddAttributes($descXML, $descAttribute);
FormHelper::attributes($descXML, $descAttribute);
// now add the fields to the child form
ComponentbuilderHelper::xmlAppend($childForm, $descXML);
FormHelper::append($childForm, $descXML);
// setup subform with values
$subform->setup($subformXML, $values);

View File

@@ -279,10 +279,258 @@ class FieldtypeModel extends AdminModel
$this->db->updateObject('#__componentbuilder_fieldtype', $objectUpdate, 'id');
}
}
$this->fieldtypevvvv = $item->id;
return $item;
}
/**
* Method to get list data.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getVycfields()
{
// Get the user object.
$user = Factory::getApplication()->getIdentity();
// Create a new query object.
$db = $this->getDatabase();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
$query->select($db->quoteName('c.title','category_title'));
// From the componentbuilder_field table
$query->from($db->quoteName('#__componentbuilder_field', 'a'));
$query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')');
// do not use these filters in the export method
if (!isset($_export) || !$_export)
{
// Filtering "extension"
$filter_extension = $this->state->get("filter.extension");
$field_ids = array();
$get_ids = true;
if ($get_ids && $filter_extension !== null && !empty($filter_extension))
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = JCBFilterHelper::linked((int) $type_extension[1], (string) $type_extension[0])) !== null)
{
$field_ids = $ids;
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
$get_ids = false;
}
}
// Filtering "admin_view"
$filter_admin_view = $this->state->get("filter.admin_view");
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
{
if (($ids = JCBFilterHelper::linked((int) $filter_admin_view, 'admin_view')) !== null)
{
// view will return less fields, so we ignore the component
$field_ids = $ids;
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
$get_ids = false;
}
}
// now check if we have IDs
if ($get_ids && UtilitiesArrayHelper::check($field_ids))
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $field_ids) . ')');
}
}
// From the componentbuilder_fieldtype table.
$query->select($db->quoteName('g.name','fieldtype_name'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_fieldtype', 'g') . ' ON (' . $db->quoteName('a.fieldtype') . ' = ' . $db->quoteName('g.id') . ')');
// Filter by fieldtypevvvv global.
$fieldtypevvvv = $this->fieldtypevvvv;
if (is_numeric($fieldtypevvvv ))
{
$query->where('a.fieldtype = ' . (int) $fieldtypevvvv );
}
elseif (is_string($fieldtypevvvv))
{
$query->where('a.fieldtype = ' . $db->quote($fieldtypevvvv));
}
else
{
$query->where('a.fieldtype = -5');
}
// 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 . ')');
}
// Order the results by ordering
$query->order('a.published ASC');
$query->order('a.ordering ASC');
// Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
// 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('field.access', 'com_componentbuilder.field.' . (int) $item->id) && $user->authorise('field.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
// set selection value to a translatable value
if (UtilitiesArrayHelper::check($items))
{
foreach ($items as $nr => &$item)
{
// convert datatype
$item->datatype = $this->selectionTranslationVycfields($item->datatype, 'datatype');
// convert indexes
$item->indexes = $this->selectionTranslationVycfields($item->indexes, 'indexes');
// convert null_switch
$item->null_switch = $this->selectionTranslationVycfields($item->null_switch, 'null_switch');
// convert store
$item->store = $this->selectionTranslationVycfields($item->store, 'store');
}
}
return $items;
}
return false;
}
/**
* Method to convert selection values to translatable string.
*
* @return string The translatable string.
*/
public function selectionTranslationVycfields($value,$name)
{
// Array of datatype language strings
if ($name === 'datatype')
{
$datatypeArray = array(
0 => 'COM_COMPONENTBUILDER_FIELD_SELECT_AN_OPTION',
'CHAR' => 'COM_COMPONENTBUILDER_FIELD_CHAR',
'VARCHAR' => 'COM_COMPONENTBUILDER_FIELD_VARCHAR',
'TEXT' => 'COM_COMPONENTBUILDER_FIELD_TEXT',
'MEDIUMTEXT' => 'COM_COMPONENTBUILDER_FIELD_MEDIUMTEXT',
'LONGTEXT' => 'COM_COMPONENTBUILDER_FIELD_LONGTEXT',
'BLOB' => 'COM_COMPONENTBUILDER_FIELD_BLOB',
'TINYBLOB' => 'COM_COMPONENTBUILDER_FIELD_TINYBLOB',
'MEDIUMBLOB' => 'COM_COMPONENTBUILDER_FIELD_MEDIUMBLOB',
'LONGBLOB' => 'COM_COMPONENTBUILDER_FIELD_LONGBLOB',
'DATETIME' => 'COM_COMPONENTBUILDER_FIELD_DATETIME',
'DATE' => 'COM_COMPONENTBUILDER_FIELD_DATE',
'TIME' => 'COM_COMPONENTBUILDER_FIELD_TIME',
'INT' => 'COM_COMPONENTBUILDER_FIELD_INT',
'TINYINT' => 'COM_COMPONENTBUILDER_FIELD_TINYINT',
'BIGINT' => 'COM_COMPONENTBUILDER_FIELD_BIGINT',
'FLOAT' => 'COM_COMPONENTBUILDER_FIELD_FLOAT',
'DECIMAL' => 'COM_COMPONENTBUILDER_FIELD_DECIMAL',
'DOUBLE' => 'COM_COMPONENTBUILDER_FIELD_DOUBLE'
);
// Now check if value is found in this array
if (isset($datatypeArray[$value]) && UtilitiesStringHelper::check($datatypeArray[$value]))
{
return $datatypeArray[$value];
}
}
// Array of indexes language strings
if ($name === 'indexes')
{
$indexesArray = array(
1 => 'COM_COMPONENTBUILDER_FIELD_UNIQUE_KEY',
2 => 'COM_COMPONENTBUILDER_FIELD_KEY',
0 => 'COM_COMPONENTBUILDER_FIELD_NONE'
);
// Now check if value is found in this array
if (isset($indexesArray[$value]) && UtilitiesStringHelper::check($indexesArray[$value]))
{
return $indexesArray[$value];
}
}
// Array of null_switch language strings
if ($name === 'null_switch')
{
$null_switchArray = array(
'NULL' => 'COM_COMPONENTBUILDER_FIELD_NULL',
'NOT NULL' => 'COM_COMPONENTBUILDER_FIELD_NOT_NULL'
);
// Now check if value is found in this array
if (isset($null_switchArray[$value]) && UtilitiesStringHelper::check($null_switchArray[$value]))
{
return $null_switchArray[$value];
}
}
// Array of store language strings
if ($name === 'store')
{
$storeArray = array(
0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT',
1 => 'COM_COMPONENTBUILDER_FIELD_JSON',
2 => 'COM_COMPONENTBUILDER_FIELD_BASE64',
3 => 'COM_COMPONENTBUILDER_FIELD_BASIC_ENCRYPTION_LOCALDBKEY',
5 => 'COM_COMPONENTBUILDER_FIELD_MEDIUM_ENCRYPTION_LOCALFILEKEY',
4 => 'COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION',
6 => 'COM_COMPONENTBUILDER_FIELD_EXPERT_MODE_CUSTOM'
);
// Now check if value is found in this array
if (isset($storeArray[$value]) && UtilitiesStringHelper::check($storeArray[$value]))
{
return $storeArray[$value];
}
}
return $value;
}
/**
* Method to get the record form.
*

View File

@@ -426,7 +426,7 @@ class FieldtypesModel extends ListModel
// Get a db connection.
$db = Factory::getDbo();
// get the columns
$columns = $db->getTableColumns("#__componentbuilder_[[[view]]]");
$columns = $db->getTableColumns("#__componentbuilder_fieldtype");
if (UtilitiesArrayHelper::check($columns))
{
// remove the headers you don't import/export.

View File

@@ -242,14 +242,19 @@ class HtmlView extends BaseHtmlView
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
$this->getDocument()->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
$this->getDocument()->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
// add the libs for subform (since not adding it via xml but ajax)
Factory::getApplication()
->getDocument()
->getWebAssetManager()
->useScript('webcomponent.field-subform');
->useScript('webcomponent.field-subform')
->usePreset('choicesjs')
->useScript('webcomponent.field-fancy-select');
Factory::getApplication()
->getDocument()
->addStyleDeclaration('.subform-table-sublayout-section .controls { margin-left: 0px }');
// set some lang
Text::script('COM_COMPONENTBUILDER_PROPERTY_ALREADY_SELECTED_TRY_ANOTHER');
Text::script('COM_COMPONENTBUILDER_TYPE_OR_SELECT_SOME_OPTIONS');

View File

@@ -81,6 +81,9 @@ class HtmlView extends BaseHtmlView
$this->referral .= '&return=' . (string) $return;
}
// Get Linked view data
$this->vycfields = $this->get('Vycfields');
// Set the toolbar
$this->addToolBar();
@@ -224,6 +227,16 @@ class HtmlView extends BaseHtmlView
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// Add the CSS for Footable
Html::_('stylesheet', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', ['version' => 'auto']);
Html::_('stylesheet', 'media/com_componentbuilder/footable-v3/css/footable.standalone.min.css', ['version' => 'auto']);
// Add the JavaScript for Footable (adding all functions)
Html::_('script', 'media/com_componentbuilder/footable-v3/js/footable.min.js', ['version' => 'auto']);
$footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable();});});";
$this->getDocument()->addScriptDeclaration($footable);
// add scripts
foreach ($this->scripts as $script)
{

View File

@@ -170,13 +170,13 @@ class HtmlView extends BaseHtmlView
$attributes = [
'type' => 'text',
'name' => 'search_value',
'hiddenLabel' => true,
'hiddenLabel' => 'true',
'label' => 'COM_COMPONENTBUILDER_SEARCH',
'size' => 150,
'maxlength' => 200,
'description' => 'COM_COMPONENTBUILDER_HERE_YOU_CAN_ENTER_YOUR_SEARCH_TEXT',
'filter' => 'RAW',
'class' => 'search-value span11',
'class' => 'search-value',
'hint' => 'COM_COMPONENTBUILDER_ENTER_YOUR_SEARCH_TEXT',
'autocomplete' => true,
'default' => $this->urlvalues['search_value']];
@@ -191,13 +191,13 @@ class HtmlView extends BaseHtmlView
$attributes = [
'type' => 'text',
'name' => 'replace_value',
'hiddenLabel' => true,
'hiddenLabel' => 'true',
'label' => 'COM_COMPONENTBUILDER_REPLACE',
'size' => 150,
'maxlength' => 200,
'description' => 'COM_COMPONENTBUILDER_HERE_YOU_CAN_ENTER_THE_REPLACE_TEXT_THAT_YOU_WOULD_LIKE_TO_USE_AS_REPLACEMENT_FOR_THE_SEARCH_TEXT_FOUND',
'filter' => 'RAW',
'class' => 'replace-value span11',
'class' => 'replace-value',
'hint' => 'COM_COMPONENTBUILDER_ENTER_YOUR_REPLACE_TEXT',
'autocomplete' => true,
'showon' => 'type_search:2',
@@ -300,7 +300,7 @@ class HtmlView extends BaseHtmlView
'name' => 'item_code',
'label' => 'COM_COMPONENTBUILDER_ITEM_CODE',
'width' => '100%',
'height' => '150px',
'height' => '350px',
'class' => 'item_code_editor',
'syntax' => 'php',
'buttons' => 'false',