From ee949fbe6e44c8255020edfffc555ed87135946b Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 11 Mar 2018 04:44:43 +0200 Subject: [PATCH] Expanded the automatic DB update feature, to insure that any changes to a field name/datatype/lenght will now also create a DB update, resolve gh-241 --- README.md | 4 +- admin/README.txt | 4 +- admin/assets/css/dynamic_get.css | 1 + admin/config.xml | 12 +- admin/helpers/compiler/a_Get.php | 356 ++++++++++++++++-- admin/helpers/compiler/b_Structure.php | 10 +- admin/helpers/compiler/c_Fields.php | 271 +------------ admin/helpers/compiler/e_Interpretation.php | 91 +---- .../en-GB/en-GB.com_componentbuilder.ini | 4 +- .../joomla_component/settings_fullwidth.php | 2 +- .../joomla_component/settings_left.php | 6 +- .../joomla_component/settings_right.php | 4 +- admin/models/forms/admin_fields_conditions.js | 1 + admin/models/forms/admin_view.js | 1 + admin/models/forms/component_site_views.xml | 8 +- admin/models/forms/custom_admin_view.js | 1 + admin/models/forms/custom_code.js | 1 + admin/models/forms/dynamic_get.js | 1 + admin/models/forms/field.js | 1 + admin/models/forms/joomla_component.js | 1 + admin/models/forms/joomla_component.xml | 36 +- admin/models/forms/language_translation.js | 1 + admin/models/forms/layout.js | 1 + admin/models/forms/library.js | 1 + admin/models/forms/site_view.js | 1 + admin/models/forms/template.js | 1 + admin/sql/install.mysql.utf8.sql | 2 +- .../admin_fields_conditions/tmpl/edit.php | 1 + admin/views/admin_view/tmpl/edit.php | 3 +- admin/views/custom_admin_view/tmpl/edit.php | 3 +- admin/views/custom_code/tmpl/edit.php | 1 + admin/views/dynamic_get/tmpl/edit.php | 1 + admin/views/field/tmpl/edit.php | 1 + admin/views/joomla_component/tmpl/edit.php | 1 + .../views/language_translation/tmpl/edit.php | 1 + admin/views/layout/tmpl/edit.php | 3 +- admin/views/library/tmpl/edit.php | 1 + admin/views/site_view/tmpl/edit.php | 3 +- admin/views/template/tmpl/edit.php | 3 +- componentbuilder.xml | 2 +- 40 files changed, 440 insertions(+), 407 deletions(-) diff --git a/README.md b/README.md index 6862b8829..8aa1d87b5 100644 --- a/README.md +++ b/README.md @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 10th March, 2018 ++ *Last Build*: 11th March, 2018 + *Version*: 2.6.18 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **184097** ++ *Line count*: **184122** + *Field count*: **1651** + *File count*: **1172** + *Folder count*: **189** diff --git a/admin/README.txt b/admin/README.txt index 6862b8829..8aa1d87b5 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 10th March, 2018 ++ *Last Build*: 11th March, 2018 + *Version*: 2.6.18 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **184097** ++ *Line count*: **184122** + *Field count*: **1651** + *File count*: **1172** + *Folder count*: **189** diff --git a/admin/assets/css/dynamic_get.css b/admin/assets/css/dynamic_get.css index ea37532e5..f4cbb8a06 100644 --- a/admin/assets/css/dynamic_get.css +++ b/admin/assets/css/dynamic_get.css @@ -24,6 +24,7 @@ /* CSS Document */ + .fieldMedium { width: 80px !important; } diff --git a/admin/config.xml b/admin/config.xml index 4a12248d7..c373eab98 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -69,11 +69,11 @@ min="10" max="100" step="10" /> - + + class="spacer_hr_one" /> COM_COMPONENTBUILDER_CONFIG_EVERY_WEEK - + + class="spacer_hr_two" /> addconfig = (isset($component->addconfig) && ComponentbuilderHelper::checkJson($component->addconfig)) ? json_decode($component->addconfig, true) : null; if (ComponentbuilderHelper::checkArray($component->addconfig)) { - $component->config = array_map(function($array) + $component->config = array_map(function($field) { - $array['alias'] = 0; - $array['title'] = 0; - $array['settings'] = $this->getFieldData($array['field']); - return $array; + // set hash + static $hash = 1; + // load hash + $field['hash'] = md5($field['field'].$hash); + // increment hash + $hash++; + $field['alias'] = 0; + $field['title'] = 0; + // load the settings + $field['settings'] = $this->getFieldData($field['field']); + // set real field name + $field['base_name'] = $this->getFieldName($field); + // set unigue name keeper + $this->setUniqueNameCounter($this->getFieldName($field), 'configs'); + // return field + return $field; }, array_values($component->addconfig)); + + // do some house cleaning (for fields) + foreach ($component->config as $field) + { + // so first we lock the field name in + $this->getFieldName($field, 'configs'); + } // unset original value unset($component->addconfig); } @@ -1357,11 +1397,24 @@ class Get if (ComponentbuilderHelper::checkArray($view->addfields)) { // load the field data - $view->fields = array_map(function($array) use($name_single, $name_list) + $view->fields = array_map(function($field) use($name_single, $name_list) { - $array['settings'] = $this->getFieldData($array['field'], $name_single, $name_list); - return $array; + // set hash + static $hash = 1; + // 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) { @@ -1383,6 +1436,62 @@ class Get } 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)) + { + // 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) + { + // 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); + } + } + } + } } } unset($view->addfields); @@ -1418,16 +1527,10 @@ class Get $required = ($required == true) ? 'yes' : 'no'; $filter = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'filter="', '"'); $filter = ComponentbuilderHelper::checkString($filter) ? $filter : 'none'; - // get name - $name = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'name="', '"'); - $name = ComponentbuilderHelper::checkString($name) ? $name : $fieldValues['settings']->name; - // get type - $type = ComponentbuilderHelper::getBetween($fieldValues['settings']->xml, 'type="', '"'); - $type = ComponentbuilderHelper::checkString($type) ? $type : $fieldValues['settings']->type_name; // set the field name $conditionValue['target_field'][$fieldKey] = array( - 'name' => ComponentbuilderHelper::safeString($name), - 'type' => ComponentbuilderHelper::safeString($type), + 'name' => $this->getFieldName($fieldValues, $name_list), + 'type' => $this->getFieldType($fieldValues), 'required' => $required, 'filter' => $filter ); @@ -1444,15 +1547,11 @@ class Get { if ((int) $fieldValue['field'] == (int) $conditionValue['match_field']) { - // get name - $name = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml, 'name="', '"'); - $name = ComponentbuilderHelper::checkString($name) ? $name : $fieldValue['settings']->name; - // get type - $type = ComponentbuilderHelper::getBetween($fieldValue['settings']->xml, 'type="', '"'); - $type = ComponentbuilderHelper::checkString($type) ? $type : $fieldValue['settings']->type_name; + // set the type + $type = $this->getFieldType($fieldValue); // set the field details - $conditionValue['match_name'] = ComponentbuilderHelper::safeString($name); - $conditionValue['match_type'] = ComponentbuilderHelper::safeString($type); + $conditionValue['match_name'] = $this->getFieldName($fieldValue, $name_list); + $conditionValue['match_type'] = $type; $conditionValue['match_xml'] = $fieldValue['settings']->xml; // if custom field load field being extended if (!ComponentbuilderHelper::typeField($type)) @@ -1500,7 +1599,7 @@ class Get } $this->customScriptBuilder[$scripter_target][$name_single] = ''; } - $this->customScriptBuilder[$scripter_target][$name_single] .= $view->$scripter; + $this->customScriptBuilder[$scripter_target][$name_single] .= PHP_EOL . $view->$scripter; if (strpos($view->$scripter, "token") !== false || strpos($view->$scripter, "task=ajax") !== false) { if (!$this->customScriptBuilder['token'][$name_single]) @@ -1521,7 +1620,7 @@ class Get { $this->customScriptBuilder[$scripter][$name_single] = ''; } - $this->customScriptBuilder[$scripter][$name_single] .= base64_decode($view->$scripter); + $this->customScriptBuilder[$scripter][$name_single] .= PHP_EOL . base64_decode($view->$scripter); unset($view->$scripter); } } @@ -2076,7 +2175,7 @@ class Get $this->_fieldData[$id]->javascript_views_footer = $this->setDynamicValues(base64_decode($this->_fieldData[$id]->javascript_views_footer)); $this->_fieldData[$id]->javascript_views_footer_decoded = true; } - $this->customScriptBuilder['views_footer'][$name_list] .= $this->_fieldData[$id]->javascript_views_footer; + $this->customScriptBuilder['views_footer'][$name_list] .= PHP_EOL . $this->_fieldData[$id]->javascript_views_footer; if (strpos($this->_fieldData[$id]->javascript_views_footer, "token") !== false || strpos($this->_fieldData[$id]->javascript_views_footer, "task=ajax") !== false) { @@ -2108,7 +2207,7 @@ class Get $this->setCustomCodeData($this->_fieldData[$id]->css_views); $this->_fieldData[$id]->css_views_decoded = true; } - $this->customScriptBuilder['css_views'][$name_list] .= $this->_fieldData[$id]->css_views; + $this->customScriptBuilder['css_views'][$name_list] .= PHP_EOL . $this->_fieldData[$id]->css_views; } // add this only once to view. @@ -2123,6 +2222,207 @@ class Get return false; } + /** + * Get the field's actual type + * + * @param object $field The field object + * + * @return string Success returns field type + * + */ + public function getFieldType(&$field) + { + // set the type name + $type_name = ComponentbuilderHelper::safeString($field['settings']->type_name); + // check that we have the poperties + if (ComponentbuilderHelper::checkArray($field['settings']->properties)) + { + foreach ($field['settings']->properties as $property) + { + if ($property['name'] === 'type') + { + 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)) + { + $type = $type_name; + } + // make sure none adjustable fields are set (should be same as above) + elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0) + { + $type = $property['example']; + } + // fall back on the xml settings (not ideal) + else + { + $type = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); + } + + // check if the value is set + if (ComponentbuilderHelper::checkString($type)) + { + // add the value + return $type; + } + // exit foreach loop + break; + } + } + } + // fall back to text + return 'text'; + } + + /** + * Get the field's actual name + * + * @param object $field The field object + * @param string $listViewName The list view name + * + * @return string Success returns field name + * + */ + public function getFieldName(&$field, $listViewName = null) + { + // return the unique name if already set + if (ComponentbuilderHelper::checkString($listViewName) && isset($field['hash']) && isset($this->uniqueFieldNames[$listViewName.$field['hash']])) + { + return $this->uniqueFieldNames[$listViewName.$field['hash']]; + } + // set the type name + $type_name = ComponentbuilderHelper::safeString($field['settings']->type_name); + // set the name of the field + $name = ComponentbuilderHelper::safeString($field['settings']->name); + // check that we have the poperties + if (ComponentbuilderHelper::checkArray($field['settings']->properties)) + { + foreach ($field['settings']->properties as $property) + { + if ($property['name'] === 'name') + { + // if category then name must be catid (only one per view) + if ($type_name === 'category') + { + // quick check if this is a category linked to view page + $requeSt_id = ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"'); + if (strpos($requeSt_id, '_request_id') !== false || strpos($requeSt_id, '_request_catid') !== false) + { + // keep it then, don't change + $name = $requeSt_id; + } + else + { + $name = 'catid'; + } + // if list view name is set + if (ComponentbuilderHelper::checkString($listViewName)) + { + // check if we should use another Text Name as this views name + $otherName = ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'); + $otherViews = ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'); + $otherView = ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'); + if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView)) + { + $this->catOtherName[$listViewName] = array( + 'name' => ComponentbuilderHelper::safeString($otherName), + 'views' => ComponentbuilderHelper::safeString($otherViews), + 'view' => ComponentbuilderHelper::safeString($otherView) + ); + } + } + } + // if tag is set then enable all tag options for this view (only one per view) + elseif ($type_name === 'tag') + { + $name = 'tags'; + } + // if the field is set as alias it must be called alias + elseif (isset($field['alias']) && $field['alias']) + { + $name = 'alias'; + } + else + { + $name = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"')); + } + // exit foreach loop + break; + } + } + } + // return the value unique + if (ComponentbuilderHelper::checkString($listViewName) && isset($field['hash']) ) + { + $this->uniqueFieldNames[$listViewName.$field['hash']] = $this->uniqueName($name, $listViewName); + // now return the unique name + return $this->uniqueFieldNames[$listViewName.$field['hash']]; + } + // fall back to global + return $name; + } + + /** + * Count how many times the same field is used per view + * + * @param string $name The name of the field + * @param string $view The name of the view + * + * @return void + * + */ + protected function setUniqueNameCounter($name, $view) + { + if (!isset($this->uniqueNames[$view])) + { + $this->uniqueNames[$view] = array(); + $this->uniqueNames[$view]['counter'] = array(); + $this->uniqueNames[$view]['names'] = array(); + } + if (!isset($this->uniqueNames[$view]['counter'][$name])) + { + $this->uniqueNames[$view]['counter'][$name] = 1; + return; + } + // count how many times the field is used + $this->uniqueNames[$view]['counter'][$name] ++; + return; + } + + /** + * Naming each field with an unique name + * + * @param string $name The name of the field + * @param string $view The name of the view + * + * @return string the name + * + */ + protected function uniqueName($name, $view) + { + // only increment if the field name is used multiple times + if (isset($this->uniqueNames[$view]['counter'][$name]) && $this->uniqueNames[$view]['counter'][$name] > 1) + { + $counter = 1; + // set the unique name + $uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter); + while (isset($this->uniqueNames[$view]['names'][$uniqueName])) + { + // increment the number + $counter++; + // try again + $uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter); + } + // set the new name number + $this->uniqueNames[$view]['names'][$uniqueName] = $counter; + // return the unique name + return $uniqueName; + } + return $name; + } + /** * Set get Data * diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index 7f7646f21..d6c232d19 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -551,8 +551,8 @@ class Structure extends Get if (count($getter) == 2 && is_numeric($getter[1])) { // the pointers - $id = (int) $getter[1]; $t = ComponentbuilderHelper::safeString($getter[0], 'U'); + $id = (int) $getter[1]; // the dynamic stuff $targets = array('A' => 'admin_views', 'C' => 'custom_admin_views'); $names = array('A' => 'admin view', 'C' => 'custom admin view'); @@ -561,12 +561,14 @@ class Structure extends Get // check the target values if (isset($targets[$t]) && $id > 0) { + // set the type name + $type_names = ComponentbuilderHelper::safeString($targets[$t], 'w'); // set the dynamic dash if (isset($this->componentData->{$targets[$t]}) && ComponentbuilderHelper::checkArray($this->componentData->{$targets[$t]})) { // search the target views $dashboard = (array) array_filter($this->componentData->{$targets[$t]}, function($view) use($id, $t, $types){ - if (isset($view[$types[$t]]) && $id == (int) $view[$types[$t]]) + if (isset($view[$types[$t]]) && $id == $view[$types[$t]]) { return true; } @@ -579,16 +581,12 @@ class Structure extends Get } else { - // set the type name - $type_names = ComponentbuilderHelper::safeString($targets[$t], 'w'); // set massage that something is wrong $this->app->enqueueMessage(JText::sprintf('The %s (%s) is not available in your component! Please insure to only used %s, for a dynamic dashboard, that are still linked to your component.', $names[$t], $this->componentData->dashboard, $type_names), 'Error'); } } else { - // set the type name - $type_names = ComponentbuilderHelper::safeString($targets[$t], 'w'); // set massage that something is wrong $this->app->enqueueMessage(JText::sprintf('The %s (%s) is not available in your component! Please insure to only used %s, for a dynamic dashboard, that are still linked to your component.', $names[$t], $this->componentData->dashboard, $type_names), 'Error'); } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index ab6e28519..f7fe1ff82 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -75,13 +75,6 @@ class Fields extends Structure */ public $siteFieldData = array(); - /** - * Category other name bucket - * - * @var array - */ - public $catOtherName = array(); - /** * list of fields that are not being escaped * @@ -341,13 +334,6 @@ class Fields extends Structure */ public $fieldsNames = array(); - /** - * Set unique Names - * - * @var array - */ - public $uniqueNames = array(); - /** * Default Fields * @@ -461,22 +447,14 @@ class Fields extends Structure $this->langContent[$this->lang][$langView . '_VERSION_LABEL'] = "Revision"; $this->langContent[$this->lang][$langView . '_VERSION_DESC'] = "A count of the number of times this " . $view['settings']->name_single . " has been revised."; $this->langContent[$this->lang][$langView . '_SAVE_WARNING'] = "Alias already existed so a number was added at the end. You can re-edit the " . $view['settings']->name_single . " to customise the alias."; - - // check if the same field is added multiple times - foreach ($view['settings']->fields as $field) - { - $name = ComponentbuilderHelper::safeString($field['settings']->name); - $this->setUniqueNameKeeper($field, $view['settings']->type, $name, $viewName); - } // start adding dynamc fields $dynamicFieldsXML = array(); - $spacerCounter = 'a'; // set the custom table key $dbkey = 'g'; // TODO we should add the global and local view switch if field for front end foreach ($view['settings']->fields as $field) { - $dynamicFieldsXML[] = $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $spacerCounter, $this->placeholders, $dbkey, true); + $dynamicFieldsXML[] = $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $this->placeholders, $dbkey, true); } // set the default fields $XML = new simpleXMLElement(''); @@ -781,7 +759,6 @@ class Fields extends Structure * @param string $langView The language string of the view * @param string $viewName The singel view name * @param string $listViewName The list view name - * @param string $spacerCounter The space counter value * @param array $placeholders The place holder and replace values * @param string $dbkey The the custom table key * @param boolean $build The switch to set the build option @@ -789,19 +766,19 @@ class Fields extends Structure * @return SimpleXMLElement The complete field in xml * */ - public function setDynamicField(&$field, &$view, &$viewType, &$langView, &$viewName, &$listViewName, &$spacerCounter, &$placeholders, &$dbkey, $build) + public function setDynamicField(&$field, &$view, &$viewType, &$langView, &$viewName, &$listViewName, &$placeholders, &$dbkey, $build) { if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings'])) { // reset some values - $name = ComponentbuilderHelper::safeString($field['settings']->name); - $typeName = ComponentbuilderHelper::safeString($field['settings']->type_name); + $name = $this->getFieldName($field, $listViewName); + $typeName = $this->getFieldType($field); $multiple = false; $langLabel = ''; $fieldSet = ''; $fieldAttributes = array(); // set field attributes - $fieldAttributes = $this->setFieldAttributes($field, $viewType, $name, $typeName, $multiple, $langLabel, $langView, $spacerCounter, $listViewName, $viewName, $placeholders); + $fieldAttributes = $this->setFieldAttributes($field, $viewType, $name, $typeName, $multiple, $langLabel, $langView, $listViewName, $viewName, $placeholders); // check if values were set if (ComponentbuilderHelper::checkArray($fieldAttributes)) { @@ -849,11 +826,6 @@ class Fields extends Structure } // now add to the field set $xmlElement = $this->setField('spacer', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray); - // increment spacer counter - if ($typeName === 'spacer') - { - $spacerCounter++; - } } elseif ($this->defaultField($typeName, 'special')) { @@ -1064,12 +1036,12 @@ class Fields extends Structure $fieldData['settings'] = $this->getFieldData($fieldId, $viewName); if (ComponentbuilderHelper::checkObject($fieldData['settings'])) { - $r_name = ComponentbuilderHelper::safeString($fieldData['settings']->name); - $r_typeName = ComponentbuilderHelper::safeString($fieldData['settings']->type_name); + $r_name = $this->getFieldName($fieldData); + $r_typeName = $this->getFieldType($fieldData); $r_multiple = false; $r_langLabel = ''; // get field values - $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $listViewName, $viewName, $placeholders, true); + $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $listViewName, $viewName, $placeholders, true); // check if values were set if (ComponentbuilderHelper::checkArray($r_fieldValues)) { @@ -1161,12 +1133,12 @@ class Fields extends Structure $fieldData['settings'] = $this->getFieldData($fieldId, $viewName); if (ComponentbuilderHelper::checkObject($fieldData['settings'])) { - $r_name = ComponentbuilderHelper::safeString($fieldData['settings']->name); - $r_typeName = ComponentbuilderHelper::safeString($fieldData['settings']->type_name); + $r_name = $this->getFieldName($fieldData); + $r_typeName = $this->getFieldType($fieldData); $r_multiple = false; $r_langLabel = ''; // get field values - $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $spacerCounter, $listViewName, $viewName, $placeholders, true); + $r_fieldValues = $this->setFieldAttributes($fieldData, $view, $r_name, $r_typeName, $r_multiple, $r_langLabel, $langView, $listViewName, $viewName, $placeholders, true); // check if values were set if (ComponentbuilderHelper::checkArray($r_fieldValues)) { @@ -1372,7 +1344,6 @@ class Fields extends Structure * @param boolean $multiple The switch to set multiple selection option * @param string $langLabel The language string for field label * @param string $langView The language string of the view - * @param string $spacerCounter The space counter value * @param string $listViewName The list view name * @param string $viewName The singel view name * @param array $placeholders The place holder and replace values @@ -1381,7 +1352,7 @@ class Fields extends Structure * @return array The field attributes * */ - private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, &$multiple, &$langLabel, $langView, &$spacerCounter, $listViewName, $viewName, $placeholders, $repeatable = false) + private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, &$multiple, &$langLabel, $langView, $listViewName, $viewName, $placeholders, $repeatable = false) { // reset array $fieldAttributes = array(); @@ -1402,38 +1373,8 @@ class Fields extends Structure $langValue = ''; if ($property['name'] === 'type') { - if ($typeName === 'custom' || $typeName === 'customuser') - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); - } - // use field core type only if not found - elseif (ComponentbuilderHelper::checkString($typeName)) - { - $xmlValue = $typeName; - } - // make sure none adjustable fields are set - elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0) - { - $xmlValue = $property['example']; - } - // fall back on the xml settings - else - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'type="', '"')); - } - - // check if the value is set - if (ComponentbuilderHelper::checkString($xmlValue)) - { - // add the value - $typeName = $xmlValue; - } - else - { - // fall back to text - $xmlValue = 'text'; - $typeName = $xmlValue; - } + // get type name + $xmlValue = $typeName; // add to custom if it is custom if ($setCustom) @@ -1444,67 +1385,8 @@ class Fields extends Structure } elseif ($property['name'] === 'name') { - // if category then name must be catid (only one per view) - if ($typeName === 'category') - { - // quick check if this is a category linked to view page - $requeSt_id = ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"'); - if (strpos($requeSt_id, '_request_id') !== false || strpos($requeSt_id, '_request_catid') !== false) - { - // keep it then, don't change - $xmlValue = $requeSt_id; - } - else - { - $xmlValue = 'catid'; - } - // check if we should use another Text Name as this views name - $otherName = ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'); - $otherViews = ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'); - $otherView = ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'); - if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView)) - { - $this->catOtherName[$listViewName] = array( - 'name' => ComponentbuilderHelper::safeString($otherName), - 'views' => ComponentbuilderHelper::safeString($otherViews), - 'view' => ComponentbuilderHelper::safeString($otherView) - ); - } - } - // if tag is set then enable all tag options for this view (only one per view) - elseif ($typeName === 'tag') - { - $xmlValue = 'tags'; - } - // if the field is set as alias it must be called alias - elseif (isset($field['alias']) && $field['alias']) - { - $xmlValue = 'alias'; - } - elseif ($typeName === 'spacer') - { - // make sure the name is unique - $xmlValue = $name . '_' . $spacerCounter; - } - else - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"')); - } - - // use field core name only if not found in xml - if (!ComponentbuilderHelper::checkString($xmlValue)) - { - // make sure the XML name is uniqe, so we can add one field multiple times - $name = $this->uniqueName($name, $viewName); - $xmlValue = $name; - } - // set the name if found - else - { - // make sure the XML name is uniqe, so we can add one field multiple times - $xmlValue = $this->uniqueName($xmlValue, $viewName); - $name = $this->setPlaceholders($xmlValue, $placeholders); - } + // get the actual field name + $xmlValue = $this->setPlaceholders($name, $placeholders); } elseif ($property['name'] === 'extension' || $property['name'] === 'directory' || $property['name'] === 'formsource') { @@ -1623,9 +1505,9 @@ class Fields extends Structure // update label if field use multiple times if ($property['name'] === 'label') { - if (isset($fieldAttributes['name']) && isset($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']])) + if (isset($fieldAttributes['name']) && isset($this->uniqueNames[$listViewName]['names'][$fieldAttributes['name']])) { - $xmlValue .= ' (' . ComponentbuilderHelper::safeString($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']]) . ')'; + $xmlValue .= ' (' . ComponentbuilderHelper::safeString($this->uniqueNames[$listViewName]['names'][$fieldAttributes['name']]) . ')'; } } // replace placeholders @@ -1718,123 +1600,6 @@ class Fields extends Structure return $fieldAttributes; } - /** - * Keep track of the field names, to see if it used multiple times - * - * @param array $field The field data - * @param string $typeName The field type - * @param string $name The field name - * @param string $viewName The singel view name - * - * @return void - * - */ - protected function setUniqueNameKeeper(&$field, &$typeName, &$name, $viewName) - { - // setup a default field - if (ComponentbuilderHelper::checkArray($field['settings']->properties)) - { - foreach ($field['settings']->properties as $property) - { - // reset - $xmlValue = ''; - if ($property['name'] === 'name') - { - // if category then name must be catid (only one per view) - if ($typeName === 'category') - { - // only one allowed - return; - } - // if tag is set then enable all tag options for this view (only one per view) - elseif ($typeName === 'tag') - { - // only one allowed - return; - } - // if the field is set as alias it must be called alias - elseif (isset($field['alias']) && $field['alias']) - { - // only one allowed - return; - } - elseif ($typeName === 'spacer') - { - // not needed here - return; - } - else - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"')); - } - - // use field core name only if not found in xml - if (!ComponentbuilderHelper::checkString($xmlValue)) - { - $xmlValue = $name; - } - // make sure the XML name is uniqe, so we can add one field multiple times - return $this->setUniqueNameCounter($xmlValue, $viewName); - } - } - } - } - - /** - * Count how many times the same field is used per view - * - * @param string $name The name of the field - * @param string $view The name of the view - * - * @return void - * - */ - protected function setUniqueNameCounter($name, $view) - { - if (!isset($this->uniqueNames[$view])) - { - $this->uniqueNames[$view] = array(); - $this->uniqueNames[$view]['counter'] = array(); - $this->uniqueNames[$view]['names'] = array(); - } - if (!isset($this->uniqueNames[$view]['counter'][$name])) - { - $this->uniqueNames[$view]['counter'][$name] = 1; - return; - } - // count how many times the field is used - $this->uniqueNames[$view]['counter'][$name] ++; - return; - } - - /** - * Naming each field with an unique name - * - * @param string $name The name of the field - * @param string $view The name of the view - * - * @return string the name - * - */ - protected function uniqueName($name, $view) - { - // only increment if the field name is used multiple times - if (isset($this->uniqueNames[$view]['counter'][$name]) && $this->uniqueNames[$view]['counter'][$name] > 1) - { - $counter = $this->uniqueNames[$view]['counter'][$name]; - $uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter); - while (isset($this->uniqueNames[$view]['names'][$uniqueName])) - { - $counter--; - $uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter); - } - // set the new name - $this->uniqueNames[$view]['names'][$uniqueName] = $counter; - return $uniqueName; - } - return $name; - } - /** * set Builders * diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 46b4b0d30..4a6811dff 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -5634,7 +5634,6 @@ class Interpretation extends Fields // set the main db prefix $component = $this->fileContentStatic['###component###']; // start building the db - $db = ''; foreach ($this->queryBuilder as $view => $fields) { @@ -5711,9 +5710,21 @@ class Interpretation extends Fields $this->updateSQLBuilder["ALTERTABLE`#__" . $component . "_" . $view . "`ADD`" . $field . "`"] = "ALTER TABLE `#__" . $component . "_" . $view . "` ADD `" . $field . "` " . $data['type'] . $lenght . " " . $default . " AFTER `" . $last_name . "`;"; } // check if the field has changed name and/or data type and lenght - elseif (0) + elseif ((isset($this->updateSQL['field.datatype']) && isset($this->updateSQL['field.datatype'][$view.'.'.$field])) || + (isset($this->updateSQL['field.lenght']) && isset($this->updateSQL['field.lenght'][$view.'.'.$field])) || + (isset($this->updateSQL['field.name']) && isset($this->updateSQL['field.name'][$view.'.'.$field]))) { - // hmmm tough one + // if the name changed + if (isset($this->updateSQL['field.name']) && isset($this->updateSQL['field.name'][$view.'.'.$field])) + { + $oldName = $this->updateSQL['field.name'][$view.'.'.$field]['old']; + } + else + { + $oldName = $field; + } + // now set the update SQL + $this->updateSQLBuilder["ALTERTABLE`#__" . $component . "_" . $view . "`CHANGE`" . $oldName . "``" . $field . "`"] = "ALTER TABLE `#__" . $component . "_" . $view . "` CHANGE `" . $oldName . "` `" . $field . "` " . $data['type'] . $lenght . " " . $default . ";"; } // be sure to track the last name used :) $last_name = $field; @@ -12853,14 +12864,14 @@ class Interpretation extends Fields '###component###' => $component, '###view###' => $viewName, '###views###' => $listViewName); - $spacerCounter = 'a'; $view = ''; $viewType = 0; + // set the custom table key $dbkey = 'g'; foreach ($this->componentData->config as $field) { - $newxmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $spacerCounter, $placeholders, $dbkey, false); + $newxmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $placeholders, $dbkey, false); // tmp hack untill this whole area is also done in xml (TODO) if (isset($newxmlField->fieldXML)) { @@ -14715,8 +14726,8 @@ function vdm_dkim() { $propertyType = $property; } } - $fieldType = $this->getFieldType($field['settings']->type_name, $field['settings']->xml, $propertyType); - $fieldName = $this->getFieldName($fieldType, $field['settings']->xml, $field['alias']); + $fieldType = $this->getFieldType($field); + $fieldName = $this->getFieldName($field, $nameViews); $fieldView = array(); // set the permission for this field $fieldView['action'] = 'view.edit.' . $fieldName; @@ -15065,72 +15076,6 @@ function vdm_dkim() { } } - public function getFieldName($typeName, $xml, $alias) - { - // if category then name must be catid (only one per view) - if ($typeName === 'category') - { - return 'catid'; - } - // if tag is set then enable all tag options for this view (only one per view) - elseif ($typeName === 'tag') - { - return 'tags'; - } - // if the field is set as alias it must be called alias - elseif ($alias) - { - return 'alias'; - } - elseif ($typeName === 'spacer') - { - // make sure the name is unique - return false; - } - else - { - return ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'name="', '"')); - } - } - - public function getFieldType($typeName, $xml, $property) - { - // make sure its lower case - $typeName = ComponentbuilderHelper::safeString($typeName); - - if ($typeName === 'custom' || $typeName === 'customuser') - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); - } - // use field core type only if not found - elseif (ComponentbuilderHelper::checkString($typeName)) - { - $xmlValue = $typeName; - } - // make sure none adjustable fields are set - elseif (isset($property['example']) && ComponentbuilderHelper::checkString($property['example']) && $property['adjustable'] == 0) - { - $xmlValue = $property['example']; - } - // fall back on the xml settings - else - { - $xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xml, 'type="', '"')); - } - - // check if the value is set - if (ComponentbuilderHelper::checkString($xmlValue)) - { - // add the value - return $xmlValue; - } - else - { - // fall back to text - return 'text'; - } - } - public function getInbetweenStrings($str, $start = '###', $end = '###') { $matches = array(); diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index cfca1b413..ad9e2d996 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -2114,12 +2114,14 @@ COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_CREATED_DATE_DESC="The date this Compo COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_CREATED_DATE_LABEL="Created Date" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_DEFAULT_VIEW_DESCRIPTION="Select only one." COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_DEFAULT_VIEW_LABEL="Default View" +COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_DESCRIPTION="if view uses Access,
should default be public." COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_EDIT="Editing the Component Site Views" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ERROR_UNIQUE_ALIAS="Another Component Site Views has the same alias." COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ID="Id" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_JOOMLA_COMPONENT="Joomla Component" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_JOOMLA_COMPONENT_LABEL="Component" +COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_LABEL="Public Access" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_MENU_DESCRIPTION="Select if the view should show have a menu link." COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_MENU_LABEL="Add Menu" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_METADATA_DESCRIPTION="Select if this view should have metadata." @@ -2133,8 +2135,6 @@ COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_NOTE_ON_SITE_VIEWS_DESCRIPTION="Do not COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_NOTE_ON_SITE_VIEWS_LABEL="Setting Site Views" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_PERMISSION="Permissions" -COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_PUBLIC_ACCESS_DESCRIPTION="if view uses Access,
should default be public." -COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_PUBLIC_ACCESS_LABEL="Public Access" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_PUBLISHING="Publishing" COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Component Site Views to customise the alias." COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_SITEVIEW="Siteview" diff --git a/admin/layouts/joomla_component/settings_fullwidth.php b/admin/layouts/joomla_component/settings_fullwidth.php index 68a447d9b..03edff532 100644 --- a/admin/layouts/joomla_component/settings_fullwidth.php +++ b/admin/layouts/joomla_component/settings_fullwidth.php @@ -30,7 +30,7 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'spacer_hr_f', + 'spacer_hr_six', 'note_on_contributors', 'addcontributors', 'emptycontributors', diff --git a/admin/layouts/joomla_component/settings_left.php b/admin/layouts/joomla_component/settings_left.php index 0ec23edf9..56d91f74a 100644 --- a/admin/layouts/joomla_component/settings_left.php +++ b/admin/layouts/joomla_component/settings_left.php @@ -31,11 +31,11 @@ $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( 'note_moved_views', - 'spacer_hr_a', + 'spacer_hr_one', 'note_mysql_tweak_options', - 'spacer_hr_b', + 'spacer_hr_two', 'note_add_custom_menus', - 'spacer_hr_c', + 'spacer_hr_three', 'note_add_config' ); diff --git a/admin/layouts/joomla_component/settings_right.php b/admin/layouts/joomla_component/settings_right.php index 18a4336e7..5a3dd8f27 100644 --- a/admin/layouts/joomla_component/settings_right.php +++ b/admin/layouts/joomla_component/settings_right.php @@ -31,10 +31,10 @@ $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( 'note_component_files_folders', - 'spacer_hr_d', + 'spacer_hr_four', 'to_ignore_note', 'toignore', - 'spacer_hr_e', + 'spacer_hr_five', 'jcb_export_package_note', 'export_key', 'export_package_link', diff --git a/admin/models/forms/admin_fields_conditions.js b/admin/models/forms/admin_fields_conditions.js index a853f18ba..5701fb39a 100644 --- a/admin/models/forms/admin_fields_conditions.js +++ b/admin/models/forms/admin_fields_conditions.js @@ -24,6 +24,7 @@ + function getFieldSelectOptions_server(fieldId){ var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json"; if(token.length > 0 && fieldId > 0){ diff --git a/admin/models/forms/admin_view.js b/admin/models/forms/admin_view.js index fd84c3401..4991d74e6 100644 --- a/admin/models/forms/admin_view.js +++ b/admin/models/forms/admin_view.js @@ -1196,6 +1196,7 @@ function isSet(val) return false; } + jQuery(document).ready(function() { // get the linked details diff --git a/admin/models/forms/component_site_views.xml b/admin/models/forms/component_site_views.xml index 7a2f87ec0..c897eb9ac 100644 --- a/admin/models/forms/component_site_views.xml +++ b/admin/models/forms/component_site_views.xml @@ -152,13 +152,13 @@ required="false" description="COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_ACCESS_DESCRIPTION" class="inputbox" /> - + diff --git a/admin/models/forms/custom_admin_view.js b/admin/models/forms/custom_admin_view.js index cb811b55e..7793d8eb0 100644 --- a/admin/models/forms/custom_admin_view.js +++ b/admin/models/forms/custom_admin_view.js @@ -438,6 +438,7 @@ function isSet(val) return false; } + jQuery(document).ready(function() { // get the linked details diff --git a/admin/models/forms/custom_code.js b/admin/models/forms/custom_code.js index 00423e98d..4b07a397e 100644 --- a/admin/models/forms/custom_code.js +++ b/admin/models/forms/custom_code.js @@ -224,6 +224,7 @@ function isSet(val) return false; } + jQuery(document).ready(function() { var target = jQuery("#jform_target input[type='radio']:checked").val(); diff --git a/admin/models/forms/dynamic_get.js b/admin/models/forms/dynamic_get.js index e2fc7b332..bfbdaf877 100644 --- a/admin/models/forms/dynamic_get.js +++ b/admin/models/forms/dynamic_get.js @@ -1428,6 +1428,7 @@ function isSet(val) return false; } + jQuery(document).ready(function() { // get the linked details diff --git a/admin/models/forms/field.js b/admin/models/forms/field.js index 7135f33df..23821f570 100644 --- a/admin/models/forms/field.js +++ b/admin/models/forms/field.js @@ -509,6 +509,7 @@ function isSet(val) return false; } + jQuery(document).ready(function() { // get the linked details diff --git a/admin/models/forms/joomla_component.js b/admin/models/forms/joomla_component.js index 497a7cf9a..62445c3d7 100644 --- a/admin/models/forms/joomla_component.js +++ b/admin/models/forms/joomla_component.js @@ -880,6 +880,7 @@ function isSet(val) return false; } + jQuery(document).ready(function() { // check what is the dashboard switch diff --git a/admin/models/forms/joomla_component.xml b/admin/models/forms/joomla_component.xml index 4e26ad477..92f7875bd 100644 --- a/admin/models/forms/joomla_component.xml +++ b/admin/models/forms/joomla_component.xml @@ -665,11 +665,11 @@
- + + class="spacer_hr_one" /> COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES - + + class="spacer_hr_two" /> COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES - + + class="spacer_hr_three" /> COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES - + + class="spacer_hr_four" /> COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEFAULT - + + class="spacer_hr_five" /> COM_COMPONENTBUILDER_JOOMLA_COMPONENT_YES - + + class="spacer_hr_six" /> 0 && snippetId > 0){ diff --git a/admin/models/forms/library.js b/admin/models/forms/library.js index e14359cfa..d0309e108 100644 --- a/admin/models/forms/library.js +++ b/admin/models/forms/library.js @@ -414,6 +414,7 @@ function isSet(val) return false; } + jQuery(document).ready(function() { // get the linked details diff --git a/admin/models/forms/site_view.js b/admin/models/forms/site_view.js index 17917b9cb..88afbbdf5 100644 --- a/admin/models/forms/site_view.js +++ b/admin/models/forms/site_view.js @@ -479,6 +479,7 @@ function isSet(val) return false; } + jQuery(document).ready(function() { // get the linked details diff --git a/admin/models/forms/template.js b/admin/models/forms/template.js index 788e282f5..727e967bd 100644 --- a/admin/models/forms/template.js +++ b/admin/models/forms/template.js @@ -100,6 +100,7 @@ function isSet(val) } + function getSnippetDetails_server(snippetId){ var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"; if(token.length > 0 && snippetId > 0){ diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index fea066463..91b980247 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -1521,7 +1521,7 @@ INSERT INTO `#__componentbuilder_help_document` (`id`, `admin_view`, `alias`, `a -- INSERT INTO `#__componentbuilder_admin_fields` (`id`, `addfields`, `admin_view`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES -(111, '{\"addfields0\":{\"field\":\"199\",\"list\":\"1\",\"order_list\":\"1\",\"title\":\"1\",\"alias\":\"0\",\"sort\":\"1\",\"search\":\"1\",\"filter\":\"0\",\"link\":\"1\",\"tab\":\"1\",\"alignment\":\"4\",\"order_edit\":\"1\",\"permission\":\"1\"},\"addfields1\":{\"field\":\"23\",\"list\":\"0\",\"order_list\":\"0\",\"title\":\"0\",\"alias\":\"1\",\"sort\":\"0\",\"search\":\"1\",\"filter\":\"0\",\"link\":\"0\",\"tab\":\"1\",\"alignment\":\"4\",\"order_edit\":\"2\",\"permission\":\"1\"},\"addfields2\":{\"field\":\"84\",\"list\":\"1\",\"order_list\":\"2\",\"title\":\"0\",\"alias\":\"0\",\"sort\":\"1\",\"search\":\"1\",\"filter\":\"0\",\"link\":\"0\",\"tab\":\"1\",\"alignment\":\"3\",\"order_edit\":\"1\",\"permission\":\"1\"},\"addfields3\":{\"field\":\"682\",\"list\":\"0\",\"order_list\":\"0\",\"title\":\"0\",\"alias\":\"0\",\"sort\":\"1\",\"search\":\"1\",\"filter\":\"1\",\"link\":\"0\",\"tab\":\"2\",\"alignment\":\"1\",\"order_edit\":\"1\",\"permission\":\"1\"},\"addfields4\":{\"field\":\"100\",\"list\":\"0\",\"order_list\":\"0\",\"title\":\"0\",\"alias\":\"0\",\"sort\":\"0\",\"search\":\"0\",\"filter\":\"0\",\"link\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"1\",\"permission\":\"1\"},\"addfields5\":{\"field\":\"196\",\"list\":\"0\",\"order_list\":\"0\",\"title\":\"0\",\"alias\":\"0\",\"sort\":\"0\",\"search\":\"0\",\"filter\":\"0\",\"link\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"2\",\"permission\":\"1\"},\"addfields6\":{\"field\":\"1011\",\"list\":\"0\",\"order_list\":\"0\",\"title\":\"0\",\"alias\":\"0\",\"sort\":\"0\",\"search\":\"0\",\"filter\":\"0\",\"link\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"3\",\"permission\":\"1\"},\"addfields7\":{\"field\":\"158\",\"list\":\"0\",\"order_list\":\"0\",\"title\":\"0\",\"alias\":\"0\",\"sort\":\"0\",\"search\":\"0\",\"filter\":\"0\",\"link\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"4\",\"permission\":\"1\"},\"addfields8\":{\"field\":\"280\",\"list\":\"0\",\"order_list\":\"0\",\"title\":\"0\",\"alias\":\"0\",\"sort\":\"0\",\"search\":\"0\",\"filter\":\"0\",\"link\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"5\",\"permission\":\"1\"},\"addfields9\":{\"field\":\"203\",\"list\":\"0\",\"order_list\":\"0\",\"title\":\"0\",\"alias\":\"0\",\"sort\":\"0\",\"search\":\"0\",\"filter\":\"0\",\"link\":\"0\",\"tab\":\"1\",\"alignment\":\"5\",\"order_edit\":\"1\",\"permission\":\"0\"}}', 109, 1, '2017-10-12 19:52:03', '0000-00-00 00:00:00', 2, '', ''); +(111, '{\"0\":{\"field\":\"84\",\"list\":\"1\",\"order_list\":\"2\",\"sort\":\"1\",\"search\":\"1\",\"tab\":\"1\",\"alignment\":\"3\",\"order_edit\":\"1\",\"permission\":\"0\"},\"1\":{\"field\":\"199\",\"list\":\"1\",\"order_list\":\"1\",\"title\":\"1\",\"sort\":\"1\",\"search\":\"1\",\"link\":\"1\",\"tab\":\"1\",\"alignment\":\"4\",\"order_edit\":\"1\",\"permission\":\"0\"},\"2\":{\"field\":\"23\",\"order_list\":\"0\",\"alias\":\"1\",\"search\":\"1\",\"tab\":\"1\",\"alignment\":\"4\",\"order_edit\":\"2\",\"permission\":\"0\"},\"3\":{\"field\":\"203\",\"order_list\":\"0\",\"tab\":\"1\",\"alignment\":\"5\",\"order_edit\":\"1\",\"permission\":\"0\"},\"4\":{\"field\":\"682\",\"order_list\":\"0\",\"sort\":\"1\",\"search\":\"1\",\"filter\":\"1\",\"tab\":\"2\",\"alignment\":\"1\",\"order_edit\":\"1\",\"permission\":\"0\"},\"5\":{\"field\":\"100\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"1\",\"permission\":\"0\"},\"6\":{\"field\":\"196\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"2\",\"permission\":\"0\"},\"7\":{\"field\":\"1011\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"3\",\"permission\":\"0\"},\"8\":{\"field\":\"158\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"4\",\"permission\":\"0\"},\"9\":{\"field\":\"280\",\"order_list\":\"0\",\"tab\":\"2\",\"alignment\":\"2\",\"order_edit\":\"5\",\"permission\":\"0\"}}', 109, 1, '2017-10-12 19:52:03', '2018-03-10 23:04:11', 4, '', ''); -- -- Dumping data for table `#__componentbuilder_admin_fields_conditions` diff --git a/admin/views/admin_fields_conditions/tmpl/edit.php b/admin/views/admin_fields_conditions/tmpl/edit.php index 1a613af6d..b1730ac8b 100644 --- a/admin/views/admin_fields_conditions/tmpl/edit.php +++ b/admin/views/admin_fields_conditions/tmpl/edit.php @@ -119,6 +119,7 @@ $componentParams = JComponentHelper::getParams('com_componentbuilder');