From 4e740f568e94f0249cafba994faff7b8f29ebacf Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 28 Mar 2018 11:46:14 +0200 Subject: [PATCH] Added the option for automatic alias building, resolve gh-246. Made improvements to the buttons all over JCB, and the tweaked the field view a little more. --- README.md | 8 +- admin/README.txt | 8 +- admin/assets/css/admin.css | 1 + admin/assets/css/field.css | 5 +- admin/controllers/ajax.json.php | 44 +- admin/helpers/compiler/a_Get.php | 41 +- admin/helpers/compiler/c_Fields.php | 4 +- admin/helpers/compiler/e_Interpretation.php | 166 ++++-- admin/helpers/componentbuilder.php | 2 +- .../en-GB/en-GB.com_componentbuilder.ini | 15 +- .../admin_view/fields_conditions_left.php | 6 +- admin/models/admin_fields.php | 4 +- admin/models/admin_fields_conditions.php | 4 +- admin/models/admin_view.php | 213 +++---- admin/models/admin_views.php | 48 +- admin/models/ajax.php | 76 ++- admin/models/component_admin_views.php | 4 +- admin/models/component_config.php | 4 +- admin/models/component_custom_admin_menus.php | 4 +- admin/models/component_custom_admin_views.php | 4 +- admin/models/component_dashboard.php | 4 +- admin/models/component_files_folders.php | 4 +- admin/models/component_mysql_tweaks.php | 4 +- admin/models/component_site_views.php | 4 +- admin/models/component_updates.php | 4 +- admin/models/custom_admin_view.php | 4 +- admin/models/custom_code.php | 4 +- admin/models/dynamic_get.php | 4 +- admin/models/field.php | 4 +- admin/models/fields/aliasbuilder.php | 205 +++++++ admin/models/fieldtype.php | 4 +- admin/models/forms/admin_view.js | 47 +- admin/models/forms/admin_view.xml | 544 +++++++++--------- admin/models/forms/field.js | 31 +- admin/models/forms/joomla_component.js | 16 +- admin/models/forms/language_translation.js | 16 +- admin/models/forms/library.js | 16 +- admin/models/help_document.php | 46 +- admin/models/joomla_component.php | 4 +- admin/models/language.php | 4 +- admin/models/language_translation.php | 4 +- admin/models/layout.php | 46 +- admin/models/library.php | 4 +- admin/models/library_config.php | 4 +- admin/models/library_files_folders_urls.php | 4 +- admin/models/server.php | 4 +- admin/models/site_view.php | 4 +- admin/models/snippet.php | 4 +- admin/models/snippet_type.php | 4 +- admin/models/template.php | 46 +- admin/models/validation_rule.php | 4 +- admin/sql/install.mysql.utf8.sql | 16 +- admin/sql/updates/mysql/2.7.0.sql | 4 + admin/views/field/tmpl/edit.php | 17 + componentbuilder.xml | 2 +- script.php | 8 +- site/helpers/componentbuilder.php | 2 +- 57 files changed, 1217 insertions(+), 590 deletions(-) create mode 100644 admin/models/fields/aliasbuilder.php diff --git a/README.md b/README.md index e951e6ed0..221d734e5 100644 --- a/README.md +++ b/README.md @@ -126,13 +126,13 @@ 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*: 27th March, 2018 ++ *Last Build*: 28th March, 2018 + *Version*: 2.7.1 + *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*: **190902** -+ *Field count*: **1007** -+ *File count*: **1196** ++ *Line count*: **191428** ++ *Field count*: **1011** ++ *File count*: **1197** + *Folder count*: **193** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/README.txt b/admin/README.txt index e951e6ed0..221d734e5 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -126,13 +126,13 @@ 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*: 27th March, 2018 ++ *Last Build*: 28th March, 2018 + *Version*: 2.7.1 + *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*: **190902** -+ *Field count*: **1007** -+ *File count*: **1196** ++ *Line count*: **191428** ++ *Field count*: **1011** ++ *File count*: **1197** + *Folder count*: **193** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 1748953b7..bf5da1422 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -27,5 +27,6 @@ pointer-events: none; } .fieldMedium { width: 130px; } +.fieldFull { width: 100%; } .fieldSmall { width: 60px; } code { display: inline-block; margin: 3px;} diff --git a/admin/assets/css/field.css b/admin/assets/css/field.css index f8a8267f8..a66357a0f 100644 --- a/admin/assets/css/field.css +++ b/admin/assets/css/field.css @@ -24,4 +24,7 @@ /* CSS Document */ - + +.uk-scrollable-box { +height: 380px !important; +} diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 64e91ff4c..9998797e4 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -53,6 +53,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy $this->registerTask('getButtonID', 'ajax'); $this->registerTask('getAjaxDisplay', 'ajax'); $this->registerTask('getLinked', 'ajax'); + $this->registerTask('checkAliasField', 'ajax'); $this->registerTask('templateDetails', 'ajax'); $this->registerTask('getLayoutDetails', 'ajax'); $this->registerTask('dbTableColumns', 'ajax'); @@ -352,9 +353,10 @@ class ComponentbuilderControllerAjax extends JControllerLegacy { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); $typeValue = $jinput->get('type', NULL, 'WORD'); - if($typeValue && $user->id != 0) + $sizeValue = $jinput->get('size', NULL, 'INT'); + if($typeValue && $sizeValue && $user->id != 0) { - $result = $this->getModel('ajax')->getButton($typeValue); + $result = $this->getModel('ajax')->getButton($typeValue, $sizeValue); } else { @@ -500,6 +502,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } } break; + case 'checkAliasField': + try + { + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $typeValue = $jinput->get('type', NULL, 'INT'); + if($typeValue && $user->id != 0) + { + $result = $this->getModel('ajax')->checkAliasField($typeValue); + } + else + { + $result = false; + } + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode($e).");"; + } + else + { + echo "(".json_encode($e).");"; + } + } + break; case 'templateDetails': try { diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index fe2615b9c..5a524a373 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -435,6 +435,13 @@ class Get */ private $_fieldData = array(); + /** + * The custom alias builder + * + * @var array + */ + public $customAliasBuilder = array(); + /** * The field builder type * @@ -1748,6 +1755,33 @@ class Get $this->addAjax = true; } } + // activate alias builder + if (!isset($this->customAliasBuilder[$name_single]) && isset($view->alias_builder_type) && 2 == $view->alias_builder_type + && isset($view->alias_builder) && ComponentbuilderHelper::checkJson($view->alias_builder)) + { + // get the aliasFields + $alias_fields = (array) json_decode($view->alias_builder, true); + // get the active fields + $alias_fields = (array) array_filter($view->fields, function($field) use($alias_fields) { + // check if field is in view fields + if (in_array($field['field'], $alias_fields)) + { + return true; + } + return false; + }); + // check if all is well + if (ComponentbuilderHelper::checkArray($alias_fields)) + { + // load the field names + $this->customAliasBuilder[$name_single] = (array) array_map(function ($field) use($name_list) { + return $this->getFieldName($field, $name_list); + },$alias_fields + ); + } + } + // unset + unset($view->alias_builder); // add_sql if ($view->add_sql == 1) { @@ -2089,7 +2123,7 @@ class Get // load the values form params $field->xml = $this->setDynamicValues(json_decode($field->xml)); - + // check if we have validate (validation rule set) $validationRule = ComponentbuilderHelper::getBetween($field->xml, 'validate="', '"'); if (ComponentbuilderHelper::checkString($validationRule)) @@ -2103,7 +2137,7 @@ class Get if ($coreValidationRules = ComponentbuilderHelper::getExistingValidationRuleNames(true)) { // make sure this rule is not a core validation rule - if (!in_array($validationRule, $coreValidationRules)) + if (!in_array($validationRule, (array) $coreValidationRules)) { // get the class methods for this rule if it exists if ($this->validationRules[$validationRule] = ComponentbuilderHelper::getVar('validation_rule', $validationRule, 'name','php')) @@ -2113,8 +2147,7 @@ class Get } else { - // set the notice that this validation rule is custom and was not found - + // set the notice that this validation rule is custom and was not found (TODO) } } } diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index e532a7dbf..aa5432527 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -2393,12 +2393,12 @@ class Fields extends Structure $this->historyBuilder[$view_name_single] = $view_name_single; } // set Alias (only one title per view) - if (isset($field['alias']) && $field['alias']) + if (isset($field['alias']) && $field['alias'] && !isset($this->aliasBuilder[$view_name_single])) { $this->aliasBuilder[$view_name_single] = $name; } // set Titles (only one title per view) - if (isset($field['title']) && $field['title']) + if (isset($field['title']) && $field['title'] && !isset($this->titleBuilder[$view_name_single])) { $this->titleBuilder[$view_name_single] = $name; } diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 6de1a6050..827789313 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -5064,8 +5064,6 @@ class Interpretation extends Fields public function setBatchMove($viewName_single) { // set needed defaults - $title = false; - $alias = false; $category = false; $batchmove = array(); $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); @@ -5083,16 +5081,6 @@ class Interpretation extends Fields { $category = $this->catCodeBuilder[$viewName_single]['code']; } - // only load alias if set in this view - if (array_key_exists($viewName_single, $this->aliasBuilder)) - { - $alias = $this->aliasBuilder[$viewName_single]; - } - // only load title if set in this view - if (array_key_exists($viewName_single, $this->titleBuilder)) - { - $title = $this->titleBuilder[$viewName_single]; - } // prepare custom script $customScript = $this->getCustomScriptBuilder('php_batchmove', $viewName_single, PHP_EOL . PHP_EOL, null, true); @@ -5252,6 +5240,7 @@ class Interpretation extends Fields { // set needed defaults $title = false; + $titles = array(); $alias = false; $category = false; $batchcopy = array(); @@ -5277,9 +5266,26 @@ class Interpretation extends Fields $alias = $this->aliasBuilder[$viewName_single]; } // only load title if set in this view - if (array_key_exists($viewName_single, $this->titleBuilder)) + if (isset($this->customAliasBuilder[$viewName_single])) { - $title = $this->titleBuilder[$viewName_single]; + $titles = array_values($this->customAliasBuilder[$viewName_single]); + $title = true; + } + elseif (array_key_exists($viewName_single, $this->titleBuilder)) + { + $titles = array($this->titleBuilder[$viewName_single]); + $title = true; + } + // se the dynamic title + if ($title) + { + // reset the bucket + $titleData = array(); + // load the dynamic title builder + foreach ($titles as $_title) + { + $titleData[] = "\$this->table->" . $_title; + } } // prepare custom script $customScript = $this->getCustomScriptBuilder('php_batchcopy', $viewName_single, PHP_EOL . PHP_EOL, null, true); @@ -5400,7 +5406,7 @@ class Interpretation extends Fields $batchcopy[] = "\t\t\t\t\tcontinue;"; $batchcopy[] = "\t\t\t\t}"; $batchcopy[] = "\t\t\t}"; - if ($category && $alias === 'alias' && $title === 'title') + if ($category && $alias === 'alias' && ($title && count($titles) == 1 && in_array('title', $titles))) { $batchcopy[] = PHP_EOL . "\t\t\tif (isset(\$values['" . $category . "']))"; $batchcopy[] = "\t\t\t{"; @@ -5411,27 +5417,31 @@ class Interpretation extends Fields $batchcopy[] = "\t\t\t\tstatic::generateTitle((int) \$this->table->" . $category . ", \$this->table);"; $batchcopy[] = "\t\t\t}"; } - elseif ($category && $alias && $title) + elseif ($category && $alias && ($title && count($titles) == 1)) { $batchcopy[] = PHP_EOL . "\t\t\tif (isset(\$values['" . $category . "']))"; $batchcopy[] = "\t\t\t{"; - $batchcopy[] = "\t\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$values['" . $category . "'], \$this->table->" . $alias . ", \$this->table->" . $title . ");"; + $batchcopy[] = "\t\t\t\tlist(\$this->table->" . implode('', $titles) . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$values['" . $category . "'], \$this->table->" . $alias . ", \$this->table->" . implode('', $titles) . ");"; $batchcopy[] = "\t\t\t}"; $batchcopy[] = "\t\t\telse"; $batchcopy[] = "\t\t\t{"; - $batchcopy[] = "\t\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$this->table->" . $category . ", \$this->table->" . $alias . ", \$this->table->" . $title . ");"; + $batchcopy[] = "\t\t\t\tlist(\$this->table->" . implode('', $titles) . ", \$this->table->" . $alias . ") = \$this->generateNewTitle(\$this->table->" . $category . ", \$this->table->" . $alias . ", \$this->table->" . implode('', $titles) . ");"; $batchcopy[] = "\t\t\t}"; } + elseif (!$category && $alias && ($title && count($titles) == 1)) + { + $batchcopy[] = "\t\t\tlist(\$this->table->" . implode('', $titles) . ", \$this->table->" . $alias . ") = \$this->_generateNewTitle(\$this->table->" . $alias . ", \$this->table->" . implode('', $titles) . ");"; + } elseif (!$category && $alias && $title) { - $batchcopy[] = "\t\t\tlist(\$this->table->" . $title . ", \$this->table->" . $alias . ") = \$this->_generateNewTitle(\$this->table->" . $alias . ", \$this->table->" . $title . ");"; + $batchcopy[] = "\t\t\tlist(" . implode(', ', $titleData) . ", \$this->table->" . $alias . ") = \$this->_generateNewTitle(\$this->table->" . $alias . ", array(" . implode(', ', $titleData) . "));"; } - elseif (!$category && !$alias && $title && $title != 'user' && $title != 'jobnumber') // TODO [jobnumber] just for one project (not ideal) + elseif (!$category && !$alias && ($title && count($titles) == 1 && !in_array('user', $titles) && !in_array('jobnumber', $titles))) // TODO [jobnumber] just for one project (not ideal) { $batchcopy[] = PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " Only for strings"; - $batchcopy[] = "\t\t\tif (" . $Helper . "::checkString(\$this->table->" . $title . ") && !is_numeric(\$this->table->" . $title . "))"; + $batchcopy[] = "\t\t\tif (" . $Helper . "::checkString(\$this->table->" . implode('', $titles). ") && !is_numeric(\$this->table->" . implode('', $titles) . "))"; $batchcopy[] = "\t\t\t{"; - $batchcopy[] = "\t\t\t\t\$this->table->" . $title . " = \$this->generateUniqe('" . $title . "',\$this->table->" . $title . ");"; + $batchcopy[] = "\t\t\t\t\$this->table->" . implode('', $titles) . " = \$this->generateUniqe('" . implode('', $titles) . "',\$this->table->" . implode('', $titles) . ");"; $batchcopy[] = "\t\t\t}"; } @@ -5503,35 +5513,65 @@ class Interpretation extends Fields { $fixUniqe = array(); // only load this if these two items are set - if (array_key_exists($viewName_single, $this->aliasBuilder) && array_key_exists($viewName_single, $this->titleBuilder)) + if (array_key_exists($viewName_single, $this->aliasBuilder) && + (array_key_exists($viewName_single, $this->titleBuilder) || isset($this->customAliasBuilder[$viewName_single]))) { // set needed defaults $setCategory = false; $alias = $this->aliasBuilder[$viewName_single]; - $title = $this->titleBuilder[$viewName_single]; $VIEW = ComponentbuilderHelper::safeString($viewName_single, 'U'); if (array_key_exists($viewName_single, $this->catCodeBuilder)) { $category = $this->catCodeBuilder[$viewName_single]['code']; $setCategory = true; } + // set the title stuff + if (isset($this->customAliasBuilder[$viewName_single])) + { + $titles = array_values($this->customAliasBuilder[$viewName_single]); + if (isset($this->titleBuilder[$viewName_single])) + { + // $titles[] = $this->titleBuilder[$viewName_single]; // TODO this may be unexpected + } + } + else + { + $titles = array($this->titleBuilder[$viewName_single]); + } // start building the fix - $fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the " . $title . " for save as copy"; + $fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the " . implode(', ',$titles) . " for save as copy"; $fixUniqe[] = "\t\tif (\$input->get('task') === 'save2copy')"; $fixUniqe[] = "\t\t{"; $fixUniqe[] = "\t\t\t\$origTable = clone \$this->getTable();"; $fixUniqe[] = "\t\t\t\$origTable->load(\$input->getInt('id'));"; - $fixUniqe[] = PHP_EOL . "\t\t\tif (\$data['" . $title . "'] == \$origTable->" . $title . ")"; - $fixUniqe[] = "\t\t\t{"; - if ($setCategory) + // reset the buckets + $ifStatment = array(); + $titleVars = array(); + $titleData = array(); + $titleUpdate = array(); + // load the dynamic title builder + foreach ($titles as $title) { - $fixUniqe[] = "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], \$data['" . $title . "']);"; + $ifStatment[] = "\$data['" . $title . "'] == \$origTable->" . $title; + $titleVars[] = "\$" . $title; + $titleData[] = "\$data['" . $title . "']"; + $titleUpdate[] = "\t\t\t\t\$data['" . $title . "'] = \$" . $title . ";"; + } + $fixUniqe[] = PHP_EOL . "\t\t\tif (" . implode(' || ', $ifStatment) . ")"; + $fixUniqe[] = "\t\t\t{"; + if ($setCategory && count($titles) == 1) + { + $fixUniqe[] = "\t\t\t\tlist(" . implode('',$titleVars) . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], " . implode('',$titleData) . ");"; + } + elseif (count($titles) == 1) + { + $fixUniqe[] = "\t\t\t\tlist(" . implode(', ',$titleVars) . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], " . implode('',$titleData) . ");"; } else { - $fixUniqe[] = "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], \$data['" . $title . "']);"; + $fixUniqe[] = "\t\t\t\tlist(" . implode(', ',$titleVars) . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], array(" . implode(', ',$titleData) . "));"; } - $fixUniqe[] = "\t\t\t\t\$data['" . $title . "'] = \$" . $title . ";"; + $fixUniqe[] = implode("\n", $titleUpdate); $fixUniqe[] = "\t\t\t\t\$data['" . $alias . "'] = \$" . $alias . ";"; $fixUniqe[] = "\t\t\t}"; $fixUniqe[] = "\t\t\telse"; @@ -5546,24 +5586,25 @@ class Interpretation extends Fields $fixUniqe[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Automatic handling of " . $alias . " for empty fields"; $fixUniqe[] = "\t\tif (in_array(\$input->get('task'), array('apply', 'save', 'save2new')) && (int) \$input->get('id') == 0)"; $fixUniqe[] = "\t\t{"; - $fixUniqe[] = "\t\t\tif (\$data['" . $alias . "'] == null)"; + $fixUniqe[] = "\t\t\tif (\$data['" . $alias . "'] == null || empty(\$data['" . $alias . "']))"; $fixUniqe[] = "\t\t\t{"; $fixUniqe[] = "\t\t\t\tif (JFactory::getConfig()->get('unicodeslugs') == 1)"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLUnicodeSlug(\$data['" . $title . "']);"; + $fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLUnicodeSlug(" . implode(' . " " . ', $titleData) . ");"; $fixUniqe[] = "\t\t\t\t}"; $fixUniqe[] = "\t\t\t\telse"; $fixUniqe[] = "\t\t\t\t{"; - $fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLSafe(\$data['" . $title . "']);"; + $fixUniqe[] = "\t\t\t\t\t\$data['" . $alias . "'] = JFilterOutput::stringURLSafe(". implode(' . " " . ', $titleData) .");"; $fixUniqe[] = "\t\t\t\t}"; $fixUniqe[] = PHP_EOL . "\t\t\t\t\$table = JTable::getInstance('" . $viewName_single . "', '" . $this->fileContentStatic['###component###'] . "Table');"; - if ($setCategory) + if ($setCategory && count($titles) == 1) { $fixUniqe[] = PHP_EOL . "\t\t\t\tif (\$table->load(array('" . $alias . "' => \$data['" . $alias . "'], '" . $category . "' => \$data['" . $category . "'])) && (\$table->id != \$data['id'] || \$data['id'] == 0))"; $fixUniqe[] = "\t\t\t\t{"; $fixUniqe[] = "\t\t\t\t\t\$msg = JText:" . ":_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');"; $fixUniqe[] = "\t\t\t\t}"; - $fixUniqe[] = PHP_EOL . "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], \$data['" . $title . "']);"; + $fixUniqe[] = PHP_EOL . "\t\t\t\tlist(" . implode('',$titleVars) . ", \$" . $alias . ") = \$this->generateNewTitle(\$data['" . $category . "'], \$data['" . $alias . "'], " . implode('',$titleData) . ");"; + $fixUniqe[] = "\t\t\t\t\$data['" . $alias . "'] = \$" . $alias . ";"; } else { @@ -5571,9 +5612,8 @@ class Interpretation extends Fields $fixUniqe[] = "\t\t\t\t{"; $fixUniqe[] = "\t\t\t\t\t\$msg = JText:" . ":_('COM_" . $this->fileContentStatic['###COMPONENT###'] . "_" . $VIEW . "_SAVE_WARNING');"; $fixUniqe[] = "\t\t\t\t}"; - $fixUniqe[] = PHP_EOL . "\t\t\t\tlist(\$" . $title . ", \$" . $alias . ") = \$this->_generateNewTitle(\$data['" . $alias . "'], \$data['" . $title . "']);"; + $fixUniqe[] = PHP_EOL . "\t\t\t\t\$data['" . $alias . "'] = \$this->_generateNewTitle(\$data['" . $alias . "']);"; } - $fixUniqe[] = "\t\t\t\t\$data['" . $alias . "'] = \$" . $alias . ";"; $fixUniqe[] = PHP_EOL . "\t\t\t\tif (isset(\$msg))"; $fixUniqe[] = "\t\t\t\t{"; $fixUniqe[] = "\t\t\t\t\tJFactory::getApplication()->enqueueMessage(\$msg, 'warning');"; @@ -5602,28 +5642,56 @@ class Interpretation extends Fields public function setGenerateNewTitle($viewName_single) { // if category is added to this view then do nothing - if (array_key_exists($viewName_single, $this->aliasBuilder) && array_key_exists($viewName_single, $this->titleBuilder)) + if (array_key_exists($viewName_single, $this->aliasBuilder) && + (array_key_exists($viewName_single, $this->titleBuilder) || isset($this->customAliasBuilder[$viewName_single]))) { + // get component name + $Component = $this->fileContentStatic['###Component###']; + // rest the new function $newFunction = array(); $newFunction[] = PHP_EOL . PHP_EOL . "\t/**"; - $newFunction[] = "\t* Method to change the title & alias."; + $newFunction[] = "\t* Method to change the title/s & alias."; $newFunction[] = "\t*"; - $newFunction[] = "\t* @param string \$alias The alias."; - $newFunction[] = "\t* @param string \$title The title."; + $newFunction[] = "\t* @param string \$alias The alias."; + $newFunction[] = "\t* @param string/array \$title The title."; $newFunction[] = "\t*"; - $newFunction[] = "\t* @return array Contains the modified title and alias."; + $newFunction[] = "\t* @return array/string Contains the modified title/s and/or alias."; $newFunction[] = "\t*"; $newFunction[] = "\t*/"; - $newFunction[] = "\tprotected function _generateNewTitle(\$alias, \$title)"; + $newFunction[] = "\tprotected function _generateNewTitle(\$alias, \$title = null)"; $newFunction[] = "\t{"; - $newFunction[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the title & alias"; + $newFunction[] = PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Alter the title/s & alias"; $newFunction[] = "\t\t\$table = \$this->getTable();"; $newFunction[] = PHP_EOL . "\t\twhile (\$table->load(array('alias' => \$alias)))"; $newFunction[] = "\t\t{"; - $newFunction[] = "\t\t\t\$title = JString::increment(\$title);"; + $newFunction[] = "\t\t\t//" . $this->setLine(__LINE__) . " Check if this is an array of titles"; + $newFunction[] = "\t\t\tif (".$Component."Helper::checkArray(\$title))"; + $newFunction[] = "\t\t\t{"; + $newFunction[] = "\t\t\t\tforeach(\$title as \$nr => &\$_title)"; + $newFunction[] = "\t\t\t\t{"; + $newFunction[] = "\t\t\t\t\t\$_title = JString::increment(\$_title);"; + $newFunction[] = "\t\t\t\t}"; + $newFunction[] = "\t\t\t}"; + $newFunction[] = "\t\t\t//" . $this->setLine(__LINE__) . " Make sure we have a title"; + $newFunction[] = "\t\t\telseif (\$title)"; + $newFunction[] = "\t\t\t{"; + $newFunction[] = "\t\t\t\t\$title = JString::increment(\$title);"; + $newFunction[] = "\t\t\t}"; $newFunction[] = "\t\t\t\$alias = JString::increment(\$alias, 'dash');"; $newFunction[] = "\t\t}"; - $newFunction[] = PHP_EOL . "\t\treturn array(\$title, \$alias);"; + $newFunction[] = "\t\t//" . $this->setLine(__LINE__) . " Check if this is an array of titles"; + $newFunction[] = "\t\tif (".$Component."Helper::checkArray(\$title))"; + $newFunction[] = "\t\t{"; + $newFunction[] = "\t\t\t\$title[] = \$alias;"; + $newFunction[] = "\t\t\treturn \$title;"; + $newFunction[] = "\t\t}"; + $newFunction[] = "\t\t//" . $this->setLine(__LINE__) . " Make sure we have a title"; + $newFunction[] = "\t\telseif (\$title)"; + $newFunction[] = "\t\t{"; + $newFunction[] = "\t\t\treturn array(\$title, \$alias);"; + $newFunction[] = "\t\t}"; + $newFunction[] = "\t\t//" . $this->setLine(__LINE__) . " We only had an alias"; + $newFunction[] = "\t\treturn \$alias;"; $newFunction[] = "\t}"; return implode(PHP_EOL, $newFunction); } @@ -5631,9 +5699,9 @@ class Interpretation extends Fields { $newFunction = array(); $newFunction[] = PHP_EOL . PHP_EOL . "\t/**"; - $newFunction[] = "\t* Method to change the title & alias."; + $newFunction[] = "\t* Method to change the title"; $newFunction[] = "\t*"; - $newFunction[] = "\t* @param string \$title The title."; + $newFunction[] = "\t* @param string \$title The title."; $newFunction[] = "\t*"; $newFunction[] = "\t* @return array Contains the modified title and alias."; $newFunction[] = "\t*"; diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 040f3f76b..2a66ca3bc 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -1685,7 +1685,7 @@ abstract class ComponentbuilderHelper $field['values_description'] .= ''.JText::_('COM_COMPONENTBUILDER_PROPERTY').''.JText::_('COM_COMPONENTBUILDER_EXAMPLE').''.JText::_('COM_COMPONENTBUILDER_DESCRIPTION').''; foreach ($properties as $property) { - $example = (isset($property['example']) && self::checkString($property['example'])) ? ''.$property['example'].'' : ''; + $example = (isset($property['example']) && self::checkString($property['example'])) ? self::shorten($property['example'], 30) : ''; $field['values_description'] .= ''.$property['name'].''.$example.''.$property['description'].''; if(isset($settings[$property['name']])) { diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 7060bf9d5..24bcd70fc 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -348,6 +348,12 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_ADMINVIEW_DESCRIPTION="Select an admin view" COM_COMPONENTBUILDER_ADMIN_VIEW_ADMINVIEW_LABEL="View" COM_COMPONENTBUILDER_ADMIN_VIEW_AJAX_INPUT="Ajax Input" COM_COMPONENTBUILDER_ADMIN_VIEW_AJAX_INPUT_LABEL="Ajax Input" +COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER="Alias Builder" +COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_DESCRIPTION="Select the field/s you would like to use to build the alias." +COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_LABEL="Alias Builder" +COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_TYPE="Alias Builder Type" +COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_TYPE_DESCRIPTION="How should the alias be build for this view" +COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_TYPE_LABEL="Alias Builder Type" COM_COMPONENTBUILDER_ADMIN_VIEW_ALNUM="ALNUM" COM_COMPONENTBUILDER_ADMIN_VIEW_ARCHIVE="Archive" COM_COMPONENTBUILDER_ADMIN_VIEW_ARRAY="ARRAY" @@ -431,6 +437,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_CSS_VIEW_DESCRIPTION="Add your CSS here! [Do not COM_COMPONENTBUILDER_ADMIN_VIEW_CSS_VIEW_HINT="// CSS for the edit view" COM_COMPONENTBUILDER_ADMIN_VIEW_CSS_VIEW_LABEL="CSS" COM_COMPONENTBUILDER_ADMIN_VIEW_CUBE="Cube" +COM_COMPONENTBUILDER_ADMIN_VIEW_CUSTOM="Custom" COM_COMPONENTBUILDER_ADMIN_VIEW_CUSTOM_BUTTON="Custom Button" COM_COMPONENTBUILDER_ADMIN_VIEW_CUSTOM_BUTTONS="Custom Buttons" COM_COMPONENTBUILDER_ADMIN_VIEW_CUSTOM_BUTTON_LABEL="Custom Buttons" @@ -596,11 +603,15 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_NO="No" COM_COMPONENTBUILDER_ADMIN_VIEW_NONE="None" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ADVANCED_IMPORT_DESCRIPTION="

The scripts that are automatic added to the input fields below is identical to the default import scripts used. Adapt them to your own custom needs.

" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ADVANCED_IMPORT_LABEL="Advanced notice." +COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ALIAS_BUILDER_CUSTOM_DESCRIPTION="The custom behaviour allows you to select what field/s must be used to build the alias." +COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ALIAS_BUILDER_CUSTOM_LABEL="Custom Alias Behaviour" +COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ALIAS_BUILDER_DEFAULT_DESCRIPTION="The default behaviour uses the title field to build that alias, and if no title field is found uses the date." +COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_ALIAS_BUILDER_DEFAULT_LABEL="Default Alias Behaviour" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_BEGINNER_IMPORT_DESCRIPTION="

Please do not change this area unless you would like to add special import to this view that goes beyond the default import concept that Component Builder already does automatic if this view is set to have import & export in the component area where this view is linked to the component.

" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_BEGINNER_IMPORT_LABEL="Beginners notice." COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_BUTTONS_DESCRIPTION="Some Shortcut Buttons
" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_DISPLAY_DESCRIPTION="

Linked Fields

Display of the fields will load here!

Field Conditions

Display of the fields conditions will load here!
" -COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_NOTICE_DESCRIPTION="
Welcome to the new improved fields and conditions layout.

We had to remove the repeatable fields layouts since Joomla has depreciated it. With this new improved layout we trust your experience will be better then ever before.

You can still watch the tutorials, and though it was made during the time repeatable fields were still being used, the various concepts and layouts still look mostly the same.

" +COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_NOTICE_DESCRIPTION="
Welcome to the new improved fields and conditions layout.

We had to remove the repeatable fields layouts since Joomla has depreciated it. With this new improved layout we trust your experience will be better then ever before.

You can still watch the tutorials, and though it was made during the time repeatable fields were still being used, the various concepts and layouts still look mostly the same.

" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_CREATE_EDIT_NOTICE_LABEL="Fields & Conditions" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_LINKED_TO_NOTICE_DESCRIPTION="
Searching the database.
" COM_COMPONENTBUILDER_ADMIN_VIEW_NOTE_LINKED_TO_NOTICE_LABEL="Linked To" @@ -3893,7 +3904,7 @@ COM_COMPONENTBUILDER_FIELD_NOTE_FILTER_INFORMATION_DESCRIPTION="
-

Validation Rules

+

Validation Rules

Searching the system.
diff --git a/admin/layouts/admin_view/fields_conditions_left.php b/admin/layouts/admin_view/fields_conditions_left.php index 5ca658548..b255a7d45 100644 --- a/admin/layouts/admin_view/fields_conditions_left.php +++ b/admin/layouts/admin_view/fields_conditions_left.php @@ -30,7 +30,11 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'note_create_edit_notice' + 'note_create_edit_notice', + 'alias_builder_type', + 'note_alias_builder_custom', + 'note_alias_builder_default', + 'alias_builder' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/models/admin_fields.php b/admin/models/admin_fields.php index 31261e3a7..435e78a12 100644 --- a/admin/models/admin_fields.php +++ b/admin/models/admin_fields.php @@ -879,9 +879,9 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/admin_fields_conditions.php b/admin/models/admin_fields_conditions.php index 9b7cd5e54..9c08a23a4 100644 --- a/admin/models/admin_fields_conditions.php +++ b/admin/models/admin_fields_conditions.php @@ -869,9 +869,9 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index 5608cac2f..d24750335 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -132,6 +132,14 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->addtables = $addtables->toArray(); } + if (!empty($item->alias_builder)) + { + // Convert the alias_builder field to an array. + $alias_builder = new Registry; + $alias_builder->loadString($item->alias_builder); + $item->alias_builder = $alias_builder->toArray(); + } + if (!empty($item->custom_button)) { // Convert the custom_button field to an array. @@ -148,28 +156,28 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->ajax_input = $ajax_input->toArray(); } - if (!empty($item->php_import_save)) - { - // base64 Decode php_import_save. - $item->php_import_save = base64_decode($item->php_import_save); - } - if (!empty($item->html_import_view)) { // base64 Decode html_import_view. $item->html_import_view = base64_decode($item->html_import_view); } + if (!empty($item->php_import_save)) + { + // base64 Decode php_import_save. + $item->php_import_save = base64_decode($item->php_import_save); + } + if (!empty($item->php_import_headers)) { // base64 Decode php_import_headers. $item->php_import_headers = base64_decode($item->php_import_headers); } - if (!empty($item->css_view)) + if (!empty($item->php_getitem)) { - // base64 Decode css_view. - $item->css_view = base64_decode($item->css_view); + // base64 Decode php_getitem. + $item->php_getitem = base64_decode($item->php_getitem); } if (!empty($item->php_getitems)) @@ -184,10 +192,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_getitems_after_all = base64_decode($item->php_getitems_after_all); } - if (!empty($item->css_views)) + if (!empty($item->css_view)) { - // base64 Decode css_views. - $item->css_views = base64_decode($item->css_views); + // base64 Decode css_view. + $item->css_view = base64_decode($item->css_view); } if (!empty($item->php_getlistquery)) @@ -202,10 +210,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_before_save = base64_decode($item->php_before_save); } - if (!empty($item->javascript_view_file)) + if (!empty($item->css_views)) { - // base64 Decode javascript_view_file. - $item->javascript_view_file = base64_decode($item->javascript_view_file); + // base64 Decode css_views. + $item->css_views = base64_decode($item->css_views); } if (!empty($item->php_save)) @@ -220,10 +228,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_postsavehook = base64_decode($item->php_postsavehook); } - if (!empty($item->javascript_view_footer)) + if (!empty($item->javascript_view_file)) { - // base64 Decode javascript_view_footer. - $item->javascript_view_footer = base64_decode($item->javascript_view_footer); + // base64 Decode javascript_view_file. + $item->javascript_view_file = base64_decode($item->javascript_view_file); } if (!empty($item->php_allowedit)) @@ -238,10 +246,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_batchcopy = base64_decode($item->php_batchcopy); } - if (!empty($item->javascript_views_file)) + if (!empty($item->javascript_view_footer)) { - // base64 Decode javascript_views_file. - $item->javascript_views_file = base64_decode($item->javascript_views_file); + // base64 Decode javascript_view_footer. + $item->javascript_view_footer = base64_decode($item->javascript_view_footer); } if (!empty($item->php_batchmove)) @@ -256,10 +264,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_before_publish = base64_decode($item->php_before_publish); } - if (!empty($item->javascript_views_footer)) + if (!empty($item->javascript_views_file)) { - // base64 Decode javascript_views_footer. - $item->javascript_views_footer = base64_decode($item->javascript_views_footer); + // base64 Decode javascript_views_file. + $item->javascript_views_file = base64_decode($item->javascript_views_file); } if (!empty($item->php_after_publish)) @@ -274,22 +282,34 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_before_delete = base64_decode($item->php_before_delete); } + if (!empty($item->javascript_views_footer)) + { + // base64 Decode javascript_views_footer. + $item->javascript_views_footer = base64_decode($item->javascript_views_footer); + } + if (!empty($item->php_after_delete)) { // base64 Decode php_after_delete. $item->php_after_delete = base64_decode($item->php_after_delete); } + if (!empty($item->php_document)) + { + // base64 Decode php_document. + $item->php_document = base64_decode($item->php_document); + } + if (!empty($item->php_controller)) { // base64 Decode php_controller. $item->php_controller = base64_decode($item->php_controller); } - if (!empty($item->php_document)) + if (!empty($item->sql)) { - // base64 Decode php_document. - $item->php_document = base64_decode($item->php_document); + // base64 Decode sql. + $item->sql = base64_decode($item->sql); } if (!empty($item->php_model)) @@ -304,28 +324,16 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_controller_list = base64_decode($item->php_controller_list); } - if (!empty($item->sql)) - { - // base64 Decode sql. - $item->sql = base64_decode($item->sql); - } - - if (!empty($item->php_model_list)) - { - // base64 Decode php_model_list. - $item->php_model_list = base64_decode($item->php_model_list); - } - if (!empty($item->php_import_display)) { // base64 Decode php_import_display. $item->php_import_display = base64_decode($item->php_import_display); } - if (!empty($item->php_ajaxmethod)) + if (!empty($item->php_model_list)) { - // base64 Decode php_ajaxmethod. - $item->php_ajaxmethod = base64_decode($item->php_ajaxmethod); + // base64 Decode php_model_list. + $item->php_model_list = base64_decode($item->php_model_list); } if (!empty($item->php_import)) @@ -340,18 +348,18 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_import_setdata = base64_decode($item->php_import_setdata); } + if (!empty($item->php_ajaxmethod)) + { + // base64 Decode php_ajaxmethod. + $item->php_ajaxmethod = base64_decode($item->php_ajaxmethod); + } + if (!empty($item->php_import_ext)) { // base64 Decode php_import_ext. $item->php_import_ext = base64_decode($item->php_import_ext); } - if (!empty($item->php_getitem)) - { - // base64 Decode php_getitem. - $item->php_getitem = base64_decode($item->php_getitem); - } - if (empty($item->id)) { @@ -1236,6 +1244,19 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['addtables'] = ''; } + // Set the alias_builder items to data. + if (isset($data['alias_builder']) && is_array($data['alias_builder'])) + { + $alias_builder = new JRegistry; + $alias_builder->loadArray($data['alias_builder']); + $data['alias_builder'] = (string) $alias_builder; + } + elseif (!isset($data['alias_builder'])) + { + // Set the empty alias_builder to data + $data['alias_builder'] = ''; + } + // Set the custom_button items to data. if (isset($data['custom_button']) && is_array($data['custom_button'])) { @@ -1262,28 +1283,28 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['ajax_input'] = ''; } - // Set the php_import_save string to base64 string. - if (isset($data['php_import_save'])) - { - $data['php_import_save'] = base64_encode($data['php_import_save']); - } - // Set the html_import_view string to base64 string. if (isset($data['html_import_view'])) { $data['html_import_view'] = base64_encode($data['html_import_view']); } + // Set the php_import_save string to base64 string. + if (isset($data['php_import_save'])) + { + $data['php_import_save'] = base64_encode($data['php_import_save']); + } + // Set the php_import_headers string to base64 string. if (isset($data['php_import_headers'])) { $data['php_import_headers'] = base64_encode($data['php_import_headers']); } - // Set the css_view string to base64 string. - if (isset($data['css_view'])) + // Set the php_getitem string to base64 string. + if (isset($data['php_getitem'])) { - $data['css_view'] = base64_encode($data['css_view']); + $data['php_getitem'] = base64_encode($data['php_getitem']); } // Set the php_getitems string to base64 string. @@ -1298,10 +1319,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_getitems_after_all'] = base64_encode($data['php_getitems_after_all']); } - // Set the css_views string to base64 string. - if (isset($data['css_views'])) + // Set the css_view string to base64 string. + if (isset($data['css_view'])) { - $data['css_views'] = base64_encode($data['css_views']); + $data['css_view'] = base64_encode($data['css_view']); } // Set the php_getlistquery string to base64 string. @@ -1316,10 +1337,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_before_save'] = base64_encode($data['php_before_save']); } - // Set the javascript_view_file string to base64 string. - if (isset($data['javascript_view_file'])) + // Set the css_views string to base64 string. + if (isset($data['css_views'])) { - $data['javascript_view_file'] = base64_encode($data['javascript_view_file']); + $data['css_views'] = base64_encode($data['css_views']); } // Set the php_save string to base64 string. @@ -1334,10 +1355,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_postsavehook'] = base64_encode($data['php_postsavehook']); } - // Set the javascript_view_footer string to base64 string. - if (isset($data['javascript_view_footer'])) + // Set the javascript_view_file string to base64 string. + if (isset($data['javascript_view_file'])) { - $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); + $data['javascript_view_file'] = base64_encode($data['javascript_view_file']); } // Set the php_allowedit string to base64 string. @@ -1352,10 +1373,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_batchcopy'] = base64_encode($data['php_batchcopy']); } - // Set the javascript_views_file string to base64 string. - if (isset($data['javascript_views_file'])) + // Set the javascript_view_footer string to base64 string. + if (isset($data['javascript_view_footer'])) { - $data['javascript_views_file'] = base64_encode($data['javascript_views_file']); + $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); } // Set the php_batchmove string to base64 string. @@ -1370,10 +1391,10 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_before_publish'] = base64_encode($data['php_before_publish']); } - // Set the javascript_views_footer string to base64 string. - if (isset($data['javascript_views_footer'])) + // Set the javascript_views_file string to base64 string. + if (isset($data['javascript_views_file'])) { - $data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']); + $data['javascript_views_file'] = base64_encode($data['javascript_views_file']); } // Set the php_after_publish string to base64 string. @@ -1388,22 +1409,34 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_before_delete'] = base64_encode($data['php_before_delete']); } + // Set the javascript_views_footer string to base64 string. + if (isset($data['javascript_views_footer'])) + { + $data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']); + } + // Set the php_after_delete string to base64 string. if (isset($data['php_after_delete'])) { $data['php_after_delete'] = base64_encode($data['php_after_delete']); } + // Set the php_document string to base64 string. + if (isset($data['php_document'])) + { + $data['php_document'] = base64_encode($data['php_document']); + } + // Set the php_controller string to base64 string. if (isset($data['php_controller'])) { $data['php_controller'] = base64_encode($data['php_controller']); } - // Set the php_document string to base64 string. - if (isset($data['php_document'])) + // Set the sql string to base64 string. + if (isset($data['sql'])) { - $data['php_document'] = base64_encode($data['php_document']); + $data['sql'] = base64_encode($data['sql']); } // Set the php_model string to base64 string. @@ -1418,28 +1451,16 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_controller_list'] = base64_encode($data['php_controller_list']); } - // Set the sql string to base64 string. - if (isset($data['sql'])) - { - $data['sql'] = base64_encode($data['sql']); - } - - // Set the php_model_list string to base64 string. - if (isset($data['php_model_list'])) - { - $data['php_model_list'] = base64_encode($data['php_model_list']); - } - // Set the php_import_display string to base64 string. if (isset($data['php_import_display'])) { $data['php_import_display'] = base64_encode($data['php_import_display']); } - // Set the php_ajaxmethod string to base64 string. - if (isset($data['php_ajaxmethod'])) + // Set the php_model_list string to base64 string. + if (isset($data['php_model_list'])) { - $data['php_ajaxmethod'] = base64_encode($data['php_ajaxmethod']); + $data['php_model_list'] = base64_encode($data['php_model_list']); } // Set the php_import string to base64 string. @@ -1454,16 +1475,16 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_import_setdata'] = base64_encode($data['php_import_setdata']); } + // Set the php_ajaxmethod string to base64 string. + if (isset($data['php_ajaxmethod'])) + { + $data['php_ajaxmethod'] = base64_encode($data['php_ajaxmethod']); + } + // Set the php_import_ext string to base64 string. if (isset($data['php_import_ext'])) { $data['php_import_ext'] = base64_encode($data['php_import_ext']); - } - - // Set the php_getitem string to base64 string. - if (isset($data['php_getitem'])) - { - $data['php_getitem'] = base64_encode($data['php_getitem']); } // Set the Params Items to data diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index 7cd94f66c..6b51ca4fb 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -262,74 +262,74 @@ class ComponentbuilderModelAdmin_views extends JModelList continue; } - // decode php_import_save - $item->php_import_save = base64_decode($item->php_import_save); // decode html_import_view $item->html_import_view = base64_decode($item->html_import_view); + // decode php_import_save + $item->php_import_save = base64_decode($item->php_import_save); // decode php_import_headers $item->php_import_headers = base64_decode($item->php_import_headers); - // decode css_view - $item->css_view = base64_decode($item->css_view); + // decode php_getitem + $item->php_getitem = base64_decode($item->php_getitem); // decode php_getitems $item->php_getitems = base64_decode($item->php_getitems); // decode php_getitems_after_all $item->php_getitems_after_all = base64_decode($item->php_getitems_after_all); - // decode css_views - $item->css_views = base64_decode($item->css_views); + // decode css_view + $item->css_view = base64_decode($item->css_view); // decode php_getlistquery $item->php_getlistquery = base64_decode($item->php_getlistquery); // decode php_before_save $item->php_before_save = base64_decode($item->php_before_save); - // decode javascript_view_file - $item->javascript_view_file = base64_decode($item->javascript_view_file); + // decode css_views + $item->css_views = base64_decode($item->css_views); // decode php_save $item->php_save = base64_decode($item->php_save); // decode php_postsavehook $item->php_postsavehook = base64_decode($item->php_postsavehook); - // decode javascript_view_footer - $item->javascript_view_footer = base64_decode($item->javascript_view_footer); + // decode javascript_view_file + $item->javascript_view_file = base64_decode($item->javascript_view_file); // decode php_allowedit $item->php_allowedit = base64_decode($item->php_allowedit); // decode php_batchcopy $item->php_batchcopy = base64_decode($item->php_batchcopy); - // decode javascript_views_file - $item->javascript_views_file = base64_decode($item->javascript_views_file); + // decode javascript_view_footer + $item->javascript_view_footer = base64_decode($item->javascript_view_footer); // decode php_batchmove $item->php_batchmove = base64_decode($item->php_batchmove); // decode php_before_publish $item->php_before_publish = base64_decode($item->php_before_publish); - // decode javascript_views_footer - $item->javascript_views_footer = base64_decode($item->javascript_views_footer); + // decode javascript_views_file + $item->javascript_views_file = base64_decode($item->javascript_views_file); // decode php_after_publish $item->php_after_publish = base64_decode($item->php_after_publish); // decode php_before_delete $item->php_before_delete = base64_decode($item->php_before_delete); + // decode javascript_views_footer + $item->javascript_views_footer = base64_decode($item->javascript_views_footer); // decode php_after_delete $item->php_after_delete = base64_decode($item->php_after_delete); - // decode php_controller - $item->php_controller = base64_decode($item->php_controller); // decode php_document $item->php_document = base64_decode($item->php_document); + // decode php_controller + $item->php_controller = base64_decode($item->php_controller); + // decode sql + $item->sql = base64_decode($item->sql); // decode php_model $item->php_model = base64_decode($item->php_model); // decode php_controller_list $item->php_controller_list = base64_decode($item->php_controller_list); - // decode sql - $item->sql = base64_decode($item->sql); - // decode php_model_list - $item->php_model_list = base64_decode($item->php_model_list); // decode php_import_display $item->php_import_display = base64_decode($item->php_import_display); - // decode php_ajaxmethod - $item->php_ajaxmethod = base64_decode($item->php_ajaxmethod); + // decode php_model_list + $item->php_model_list = base64_decode($item->php_model_list); // decode php_import $item->php_import = base64_decode($item->php_import); // decode php_import_setdata $item->php_import_setdata = base64_decode($item->php_import_setdata); + // decode php_ajaxmethod + $item->php_ajaxmethod = base64_decode($item->php_ajaxmethod); // decode php_import_ext $item->php_import_ext = base64_decode($item->php_import_ext); - // decode php_getitem - $item->php_getitem = base64_decode($item->php_getitem); // unset the values we don't want exported. unset($item->asset_id); unset($item->checked_out); diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 3a0120bd6..4e03dfaed 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -215,6 +215,7 @@ class ComponentbuilderModelAjax extends JModelList 'library_files_folders_urls' => 'libraries_files_folders_urls', 'admin_fields' => 'admins_fields', 'admin_fields_conditions' => 'admins_fields_conditions', + 'validation_rule' => 'validation_rules', 'field' => 'fields', 'component_admin_views' => 'components_admin_views' , 'component_site_views' => 'components_site_views', @@ -227,7 +228,7 @@ class ComponentbuilderModelAjax extends JModelList 'component_files_folders' => 'components_files_folders', 'language' => true); - public function getButton($type) + public function getButton($type, $size) { if (isset($this->buttonArray[$type])) { @@ -244,18 +245,27 @@ class ComponentbuilderModelAjax extends JModelList // only load referal if not new item. $ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id']; } - // build the button - $button = '
-
- -
- -
'; + // build url (A tag) + $startAtag = ''; + // build the smaller button + if (2 == $size) + { + $button = $startAtag.' ' . JText::_('COM_COMPONENTBUILDER_CREATE') . ''; + } + else + // build the big button + { + $button = '
+
+ +
+
'.$startAtag.' + + ' . JText::_('COM_COMPONENTBUILDER_NEW') . ' + +
+
'; + } // return the button attached to input field return $button; } @@ -307,7 +317,7 @@ class ComponentbuilderModelAjax extends JModelList $button[] = ''; $button[] = '
'; } - $button[] = ''; + $button[] = ''; if (1 == $size) { $button[] = ''; @@ -335,7 +345,36 @@ class ComponentbuilderModelAjax extends JModelList return ''; } - public static function getDynamicScripts($type) + public function checkAliasField($type) + { + // get the view name & id + $values = $this->getViewID(); + if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && in_array($values['a_view'], $this->allowedViewsArray)) + { + // get the fields + if ($fields = ComponentbuilderHelper::getVar('admin_fields', $values['a_id'], 'admin_view', 'addfields')) + { + // open the fields + if (ComponentbuilderHelper::checkJson($fields)) + { + $fields = json_decode($fields, true); + if (ComponentbuilderHelper::checkArray($fields)) + { + foreach($fields as $field) + { + if (isset($field['alias']) && $field['alias'] == 1) + { + return true; + } + } + } + } + } + } + return false; + } + + public function getDynamicScripts($type) { // get from global helper return ComponentbuilderHelper::getDynamicScripts($type); @@ -831,7 +870,8 @@ class ComponentbuilderModelAjax extends JModelList if ($this->canEdit($id, $view)) { $edit = "index.php?option=com_componentbuilder&view=".$views."&task=".$view.".edit&id=".$id.$this->ref; - return ' '; + $title = ComponentbuilderHelper::safeString(JText::_('COM_COMPONENTBUILDER_EDIT').' '.$view, 'W'); + return ' '; } return ''; @@ -2133,10 +2173,10 @@ class ComponentbuilderModelAjax extends JModelList $exitingNames["boolean"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_THE_VALUES_ZERO_ONE_TRUE_OR_FALSE_CASEINSENSITIVE"); $exitingNames["color"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_ONLY_EMPTY_VALUES_CONVERTED_TO_ZERO_AND_STRINGS_IN_THE_FORM_RGB_OR_RRGGBB_WHERE_R_G_AND_B_ARE_HEX_VALUES"); $exitingNames["email"] = JText::_("COM_COMPONENTBUILDER_ACCEPTS_AN_EMAIL_ADDRESS_SATISFIES_A_BASIC_SYNTAX_CHECK_IN_THE_PATTERN_OF_QUOTXYZZQUOT_WITH_NO_INVALID_CHARACTERS"); - $exitingNames["equals"] = JText::sprintf("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_THE_SAME_AS_THAT_HELD_IN_THE_FIELD_NAMED_QUOTFIELDQUOT_EGS", '
<input type="text" name="email_check" validate="equals" field="email" />'); + $exitingNames["equals"] = JText::sprintf("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_THE_SAME_AS_THAT_HELD_IN_THE_FIELD_NAMED_QUOTFIELDQUOT_EGS", '
<input
  type="text"
  name="email_check"
  validate="equals"
  field="email"
/>
'); $exitingNames["options"] = JText::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_ENTERED_BE_ONE_OF_THE_OPTIONS_IN_AN_ELEMENT_OF_TYPEQUOTLISTQUOT_THAT_IS_THAT_THE_ELEMENT_IS_A_SELECT_LIST"); $exitingNames["tel"] = JText::_("COM_COMPONENTBUILDER_REQUIRES_THE_VALUE_TO_BE_A_TELEPHONE_NUMBER_COMPLYING_WITH_THE_STANDARDS_OF_NANPA_ITUT_TRECEONE_HUNDRED_AND_SIXTY_FOUR_OR_IETF_RFCFOUR_THOUSAND_NINE_HUNDRED_AND_THIRTY_THREE"); - $exitingNames["url"] = JText::sprintf("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_IS_A_URL_WITH_A_VALID_SCHEME_WHICH_CAN_BE_RESTRICTED_BY_THE_OPTIONAL_COMMASEPARATED_FIELD_SCHEME_AND_PASSES_A_BASIC_SYNTAX_CHECK_EGS", '
<input type="text" name="link" validate="url" scheme="http,https,mailto" />'); + $exitingNames["url"] = JText::sprintf("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_IS_A_URL_WITH_A_VALID_SCHEME_WHICH_CAN_BE_RESTRICTED_BY_THE_OPTIONAL_COMMASEPARATED_FIELD_SCHEME_AND_PASSES_A_BASIC_SYNTAX_CHECK_EGS", '
<input
  type="text"
  name="link"
  validate="url"
  scheme="http,https,mailto"
/>
'); $exitingNames["username"] = JText::_("COM_COMPONENTBUILDER_VALIDATES_THAT_THE_VALUE_DOES_NOT_APPEAR_AS_A_USERNAME_ON_THE_SYSTEM_THAT_IS_THAT_IT_IS_A_VALID_NEW_USERNAME_DOES_NOT_SYNTAX_CHECK_IT_AS_A_VALID_NAME"); // now get the custom created rules $db = JFactory::getDbo(); diff --git a/admin/models/component_admin_views.php b/admin/models/component_admin_views.php index 775c01137..069b36a6e 100644 --- a/admin/models/component_admin_views.php +++ b/admin/models/component_admin_views.php @@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/component_config.php b/admin/models/component_config.php index c65f86bec..9a405f83a 100644 --- a/admin/models/component_config.php +++ b/admin/models/component_config.php @@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_config extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/component_custom_admin_menus.php b/admin/models/component_custom_admin_menus.php index 0e1d68d95..60af952b8 100644 --- a/admin/models/component_custom_admin_menus.php +++ b/admin/models/component_custom_admin_menus.php @@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/component_custom_admin_views.php b/admin/models/component_custom_admin_views.php index 3bad6c214..2eae997fe 100644 --- a/admin/models/component_custom_admin_views.php +++ b/admin/models/component_custom_admin_views.php @@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/component_dashboard.php b/admin/models/component_dashboard.php index 37d7cbc6a..889291e19 100644 --- a/admin/models/component_dashboard.php +++ b/admin/models/component_dashboard.php @@ -892,9 +892,9 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/component_files_folders.php b/admin/models/component_files_folders.php index 771581ead..943a5f7dd 100644 --- a/admin/models/component_files_folders.php +++ b/admin/models/component_files_folders.php @@ -944,9 +944,9 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/component_mysql_tweaks.php b/admin/models/component_mysql_tweaks.php index 23b45dda1..8de85253d 100644 --- a/admin/models/component_mysql_tweaks.php +++ b/admin/models/component_mysql_tweaks.php @@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/component_site_views.php b/admin/models/component_site_views.php index 5590aeba7..747274161 100644 --- a/admin/models/component_site_views.php +++ b/admin/models/component_site_views.php @@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/component_updates.php b/admin/models/component_updates.php index ab3eb64b6..cd9fbe508 100644 --- a/admin/models/component_updates.php +++ b/admin/models/component_updates.php @@ -880,9 +880,9 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/custom_admin_view.php b/admin/models/custom_admin_view.php index 9080a9d59..f00df0ba8 100644 --- a/admin/models/custom_admin_view.php +++ b/admin/models/custom_admin_view.php @@ -1140,9 +1140,9 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/custom_code.php b/admin/models/custom_code.php index f24ddb0b9..91d9e69d6 100644 --- a/admin/models/custom_code.php +++ b/admin/models/custom_code.php @@ -876,9 +876,9 @@ class ComponentbuilderModelCustom_code extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/dynamic_get.php b/admin/models/dynamic_get.php index 9079182cf..2db109232 100644 --- a/admin/models/dynamic_get.php +++ b/admin/models/dynamic_get.php @@ -1146,9 +1146,9 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/field.php b/admin/models/field.php index 8f7cc3a5d..e4520c5c2 100644 --- a/admin/models/field.php +++ b/admin/models/field.php @@ -973,9 +973,9 @@ class ComponentbuilderModelField extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/fields/aliasbuilder.php b/admin/models/fields/aliasbuilder.php new file mode 100644 index 000000000..8d53c335d --- /dev/null +++ b/admin/models/fields/aliasbuilder.php @@ -0,0 +1,205 @@ + + @github Joomla Component Builder + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +// import the list field type +jimport('joomla.form.helper'); +JFormHelper::loadFieldClass('list'); + +/** + * Aliasbuilder Form Field class for the Componentbuilder component + */ +class JFormFieldAliasbuilder extends JFormFieldList +{ + /** + * The aliasbuilder field type. + * + * @var string + */ + public $type = 'aliasbuilder'; + /** + * Override to add new button + * + * @return string The field input markup. + * + * @since 3.2 + */ + protected function getInput() + { + // see if we should add buttons + $setButton = $this->getAttribute('button'); + // get html + $html = parent::getInput(); + // if true set button + if ($setButton === 'true') + { + $button = array(); + $script = array(); + $buttonName = $this->getAttribute('name'); + // get the input from url + $app = JFactory::getApplication(); + $jinput = $app->input; + // get the view name & id + $values = $jinput->getArray(array( + 'id' => 'int', + 'view' => 'word' + )); + // check if new item + $ref = ''; + $refJ = ''; + if (!is_null($values['id']) && strlen($values['view'])) + { + // only load referal if not new item. + $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; + $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + } + $user = JFactory::getUser(); + // only add if user allowed to create field + if ($user->authorise('field.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + { + // build Create button + $buttonNamee = trim($buttonName); + $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee); + $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee); + $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee); + $buttonNamee = ucfirst(strtolower($buttonNamee)); + $button[] = ' + '; + } + // only add if user allowed to edit field + if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area. + { + // build edit button + $buttonNamee = trim($buttonName); + $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee); + $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee); + $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee); + $buttonNamee = ucfirst(strtolower($buttonNamee)); + $button[] = ''; + // build script + $script[] = " + jQuery(document).ready(function() { + jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) { + e.preventDefault(); + var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val(); + ".$buttonName."Button(".$buttonName."Value); + }); + var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val(); + ".$buttonName."Button(".$buttonName."Value); + }); + function ".$buttonName."Button(value) { + if (value > 0) { + // hide the create button + jQuery('#".$buttonName."Create').hide(); + // show edit button + jQuery('#".$buttonName."Edit').show(); + var url = 'index.php?option=com_componentbuilder&view=fields&task=field.edit&id='+value+'".$refJ."'; + jQuery('#".$buttonName."Edit').attr('href', url); + } else { + // show the create button + jQuery('#".$buttonName."Create').show(); + // hide edit button + jQuery('#".$buttonName."Edit').hide(); + } + }"; + } + // check if button was created for field field. + if (is_array($button) && count($button) > 0) + { + // Load the needed script. + $document = JFactory::getDocument(); + $document->addScriptDeclaration(implode(' ',$script)); + // return the button attached to input field. + return '
' .$html . implode('',$button).'
'; + } + } + return $html; + } + + /** + * Method to get a list of options for a list input. + * + * @return array An array of JHtml options. + */ + public function getOptions() + { + // load the db opbject + $db = JFactory::getDBO(); + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the id + $adminView = $jinput->getInt('id', 0); + // rest the fields ids + $fieldIds = array(); + if (is_numeric($adminView) && $adminView >= 1) + { + // get all the fields linked to the admin view + if ($addFields = ComponentbuilderHelper::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields')) + { + if (ComponentbuilderHelper::checkJson($addFields)) + { + $addFields = json_decode($addFields, true); + if (ComponentbuilderHelper::checkArray($addFields)) + { + foreach($addFields as $addField) + { + if (isset($addField['field']) && (!isset($addField['alias']) || 1 != $addField['alias'])) + { + $fieldIds[] = (int) $addField['field']; + } + } + } + } + } + } + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name','b.name'),array('id','name','type'))); + $query->from($db->quoteName('#__componentbuilder_field', 'a')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_fieldtype', 'b') . ' ON (' . $db->quoteName('a.fieldtype') . ' = ' . $db->quoteName('b.id') . ')'); + $query->where($db->quoteName('a.published') . ' >= 1'); + // filter by fields linked + if (ComponentbuilderHelper::checkArray($fieldIds)) + { + // only load these fields + $query->where($db->quoteName('a.id') . ' IN (' . implode(',', $fieldIds) . ')'); + } + $query->order('a.name ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [' . $item->type . ']'); + } + } + return $options; + } +} diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index d6bc287e6..07c079774 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -1140,9 +1140,9 @@ class ComponentbuilderModelFieldtype extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/forms/admin_view.js b/admin/models/forms/admin_view.js index b3b74ff33..d43e0bae6 100644 --- a/admin/models/forms/admin_view.js +++ b/admin/models/forms/admin_view.js @@ -1199,6 +1199,8 @@ function isSet(val) jQuery(document).ready(function() { + // check if this view has alias field + checkAliasField(); // get the linked details getLinked(); // set button @@ -1214,6 +1216,35 @@ jQuery(document).ready(function() addButton('field','create_edit_buttons'); // <-- third }); +function checkAliasField() { + checkAliasField_server(1).done(function(result) { + if(result){ + // remove the notice + jQuery('.note_create_edit_notice_p').remove(); + } else { + // hide everything about alias management + jQuery('#jform_alias_builder_type').closest('.control-group').remove(); + jQuery('#jform_alias_builder').closest('.control-group').remove(); + jQuery('.note_alias_builder_default').closest('.control-group').remove(); + jQuery('.note_alias_builder_custom').closest('.control-group').remove(); + } + }); +} + +function checkAliasField_server(type){ + var getUrl = "index.php?option=com_componentbuilder&task=ajax.checkAliasField&format=json&vdm="+vastDevMod; + if(token.length > 0 && type > 0){ + var request = 'token='+token+'&type=' + type; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'jsonp', + data: request, + jsonp: 'callback' + }); +} + function getAjaxDisplay(type){ getAjaxDisplay_server(type).done(function(result) { if(result){ @@ -1267,10 +1298,10 @@ function addButtonID(type, where, size){ }); } -function addButton_server(type){ +function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type; + var request = 'token='+token+'&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -1280,10 +1311,16 @@ function addButton_server(type){ jsonp: 'callback' }); } -function addButton(type,where){ - addButton_server(type).done(function(result) { +function addButton(type, where, size){ + // just to insure that default behaviour still works + size = typeof size !== 'undefined' ? size : 1; + addButton_server(type, size).done(function(result) { if(result){ - addData(result,'#jform_'+where); + if (2 == size) { + jQuery('#'+where).html(result); + } else { + addData(result, '#jform_'+where); + } } }) } diff --git a/admin/models/forms/admin_view.xml b/admin/models/forms/admin_view.xml index 3c0ae5547..1176afd64 100644 --- a/admin/models/forms/admin_view.xml +++ b/admin/models/forms/admin_view.xml @@ -144,20 +144,6 @@ message="COM_COMPONENTBUILDER_ADMIN_VIEW_SHORT_DESCRIPTION_MESSAGE" hint="COM_COMPONENTBUILDER_ADMIN_VIEW_SHORT_DESCRIPTION_HINT" /> - - - - - - COM_COMPONENTBUILDER_ADMIN_VIEW_NO - + + + - - + + + + + + - + @@ -300,11 +306,11 @@ name="not_required" default="[]" /> - + @@ -316,19 +322,8 @@ - - + + - + - + @@ -456,11 +456,11 @@ /> - + @@ -472,11 +472,11 @@ - + @@ -576,6 +576,22 @@ + + + + + + + + COM_COMPONENTBUILDER_ADMIN_VIEW_NO - - + + + + + + COM_COMPONENTBUILDER_ADMIN_VIEW_NO - - + + COM_COMPONENTBUILDER_ADMIN_VIEW_NO - - + + - + - - - - + type="aliasbuilder" + name="alias_builder" + label="COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_LABEL" + description="COM_COMPONENTBUILDER_ADMIN_VIEW_ALIAS_BUILDER_DESCRIPTION" + class="list_class fieldFull" + multiple="true" + showon="alias_builder_type:2" + /> COM_COMPONENTBUILDER_ADMIN_VIEW_NO - + @@ -716,11 +740,11 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_HEADERS_HINT" required="true" /> - + @@ -730,19 +754,8 @@ - - + + + + + + - + @@ -791,17 +819,17 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETITEMS_AFTER_ALL_HINT" required="true" /> - + @@ -817,11 +845,11 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_GETLISTQUERY_HINT" required="true" /> - + @@ -844,17 +872,17 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BEFORE_SAVE_HINT" required="true" /> - + @@ -870,11 +898,11 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_SAVE_HINT" required="true" /> - + @@ -897,17 +925,17 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_POSTSAVEHOOK_HINT" required="true" /> - + @@ -923,11 +951,11 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_ALLOWEDIT_HINT" required="true" /> - + @@ -950,17 +978,17 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BATCHCOPY_HINT" required="true" /> - + @@ -976,11 +1004,11 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BATCHMOVE_HINT" required="true" /> - + @@ -1003,17 +1031,17 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BEFORE_PUBLISH_HINT" required="true" /> - + @@ -1029,11 +1057,11 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AFTER_PUBLISH_HINT" required="true" /> - + @@ -1056,6 +1084,59 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_BEFORE_DELETE_HINT" required="true" /> + + + + + + + + + + + + - - - - - - - - COM_COMPONENTBUILDER_ADMIN_VIEW_DUMP - + @@ -1656,6 +1685,47 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_SQL_HINT" required="true" /> + + + + + + + + - - + + COM_COMPONENTBUILDER_ADMIN_VIEW_NO - + @@ -1711,17 +1792,17 @@ hint="COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_AJAXMETHOD_HINT" required="true" /> - + @@ -1856,59 +1937,6 @@ /> - - - - - - - - - - - - diff --git a/admin/models/forms/field.js b/admin/models/forms/field.js index fea8491b9..2b10c0b63 100644 --- a/admin/models/forms/field.js +++ b/admin/models/forms/field.js @@ -516,6 +516,8 @@ jQuery(document).ready(function() getLinked(); // get the validation rules getValidationRulesTable(); + // set button to create more fields + addButton('validation_rule', 'validation_rules_header', 2); }); function getLinked_server(type){ @@ -539,6 +541,33 @@ function getLinked(){ } }); } + +function addButton_server(type, size){ + var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); + if(token.length > 0 && type.length > 0){ + var request = 'token='+token+'&type='+type+'&size='+size; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'jsonp', + data: request, + jsonp: 'callback' + }); +} +function addButton(type, where, size){ + // just to insure that default behaviour still works + size = typeof size !== 'undefined' ? size : 1; + addButton_server(type, size).done(function(result) { + if(result){ + if (2 == size) { + jQuery('#'+where).html(result); + } else { + addData(result, '#jform_'+where); + } + } + }) +} function getFieldOptions_server(fieldId){ var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldOptions&format=json"; @@ -561,7 +590,7 @@ function getFieldOptions(id,setValue){ jQuery('textarea#jform_xml').val(result.values); } jQuery('#help').remove(); - jQuery('.helpNote').append('
'+result.description+'
'+result.values_description+'
'); + jQuery('.helpNote').append('
'+result.description+'
'+result.values_description+'
'); } }) } diff --git a/admin/models/forms/joomla_component.js b/admin/models/forms/joomla_component.js index 786e02498..618bf90e7 100644 --- a/admin/models/forms/joomla_component.js +++ b/admin/models/forms/joomla_component.js @@ -994,10 +994,10 @@ function addButtonID(type, where, size){ }); } -function addButton_server(type){ +function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type; + var request = 'token='+token+'&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -1007,10 +1007,16 @@ function addButton_server(type){ jsonp: 'callback' }); } -function addButton(type,where){ - addButton_server(type).done(function(result) { +function addButton(type, where, size){ + // just to insure that default behaviour still works + size = typeof size !== 'undefined' ? size : 1; + addButton_server(type, size).done(function(result) { if(result){ - addData(result,'#jform_'+where); + if (2 == size) { + jQuery('#'+where).html(result); + } else { + addData(result, '#jform_'+where); + } } }) } diff --git a/admin/models/forms/language_translation.js b/admin/models/forms/language_translation.js index 12192c8bd..5c7deecd7 100644 --- a/admin/models/forms/language_translation.js +++ b/admin/models/forms/language_translation.js @@ -34,10 +34,10 @@ function addData(result,where){ jQuery(result).insertAfter(jQuery(where).closest('.control-group')); } -function addButton_server(type){ +function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type; + var request = 'token='+token+'&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -47,10 +47,16 @@ function addButton_server(type){ jsonp: 'callback' }); } -function addButton(type,where){ - addButton_server(type).done(function(result) { +function addButton(type, where, size){ + // just to insure that default behaviour still works + size = typeof size !== 'undefined' ? size : 1; + addButton_server(type, size).done(function(result) { if(result){ - addData(result,'#jform_'+where); + if (2 == size) { + jQuery('#'+where).html(result); + } else { + addData(result, '#jform_'+where); + } } }) } diff --git a/admin/models/forms/library.js b/admin/models/forms/library.js index 05d3bbc30..b06f35d92 100644 --- a/admin/models/forms/library.js +++ b/admin/models/forms/library.js @@ -453,10 +453,10 @@ function addButtonID(type, where, size){ }); } -function addButton_server(type){ +function addButton_server(type, size){ var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod); if(token.length > 0 && type.length > 0){ - var request = 'token='+token+'&type='+type; + var request = 'token='+token+'&type='+type+'&size='+size; } return jQuery.ajax({ type: 'GET', @@ -466,10 +466,16 @@ function addButton_server(type){ jsonp: 'callback' }); } -function addButton(type,where){ - addButton_server(type).done(function(result) { +function addButton(type, where, size){ + // just to insure that default behaviour still works + size = typeof size !== 'undefined' ? size : 1; + addButton_server(type, size).done(function(result) { if(result){ - addData(result,'#jform_'+where); + if (2 == size) { + jQuery('#'+where).html(result); + } else { + addData(result, '#jform_'+where); + } } }) } diff --git a/admin/models/help_document.php b/admin/models/help_document.php index df8a7e30a..738bd6c0f 100644 --- a/admin/models/help_document.php +++ b/admin/models/help_document.php @@ -849,7 +849,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { - if ($data['alias'] == null) + if ($data['alias'] == null || empty($data['alias'])) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { @@ -867,8 +867,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin $msg = JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SAVE_WARNING'); } - list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']); - $data['alias'] = $alias; + $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { @@ -923,26 +922,49 @@ class ComponentbuilderModelHelp_document extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title/s & alias. * - * @param string $alias The alias. - * @param string $title The title. + * @param string $alias The alias. + * @param string/array $title The title. * - * @return array Contains the modified title and alias. + * @return array/string Contains the modified title/s and/or alias. * */ - protected function _generateNewTitle($alias, $title) + protected function _generateNewTitle($alias, $title = null) { - // Alter the title & alias + // Alter the title/s & alias $table = $this->getTable(); while ($table->load(array('alias' => $alias))) { - $title = JString::increment($title); + // Check if this is an array of titles + if (ComponentbuilderHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = JString::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = JString::increment($title); + } $alias = JString::increment($alias, 'dash'); } - - return array($title, $alias); + // Check if this is an array of titles + if (ComponentbuilderHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; } } diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index d6f5cceab..19edf160d 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -1233,9 +1233,9 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/language.php b/admin/models/language.php index eeac5ce26..7022e7509 100644 --- a/admin/models/language.php +++ b/admin/models/language.php @@ -826,9 +826,9 @@ class ComponentbuilderModelLanguage extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/language_translation.php b/admin/models/language_translation.php index 1b79e0f1c..98d084811 100644 --- a/admin/models/language_translation.php +++ b/admin/models/language_translation.php @@ -885,9 +885,9 @@ class ComponentbuilderModelLanguage_translation extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/layout.php b/admin/models/layout.php index d5d61b192..c379ae4e2 100644 --- a/admin/models/layout.php +++ b/admin/models/layout.php @@ -885,7 +885,7 @@ class ComponentbuilderModelLayout extends JModelAdmin // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { - if ($data['alias'] == null) + if ($data['alias'] == null || empty($data['alias'])) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { @@ -903,8 +903,7 @@ class ComponentbuilderModelLayout extends JModelAdmin $msg = JText::_('COM_COMPONENTBUILDER_LAYOUT_SAVE_WARNING'); } - list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); - $data['alias'] = $alias; + $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { @@ -959,26 +958,49 @@ class ComponentbuilderModelLayout extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title/s & alias. * - * @param string $alias The alias. - * @param string $title The title. + * @param string $alias The alias. + * @param string/array $title The title. * - * @return array Contains the modified title and alias. + * @return array/string Contains the modified title/s and/or alias. * */ - protected function _generateNewTitle($alias, $title) + protected function _generateNewTitle($alias, $title = null) { - // Alter the title & alias + // Alter the title/s & alias $table = $this->getTable(); while ($table->load(array('alias' => $alias))) { - $title = JString::increment($title); + // Check if this is an array of titles + if (ComponentbuilderHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = JString::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = JString::increment($title); + } $alias = JString::increment($alias, 'dash'); } - - return array($title, $alias); + // Check if this is an array of titles + if (ComponentbuilderHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; } } diff --git a/admin/models/library.php b/admin/models/library.php index 74a191ccb..869c3a030 100644 --- a/admin/models/library.php +++ b/admin/models/library.php @@ -1026,9 +1026,9 @@ class ComponentbuilderModelLibrary extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/library_config.php b/admin/models/library_config.php index d95ad520d..6255dff06 100644 --- a/admin/models/library_config.php +++ b/admin/models/library_config.php @@ -849,9 +849,9 @@ class ComponentbuilderModelLibrary_config extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/library_files_folders_urls.php b/admin/models/library_files_folders_urls.php index a92590104..6730d5ce1 100644 --- a/admin/models/library_files_folders_urls.php +++ b/admin/models/library_files_folders_urls.php @@ -933,9 +933,9 @@ class ComponentbuilderModelLibrary_files_folders_urls extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/server.php b/admin/models/server.php index e8100c398..18a3839b2 100644 --- a/admin/models/server.php +++ b/admin/models/server.php @@ -1064,9 +1064,9 @@ class ComponentbuilderModelServer extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/site_view.php b/admin/models/site_view.php index 4acbd47aa..7082ed1ac 100644 --- a/admin/models/site_view.php +++ b/admin/models/site_view.php @@ -1163,9 +1163,9 @@ class ComponentbuilderModelSite_view extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/snippet.php b/admin/models/snippet.php index 56aa7e8fc..73ae5a0bb 100644 --- a/admin/models/snippet.php +++ b/admin/models/snippet.php @@ -856,9 +856,9 @@ class ComponentbuilderModelSnippet extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/snippet_type.php b/admin/models/snippet_type.php index 09d0d7d41..729455483 100644 --- a/admin/models/snippet_type.php +++ b/admin/models/snippet_type.php @@ -826,9 +826,9 @@ class ComponentbuilderModelSnippet_type extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/models/template.php b/admin/models/template.php index e9dddf35b..52805d544 100644 --- a/admin/models/template.php +++ b/admin/models/template.php @@ -885,7 +885,7 @@ class ComponentbuilderModelTemplate extends JModelAdmin // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { - if ($data['alias'] == null) + if ($data['alias'] == null || empty($data['alias'])) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { @@ -903,8 +903,7 @@ class ComponentbuilderModelTemplate extends JModelAdmin $msg = JText::_('COM_COMPONENTBUILDER_TEMPLATE_SAVE_WARNING'); } - list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); - $data['alias'] = $alias; + $data['alias'] = $this->_generateNewTitle($data['alias']); if (isset($msg)) { @@ -959,26 +958,49 @@ class ComponentbuilderModelTemplate extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title/s & alias. * - * @param string $alias The alias. - * @param string $title The title. + * @param string $alias The alias. + * @param string/array $title The title. * - * @return array Contains the modified title and alias. + * @return array/string Contains the modified title/s and/or alias. * */ - protected function _generateNewTitle($alias, $title) + protected function _generateNewTitle($alias, $title = null) { - // Alter the title & alias + // Alter the title/s & alias $table = $this->getTable(); while ($table->load(array('alias' => $alias))) { - $title = JString::increment($title); + // Check if this is an array of titles + if (ComponentbuilderHelper::checkArray($title)) + { + foreach($title as $nr => &$_title) + { + $_title = JString::increment($_title); + } + } + // Make sure we have a title + elseif ($title) + { + $title = JString::increment($title); + } $alias = JString::increment($alias, 'dash'); } - - return array($title, $alias); + // Check if this is an array of titles + if (ComponentbuilderHelper::checkArray($title)) + { + $title[] = $alias; + return $title; + } + // Make sure we have a title + elseif ($title) + { + return array($title, $alias); + } + // We only had an alias + return $alias; } } diff --git a/admin/models/validation_rule.php b/admin/models/validation_rule.php index c6b95d2fb..6f3c00444 100644 --- a/admin/models/validation_rule.php +++ b/admin/models/validation_rule.php @@ -864,9 +864,9 @@ class ComponentbuilderModelValidation_rule extends JModelAdmin } /** - * Method to change the title & alias. + * Method to change the title * - * @param string $title The title. + * @param string $title The title. * * @return array Contains the modified title and alias. * diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 7fffdf017..24126ea64 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -161,6 +161,8 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_view` ( `addtables` TEXT NOT NULL, `addtabs` TEXT NOT NULL, `ajax_input` TEXT NOT NULL, + `alias_builder` VARCHAR(255) NOT NULL DEFAULT '', + `alias_builder_type` CHAR NOT NULL DEFAULT '', `css_view` TEXT NOT NULL, `css_views` TEXT NOT NULL, `custom_button` TEXT NOT NULL, @@ -227,25 +229,26 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_view` ( KEY `idx_state` (`published`), KEY `idx_name_single` (`name_single`), KEY `idx_name_list` (`name_list`), - KEY `idx_add_php_after_publish` (`add_php_after_publish`), KEY `idx_add_php_batchmove` (`add_php_batchmove`), KEY `idx_add_php_allowedit` (`add_php_allowedit`), KEY `idx_add_php_save` (`add_php_save`), KEY `idx_add_php_getlistquery` (`add_php_getlistquery`), + KEY `idx_add_sql` (`add_sql`), KEY `idx_type` (`type`), KEY `idx_add_fadein` (`add_fadein`), + KEY `idx_add_php_after_publish` (`add_php_after_publish`), KEY `idx_add_php_after_delete` (`add_php_after_delete`), - KEY `idx_add_sql` (`add_sql`), + KEY `idx_add_php_getitems_after_all` (`add_php_getitems_after_all`), KEY `idx_add_php_before_save` (`add_php_before_save`), KEY `idx_add_php_postsavehook` (`add_php_postsavehook`), KEY `idx_add_php_batchcopy` (`add_php_batchcopy`), KEY `idx_add_php_before_publish` (`add_php_before_publish`), KEY `idx_add_php_before_delete` (`add_php_before_delete`), KEY `idx_add_php_document` (`add_php_document`), - KEY `idx_add_css_view` (`add_css_view`), KEY `idx_add_custom_import` (`add_custom_import`), + KEY `idx_add_php_getitem` (`add_php_getitem`), KEY `idx_add_php_getitems` (`add_php_getitems`), - KEY `idx_add_php_getitems_after_all` (`add_php_getitems_after_all`), + KEY `idx_add_css_view` (`add_css_view`), KEY `idx_add_css_views` (`add_css_views`), KEY `idx_add_javascript_view_file` (`add_javascript_view_file`), KEY `idx_add_javascript_view_footer` (`add_javascript_view_footer`), @@ -253,8 +256,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_admin_view` ( KEY `idx_add_javascript_views_footer` (`add_javascript_views_footer`), KEY `idx_add_custom_button` (`add_custom_button`), KEY `idx_source` (`source`), - KEY `idx_add_php_ajax` (`add_php_ajax`), - KEY `idx_add_php_getitem` (`add_php_getitem`) + KEY `idx_add_php_ajax` (`add_php_ajax`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `#__componentbuilder_custom_admin_view` ( @@ -1517,7 +1519,7 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `catid`, `description`, `name (24, '', 'The text form field type provides a text box for data entry. If the field has a value saved, this value is displayed when the page is first loaded. If not, the default value (if any) is selected.', 'Text', '{\"properties0\":{\"name\":\"type\",\"example\":\"text\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be text.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mytextvalue\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Enter some text\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties4\":{\"name\":\"maxlength\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) limits the number of characters that may be entered.\"},\"properties5\":{\"name\":\"default\",\"example\":\"Some text\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Enter some description\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties7\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties8\":{\"name\":\"readonly\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties10\":{\"name\":\"required\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties11\":{\"name\":\"filter\",\"example\":\"STRING\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties12\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties13\":{\"name\":\"field\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) used in validation of \\\"equals\\\" to link the field to match.\"},\"properties14\":{\"name\":\"message\",\"example\":\"Error! Please add some text here.\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The error message that will be displayed instead of the default message.\"},\"properties15\":{\"name\":\"hint\",\"example\":\"Your Name Here\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The placeholder to display inside the text box.\"},\"properties16\":{\"name\":\"autocomplete\",\"example\":\"on\",\"adjustable\":\"1\",\"description\":\"(optional) The autocomplete state for the form field. If \'off\' element will not be automatically completed by browser.\"},\"properties17\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"},\"properties18\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a text box for data entry.', '', 1, 8, '', ''), (25, '', 'The textarea form field type provides a text area for entry of multi-line text. If the field has a value saved, this value is displayed when the page is first loaded. If not, the default value (if any) is selected.', 'Textarea', '{\"properties0\":{\"name\":\"type\",\"example\":\"textarea\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be textarea.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mytextarea\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Enter some text\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"rows\",\"example\":\"10\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the height of the visible text area in lines. If omitted the width is determined by the browser. The value of rows does not limit the number of lines that may be entered.\"},\"properties4\":{\"name\":\"cols\",\"example\":\"5\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the width of the visible text area in characters. If omitted the width is determined by the browser. The value of cols does not limit the number of characters that may be entered.\"},\"properties5\":{\"name\":\"default\",\"example\":\"default text\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Text Area\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties16\":{\"name\":\"message\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties7\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties8\":{\"name\":\"filter\",\"example\":\"raw\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties9\":{\"name\":\"hint\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The placeholder to display inside the textarea.\"},\"properties10\":{\"name\":\"required\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties17\":{\"name\":\"validate\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties11\":{\"name\":\"readonly\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties12\":{\"name\":\"disabled\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties13\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"},\"properties14\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a text area for entry of multi-line text.', '', 1, 6, '', ''), (26, '', 'The timezones form field type provides a drop down list of time zones. If the field has a value saved, this value is displayed when the page is first loaded. If not, the default value (if any) is selected.', 'Timezone', '{\"properties0\":{\"name\":\"type\",\"example\":\"timezone\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be timezone.\"},\"properties1\":{\"name\":\"name\",\"example\":\"timezone\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Timezone\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the default time zone. For example, use \'-10\' for \'(UTC -10:00) Hawaii\'.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties5\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides a drop down list of time zones.', '', 1, 2, '', ''), -(27, '', 'This field essentially is a text field with the type of url. If a fully qualified url (that is one with a scheme and domain such as http://example.com) is entered and it uses idn (that is uses characters that are non ascii such as ê or Ψ) it will translat', 'URL', '{\"properties0\":{\"name\":\"type\",\"example\":\"url\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be url.\"},\"properties1\":{\"name\":\"name\",\"example\":\"website\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Website\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties4\":{\"name\":\"maxlength\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) limits the number of characters that may be entered.\"},\"properties5\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Enter website address\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties7\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties8\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties10\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties11\":{\"name\":\"filter\",\"example\":\"url\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties12\":{\"name\":\"validated\",\"example\":\"url\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties13\":{\"name\":\"message\",\"example\":\"Error! Please add website here.\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties14\":{\"name\":\"hint\",\"example\":\"Your Website Here\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The placeholder to display inside the text box.\"},\"properties15\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"},\"properties16\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a URL text input field.', '', 1, 5, '', ''), +(27, '', 'This field essentially is a text field with the type of url. If a fully qualified url (that is one with a scheme and domain such as http://example.com) is entered and it uses idn (that is uses characters that are non ascii such as ê or Ψ) it will translat', 'URL', '{\"properties0\":{\"name\":\"type\",\"example\":\"url\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be url.\"},\"properties1\":{\"name\":\"name\",\"example\":\"website\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Website\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"size\",\"example\":\"10\",\"adjustable\":\"1\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties4\":{\"name\":\"maxlength\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) limits the number of characters that may be entered.\"},\"properties5\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) (not translatable) is the default value.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Enter website address\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties7\":{\"name\":\"class\",\"example\":\"text_area\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'text_area\'.\"},\"properties8\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value\"},\"properties9\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field cannot be changed and will automatically inherit the default value - it will also not submit\"},\"properties10\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties11\":{\"name\":\"filter\",\"example\":\"url\",\"adjustable\":\"1\",\"description\":\"(optional) allow the system to save certain html tags or raw data.\"},\"properties12\":{\"name\":\"validated\",\"example\":\"url\",\"adjustable\":\"1\",\"description\":\"(optional) The validation method for the form field. This value will determine which method is used to validate the value for a field.\"},\"properties18\":{\"name\":\"scheme\",\"example\":\"http,https,mailto\",\"adjustable\":\"1\",\"description\":\"(optional) Validates that the value is a URL with a valid scheme (which can be restricted by the optional comma-separated field \'scheme\'), and passes a basic syntax check.\"},\"properties13\":{\"name\":\"message\",\"example\":\"Error! Please add website here.\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as error on validation.\"},\"properties14\":{\"name\":\"hint\",\"example\":\"Your Website Here\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) The placeholder to display inside the text box.\"},\"properties15\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Allows you to hide the field based on the value(s) of another field; for Joomla 3.2.4+\"},\"properties16\":{\"name\":\"onchange\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) HTML equivalent attribute (javascript use)\"}}', 'provides a URL text input field.', '', 1, 6, '', ''), (28, '', 'The user form field type provides a modal select box of users.', 'User', '{\"properties0\":{\"name\":\"type\",\"example\":\"user\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be user.\"},\"properties1\":{\"name\":\"name\",\"example\":\"user\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"User\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides a modal list of users.', '', 1, 2, '', ''), (29, '', 'The usergroup form field type provides a modal select box of user groups.', 'Usergroup', '{\"properties0\":{\"name\":\"type\",\"example\":\"usergroup\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be usergroup.\"},\"properties1\":{\"name\":\"name\",\"example\":\"usergroup\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Group\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Select a group\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the field required true if yes.\"},\"properties7\":{\"name\":\"multiple\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) If set to multiple then allows more than one usergroup to be selected.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides a drop down list of user groups.', '', 1, 2, '', ''), (30, '', 'The filelist form field type provides a drop down list of files from a specified directory. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.\r\n\r\nBy default, the first item on the', 'Filelist', '{\"properties0\":{\"name\":\"type\",\"example\":\"filelist\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be filelist.\"},\"properties1\":{\"name\":\"name\",\"example\":\"myfile\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a file\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"directory\",\"example\":\"images\\/stories\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the filesystem path to the directory containing the files to be listed. If omitted the directory given by JPATH_ROOT is assumed.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the default file name.\"},\"properties5\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties6\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a regular expression string which is used to filter the list of files selected for inclusion in the drop-down list. If omitted, all files in the directory are included. The filter argument expression is applied before the exclude argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties7\":{\"name\":\"exclude\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a regular expression string which is used to exclude files from the list. The exclude argument expression is applied after the filter argument expression. For information on constructing regular expressions see Regular expressions in parameter arguments.\"},\"properties8\":{\"name\":\"stripext\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a Boolean argument. If true then file name extensions will be stripped from the file names listed. Also note that the file name will be saved without the extension too.\"},\"properties9\":{\"name\":\"hide_none\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Do not use -\' item is omitted from the drop-down list.\"},\"properties10\":{\"name\":\"hide_default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a Boolean argument. If true, the \'- Use default -\' item is omitted from the drop-down list.\"},\"properties11\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Provides a drop down list of files from a specified directory.', '', 1, 2, '', 1), diff --git a/admin/sql/updates/mysql/2.7.0.sql b/admin/sql/updates/mysql/2.7.0.sql index 6255f148a..eb2dbc933 100644 --- a/admin/sql/updates/mysql/2.7.0.sql +++ b/admin/sql/updates/mysql/2.7.0.sql @@ -25,3 +25,7 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_validation_rule` ( KEY `idx_state` (`published`), KEY `idx_name` (`name`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; + +ALTER TABLE `#__componentbuilder_admin_view` ADD `alias_builder` VARCHAR(255) NOT NULL DEFAULT '' AFTER `ajax_input`; + +ALTER TABLE `#__componentbuilder_admin_view` ADD `alias_builder_type` CHAR NOT NULL DEFAULT '' AFTER `alias_builder`; diff --git a/admin/views/field/tmpl/edit.php b/admin/views/field/tmpl/edit.php index 1a68d6621..e717e7537 100644 --- a/admin/views/field/tmpl/edit.php +++ b/admin/views/field/tmpl/edit.php @@ -339,6 +339,23 @@ jQuery(document).ready(function() { } }); + +function JRouter(link) { +isSite()) + { + echo 'var url = "'.JURI::root().'";'; + } + else + { + echo 'var url = "";'; + } +?> + return url+link; +} + // nice little dot trick :) jQuery(document).ready( function($) { var x=0; diff --git a/componentbuilder.xml b/componentbuilder.xml index 0236645dd..201cc73ff 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 27th March, 2018 + 28th March, 2018 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://joomlacomponentbuilder.com diff --git a/script.php b/script.php index cfb509417..2cacf1a0a 100644 --- a/script.php +++ b/script.php @@ -3308,9 +3308,9 @@ class com_componentbuilderInstallerScript $admin_view->type_title = 'Componentbuilder Admin_view'; $admin_view->type_alias = 'com_componentbuilder.admin_view'; $admin_view->table = '{"special": {"dbtable": "#__componentbuilder_admin_view","key": "id","type": "Admin_view","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $admin_view->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_single":"name_single","name_list":"name_list","short_description":"short_description","add_php_after_publish":"add_php_after_publish","add_php_batchmove":"add_php_batchmove","add_php_allowedit":"add_php_allowedit","add_php_save":"add_php_save","add_php_getlistquery":"add_php_getlistquery","php_import_save":"php_import_save","type":"type","add_fadein":"add_fadein","description":"description","icon_category":"icon_category","add_php_after_delete":"add_php_after_delete","not_required":"not_required","add_sql":"add_sql","html_import_view":"html_import_view","icon_add":"icon_add","add_php_before_save":"add_php_before_save","add_php_postsavehook":"add_php_postsavehook","add_php_batchcopy":"add_php_batchcopy","add_php_before_publish":"add_php_before_publish","add_php_before_delete":"add_php_before_delete","add_php_document":"add_php_document","add_css_view":"add_css_view","add_custom_import":"add_custom_import","add_php_getitems":"add_php_getitems","php_import_headers":"php_import_headers","add_php_getitems_after_all":"add_php_getitems_after_all","css_view":"css_view","icon":"icon","php_getitems":"php_getitems","add_css_views":"add_css_views","php_getitems_after_all":"php_getitems_after_all","css_views":"css_views","php_getlistquery":"php_getlistquery","add_javascript_view_file":"add_javascript_view_file","php_before_save":"php_before_save","javascript_view_file":"javascript_view_file","php_save":"php_save","add_javascript_view_footer":"add_javascript_view_footer","php_postsavehook":"php_postsavehook","javascript_view_footer":"javascript_view_footer","php_allowedit":"php_allowedit","add_javascript_views_file":"add_javascript_views_file","php_batchcopy":"php_batchcopy","javascript_views_file":"javascript_views_file","php_batchmove":"php_batchmove","add_javascript_views_footer":"add_javascript_views_footer","php_before_publish":"php_before_publish","javascript_views_footer":"javascript_views_footer","php_after_publish":"php_after_publish","add_custom_button":"add_custom_button","php_before_delete":"php_before_delete","php_after_delete":"php_after_delete","php_controller":"php_controller","php_document":"php_document","php_model":"php_model","source":"source","php_controller_list":"php_controller_list","sql":"sql","php_model_list":"php_model_list","add_php_ajax":"add_php_ajax","php_import_display":"php_import_display","php_ajaxmethod":"php_ajaxmethod","php_import":"php_import","php_import_setdata":"php_import_setdata","add_php_getitem":"add_php_getitem","php_import_ext":"php_import_ext","php_getitem":"php_getitem"}}'; + $admin_view->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_single":"name_single","name_list":"name_list","short_description":"short_description","add_php_batchmove":"add_php_batchmove","add_php_allowedit":"add_php_allowedit","add_php_save":"add_php_save","add_php_getlistquery":"add_php_getlistquery","icon_add":"icon_add","html_import_view":"html_import_view","add_sql":"add_sql","type":"type","add_fadein":"add_fadein","description":"description","icon_category":"icon_category","add_php_after_publish":"add_php_after_publish","not_required":"not_required","add_php_after_delete":"add_php_after_delete","php_import_save":"php_import_save","add_php_getitems_after_all":"add_php_getitems_after_all","add_php_before_save":"add_php_before_save","add_php_postsavehook":"add_php_postsavehook","add_php_batchcopy":"add_php_batchcopy","add_php_before_publish":"add_php_before_publish","alias_builder_type":"alias_builder_type","add_php_before_delete":"add_php_before_delete","add_php_document":"add_php_document","alias_builder":"alias_builder","add_custom_import":"add_custom_import","add_php_getitem":"add_php_getitem","php_import_headers":"php_import_headers","add_php_getitems":"add_php_getitems","icon":"icon","php_getitem":"php_getitem","php_getitems":"php_getitems","add_css_view":"add_css_view","php_getitems_after_all":"php_getitems_after_all","css_view":"css_view","php_getlistquery":"php_getlistquery","add_css_views":"add_css_views","php_before_save":"php_before_save","css_views":"css_views","php_save":"php_save","add_javascript_view_file":"add_javascript_view_file","php_postsavehook":"php_postsavehook","javascript_view_file":"javascript_view_file","php_allowedit":"php_allowedit","add_javascript_view_footer":"add_javascript_view_footer","php_batchcopy":"php_batchcopy","javascript_view_footer":"javascript_view_footer","php_batchmove":"php_batchmove","add_javascript_views_file":"add_javascript_views_file","php_before_publish":"php_before_publish","javascript_views_file":"javascript_views_file","php_after_publish":"php_after_publish","add_javascript_views_footer":"add_javascript_views_footer","php_before_delete":"php_before_delete","javascript_views_footer":"javascript_views_footer","php_after_delete":"php_after_delete","add_custom_button":"add_custom_button","php_document":"php_document","source":"source","php_controller":"php_controller","sql":"sql","php_model":"php_model","php_controller_list":"php_controller_list","php_import_display":"php_import_display","php_model_list":"php_model_list","php_import":"php_import","add_php_ajax":"add_php_ajax","php_import_setdata":"php_import_setdata","php_ajaxmethod":"php_ajaxmethod","php_import_ext":"php_import_ext"}}'; $admin_view->router = 'ComponentbuilderHelperRoute::getAdmin_viewRoute'; - $admin_view->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/admin_view.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add_php_after_publish","add_php_batchmove","add_php_allowedit","add_php_save","add_php_getlistquery","type","add_fadein","add_php_after_delete","not_required","add_sql","add_php_before_save","add_php_postsavehook","add_php_batchcopy","add_php_before_publish","add_php_before_delete","add_php_document","add_css_view","add_custom_import","add_php_getitems","add_php_getitems_after_all","add_css_views","add_javascript_view_file","add_javascript_view_footer","add_javascript_views_file","add_javascript_views_footer","add_custom_button","source","add_php_ajax","add_php_getitem"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $admin_view->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/admin_view.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add_php_batchmove","add_php_allowedit","add_php_save","add_php_getlistquery","add_sql","type","add_fadein","add_php_after_publish","not_required","add_php_after_delete","add_php_getitems_after_all","add_php_before_save","add_php_postsavehook","add_php_batchcopy","add_php_before_publish","add_php_before_delete","add_php_document","add_custom_import","add_php_getitem","add_php_getitems","add_css_view","add_css_views","add_javascript_view_file","add_javascript_view_footer","add_javascript_views_file","add_javascript_views_footer","add_custom_button","source","add_php_ajax"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "alias_builder","targetTable": "#__componentbuilder_field","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $admin_view_Inserted = $db->insertObject('#__content_types', $admin_view); @@ -3747,9 +3747,9 @@ class com_componentbuilderInstallerScript $admin_view->type_title = 'Componentbuilder Admin_view'; $admin_view->type_alias = 'com_componentbuilder.admin_view'; $admin_view->table = '{"special": {"dbtable": "#__componentbuilder_admin_view","key": "id","type": "Admin_view","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $admin_view->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_single":"name_single","name_list":"name_list","short_description":"short_description","add_php_after_publish":"add_php_after_publish","add_php_batchmove":"add_php_batchmove","add_php_allowedit":"add_php_allowedit","add_php_save":"add_php_save","add_php_getlistquery":"add_php_getlistquery","php_import_save":"php_import_save","type":"type","add_fadein":"add_fadein","description":"description","icon_category":"icon_category","add_php_after_delete":"add_php_after_delete","not_required":"not_required","add_sql":"add_sql","html_import_view":"html_import_view","icon_add":"icon_add","add_php_before_save":"add_php_before_save","add_php_postsavehook":"add_php_postsavehook","add_php_batchcopy":"add_php_batchcopy","add_php_before_publish":"add_php_before_publish","add_php_before_delete":"add_php_before_delete","add_php_document":"add_php_document","add_css_view":"add_css_view","add_custom_import":"add_custom_import","add_php_getitems":"add_php_getitems","php_import_headers":"php_import_headers","add_php_getitems_after_all":"add_php_getitems_after_all","css_view":"css_view","icon":"icon","php_getitems":"php_getitems","add_css_views":"add_css_views","php_getitems_after_all":"php_getitems_after_all","css_views":"css_views","php_getlistquery":"php_getlistquery","add_javascript_view_file":"add_javascript_view_file","php_before_save":"php_before_save","javascript_view_file":"javascript_view_file","php_save":"php_save","add_javascript_view_footer":"add_javascript_view_footer","php_postsavehook":"php_postsavehook","javascript_view_footer":"javascript_view_footer","php_allowedit":"php_allowedit","add_javascript_views_file":"add_javascript_views_file","php_batchcopy":"php_batchcopy","javascript_views_file":"javascript_views_file","php_batchmove":"php_batchmove","add_javascript_views_footer":"add_javascript_views_footer","php_before_publish":"php_before_publish","javascript_views_footer":"javascript_views_footer","php_after_publish":"php_after_publish","add_custom_button":"add_custom_button","php_before_delete":"php_before_delete","php_after_delete":"php_after_delete","php_controller":"php_controller","php_document":"php_document","php_model":"php_model","source":"source","php_controller_list":"php_controller_list","sql":"sql","php_model_list":"php_model_list","add_php_ajax":"add_php_ajax","php_import_display":"php_import_display","php_ajaxmethod":"php_ajaxmethod","php_import":"php_import","php_import_setdata":"php_import_setdata","add_php_getitem":"add_php_getitem","php_import_ext":"php_import_ext","php_getitem":"php_getitem"}}'; + $admin_view->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_single":"name_single","name_list":"name_list","short_description":"short_description","add_php_batchmove":"add_php_batchmove","add_php_allowedit":"add_php_allowedit","add_php_save":"add_php_save","add_php_getlistquery":"add_php_getlistquery","icon_add":"icon_add","html_import_view":"html_import_view","add_sql":"add_sql","type":"type","add_fadein":"add_fadein","description":"description","icon_category":"icon_category","add_php_after_publish":"add_php_after_publish","not_required":"not_required","add_php_after_delete":"add_php_after_delete","php_import_save":"php_import_save","add_php_getitems_after_all":"add_php_getitems_after_all","add_php_before_save":"add_php_before_save","add_php_postsavehook":"add_php_postsavehook","add_php_batchcopy":"add_php_batchcopy","add_php_before_publish":"add_php_before_publish","alias_builder_type":"alias_builder_type","add_php_before_delete":"add_php_before_delete","add_php_document":"add_php_document","alias_builder":"alias_builder","add_custom_import":"add_custom_import","add_php_getitem":"add_php_getitem","php_import_headers":"php_import_headers","add_php_getitems":"add_php_getitems","icon":"icon","php_getitem":"php_getitem","php_getitems":"php_getitems","add_css_view":"add_css_view","php_getitems_after_all":"php_getitems_after_all","css_view":"css_view","php_getlistquery":"php_getlistquery","add_css_views":"add_css_views","php_before_save":"php_before_save","css_views":"css_views","php_save":"php_save","add_javascript_view_file":"add_javascript_view_file","php_postsavehook":"php_postsavehook","javascript_view_file":"javascript_view_file","php_allowedit":"php_allowedit","add_javascript_view_footer":"add_javascript_view_footer","php_batchcopy":"php_batchcopy","javascript_view_footer":"javascript_view_footer","php_batchmove":"php_batchmove","add_javascript_views_file":"add_javascript_views_file","php_before_publish":"php_before_publish","javascript_views_file":"javascript_views_file","php_after_publish":"php_after_publish","add_javascript_views_footer":"add_javascript_views_footer","php_before_delete":"php_before_delete","javascript_views_footer":"javascript_views_footer","php_after_delete":"php_after_delete","add_custom_button":"add_custom_button","php_document":"php_document","source":"source","php_controller":"php_controller","sql":"sql","php_model":"php_model","php_controller_list":"php_controller_list","php_import_display":"php_import_display","php_model_list":"php_model_list","php_import":"php_import","add_php_ajax":"add_php_ajax","php_import_setdata":"php_import_setdata","php_ajaxmethod":"php_ajaxmethod","php_import_ext":"php_import_ext"}}'; $admin_view->router = 'ComponentbuilderHelperRoute::getAdmin_viewRoute'; - $admin_view->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/admin_view.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add_php_after_publish","add_php_batchmove","add_php_allowedit","add_php_save","add_php_getlistquery","type","add_fadein","add_php_after_delete","not_required","add_sql","add_php_before_save","add_php_postsavehook","add_php_batchcopy","add_php_before_publish","add_php_before_delete","add_php_document","add_css_view","add_custom_import","add_php_getitems","add_php_getitems_after_all","add_css_views","add_javascript_view_file","add_javascript_view_footer","add_javascript_views_file","add_javascript_views_footer","add_custom_button","source","add_php_ajax","add_php_getitem"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; + $admin_view->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/admin_view.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add_php_batchmove","add_php_allowedit","add_php_save","add_php_getlistquery","add_sql","type","add_fadein","add_php_after_publish","not_required","add_php_after_delete","add_php_getitems_after_all","add_php_before_save","add_php_postsavehook","add_php_batchcopy","add_php_before_publish","add_php_before_delete","add_php_document","add_custom_import","add_php_getitem","add_php_getitems","add_css_view","add_css_views","add_javascript_view_file","add_javascript_view_footer","add_javascript_views_file","add_javascript_views_footer","add_custom_button","source","add_php_ajax"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "alias_builder","targetTable": "#__componentbuilder_field","targetColumn": "id","displayColumn": "name"}]}'; // Check if admin_view type is already in content_type DB. $admin_view_id = null; diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index d8a8cad2e..7b13bcd61 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -697,7 +697,7 @@ abstract class ComponentbuilderHelper $field['values_description'] .= ''.JText::_('COM_COMPONENTBUILDER_PROPERTY').''.JText::_('COM_COMPONENTBUILDER_EXAMPLE').''.JText::_('COM_COMPONENTBUILDER_DESCRIPTION').''; foreach ($properties as $property) { - $example = (isset($property['example']) && self::checkString($property['example'])) ? ''.$property['example'].'' : ''; + $example = (isset($property['example']) && self::checkString($property['example'])) ? self::shorten($property['example'], 30) : ''; $field['values_description'] .= ''.$property['name'].''.$example.''.$property['description'].''; if(isset($settings[$property['name']])) {