From fdc66fe4c77b46efcf436847b11974fd650ede35 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 23 Aug 2018 03:37:42 +0200 Subject: [PATCH] Added the feature to add custom Joomla fields to your components, requested in gh-247. Added plugin events to the dynamic get area. Added the script to remove field build in relation to component when component gets uninstalled. Improved the getForm method in the model to allow the passing of options to the form. Made further improvements to the implementation of the return parameter across the component redirecting behavior. Made some changes to the list layout views using the field relations area. --- README.md | 12 +- admin/README.txt | 12 +- admin/compiler/joomla_3/JModelAdmin.php | 7 +- admin/compiler/joomla_3/JModelAdmin_site.php | 7 +- admin/helpers/compiler/a_Get.php | 20 + admin/helpers/compiler/e_Interpretation.php | 187 ++- admin/helpers/compiler/f_Infusion.php | 6 +- admin/helpers/componentbuilder.php | 8 +- .../en-GB/en-GB.com_componentbuilder.ini | 30 +- admin/layouts/dynamic_get/main_right.php | 39 + admin/layouts/help_document/publlshing.php | 1 - admin/layouts/site_view/details_above.php | 3 +- admin/models/admin_fields.php | 9 +- admin/models/admin_fields_conditions.php | 9 +- admin/models/admin_fields_relations.php | 9 +- admin/models/admin_view.php | 9 +- admin/models/ajax.php | 31 +- admin/models/component_admin_views.php | 9 +- admin/models/component_config.php | 9 +- admin/models/component_custom_admin_menus.php | 9 +- admin/models/component_custom_admin_views.php | 9 +- admin/models/component_dashboard.php | 9 +- admin/models/component_files_folders.php | 9 +- admin/models/component_mysql_tweaks.php | 9 +- admin/models/component_site_views.php | 9 +- admin/models/component_updates.php | 9 +- admin/models/custom_admin_view.php | 87 +- admin/models/custom_admin_views.php | 108 +- admin/models/custom_code.php | 9 +- admin/models/custom_codes.php | 8 +- admin/models/dynamic_get.php | 51 +- admin/models/field.php | 9 +- admin/models/fieldtype.php | 9 +- admin/models/forms/component_admin_views.xml | 11 + admin/models/forms/custom_admin_view.xml | 456 ++--- admin/models/forms/custom_code.js | 78 +- admin/models/forms/dynamic_get.js | 41 + admin/models/forms/dynamic_get.xml | 1482 +++++++++-------- admin/models/forms/field.js | 388 ++--- admin/models/forms/help_document.js | 236 +-- admin/models/forms/help_document.xml | 8 - admin/models/forms/layout.xml | 26 +- admin/models/forms/library.js | 186 +-- admin/models/forms/server.js | 562 +++---- admin/models/forms/site_view.xml | 591 +++---- admin/models/forms/template.xml | 58 +- admin/models/help_document.php | 9 +- admin/models/help_documents.php | 21 - admin/models/import_joomla_components.php | 36 +- admin/models/joomla_component.php | 9 +- admin/models/language.php | 9 +- admin/models/language_translation.php | 9 +- admin/models/layout.php | 9 +- admin/models/layouts.php | 59 +- admin/models/library.php | 9 +- admin/models/library_config.php | 9 +- admin/models/library_files_folders_urls.php | 9 +- admin/models/server.php | 9 +- admin/models/site_view.php | 115 +- admin/models/site_views.php | 117 +- admin/models/snippet.php | 9 +- admin/models/snippet_type.php | 9 +- admin/models/template.php | 9 +- admin/models/templates.php | 75 +- admin/models/validation_rule.php | 9 +- admin/sql/install.mysql.utf8.sql | 45 +- admin/sql/updates/mysql/2.8.6.sql | 1 + admin/sql/updates/mysql/2.8.7.sql | 1 + .../custom_admin_views/tmpl/default_body.php | 29 +- .../custom_admin_views/tmpl/default_foot.php | 2 +- .../custom_admin_views/tmpl/default_head.php | 11 +- admin/views/custom_admin_views/view.html.php | 142 +- admin/views/custom_code/tmpl/edit.php | 114 +- admin/views/dynamic_get/tmpl/edit.php | 20 +- admin/views/field/tmpl/edit.php | 132 +- admin/views/help_document/tmpl/edit.php | 54 +- admin/views/layouts/tmpl/default.php | 28 +- admin/views/layouts/tmpl/default_body.php | 28 +- admin/views/layouts/tmpl/default_foot.php | 2 +- admin/views/layouts/tmpl/default_head.php | 7 +- admin/views/layouts/view.html.php | 59 +- admin/views/library/tmpl/edit.php | 40 +- admin/views/server/tmpl/edit.php | 156 +- admin/views/site_views/tmpl/default_body.php | 33 +- admin/views/site_views/tmpl/default_foot.php | 2 +- admin/views/site_views/tmpl/default_head.php | 11 +- admin/views/site_views/view.html.php | 143 +- admin/views/templates/tmpl/default.php | 28 +- admin/views/templates/tmpl/default_body.php | 38 +- admin/views/templates/tmpl/default_foot.php | 2 +- admin/views/templates/tmpl/default_head.php | 11 +- admin/views/templates/view.html.php | 84 +- componentbuilder.xml | 6 +- componentbuilder_update_server.xml | 36 +- script.php | 256 +-- site/helpers/componentbuilder.php | 8 +- 96 files changed, 4102 insertions(+), 2851 deletions(-) create mode 100644 admin/layouts/dynamic_get/main_right.php create mode 100644 admin/sql/updates/mysql/2.8.6.sql create mode 100644 admin/sql/updates/mysql/2.8.7.sql diff --git a/README.md b/README.md index 3613b9f6e..117da50d0 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.8.6) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.8.8) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -125,13 +125,13 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 19th August, 2018 -+ *Version*: 2.8.6 ++ *Last Build*: 23rd August, 2018 ++ *Version*: 2.8.8 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **187854** -+ *Field count*: **1061** -+ *File count*: **1240** ++ *Line count*: **188906** ++ *Field count*: **1063** ++ *File count*: **1243** + *Folder count*: **197** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/README.txt b/admin/README.txt index 3613b9f6e..117da50d0 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.8.6) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.8.8) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -125,13 +125,13 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 19th August, 2018 -+ *Version*: 2.8.6 ++ *Last Build*: 23rd August, 2018 ++ *Version*: 2.8.8 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **187854** -+ *Field count*: **1061** -+ *File count*: **1240** ++ *Line count*: **188906** ++ *Field count*: **1063** ++ *File count*: **1243** + *Folder count*: **197** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/compiler/joomla_3/JModelAdmin.php b/admin/compiler/joomla_3/JModelAdmin.php index d2cdbdde9..d0ca8877e 100644 --- a/admin/compiler/joomla_3/JModelAdmin.php +++ b/admin/compiler/joomla_3/JModelAdmin.php @@ -101,13 +101,16 @@ class ###Component###Model###View### extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - {###JMODELADMIN_GETFORM### + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData;###JMODELADMIN_GETFORM### } /** diff --git a/admin/compiler/joomla_3/JModelAdmin_site.php b/admin/compiler/joomla_3/JModelAdmin_site.php index d2cdbdde9..d0ca8877e 100644 --- a/admin/compiler/joomla_3/JModelAdmin_site.php +++ b/admin/compiler/joomla_3/JModelAdmin_site.php @@ -101,13 +101,16 @@ class ###Component###Model###View### extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - {###JMODELADMIN_GETFORM### + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData;###JMODELADMIN_GETFORM### } /** diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 650354af5..38763934e 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -370,6 +370,13 @@ class Get */ public $setTagHistory = false; + /** + * The Joomla Fields Switch + * + * @var boolean + */ + public $setJoomlaFields = false; + /** * The site edit views * @@ -1078,6 +1085,10 @@ class Get { $this->setTagHistory = true; } + if (isset($array['joomla_fields']) && $array['joomla_fields'] && !$this->setJoomlaFields) + { + $this->setJoomlaFields = true; + } // has become a lacacy issue, can't remove this $array['view'] = $array['adminview']; // get the admin settings/data @@ -2974,6 +2985,15 @@ class Get { unset($result->global); } + // load the events if any is set + if ($result->gettype == 1 && ComponentbuilderHelper::checkJson($result->plugin_events)) + { + $result->plugin_events = json_decode($result->plugin_events, true); + } + else + { + $result->plugin_events = ''; + } } return $results; } diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 052bfe3eb..d66904b4c 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -3120,6 +3120,14 @@ class Interpretation extends Fields $method = ''; if (isset($view['settings']->main_get) && ComponentbuilderHelper::checkObject($view['settings']->main_get)) { + + // add events if needed + if ($view['settings']->main_get->gettype == 1 && ComponentbuilderHelper::checkArray($view['settings']->main_get->plugin_events)) + { + // load the dispatcher + $method .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Initialise dispatcher."; + $method .= PHP_EOL . $this->_t(2) . "\$dispatcher = JEventDispatcher::getInstance();"; + } if ($view['settings']->main_get->gettype == 1) { // for single views @@ -3191,7 +3199,31 @@ class Interpretation extends Fields $method .= PHP_EOL . $this->_t(2) . "{"; $method .= PHP_EOL . $this->_t(3) . "throw new Exception(implode(" . '"\n", $errors), 500);'; $method .= PHP_EOL . $this->_t(2) . "}"; - + // add events if needed + if ($view['settings']->main_get->gettype == 1 && ComponentbuilderHelper::checkArray($view['settings']->main_get->plugin_events)) + { + $method .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Process the content plugins."; + $method .= PHP_EOL . $this->_t(2) . "JPluginHelper::importPlugin('content');"; + $method .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Setup Event Object."; + $method .= PHP_EOL . $this->_t(2) . "\$this->item->event = new stdClass;"; + // load the defaults + foreach ($view['settings']->main_get->plugin_events as $plugin_event) + { + // load the events + if ('onContentPrepare' === $plugin_event) + { + // TODO the onContentPrepare already gets triggered on the fields of its relation + // $method .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " onContentPrepare Event Trigger."; + // $method .= PHP_EOL . $this->_t(2) . "\$dispatcher->trigger('onContentPrepare', array ('com_" . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . ".article', &\$this->item, &\$this->params, 0));"; + } + else + { + $method .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " " . $plugin_event . " Event Trigger."; + $method .= PHP_EOL . $this->_t(2) . "\$results = \$dispatcher->trigger('" . $plugin_event . "', array('com_" . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . ".article', &\$this->item, &\$this->params, 0));"; + $method .= PHP_EOL . $this->_t(2) . '$this->item->event->' . $plugin_event . ' = trim(implode("\n", $results));'; + } + } + } $method .= PHP_EOL . PHP_EOL . $this->_t(2) . "parent::display(\$tpl);"; } return $method; @@ -4737,6 +4769,94 @@ class Interpretation extends Fields // set a var value $view = ComponentbuilderHelper::safeString($viewName); + // check if it has field relations + if (isset($this->uninstallScriptFields) && isset($this->uninstallScriptFields[$viewName])) + { + // First check if data is till in table + $script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . $this->_t(2) . "\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Select ids from fields"; + $script .= PHP_EOL . $this->_t(2) . "\$query->select(\$db->quoteName('id'));"; + $script .= PHP_EOL . $this->_t(2) . "\$query->from(\$db->quoteName('#__fields'));"; + $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Where " . $viewName . " context is found"; + $script .= PHP_EOL . $this->_t(2) . "\$query->where( \$db->quoteName('context') . ' = '. \$db->quote('" . $typeAlias . "') );"; + $script .= PHP_EOL . $this->_t(2) . "\$db->setQuery(\$query);"; + $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Execute query to see if context is found"; + $script .= PHP_EOL . $this->_t(2) . "\$db->execute();"; + $script .= PHP_EOL . $this->_t(2) . "\$" . $view . "_found = \$db->getNumRows();"; + $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Now check if there were any rows"; + $script .= PHP_EOL . $this->_t(2) . "if (\$" . $view . "_found)"; + $script .= PHP_EOL . $this->_t(2) . "{"; + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Since there are load the needed " . $view . " field ids"; + $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_field_ids = \$db->loadColumn();"; + + // Now remove the actual type entry + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Remove " . $viewName . " from the field table"; + $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('context') . ' = '. \$db->quote('" . $typeAlias . "') );"; + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . $this->_t(3) . "\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . $this->_t(3) . "\$query->delete(\$db->quoteName('#__fields'));"; + $script .= PHP_EOL . $this->_t(3) . "\$query->where(\$" . $view . "_condition);"; + $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; + $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; + $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; + $script .= PHP_EOL . $this->_t(3) . "{"; + $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; + // TODO lang is not translated + $script .= PHP_EOL . $this->_t(4) . "\$app->enqueueMessage(JText:" . ":_('The fields with type (" . $typeAlias . ") context was removed from the #__fields table'));"; + $script .= PHP_EOL . $this->_t(3) . "}"; + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Also Remove " . $viewName . " field values"; + $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('field_id') . ' IN ('. implode(',', \$" . $view . "_field_ids) .')');"; + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . $this->_t(3) . "\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . $this->_t(3) . "\$query->delete(\$db->quoteName('#__fields_values'));"; + $script .= PHP_EOL . $this->_t(3) . "\$query->where(\$" . $view . "_condition);"; + $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " field values"; + $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; + $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; + $script .= PHP_EOL . $this->_t(3) . "{"; + $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; + // TODO lang is not translated + $script .= PHP_EOL . $this->_t(4) . "\$app->enqueueMessage(JText:" . ":_('The fields values for " . $viewName . " was removed from the #__fields_values table'));"; + $script .= PHP_EOL . $this->_t(3) . "}"; + $script .= PHP_EOL . $this->_t(2) . "}"; + + // First check if data is till in table + $script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . $this->_t(2) . "\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Select ids from field groups"; + $script .= PHP_EOL . $this->_t(2) . "\$query->select(\$db->quoteName('id'));"; + $script .= PHP_EOL . $this->_t(2) . "\$query->from(\$db->quoteName('#__fields_groups'));"; + $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Where " . $viewName . " context is found"; + $script .= PHP_EOL . $this->_t(2) . "\$query->where( \$db->quoteName('context') . ' = '. \$db->quote('" . $typeAlias . "') );"; + $script .= PHP_EOL . $this->_t(2) . "\$db->setQuery(\$query);"; + $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Execute query to see if context is found"; + $script .= PHP_EOL . $this->_t(2) . "\$db->execute();"; + $script .= PHP_EOL . $this->_t(2) . "\$" . $view . "_found = \$db->getNumRows();"; + $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Now check if there were any rows"; + $script .= PHP_EOL . $this->_t(2) . "if (\$" . $view . "_found)"; + $script .= PHP_EOL . $this->_t(2) . "{"; + + // Now remove the actual type entry + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Remove " . $viewName . " from the field groups table"; + $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_condition = array( \$db->quoteName('context') . ' = '. \$db->quote('" . $typeAlias . "') );"; + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Create a new query object."; + $script .= PHP_EOL . $this->_t(3) . "\$query = \$db->getQuery(true);"; + $script .= PHP_EOL . $this->_t(3) . "\$query->delete(\$db->quoteName('#__fields_groups'));"; + $script .= PHP_EOL . $this->_t(3) . "\$query->where(\$" . $view . "_condition);"; + $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; + $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; + $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; + $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; + $script .= PHP_EOL . $this->_t(3) . "{"; + $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; + // TODO lang is not translated + $script .= PHP_EOL . $this->_t(4) . "\$app->enqueueMessage(JText:" . ":_('The field groups with type (" . $typeAlias . ") context was removed from the #__fields_groups table'));"; + $script .= PHP_EOL . $this->_t(3) . "}"; + $script .= PHP_EOL . $this->_t(2) . "}"; + } // First check if data is till in table $script .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Create a new query object."; $script .= PHP_EOL . $this->_t(2) . "\$query = \$db->getQuery(true);"; @@ -4765,7 +4885,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; - $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done);"; + $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated @@ -4782,7 +4902,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; - $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done);"; + $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated @@ -4799,7 +4919,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(3) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Execute the query to remove " . $viewName . " items"; $script .= PHP_EOL . $this->_t(3) . "\$" . $view . "_done = \$db->execute();"; - $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done);"; + $script .= PHP_EOL . $this->_t(3) . "if (\$" . $view . "_done)"; $script .= PHP_EOL . $this->_t(3) . "{"; $script .= PHP_EOL . $this->_t(4) . "//" . $this->setLine(__LINE__) . " If succesfully remove " . $viewName . " add queued success message."; // TODO lang is not translated @@ -4851,7 +4971,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(2) . "\$query->where(\$" . $component . "_condition);"; $script .= PHP_EOL . $this->_t(2) . "\$db->setQuery(\$query);"; $script .= PHP_EOL . $this->_t(2) . "\$" . $view . "_done = \$db->execute();"; - $script .= PHP_EOL . $this->_t(2) . "if (\$" . $view . "_done);"; + $script .= PHP_EOL . $this->_t(2) . "if (\$" . $view . "_done)"; $script .= PHP_EOL . $this->_t(2) . "{"; $script .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " If succesfully remove " . $component . " add queued success message."; // TODO lang is not translated @@ -4947,6 +5067,7 @@ class Interpretation extends Fields $customfieldlinks = (isset($this->customFieldLinksBuilder[$view]) && ComponentbuilderHelper::checkString($this->customFieldLinksBuilder[$view])) ? $this->customFieldLinksBuilder[$view] : ''; // build uninstall script for content types $this->uninstallScriptBuilder[$View] = 'com_' . $component . '.' . $view; + $this->uninstallScriptContent[$view] = $view; // check if this view has metadata if (isset($this->metadataBuilder[$view]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view])) { @@ -4996,6 +5117,7 @@ class Interpretation extends Fields $View = ComponentbuilderHelper::safeString($view, 'F'); // build uninstall script for content types $this->uninstallScriptBuilder[$View . ' ' . $category] = 'com_' . $component . '.' . $views . '.category'; + $this->uninstallScriptContent[$View . ' ' . $category] = $View . ' ' . $category; // set the title $array['type_title'] = $Component . ' ' . $View . ' ' . ComponentbuilderHelper::safeString($category, 'F'); // set the alias @@ -7397,6 +7519,13 @@ class Interpretation extends Fields // set counter $tabCounter++; } + // add joomla field sets if needed + if (isset($view['joomla_fields']) && $view['joomla_fields'] == 1) + { + $body .= PHP_EOL . PHP_EOL . $this->_t(1) . "ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>"; + $body .= PHP_EOL . $this->_t(1) . "tab_name = '" . $viewName_single . "Tab'; ?>"; + $body .= PHP_EOL . $this->_t(1) . ""; + } // set default publishing tab lang $tabLangName = $langView . '_PUBLISHING'; // add to lang array @@ -10797,7 +10926,7 @@ class Interpretation extends Fields // allways load these $allow = array(); $allow[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the form."; - $allow[] = $this->_t(2) . "\$form = \$this->loadForm('com_" . $component . "." . $viewName_single . "', '" . $viewName_single . "', array('control' => 'jform', 'load_data' => \$loadData));"; + $allow[] = $this->_t(2) . "\$form = \$this->loadForm('com_" . $component . "." . $viewName_single . "', '" . $viewName_single . "', \$options);"; $allow[] = PHP_EOL . $this->_t(2) . "if (empty(\$form))"; $allow[] = $this->_t(2) . "{"; $allow[] = $this->_t(3) . "return false;"; @@ -12857,11 +12986,13 @@ class Interpretation extends Fields { // set custom menu $menus .= $this->addCustomSubMenu($view, $codeName, $lang); + $nameSingle = ComponentbuilderHelper::safeString($view['settings']->name_single); + $nameList = ComponentbuilderHelper::safeString($view['settings']->name_list); + $nameUpper = ComponentbuilderHelper::safeString($view['settings']->name_list, 'U'); if (isset($view['submenu']) && $view['submenu'] == 1) { // setup access defaults $tab = ""; - $nameSingle = ComponentbuilderHelper::safeString($view['settings']->name_single); $coreLoad = false; if (isset($this->permissionCore[$nameSingle])) { @@ -12876,8 +13007,6 @@ class Interpretation extends Fields // add tab to lines to follow $tab = $this->_t(1); } - $nameList = ComponentbuilderHelper::safeString($view['settings']->name_list); - $nameUpper = ComponentbuilderHelper::safeString($view['settings']->name_list, 'U'); $menus .= PHP_EOL . $this->_t(2) . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_" . $nameUpper . "'), 'index.php?option=com_" . $codeName . "&view=" . $nameList . "', \$submenu === '" . $nameList . "');"; $this->langContent[$this->lang][$lang . "_" . $nameUpper] = $view['settings']->name_list; // check if category has another name @@ -12901,6 +13030,20 @@ class Interpretation extends Fields $menus .= PHP_EOL . $this->_t(2) . "}"; } } + // set the Joomla cutstom fields options + if (isset($view['joomla_fields']) && $view['joomla_fields'] == 1) + { + $menus .= PHP_EOL . $this->_t(2) . "if (JComponentHelper::isEnabled('com_fields'))"; + $menus .= PHP_EOL . $this->_t(2) . "{"; + $menus .= PHP_EOL . $this->_t(3) . "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_" . $nameUpper . "_FIELDS'), 'index.php?option=com_fields&context=com_" . $codeName . "." . $nameSingle . "', \$submenu === 'fields.fields');"; + $menus .= PHP_EOL . $this->_t(3) . "JHtmlSidebar::addEntry(JText:" . ":_('" . $lang . "_" . $nameUpper . "_FIELDS_GROUPS'), 'index.php?option=com_fields&view=groups&context=com_" . $codeName . "." . $nameSingle . "', \$submenu === 'fields.groups');"; + $menus .= PHP_EOL . $this->_t(2) . "}"; + $this->langContent[$this->lang][$lang . "_" . $nameUpper . "_FIELDS"] = $view['settings']->name_list . ' Fields'; + $this->langContent[$this->lang][$lang . "_" . $nameUpper . "_FIELDS_GROUPS"] = $view['settings']->name_list . ' Field Groups'; + // build uninstall script for fields + $this->uninstallScriptBuilder[$nameSingle] = 'com_' . $codeName . '.' . $nameSingle; + $this->uninstallScriptFields[$nameSingle] = $nameSingle; + } } if (isset($this->lastCustomSubMenu) && ComponentbuilderHelper::checkArray($this->lastCustomSubMenu)) { @@ -14883,6 +15026,27 @@ function vdm_dkim() { return $component; } + public function setAccessSectionsJoomlaFields() + { + $component = ''; + // set all the core field permissions + $component .= PHP_EOL . $this->_t(1) . '
'; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(1) . '
'; + $component .= PHP_EOL . $this->_t(1) . '
'; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(2) . ''; + $component .= PHP_EOL . $this->_t(1) . '
'; + return $component; + } + public function setAccessSections() { // set the default component access values @@ -14926,6 +15090,11 @@ function vdm_dkim() { $this->componentHead[] = $this->_t(2) . ''; $this->componentHead[] = $this->_t(2) . ''; $this->componentHead[] = $this->_t(2) . ''; + // set the Joomla fields + if ($this->setJoomlaFields) + { + $this->componentHead[] = $this->_t(2) . ' '; + } // new custom created by permissions $created_byTitle = $this->langPrefix . '_' . ComponentbuilderHelper::safeString('Edit Created By', 'U'); $created_byDesc = $this->langPrefix . '_' . ComponentbuilderHelper::safeString('Edit Created By', 'U') . '_DESC'; diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 7065e8266..b63de20ab 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -557,7 +557,11 @@ class Infusion extends Interpretation $this->fileContentStatic[$this->hhh . 'ACCESS_SECTIONS' . $this->hhh] = ''; } $this->fileContentStatic[$this->hhh . 'ACCESS_SECTIONS' . $this->hhh] .= $this->setAccessSectionsCategory($viewName_single, $viewName_list); - + // set the Joomla Fields ACCESS section if needed + if (isset($view['joomla_fields']) && $view['joomla_fields'] == 1) + { + $this->fileContentStatic[$this->hhh . 'ACCESS_SECTIONS' . $this->hhh] .= $this->setAccessSectionsJoomlaFields(); + } // HELPER_EXEL $this->fileContentStatic[$this->hhh . 'HELPER_EXEL' . $this->hhh] = $this->setExelHelperMethods(); } diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 71a14bdad..97ec89a21 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -3619,7 +3619,7 @@ abstract class ComponentbuilderHelper * @return string On success the edit url * */ - public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder') + public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true) { // check that we have the ID if (self::checkObject($item) && isset($item->id)) @@ -3641,7 +3641,11 @@ abstract class ComponentbuilderHelper if (JFactory::getUser()->authorise($view . '.edit', $component . '.' . $view . '.' . (int) $id)) { // set the edit link - return JRoute::_("index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $id . $ref); + if ($jRoute) + { + return JRoute::_("index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $id . $ref); + } + return "index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $id . $ref; } } return false; diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 244eea4f1..fd7053abd 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -390,7 +390,7 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CSS_VIEWS="Add Css Views" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CSS_VIEWS_LABEL="Add CSS (views)" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CSS_VIEW_LABEL="Add CSS (view)" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_BUTTON="Add Custom Button" -COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL="Add Custom Button" +COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL="Add Custom Buttons" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_IMPORT="Add Custom Import" COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_IMPORT_DESCRIPTION="Override the default import methods." COM_COMPONENTBUILDER_ADMIN_VIEW_ADD_CUSTOM_IMPORT_LABEL="Add Custom Import" @@ -1046,6 +1046,7 @@ COM_COMPONENTBUILDER_CLEAR_TMP="Clear tmp" COM_COMPONENTBUILDER_CLONE="Clone" COM_COMPONENTBUILDER_CLONE_FAILED="Clone failed!" COM_COMPONENTBUILDER_CLOSE_NEW="Close & New" +COM_COMPONENTBUILDER_CODE="Code" COM_COMPONENTBUILDER_COMMUNITY_PACKAGES="Community Packages" COM_COMPONENTBUILDER_COMPANY="Company" COM_COMPONENTBUILDER_COMPANY_NAME="Company Name" @@ -1560,6 +1561,8 @@ COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA="Joomla" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA_COMPONENT="Joomla Component" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA_COMPONENT_LABEL="Component" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA_FIELDS_DESCRIPTION="Select if the option to add Joomla fields should be added to the view." +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA_FIELDS_LABEL="Joomla Fields" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_KEY="Key" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_LAMP="Lamp" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_LAST="Last" @@ -2662,6 +2665,7 @@ COM_COMPONENTBUILDER_CONFIG_UIKIT_STYLE_LABEL="css Style" COM_COMPONENTBUILDER_CONFIG_VDM_PACKAGES="VDM Packages" COM_COMPONENTBUILDER_CONFIG_YES="Yes" COM_COMPONENTBUILDER_CONFIRMATION_STEP_BEFORE_IMPORTING="Confirmation Step Before Importing!" +COM_COMPONENTBUILDER_CONTEXT="Context" COM_COMPONENTBUILDER_CONTRIBUTOR="Contributor" COM_COMPONENTBUILDER_CONTRIBUTORS="Contributors" COM_COMPONENTBUILDER_COPYRIGHT="Copyright" @@ -2686,6 +2690,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_LIST="Custom Admin Views Dashb COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of custom admin view" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DELETE="Custom Admin Views Delete" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DELETE_DESC="Allows the users in this group to delete delete custom admin views" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_DETAILS="Details" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT="Custom Admin Views Edit" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_DESC="Allows the users in this group to edit the custom admin view" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EDIT_OWN="Custom Admin Views Edit Own" @@ -2698,6 +2703,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EXPORT="Custom Admin Views Export" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_EXPORT_DESC="Allows the users in this group to export export custom admin views" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_IMPORT="Custom Admin Views Import" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_IMPORT_DESC="Allows the users in this group to import import custom admin views" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_NAMES="Names" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_N_ITEMS_ARCHIVED="%s Custom Admin Views archived." COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_N_ITEMS_ARCHIVED_1="%s Custom Admin View archived." COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS_N_ITEMS_CHECKED_IN_0="No Custom Admin View successfully checked in." @@ -2723,7 +2729,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CSS_DOCUMENT="Add Css Document" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CSS_DOCUMENT_LABEL="Add CSS (custom document script)" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CSS_LABEL="Add CSS" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON="Add Custom Button" -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL="Add Custom Button" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL="Add Custom Buttons" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JAVASCRIPT_FILE="Add Javascript File" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JAVASCRIPT_FILE_DESCRIPTION="Add JavaScript to the JavaScript file linked to this view." COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JAVASCRIPT_FILE_LABEL="Add JavaScript (file)" @@ -3347,6 +3353,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL="Add Type" COM_COMPONENTBUILDER_CUSTOM_CODE_VERSION_DESC="A count of the number of times this Custom Code has been revised." COM_COMPONENTBUILDER_CUSTOM_CODE_VERSION_LABEL="Revision" COM_COMPONENTBUILDER_CUSTOM_IMPORT="Custom Import" +COM_COMPONENTBUILDER_CUSTOM_PHP="Custom PHP" COM_COMPONENTBUILDER_CUSTOM_SCRIPT="Custom Script" COM_COMPONENTBUILDER_DASH="Dashboard" COM_COMPONENTBUILDER_DASHBOARD="Component Builder Dashboard" @@ -3595,6 +3602,9 @@ COM_COMPONENTBUILDER_DYNAMIC_GET_NOT_IN="NOT IN" COM_COMPONENTBUILDER_DYNAMIC_GET_NOT_LESS_THAN="not less than" COM_COMPONENTBUILDER_DYNAMIC_GET_NOT_REQUIRED="Not Required" COM_COMPONENTBUILDER_DYNAMIC_GET_O="o" +COM_COMPONENTBUILDER_DYNAMIC_GET_ONCONTENTAFTERDISPLAY="onContentAfterDisplay" +COM_COMPONENTBUILDER_DYNAMIC_GET_ONCONTENTAFTERTITLE="onContentAfterTitle" +COM_COMPONENTBUILDER_DYNAMIC_GET_ONCONTENTBEFOREDISPLAY="onContentBeforeDisplay" COM_COMPONENTBUILDER_DYNAMIC_GET_ON_FIELD_DESCRIPTION="Name of the field" COM_COMPONENTBUILDER_DYNAMIC_GET_ON_FIELD_HINT="a.mainfield" COM_COMPONENTBUILDER_DYNAMIC_GET_ON_FIELD_LABEL="On Field" @@ -3638,6 +3648,9 @@ COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_DESCRIPTION="Add your PHP here COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_HINT="// PHP Here that should run in the parse Method -> switch | (array) $segments - the segments of the URL to parse | (array) $vars - the URL attributes to be used by the application." COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_LABEL="PHP" COM_COMPONENTBUILDER_DYNAMIC_GET_PLEASE_SELECT="Please select" +COM_COMPONENTBUILDER_DYNAMIC_GET_PLUGIN_EVENTS="Plugin Events" +COM_COMPONENTBUILDER_DYNAMIC_GET_PLUGIN_EVENTS_DESCRIPTION="Select the content plugin events you would like to add to the page that uses this dynamic get. Please note that the onContentPrepare event is added to all textarea and editor field types by default, so no need to add it again." +COM_COMPONENTBUILDER_DYNAMIC_GET_PLUGIN_EVENTS_LABEL="Content Plugin Events
All events added here can
be accessed in the $this->item->event object.
" COM_COMPONENTBUILDER_DYNAMIC_GET_PP="pp" COM_COMPONENTBUILDER_DYNAMIC_GET_PUBLISHING="Publishing" COM_COMPONENTBUILDER_DYNAMIC_GET_Q="q" @@ -4997,6 +5010,7 @@ COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_LIST="Layouts Dashboard List" COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of layout" COM_COMPONENTBUILDER_LAYOUTS_DELETE="Layouts Delete" COM_COMPONENTBUILDER_LAYOUTS_DELETE_DESC="Allows the users in this group to delete delete layouts" +COM_COMPONENTBUILDER_LAYOUTS_DETAILS="Details" COM_COMPONENTBUILDER_LAYOUTS_EDIT="Layouts Edit" COM_COMPONENTBUILDER_LAYOUTS_EDIT_DESC="Allows the users in this group to edit the layout" COM_COMPONENTBUILDER_LAYOUTS_EDIT_OWN="Layouts Edit Own" @@ -5009,6 +5023,7 @@ COM_COMPONENTBUILDER_LAYOUTS_EXPORT="Layouts Export" COM_COMPONENTBUILDER_LAYOUTS_EXPORT_DESC="Allows the users in this group to export export layouts" COM_COMPONENTBUILDER_LAYOUTS_IMPORT="Layouts Import" COM_COMPONENTBUILDER_LAYOUTS_IMPORT_DESC="Allows the users in this group to import import layouts" +COM_COMPONENTBUILDER_LAYOUTS_NAMES="Names" COM_COMPONENTBUILDER_LAYOUTS_N_ITEMS_ARCHIVED="%s Layouts archived." COM_COMPONENTBUILDER_LAYOUTS_N_ITEMS_ARCHIVED_1="%s Layout archived." COM_COMPONENTBUILDER_LAYOUTS_N_ITEMS_CHECKED_IN_0="No Layout successfully checked in." @@ -5778,6 +5793,7 @@ COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_LIST="Site Views Dashboard List" COM_COMPONENTBUILDER_SITE_VIEWS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of site view" COM_COMPONENTBUILDER_SITE_VIEWS_DELETE="Site Views Delete" COM_COMPONENTBUILDER_SITE_VIEWS_DELETE_DESC="Allows the users in this group to delete delete site views" +COM_COMPONENTBUILDER_SITE_VIEWS_DETAILS="Details" COM_COMPONENTBUILDER_SITE_VIEWS_EDIT="Site Views Edit" COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_DESC="Allows the users in this group to edit the site view" COM_COMPONENTBUILDER_SITE_VIEWS_EDIT_OWN="Site Views Edit Own" @@ -5790,6 +5806,7 @@ COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT="Site Views Export" COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT_DESC="Allows the users in this group to export export site views" COM_COMPONENTBUILDER_SITE_VIEWS_IMPORT="Site Views Import" COM_COMPONENTBUILDER_SITE_VIEWS_IMPORT_DESC="Allows the users in this group to import import site views" +COM_COMPONENTBUILDER_SITE_VIEWS_NAMES="Names" COM_COMPONENTBUILDER_SITE_VIEWS_N_ITEMS_ARCHIVED="%s Site Views archived." COM_COMPONENTBUILDER_SITE_VIEWS_N_ITEMS_ARCHIVED_1="%s Site View archived." COM_COMPONENTBUILDER_SITE_VIEWS_N_ITEMS_CHECKED_IN_0="No Site View successfully checked in." @@ -5815,7 +5832,7 @@ COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_DOCUMENT="Add Css Document" COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_DOCUMENT_LABEL="Add CSS (custom document script)" COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_LABEL="Add CSS" COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON="Add Custom Button" -COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON_LABEL="Add Custom Button" +COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON_LABEL="Add Custom Buttons" COM_COMPONENTBUILDER_SITE_VIEW_ADD_JAVASCRIPT_FILE="Add Javascript File" COM_COMPONENTBUILDER_SITE_VIEW_ADD_JAVASCRIPT_FILE_DESCRIPTION="Add JavaScript to the JavaScript file linked to this view." COM_COMPONENTBUILDER_SITE_VIEW_ADD_JAVASCRIPT_FILE_LABEL="Add JavaScript (file)" @@ -5901,6 +5918,11 @@ COM_COMPONENTBUILDER_SITE_VIEW_COGS="Cogs" COM_COMPONENTBUILDER_SITE_VIEW_COMMENT="Comment" COM_COMPONENTBUILDER_SITE_VIEW_COMMENTS_TWO="Comments 2" COM_COMPONENTBUILDER_SITE_VIEW_COMPASS="Compass" +COM_COMPONENTBUILDER_SITE_VIEW_CONTEXT="Context" +COM_COMPONENTBUILDER_SITE_VIEW_CONTEXT_DESCRIPTION="Do not add the component name, just the context/view code name that should be used during event triggers, if this view has events. Leaving this blank will default to the Name in Code." +COM_COMPONENTBUILDER_SITE_VIEW_CONTEXT_HINT="article" +COM_COMPONENTBUILDER_SITE_VIEW_CONTEXT_LABEL="Context" +COM_COMPONENTBUILDER_SITE_VIEW_CONTEXT_MESSAGE="Error! Please add context code name here." COM_COMPONENTBUILDER_SITE_VIEW_CONTRACT="Contract" COM_COMPONENTBUILDER_SITE_VIEW_CONTRACT_TWO="Contract 2" COM_COMPONENTBUILDER_SITE_VIEW_CREATED_BY_DESC="The user that created this Site View." @@ -6460,6 +6482,7 @@ COM_COMPONENTBUILDER_TEMPLATES_DASHBOARD_LIST="Templates Dashboard List" COM_COMPONENTBUILDER_TEMPLATES_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of template" COM_COMPONENTBUILDER_TEMPLATES_DELETE="Templates Delete" COM_COMPONENTBUILDER_TEMPLATES_DELETE_DESC="Allows the users in this group to delete delete templates" +COM_COMPONENTBUILDER_TEMPLATES_DETAILS="Details" COM_COMPONENTBUILDER_TEMPLATES_EDIT="Templates Edit" COM_COMPONENTBUILDER_TEMPLATES_EDIT_DESC="Allows the users in this group to edit the template" COM_COMPONENTBUILDER_TEMPLATES_EDIT_OWN="Templates Edit Own" @@ -6472,6 +6495,7 @@ COM_COMPONENTBUILDER_TEMPLATES_EXPORT="Templates Export" COM_COMPONENTBUILDER_TEMPLATES_EXPORT_DESC="Allows the users in this group to export export templates" COM_COMPONENTBUILDER_TEMPLATES_IMPORT="Templates Import" COM_COMPONENTBUILDER_TEMPLATES_IMPORT_DESC="Allows the users in this group to import import templates" +COM_COMPONENTBUILDER_TEMPLATES_NAMES="Names" COM_COMPONENTBUILDER_TEMPLATES_N_ITEMS_ARCHIVED="%s Templates archived." COM_COMPONENTBUILDER_TEMPLATES_N_ITEMS_ARCHIVED_1="%s Template archived." COM_COMPONENTBUILDER_TEMPLATES_N_ITEMS_CHECKED_IN_0="No Template successfully checked in." diff --git a/admin/layouts/dynamic_get/main_right.php b/admin/layouts/dynamic_get/main_right.php new file mode 100644 index 000000000..8097ca878 --- /dev/null +++ b/admin/layouts/dynamic_get/main_right.php @@ -0,0 +1,39 @@ + + * @github Joomla Component Builder + * @copyright Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'plugin_events' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/help_document/publlshing.php b/admin/layouts/help_document/publlshing.php index 7dfa73168..bc955789b 100644 --- a/admin/layouts/help_document/publlshing.php +++ b/admin/layouts/help_document/publlshing.php @@ -18,7 +18,6 @@ $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( 'published', 'ordering', - 'access', 'version', 'hits', 'id' diff --git a/admin/layouts/site_view/details_above.php b/admin/layouts/site_view/details_above.php index 674a8e6b1..88bd987fd 100644 --- a/admin/layouts/site_view/details_above.php +++ b/admin/layouts/site_view/details_above.php @@ -15,7 +15,8 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = array( - 'system_name' + 'system_name', + 'context' ); ?> diff --git a/admin/models/admin_fields.php b/admin/models/admin_fields.php index eea312434..4394b4810 100644 --- a/admin/models/admin_fields.php +++ b/admin/models/admin_fields.php @@ -124,15 +124,18 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.admin_fields', 'admin_fields', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.admin_fields', 'admin_fields', $options); if (empty($form)) { diff --git a/admin/models/admin_fields_conditions.php b/admin/models/admin_fields_conditions.php index 2baa8d1e6..6f1b85da7 100644 --- a/admin/models/admin_fields_conditions.php +++ b/admin/models/admin_fields_conditions.php @@ -124,15 +124,18 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.admin_fields_conditions', 'admin_fields_conditions', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.admin_fields_conditions', 'admin_fields_conditions', $options); if (empty($form)) { diff --git a/admin/models/admin_fields_relations.php b/admin/models/admin_fields_relations.php index 94a718889..947dfdaf9 100644 --- a/admin/models/admin_fields_relations.php +++ b/admin/models/admin_fields_relations.php @@ -104,15 +104,18 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.admin_fields_relations', 'admin_fields_relations', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.admin_fields_relations', 'admin_fields_relations', $options); if (empty($form)) { diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index 543edce6e..59c5a5862 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -435,15 +435,18 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.admin_view', 'admin_view', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.admin_view', 'admin_view', $options); if (empty($form)) { diff --git a/admin/models/ajax.php b/admin/models/ajax.php index f90711a30..94aea773f 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1501,16 +1501,24 @@ class ComponentbuilderModelAjax extends JModelList $templateString = array(); // get the view name & id $values = $this->getViewID(); - // check if we are in the correct view. + // set a return value + $return_url = 'index.php?option=com_componentbuilder&view=' . (string) $values['a_view'] . '&layout=edit&id=' . (int) $values['a_id']; + if (isset($values['a_return'])) + { + $return_url .= '&return=' . (string) $values['a_return']; + } + // start the ref builder + $ref = ''; 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']; + $ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'] . '&return=' . urlencode(base64_encode($return_url)); } + // load the template data foreach ($results as $result) { - $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 : ''; + $edit = (($button = ComponentbuilderHelper::getEditButton($result->id, 'template', 'templates', $ref)) !== false) ? $button : ''; + $editget = (isset($result->dynamic_get) && $result->dynamic_get > 0 && ($button = ComponentbuilderHelper::getEditButton($result->dynamic_get, 'dynamic_get', 'dynamic_gets', $ref)) !== false) ? $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.""; } @@ -1546,16 +1554,23 @@ class ComponentbuilderModelAjax extends JModelList $layoutString = array(); // get the view name & id $values = $this->getViewID(); - // check if we are in the correct view. + // set a return value + $return_url = 'index.php?option=com_componentbuilder&view=' . (string) $values['a_view'] . '&layout=edit&id=' . (int) $values['a_id']; + if (isset($values['a_return'])) + { + $return_url .= '&return=' . (string) $values['a_return']; + } + // start the ref builder + $ref = ''; 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']; + $ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'] . '&return=' . urlencode(base64_encode($return_url)); } 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 : ''; + $edit = (($button = ComponentbuilderHelper::getEditButton($result->id, 'layout', 'layouts', $ref)) !== false) ? $button : ''; + $editget = (isset($result->dynamic_get) && $result->dynamic_get > 0 && ($button = ComponentbuilderHelper::getEditButton($result->dynamic_get, 'dynamic_get', 'dynamic_gets', $ref)) !== false) ? $button : ''; $result->name = (ComponentbuilderHelper::checkString($result->name)) ? $result->name : JText::_('COM_COMPONENTBUILDER_NONE_SELECTED'); switch ($result->gettype) diff --git a/admin/models/component_admin_views.php b/admin/models/component_admin_views.php index 3d05ab54c..a0a873f67 100644 --- a/admin/models/component_admin_views.php +++ b/admin/models/component_admin_views.php @@ -135,15 +135,18 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_admin_views', 'component_admin_views', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_admin_views', 'component_admin_views', $options); if (empty($form)) { diff --git a/admin/models/component_config.php b/admin/models/component_config.php index 4a1c9c03c..3aff690e4 100644 --- a/admin/models/component_config.php +++ b/admin/models/component_config.php @@ -135,15 +135,18 @@ class ComponentbuilderModelComponent_config extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_config', 'component_config', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_config', 'component_config', $options); if (empty($form)) { diff --git a/admin/models/component_custom_admin_menus.php b/admin/models/component_custom_admin_menus.php index ff7d66b74..5955b68f9 100644 --- a/admin/models/component_custom_admin_menus.php +++ b/admin/models/component_custom_admin_menus.php @@ -135,15 +135,18 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_custom_admin_menus', 'component_custom_admin_menus', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_custom_admin_menus', 'component_custom_admin_menus', $options); if (empty($form)) { diff --git a/admin/models/component_custom_admin_views.php b/admin/models/component_custom_admin_views.php index 8164a8301..e34735392 100644 --- a/admin/models/component_custom_admin_views.php +++ b/admin/models/component_custom_admin_views.php @@ -135,15 +135,18 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_custom_admin_views', 'component_custom_admin_views', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_custom_admin_views', 'component_custom_admin_views', $options); if (empty($form)) { diff --git a/admin/models/component_dashboard.php b/admin/models/component_dashboard.php index d36a8bb59..75a3814ad 100644 --- a/admin/models/component_dashboard.php +++ b/admin/models/component_dashboard.php @@ -141,15 +141,18 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_dashboard', 'component_dashboard', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_dashboard', 'component_dashboard', $options); if (empty($form)) { diff --git a/admin/models/component_files_folders.php b/admin/models/component_files_folders.php index 2be39de25..d7a000ceb 100644 --- a/admin/models/component_files_folders.php +++ b/admin/models/component_files_folders.php @@ -160,15 +160,18 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_files_folders', 'component_files_folders', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_files_folders', 'component_files_folders', $options); if (empty($form)) { diff --git a/admin/models/component_mysql_tweaks.php b/admin/models/component_mysql_tweaks.php index ee8671988..ba6ac7a0d 100644 --- a/admin/models/component_mysql_tweaks.php +++ b/admin/models/component_mysql_tweaks.php @@ -135,15 +135,18 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_mysql_tweaks', 'component_mysql_tweaks', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_mysql_tweaks', 'component_mysql_tweaks', $options); if (empty($form)) { diff --git a/admin/models/component_site_views.php b/admin/models/component_site_views.php index 75f284ef6..8cc9fae2d 100644 --- a/admin/models/component_site_views.php +++ b/admin/models/component_site_views.php @@ -135,15 +135,18 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_site_views', 'component_site_views', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_site_views', 'component_site_views', $options); if (empty($form)) { diff --git a/admin/models/component_updates.php b/admin/models/component_updates.php index ebe546763..e45225411 100644 --- a/admin/models/component_updates.php +++ b/admin/models/component_updates.php @@ -135,15 +135,18 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.component_updates', 'component_updates', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.component_updates', 'component_updates', $options); if (empty($form)) { diff --git a/admin/models/custom_admin_view.php b/admin/models/custom_admin_view.php index b97e3ceff..207713899 100644 --- a/admin/models/custom_admin_view.php +++ b/admin/models/custom_admin_view.php @@ -86,22 +86,16 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->php_jview_display)) - { - // base64 Decode php_jview_display. - $item->php_jview_display = base64_decode($item->php_jview_display); - } - if (!empty($item->php_view)) { // base64 Decode php_view. $item->php_view = base64_decode($item->php_view); } - if (!empty($item->php_document)) + if (!empty($item->php_jview_display)) { - // base64 Decode php_document. - $item->php_document = base64_decode($item->php_document); + // base64 Decode php_jview_display. + $item->php_jview_display = base64_decode($item->php_jview_display); } if (!empty($item->default)) @@ -134,6 +128,12 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->css_document = base64_decode($item->css_document); } + if (!empty($item->php_document)) + { + // base64 Decode php_document. + $item->php_document = base64_decode($item->php_document); + } + if (!empty($item->css)) { // base64 Decode css. @@ -158,6 +158,14 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->php_model = base64_decode($item->php_model); } + if (!empty($item->custom_get)) + { + // Convert the custom_get field to an array. + $custom_get = new Registry; + $custom_get->loadString($item->custom_get); + $item->custom_get = $custom_get->toArray(); + } + if (!empty($item->ajax_input)) { // Convert the ajax_input field to an array. @@ -174,14 +182,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $item->libraries = $libraries->toArray(); } - if (!empty($item->custom_get)) - { - // Convert the custom_get field to an array. - $custom_get = new Registry; - $custom_get->loadString($item->custom_get); - $item->custom_get = $custom_get->toArray(); - } - if (!empty($item->custom_button)) { // Convert the custom_button field to an array. @@ -252,15 +252,18 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.custom_admin_view', 'custom_admin_view', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.custom_admin_view', 'custom_admin_view', $options); if (empty($form)) { @@ -973,6 +976,19 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin // always reset the snippets $data['snippet'] = 0; + // Set the custom_get items to data. + if (isset($data['custom_get']) && is_array($data['custom_get'])) + { + $custom_get = new JRegistry; + $custom_get->loadArray($data['custom_get']); + $data['custom_get'] = (string) $custom_get; + } + elseif (!isset($data['custom_get'])) + { + // Set the empty custom_get to data + $data['custom_get'] = ''; + } + // Set the ajax_input items to data. if (isset($data['ajax_input']) && is_array($data['ajax_input'])) { @@ -999,19 +1015,6 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $data['libraries'] = ''; } - // Set the custom_get items to data. - if (isset($data['custom_get']) && is_array($data['custom_get'])) - { - $custom_get = new JRegistry; - $custom_get->loadArray($data['custom_get']); - $data['custom_get'] = (string) $custom_get; - } - elseif (!isset($data['custom_get'])) - { - // Set the empty custom_get to data - $data['custom_get'] = ''; - } - // Set the custom_button items to data. if (isset($data['custom_button']) && is_array($data['custom_button'])) { @@ -1025,22 +1028,16 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $data['custom_button'] = ''; } - // Set the php_jview_display string to base64 string. - if (isset($data['php_jview_display'])) - { - $data['php_jview_display'] = base64_encode($data['php_jview_display']); - } - // Set the php_view string to base64 string. if (isset($data['php_view'])) { $data['php_view'] = base64_encode($data['php_view']); } - // Set the php_document string to base64 string. - if (isset($data['php_document'])) + // Set the php_jview_display string to base64 string. + if (isset($data['php_jview_display'])) { - $data['php_document'] = base64_encode($data['php_document']); + $data['php_jview_display'] = base64_encode($data['php_jview_display']); } // Set the default string to base64 string. @@ -1073,6 +1070,12 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin $data['css_document'] = base64_encode($data['css_document']); } + // Set the php_document string to base64 string. + if (isset($data['php_document'])) + { + $data['php_document'] = base64_encode($data['php_document']); + } + // Set the css string to base64 string. if (isset($data['css'])) { diff --git a/admin/models/custom_admin_views.php b/admin/models/custom_admin_views.php index cacdda386..1e37bf571 100644 --- a/admin/models/custom_admin_views.php +++ b/admin/models/custom_admin_views.php @@ -29,8 +29,10 @@ class ComponentbuilderModelCustom_admin_views extends JModelList 'a.modified_by','modified_by', 'a.system_name','system_name', 'a.name','name', - 'a.codename','codename', - 'a.description','description' + 'a.description','description', + 'a.main_get','main_get', + 'a.add_php_ajax','add_php_ajax', + 'a.add_custom_button','add_custom_button' ); } @@ -57,11 +59,17 @@ class ComponentbuilderModelCustom_admin_views extends JModelList $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); $this->setState('filter.name', $name); - $codename = $this->getUserStateFromRequest($this->context . '.filter.codename', 'filter_codename'); - $this->setState('filter.codename', $codename); - $description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description'); - $this->setState('filter.description', $description); + $this->setState('filter.description', $description); + + $main_get = $this->getUserStateFromRequest($this->context . '.filter.main_get', 'filter_main_get'); + $this->setState('filter.main_get', $main_get); + + $add_php_ajax = $this->getUserStateFromRequest($this->context . '.filter.add_php_ajax', 'filter_add_php_ajax'); + $this->setState('filter.add_php_ajax', $add_php_ajax); + + $add_custom_button = $this->getUserStateFromRequest($this->context . '.filter.add_custom_button', 'filter_add_custom_button'); + $this->setState('filter.add_custom_button', $add_custom_button); $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); $this->setState('filter.sorting', $sorting); @@ -111,10 +119,59 @@ class ComponentbuilderModelCustom_admin_views extends JModelList } } - } + } + + // set selection value to a translatable value + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // convert add_php_ajax + $item->add_php_ajax = $this->selectionTranslation($item->add_php_ajax, 'add_php_ajax'); + // convert add_custom_button + $item->add_custom_button = $this->selectionTranslation($item->add_custom_button, 'add_custom_button'); + } + } + // return items return $items; + } + + /** + * Method to convert selection values to translatable string. + * + * @return translatable string + */ + public function selectionTranslation($value,$name) + { + // Array of add_php_ajax language strings + if ($name === 'add_php_ajax') + { + $add_php_ajaxArray = array( + 1 => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_YES', + 0 => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO' + ); + // Now check if value is found in this array + if (isset($add_php_ajaxArray[$value]) && ComponentbuilderHelper::checkString($add_php_ajaxArray[$value])) + { + return $add_php_ajaxArray[$value]; + } + } + // Array of add_custom_button language strings + if ($name === 'add_custom_button') + { + $add_custom_buttonArray = array( + 1 => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_YES', + 0 => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO' + ); + // Now check if value is found in this array + if (isset($add_custom_buttonArray[$value]) && ComponentbuilderHelper::checkString($add_custom_buttonArray[$value])) + { + return $add_custom_buttonArray[$value]; + } + } + return $value; } /** @@ -136,9 +193,9 @@ class ComponentbuilderModelCustom_admin_views extends JModelList // From the componentbuilder_item table $query->from($db->quoteName('#__componentbuilder_custom_admin_view', 'a')); - // From the componentbuilder_snippet table. - $query->select($db->quoteName('g.name','snippet_name')); - $query->join('LEFT', $db->quoteName('#__componentbuilder_snippet', 'g') . ' ON (' . $db->quoteName('a.snippet') . ' = ' . $db->quoteName('g.id') . ')'); + // From the componentbuilder_dynamic_get table. + $query->select($db->quoteName('g.name','main_get_name')); + $query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'g') . ' ON (' . $db->quoteName('a.main_get') . ' = ' . $db->quoteName('g.id') . ')'); // Filter by published state $published = $this->getState('filter.published'); @@ -176,10 +233,25 @@ class ComponentbuilderModelCustom_admin_views extends JModelList else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.system_name LIKE '.$search.' OR a.name LIKE '.$search.' OR a.codename LIKE '.$search.' OR a.description LIKE '.$search.')'); + $query->where('(a.system_name LIKE '.$search.' OR a.name LIKE '.$search.' OR a.description LIKE '.$search.' OR a.main_get LIKE '.$search.' OR g.name LIKE '.$search.' OR a.codename LIKE '.$search.')'); } } + // Filter by main_get. + if ($main_get = $this->getState('filter.main_get')) + { + $query->where('a.main_get = ' . $db->quote($db->escape($main_get))); + } + // Filter by Add_php_ajax. + if ($add_php_ajax = $this->getState('filter.add_php_ajax')) + { + $query->where('a.add_php_ajax = ' . $db->quote($db->escape($add_php_ajax))); + } + // Filter by Add_custom_button. + if ($add_custom_button = $this->getState('filter.add_custom_button')) + { + $query->where('a.add_custom_button = ' . $db->quote($db->escape($add_custom_button))); + } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); @@ -245,12 +317,10 @@ class ComponentbuilderModelCustom_admin_views extends JModelList continue; } - // decode php_jview_display - $item->php_jview_display = base64_decode($item->php_jview_display); // decode php_view $item->php_view = base64_decode($item->php_view); - // decode php_document - $item->php_document = base64_decode($item->php_document); + // decode php_jview_display + $item->php_jview_display = base64_decode($item->php_jview_display); // decode default $item->default = base64_decode($item->default); // decode php_jview @@ -261,6 +331,8 @@ class ComponentbuilderModelCustom_admin_views extends JModelList $item->javascript_file = base64_decode($item->javascript_file); // decode css_document $item->css_document = base64_decode($item->css_document); + // decode php_document + $item->php_document = base64_decode($item->php_document); // decode css $item->css = base64_decode($item->css); // decode php_ajaxmethod @@ -331,8 +403,10 @@ class ComponentbuilderModelCustom_admin_views extends JModelList $id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.system_name'); $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.codename'); - $id .= ':' . $this->getState('filter.description'); + $id .= ':' . $this->getState('filter.description'); + $id .= ':' . $this->getState('filter.main_get'); + $id .= ':' . $this->getState('filter.add_php_ajax'); + $id .= ':' . $this->getState('filter.add_custom_button'); return parent::getStoreId($id); } diff --git a/admin/models/custom_code.php b/admin/models/custom_code.php index 6f1db6bae..4d2f8b0d0 100644 --- a/admin/models/custom_code.php +++ b/admin/models/custom_code.php @@ -102,15 +102,18 @@ class ComponentbuilderModelCustom_code extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.custom_code', 'custom_code', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.custom_code', 'custom_code', $options); if (empty($form)) { diff --git a/admin/models/custom_codes.php b/admin/models/custom_codes.php index 4e3fedcd0..e4f049c63 100644 --- a/admin/models/custom_codes.php +++ b/admin/models/custom_codes.php @@ -124,10 +124,10 @@ class ComponentbuilderModelCustom_codes extends JModelList if ($item->target == 2) { $item->component_system_name = $item->system_name; - $item->path = '[CUSTO'.'MCODE='.$item->id.']'; // so it is not detected + $item->path = '[CUSTO'.'MCODE='.$item->id.']'; // so it is not detected if (ComponentbuilderHelper::checkString($item->function_name)) { - $item->path = '[CUSTO'.'MCODE='.$item->function_name.']'; // so it is not detected + $item->path = '[CUSTO'.'MCODE='.$item->function_name.']'; // so it is not detected } $item->type = 2; } @@ -372,10 +372,10 @@ class ComponentbuilderModelCustom_codes extends JModelList if ($item->target == 2) { $item->component_system_name = $item->system_name; - $item->path = '[CUSTO'.'MCODE='.$item->id.']'; // so it is not detected + $item->path = '[CUSTO'.'MCODE='.$item->id.']'; // so it is not detected if (ComponentbuilderHelper::checkString($item->function_name)) { - $item->path = '[CUSTO'.'MCODE='.$item->function_name.']'; // so it is not detected + $item->path = '[CUSTO'.'MCODE='.$item->function_name.']'; // so it is not detected } $item->type = 2; } diff --git a/admin/models/dynamic_get.php b/admin/models/dynamic_get.php index 53c6817a0..dd2262b49 100644 --- a/admin/models/dynamic_get.php +++ b/admin/models/dynamic_get.php @@ -134,6 +134,14 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $item->php_calculation = base64_decode($item->php_calculation); } + if (!empty($item->join_db_table)) + { + // Convert the join_db_table field to an array. + $join_db_table = new Registry; + $join_db_table->loadString($item->join_db_table); + $item->join_db_table = $join_db_table->toArray(); + } + if (!empty($item->filter)) { // Convert the filter field to an array. @@ -174,12 +182,10 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $item->join_view_table = $join_view_table->toArray(); } - if (!empty($item->join_db_table)) + if (!empty($item->plugin_events)) { - // Convert the join_db_table field to an array. - $join_db_table = new Registry; - $join_db_table->loadString($item->join_db_table); - $item->join_db_table = $join_db_table->toArray(); + // JSON Decode plugin_events. + $item->plugin_events = json_decode($item->plugin_events); } @@ -259,15 +265,18 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.dynamic_get', 'dynamic_get', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.dynamic_get', 'dynamic_get', $options); if (empty($form)) { @@ -977,6 +986,19 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $data['metadata'] = (string) $metadata; } + // Set the join_db_table items to data. + if (isset($data['join_db_table']) && is_array($data['join_db_table'])) + { + $join_db_table = new JRegistry; + $join_db_table->loadArray($data['join_db_table']); + $data['join_db_table'] = (string) $join_db_table; + } + elseif (!isset($data['join_db_table'])) + { + // Set the empty join_db_table to data + $data['join_db_table'] = ''; + } + // Set the filter items to data. if (isset($data['filter']) && is_array($data['filter'])) { @@ -1042,17 +1064,10 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin $data['join_view_table'] = ''; } - // Set the join_db_table items to data. - if (isset($data['join_db_table']) && is_array($data['join_db_table'])) + // Set the plugin_events string to JSON string. + if (isset($data['plugin_events'])) { - $join_db_table = new JRegistry; - $join_db_table->loadArray($data['join_db_table']); - $data['join_db_table'] = (string) $join_db_table; - } - elseif (!isset($data['join_db_table'])) - { - // Set the empty join_db_table to data - $data['join_db_table'] = ''; + $data['plugin_events'] = (string) json_encode($data['plugin_events']); } // Set the php_custom_get string to base64 string. diff --git a/admin/models/field.php b/admin/models/field.php index 60488c3d6..2d95353b2 100644 --- a/admin/models/field.php +++ b/admin/models/field.php @@ -157,15 +157,18 @@ class ComponentbuilderModelField extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.field', 'field', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.field', 'field', $options); if (empty($form)) { diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index 03aa3f4a2..5a95ade94 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -307,15 +307,18 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_componentbuilder.fieldtype', 'fieldtype', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_componentbuilder.fieldtype', 'fieldtype', $options); if (empty($form)) { diff --git a/admin/models/forms/component_admin_views.xml b/admin/models/forms/component_admin_views.xml index c3ed3fece..9da0466e7 100644 --- a/admin/models/forms/component_admin_views.xml +++ b/admin/models/forms/component_admin_views.xml @@ -615,6 +615,17 @@ description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_HISTORY_DESCRIPTION" class="inputbox" /> + + - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + diff --git a/admin/models/forms/custom_code.js b/admin/models/forms/custom_code.js index ba0657c7c..775b374a4 100644 --- a/admin/models/forms/custom_code.js +++ b/admin/models/forms/custom_code.js @@ -9,43 +9,43 @@ */ // Some Global Values -jform_vvvvwacvzr_required = false; -jform_vvvvwadvzs_required = false; -jform_vvvvwadvzt_required = false; -jform_vvvvwadvzu_required = false; +jform_vvvvwadvzr_required = false; +jform_vvvvwaevzs_required = false; +jform_vvvvwaevzt_required = false; +jform_vvvvwaevzu_required = false; // Initial Script jQuery(document).ready(function() { - var target_vvvvwac = jQuery("#jform_target input[type='radio']:checked").val(); - vvvvwac(target_vvvvwac); - var target_vvvvwad = jQuery("#jform_target input[type='radio']:checked").val(); vvvvwad(target_vvvvwad); var target_vvvvwae = jQuery("#jform_target input[type='radio']:checked").val(); - var type_vvvvwae = jQuery("#jform_type input[type='radio']:checked").val(); - vvvvwae(target_vvvvwae,type_vvvvwae); + vvvvwae(target_vvvvwae); - var type_vvvvwaf = jQuery("#jform_type input[type='radio']:checked").val(); var target_vvvvwaf = jQuery("#jform_target input[type='radio']:checked").val(); - vvvvwaf(type_vvvvwaf,target_vvvvwaf); + var type_vvvvwaf = jQuery("#jform_type input[type='radio']:checked").val(); + vvvvwaf(target_vvvvwaf,type_vvvvwaf); + + var type_vvvvwag = jQuery("#jform_type input[type='radio']:checked").val(); + var target_vvvvwag = jQuery("#jform_target input[type='radio']:checked").val(); + vvvvwag(type_vvvvwag,target_vvvvwag); }); -// the vvvvwac function -function vvvvwac(target_vvvvwac) +// the vvvvwad function +function vvvvwad(target_vvvvwad) { // set the function logic - if (target_vvvvwac == 2) + if (target_vvvvwad == 2) { jQuery('#jform_function_name').closest('.control-group').show(); - if (jform_vvvvwacvzr_required) + if (jform_vvvvwadvzr_required) { updateFieldRequired('function_name',0); jQuery('#jform_function_name').prop('required','required'); jQuery('#jform_function_name').attr('aria-required',true); jQuery('#jform_function_name').addClass('required'); - jform_vvvvwacvzr_required = false; + jform_vvvvwadvzr_required = false; } jQuery('.note_jcb_placeholder').closest('.control-group').show(); @@ -54,99 +54,99 @@ function vvvvwac(target_vvvvwac) else { jQuery('#jform_function_name').closest('.control-group').hide(); - if (!jform_vvvvwacvzr_required) + if (!jform_vvvvwadvzr_required) { updateFieldRequired('function_name',1); jQuery('#jform_function_name').removeAttr('required'); jQuery('#jform_function_name').removeAttr('aria-required'); jQuery('#jform_function_name').removeClass('required'); - jform_vvvvwacvzr_required = true; + jform_vvvvwadvzr_required = true; } jQuery('.note_jcb_placeholder').closest('.control-group').hide(); jQuery('#jform_system_name').closest('.control-group').hide(); } } -// the vvvvwad function -function vvvvwad(target_vvvvwad) +// the vvvvwae function +function vvvvwae(target_vvvvwae) { // set the function logic - if (target_vvvvwad == 1) + if (target_vvvvwae == 1) { jQuery('#jform_component').closest('.control-group').show(); - if (jform_vvvvwadvzs_required) + if (jform_vvvvwaevzs_required) { updateFieldRequired('component',0); jQuery('#jform_component').prop('required','required'); jQuery('#jform_component').attr('aria-required',true); jQuery('#jform_component').addClass('required'); - jform_vvvvwadvzs_required = false; + jform_vvvvwaevzs_required = false; } jQuery('#jform_path').closest('.control-group').show(); - if (jform_vvvvwadvzt_required) + if (jform_vvvvwaevzt_required) { updateFieldRequired('path',0); jQuery('#jform_path').prop('required','required'); jQuery('#jform_path').attr('aria-required',true); jQuery('#jform_path').addClass('required'); - jform_vvvvwadvzt_required = false; + jform_vvvvwaevzt_required = false; } jQuery('#jform_from_line').closest('.control-group').show(); jQuery('#jform_hashtarget').closest('.control-group').show(); jQuery('#jform_to_line').closest('.control-group').show(); jQuery('#jform_type').closest('.control-group').show(); - if (jform_vvvvwadvzu_required) + if (jform_vvvvwaevzu_required) { updateFieldRequired('type',0); jQuery('#jform_type').prop('required','required'); jQuery('#jform_type').attr('aria-required',true); jQuery('#jform_type').addClass('required'); - jform_vvvvwadvzu_required = false; + jform_vvvvwaevzu_required = false; } } else { jQuery('#jform_component').closest('.control-group').hide(); - if (!jform_vvvvwadvzs_required) + if (!jform_vvvvwaevzs_required) { updateFieldRequired('component',1); jQuery('#jform_component').removeAttr('required'); jQuery('#jform_component').removeAttr('aria-required'); jQuery('#jform_component').removeClass('required'); - jform_vvvvwadvzs_required = true; + jform_vvvvwaevzs_required = true; } jQuery('#jform_path').closest('.control-group').hide(); - if (!jform_vvvvwadvzt_required) + if (!jform_vvvvwaevzt_required) { updateFieldRequired('path',1); jQuery('#jform_path').removeAttr('required'); jQuery('#jform_path').removeAttr('aria-required'); jQuery('#jform_path').removeClass('required'); - jform_vvvvwadvzt_required = true; + jform_vvvvwaevzt_required = true; } jQuery('#jform_from_line').closest('.control-group').hide(); jQuery('#jform_hashtarget').closest('.control-group').hide(); jQuery('#jform_to_line').closest('.control-group').hide(); jQuery('#jform_type').closest('.control-group').hide(); - if (!jform_vvvvwadvzu_required) + if (!jform_vvvvwaevzu_required) { updateFieldRequired('type',1); jQuery('#jform_type').removeAttr('required'); jQuery('#jform_type').removeAttr('aria-required'); jQuery('#jform_type').removeClass('required'); - jform_vvvvwadvzu_required = true; + jform_vvvvwaevzu_required = true; } } } -// the vvvvwae function -function vvvvwae(target_vvvvwae,type_vvvvwae) +// the vvvvwaf function +function vvvvwaf(target_vvvvwaf,type_vvvvwaf) { // set the function logic - if (target_vvvvwae == 1 && type_vvvvwae == 1) + if (target_vvvvwaf == 1 && type_vvvvwaf == 1) { jQuery('#jform_hashendtarget').closest('.control-group').show(); jQuery('#jform_to_line').closest('.control-group').show(); @@ -158,11 +158,11 @@ function vvvvwae(target_vvvvwae,type_vvvvwae) } } -// the vvvvwaf function -function vvvvwaf(type_vvvvwaf,target_vvvvwaf) +// the vvvvwag function +function vvvvwag(type_vvvvwag,target_vvvvwag) { // set the function logic - if (type_vvvvwaf == 1 && target_vvvvwaf == 1) + if (type_vvvvwag == 1 && target_vvvvwag == 1) { jQuery('#jform_hashendtarget').closest('.control-group').show(); jQuery('#jform_to_line').closest('.control-group').show(); diff --git a/admin/models/forms/dynamic_get.js b/admin/models/forms/dynamic_get.js index 859646798..d9ed77ce4 100644 --- a/admin/models/forms/dynamic_get.js +++ b/admin/models/forms/dynamic_get.js @@ -100,6 +100,9 @@ jQuery(document).ready(function() var gettype_vvvvwaa = jQuery("#jform_gettype").val(); var add_php_router_parse_vvvvwaa = jQuery("#jform_add_php_router_parse input[type='radio']:checked").val(); vvvvwaa(gettype_vvvvwaa,add_php_router_parse_vvvvwaa); + + var gettype_vvvvwac = jQuery("#jform_gettype").val(); + vvvvwac(gettype_vvvvwac); }); // the vvvvvzd function @@ -1378,6 +1381,44 @@ function add_php_router_parse_vvvvwaa_SomeFunc(add_php_router_parse_vvvvwaa) return false; } +// the vvvvwac function +function vvvvwac(gettype_vvvvwac) +{ + if (isSet(gettype_vvvvwac) && gettype_vvvvwac.constructor !== Array) + { + var temp_vvvvwac = gettype_vvvvwac; + var gettype_vvvvwac = []; + gettype_vvvvwac.push(temp_vvvvwac); + } + else if (!isSet(gettype_vvvvwac)) + { + var gettype_vvvvwac = []; + } + var gettype = gettype_vvvvwac.some(gettype_vvvvwac_SomeFunc); + + + // set this function logic + if (gettype) + { + jQuery('#jform_plugin_events').closest('.control-group').show(); + } + else + { + jQuery('#jform_plugin_events').closest('.control-group').hide(); + } +} + +// the vvvvwac Some function +function gettype_vvvvwac_SomeFunc(gettype_vvvvwac) +{ + // set the function logic + if (gettype_vvvvwac == 1) + { + return true; + } + return false; +} + // update required fields function updateFieldRequired(name,status) { diff --git a/admin/models/forms/dynamic_get.xml b/admin/models/forms/dynamic_get.xml index 41162106d..02bcc1f4a 100644 --- a/admin/models/forms/dynamic_get.xml +++ b/admin/models/forms/dynamic_get.xml @@ -142,736 +142,24 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + -