From 0a7b91829f9c09ab7aef94cbe05a16c924102f11 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 12 Jul 2018 18:35:38 +0200 Subject: [PATCH] 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. --- README.md | 4 +- admin/README.txt | 4 +- admin/compiler/joomla_3/Helper.php | 8 +- admin/compiler/joomla_3/Helper_site.php | 8 +- admin/controllers/joomla_component.php | 25 ++ admin/controllers/joomla_components.php | 4 + admin/helpers/compiler/a_Get.php | 238 ++++++++++-------- admin/helpers/compiler/c_Fields.php | 7 - admin/helpers/componentbuilder.php | 8 +- admin/sql/install.mysql.utf8.sql | 12 +- .../import_joomla_components/tmpl/default.php | 5 +- .../import_joomla_components/view.html.php | 2 +- componentbuilder.xml | 2 +- site/helpers/componentbuilder.php | 8 +- 14 files changed, 193 insertions(+), 142 deletions(-) diff --git a/README.md b/README.md index 770ab2761..d2894352b 100644 --- a/README.md +++ b/README.md @@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 10th July, 2018 ++ *Last Build*: 12th July, 2018 + *Version*: 2.8.4 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **186333** ++ *Line count*: **186363** + *Field count*: **1059** + *File count*: **1239** + *Folder count*: **197** diff --git a/admin/README.txt b/admin/README.txt index 770ab2761..d2894352b 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 10th July, 2018 ++ *Last Build*: 12th July, 2018 + *Version*: 2.8.4 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **186333** ++ *Line count*: **186363** + *Field count*: **1059** + *File count*: **1239** + *Folder count*: **197** diff --git a/admin/compiler/joomla_3/Helper.php b/admin/compiler/joomla_3/Helper.php index f49a9d300..01ec957b5 100644 --- a/admin/compiler/joomla_3/Helper.php +++ b/admin/compiler/joomla_3/Helper.php @@ -248,16 +248,16 @@ abstract class ###Component###Helper { 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 { - if ($name = self::getVar($table, $val, $id, $name)) + if ($_name = self::getVar($table, $val, $id, $name)) { - $names[] = $name; + $names[] = $_name; } } } diff --git a/admin/compiler/joomla_3/Helper_site.php b/admin/compiler/joomla_3/Helper_site.php index 0e81e73de..f12faa37d 100644 --- a/admin/compiler/joomla_3/Helper_site.php +++ b/admin/compiler/joomla_3/Helper_site.php @@ -58,16 +58,16 @@ abstract class ###Component###Helper { 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 { - if ($name = self::getVar($table, $val, $id, $name)) + if ($_name = self::getVar($table, $val, $id, $name)) { - $names[] = $name; + $names[] = $_name; } } } diff --git a/admin/controllers/joomla_component.php b/admin/controllers/joomla_component.php index fbebe0efc..8d59fcfc4 100644 --- a/admin/controllers/joomla_component.php +++ b/admin/controllers/joomla_component.php @@ -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. 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; } /** diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index 218bc8cb7..dfc2ed157 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -97,6 +97,8 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin public function smartImport() { + // 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')) @@ -355,6 +357,8 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin public function cloner() { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); // Get the model $model = $this->getModel('Joomla_components'); // check if export is allowed for this user. diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index a227d967e..5e10222cc 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -494,6 +494,13 @@ class Get */ 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 * @@ -1540,112 +1547,118 @@ class Get $view->addfields = (isset($view->addfields) && ComponentbuilderHelper::checkJson($view->addfields)) ? json_decode($view->addfields, true) : null; 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 if ($old_view = $this->getHistoryWatch('admin_fields', $view->addfields_id)) { // add new fields were added 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 unset($old_view); } - if (ComponentbuilderHelper::checkArray($view->addfields)) + // sort the fields acording to order + usort($view->fields, function($a, $b) { - // load the field data - $view->fields = array_map(function($field) use($name_single, $name_list) + if (isset($a['order_list']) && isset($b['order_list'])) { - // 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 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) { - 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 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)) + elseif ($a['order_list'] != 0 && $b['order_list'] == 0) { - // check if the datatype changed - if (isset($field['settings']->history->datatype)) + return 0; + } + 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); - } - // 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) - { - // 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); + // 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 - if (!isset($this->uniqueNames[$name_list]['names'][$field_name])) - { - // 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); - } - 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 %s that has been added multiple times to the %s view, the name of that field has changed to %s. 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); + // only run this if not a multi field + if (!isset($this->uniqueNames[$name_list]['names'][$field_name])) + { + // 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); } + 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 %s that has been added multiple times to the %s view, the name of that field has changed to %s. 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) { + // check if we have done this already + if (isset($field['type_name'])) + { + return $field['type_name']; + } // set the type name $type_name = ComponentbuilderHelper::safeString($field['settings']->type_name); // check that we have the poperties @@ -2507,16 +2525,17 @@ class Get { if ($property['name'] === 'type') { + // if custom (we must use the xml value) if ($type_name === 'custom' || $type_name === 'customuser') { $type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); } - // use field core type - elseif (ComponentbuilderHelper::checkString($type_name)) + // use field core type (name) + elseif (ComponentbuilderHelper::checkString($type_name) || (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0)) { $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) { $type = $property['example']; @@ -3022,11 +3041,12 @@ class Get * @param mix $new The new values * @param string $type The type of values * @param int $key The id/key where values changed + * @param array $ignore The ids to ignore * * @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 if (ComponentbuilderHelper::checkArray($new) && ComponentbuilderHelper::checkArray($old)) @@ -3037,8 +3057,14 @@ class Get foreach ($new[$type] as $item) { $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 - if (isset($old[$type]) && ComponentbuilderHelper::checkArray($old[$type])) + elseif (isset($old[$type]) && ComponentbuilderHelper::checkArray($old[$type])) { if (!in_array($item, $old[$type])) { @@ -3084,12 +3110,18 @@ class Get { foreach ($new as $item) { - // search to see if this is a new value - $newItem = true; 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 - if (isset($old[$type]) && ComponentbuilderHelper::checkArray($old[$type])) + elseif (isset($old[$type]) && ComponentbuilderHelper::checkArray($old[$type])) { if (in_array($item[$type], $old[$type])) { @@ -3120,16 +3152,12 @@ class Get { $newItem = false; } - } - else - { - break; - } - // add if new - if ($newItem) - { - // 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); + } } } } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index c5d0d4da1..a2cbe27ce 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -319,13 +319,6 @@ class Fields extends Structure */ 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 * diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index c0866db2d..a263c9289 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -4226,16 +4226,16 @@ abstract class ComponentbuilderHelper { 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 { - if ($name = self::getVar($table, $val, $id, $name)) + if ($_name = self::getVar($table, $val, $id, $name)) { - $names[] = $name; + $names[] = $_name; } } } diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 29259a3d8..f997e0d77 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -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 -(23, '', '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Alias', 'NOT NULL', '', 24, '\"\"', 1, '2015-04-09 13:46:04', '2016-05-05 22:30:18', 2, '', 216), -(84, '', '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NOT NULL', '', 25, '\"\"', 1, '2015-03-19 18:20:49', '2016-10-20 17:01:21', 4, '', 265), +(23, '', '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Alias', 'NOT NULL', '', 24, '\"\"', 1, '2015-04-09 13:46:04', '2018-07-12 04:14:35', 2, '', 216), +(84, '', '', '', '', '', '', '', '', '', '', '', 'TEXT', '', '', '', 'Description (full width)', 'NOT NULL', '', 25, '\"\"', 1, '2015-03-19 18:20:49', '2018-07-12 04:14:35', 4, '', 265), (100, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Email (required)', 'NOT NULL', '', 24, '\"\"', 1, '2015-05-05 23:44:32', '2016-02-07 22:43:18', 4, '', 285), (158, '', '', '', '', '', '', '', '', '', 64, '', 'CHAR', '', '', '', 'Image', 'NOT NULL', '', 12, '\"\"', 1, '2015-04-29 14:00:56', '2015-08-25 21:15:22', 1, '', 45), (196, '', '', '', '', '', '', '', '', '', 64, '', 'VARCHAR', '', '', '', 'Mobile Phone', 'NOT NULL', '', 23, '\"\"', 1, '2015-04-07 22:12:58', '2016-03-28 14:00:02', 2, '', 7), -(199, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name', 'NOT NULL', '', 24, '\"\"', 1, '2015-03-19 17:30:59', '2017-10-25 20:26:02', 8, '', 4), -(203, '', '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"\"', 1, '2015-05-08 16:19:16', '2015-08-25 21:15:22', 1, '', 19), -(280, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"\"', 1, '2015-04-08 00:36:16', '2018-07-08 00:11:05', 2, '', 105), +(199, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', 2, '', '', 'Name', 'NOT NULL', '', 24, '\"\"', 1, '2015-03-19 17:30:59', '2018-07-12 04:14:35', 8, '', 4), +(203, '', '', '', '', '', '', '', '', '', 1, '', 'INT', '', '', '', 'Not Required', 'NOT NULL', '', 9, '\"\"', 1, '2015-05-08 16:19:16', '2018-07-12 04:14:35', 1, '', 19), +(280, '', '', '', '', '', '', '', '', '', 255, '', 'VARCHAR', '', '', '', 'Website', 'NOT NULL', '', 27, '\"\"', 1, '2015-04-08 00:36:16', '2018-07-12 04:14:35', 2, '', 105), (682, '', '', '', '', '', '', '', '', '', 1, '', 'TINYINT', 2, '', '', 'Add More', 'NOT NULL', '', 17, '\"\"', 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, '\"\"', 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 -(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), (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), diff --git a/admin/views/import_joomla_components/tmpl/default.php b/admin/views/import_joomla_components/tmpl/default.php index 723d704b0..99a49a51e 100644 --- a/admin/views/import_joomla_components/tmpl/default.php +++ b/admin/views/import_joomla_components/tmpl/default.php @@ -36,13 +36,14 @@ JHtml::_('behavior.keepalive'); Joomla.submitbutton = function(task) { - if ('refresh' === task){ + if ('joomla_component.refresh' === task){ jQuery('#loading').css('display', 'block'); // clear the history jQuery.jStorage.flush(); // now start the update autoJCBpackageInfo(); - jQuery('#loading').hide(); + // also clear the session memory around the component list + Joomla.submitform(task); } else { var form = document.getElementById('adminForm'); // do field validation diff --git a/admin/views/import_joomla_components/view.html.php b/admin/views/import_joomla_components/view.html.php index 7e43f59f0..f65bda83b 100644 --- a/admin/views/import_joomla_components/view.html.php +++ b/admin/views/import_joomla_components/view.html.php @@ -59,7 +59,7 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy // add title to the page JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_IMPORT'),'upload'); // 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 $session = JFactory::getSession(); diff --git a/componentbuilder.xml b/componentbuilder.xml index 3dfe442a6..8117a79e7 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 10th July, 2018 + 12th July, 2018 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index ddf22f7fe..de39c242e 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -3604,16 +3604,16 @@ abstract class ComponentbuilderHelper { 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 { - if ($name = self::getVar($table, $val, $id, $name)) + if ($_name = self::getVar($table, $val, $id, $name)) { - $names[] = $name; + $names[] = $_name; } } }