Fixed gh-318 so that default and other none database fields will not trigger SQL update and version increment. Fixed gh-317 that had conflict variable naming in the jsonToString helper method. Improved the refresh method for JCB package area.

This commit is contained in:
Llewellyn van der Merwe 2018-07-12 18:35:38 +02:00
parent b42a3a5420
commit 0a7b91829f
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
14 changed files with 193 additions and 142 deletions

View File

@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 10th July, 2018 + *Last Build*: 12th July, 2018
+ *Version*: 2.8.4 + *Version*: 2.8.4
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **186333** + *Line count*: **186363**
+ *Field count*: **1059** + *Field count*: **1059**
+ *File count*: **1239** + *File count*: **1239**
+ *Folder count*: **197** + *Folder count*: **197**

View File

@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 10th July, 2018 + *Last Build*: 12th July, 2018
+ *Version*: 2.8.4 + *Version*: 2.8.4
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **186333** + *Line count*: **186363**
+ *Field count*: **1059** + *Field count*: **1059**
+ *File count*: **1239** + *File count*: **1239**
+ *Folder count*: **197** + *Folder count*: **197**

View File

@ -248,16 +248,16 @@ abstract class ###Component###Helper
{ {
if ($external) if ($external)
{ {
if ($name = self::getVar(null, $val, $id, $name, '=', $table)) if ($_name = self::getVar(null, $val, $id, $name, '=', $table))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
else else
{ {
if ($name = self::getVar($table, $val, $id, $name)) if ($_name = self::getVar($table, $val, $id, $name))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
} }

View File

@ -58,16 +58,16 @@ abstract class ###Component###Helper
{ {
if ($external) if ($external)
{ {
if ($name = self::getVar(null, $val, $id, $name, '=', $table)) if ($_name = self::getVar(null, $val, $id, $name, '=', $table))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
else else
{ {
if ($name = self::getVar($table, $val, $id, $name)) if ($_name = self::getVar($table, $val, $id, $name))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
} }

View File

@ -33,6 +33,31 @@ class ComponentbuilderControllerJoomla_component extends JControllerForm
{ {
$this->view_list = 'Joomla_components'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Joomla_components'; // safeguard for setting the return view listing to the main view.
parent::__construct($config); parent::__construct($config);
}
public function refresh()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
{
$session = JFactory::getSession();
$session->set('backto_VDM_IMPORT', 'joomla_components');
$session->set('dataType_VDM_IMPORTINTO', 'smart_package');
// clear the session
componentbuilderHelper::set('vdmGithubPackages', null);
componentbuilderHelper::set('communityGithubPackages', null);
// Redirect to import view.
$message = JText::_('COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', false), $message);
return;
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
} }
/** /**

View File

@ -97,6 +97,8 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin
public function smartImport() public function smartImport()
{ {
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user. // check if import is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
@ -355,6 +357,8 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin
public function cloner() public function cloner()
{ {
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// Get the model // Get the model
$model = $this->getModel('Joomla_components'); $model = $this->getModel('Joomla_components');
// check if export is allowed for this user. // check if export is allowed for this user.

View File

@ -494,6 +494,13 @@ class Get
*/ */
public $fieldRelations = array(); public $fieldRelations = array();
/**
* Default Fields
*
* @var array
*/
public $defaultFields = array('created', 'created_by', 'modified', 'modified_by', 'published', 'ordering', 'access', 'version', 'hits', 'id');
/** /**
* The list join fields * The list join fields
* *
@ -1540,112 +1547,118 @@ class Get
$view->addfields = (isset($view->addfields) && ComponentbuilderHelper::checkJson($view->addfields)) ? json_decode($view->addfields, true) : null; $view->addfields = (isset($view->addfields) && ComponentbuilderHelper::checkJson($view->addfields)) ? json_decode($view->addfields, true) : null;
if (ComponentbuilderHelper::checkArray($view->addfields)) if (ComponentbuilderHelper::checkArray($view->addfields))
{ {
$ignoreFields = array();
// load the field data
$view->fields = array_map(function($field) use($name_single, $name_list, &$ignoreFields)
{
// set hash
static $hash = 123467890; // (TODO) I found this making duplicates
// load hash
$field['hash'] = md5($field['field'] . $hash);
// increment hash
$hash++;
// set the settings
$field['settings'] = $this->getFieldData($field['field'], $name_single, $name_list);
// set real field name
$field['base_name'] = $this->getFieldName($field);
// set code name for field type
$field['type_name'] = $this->getFieldType($field);
// check if this field is a default field OR
// check if this is none database related field
if (in_array($field['base_name'], $this->defaultFields) ||
ComponentbuilderHelper::fieldCheck($field['type_name'], 'spacer') ||
$field['list'] == 2) // 2 = none database
{
$ignoreFields[$field['field']] = $field['field'];
}
// set unigue name keeper
$this->setUniqueNameCounter($field['base_name'], $name_list);
// return field
return $field;
}, array_values($view->addfields));
// build update SQL // build update SQL
if ($old_view = $this->getHistoryWatch('admin_fields', $view->addfields_id)) if ($old_view = $this->getHistoryWatch('admin_fields', $view->addfields_id))
{ {
// add new fields were added // add new fields were added
if (isset($old_view->addfields) && ComponentbuilderHelper::checkJson($old_view->addfields)) if (isset($old_view->addfields) && ComponentbuilderHelper::checkJson($old_view->addfields))
{ {
$this->setUpdateSQL(json_decode($old_view->addfields, true), $view->addfields, 'field', $name_single); $this->setUpdateSQL(json_decode($old_view->addfields, true), $view->addfields, 'field', $name_single, $ignoreFields);
} }
// clear this data // clear this data
unset($old_view); unset($old_view);
} }
if (ComponentbuilderHelper::checkArray($view->addfields)) // sort the fields acording to order
usort($view->fields, function($a, $b)
{ {
// load the field data if (isset($a['order_list']) && isset($b['order_list']))
$view->fields = array_map(function($field) use($name_single, $name_list)
{ {
// set hash if ($a['order_list'] != 0 && $b['order_list'] != 0)
static $hash = 123467890; // (TODO) I found this making duplicates {
// load hash return $a['order_list'] - $b['order_list'];
$field['hash'] = md5($field['field'] . $hash); }
// increment hash elseif ($b['order_list'] != 0 && $a['order_list'] == 0)
$hash++;
// set the settings
$field['settings'] = $this->getFieldData($field['field'], $name_single, $name_list);
// set real field name
$field['base_name'] = $this->getFieldName($field);
// set unigue name keeper
$this->setUniqueNameCounter($field['base_name'], $name_list);
// return field
return $field;
}, array_values($view->addfields));
// sort the fields acording to order
usort($view->fields, function($a, $b)
{
if (isset($a['order_list']) && isset($b['order_list']))
{ {
if ($a['order_list'] != 0 && $b['order_list'] != 0)
{
return $a['order_list'] - $b['order_list'];
}
elseif ($b['order_list'] != 0 && $a['order_list'] == 0)
{
return 1;
}
elseif ($a['order_list'] != 0 && $b['order_list'] == 0)
{
return 0;
}
return 1; return 1;
} }
return 0; elseif ($a['order_list'] != 0 && $b['order_list'] == 0)
});
// do some house cleaning (for fields)
foreach ($view->fields as $field)
{
// so first we lock the field name in
$field_name = $this->getFieldName($field, $name_list);
// check if the field changed since the last compilation
if (ComponentbuilderHelper::checkObject($field['settings']->history))
{ {
// check if the datatype changed return 0;
if (isset($field['settings']->history->datatype)) }
return 1;
}
return 0;
});
// do some house cleaning (for fields)
foreach ($view->fields as $field)
{
// so first we lock the field name in
$field_name = $this->getFieldName($field, $name_list);
// check if the field changed since the last compilation (default fields never change and are always added)
if (!isset($ignoreFields[$field['field']]) && ComponentbuilderHelper::checkObject($field['settings']->history))
{
// check if the datatype changed
if (isset($field['settings']->history->datatype))
{
$this->setUpdateSQL($field['settings']->history->datatype, $field['settings']->datatype, 'field.datatype', $name_single . '.' . $field_name);
}
// check if the datatype lenght changed
if (isset($field['settings']->history->datalenght) && isset($field['settings']->history->datalenght_other))
{
$this->setUpdateSQL($field['settings']->history->datalenght . $field['settings']->history->datalenght_other, $field['settings']->datalenght . $field['settings']->datalenght_other, 'field.lenght', $name_single . '.' . $field_name);
}
// check if the name changed
if (isset($field['settings']->history->xml) && ComponentbuilderHelper::checkJson($field['settings']->history->xml))
{
// only run if this is not an alias or a tag
if ((!isset($field['alias']) || !$field['alias']) && 'tag' !== $field['settings']->type_name)
{ {
$this->setUpdateSQL($field['settings']->history->datatype, $field['settings']->datatype, 'field.datatype', $name_single . '.' . $field_name); // build temp field bucket
} $tmpfield = array();
// check if the datatype lenght changed $tmpfield['settings'] = new stdClass();
if (isset($field['settings']->history->datalenght) && isset($field['settings']->history->datalenght_other)) // convert the xml json string to normal string
{ $tmpfield['settings']->xml = $this->setDynamicValues(json_decode($field['settings']->history->xml));
$this->setUpdateSQL($field['settings']->history->datalenght . $field['settings']->history->datalenght_other, $field['settings']->datalenght . $field['settings']->datalenght_other, 'field.lenght', $name_single . '.' . $field_name); // add properties from current field as it is generic
} $tmpfield['settings']->properties = $field['settings']->properties;
// check if the name changed // add the old name
if (isset($field['settings']->history->xml) && ComponentbuilderHelper::checkJson($field['settings']->history->xml)) $tmpfield['settings']->name = $field['settings']->history->name;
{ // add the field type from current field since it is generic
// only run if this is not an alias or a tag $tmpfield['settings']->type_name = $field['settings']->type_name;
if ((!isset($field['alias']) || !$field['alias']) && 'tag' !== $field['settings']->type_name) // get the old name
{ $old_field_name = $this->getFieldName($tmpfield);
// build temp field bucket
$tmpfield = array();
$tmpfield['settings'] = new stdClass();
// convert the xml json string to normal string
$tmpfield['settings']->xml = $this->setDynamicValues(json_decode($field['settings']->history->xml));
// add properties from current field as it is generic
$tmpfield['settings']->properties = $field['settings']->properties;
// add the old name
$tmpfield['settings']->name = $field['settings']->history->name;
// add the field type from current field since it is generic
$tmpfield['settings']->type_name = $field['settings']->type_name;
// get the old name
$old_field_name = $this->getFieldName($tmpfield);
// only run this if not a multi field // only run this if not a multi field
if (!isset($this->uniqueNames[$name_list]['names'][$field_name])) if (!isset($this->uniqueNames[$name_list]['names'][$field_name]))
{ {
// this only works when the field is not multiple of the same field // this only works when the field is not multiple of the same field
$this->setUpdateSQL($old_field_name, $field_name, 'field.name', $name_single . '.' . $field_name); $this->setUpdateSQL($old_field_name, $field_name, 'field.name', $name_single . '.' . $field_name);
}
elseif ($old_field_name !== $field_name)
{
// give a notice atleast that the multi fields could have changed and no DB update was done
$this->app->enqueueMessage(JText::sprintf('You have a field called <b>%s</b> that has been added multiple times to the <b>%s</b> view, the name of that field has changed to <b>%s</b>. Normaly we would automaticly add the update SQL to your component, but with multiple fields this does not work automaticly since it could be that noting changed and it just seems like it did. Therefore you will have to do this manualy if it actualy did change!', $field_name, $name_single, $old_field_name), 'Notice');
}
// remove tmp
unset($tmpfield);
} }
elseif ($old_field_name !== $field_name)
{
// give a notice atleast that the multi fields could have changed and no DB update was done
$this->app->enqueueMessage(JText::sprintf('You have a field called <b>%s</b> that has been added multiple times to the <b>%s</b> view, the name of that field has changed to <b>%s</b>. Normaly we would automaticly add the update SQL to your component, but with multiple fields this does not work automaticly since it could be that noting changed and it just seems like it did. Therefore you will have to do this manualy if it actualy did change!', $field_name, $name_single, $old_field_name), 'Notice');
}
// remove tmp
unset($tmpfield);
} }
} }
} }
@ -2498,6 +2511,11 @@ class Get
*/ */
public function getFieldType(&$field) public function getFieldType(&$field)
{ {
// check if we have done this already
if (isset($field['type_name']))
{
return $field['type_name'];
}
// set the type name // set the type name
$type_name = ComponentbuilderHelper::safeString($field['settings']->type_name); $type_name = ComponentbuilderHelper::safeString($field['settings']->type_name);
// check that we have the poperties // check that we have the poperties
@ -2507,16 +2525,17 @@ class Get
{ {
if ($property['name'] === 'type') if ($property['name'] === 'type')
{ {
// if custom (we must use the xml value)
if ($type_name === 'custom' || $type_name === 'customuser') if ($type_name === 'custom' || $type_name === 'customuser')
{ {
$type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); $type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"'));
} }
// use field core type // use field core type (name)
elseif (ComponentbuilderHelper::checkString($type_name)) elseif (ComponentbuilderHelper::checkString($type_name) || (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0))
{ {
$type = $type_name; $type = $type_name;
} }
// make sure none adjustable fields are set (should be same as above) // make sure none adjustable fields are set (should be same as above) (TODO) hmmm we need look at this again
elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0) elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0)
{ {
$type = $property['example']; $type = $property['example'];
@ -3022,11 +3041,12 @@ class Get
* @param mix $new The new values * @param mix $new The new values
* @param string $type The type of values * @param string $type The type of values
* @param int $key The id/key where values changed * @param int $key The id/key where values changed
* @param array $ignore The ids to ignore
* *
* @return void * @return void
* *
*/ */
protected function setUpdateSQL($old, $new, $type, $key = null) protected function setUpdateSQL($old, $new, $type, $key = null, $ignore = null)
{ {
// check if there were new items added // check if there were new items added
if (ComponentbuilderHelper::checkArray($new) && ComponentbuilderHelper::checkArray($old)) if (ComponentbuilderHelper::checkArray($new) && ComponentbuilderHelper::checkArray($old))
@ -3037,8 +3057,14 @@ class Get
foreach ($new[$type] as $item) foreach ($new[$type] as $item)
{ {
$newItem = true; $newItem = true;
// check if this is an id to ignore
if (ComponentbuilderHelper::checkArray($ignore) && in_array($item, $ignore))
{
// don't add ignored ids
$newItem = false;
}
// check if this is old repeatable field // check if this is old repeatable field
if (isset($old[$type]) && ComponentbuilderHelper::checkArray($old[$type])) elseif (isset($old[$type]) && ComponentbuilderHelper::checkArray($old[$type]))
{ {
if (!in_array($item, $old[$type])) if (!in_array($item, $old[$type]))
{ {
@ -3084,12 +3110,18 @@ class Get
{ {
foreach ($new as $item) foreach ($new as $item)
{ {
// search to see if this is a new value
$newItem = true;
if (isset($item[$type])) if (isset($item[$type]))
{ {
// search to see if this is a new value
$newItem = true;
// check if this is an id to ignore
if (ComponentbuilderHelper::checkArray($ignore) && in_array($item[$type], $ignore))
{
// don't add ignored ids
$newItem = false;
}
// check if this is old repeatable field // check if this is old repeatable field
if (isset($old[$type]) && ComponentbuilderHelper::checkArray($old[$type])) elseif (isset($old[$type]) && ComponentbuilderHelper::checkArray($old[$type]))
{ {
if (in_array($item[$type], $old[$type])) if (in_array($item[$type], $old[$type]))
{ {
@ -3120,16 +3152,12 @@ class Get
{ {
$newItem = false; $newItem = false;
} }
} // add if new
else if ($newItem)
{ {
break; // we have a new item, lets add to SQL
} $this->setAddSQL($type, $item[$type], $key);
// add if new }
if ($newItem)
{
// we have a new item, lets add to SQL
$this->setAddSQL($type, $item[$type], $key);
} }
} }
} }

View File

@ -319,13 +319,6 @@ class Fields extends Structure
*/ */
public $fieldsNames = array(); public $fieldsNames = array();
/**
* Default Fields
*
* @var array
*/
public $defaultFields = array('created', 'created_by', 'modified', 'modified_by', 'published', 'ordering', 'access', 'version', 'hits', 'id');
/** /**
* Default Fields set to publishing * Default Fields set to publishing
* *

View File

@ -4226,16 +4226,16 @@ abstract class ComponentbuilderHelper
{ {
if ($external) if ($external)
{ {
if ($name = self::getVar(null, $val, $id, $name, '=', $table)) if ($_name = self::getVar(null, $val, $id, $name, '=', $table))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
else else
{ {
if ($name = self::getVar($table, $val, $id, $name)) if ($_name = self::getVar($table, $val, $id, $name))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
} }

View File

@ -1508,14 +1508,14 @@ INSERT INTO `#__componentbuilder_snippet` (`id`, `contributor_company`, `contrib
-- --
INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`, `add_javascript_view_footer`, `add_javascript_views_footer`, `catid`, `css_view`, `css_views`, `datadefault`, `datadefault_other`, `datalenght`, `datalenght_other`, `datatype`, `indexes`, `javascript_view_footer`, `javascript_views_footer`, `name`, `null_switch`, `store`, `fieldtype`, `xml`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`, `add_javascript_view_footer`, `add_javascript_views_footer`, `catid`, `css_view`, `css_views`, `datadefault`, `datadefault_other`, `datalenght`, `datalenght_other`, `datatype`, `indexes`, `javascript_view_footer`, `javascript_views_footer`, `name`, `null_switch`, `store`, `fieldtype`, `xml`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES
(23, '', '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Alias', 'NOT NULL', '', 24, '\"<field type=\\\"text\\\" name=\\\"alias\\\" label=\\\"Alias\\\" filter=\\\"STRING\\\" hint=\\\"Auto-generated from name\\\"\\/>\"', 1, '2015-04-09 13:46:04', '2016-05-05 22:30:18', 2, '', 216), (23, '', '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Alias', 'NOT NULL', '', 24, '\"<field type=\\\"text\\\" name=\\\"alias\\\" label=\\\"Alias\\\" filter=\\\"STRING\\\" hint=\\\"Auto-generated from name\\\"\\/>\"', 1, '2015-04-09 13:46:04', '2018-07-12 04:14:35', 2, '', 216),
(84, '', '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NOT NULL', '', 25, '\"<field \\r\\n\\ttype=\\\"textarea\\\" \\r\\n\\tname=\\\"description\\\" \\r\\n\\tlabel=\\\"Description\\\" \\r\\n\\trows=\\\"11\\\" \\r\\n\\tcols=\\\"10\\\" \\r\\n\\tdescription=\\\"Add Description Here\\\" \\r\\n\\tclass=\\\"text_area span12\\\" \\r\\n\\tfilter=\\\"HTML\\\" \\r\\n\\thint=\\\"Add Description Here\\\" \\r\\n\\/>\"', 1, '2015-03-19 18:20:49', '2016-10-20 17:01:21', 4, '', 265), (84, '', '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NOT NULL', '', 25, '\"<field \\r\\n\\ttype=\\\"textarea\\\" \\r\\n\\tname=\\\"description\\\" \\r\\n\\tlabel=\\\"Description\\\" \\r\\n\\trows=\\\"11\\\" \\r\\n\\tcols=\\\"10\\\" \\r\\n\\tdescription=\\\"Add Description Here\\\" \\r\\n\\tclass=\\\"text_area span12\\\" \\r\\n\\tfilter=\\\"HTML\\\" \\r\\n\\thint=\\\"Add Description Here\\\" \\r\\n\\/>\"', 1, '2015-03-19 18:20:49', '2018-07-12 04:14:35', 4, '', 265),
(100, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Email (required)', 'NOT NULL', '', 24, '\"<field \\r\\n\\ttype=\\\"text\\\" \\r\\n\\tname=\\\"email\\\" \\r\\n\\tlabel=\\\"Email\\\" \\r\\n\\tsize=\\\"10\\\" \\r\\n\\tmaxlength=\\\"50\\\" \\r\\n\\tdescription=\\\"Enter Email\\\" \\r\\n\\tclass=\\\"text_area\\\"\\r\\n\\tfilter=\\\"STRING\\\" \\r\\n\\tvalidate=\\\"email\\\" \\r\\n\\trequired=\\\"true\\\"\\r\\n\\tmessage=\\\"Error! Please add email address here.\\\" \\r\\n\\thint=\\\"demo@example.com\\\" \\r\\n\\/>\"', 1, '2015-05-05 23:44:32', '2016-02-07 22:43:18', 4, '', 285), (100, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Email (required)', 'NOT NULL', '', 24, '\"<field \\r\\n\\ttype=\\\"text\\\" \\r\\n\\tname=\\\"email\\\" \\r\\n\\tlabel=\\\"Email\\\" \\r\\n\\tsize=\\\"10\\\" \\r\\n\\tmaxlength=\\\"50\\\" \\r\\n\\tdescription=\\\"Enter Email\\\" \\r\\n\\tclass=\\\"text_area\\\"\\r\\n\\tfilter=\\\"STRING\\\" \\r\\n\\tvalidate=\\\"email\\\" \\r\\n\\trequired=\\\"true\\\"\\r\\n\\tmessage=\\\"Error! Please add email address here.\\\" \\r\\n\\thint=\\\"demo@example.com\\\" \\r\\n\\/>\"', 1, '2015-05-05 23:44:32', '2016-02-07 22:43:18', 4, '', 285),
(158, '', '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Image', 'NOT NULL', '', 12, '\"<field \\r\\n\\ttype=\\\"media\\\" \\r\\n\\tname=\\\"image\\\" \\r\\n\\tlabel=\\\"Image\\\" \\r\\n\\tdescription=\\\"\\\" \\r\\n\\tdirectory=\\\"\\\" \\r\\n\\/>\"', 1, '2015-04-29 14:00:56', '2015-08-25 21:15:22', 1, '', 45), (158, '', '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Image', 'NOT NULL', '', 12, '\"<field \\r\\n\\ttype=\\\"media\\\" \\r\\n\\tname=\\\"image\\\" \\r\\n\\tlabel=\\\"Image\\\" \\r\\n\\tdescription=\\\"\\\" \\r\\n\\tdirectory=\\\"\\\" \\r\\n\\/>\"', 1, '2015-04-29 14:00:56', '2015-08-25 21:15:22', 1, '', 45),
(196, '', '', '', '', '', '', '', '', '', 64, '', 'VARCHAR', '', '', '', 'Mobile Phone', 'NOT NULL', '', 23, '\"<field type=\\\"text\\\" \\r\\nname=\\\"mobile_phone\\\" \\r\\nlabel=\\\"Mobile Phone\\\" \\r\\nsize=\\\"10\\\" \\r\\nmaxlength=\\\"50\\\" \\r\\ndefault=\\\"\\\" \\r\\ndescription=\\\"Enter Mobile Phone Number\\\" \\r\\nclass=\\\"text_area\\\" \\r\\nfilter=\\\"STRING\\\" \\r\\nvalidated=\\\"tel\\\" \\r\\nrequired=\\\"true\\\" \\r\\nmessage=\\\"Error! Please add mobile phone number here.\\\" \\r\\nhint=\\\"Mobile Phone Here\\\" \\/>\"', 1, '2015-04-07 22:12:58', '2016-03-28 14:00:02', 2, '', 7), (196, '', '', '', '', '', '', '', '', '', 64, '', 'VARCHAR', '', '', '', 'Mobile Phone', 'NOT NULL', '', 23, '\"<field type=\\\"text\\\" \\r\\nname=\\\"mobile_phone\\\" \\r\\nlabel=\\\"Mobile Phone\\\" \\r\\nsize=\\\"10\\\" \\r\\nmaxlength=\\\"50\\\" \\r\\ndefault=\\\"\\\" \\r\\ndescription=\\\"Enter Mobile Phone Number\\\" \\r\\nclass=\\\"text_area\\\" \\r\\nfilter=\\\"STRING\\\" \\r\\nvalidated=\\\"tel\\\" \\r\\nrequired=\\\"true\\\" \\r\\nmessage=\\\"Error! Please add mobile phone number here.\\\" \\r\\nhint=\\\"Mobile Phone Here\\\" \\/>\"', 1, '2015-04-07 22:12:58', '2016-03-28 14:00:02', 2, '', 7),
(199, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name', 'NOT NULL', '', 24, '\"<field\\r\\n\\ttype=\\\"text\\\" \\r\\n\\tname=\\\"name\\\" \\r\\n\\tlabel=\\\"Name\\\" \\r\\n\\tsize=\\\"40\\\" \\r\\n\\tmaxlength=\\\"150\\\" \\r\\n\\tdescription=\\\"Enter Name Here\\\" \\r\\n\\tclass=\\\"text_area\\\" \\r\\n\\treadonly=\\\"false\\\" \\r\\n\\tdisabled=\\\"false\\\" \\r\\n\\trequired=\\\"true\\\"\\r\\n\\tfilter=\\\"STRING\\\" \\r\\n\\tmessage=\\\"Error! Please add name here.\\\" \\r\\n\\thint=\\\"Name Here\\\" \\r\\n\\/>\"', 1, '2015-03-19 17:30:59', '2017-10-25 20:26:02', 8, '', 4), (199, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name', 'NOT NULL', '', 24, '\"<field\\r\\n\\ttype=\\\"text\\\" \\r\\n\\tname=\\\"name\\\" \\r\\n\\tlabel=\\\"Name\\\" \\r\\n\\tsize=\\\"40\\\" \\r\\n\\tmaxlength=\\\"150\\\" \\r\\n\\tdescription=\\\"Enter Name Here\\\" \\r\\n\\tclass=\\\"text_area\\\" \\r\\n\\treadonly=\\\"false\\\" \\r\\n\\tdisabled=\\\"false\\\" \\r\\n\\trequired=\\\"true\\\"\\r\\n\\tfilter=\\\"STRING\\\" \\r\\n\\tmessage=\\\"Error! Please add name here.\\\" \\r\\n\\thint=\\\"Name Here\\\" \\r\\n\\/>\"', 1, '2015-03-19 17:30:59', '2018-07-12 04:14:35', 8, '', 4),
(203, '', '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"<field \\r\\n\\ttype=\\\"hidden\\\" \\r\\n\\tname=\\\"not_required\\\" \\r\\n\\tdefault=\\\"[]\\\" \\r\\n\\/>\"', 1, '2015-05-08 16:19:16', '2015-08-25 21:15:22', 1, '', 19), (203, '', '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"<field \\r\\n\\ttype=\\\"hidden\\\" \\r\\n\\tname=\\\"not_required\\\" \\r\\n\\tdefault=\\\"[]\\\" \\r\\n\\/>\"', 1, '2015-05-08 16:19:16', '2018-07-12 04:14:35', 1, '', 19),
(280, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"<field\\n\\ttype=\\\"url\\\"\\n\\tname=\\\"website\\\"\\n\\tlabel=\\\"Website\\\"\\n\\tsize=\\\"60\\\"\\n\\tmaxlength=\\\"150\\\"\\n\\tdescription=\\\"Enter website address\\\"\\n\\tclass=\\\"text_area\\\"\\n\\tfilter=\\\"url\\\"\\n\\tvalidated=\\\"url\\\"\\n\\tmessage=\\\"Error! Please add website here.\\\"\\n\\thint=\\\"http:\\/\\/www.example.com\\\"\\n\\tscheme=\\\"http,https\\\"\\n\\/>\"', 1, '2015-04-08 00:36:16', '2018-07-08 00:11:05', 2, '', 105), (280, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"<field\\n\\ttype=\\\"url\\\"\\n\\tname=\\\"website\\\"\\n\\tlabel=\\\"Website\\\"\\n\\tsize=\\\"60\\\"\\n\\tmaxlength=\\\"150\\\"\\n\\tdescription=\\\"Enter website address\\\"\\n\\tclass=\\\"text_area\\\"\\n\\tfilter=\\\"url\\\"\\n\\tvalidated=\\\"url\\\"\\n\\tmessage=\\\"Error! Please add website here.\\\"\\n\\thint=\\\"http:\\/\\/www.example.com\\\"\\n\\tscheme=\\\"http,https\\\"\\n\\/>\"', 1, '2015-04-08 00:36:16', '2018-07-12 04:14:35', 2, '', 105),
(682, '', '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add More', 'NOT NULL', '', 17, '\"<field \\r\\n\\ttype=\\\"radio\\\" \\r\\n\\tname=\\\"add\\\" \\r\\n\\tlabel=\\\"Add More\\\" \\r\\n\\tdescription=\\\"\\\" \\r\\n\\tclass=\\\"btn-group btn-group-yesno\\\" \\r\\n\\toption=\\\"1|Yes,0|No\\\" \\r\\n\\tdefault=\\\"0\\\" \\r\\n\\trequired=\\\"true\\\" \\r\\n\\/>\"', 1, '2015-08-05 01:18:20', '2018-03-30 09:30:45', 4, '', 196), (682, '', '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add More', 'NOT NULL', '', 17, '\"<field \\r\\n\\ttype=\\\"radio\\\" \\r\\n\\tname=\\\"add\\\" \\r\\n\\tlabel=\\\"Add More\\\" \\r\\n\\tdescription=\\\"\\\" \\r\\n\\tclass=\\\"btn-group btn-group-yesno\\\" \\r\\n\\toption=\\\"1|Yes,0|No\\\" \\r\\n\\tdefault=\\\"0\\\" \\r\\n\\trequired=\\\"true\\\" \\r\\n\\/>\"', 1, '2015-08-05 01:18:20', '2018-03-30 09:30:45', 4, '', 196),
(1011, '', '', '', '', '', '', '', 'Other', '0000-00-00', '', '', 'DATE', '', '', '', 'Date of Birth', 'NOT NULL', '', 1, '\"<field \\r\\n\\ttype=\\\"calendar\\\" \\r\\n\\tname=\\\"dateofbirth\\\" \\r\\n\\tlabel=\\\"Date of Birth\\\" \\r\\n\\tdefault=\\\"1970-01-01\\\" \\r\\n\\tdescription=\\\"Your date of birth\\\" \\r\\n\\tclass=\\\"\\\" \\r\\n\\tformat=\\\"%Y-%m-%d\\\" \\r\\n\\tfilter=\\\"\\\" \\r\\n\\trequired=\\\"\\\" \\r\\n\\/>\"', 1, '2015-12-07 01:47:32', '2015-12-07 02:15:24', 3, '', 649); (1011, '', '', '', '', '', '', '', 'Other', '0000-00-00', '', '', 'DATE', '', '', '', 'Date of Birth', 'NOT NULL', '', 1, '\"<field \\r\\n\\ttype=\\\"calendar\\\" \\r\\n\\tname=\\\"dateofbirth\\\" \\r\\n\\tlabel=\\\"Date of Birth\\\" \\r\\n\\tdefault=\\\"1970-01-01\\\" \\r\\n\\tdescription=\\\"Your date of birth\\\" \\r\\n\\tclass=\\\"\\\" \\r\\n\\tformat=\\\"%Y-%m-%d\\\" \\r\\n\\tfilter=\\\"\\\" \\r\\n\\trequired=\\\"\\\" \\r\\n\\/>\"', 1, '2015-12-07 01:47:32', '2015-12-07 02:15:24', 3, '', 649);
@ -1567,7 +1567,7 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `catid`, `description`, `name
-- --
INSERT INTO `#__componentbuilder_language` (`id`, `langtag`, `name`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES INSERT INTO `#__componentbuilder_language` (`id`, `langtag`, `name`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES
(1, 'af-ZA', 'Afrikaans', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), (1, 'af-ZA', 'Afrikaans', '', 1, '2018-04-19 13:43:44', '2018-07-12 04:14:35', 1, '', 1),
(2, 'sq-AL', 'Albanian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), (2, 'sq-AL', 'Albanian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1),
(3, 'ar-AA', 'Arabic Unitag', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), (3, 'ar-AA', 'Arabic Unitag', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1),
(4, 'hy-AM', 'Armenian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), (4, 'hy-AM', 'Armenian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1),

View File

@ -36,13 +36,14 @@ JHtml::_('behavior.keepalive');
<?php else: ?> <?php else: ?>
Joomla.submitbutton = function(task) Joomla.submitbutton = function(task)
{ {
if ('refresh' === task){ if ('joomla_component.refresh' === task){
jQuery('#loading').css('display', 'block'); jQuery('#loading').css('display', 'block');
// clear the history // clear the history
jQuery.jStorage.flush(); jQuery.jStorage.flush();
// now start the update // now start the update
autoJCBpackageInfo(); autoJCBpackageInfo();
jQuery('#loading').hide(); // also clear the session memory around the component list
Joomla.submitform(task);
} else { } else {
var form = document.getElementById('adminForm'); var form = document.getElementById('adminForm');
// do field validation // do field validation

View File

@ -59,7 +59,7 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy
// add title to the page // add title to the page
JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_IMPORT'),'upload'); JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_IMPORT'),'upload');
// add refesh button. // add refesh button.
JToolBarHelper::custom('refresh', 'refresh', '', 'COM_COMPONENTBUILDER_REFRESH', false); JToolBarHelper::custom('joomla_component.refresh', 'refresh', '', 'COM_COMPONENTBUILDER_REFRESH', false);
} }
// get the session object // get the session object
$session = JFactory::getSession(); $session = JFactory::getSession();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>10th July, 2018</creationDate> <creationDate>12th July, 2018</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>

View File

@ -3604,16 +3604,16 @@ abstract class ComponentbuilderHelper
{ {
if ($external) if ($external)
{ {
if ($name = self::getVar(null, $val, $id, $name, '=', $table)) if ($_name = self::getVar(null, $val, $id, $name, '=', $table))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
else else
{ {
if ($name = self::getVar($table, $val, $id, $name)) if ($_name = self::getVar($table, $val, $id, $name))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
} }