From d1813147d377242821b8e1cc71ba202adebee944 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 19 Apr 2018 17:52:47 +0200 Subject: [PATCH] Added edit links to templates and layouts. Fixed the alias and title selection issue in admin fields area. Added all available languages in Joomla to language area. --- README.md | 6 +- admin/README.txt | 6 +- admin/config.xml | 11 +++ admin/helpers/compiler/a_Get.php | 19 +++-- admin/helpers/compiler/e_Interpretation.php | 35 +++++--- .../en-GB/en-GB.com_componentbuilder.ini | 2 + admin/models/ajax.php | 43 +++++++--- admin/models/fields/lang.php | 36 ++++---- admin/models/forms/admin_fields.xml | 2 + admin/models/forms/custom_admin_view.js | 4 +- admin/models/forms/layout.js | 2 +- admin/models/forms/site_view.js | 4 +- admin/models/forms/template.js | 4 +- admin/models/languages.php | 7 ++ admin/models/layout.php | 26 ++++++ admin/models/template.php | 26 ++++++ admin/sql/install.mysql.utf8.sql | 82 +++++++++++++++++++ admin/views/admin_fields/tmpl/edit.php | 46 +++++++++++ admin/views/layout/view.html.php | 2 + admin/views/template/view.html.php | 2 + componentbuilder.xml | 2 +- script.php | 2 +- 22 files changed, 306 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 3b9fc641f..13ba48366 100644 --- a/README.md +++ b/README.md @@ -126,12 +126,12 @@ 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*: 18th April, 2018 ++ *Last Build*: 19th April, 2018 + *Version*: 2.7.5 + *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*: **182984** -+ *Field count*: **1012** ++ *Line count*: **183282** ++ *Field count*: **1013** + *File count*: **1199** + *Folder count*: **193** diff --git a/admin/README.txt b/admin/README.txt index 3b9fc641f..13ba48366 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -126,12 +126,12 @@ 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*: 18th April, 2018 ++ *Last Build*: 19th April, 2018 + *Version*: 2.7.5 + *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*: **182984** -+ *Field count*: **1012** ++ *Line count*: **183282** ++ *Field count*: **1013** + *File count*: **1199** + *Folder count*: **193** diff --git a/admin/config.xml b/admin/config.xml index 0f2763316..6032371c5 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -61,6 +61,17 @@ + + langStringTargets, function($get) use($string) - { - if (strpos($string, $get) !== false) { - return true; - } - return false; - }); + if (strpos($string, $get) !== false) + { + return true; + } + return false; + }); // check if we should continue if (ComponentbuilderHelper::checkArray($langStringTargets)) { @@ -5607,7 +5608,7 @@ class Get } /** - * return the placeholders for insered and replaced code + * return the placeholders for inserted and replaced code * * @param int $type The type of placement * @param int $id The code id in the system diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 185be36c6..e6991f340 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -2822,14 +2822,14 @@ class Interpretation extends Fields } /** - * get the custom script in the script builder + * get the a script from the custom script builder * * @param string $first The first key * @param string $second The second key * @param string $prefix The prefix to add in front of the script if found * @param string/bool $note The switch/note to add to the script * @param bool $unset The switch to unset the value if found - * @param string/bool $unset The switch/string to use as default return if script not found + * @param string/bool $default The switch/string to use as default return if script not found * @param string $sufix The sufix to add after the script if found * * @return mix The string/script if found or the default value if not found @@ -2837,8 +2837,9 @@ class Interpretation extends Fields */ public function getCustomScriptBuilder($first, $second, $prefix = '', $note = null, $unset = null, $default = null, $sufix = '') { - // check if there is any custom script + // default is to return an empty string $script = ''; + // check if there is any custom script if (isset($this->customScriptBuilder[$first][$second]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$first][$second])) { // add not if set @@ -2846,6 +2847,7 @@ class Interpretation extends Fields { $script .= $note; } + // load the actual script $script .= $prefix . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$first][$second]) . $sufix; // clear some memory if ($unset) @@ -3101,6 +3103,17 @@ class Interpretation extends Fields public function setPrepareDocument(&$view) { + // fix just incase we missed it somewhere + $tmp = $this->lang; + if ('site' === $this->target) + { + $this->lang = 'site'; + } + else + { + $this->lang = 'admin'; + } + // ensure correct target is set $TARGET = ComponentbuilderHelper::safeString($this->target, 'U'); @@ -3146,6 +3159,9 @@ class Interpretation extends Fields // set a JavaScript file if needed $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_LIBRARIES_LOADER###'] .= $this->setJavaScriptFile($view, $TARGET); + + // fix just incase we missed it somewhere + $this->lang = $tmp; } public function setGetModules($view, $TARGET) @@ -3311,12 +3327,13 @@ class Interpretation extends Fields { foreach ($view['settings']->custom_buttons as $custom_button) { + // Load to lang + $keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($custom_button['name'], 'U'); + $keyCode = ComponentbuilderHelper::safeString($custom_button['name']); + $this->langContent[$this->lang][$keyLang] = trim($custom_button['name']); + // load the button if (3 !== $type && ($custom_button['target'] != 2 || $this->target === 'site')) { - // Load to lang - $keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($custom_button['name'], 'U'); - $keyCode = ComponentbuilderHelper::safeString($custom_button['name']); - $this->langContent[$this->lang][$keyLang] = trim($custom_button['name']); // add cpanel button TODO does not work well on site with permissions if ($custom_button['target'] == 2) { @@ -3334,10 +3351,6 @@ class Interpretation extends Fields // load the list button elseif (3 == $type && $custom_button['target'] != 1) { - // Load to lang - $keyLang = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($custom_button['name'], 'U'); - $keyCode = ComponentbuilderHelper::safeString($custom_button['name']); - $this->langContent[$this->lang][$keyLang] = trim($custom_button['name']); // add cpanel button TODO does not work well on site with permissions if (isset($custom_button['type']) && $custom_button['type'] == 2) { diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 3251cc8e8..c9e95f13d 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -2401,6 +2401,7 @@ COM_COMPONENTBUILDER_CONFIG_GLOBAL_DESC="The Global Parameters" COM_COMPONENTBUILDER_CONFIG_GLOBAL_LABEL="Global" COM_COMPONENTBUILDER_CONFIG_GRADIANT_LOAD="Gradient" COM_COMPONENTBUILDER_CONFIG_INACTIVE="Inactive" +COM_COMPONENTBUILDER_CONFIG_LANGUAGE_LABEL="Language" COM_COMPONENTBUILDER_CONFIG_LOCAL_FOLDER="Local Folder" COM_COMPONENTBUILDER_CONFIG_MAILER_DESCRIPTION="Select what mailer you would like to use to send emails." COM_COMPONENTBUILDER_CONFIG_MAILER_LABEL="Mailer" @@ -5338,6 +5339,7 @@ COM_COMPONENTBUILDER_NEW_MEANS_THAT_WE_COULD_NOT_FIND_A_LOCAL_SNIPPET_WITH_THE_S COM_COMPONENTBUILDER_NEW_NOTICE="New Notice" COM_COMPONENTBUILDER_NO="No" COM_COMPONENTBUILDER_NONE_DB="None DB" +COM_COMPONENTBUILDER_NONE_SELECTED="None selected" COM_COMPONENTBUILDER_NOTRANSLATION="no-translation" COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!" COM_COMPONENTBUILDER_NOT_SET="not set" diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 4a956ea70..0dbd077a3 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1362,14 +1362,14 @@ class ComponentbuilderModelAjax extends JModelList // set table $table = false; // Get a db connection. - $db = JFactory::getDbo(); + $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.alias','a.template','b.name'))); + $query->select($db->quoteName(array('a.id','a.alias','a.template','b.name','a.dynamic_get'))); $query->from($db->quoteName('#__componentbuilder_template', 'a')); $query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'b') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('a.dynamic_get') . ')'); $query->where($db->quoteName('a.id') . ' != '.(int) $id); - $query->where($db->quoteName('a.published') . ' = 1'); + $query->where($db->quoteName('a.published') . ' = 1'); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); @@ -1377,9 +1377,20 @@ class ComponentbuilderModelAjax extends JModelList { $results = $db->loadObjectList(); $templateString = array(); + // get the view name & id + $values = $this->getViewID(); + // check if we are in the correct view. + if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view'])) + { + // set the return ref + $this->ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id']; + } foreach ($results as $result) { - $templateString[] = "".$result->name."<?php echo \$this->loadTemplate('".ComponentbuilderHelper::safeString($result->alias)."'); ?>"; + $edit = ($button = $this->addEditLink($result->id, 'template', 'templates')) ? $button : ''; + $editget = (isset($result->dynamic_get) && $result->dynamic_get > 0 && $button = $this->addEditLink($result->dynamic_get, 'dynamic_get', 'dynamic_gets')) ? $button : ''; + $result->name = (ComponentbuilderHelper::checkString($result->name)) ? $result->name : JText::_('COM_COMPONENTBUILDER_NONE_SELECTED'); + $templateString[] = "".$result->name." ".$editget."<?php echo \$this->loadTemplate('".ComponentbuilderHelper::safeString($result->alias)."'); ?> ".$edit.""; } // build the table $table = '

