Added #39 a new feature the imports custom code during compilation. We also improved the compiler.
This commit is contained in:
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 94 of this MVC
|
||||
@build 13th January, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_view.php
|
||||
@ -404,7 +404,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
public function selectionTranslationVxtfields($value,$name)
|
||||
{
|
||||
// Array of datatype language strings
|
||||
if ($name == 'datatype')
|
||||
if ($name === 'datatype')
|
||||
{
|
||||
$datatypeArray = array(
|
||||
'CHAR' => 'COM_COMPONENTBUILDER_FIELD_CHAR',
|
||||
@ -429,7 +429,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
}
|
||||
}
|
||||
// Array of indexes language strings
|
||||
if ($name == 'indexes')
|
||||
if ($name === 'indexes')
|
||||
{
|
||||
$indexesArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_FIELD_UNIQUE_KEY',
|
||||
@ -443,7 +443,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
}
|
||||
}
|
||||
// Array of null_switch language strings
|
||||
if ($name == 'null_switch')
|
||||
if ($name === 'null_switch')
|
||||
{
|
||||
$null_switchArray = array(
|
||||
'NULL' => 'COM_COMPONENTBUILDER_FIELD_NULL',
|
||||
@ -456,7 +456,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
}
|
||||
}
|
||||
// Array of store language strings
|
||||
if ($name == 'store')
|
||||
if ($name === 'store')
|
||||
{
|
||||
$storeArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT',
|
||||
@ -1443,7 +1443,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 94 of this MVC
|
||||
@build 13th January, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_views.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ajax.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage compiler.php
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 77 of this MVC
|
||||
@build 26th December, 2016
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -1342,7 +1342,7 @@ class ComponentbuilderModelComponent extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
@ -43,7 +43,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
$icons = array();
|
||||
// view groups array
|
||||
$viewGroups = array(
|
||||
'main' => array('png.compiler', 'png.component.add', 'png.components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.help_document.add', 'png.help_documents')
|
||||
'main' => array('png.compiler', 'png.component.add', 'png.components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.help_document.add', 'png.help_documents')
|
||||
);
|
||||
// view access array
|
||||
$viewAccess = array(
|
||||
@ -78,6 +78,11 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
||||
'dynamic_gets.submenu' => 'dynamic_get.submenu',
|
||||
'dynamic_gets.dashboard_list' => 'dynamic_get.dashboard_list',
|
||||
'dynamic_get.dashboard_add' => 'dynamic_get.dashboard_add',
|
||||
'custom_code.create' => 'custom_code.create',
|
||||
'custom_codes.access' => 'custom_code.access',
|
||||
'custom_code.access' => 'custom_code.access',
|
||||
'custom_codes.submenu' => 'custom_code.submenu',
|
||||
'custom_codes.dashboard_list' => 'custom_code.dashboard_list',
|
||||
'snippets.access' => 'snippet.access',
|
||||
'snippet.access' => 'snippet.access',
|
||||
'snippets.submenu' => 'snippet.submenu',
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 77 of this MVC
|
||||
@build 26th December, 2016
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage components.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 18 of this MVC
|
||||
@build 13th January, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_view.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -1044,7 +1044,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the name for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
$origTable = clone $this->getTable();
|
||||
$origTable->load($input->getInt('id'));
|
||||
@ -1098,7 +1098,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 18 of this MVC
|
||||
@build 13th January, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_views.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
873
admin/models/custom_code.php
Normal file
873
admin/models/custom_code.php
Normal file
@ -0,0 +1,873 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 14 of this MVC
|
||||
@build 31st January, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_code.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// import Joomla modelform library
|
||||
jimport('joomla.application.component.modeladmin');
|
||||
|
||||
/**
|
||||
* Componentbuilder Custom_code Model
|
||||
*/
|
||||
class ComponentbuilderModelCustom_code extends JModelAdmin
|
||||
{
|
||||
/**
|
||||
* @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.custom_code';
|
||||
|
||||
/**
|
||||
* 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 JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'custom_code', $prefix = 'ComponentbuilderTable', $config = array())
|
||||
{
|
||||
return JTable::getInstance($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))
|
||||
{
|
||||
// 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->code))
|
||||
{
|
||||
// base64 Decode code.
|
||||
$item->code = base64_decode($item->code);
|
||||
}
|
||||
|
||||
if (!empty($item->id))
|
||||
{
|
||||
$item->tags = new JHelperTags;
|
||||
$item->tags->getTagIds($item->id, 'com_componentbuilder.custom_code');
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_componentbuilder.custom_code', 'custom_code', array('control' => 'jform', 'load_data' => $loadData));
|
||||
|
||||
if (empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$jinput = JFactory::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 = JFactory::getUser();
|
||||
|
||||
// Check for existing item.
|
||||
// Modify the form based on Edit State access controls.
|
||||
if ($id != 0 && (!$user->authorise('custom_code.edit.state', 'com_componentbuilder.custom_code.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('custom_code.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('custom_code.edit.created_by', 'com_componentbuilder.custom_code.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('custom_code.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('custom_code.edit.created', 'com_componentbuilder.custom_code.' . (int) $id))
|
||||
|| ($id == 0 && !$user->authorise('custom_code.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 field name
|
||||
$redirectedField = $jinput->get('ref', null, 'STRING');
|
||||
// Set redirected field value
|
||||
$redirectedValue = $jinput->get('refid', 0, 'INT');
|
||||
if (0 != $redirectedValue && $redirectedField)
|
||||
{
|
||||
// Now set the local-redirected field default value
|
||||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the script that have to be included on the form
|
||||
*
|
||||
* @return string script files
|
||||
*/
|
||||
public function getScript()
|
||||
{
|
||||
return 'administrator/components/com_componentbuilder/models/forms/custom_code.js';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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))
|
||||
{
|
||||
if ($record->published != -2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
// The record has been set. Check the record permissions.
|
||||
return $user->authorise('custom_code.delete', 'com_componentbuilder.custom_code.' . (int) $record->id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
// The record has been set. Check the record permissions.
|
||||
$permission = $user->authorise('custom_code.edit.state', 'com_componentbuilder.custom_code.' . (int) $recordId);
|
||||
if (!$permission && !is_null($permission))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return $user->authorise('custom_code.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 = array(), $key = 'id')
|
||||
{
|
||||
// Check specific edit permission then general edit permission.
|
||||
$user = JFactory::getUser();
|
||||
|
||||
return $user->authorise('custom_code.edit', 'com_componentbuilder.custom_code.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('custom_code.edit', 'com_componentbuilder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and sanitise the table data prior to saving.
|
||||
*
|
||||
* @param JTable $table A JTable object.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
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 = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('MAX(ordering)')
|
||||
->from($db->quoteName('#__componentbuilder_custom_code'));
|
||||
$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 = JFactory::getApplication()->getUserState('com_componentbuilder.edit.custom_code.data', array());
|
||||
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
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 getUniqeFields()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
JArrayHelper::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(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
// Set some needed variables.
|
||||
$this->user = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('custom_code');
|
||||
$this->batchSet = true;
|
||||
|
||||
if (!$this->canDo->get('core.batch'))
|
||||
{
|
||||
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->type == false)
|
||||
{
|
||||
$type = new JUcmType;
|
||||
$this->type = $type->getTypeByAlias($this->typeAlias);
|
||||
}
|
||||
|
||||
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
|
||||
|
||||
if (!empty($commands['move_copy']))
|
||||
{
|
||||
$cmd = JArrayHelper::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(JText::_('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 = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('custom_code');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('custom_code.create') && !$this->canDo->get('custom_code.batch'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get list of uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
// 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('custom_code.edit.state'))
|
||||
{
|
||||
$values['published'] = 0;
|
||||
}
|
||||
|
||||
$newIds = array();
|
||||
|
||||
// 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('custom_code.edit', $contexts[$pk]))
|
||||
|
||||
{
|
||||
|
||||
// Not fatal error
|
||||
|
||||
$this->setError(JText::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(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$this->table->component = $this->generateUniqe('component',$this->table->component);
|
||||
|
||||
// insert all set values
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
foreach ($values as $key => $value)
|
||||
{
|
||||
if (strlen($value) > 0 && isset($this->table->$key))
|
||||
{
|
||||
$this->table->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update all uniqe fields
|
||||
if (ComponentbuilderHelper::checkArray($uniqeFields))
|
||||
{
|
||||
foreach ($uniqeFields as $uniqeField)
|
||||
{
|
||||
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
|
||||
}
|
||||
}
|
||||
|
||||
// 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 = JFactory::getUser();
|
||||
$this->table = $this->getTable();
|
||||
$this->tableClassName = get_class($this->table);
|
||||
$this->contentType = new JUcmType;
|
||||
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
|
||||
$this->canDo = ComponentbuilderHelper::getActions('custom_code');
|
||||
}
|
||||
|
||||
if (!$this->canDo->get('custom_code.edit') && !$this->canDo->get('custom_code.batch'))
|
||||
{
|
||||
$this->setError(JText::_('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('custom_code.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('custom_code.edit', $contexts[$pk]))
|
||||
{
|
||||
$this->setError(JText::_('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(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// insert all set values.
|
||||
if (ComponentbuilderHelper::checkArray($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 = JFactory::getApplication()->input;
|
||||
$filter = JFilterInput::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 JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
|
||||
// Set the code string to base64 string.
|
||||
if (isset($data['code']))
|
||||
{
|
||||
$data['code'] = base64_encode($data['code']);
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
{
|
||||
$params = new JRegistry;
|
||||
$params->loadArray($data['params']);
|
||||
$data['params'] = (string) $params;
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
if (ComponentbuilderHelper::checkArray($uniqeFields))
|
||||
{
|
||||
foreach ($uniqeFields as $uniqeField)
|
||||
{
|
||||
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parent::save($data))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to generate a uniqe value.
|
||||
*
|
||||
* @param string $field name.
|
||||
* @param string $value data.
|
||||
*
|
||||
* @return string New value.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function generateUniqe($field,$value)
|
||||
{
|
||||
|
||||
// set field value uniqe
|
||||
$table = $this->getTable();
|
||||
|
||||
while ($table->load(array($field => $value)))
|
||||
{
|
||||
$value = JString::increment($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title & alias.
|
||||
*
|
||||
* @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(array('title' => $title)))
|
||||
{
|
||||
$title = JString::increment($title);
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
430
admin/models/custom_codes.php
Normal file
430
admin/models/custom_codes.php
Normal file
@ -0,0 +1,430 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 14 of this MVC
|
||||
@build 31st January, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_codes.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the Joomla modellist library
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
/**
|
||||
* Custom_codes Model
|
||||
*/
|
||||
class ComponentbuilderModelCustom_codes extends JModelList
|
||||
{
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'a.id','id',
|
||||
'a.published','published',
|
||||
'a.ordering','ordering',
|
||||
'a.created_by','created_by',
|
||||
'a.modified_by','modified_by',
|
||||
'a.component','component',
|
||||
'a.path','path',
|
||||
'a.type','type'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
{
|
||||
$this->context .= '.' . $layout;
|
||||
}
|
||||
$component = $this->getUserStateFromRequest($this->context . '.filter.component', 'filter_component');
|
||||
$this->setState('filter.component', $component);
|
||||
|
||||
$path = $this->getUserStateFromRequest($this->context . '.filter.path', 'filter_path');
|
||||
$this->setState('filter.path', $path);
|
||||
|
||||
$type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type');
|
||||
$this->setState('filter.type', $type);
|
||||
|
||||
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
|
||||
$this->setState('filter.sorting', $sorting);
|
||||
|
||||
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
|
||||
$this->setState('filter.access', $access);
|
||||
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$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);
|
||||
|
||||
// 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.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
// check in items
|
||||
$this->checkInNow();
|
||||
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// set values to display correctly.
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = ($user->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $item->id) && $user->authorise('custom_code.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// set selection value to a translatable value
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
{
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
// convert type
|
||||
$item->type = $this->selectionTranslation($item->type, 'type');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to convert selection values to translatable string.
|
||||
*
|
||||
* @return translatable string
|
||||
*/
|
||||
public function selectionTranslation($value,$name)
|
||||
{
|
||||
// Array of type language strings
|
||||
if ($name === 'type')
|
||||
{
|
||||
$typeArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_REPLACEMENT',
|
||||
2 => 'COM_COMPONENTBUILDER_CUSTOM_CODE_INSERTION'
|
||||
);
|
||||
// Now check if value is found in this array
|
||||
if (isset($typeArray[$value]) && ComponentbuilderHelper::checkString($typeArray[$value]))
|
||||
{
|
||||
return $typeArray[$value];
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Create a new query object.
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
$query->select('a.*');
|
||||
|
||||
// From the componentbuilder_item table
|
||||
$query->from($db->quoteName('#__componentbuilder_custom_code', 'a'));
|
||||
|
||||
// From the componentbuilder_component table.
|
||||
$query->select($db->quoteName('g.system_name','component_system_name'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_component', 'g') . ' ON (' . $db->quoteName('a.component') . ' = ' . $db->quoteName('g.id') . ')');
|
||||
|
||||
// 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.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $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.component LIKE '.$search.' OR g.system_name LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by component.
|
||||
if ($component = $this->getState('filter.component'))
|
||||
{
|
||||
$query->where('a.component = ' . $db->quote($db->escape($component)));
|
||||
}
|
||||
// Filter by Type.
|
||||
if ($type = $this->getState('filter.type'))
|
||||
{
|
||||
$query->where('a.type = ' . $db->quote($db->escape($type)));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.id');
|
||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
||||
if ($orderCol != '')
|
||||
{
|
||||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get list export data.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getExportData($pks)
|
||||
{
|
||||
// setup the query
|
||||
if (ComponentbuilderHelper::checkArray($pks))
|
||||
{
|
||||
// Set a value to know this is exporting method.
|
||||
$_export = true;
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
// Create a new query object.
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
$query->select('a.*');
|
||||
|
||||
// From the componentbuilder_custom_code table
|
||||
$query->from($db->quoteName('#__componentbuilder_custom_code', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// 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.ordering ASC');
|
||||
|
||||
// Load the items
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$items = $db->loadObjectList();
|
||||
|
||||
// set values to display correctly.
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = ($user->authorise('custom_code.access', 'com_componentbuilder.custom_code.' . (int) $item->id) && $user->authorise('custom_code.access', 'com_componentbuilder'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
continue;
|
||||
}
|
||||
|
||||
// decode code
|
||||
$item->code = base64_decode($item->code);
|
||||
// unset the values we don't want exported.
|
||||
unset($item->asset_id);
|
||||
unset($item->checked_out);
|
||||
unset($item->checked_out_time);
|
||||
}
|
||||
}
|
||||
// Add headers to items array.
|
||||
$headers = $this->getExImPortHeaders();
|
||||
if (ComponentbuilderHelper::checkObject($headers))
|
||||
{
|
||||
array_unshift($items,$headers);
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get header.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getExImPortHeaders()
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// get the columns
|
||||
$columns = $db->getTableColumns("#__componentbuilder_custom_code");
|
||||
if (ComponentbuilderHelper::checkArray($columns))
|
||||
{
|
||||
// remove the headers you don't import/export.
|
||||
unset($columns['asset_id']);
|
||||
unset($columns['checked_out']);
|
||||
unset($columns['checked_out_time']);
|
||||
$headers = new stdClass();
|
||||
foreach ($columns as $column => $type)
|
||||
{
|
||||
$headers->{$column} = $column;
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
* @return string A store id.
|
||||
*
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.id');
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.component');
|
||||
$id .= ':' . $this->getState('filter.path');
|
||||
$id .= ':' . $this->getState('filter.type');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query to checkin all items left checked out longer then a set time.
|
||||
*
|
||||
* @return a bool
|
||||
*
|
||||
*/
|
||||
protected function checkInNow()
|
||||
{
|
||||
// Get set check in time
|
||||
$time = JComponentHelper::getParams('com_componentbuilder')->get('check_in');
|
||||
|
||||
if ($time)
|
||||
{
|
||||
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// reset query
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
$query->from($db->quoteName('#__componentbuilder_custom_code'));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// Get Yesterdays date
|
||||
$date = JFactory::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_custom_code'))->set($fields)->where($conditions);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 81 of this MVC
|
||||
@build 15th January, 2017
|
||||
@created 21st May, 2015
|
||||
@package Component Builder
|
||||
@subpackage dynamic_get.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -911,7 +911,7 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 81 of this MVC
|
||||
@build 15th January, 2017
|
||||
@created 21st May, 2015
|
||||
@package Component Builder
|
||||
@subpackage dynamic_gets.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -153,7 +153,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList
|
||||
public function selectionTranslation($value,$name)
|
||||
{
|
||||
// Array of main_source language strings
|
||||
if ($name == 'main_source')
|
||||
if ($name === 'main_source')
|
||||
{
|
||||
$main_sourceArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PLEASE_SELECT',
|
||||
@ -168,7 +168,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList
|
||||
}
|
||||
}
|
||||
// Array of gettype language strings
|
||||
if ($name == 'gettype')
|
||||
if ($name === 'gettype')
|
||||
{
|
||||
$gettypeArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_DYNAMIC_GET_GETITEM',
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 36 of this MVC
|
||||
@build 12th January, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage field.php
|
||||
@ -1049,7 +1049,7 @@ class ComponentbuilderModelField extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 36 of this MVC
|
||||
@build 12th January, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fields.php
|
||||
@ -181,7 +181,7 @@ class ComponentbuilderModelFields extends JModelList
|
||||
public function selectionTranslation($value,$name)
|
||||
{
|
||||
// Array of datatype language strings
|
||||
if ($name == 'datatype')
|
||||
if ($name === 'datatype')
|
||||
{
|
||||
$datatypeArray = array(
|
||||
'CHAR' => 'COM_COMPONENTBUILDER_FIELD_CHAR',
|
||||
@ -206,7 +206,7 @@ class ComponentbuilderModelFields extends JModelList
|
||||
}
|
||||
}
|
||||
// Array of indexes language strings
|
||||
if ($name == 'indexes')
|
||||
if ($name === 'indexes')
|
||||
{
|
||||
$indexesArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_FIELD_UNIQUE_KEY',
|
||||
@ -220,7 +220,7 @@ class ComponentbuilderModelFields extends JModelList
|
||||
}
|
||||
}
|
||||
// Array of null_switch language strings
|
||||
if ($name == 'null_switch')
|
||||
if ($name === 'null_switch')
|
||||
{
|
||||
$null_switchArray = array(
|
||||
'NULL' => 'COM_COMPONENTBUILDER_FIELD_NULL',
|
||||
@ -233,7 +233,7 @@ class ComponentbuilderModelFields extends JModelList
|
||||
}
|
||||
}
|
||||
// Array of store language strings
|
||||
if ($name == 'store')
|
||||
if ($name === 'store')
|
||||
{
|
||||
$storeArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT',
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage adminviewfolderlist.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName == '' || $buttonName == '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage adminviews.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldAdminviews extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit admin_view
|
||||
if (($buttonName == 'admin_view' || $buttonName == 'admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage articles.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldArticles extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit article
|
||||
if (($buttonName == 'article' || $buttonName == 'articles') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'article' || $buttonName === 'articles') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
171
admin/models/fields/component.php
Normal file
171
admin/models/fields/component.php
Normal file
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Component Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldComponent extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The component field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'component';
|
||||
/**
|
||||
* Override to add new button
|
||||
*
|
||||
* @return string The field input markup.
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
protected function getInput()
|
||||
{
|
||||
// see if we should add buttons
|
||||
$setButton = $this->getAttribute('button');
|
||||
// get html
|
||||
$html = parent::getInput();
|
||||
// if true set button
|
||||
if ($setButton === 'true')
|
||||
{
|
||||
$button = array();
|
||||
$script = array();
|
||||
$buttonName = $this->getAttribute('name');
|
||||
// get the input from url
|
||||
$app = JFactory::getApplication();
|
||||
$jinput = $app->input;
|
||||
// get the view name & id
|
||||
$values = $jinput->getArray(array(
|
||||
'id' => 'int',
|
||||
'view' => 'word'
|
||||
));
|
||||
// check if new item
|
||||
$ref = '';
|
||||
$refJ = '';
|
||||
if (!is_null($values['id']) && strlen($values['view']))
|
||||
{
|
||||
// only load referal if not new item.
|
||||
$ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
|
||||
}
|
||||
$user = JFactory::getUser();
|
||||
// only add if user allowed to create component
|
||||
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build Create button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
|
||||
href="index.php?option=com_componentbuilder&view=component&layout=edit'.$ref.'" >
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit component
|
||||
if (($buttonName === 'component' || $buttonName === 'components') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
$buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
|
||||
$buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
|
||||
$buttonNamee = ucfirst(strtolower($buttonNamee));
|
||||
$button[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
|
||||
<span class="icon-edit"></span></a>';
|
||||
// build script
|
||||
$script[] = "
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
|
||||
e.preventDefault();
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
|
||||
".$buttonName."Button(".$buttonName."Value);
|
||||
});
|
||||
function ".$buttonName."Button(value) {
|
||||
if (value > 0) {
|
||||
// hide the create button
|
||||
jQuery('#".$buttonName."Create').hide();
|
||||
// show edit button
|
||||
jQuery('#".$buttonName."Edit').show();
|
||||
var url = 'index.php?option=com_componentbuilder&view=components&task=component.edit&id='+value+'".$refJ."';
|
||||
jQuery('#".$buttonName."Edit').attr('href', url);
|
||||
} else {
|
||||
// show the create button
|
||||
jQuery('#".$buttonName."Create').show();
|
||||
// hide edit button
|
||||
jQuery('#".$buttonName."Edit').hide();
|
||||
}
|
||||
}";
|
||||
}
|
||||
// check if button was created for component field.
|
||||
if (is_array($button) && count($button) > 0)
|
||||
{
|
||||
// Load the needed script.
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration(implode(' ',$script));
|
||||
// return the button attached to input field.
|
||||
return '<div class="input-append">' .$html . implode('',$button).'</div>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','component_system_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_component', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.system_name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->component_system_name);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customadminviews.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldCustomadminviews extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit custom_admin_view
|
||||
if (($buttonName == 'custom_admin_view' || $buttonName == 'custom_admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'custom_admin_view' || $buttonName === 'custom_admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customfilelist.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldCustomfilelist extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName == '' || $buttonName == '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customfolderlist.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldCustomfolderlist extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName == '' || $buttonName == '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customgets.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldCustomgets extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit dynamic_get
|
||||
if (($buttonName == 'dynamic_get' || $buttonName == 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'dynamic_get' || $buttonName === 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dbtables.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldDbtables extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName == '' || $buttonName == '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dynamicgets.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldDynamicgets extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit dynamic_get
|
||||
if (($buttonName == 'dynamic_get' || $buttonName == 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'dynamic_get' || $buttonName === 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fields.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldFields extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit field
|
||||
if (($buttonName == 'field' || $buttonName == 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fieldsmulti.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldFieldsmulti extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit field
|
||||
if (($buttonName == 'field' || $buttonName == 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fieldtypes.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldFieldtypes extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit fieldtype
|
||||
if (($buttonName == 'fieldtype' || $buttonName == 'fieldtypes') && $user->authorise('fieldtype.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'fieldtype' || $buttonName === 'fieldtypes') && $user->authorise('fieldtype.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage maingets.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldMaingets extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit dynamic_get
|
||||
if (($buttonName == 'dynamic_get' || $buttonName == 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'dynamic_get' || $buttonName === 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage siteviewfolderlist.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit
|
||||
if (($buttonName == '' || $buttonName == '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage siteviews.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldSiteviews extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit site_view
|
||||
if (($buttonName == 'site_view' || $buttonName == 'site_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'site_view' || $buttonName === 'site_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage snippets.php
|
||||
@ -92,7 +92,7 @@ class JFormFieldSnippets extends JFormFieldList
|
||||
<span class="icon-new icon-white"></span></a>';
|
||||
}
|
||||
// only add if user allowed to edit snippet
|
||||
if (($buttonName == 'snippet' || $buttonName == 'snippets') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
if (($buttonName === 'snippet' || $buttonName === 'snippets') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
|
||||
{
|
||||
// build edit button
|
||||
$buttonNamee = trim($buttonName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 12 of this MVC
|
||||
@build 20th October, 2016
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fieldtype.php
|
||||
@ -218,7 +218,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
|
||||
public function selectionTranslationVztfields($value,$name)
|
||||
{
|
||||
// Array of datatype language strings
|
||||
if ($name == 'datatype')
|
||||
if ($name === 'datatype')
|
||||
{
|
||||
$datatypeArray = array(
|
||||
'CHAR' => 'COM_COMPONENTBUILDER_FIELD_CHAR',
|
||||
@ -243,7 +243,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
|
||||
}
|
||||
}
|
||||
// Array of indexes language strings
|
||||
if ($name == 'indexes')
|
||||
if ($name === 'indexes')
|
||||
{
|
||||
$indexesArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_FIELD_UNIQUE_KEY',
|
||||
@ -257,7 +257,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
|
||||
}
|
||||
}
|
||||
// Array of null_switch language strings
|
||||
if ($name == 'null_switch')
|
||||
if ($name === 'null_switch')
|
||||
{
|
||||
$null_switchArray = array(
|
||||
'NULL' => 'COM_COMPONENTBUILDER_FIELD_NULL',
|
||||
@ -270,7 +270,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
|
||||
}
|
||||
}
|
||||
// Array of store language strings
|
||||
if ($name == 'store')
|
||||
if ($name === 'store')
|
||||
{
|
||||
$storeArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_FIELD_DEFAULT',
|
||||
@ -1043,7 +1043,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 12 of this MVC
|
||||
@build 20th October, 2016
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fieldtypes.php
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 94 of this MVC
|
||||
@build 13th January, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage admin_view.js
|
||||
|
@ -9,9 +9,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 77 of this MVC
|
||||
@build 26th December, 2016
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -9,9 +9,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 18 of this MVC
|
||||
@build 13th January, 2017
|
||||
@created 13th August, 2015
|
||||
@package Component Builder
|
||||
@subpackage custom_admin_view.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
53
admin/models/forms/custom_code.js
Normal file
53
admin/models/forms/custom_code.js
Normal file
@ -0,0 +1,53 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 14 of this MVC
|
||||
@build 31st January, 2017
|
||||
@created 11th October, 2016
|
||||
@package Component Builder
|
||||
@subpackage custom_code.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var type_vvvvvzo = jQuery("#jform_type input[type='radio']:checked").val();
|
||||
vvvvvzo(type_vvvvvzo);
|
||||
});
|
||||
|
||||
// the vvvvvzo function
|
||||
function vvvvvzo(type_vvvvvzo)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvvzo == 1)
|
||||
{
|
||||
jQuery('#jform_hashendtarget').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_hashendtarget').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
225
admin/models/forms/custom_code.xml
Normal file
225
admin/models/forms/custom_code.xml
Normal file
@ -0,0 +1,225 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form
|
||||
addrulepath="/administrator/components/com_componentbuilder/models/rules"
|
||||
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
|
||||
>
|
||||
<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_CUSTOM_CODE_CREATED_DATE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_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_CUSTOM_CODE_CREATED_BY_LABEL"
|
||||
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_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_CUSTOM_CODE_MODIFIED_DATE_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_CODE_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_CUSTOM_CODE_MODIFIED_BY_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_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_CUSTOM_CODE_ORDERING_LABEL"
|
||||
description=""
|
||||
default="0"
|
||||
size="6"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Version Field. Type: Text (joomla) -->
|
||||
<field
|
||||
name="version"
|
||||
type="text"
|
||||
class="readonly"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_VERSION_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_VERSION_DESC"
|
||||
size="6"
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- Component Field. Type: Component. (custom) -->
|
||||
<field
|
||||
type="component"
|
||||
name="component"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL"
|
||||
description="JFIELD_TITLE_DESC"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
default="0"
|
||||
required="true"
|
||||
button="true"
|
||||
/>
|
||||
<!-- Path Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="path"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_PATH_LABEL"
|
||||
size="100"
|
||||
maxlength="250"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_PATH_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
required="true"
|
||||
filter="PATH"
|
||||
message="Error! Please add target path."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_PATH_HINT"
|
||||
/>
|
||||
<!-- Type Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="type"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_REPLACEMENT</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_CUSTOM_CODE_INSERTION</option>
|
||||
</field>
|
||||
<!-- Hashendtarget Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="hashendtarget"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_LABEL"
|
||||
size="50"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="true"
|
||||
filter="STRING"
|
||||
message="Error! Please add some text here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_HINT"
|
||||
/>
|
||||
<!-- From_line Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="from_line"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="FLOAT"
|
||||
message="Error! Please add amount paid here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_FROM_LINE_HINT"
|
||||
onchange="if(!jQuery(this).val().match(/^\d+$/)){jQuery(this).val('')};"
|
||||
/>
|
||||
<!-- Hashtarget Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="hashtarget"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_LABEL"
|
||||
size="50"
|
||||
maxlength="150"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_DESCRIPTION"
|
||||
class="text_area"
|
||||
readonly="true"
|
||||
filter="STRING"
|
||||
message="Error! Please add some text here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_HINT"
|
||||
/>
|
||||
<!-- To_line Field. Type: Text. (joomla) -->
|
||||
<field
|
||||
type="text"
|
||||
name="to_line"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_TO_LINE_LABEL"
|
||||
size="10"
|
||||
maxlength="50"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_TO_LINE_DESCRIPTION"
|
||||
class="text_area"
|
||||
filter="FLOAT"
|
||||
message="Error! Please add line number here."
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_TO_LINE_HINT"
|
||||
onchange="if(!jQuery(this).val().match(/^\d+$/)){jQuery(this).val('')};"
|
||||
/>
|
||||
<!-- Code Field. Type: Textarea. (joomla) -->
|
||||
<field
|
||||
type="textarea"
|
||||
name="code"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_LABEL"
|
||||
rows="30"
|
||||
cols="15"
|
||||
description="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_DESCRIPTION"
|
||||
class="text_area span12"
|
||||
filter="raw"
|
||||
hint="COM_COMPONENTBUILDER_CUSTOM_CODE_CODE_HINT"
|
||||
required="true"
|
||||
/>
|
||||
</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 custom_code"
|
||||
translate_label="false"
|
||||
filter="rules"
|
||||
validate="rules"
|
||||
class="inputbox"
|
||||
component="com_componentbuilder"
|
||||
section="custom_code"
|
||||
/>
|
||||
</fieldset>
|
||||
</form>
|
@ -9,9 +9,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 81 of this MVC
|
||||
@build 15th January, 2017
|
||||
@created 21st May, 2015
|
||||
@package Component Builder
|
||||
@subpackage dynamic_get.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 36 of this MVC
|
||||
@build 12th January, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage field.js
|
||||
@ -23,151 +23,96 @@
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvvzovzk_required = false;
|
||||
jform_vvvvvzpvzl_required = false;
|
||||
jform_vvvvvzqvzm_required = false;
|
||||
jform_vvvvvzrvzn_required = false;
|
||||
jform_vvvvvzuvzo_required = false;
|
||||
jform_vvvvvzvvzp_required = false;
|
||||
jform_vvvvvzwvzq_required = false;
|
||||
jform_vvvvvzxvzr_required = false;
|
||||
jform_vvvvvzpvzk_required = false;
|
||||
jform_vvvvvzqvzl_required = false;
|
||||
jform_vvvvvzrvzm_required = false;
|
||||
jform_vvvvvzsvzn_required = false;
|
||||
jform_vvvvvzvvzo_required = false;
|
||||
jform_vvvvvzwvzp_required = false;
|
||||
jform_vvvvvzxvzq_required = false;
|
||||
jform_vvvvvzyvzr_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var datalenght_vvvvvzo = jQuery("#jform_datalenght").val();
|
||||
vvvvvzo(datalenght_vvvvvzo);
|
||||
var datalenght_vvvvvzp = jQuery("#jform_datalenght").val();
|
||||
vvvvvzp(datalenght_vvvvvzp);
|
||||
|
||||
var datadefault_vvvvvzp = jQuery("#jform_datadefault").val();
|
||||
vvvvvzp(datadefault_vvvvvzp);
|
||||
|
||||
var datatype_vvvvvzq = jQuery("#jform_datatype").val();
|
||||
vvvvvzq(datatype_vvvvvzq);
|
||||
var datadefault_vvvvvzq = jQuery("#jform_datadefault").val();
|
||||
vvvvvzq(datadefault_vvvvvzq);
|
||||
|
||||
var datatype_vvvvvzr = jQuery("#jform_datatype").val();
|
||||
vvvvvzr(datatype_vvvvvzr);
|
||||
|
||||
var store_vvvvvzs = jQuery("#jform_store").val();
|
||||
var datatype_vvvvvzs = jQuery("#jform_datatype").val();
|
||||
vvvvvzs(store_vvvvvzs,datatype_vvvvvzs);
|
||||
vvvvvzs(datatype_vvvvvzs);
|
||||
|
||||
var add_css_view_vvvvvzu = jQuery("#jform_add_css_view input[type='radio']:checked").val();
|
||||
vvvvvzu(add_css_view_vvvvvzu);
|
||||
var store_vvvvvzt = jQuery("#jform_store").val();
|
||||
var datatype_vvvvvzt = jQuery("#jform_datatype").val();
|
||||
vvvvvzt(store_vvvvvzt,datatype_vvvvvzt);
|
||||
|
||||
var add_css_views_vvvvvzv = jQuery("#jform_add_css_views input[type='radio']:checked").val();
|
||||
vvvvvzv(add_css_views_vvvvvzv);
|
||||
var add_css_view_vvvvvzv = jQuery("#jform_add_css_view input[type='radio']:checked").val();
|
||||
vvvvvzv(add_css_view_vvvvvzv);
|
||||
|
||||
var add_javascript_view_footer_vvvvvzw = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
|
||||
vvvvvzw(add_javascript_view_footer_vvvvvzw);
|
||||
var add_css_views_vvvvvzw = jQuery("#jform_add_css_views input[type='radio']:checked").val();
|
||||
vvvvvzw(add_css_views_vvvvvzw);
|
||||
|
||||
var add_javascript_views_footer_vvvvvzx = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
|
||||
vvvvvzx(add_javascript_views_footer_vvvvvzx);
|
||||
var add_javascript_view_footer_vvvvvzx = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
|
||||
vvvvvzx(add_javascript_view_footer_vvvvvzx);
|
||||
|
||||
var add_javascript_views_footer_vvvvvzy = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
|
||||
vvvvvzy(add_javascript_views_footer_vvvvvzy);
|
||||
});
|
||||
|
||||
// the vvvvvzo function
|
||||
function vvvvvzo(datalenght_vvvvvzo)
|
||||
// the vvvvvzp function
|
||||
function vvvvvzp(datalenght_vvvvvzp)
|
||||
{
|
||||
if (isSet(datalenght_vvvvvzo) && datalenght_vvvvvzo.constructor !== Array)
|
||||
if (isSet(datalenght_vvvvvzp) && datalenght_vvvvvzp.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvzo = datalenght_vvvvvzo;
|
||||
var datalenght_vvvvvzo = [];
|
||||
datalenght_vvvvvzo.push(temp_vvvvvzo);
|
||||
var temp_vvvvvzp = datalenght_vvvvvzp;
|
||||
var datalenght_vvvvvzp = [];
|
||||
datalenght_vvvvvzp.push(temp_vvvvvzp);
|
||||
}
|
||||
else if (!isSet(datalenght_vvvvvzo))
|
||||
else if (!isSet(datalenght_vvvvvzp))
|
||||
{
|
||||
var datalenght_vvvvvzo = [];
|
||||
var datalenght_vvvvvzp = [];
|
||||
}
|
||||
var datalenght = datalenght_vvvvvzo.some(datalenght_vvvvvzo_SomeFunc);
|
||||
var datalenght = datalenght_vvvvvzp.some(datalenght_vvvvvzp_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datalenght)
|
||||
{
|
||||
jQuery('#jform_datalenght_other').closest('.control-group').show();
|
||||
if (jform_vvvvvzovzk_required)
|
||||
if (jform_vvvvvzpvzk_required)
|
||||
{
|
||||
updateFieldRequired('datalenght_other',0);
|
||||
jQuery('#jform_datalenght_other').prop('required','required');
|
||||
jQuery('#jform_datalenght_other').attr('aria-required',true);
|
||||
jQuery('#jform_datalenght_other').addClass('required');
|
||||
jform_vvvvvzovzk_required = false;
|
||||
jform_vvvvvzpvzk_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datalenght_other').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzovzk_required)
|
||||
if (!jform_vvvvvzpvzk_required)
|
||||
{
|
||||
updateFieldRequired('datalenght_other',1);
|
||||
jQuery('#jform_datalenght_other').removeAttr('required');
|
||||
jQuery('#jform_datalenght_other').removeAttr('aria-required');
|
||||
jQuery('#jform_datalenght_other').removeClass('required');
|
||||
jform_vvvvvzovzk_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzo Some function
|
||||
function datalenght_vvvvvzo_SomeFunc(datalenght_vvvvvzo)
|
||||
{
|
||||
// set the function logic
|
||||
if (datalenght_vvvvvzo == 'Other')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvvzp function
|
||||
function vvvvvzp(datadefault_vvvvvzp)
|
||||
{
|
||||
if (isSet(datadefault_vvvvvzp) && datadefault_vvvvvzp.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvzp = datadefault_vvvvvzp;
|
||||
var datadefault_vvvvvzp = [];
|
||||
datadefault_vvvvvzp.push(temp_vvvvvzp);
|
||||
}
|
||||
else if (!isSet(datadefault_vvvvvzp))
|
||||
{
|
||||
var datadefault_vvvvvzp = [];
|
||||
}
|
||||
var datadefault = datadefault_vvvvvzp.some(datadefault_vvvvvzp_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datadefault)
|
||||
{
|
||||
jQuery('#jform_datadefault_other').closest('.control-group').show();
|
||||
if (jform_vvvvvzpvzl_required)
|
||||
{
|
||||
updateFieldRequired('datadefault_other',0);
|
||||
jQuery('#jform_datadefault_other').prop('required','required');
|
||||
jQuery('#jform_datadefault_other').attr('aria-required',true);
|
||||
jQuery('#jform_datadefault_other').addClass('required');
|
||||
jform_vvvvvzpvzl_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datadefault_other').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzpvzl_required)
|
||||
{
|
||||
updateFieldRequired('datadefault_other',1);
|
||||
jQuery('#jform_datadefault_other').removeAttr('required');
|
||||
jQuery('#jform_datadefault_other').removeAttr('aria-required');
|
||||
jQuery('#jform_datadefault_other').removeClass('required');
|
||||
jform_vvvvvzpvzl_required = true;
|
||||
jform_vvvvvzpvzk_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzp Some function
|
||||
function datadefault_vvvvvzp_SomeFunc(datadefault_vvvvvzp)
|
||||
function datalenght_vvvvvzp_SomeFunc(datalenght_vvvvvzp)
|
||||
{
|
||||
// set the function logic
|
||||
if (datadefault_vvvvvzp == 'Other')
|
||||
if (datalenght_vvvvvzp == 'Other')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -175,58 +120,54 @@ function datadefault_vvvvvzp_SomeFunc(datadefault_vvvvvzp)
|
||||
}
|
||||
|
||||
// the vvvvvzq function
|
||||
function vvvvvzq(datatype_vvvvvzq)
|
||||
function vvvvvzq(datadefault_vvvvvzq)
|
||||
{
|
||||
if (isSet(datatype_vvvvvzq) && datatype_vvvvvzq.constructor !== Array)
|
||||
if (isSet(datadefault_vvvvvzq) && datadefault_vvvvvzq.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvzq = datatype_vvvvvzq;
|
||||
var datatype_vvvvvzq = [];
|
||||
datatype_vvvvvzq.push(temp_vvvvvzq);
|
||||
var temp_vvvvvzq = datadefault_vvvvvzq;
|
||||
var datadefault_vvvvvzq = [];
|
||||
datadefault_vvvvvzq.push(temp_vvvvvzq);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvvzq))
|
||||
else if (!isSet(datadefault_vvvvvzq))
|
||||
{
|
||||
var datatype_vvvvvzq = [];
|
||||
var datadefault_vvvvvzq = [];
|
||||
}
|
||||
var datatype = datatype_vvvvvzq.some(datatype_vvvvvzq_SomeFunc);
|
||||
var datadefault = datadefault_vvvvvzq.some(datadefault_vvvvvzq_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datatype)
|
||||
if (datadefault)
|
||||
{
|
||||
jQuery('#jform_datadefault').closest('.control-group').show();
|
||||
jQuery('#jform_datalenght').closest('.control-group').show();
|
||||
jQuery('#jform_indexes').closest('.control-group').show();
|
||||
if (jform_vvvvvzqvzm_required)
|
||||
jQuery('#jform_datadefault_other').closest('.control-group').show();
|
||||
if (jform_vvvvvzqvzl_required)
|
||||
{
|
||||
updateFieldRequired('indexes',0);
|
||||
jQuery('#jform_indexes').prop('required','required');
|
||||
jQuery('#jform_indexes').attr('aria-required',true);
|
||||
jQuery('#jform_indexes').addClass('required');
|
||||
jform_vvvvvzqvzm_required = false;
|
||||
updateFieldRequired('datadefault_other',0);
|
||||
jQuery('#jform_datadefault_other').prop('required','required');
|
||||
jQuery('#jform_datadefault_other').attr('aria-required',true);
|
||||
jQuery('#jform_datadefault_other').addClass('required');
|
||||
jform_vvvvvzqvzl_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datadefault').closest('.control-group').hide();
|
||||
jQuery('#jform_datalenght').closest('.control-group').hide();
|
||||
jQuery('#jform_indexes').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzqvzm_required)
|
||||
jQuery('#jform_datadefault_other').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzqvzl_required)
|
||||
{
|
||||
updateFieldRequired('indexes',1);
|
||||
jQuery('#jform_indexes').removeAttr('required');
|
||||
jQuery('#jform_indexes').removeAttr('aria-required');
|
||||
jQuery('#jform_indexes').removeClass('required');
|
||||
jform_vvvvvzqvzm_required = true;
|
||||
updateFieldRequired('datadefault_other',1);
|
||||
jQuery('#jform_datadefault_other').removeAttr('required');
|
||||
jQuery('#jform_datadefault_other').removeAttr('aria-required');
|
||||
jQuery('#jform_datadefault_other').removeClass('required');
|
||||
jform_vvvvvzqvzl_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzq Some function
|
||||
function datatype_vvvvvzq_SomeFunc(datatype_vvvvvzq)
|
||||
function datadefault_vvvvvzq_SomeFunc(datadefault_vvvvvzq)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvvzq == 'CHAR' || datatype_vvvvvzq == 'VARCHAR' || datatype_vvvvvzq == 'DATETIME' || datatype_vvvvvzq == 'DATE' || datatype_vvvvvzq == 'TIME' || datatype_vvvvvzq == 'INT' || datatype_vvvvvzq == 'TINYINT' || datatype_vvvvvzq == 'BIGINT' || datatype_vvvvvzq == 'FLOAT' || datatype_vvvvvzq == 'DECIMAL' || datatype_vvvvvzq == 'DOUBLE')
|
||||
if (datadefault_vvvvvzq == 'Other')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -252,27 +193,31 @@ function vvvvvzr(datatype_vvvvvzr)
|
||||
// set this function logic
|
||||
if (datatype)
|
||||
{
|
||||
jQuery('#jform_store').closest('.control-group').show();
|
||||
if (jform_vvvvvzrvzn_required)
|
||||
jQuery('#jform_datadefault').closest('.control-group').show();
|
||||
jQuery('#jform_datalenght').closest('.control-group').show();
|
||||
jQuery('#jform_indexes').closest('.control-group').show();
|
||||
if (jform_vvvvvzrvzm_required)
|
||||
{
|
||||
updateFieldRequired('store',0);
|
||||
jQuery('#jform_store').prop('required','required');
|
||||
jQuery('#jform_store').attr('aria-required',true);
|
||||
jQuery('#jform_store').addClass('required');
|
||||
jform_vvvvvzrvzn_required = false;
|
||||
updateFieldRequired('indexes',0);
|
||||
jQuery('#jform_indexes').prop('required','required');
|
||||
jQuery('#jform_indexes').attr('aria-required',true);
|
||||
jQuery('#jform_indexes').addClass('required');
|
||||
jform_vvvvvzrvzm_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_store').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzrvzn_required)
|
||||
jQuery('#jform_datadefault').closest('.control-group').hide();
|
||||
jQuery('#jform_datalenght').closest('.control-group').hide();
|
||||
jQuery('#jform_indexes').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzrvzm_required)
|
||||
{
|
||||
updateFieldRequired('store',1);
|
||||
jQuery('#jform_store').removeAttr('required');
|
||||
jQuery('#jform_store').removeAttr('aria-required');
|
||||
jQuery('#jform_store').removeClass('required');
|
||||
jform_vvvvvzrvzn_required = true;
|
||||
updateFieldRequired('indexes',1);
|
||||
jQuery('#jform_indexes').removeAttr('required');
|
||||
jQuery('#jform_indexes').removeAttr('aria-required');
|
||||
jQuery('#jform_indexes').removeClass('required');
|
||||
jform_vvvvvzrvzm_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -281,7 +226,7 @@ function vvvvvzr(datatype_vvvvvzr)
|
||||
function datatype_vvvvvzr_SomeFunc(datatype_vvvvvzr)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvvzr == 'CHAR' || datatype_vvvvvzr == 'VARCHAR' || datatype_vvvvvzr == 'TEXT' || datatype_vvvvvzr == 'MEDIUMTEXT' || datatype_vvvvvzr == 'LONGTEXT')
|
||||
if (datatype_vvvvvzr == 'CHAR' || datatype_vvvvvzr == 'VARCHAR' || datatype_vvvvvzr == 'DATETIME' || datatype_vvvvvzr == 'DATE' || datatype_vvvvvzr == 'TIME' || datatype_vvvvvzr == 'INT' || datatype_vvvvvzr == 'TINYINT' || datatype_vvvvvzr == 'BIGINT' || datatype_vvvvvzr == 'FLOAT' || datatype_vvvvvzr == 'DECIMAL' || datatype_vvvvvzr == 'DOUBLE')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -289,20 +234,8 @@ function datatype_vvvvvzr_SomeFunc(datatype_vvvvvzr)
|
||||
}
|
||||
|
||||
// the vvvvvzs function
|
||||
function vvvvvzs(store_vvvvvzs,datatype_vvvvvzs)
|
||||
function vvvvvzs(datatype_vvvvvzs)
|
||||
{
|
||||
if (isSet(store_vvvvvzs) && store_vvvvvzs.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvzs = store_vvvvvzs;
|
||||
var store_vvvvvzs = [];
|
||||
store_vvvvvzs.push(temp_vvvvvzs);
|
||||
}
|
||||
else if (!isSet(store_vvvvvzs))
|
||||
{
|
||||
var store_vvvvvzs = [];
|
||||
}
|
||||
var store = store_vvvvvzs.some(store_vvvvvzs_SomeFunc);
|
||||
|
||||
if (isSet(datatype_vvvvvzs) && datatype_vvvvvzs.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvzs = datatype_vvvvvzs;
|
||||
@ -317,27 +250,33 @@ function vvvvvzs(store_vvvvvzs,datatype_vvvvvzs)
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (store && datatype)
|
||||
if (datatype)
|
||||
{
|
||||
jQuery('.note_vdm_encryption').closest('.control-group').show();
|
||||
jQuery('#jform_store').closest('.control-group').show();
|
||||
if (jform_vvvvvzsvzn_required)
|
||||
{
|
||||
updateFieldRequired('store',0);
|
||||
jQuery('#jform_store').prop('required','required');
|
||||
jQuery('#jform_store').attr('aria-required',true);
|
||||
jQuery('#jform_store').addClass('required');
|
||||
jform_vvvvvzsvzn_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_vdm_encryption').closest('.control-group').hide();
|
||||
jQuery('#jform_store').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzsvzn_required)
|
||||
{
|
||||
updateFieldRequired('store',1);
|
||||
jQuery('#jform_store').removeAttr('required');
|
||||
jQuery('#jform_store').removeAttr('aria-required');
|
||||
jQuery('#jform_store').removeClass('required');
|
||||
jform_vvvvvzsvzn_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzs Some function
|
||||
function store_vvvvvzs_SomeFunc(store_vvvvvzs)
|
||||
{
|
||||
// set the function logic
|
||||
if (store_vvvvvzs == 4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvvzs Some function
|
||||
function datatype_vvvvvzs_SomeFunc(datatype_vvvvvzs)
|
||||
{
|
||||
@ -349,126 +288,187 @@ function datatype_vvvvvzs_SomeFunc(datatype_vvvvvzs)
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvvzu function
|
||||
function vvvvvzu(add_css_view_vvvvvzu)
|
||||
// the vvvvvzt function
|
||||
function vvvvvzt(store_vvvvvzt,datatype_vvvvvzt)
|
||||
{
|
||||
if (isSet(store_vvvvvzt) && store_vvvvvzt.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvzt = store_vvvvvzt;
|
||||
var store_vvvvvzt = [];
|
||||
store_vvvvvzt.push(temp_vvvvvzt);
|
||||
}
|
||||
else if (!isSet(store_vvvvvzt))
|
||||
{
|
||||
var store_vvvvvzt = [];
|
||||
}
|
||||
var store = store_vvvvvzt.some(store_vvvvvzt_SomeFunc);
|
||||
|
||||
if (isSet(datatype_vvvvvzt) && datatype_vvvvvzt.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvzt = datatype_vvvvvzt;
|
||||
var datatype_vvvvvzt = [];
|
||||
datatype_vvvvvzt.push(temp_vvvvvzt);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvvzt))
|
||||
{
|
||||
var datatype_vvvvvzt = [];
|
||||
}
|
||||
var datatype = datatype_vvvvvzt.some(datatype_vvvvvzt_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (store && datatype)
|
||||
{
|
||||
jQuery('.note_vdm_encryption').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_vdm_encryption').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzt Some function
|
||||
function store_vvvvvzt_SomeFunc(store_vvvvvzt)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_view_vvvvvzu == 1)
|
||||
if (store_vvvvvzt == 4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvvzt Some function
|
||||
function datatype_vvvvvzt_SomeFunc(datatype_vvvvvzt)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvvzt == 'CHAR' || datatype_vvvvvzt == 'VARCHAR' || datatype_vvvvvzt == 'TEXT' || datatype_vvvvvzt == 'MEDIUMTEXT' || datatype_vvvvvzt == 'LONGTEXT')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvvzv function
|
||||
function vvvvvzv(add_css_view_vvvvvzv)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_view_vvvvvzv == 1)
|
||||
{
|
||||
jQuery('#jform_css_view').closest('.control-group').show();
|
||||
if (jform_vvvvvzuvzo_required)
|
||||
if (jform_vvvvvzvvzo_required)
|
||||
{
|
||||
updateFieldRequired('css_view',0);
|
||||
jQuery('#jform_css_view').prop('required','required');
|
||||
jQuery('#jform_css_view').attr('aria-required',true);
|
||||
jQuery('#jform_css_view').addClass('required');
|
||||
jform_vvvvvzuvzo_required = false;
|
||||
jform_vvvvvzvvzo_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_css_view').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzuvzo_required)
|
||||
if (!jform_vvvvvzvvzo_required)
|
||||
{
|
||||
updateFieldRequired('css_view',1);
|
||||
jQuery('#jform_css_view').removeAttr('required');
|
||||
jQuery('#jform_css_view').removeAttr('aria-required');
|
||||
jQuery('#jform_css_view').removeClass('required');
|
||||
jform_vvvvvzuvzo_required = true;
|
||||
jform_vvvvvzvvzo_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzv function
|
||||
function vvvvvzv(add_css_views_vvvvvzv)
|
||||
// the vvvvvzw function
|
||||
function vvvvvzw(add_css_views_vvvvvzw)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_views_vvvvvzv == 1)
|
||||
if (add_css_views_vvvvvzw == 1)
|
||||
{
|
||||
jQuery('#jform_css_views').closest('.control-group').show();
|
||||
if (jform_vvvvvzvvzp_required)
|
||||
if (jform_vvvvvzwvzp_required)
|
||||
{
|
||||
updateFieldRequired('css_views',0);
|
||||
jQuery('#jform_css_views').prop('required','required');
|
||||
jQuery('#jform_css_views').attr('aria-required',true);
|
||||
jQuery('#jform_css_views').addClass('required');
|
||||
jform_vvvvvzvvzp_required = false;
|
||||
jform_vvvvvzwvzp_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_css_views').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzvvzp_required)
|
||||
if (!jform_vvvvvzwvzp_required)
|
||||
{
|
||||
updateFieldRequired('css_views',1);
|
||||
jQuery('#jform_css_views').removeAttr('required');
|
||||
jQuery('#jform_css_views').removeAttr('aria-required');
|
||||
jQuery('#jform_css_views').removeClass('required');
|
||||
jform_vvvvvzvvzp_required = true;
|
||||
jform_vvvvvzwvzp_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzw function
|
||||
function vvvvvzw(add_javascript_view_footer_vvvvvzw)
|
||||
// the vvvvvzx function
|
||||
function vvvvvzx(add_javascript_view_footer_vvvvvzx)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_javascript_view_footer_vvvvvzw == 1)
|
||||
if (add_javascript_view_footer_vvvvvzx == 1)
|
||||
{
|
||||
jQuery('#jform_javascript_view_footer').closest('.control-group').show();
|
||||
if (jform_vvvvvzwvzq_required)
|
||||
if (jform_vvvvvzxvzq_required)
|
||||
{
|
||||
updateFieldRequired('javascript_view_footer',0);
|
||||
jQuery('#jform_javascript_view_footer').prop('required','required');
|
||||
jQuery('#jform_javascript_view_footer').attr('aria-required',true);
|
||||
jQuery('#jform_javascript_view_footer').addClass('required');
|
||||
jform_vvvvvzwvzq_required = false;
|
||||
jform_vvvvvzxvzq_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_javascript_view_footer').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzwvzq_required)
|
||||
if (!jform_vvvvvzxvzq_required)
|
||||
{
|
||||
updateFieldRequired('javascript_view_footer',1);
|
||||
jQuery('#jform_javascript_view_footer').removeAttr('required');
|
||||
jQuery('#jform_javascript_view_footer').removeAttr('aria-required');
|
||||
jQuery('#jform_javascript_view_footer').removeClass('required');
|
||||
jform_vvvvvzwvzq_required = true;
|
||||
jform_vvvvvzxvzq_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzx function
|
||||
function vvvvvzx(add_javascript_views_footer_vvvvvzx)
|
||||
// the vvvvvzy function
|
||||
function vvvvvzy(add_javascript_views_footer_vvvvvzy)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_javascript_views_footer_vvvvvzx == 1)
|
||||
if (add_javascript_views_footer_vvvvvzy == 1)
|
||||
{
|
||||
jQuery('#jform_javascript_views_footer').closest('.control-group').show();
|
||||
if (jform_vvvvvzxvzr_required)
|
||||
if (jform_vvvvvzyvzr_required)
|
||||
{
|
||||
updateFieldRequired('javascript_views_footer',0);
|
||||
jQuery('#jform_javascript_views_footer').prop('required','required');
|
||||
jQuery('#jform_javascript_views_footer').attr('aria-required',true);
|
||||
jQuery('#jform_javascript_views_footer').addClass('required');
|
||||
jform_vvvvvzxvzr_required = false;
|
||||
jform_vvvvvzyvzr_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_javascript_views_footer').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzxvzr_required)
|
||||
if (!jform_vvvvvzyvzr_required)
|
||||
{
|
||||
updateFieldRequired('javascript_views_footer',1);
|
||||
jQuery('#jform_javascript_views_footer').removeAttr('required');
|
||||
jQuery('#jform_javascript_views_footer').removeAttr('aria-required');
|
||||
jQuery('#jform_javascript_views_footer').removeClass('required');
|
||||
jform_vvvvvzxvzr_required = true;
|
||||
jform_vvvvvzyvzr_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version @update number 12 of this MVC
|
||||
@build 20th October, 2016
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fieldtype.js
|
||||
|
@ -9,9 +9,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 6 of this MVC
|
||||
@build 17th October, 2016
|
||||
@created 4th March, 2016
|
||||
@package Component Builder
|
||||
@subpackage help_document.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -23,24 +23,21 @@
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvvzyvzu_required = false;
|
||||
jform_vvvvvzzvzv_required = false;
|
||||
jform_vvvvwaavzw_required = false;
|
||||
jform_vvvvwabvzx_required = false;
|
||||
jform_vvvvwacvzy_required = false;
|
||||
jform_vvvvwadvzz_required = false;
|
||||
jform_vvvvvzzvzu_required = false;
|
||||
jform_vvvvwaavzv_required = false;
|
||||
jform_vvvvwabvzw_required = false;
|
||||
jform_vvvvwacvzx_required = false;
|
||||
jform_vvvvwadvzy_required = false;
|
||||
jform_vvvvwaevzz_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var location_vvvvvzy = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvvzy(location_vvvvvzy);
|
||||
|
||||
var location_vvvvvzz = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvvzz(location_vvvvvzz);
|
||||
|
||||
var type_vvvvwaa = jQuery("#jform_type").val();
|
||||
vvvvwaa(type_vvvvwaa);
|
||||
var location_vvvvwaa = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvwaa(location_vvvvwaa);
|
||||
|
||||
var type_vvvvwab = jQuery("#jform_type").val();
|
||||
vvvvwab(type_vvvvwab);
|
||||
@ -48,127 +45,75 @@ jQuery(document).ready(function()
|
||||
var type_vvvvwac = jQuery("#jform_type").val();
|
||||
vvvvwac(type_vvvvwac);
|
||||
|
||||
var target_vvvvwad = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
vvvvwad(target_vvvvwad);
|
||||
var type_vvvvwad = jQuery("#jform_type").val();
|
||||
vvvvwad(type_vvvvwad);
|
||||
|
||||
var target_vvvvwae = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
vvvvwae(target_vvvvwae);
|
||||
});
|
||||
|
||||
// the vvvvvzy function
|
||||
function vvvvvzy(location_vvvvvzy)
|
||||
// the vvvvvzz function
|
||||
function vvvvvzz(location_vvvvvzz)
|
||||
{
|
||||
// set the function logic
|
||||
if (location_vvvvvzy == 1)
|
||||
if (location_vvvvvzz == 1)
|
||||
{
|
||||
jQuery('#jform_admin_view').closest('.control-group').show();
|
||||
if (jform_vvvvvzyvzu_required)
|
||||
if (jform_vvvvvzzvzu_required)
|
||||
{
|
||||
updateFieldRequired('admin_view',0);
|
||||
jQuery('#jform_admin_view').prop('required','required');
|
||||
jQuery('#jform_admin_view').attr('aria-required',true);
|
||||
jQuery('#jform_admin_view').addClass('required');
|
||||
jform_vvvvvzyvzu_required = false;
|
||||
jform_vvvvvzzvzu_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_admin_view').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzyvzu_required)
|
||||
if (!jform_vvvvvzzvzu_required)
|
||||
{
|
||||
updateFieldRequired('admin_view',1);
|
||||
jQuery('#jform_admin_view').removeAttr('required');
|
||||
jQuery('#jform_admin_view').removeAttr('aria-required');
|
||||
jQuery('#jform_admin_view').removeClass('required');
|
||||
jform_vvvvvzyvzu_required = true;
|
||||
jform_vvvvvzzvzu_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvzz function
|
||||
function vvvvvzz(location_vvvvvzz)
|
||||
// the vvvvwaa function
|
||||
function vvvvwaa(location_vvvvwaa)
|
||||
{
|
||||
// set the function logic
|
||||
if (location_vvvvvzz == 2)
|
||||
if (location_vvvvwaa == 2)
|
||||
{
|
||||
jQuery('#jform_site_view').closest('.control-group').show();
|
||||
if (jform_vvvvvzzvzv_required)
|
||||
if (jform_vvvvwaavzv_required)
|
||||
{
|
||||
updateFieldRequired('site_view',0);
|
||||
jQuery('#jform_site_view').prop('required','required');
|
||||
jQuery('#jform_site_view').attr('aria-required',true);
|
||||
jQuery('#jform_site_view').addClass('required');
|
||||
jform_vvvvvzzvzv_required = false;
|
||||
jform_vvvvwaavzv_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_site_view').closest('.control-group').hide();
|
||||
if (!jform_vvvvvzzvzv_required)
|
||||
if (!jform_vvvvwaavzv_required)
|
||||
{
|
||||
updateFieldRequired('site_view',1);
|
||||
jQuery('#jform_site_view').removeAttr('required');
|
||||
jQuery('#jform_site_view').removeAttr('aria-required');
|
||||
jQuery('#jform_site_view').removeClass('required');
|
||||
jform_vvvvvzzvzv_required = true;
|
||||
jform_vvvvwaavzv_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwaa function
|
||||
function vvvvwaa(type_vvvvwaa)
|
||||
{
|
||||
if (isSet(type_vvvvwaa) && type_vvvvwaa.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwaa = type_vvvvwaa;
|
||||
var type_vvvvwaa = [];
|
||||
type_vvvvwaa.push(temp_vvvvwaa);
|
||||
}
|
||||
else if (!isSet(type_vvvvwaa))
|
||||
{
|
||||
var type_vvvvwaa = [];
|
||||
}
|
||||
var type = type_vvvvwaa.some(type_vvvvwaa_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_url').closest('.control-group').show();
|
||||
if (jform_vvvvwaavzw_required)
|
||||
{
|
||||
updateFieldRequired('url',0);
|
||||
jQuery('#jform_url').prop('required','required');
|
||||
jQuery('#jform_url').attr('aria-required',true);
|
||||
jQuery('#jform_url').addClass('required');
|
||||
jform_vvvvwaavzw_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_url').closest('.control-group').hide();
|
||||
if (!jform_vvvvwaavzw_required)
|
||||
{
|
||||
updateFieldRequired('url',1);
|
||||
jQuery('#jform_url').removeAttr('required');
|
||||
jQuery('#jform_url').removeAttr('aria-required');
|
||||
jQuery('#jform_url').removeClass('required');
|
||||
jform_vvvvwaavzw_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwaa Some function
|
||||
function type_vvvvwaa_SomeFunc(type_vvvvwaa)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwaa == 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwab function
|
||||
function vvvvwab(type_vvvvwab)
|
||||
{
|
||||
@ -188,27 +133,27 @@ function vvvvwab(type_vvvvwab)
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_article').closest('.control-group').show();
|
||||
if (jform_vvvvwabvzx_required)
|
||||
jQuery('#jform_url').closest('.control-group').show();
|
||||
if (jform_vvvvwabvzw_required)
|
||||
{
|
||||
updateFieldRequired('article',0);
|
||||
jQuery('#jform_article').prop('required','required');
|
||||
jQuery('#jform_article').attr('aria-required',true);
|
||||
jQuery('#jform_article').addClass('required');
|
||||
jform_vvvvwabvzx_required = false;
|
||||
updateFieldRequired('url',0);
|
||||
jQuery('#jform_url').prop('required','required');
|
||||
jQuery('#jform_url').attr('aria-required',true);
|
||||
jQuery('#jform_url').addClass('required');
|
||||
jform_vvvvwabvzw_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_article').closest('.control-group').hide();
|
||||
if (!jform_vvvvwabvzx_required)
|
||||
jQuery('#jform_url').closest('.control-group').hide();
|
||||
if (!jform_vvvvwabvzw_required)
|
||||
{
|
||||
updateFieldRequired('article',1);
|
||||
jQuery('#jform_article').removeAttr('required');
|
||||
jQuery('#jform_article').removeAttr('aria-required');
|
||||
jQuery('#jform_article').removeClass('required');
|
||||
jform_vvvvwabvzx_required = true;
|
||||
updateFieldRequired('url',1);
|
||||
jQuery('#jform_url').removeAttr('required');
|
||||
jQuery('#jform_url').removeAttr('aria-required');
|
||||
jQuery('#jform_url').removeClass('required');
|
||||
jform_vvvvwabvzw_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,7 +162,7 @@ function vvvvwab(type_vvvvwab)
|
||||
function type_vvvvwab_SomeFunc(type_vvvvwab)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwab == 1)
|
||||
if (type_vvvvwab == 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -243,27 +188,27 @@ function vvvvwac(type_vvvvwac)
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_content-lbl').closest('.control-group').show();
|
||||
if (jform_vvvvwacvzy_required)
|
||||
jQuery('#jform_article').closest('.control-group').show();
|
||||
if (jform_vvvvwacvzx_required)
|
||||
{
|
||||
updateFieldRequired('content',0);
|
||||
jQuery('#jform_content').prop('required','required');
|
||||
jQuery('#jform_content').attr('aria-required',true);
|
||||
jQuery('#jform_content').addClass('required');
|
||||
jform_vvvvwacvzy_required = false;
|
||||
updateFieldRequired('article',0);
|
||||
jQuery('#jform_article').prop('required','required');
|
||||
jQuery('#jform_article').attr('aria-required',true);
|
||||
jQuery('#jform_article').addClass('required');
|
||||
jform_vvvvwacvzx_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_content-lbl').closest('.control-group').hide();
|
||||
if (!jform_vvvvwacvzy_required)
|
||||
jQuery('#jform_article').closest('.control-group').hide();
|
||||
if (!jform_vvvvwacvzx_required)
|
||||
{
|
||||
updateFieldRequired('content',1);
|
||||
jQuery('#jform_content').removeAttr('required');
|
||||
jQuery('#jform_content').removeAttr('aria-required');
|
||||
jQuery('#jform_content').removeClass('required');
|
||||
jform_vvvvwacvzy_required = true;
|
||||
updateFieldRequired('article',1);
|
||||
jQuery('#jform_article').removeAttr('required');
|
||||
jQuery('#jform_article').removeAttr('aria-required');
|
||||
jQuery('#jform_article').removeClass('required');
|
||||
jform_vvvvwacvzx_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -272,7 +217,7 @@ function vvvvwac(type_vvvvwac)
|
||||
function type_vvvvwac_SomeFunc(type_vvvvwac)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwac == 2)
|
||||
if (type_vvvvwac == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -280,32 +225,87 @@ function type_vvvvwac_SomeFunc(type_vvvvwac)
|
||||
}
|
||||
|
||||
// the vvvvwad function
|
||||
function vvvvwad(target_vvvvwad)
|
||||
function vvvvwad(type_vvvvwad)
|
||||
{
|
||||
if (isSet(type_vvvvwad) && type_vvvvwad.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwad = type_vvvvwad;
|
||||
var type_vvvvwad = [];
|
||||
type_vvvvwad.push(temp_vvvvwad);
|
||||
}
|
||||
else if (!isSet(type_vvvvwad))
|
||||
{
|
||||
var type_vvvvwad = [];
|
||||
}
|
||||
var type = type_vvvvwad.some(type_vvvvwad_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_content-lbl').closest('.control-group').show();
|
||||
if (jform_vvvvwadvzy_required)
|
||||
{
|
||||
updateFieldRequired('content',0);
|
||||
jQuery('#jform_content').prop('required','required');
|
||||
jQuery('#jform_content').attr('aria-required',true);
|
||||
jQuery('#jform_content').addClass('required');
|
||||
jform_vvvvwadvzy_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_content-lbl').closest('.control-group').hide();
|
||||
if (!jform_vvvvwadvzy_required)
|
||||
{
|
||||
updateFieldRequired('content',1);
|
||||
jQuery('#jform_content').removeAttr('required');
|
||||
jQuery('#jform_content').removeAttr('aria-required');
|
||||
jQuery('#jform_content').removeClass('required');
|
||||
jform_vvvvwadvzy_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwad Some function
|
||||
function type_vvvvwad_SomeFunc(type_vvvvwad)
|
||||
{
|
||||
// set the function logic
|
||||
if (target_vvvvwad == 1)
|
||||
if (type_vvvvwad == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwae function
|
||||
function vvvvwae(target_vvvvwae)
|
||||
{
|
||||
// set the function logic
|
||||
if (target_vvvvwae == 1)
|
||||
{
|
||||
jQuery('#jform_groups').closest('.control-group').show();
|
||||
if (jform_vvvvwadvzz_required)
|
||||
if (jform_vvvvwaevzz_required)
|
||||
{
|
||||
updateFieldRequired('groups',0);
|
||||
jQuery('#jform_groups').prop('required','required');
|
||||
jQuery('#jform_groups').attr('aria-required',true);
|
||||
jQuery('#jform_groups').addClass('required');
|
||||
jform_vvvvwadvzz_required = false;
|
||||
jform_vvvvwaevzz_required = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_groups').closest('.control-group').hide();
|
||||
if (!jform_vvvvwadvzz_required)
|
||||
if (!jform_vvvvwaevzz_required)
|
||||
{
|
||||
updateFieldRequired('groups',1);
|
||||
jQuery('#jform_groups').removeAttr('required');
|
||||
jQuery('#jform_groups').removeAttr('aria-required');
|
||||
jQuery('#jform_groups').removeClass('required');
|
||||
jform_vvvvwadvzz_required = true;
|
||||
jform_vvvvwaevzz_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 65 of this MVC
|
||||
@build 18th October, 2016
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layout.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -9,9 +9,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 44 of this MVC
|
||||
@build 29th January, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_view.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -9,9 +9,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 16 of this MVC
|
||||
@build 20th October, 2016
|
||||
@created 19th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage snippet.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -9,9 +9,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 39 of this MVC
|
||||
@build 18th October, 2016
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage template.js
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 6 of this MVC
|
||||
@build 17th October, 2016
|
||||
@created 4th March, 2016
|
||||
@package Component Builder
|
||||
@subpackage help_document.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -839,7 +839,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the title for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
$origTable = clone $this->getTable();
|
||||
$origTable->load($input->getInt('id'));
|
||||
@ -893,7 +893,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 6 of this MVC
|
||||
@build 17th October, 2016
|
||||
@created 4th March, 2016
|
||||
@package Component Builder
|
||||
@subpackage help_documents.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -181,7 +181,7 @@ class ComponentbuilderModelHelp_documents extends JModelList
|
||||
public function selectionTranslation($value,$name)
|
||||
{
|
||||
// Array of type language strings
|
||||
if ($name == 'type')
|
||||
if ($name === 'type')
|
||||
{
|
||||
$typeArray = array(
|
||||
0 => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_SELECT_AN_OPTION',
|
||||
@ -196,7 +196,7 @@ class ComponentbuilderModelHelp_documents extends JModelList
|
||||
}
|
||||
}
|
||||
// Array of location language strings
|
||||
if ($name == 'location')
|
||||
if ($name === 'location')
|
||||
{
|
||||
$locationArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN',
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@version 2.2.9
|
||||
@build 1st February, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import.php
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 65 of this MVC
|
||||
@build 18th October, 2016
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layout.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -851,7 +851,7 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the name for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
$origTable = clone $this->getTable();
|
||||
$origTable->load($input->getInt('id'));
|
||||
@ -905,7 +905,7 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 65 of this MVC
|
||||
@build 18th October, 2016
|
||||
@created 18th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage layouts.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 44 of this MVC
|
||||
@build 29th January, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_view.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -1056,7 +1056,7 @@ class ComponentbuilderModelSite_view extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the name for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
$origTable = clone $this->getTable();
|
||||
$origTable->load($input->getInt('id'));
|
||||
@ -1110,7 +1110,7 @@ class ComponentbuilderModelSite_view extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 44 of this MVC
|
||||
@build 29th January, 2017
|
||||
@created 29th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage site_views.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 16 of this MVC
|
||||
@build 20th October, 2016
|
||||
@created 19th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage snippet.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -803,7 +803,7 @@ class ComponentbuilderModelSnippet extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 16 of this MVC
|
||||
@build 20th October, 2016
|
||||
@created 19th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage snippets.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -155,7 +155,7 @@ class ComponentbuilderModelSnippets extends JModelList
|
||||
public function selectionTranslation($value,$name)
|
||||
{
|
||||
// Array of type language strings
|
||||
if ($name == 'type')
|
||||
if ($name === 'type')
|
||||
{
|
||||
$typeArray = array(
|
||||
1 => 'COM_COMPONENTBUILDER_SNIPPET_LAYOUT',
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 39 of this MVC
|
||||
@build 18th October, 2016
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage template.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@ -851,7 +851,7 @@ class ComponentbuilderModelTemplate extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the name for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
$origTable = clone $this->getTable();
|
||||
$origTable->load($input->getInt('id'));
|
||||
@ -905,7 +905,7 @@ class ComponentbuilderModelTemplate extends JModelAdmin
|
||||
}
|
||||
|
||||
// Alter the uniqe field for save as copy
|
||||
if ($input->get('task') == 'save2copy')
|
||||
if ($input->get('task') === 'save2copy')
|
||||
{
|
||||
// Automatic handling of other uniqe fields
|
||||
$uniqeFields = $this->getUniqeFields();
|
||||
|
@ -10,9 +10,9 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.2.6
|
||||
@build 20th January, 2017
|
||||
@created 30th April, 2015
|
||||
@version @update number 39 of this MVC
|
||||
@build 18th October, 2016
|
||||
@created 26th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage templates.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
|
Reference in New Issue
Block a user