'.JText::_('COM_COMPONENTBUILDER_TEMPLATE_CODE_SNIPPETS').'

'; @@ -1396,14 +1407,14 @@ class ComponentbuilderModelAjax extends JModelList // set table $table = false; // Get a db connection. - $db = JFactory::getDbo(); + $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.alias','a.layout','b.getcustom','b.gettype','b.name'))); + $query->select($db->quoteName(array('a.id','a.alias','a.layout','b.getcustom','b.gettype','b.name','a.dynamic_get'))); $query->from($db->quoteName('#__componentbuilder_layout', 'a')); $query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'b') . ' ON (' . $db->quoteName('b.id') . ' = ' . $db->quoteName('a.dynamic_get') . ')'); $query->where($db->quoteName('a.id') . ' != '.(int) $id); - $query->where($db->quoteName('a.published') . ' = 1'); + $query->where($db->quoteName('a.published') . ' = 1'); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); @@ -1411,17 +1422,29 @@ class ComponentbuilderModelAjax extends JModelList { $results = $db->loadObjectList(); $layoutString = array(); + // get the view name & id + $values = $this->getViewID(); + // check if we are in the correct view. + if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view'])) + { + // set the return ref + $this->ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id']; + } foreach ($results as $result) { + $edit = ($button = $this->addEditLink($result->id, 'layout', 'layouts')) ? $button : ''; + $editget = (isset($result->dynamic_get) && $result->dynamic_get > 0 && $button = $this->addEditLink($result->dynamic_get, 'dynamic_get', 'dynamic_gets')) ? $button : ''; + $result->name = (ComponentbuilderHelper::checkString($result->name)) ? $result->name : JText::_('COM_COMPONENTBUILDER_NONE_SELECTED'); + switch ($result->gettype) { case 1: // single - $layoutString[] = ""; + $layoutString[] = ""; break; case 2: // list - $layoutString[] = ""; + $layoutString[] = ""; break; case 3: case 4: @@ -1435,7 +1458,7 @@ class ComponentbuilderModelAjax extends JModelList { $varName = $result->getcustom; } - $layoutString[] = ""; + $layoutString[] = ""; break; } } diff --git a/admin/models/fields/lang.php b/admin/models/fields/lang.php index b44765c54..10b3952f8 100644 --- a/admin/models/fields/lang.php +++ b/admin/models/fields/lang.php @@ -49,23 +49,23 @@ class JFormFieldLang extends JFormFieldList */ public function getOptions() { - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.langtag','a.name'),array('langtag','language_name'))); - $query->from($db->quoteName('#__componentbuilder_language', 'a')); - $query->where($db->quoteName('a.published') . ' >= 1'); - $query->order('a.langtag ASC'); - $db->setQuery((string)$query); - $items = $db->loadObjectList(); - $options = array(); - if ($items) - { - $options[] = JHtml::_('select.option', '', 'Select an option'); - foreach($items as $item) - { - $options[] = JHtml::_('select.option', trim($item->langtag), $item->language_name . ' (' .$item->langtag.')'); - } - } - return $options; + $db = JFactory::getDBO(); +$query = $db->getQuery(true); +$query->select($db->quoteName(array('a.langtag','a.name'),array('langtag','language_name'))); +$query->from($db->quoteName('#__componentbuilder_language', 'a')); +$query->where($db->quoteName('a.published') . ' >= 1'); +$query->order('a.langtag ASC'); +$db->setQuery((string)$query); +$items = $db->loadObjectList(); +$options = array(); +if ($items) +{ + $options[] = JHtml::_('select.option', '', 'Select an option'); + foreach($items as $item) + { + $options[] = JHtml::_('select.option', trim($item->langtag), $item->language_name . ' (' .$item->langtag.')'); + } +} +return $options; } } diff --git a/admin/models/forms/admin_fields.xml b/admin/models/forms/admin_fields.xml index 131580f77..244c5cad5 100644 --- a/admin/models/forms/admin_fields.xml +++ b/admin/models/forms/admin_fields.xml @@ -158,6 +158,7 @@ required="false" description="COM_COMPONENTBUILDER_ADMIN_FIELDS_TITLE_DESCRIPTION" class="inputbox" + onchange="checkTitle(this)" /> 0 && id > 0){ var request = 'token='+token+'&id='+id; } @@ -570,7 +570,7 @@ function getLayoutDetails(id){ } function getTemplateDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod; if(token.length > 0 && id > 0){ var request = 'token='+token+'&id='+id; } diff --git a/admin/models/forms/layout.js b/admin/models/forms/layout.js index fa47acd91..bd9d7c403 100644 --- a/admin/models/forms/layout.js +++ b/admin/models/forms/layout.js @@ -178,7 +178,7 @@ function getDynamicValues(id){ } function getLayoutDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod; if(token.length > 0 && id > 0){ var request = 'token='+token+'&id='+id; } diff --git a/admin/models/forms/site_view.js b/admin/models/forms/site_view.js index d8d24db88..da82408e6 100644 --- a/admin/models/forms/site_view.js +++ b/admin/models/forms/site_view.js @@ -585,7 +585,7 @@ function getDynamicValues(id){ } function getLayoutDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod; if(token.length > 0 && id > 0){ var request = 'token='+token+'&id='+id; } @@ -611,7 +611,7 @@ function getLayoutDetails(id){ } function getTemplateDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod; if(token.length > 0 && id > 0){ var request = 'token='+token+'&id='+id; } diff --git a/admin/models/forms/template.js b/admin/models/forms/template.js index d3da0c767..0abe306a9 100644 --- a/admin/models/forms/template.js +++ b/admin/models/forms/template.js @@ -178,7 +178,7 @@ function getDynamicValues(id){ } function getLayoutDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&format=json&vdm="+vastDevMod; if(token.length > 0 && id > 0){ var request = 'token='+token+'&id='+id; } @@ -204,7 +204,7 @@ function getLayoutDetails(id){ } function getTemplateDetails_server(id){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod; if(token.length > 0 && id > 0){ var request = 'token='+token+'&id='+id; } diff --git a/admin/models/languages.php b/admin/models/languages.php index 420bad3e0..301e8ef62 100644 --- a/admin/models/languages.php +++ b/admin/models/languages.php @@ -138,6 +138,13 @@ class ComponentbuilderModelLanguages extends JModelList $languages[$language->name] = $language; } + // we must add the British language en-GB (since Joomla Ships with it) + $language = new stdClass; + $language->name = 'English GB'; + $language->element = 'pkg_en-GB'; + $language->type = 'package'; + $languages[$language->name] = $language; + usort($languages, function($a, $b) { return strcmp($a->name, $b->name); diff --git a/admin/models/layout.php b/admin/models/layout.php index c379ae4e2..136e4dd06 100644 --- a/admin/models/layout.php +++ b/admin/models/layout.php @@ -64,6 +64,11 @@ class ComponentbuilderModelLayout extends JModelAdmin public function getTable($type = 'layout', $prefix = 'ComponentbuilderTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); + } + + public function getVDM() + { + return $this->vastDevMod; } /** @@ -113,6 +118,27 @@ class ComponentbuilderModelLayout extends JModelAdmin { // base64 Decode layout. $item->layout = base64_decode($item->layout); + } + + + if (empty($item->id)) + { + $id = 0; + } + else + { + $id = $item->id; + } + // set the id and view name to session + if ($vdm = ComponentbuilderHelper::get('layout__'.$id)) + { + $this->vastDevMod = $vdm; + } + else + { + $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + ComponentbuilderHelper::set($this->vastDevMod, 'layout__'.$id); + ComponentbuilderHelper::set('layout__'.$id, $this->vastDevMod); } if (!empty($item->id)) diff --git a/admin/models/template.php b/admin/models/template.php index 52805d544..d3077def8 100644 --- a/admin/models/template.php +++ b/admin/models/template.php @@ -64,6 +64,11 @@ class ComponentbuilderModelTemplate extends JModelAdmin public function getTable($type = 'template', $prefix = 'ComponentbuilderTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); + } + + public function getVDM() + { + return $this->vastDevMod; } /** @@ -113,6 +118,27 @@ class ComponentbuilderModelTemplate extends JModelAdmin { // base64 Decode template. $item->template = base64_decode($item->template); + } + + + if (empty($item->id)) + { + $id = 0; + } + else + { + $id = $item->id; + } + // set the id and view name to session + if ($vdm = ComponentbuilderHelper::get('template__'.$id)) + { + $this->vastDevMod = $vdm; + } + else + { + $this->vastDevMod = ComponentbuilderHelper::randomkey(50); + ComponentbuilderHelper::set($this->vastDevMod, 'template__'.$id); + ComponentbuilderHelper::set('template__'.$id, $this->vastDevMod); } if (!empty($item->id)) diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 557620855..d5aec9d4e 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -1527,6 +1527,88 @@ INSERT INTO `#__componentbuilder_fieldtype` (`id`, `catid`, `description`, `name (34, '', 'Remember all views already have [accesslevel] added by default, only add this if you need more custom access selection! Provides a dropdown list of accesslevel options with the current option selected.', 'Accesslevel', '{\"properties0\":{\"name\":\"type\",\"example\":\"accesslevel\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be accesslevel\"},\"properties1\":{\"name\":\"name\",\"example\":\"accesstwo\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"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\":\"Access Two\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"description\",\"example\":\"Select an access level to this concept.\",\"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.\"},\"properties4\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties5\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the field required true if yes.\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) If set to multiple then allows more than one usergroup to be selected.\"},\"properties7\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'List of accesslevels', '', 1, 2, '', 5), (35, '', 'Provides a form with rows of fields that you specify. As many options can be added as desired. Note this form field has a jQuery based javascript file as a dependency.', 'Subform', '{\"properties0\":{\"name\":\"type\",\"example\":\"subform\",\"description\":\"(mandatory) must be subform.\"},\"properties1\":{\"name\":\"name\",\"example\":\"options\",\"adjustable\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter\"},\"properties2\":{\"name\":\"label\",\"example\":\"The Option List\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"layout\",\"example\":\"joomla.form.field.subform.repeatable-table\",\"adjustable\":\"1\",\"description\":\"(mandatory) The layout for the repeatable table.\"},\"properties4\":{\"name\":\"component\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) To change the component where it should search for layout\"},\"properties5\":{\"name\":\"client\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Function to initialise the application client
Frontend: site<\\/code> or 0<\\/code>
Backend: admin<\\/code> or 1<\\/code>\"},\"properties6\":{\"name\":\"multiple\",\"example\":\"true\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) The rows to be multiple.\"},\"properties7\":{\"name\":\"buttons\",\"example\":\"add,remove,move\",\"adjustable\":\"1\",\"description\":\"(optional) Which buttons to show if multiple mode is true.
Options: add,remove,move<\\/code>\"},\"properties8\":{\"name\":\"fields\",\"example\":\"1,2,3\",\"adjustable\":\"1\",\"description\":\"(mandatory) The fields to add to the modal. All fields must first be created in component builder as a field before you can add them here, since you must use the id of the field. Separate the field ids with commas. Do not add custom fields that are not also used in this component.\"},\"properties9\":{\"name\":\"formsource\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) you can add a path to a xml file containing the fields.\"},\"properties10\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) description text for the form field. Displays at the top of the modal with the name as well as in the usual position in the form\"},\"properties11\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The default value for the form field if the field is left empty. Note this has to be a json string compatible with the contents of the form field.\"},\"properties12\":{\"name\":\"icon\",\"example\":\"list\",\"adjustable\":\"1\",\"description\":\"(optional) The icon to show on the select button (is prefixed with \\\"icon-\\\").\"},\"properties13\":{\"name\":\"max\",\"example\":\"50\",\"adjustable\":\"1\",\"description\":\"(optional) The maximum number of rows of fields allowed (by default 999 to be effectively infinite)\"},\"properties14\":{\"name\":\"min\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The minimum number of rows of fields required\"},\"properties15\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) Use only if you would like to save raw data, since the default is best.\"},\"properties16\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'Allows form fields which can have as many options as the user desires.', '', 1, 12, '', 6); +-- +-- Dumping data for table `#__componentbuilder_language` +-- + +INSERT INTO `#__componentbuilder_language` (`id`, `langtag`, `name`, `params`, `published`, `created`, `modified`, `version`, `hits`, `ordering`) VALUES +(1, 'af-ZA', 'Afrikaans', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(2, 'sq-AL', 'Albanian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(3, 'ar-AA', 'Arabic Unitag', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(4, 'hy-AM', 'Armenian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(5, 'id-ID', 'Bahasa Indonesia', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(6, 'eu-ES', 'Basque', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(7, 'be-BY', 'Belarusian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(8, 'bn-BD', 'Bengali', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(9, 'bs-BA', 'Bosnian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(10, 'bg-BG', 'Bulgarian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(11, 'ca-ES', 'Catalan', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(12, 'zh-CN', 'Chinese Simplified', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(13, 'zh-TW', 'Chinese Traditional', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(14, 'hr-HR', 'Croatian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(15, 'cs-CZ', 'Czech', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(16, 'da-DK', 'Danish', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(17, 'prs-AF', 'Dari Persian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(18, 'nl-NL', 'Dutch', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(19, 'dz-BT', 'Dzongkha', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(20, 'en-AU', 'English AU', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(21, 'en-CA', 'English CA', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(22, 'en-GB', 'English GB', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(23, 'en-NZ', 'English NZ', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(24, 'en-US', 'English US', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(25, 'eo-XX', 'Esperanto', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(26, 'et-EE', 'Estonian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(27, 'fi-FI', 'Finnish', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(28, 'nl-BE', 'Flemish', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(29, 'fr-FR', 'French', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(30, 'fr-CA', 'French CA', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(31, 'gl-ES', 'Galician', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(32, 'ka-GE', 'Georgian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(33, 'de-AT', 'German AT', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(34, 'de-CH', 'German CH', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(35, 'de-DE', 'German DE', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(36, 'de-LI', 'German LI', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(37, 'de-LU', 'German LU', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(38, 'el-GR', 'Greek', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(39, 'he-IL', 'Hebrew', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(40, 'hi-IN', 'Hindi', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(41, 'hu-HU', 'Hungarian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(42, 'ga-IE', 'Irish', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(43, 'it-IT', 'Italian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(44, 'ja-JP', 'Japanese', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(45, 'km-KH', 'Khmer', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(46, 'ko-KR', 'Korean', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(47, 'lv-LV', 'Latvian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(48, 'mk-MK', 'Macedonian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(49, 'ms-MY', 'Malay', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(50, 'srp-ME', 'Montenegrin', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(51, 'nb-NO', 'Norwegian Bokmal', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(52, 'nn-NO', 'Norwegian Nynorsk', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(53, 'fa-IR', 'Persian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(54, 'pl-PL', 'Polish', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(55, 'pt-PT', 'Portuguese', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(56, 'pt-BR', 'Portuguese Brazil', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(57, 'ro-RO', 'Romanian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(58, 'ru-RU', 'Russian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(59, 'sr-RS', 'Serbian Cyrillic', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(60, 'sr-YU', 'Serbian Latin', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(61, 'si-LK', 'Sinhala', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(62, 'sk-SK', 'Slovak', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(63, 'sl-SI', 'Slovenian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(64, 'es-ES', 'Spanish', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(65, 'es-CO', 'Spanish CO', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(66, 'sw-KE', 'Swahili', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(67, 'sv-SE', 'Swedish', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(68, 'sy-IQ', 'Syriac', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(69, 'ta-IN', 'Tamil', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(70, 'th-TH', 'Thai', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(71, 'tr-TR', 'Turkish', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(72, 'tk-TM', 'Turkmen', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(73, 'uk-UA', 'Ukrainian', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(74, 'ug-CN', 'Uyghur', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(75, 'vi-VN', 'Vietnamese', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1), +(76, 'cy-GB', 'Welsh', '', 1, '2018-04-19 13:43:44', '0000-00-00 00:00:00', 1, '', 1); + -- -- Dumping data for table `#__componentbuilder_help_document` -- diff --git a/admin/views/admin_fields/tmpl/edit.php b/admin/views/admin_fields/tmpl/edit.php index 7aed1cc32..748e873be 100644 --- a/admin/views/admin_fields/tmpl/edit.php +++ b/admin/views/admin_fields/tmpl/edit.php @@ -236,4 +236,50 @@ function fanAsgfdSffsAbsent(arr){ } return absentArray; } +// little script to check that only one title is selected +function checkTitle(field) { + // get the ID + var id = jQuery(field).attr('id'); + var target = id.split('__'); + //set the subID + var subID = target[0]+'__'+target[1]; + var subID = subID.replace(/\d+/g, ''); + // set notice and do house cleaning + if (jQuery('#'+id).prop('checked')) { + // get number of items + var numItems = jQuery('.count-the-items1235').length + 10; + for (i = 0; i < numItems; i++) { // for now this is the number of field we should check + // build ID + var id_check = subID+i+'__title'; + // first check if Id is on page + if (jQuery("#"+id_check).length && id_check !== id) { + // uncheck it + jQuery("#"+id_check).prop('checked', false).trigger('change'); + } + } + } +} +// little script to check that only one title is selected +function checkAlias(field) { + // get the ID + var id = jQuery(field).attr('id'); + var target = id.split('__'); + //set the subID + var subID = target[0]+'__'+target[1]; + var subID = subID.replace(/\d+/g, ''); + // set notice and do house cleaning + if (jQuery('#'+id).prop('checked')) { + // get number of items + var numItems = jQuery('.count-the-items1235').length + 10; + for (i = 0; i < numItems; i++) { // for now this is the number of field we should check + // build ID + var id_check = subID+i+'__alias'; + // first check if Id is on page + if (jQuery("#"+id_check).length && id_check !== id) { + // uncheck it + jQuery("#"+id_check).prop('checked', false).trigger('change'); + } + } + } +} diff --git a/admin/views/layout/view.html.php b/admin/views/layout/view.html.php index b40760787..e076495c0 100644 --- a/admin/views/layout/view.html.php +++ b/admin/views/layout/view.html.php @@ -208,6 +208,8 @@ class ComponentbuilderViewLayout extends JViewLegacy $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + // add var key + $this->document->addScriptDeclaration("var vastDevMod = '".$this->get('VDM')."';"); JText::script('view not acceptable. Error'); } } diff --git a/admin/views/template/view.html.php b/admin/views/template/view.html.php index b6530d026..308fb6f39 100644 --- a/admin/views/template/view.html.php +++ b/admin/views/template/view.html.php @@ -208,6 +208,8 @@ class ComponentbuilderViewTemplate extends JViewLegacy $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + // add var key + $this->document->addScriptDeclaration("var vastDevMod = '".$this->get('VDM')."';"); JText::script('view not acceptable. Error'); } } diff --git a/componentbuilder.xml b/componentbuilder.xml index 4937c249b..4ef73e581 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 18th April, 2018 + 19th April, 2018 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://joomlacomponentbuilder.com diff --git a/script.php b/script.php index e69da93da..44645018f 100644 --- a/script.php +++ b/script.php @@ -3692,7 +3692,7 @@ class com_componentbuilderInstallerScript $query = $db->getQuery(true); // Field to update. $fields = array( - $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","minify":"0","percentagelanguageadd":"50","compiler_field_builder_type":"2","set_browser_storage":"1","storage_time_to_live":"global","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'), + $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"llewellyn@joomlacomponentbuilder.com","minify":"0","language":"en-GB","percentagelanguageadd":"50","compiler_field_builder_type":"2","set_browser_storage":"1","storage_time_to_live":"global","cronjob_backup_type":"1","cronjob_backup_server":"0","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'), ); // Condition. $conditions = array(
".$result->name."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->item); ?>".$result->name." ".$editget."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->item); ?> ".$edit."".$result->name."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->items); ?>".$result->name." ".$editget."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->items); ?> ".$edit."".$result->name."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->".$varName."); ?>".$result->name." ".$editget."<?php echo JLayoutHelper::render('".ComponentbuilderHelper::safeString($result->alias)."', \$this->".$varName."); ?> ".$edit."