From 189a8723acff262cd0502876c9c0963697b02357 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 18 Jan 2018 01:14:43 +0200 Subject: [PATCH] Added easy translation export and import feature, to allow translation to be done via an exel spreadsheet --- README.md | 14 +- admin/README.txt | 14 +- .../import_language_translations.php | 67 ++ admin/controllers/language_translations.php | 2 +- admin/helpers/compiler/a_Get.php | 2 +- admin/helpers/compiler/e_Interpretation.php | 54 +- admin/helpers/componentbuilder.php | 35 +- .../en-GB/en-GB.com_componentbuilder.ini | 4 + .../admin_view/custom_import_fullwidth.php | 1 + admin/layouts/fieldtype/fields_fullwidth.php | 2 +- .../ftp/linked_components_fullwidth.php | 2 +- admin/models/admin_view.php | 474 +++++----- admin/models/admin_views.php | 105 +-- admin/models/custom_admin_views.php | 27 - admin/models/custom_codes.php | 27 - admin/models/dynamic_gets.php | 27 - admin/models/fields.php | 27 - admin/models/fieldtype.php | 12 +- admin/models/fieldtypes.php | 27 - admin/models/forms/admin_view.js | 91 +- admin/models/forms/admin_view.xml | 837 +++++++++--------- admin/models/forms/custom_admin_view.js | 108 +-- admin/models/forms/custom_code.js | 36 +- admin/models/forms/dynamic_get.js | 174 ++-- admin/models/forms/field.js | 80 +- admin/models/forms/help_document.js | 60 +- admin/models/forms/layout.js | 10 +- admin/models/forms/library.js | 20 +- admin/models/forms/site_view.js | 108 +-- admin/models/forms/template.js | 10 +- admin/models/ftp.php | 2 +- admin/models/ftps.php | 27 - admin/models/help_documents.php | 27 - admin/models/import_language_translations.php | 660 ++++++++++++++ admin/models/joomla_component.php | 37 + admin/models/language_translations.php | 117 ++- admin/models/languages.php | 27 - admin/models/layouts.php | 27 - admin/models/site_views.php | 27 - admin/models/snippets.php | 27 - admin/models/templates.php | 27 - admin/sql/install.mysql.utf8.sql | 51 +- admin/sql/updates/mysql/2.6.11.sql | 1 + admin/views/fieldtype/view.html.php | 2 +- admin/views/ftp/view.html.php | 2 +- .../import_language_translations/index.html | 1 + .../tmpl/default.php | 247 ++++++ .../tmpl/index.html | 1 + .../view.html.php | 109 +++ componentbuilder.xml | 6 +- componentbuilder_update_server.xml | 17 + script.php | 10 +- site/helpers/componentbuilder.php | 35 +- 53 files changed, 2462 insertions(+), 1482 deletions(-) create mode 100644 admin/controllers/import_language_translations.php create mode 100644 admin/models/import_language_translations.php create mode 100644 admin/sql/updates/mysql/2.6.11.sql create mode 100644 admin/views/import_language_translations/index.html create mode 100644 admin/views/import_language_translations/tmpl/default.php create mode 100644 admin/views/import_language_translations/tmpl/index.html create mode 100644 admin/views/import_language_translations/view.html.php diff --git a/README.md b/README.md index 6cf6ad512..1f3d65f83 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.6.11) 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.6.12) 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) @@ -126,14 +126,14 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 16th January, 2018 -+ *Version*: 2.6.11 ++ *Last Build*: 17th January, 2018 ++ *Version*: 2.6.12 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **179847** -+ *Field count*: **1571** -+ *File count*: **1153** -+ *Folder count*: **184** ++ *Line count*: **180823** ++ *Field count*: **1573** ++ *File count*: **1160** ++ *Folder count*: **186** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/README.txt b/admin/README.txt index 6cf6ad512..1f3d65f83 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.6.11) 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.6.12) 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) @@ -126,14 +126,14 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 16th January, 2018 -+ *Version*: 2.6.11 ++ *Last Build*: 17th January, 2018 ++ *Version*: 2.6.12 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **179847** -+ *Field count*: **1571** -+ *File count*: **1153** -+ *Folder count*: **184** ++ *Line count*: **180823** ++ *Field count*: **1573** ++ *File count*: **1160** ++ *Folder count*: **186** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/controllers/import_language_translations.php b/admin/controllers/import_language_translations.php new file mode 100644 index 000000000..ca4066940 --- /dev/null +++ b/admin/controllers/import_language_translations.php @@ -0,0 +1,67 @@ + + @github Joomla Component Builder + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file +defined('_JEXEC') or die('Restricted access'); + +/** + * Componentbuilder Import_language_translations Controller + */ +class ComponentbuilderControllerImport_language_translations extends JControllerLegacy +{ + /** + * Import an spreadsheet. + * + * @return void + */ + public function import() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $model = $this->getModel('Import_language_translations'); + if ($model->import()) + { + $cache = JFactory::getCache('mod_menu'); + $cache->clean(); + // TODO: Reset the users acl here as well to kill off any missing bits + } + + $app = JFactory::getApplication(); + $redirect_url = $app->getUserState('com_componentbuilder.redirect_url'); + if (empty($redirect_url)) + { + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=import_language_translations', false); + } + else + { + // wipe out the user state when we're going to redirect + $app->setUserState('com_componentbuilder.redirect_url', ''); + $app->setUserState('com_componentbuilder.message', ''); + $app->setUserState('com_componentbuilder.extension_message', ''); + } + $this->setRedirect($redirect_url); + } +} diff --git a/admin/controllers/language_translations.php b/admin/controllers/language_translations.php index 9b8d98090..3b5881eb5 100644 --- a/admin/controllers/language_translations.php +++ b/admin/controllers/language_translations.php @@ -99,7 +99,7 @@ class ComponentbuilderControllerLanguage_translations extends JControllerAdmin $session->set('dataType_VDM_IMPORTINTO', 'language_translation'); // Redirect to import view. $message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGE_TRANSLATIONS'); - $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_language_translations', false), $message); return; } } diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index f29c49e7f..d00c53680 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -1534,7 +1534,7 @@ class Get // set custom import scripts if (isset($view->add_custom_import) && $view->add_custom_import == 1) { - $addImportArray = array('php_import_ext', 'php_import_display', 'php_import', 'php_import_setdata', 'php_import_save', 'html_import_view'); + $addImportArray = array('php_import_ext', 'php_import_display', 'php_import', 'php_import_setdata', 'php_import_save', 'php_import_headers', 'html_import_view'); foreach ($addImportArray as $importScripter) { if (isset($view->$importScripter) && strlen($view->$importScripter) > 0) diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 087d229ec..ef1917127 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -8104,32 +8104,34 @@ class Interpretation extends Fields $query .= PHP_EOL . "\t\treturn false;"; $query .= PHP_EOL . "\t}"; - $query .= PHP_EOL . PHP_EOL . "\t/**"; - $query .= PHP_EOL . "\t* Method to get header."; - $query .= PHP_EOL . "\t*"; - $query .= PHP_EOL . "\t* @return mixed An array of data items on success, false on failure."; - $query .= PHP_EOL . "\t*/"; - $query .= PHP_EOL . "\tpublic function getExImPortHeaders()"; - $query .= PHP_EOL . "\t{"; - $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Get a db connection."; - $query .= PHP_EOL . "\t\t\$db = JFactory::getDbo();"; - $query .= PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " get the columns"; - $query .= PHP_EOL . "\t\t\$columns = \$db->getTableColumns(" . '"#__' . $this->fileContentStatic['###component###'] . '_' . $viewName_single . '");'; - $query .= PHP_EOL . "\t\tif (" . $this->fileContentStatic['###Component###'] . "Helper::checkArray(\$columns))"; - $query .= PHP_EOL . "\t\t{"; - $query .= PHP_EOL . "\t\t\t//" . $this->setLine(__LINE__) . " remove the headers you don't import/export."; - $query .= PHP_EOL . "\t\t\tunset(\$columns['asset_id']);"; - $query .= PHP_EOL . "\t\t\tunset(\$columns['checked_out']);"; - $query .= PHP_EOL . "\t\t\tunset(\$columns['checked_out_time']);"; - $query .= PHP_EOL . "\t\t\t\$headers = new stdClass();"; - $query .= PHP_EOL . "\t\t\tforeach (\$columns as \$column => \$type)"; - $query .= PHP_EOL . "\t\t\t{"; - $query .= PHP_EOL . "\t\t\t\t\$headers->{\$column} = \$column;"; - $query .= PHP_EOL . "\t\t\t}"; - $query .= PHP_EOL . "\t\t\treturn \$headers;"; - $query .= PHP_EOL . "\t\t}"; - $query .= PHP_EOL . "\t\treturn false;"; - $query .= PHP_EOL . "\t}"; + // set some placeholders just incase + if (!isset($this->placeholders['###view###']) && !isset($this->placeholders['[[[view]]]'])) + { + $this->placeholders['###view###'] = $viewName_single; + $this->placeholders['[[[view]]]'] = $viewName_single; + $_viewSet = true; + } + if (!isset($this->placeholders['###views###']) && !isset($this->placeholders['[[[views]]]'])) + { + $this->placeholders['###views###'] = $viewName_list; + $this->placeholders['[[[views]]]'] = $viewName_list; + $_viewsSet = true; + } + + // add getExImPortHeaders + $query .= $this->getCustomScriptBuilder('php_import_headers', 'import_' . $viewName_list, PHP_EOL . PHP_EOL, null, true); + + // remove place holders if not needed (to not be suprized) + if (isset($_viewSet)) + { + unset($this->placeholders['###view###']); + unset($this->placeholders['[[[view]]]']); + } + if (isset($_viewsSet)) + { + unset($this->placeholders['###views###']); + unset($this->placeholders['[[[views]]]']); + } } return $query; } diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 48f055ea3..ea0eb5ad2 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -938,7 +938,7 @@ abstract class ComponentbuilderHelper public static function getImportScripts($type, $fieldName = false) { - // if field name is pased the convert to type + // if field name is passed the convert to type if ($fieldName) { $fieldNames = array( @@ -947,7 +947,8 @@ abstract class ComponentbuilderHelper 'php_import_save' => 'save', 'html_import_view' => 'view', 'php_import' => 'import', - 'php_import_ext' => 'ext' + 'php_import_ext' => 'ext', + 'php_import_headers' => 'headers' ); // first check if the field name is found if (isset($fieldNames[$type])) @@ -1047,6 +1048,36 @@ abstract class ComponentbuilderHelper $script['setdata'][] = "\t\treturn false;"; $script['setdata'][] = "\t}"; } + elseif ('headers' === $type) + { + $script['headers'] = array(); + $script['headers'][] = "\t/**"; + $script['headers'][] = "\t* Method to get header."; + $script['headers'][] = "\t*"; + $script['headers'][] = "\t* @return mixed An array of data items on success, false on failure."; + $script['headers'][] = "\t*/"; + $script['headers'][] = "\tpublic function getExImPortHeaders()"; + $script['headers'][] = "\t{"; + $script['headers'][] = "\t\t// Get a db connection."; + $script['headers'][] = "\t\t\$db = JFactory::getDbo();"; + $script['headers'][] = "\t\t// get the columns"; + $script['headers'][] = "\t\t\$columns = \$db->getTableColumns(\"#__###-#-#-component###_###-#-#-view###\");"; + $script['headers'][] = "\t\tif (###-#-#-Component###Helper::checkArray(\$columns))"; + $script['headers'][] = "\t\t{"; + $script['headers'][] = "\t\t\t// remove the headers you don't import/export."; + $script['headers'][] = "\t\t\tunset(\$columns['asset_id']);"; + $script['headers'][] = "\t\t\tunset(\$columns['checked_out']);"; + $script['headers'][] = "\t\t\tunset(\$columns['checked_out_time']);"; + $script['headers'][] = "\t\t\t\$headers = new stdClass();"; + $script['headers'][] = "\t\t\tforeach (\$columns as \$column => \$type)"; + $script['headers'][] = "\t\t\t{"; + $script['headers'][] = "\t\t\t\t\$headers->{\$column} = \$column;"; + $script['headers'][] = "\t\t\t}"; + $script['headers'][] = "\t\t\treturn \$headers;"; + $script['headers'][] = "\t\t}"; + $script['headers'][] = "\t\treturn false;"; + $script['headers'][] = "\t}"; + } elseif ('save' === $type) { $script['save'] = array(); diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index ee87af24f..e570ca705 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -703,6 +703,10 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_EXT="Php Import Ext" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_EXT_DESCRIPTION="Add your PHP here! [Do not add the php tags]" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_EXT_HINT="// PHP here for the checkExtension Method" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_EXT_LABEL="Check Extension Method PHP" +COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_HEADERS="Php Import Headers" +COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_HEADERS_DESCRIPTION="Add your PHP here! [Do not add the php tags]" +COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_HEADERS_HINT="// PHP here for the getExImPortHeaders Method" +COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_HEADERS_LABEL="get Export Import Headers PHP" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_HINT="// PHP Here that should run in the import Method." COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_LABEL="Import Method PHP" COM_COMPONENTBUILDER_ADMIN_VIEW_PHP_IMPORT_SAVE="Php Import Save" diff --git a/admin/layouts/admin_view/custom_import_fullwidth.php b/admin/layouts/admin_view/custom_import_fullwidth.php index 5cfb5641c..849964af4 100644 --- a/admin/layouts/admin_view/custom_import_fullwidth.php +++ b/admin/layouts/admin_view/custom_import_fullwidth.php @@ -36,6 +36,7 @@ $fields = $displayData->get('fields') ?: array( 'php_import_display', 'html_import_view', 'php_import', + 'php_import_headers', 'php_import_setdata', 'php_import_save', 'php_import_ext' diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php index c41c6cff0..c9a183aba 100644 --- a/admin/layouts/fieldtype/fields_fullwidth.php +++ b/admin/layouts/fieldtype/fields_fullwidth.php @@ -28,7 +28,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->waafields; +$items = $displayData->wabfields; $user = JFactory::getUser(); $id = $displayData->item->id; $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; diff --git a/admin/layouts/ftp/linked_components_fullwidth.php b/admin/layouts/ftp/linked_components_fullwidth.php index 785f8e156..dbedbd027 100644 --- a/admin/layouts/ftp/linked_components_fullwidth.php +++ b/admin/layouts/ftp/linked_components_fullwidth.php @@ -28,7 +28,7 @@ defined('_JEXEC') or die('Restricted access'); // set the defaults -$items = $displayData->wablinked_components; +$items = $displayData->waclinked_components; $user = JFactory::getUser(); $id = $displayData->item->id; $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit"; diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index 9db4fd8ff..c813d44f1 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -100,6 +100,14 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->metadata = $registry->toArray(); } + if (!empty($item->addtables)) + { + // Convert the addtables field to an array. + $addtables = new Registry; + $addtables->loadString($item->addtables); + $item->addtables = $addtables->toArray(); + } + if (!empty($item->addpermissions)) { // Convert the addpermissions field to an array. @@ -132,14 +140,6 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->custom_button = $custom_button->toArray(); } - if (!empty($item->addtables)) - { - // Convert the addtables field to an array. - $addtables = new Registry; - $addtables->loadString($item->addtables); - $item->addtables = $addtables->toArray(); - } - if (!empty($item->ajax_input)) { // Convert the ajax_input field to an array. @@ -148,112 +148,16 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->ajax_input = $ajax_input->toArray(); } - if (!empty($item->php_after_delete)) + if (!empty($item->php_import_headers)) { - // base64 Decode php_after_delete. - $item->php_after_delete = base64_decode($item->php_after_delete); + // base64 Decode php_import_headers. + $item->php_import_headers = base64_decode($item->php_import_headers); } - if (!empty($item->php_save)) + if (!empty($item->html_import_view)) { - // base64 Decode php_save. - $item->php_save = base64_decode($item->php_save); - } - - if (!empty($item->php_batchmove)) - { - // base64 Decode php_batchmove. - $item->php_batchmove = base64_decode($item->php_batchmove); - } - - if (!empty($item->php_allowedit)) - { - // base64 Decode php_allowedit. - $item->php_allowedit = base64_decode($item->php_allowedit); - } - - if (!empty($item->php_after_publish)) - { - // base64 Decode php_after_publish. - $item->php_after_publish = base64_decode($item->php_after_publish); - } - - if (!empty($item->php_getitems)) - { - // base64 Decode php_getitems. - $item->php_getitems = base64_decode($item->php_getitems); - } - - if (!empty($item->php_import)) - { - // base64 Decode php_import. - $item->php_import = base64_decode($item->php_import); - } - - if (!empty($item->php_getlistquery)) - { - // base64 Decode php_getlistquery. - $item->php_getlistquery = base64_decode($item->php_getlistquery); - } - - if (!empty($item->php_getitem)) - { - // base64 Decode php_getitem. - $item->php_getitem = base64_decode($item->php_getitem); - } - - if (!empty($item->php_getitems_after_all)) - { - // base64 Decode php_getitems_after_all. - $item->php_getitems_after_all = base64_decode($item->php_getitems_after_all); - } - - if (!empty($item->php_before_save)) - { - // base64 Decode php_before_save. - $item->php_before_save = base64_decode($item->php_before_save); - } - - if (!empty($item->php_postsavehook)) - { - // base64 Decode php_postsavehook. - $item->php_postsavehook = base64_decode($item->php_postsavehook); - } - - if (!empty($item->php_batchcopy)) - { - // base64 Decode php_batchcopy. - $item->php_batchcopy = base64_decode($item->php_batchcopy); - } - - if (!empty($item->php_before_publish)) - { - // base64 Decode php_before_publish. - $item->php_before_publish = base64_decode($item->php_before_publish); - } - - if (!empty($item->php_before_delete)) - { - // base64 Decode php_before_delete. - $item->php_before_delete = base64_decode($item->php_before_delete); - } - - if (!empty($item->php_document)) - { - // base64 Decode php_document. - $item->php_document = base64_decode($item->php_document); - } - - if (!empty($item->sql)) - { - // base64 Decode sql. - $item->sql = base64_decode($item->sql); - } - - if (!empty($item->php_import_display)) - { - // base64 Decode php_import_display. - $item->php_import_display = base64_decode($item->php_import_display); + // base64 Decode html_import_view. + $item->html_import_view = base64_decode($item->html_import_view); } if (!empty($item->php_import_save)) @@ -262,48 +166,138 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_import_save = base64_decode($item->php_import_save); } + if (!empty($item->php_getitem)) + { + // base64 Decode php_getitem. + $item->php_getitem = base64_decode($item->php_getitem); + } + if (!empty($item->css_view)) { // base64 Decode css_view. $item->css_view = base64_decode($item->css_view); } + if (!empty($item->php_getitems)) + { + // base64 Decode php_getitems. + $item->php_getitems = base64_decode($item->php_getitems); + } + + if (!empty($item->php_getitems_after_all)) + { + // base64 Decode php_getitems_after_all. + $item->php_getitems_after_all = base64_decode($item->php_getitems_after_all); + } + if (!empty($item->css_views)) { // base64 Decode css_views. $item->css_views = base64_decode($item->css_views); } + if (!empty($item->php_getlistquery)) + { + // base64 Decode php_getlistquery. + $item->php_getlistquery = base64_decode($item->php_getlistquery); + } + + if (!empty($item->php_before_save)) + { + // base64 Decode php_before_save. + $item->php_before_save = base64_decode($item->php_before_save); + } + if (!empty($item->javascript_view_file)) { // base64 Decode javascript_view_file. $item->javascript_view_file = base64_decode($item->javascript_view_file); } + if (!empty($item->php_save)) + { + // base64 Decode php_save. + $item->php_save = base64_decode($item->php_save); + } + + if (!empty($item->php_postsavehook)) + { + // base64 Decode php_postsavehook. + $item->php_postsavehook = base64_decode($item->php_postsavehook); + } + if (!empty($item->javascript_view_footer)) { // base64 Decode javascript_view_footer. $item->javascript_view_footer = base64_decode($item->javascript_view_footer); } + if (!empty($item->php_allowedit)) + { + // base64 Decode php_allowedit. + $item->php_allowedit = base64_decode($item->php_allowedit); + } + + if (!empty($item->php_batchcopy)) + { + // base64 Decode php_batchcopy. + $item->php_batchcopy = base64_decode($item->php_batchcopy); + } + if (!empty($item->javascript_views_file)) { // base64 Decode javascript_views_file. $item->javascript_views_file = base64_decode($item->javascript_views_file); } + if (!empty($item->php_batchmove)) + { + // base64 Decode php_batchmove. + $item->php_batchmove = base64_decode($item->php_batchmove); + } + + if (!empty($item->php_before_publish)) + { + // base64 Decode php_before_publish. + $item->php_before_publish = base64_decode($item->php_before_publish); + } + if (!empty($item->javascript_views_footer)) { // base64 Decode javascript_views_footer. $item->javascript_views_footer = base64_decode($item->javascript_views_footer); } + if (!empty($item->php_after_publish)) + { + // base64 Decode php_after_publish. + $item->php_after_publish = base64_decode($item->php_after_publish); + } + + if (!empty($item->php_before_delete)) + { + // base64 Decode php_before_delete. + $item->php_before_delete = base64_decode($item->php_before_delete); + } + + if (!empty($item->php_after_delete)) + { + // base64 Decode php_after_delete. + $item->php_after_delete = base64_decode($item->php_after_delete); + } + if (!empty($item->php_controller)) { // base64 Decode php_controller. $item->php_controller = base64_decode($item->php_controller); } + if (!empty($item->php_document)) + { + // base64 Decode php_document. + $item->php_document = base64_decode($item->php_document); + } + if (!empty($item->php_model)) { // base64 Decode php_model. @@ -316,22 +310,34 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_controller_list = base64_decode($item->php_controller_list); } + if (!empty($item->sql)) + { + // base64 Decode sql. + $item->sql = base64_decode($item->sql); + } + if (!empty($item->php_model_list)) { // base64 Decode php_model_list. $item->php_model_list = base64_decode($item->php_model_list); } + if (!empty($item->php_import_display)) + { + // base64 Decode php_import_display. + $item->php_import_display = base64_decode($item->php_import_display); + } + if (!empty($item->php_ajaxmethod)) { // base64 Decode php_ajaxmethod. $item->php_ajaxmethod = base64_decode($item->php_ajaxmethod); } - if (!empty($item->html_import_view)) + if (!empty($item->php_import)) { - // base64 Decode html_import_view. - $item->html_import_view = base64_decode($item->html_import_view); + // base64 Decode php_import. + $item->php_import = base64_decode($item->php_import); } if (!empty($item->php_import_setdata)) @@ -1186,6 +1192,19 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['metadata'] = (string) $metadata; } + // Set the addtables items to data. + if (isset($data['addtables']) && is_array($data['addtables'])) + { + $addtables = new JRegistry; + $addtables->loadArray($data['addtables']); + $data['addtables'] = (string) $addtables; + } + elseif (!isset($data['addtables'])) + { + // Set the empty addtables to data + $data['addtables'] = ''; + } + // Set the addpermissions items to data. if (isset($data['addpermissions']) && is_array($data['addpermissions'])) { @@ -1238,19 +1257,6 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['custom_button'] = ''; } - // Set the addtables items to data. - if (isset($data['addtables']) && is_array($data['addtables'])) - { - $addtables = new JRegistry; - $addtables->loadArray($data['addtables']); - $data['addtables'] = (string) $addtables; - } - elseif (!isset($data['addtables'])) - { - // Set the empty addtables to data - $data['addtables'] = ''; - } - // Set the ajax_input items to data. if (isset($data['ajax_input']) && is_array($data['ajax_input'])) { @@ -1264,112 +1270,16 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['ajax_input'] = ''; } - // Set the php_after_delete string to base64 string. - if (isset($data['php_after_delete'])) + // Set the php_import_headers string to base64 string. + if (isset($data['php_import_headers'])) { - $data['php_after_delete'] = base64_encode($data['php_after_delete']); + $data['php_import_headers'] = base64_encode($data['php_import_headers']); } - // Set the php_save string to base64 string. - if (isset($data['php_save'])) + // Set the html_import_view string to base64 string. + if (isset($data['html_import_view'])) { - $data['php_save'] = base64_encode($data['php_save']); - } - - // Set the php_batchmove string to base64 string. - if (isset($data['php_batchmove'])) - { - $data['php_batchmove'] = base64_encode($data['php_batchmove']); - } - - // Set the php_allowedit string to base64 string. - if (isset($data['php_allowedit'])) - { - $data['php_allowedit'] = base64_encode($data['php_allowedit']); - } - - // Set the php_after_publish string to base64 string. - if (isset($data['php_after_publish'])) - { - $data['php_after_publish'] = base64_encode($data['php_after_publish']); - } - - // Set the php_getitems string to base64 string. - if (isset($data['php_getitems'])) - { - $data['php_getitems'] = base64_encode($data['php_getitems']); - } - - // Set the php_import string to base64 string. - if (isset($data['php_import'])) - { - $data['php_import'] = base64_encode($data['php_import']); - } - - // Set the php_getlistquery string to base64 string. - if (isset($data['php_getlistquery'])) - { - $data['php_getlistquery'] = base64_encode($data['php_getlistquery']); - } - - // Set the php_getitem string to base64 string. - if (isset($data['php_getitem'])) - { - $data['php_getitem'] = base64_encode($data['php_getitem']); - } - - // Set the php_getitems_after_all string to base64 string. - if (isset($data['php_getitems_after_all'])) - { - $data['php_getitems_after_all'] = base64_encode($data['php_getitems_after_all']); - } - - // Set the php_before_save string to base64 string. - if (isset($data['php_before_save'])) - { - $data['php_before_save'] = base64_encode($data['php_before_save']); - } - - // Set the php_postsavehook string to base64 string. - if (isset($data['php_postsavehook'])) - { - $data['php_postsavehook'] = base64_encode($data['php_postsavehook']); - } - - // Set the php_batchcopy string to base64 string. - if (isset($data['php_batchcopy'])) - { - $data['php_batchcopy'] = base64_encode($data['php_batchcopy']); - } - - // Set the php_before_publish string to base64 string. - if (isset($data['php_before_publish'])) - { - $data['php_before_publish'] = base64_encode($data['php_before_publish']); - } - - // Set the php_before_delete string to base64 string. - if (isset($data['php_before_delete'])) - { - $data['php_before_delete'] = base64_encode($data['php_before_delete']); - } - - // Set the php_document string to base64 string. - if (isset($data['php_document'])) - { - $data['php_document'] = base64_encode($data['php_document']); - } - - // Set the sql string to base64 string. - if (isset($data['sql'])) - { - $data['sql'] = base64_encode($data['sql']); - } - - // Set the php_import_display string to base64 string. - if (isset($data['php_import_display'])) - { - $data['php_import_display'] = base64_encode($data['php_import_display']); + $data['html_import_view'] = base64_encode($data['html_import_view']); } // Set the php_import_save string to base64 string. @@ -1378,48 +1288,138 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_import_save'] = base64_encode($data['php_import_save']); } + // Set the php_getitem string to base64 string. + if (isset($data['php_getitem'])) + { + $data['php_getitem'] = base64_encode($data['php_getitem']); + } + // Set the css_view string to base64 string. if (isset($data['css_view'])) { $data['css_view'] = base64_encode($data['css_view']); } + // Set the php_getitems string to base64 string. + if (isset($data['php_getitems'])) + { + $data['php_getitems'] = base64_encode($data['php_getitems']); + } + + // Set the php_getitems_after_all string to base64 string. + if (isset($data['php_getitems_after_all'])) + { + $data['php_getitems_after_all'] = base64_encode($data['php_getitems_after_all']); + } + // Set the css_views string to base64 string. if (isset($data['css_views'])) { $data['css_views'] = base64_encode($data['css_views']); } + // Set the php_getlistquery string to base64 string. + if (isset($data['php_getlistquery'])) + { + $data['php_getlistquery'] = base64_encode($data['php_getlistquery']); + } + + // Set the php_before_save string to base64 string. + if (isset($data['php_before_save'])) + { + $data['php_before_save'] = base64_encode($data['php_before_save']); + } + // Set the javascript_view_file string to base64 string. if (isset($data['javascript_view_file'])) { $data['javascript_view_file'] = base64_encode($data['javascript_view_file']); } + // Set the php_save string to base64 string. + if (isset($data['php_save'])) + { + $data['php_save'] = base64_encode($data['php_save']); + } + + // Set the php_postsavehook string to base64 string. + if (isset($data['php_postsavehook'])) + { + $data['php_postsavehook'] = base64_encode($data['php_postsavehook']); + } + // Set the javascript_view_footer string to base64 string. if (isset($data['javascript_view_footer'])) { $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); } + // Set the php_allowedit string to base64 string. + if (isset($data['php_allowedit'])) + { + $data['php_allowedit'] = base64_encode($data['php_allowedit']); + } + + // Set the php_batchcopy string to base64 string. + if (isset($data['php_batchcopy'])) + { + $data['php_batchcopy'] = base64_encode($data['php_batchcopy']); + } + // Set the javascript_views_file string to base64 string. if (isset($data['javascript_views_file'])) { $data['javascript_views_file'] = base64_encode($data['javascript_views_file']); } + // Set the php_batchmove string to base64 string. + if (isset($data['php_batchmove'])) + { + $data['php_batchmove'] = base64_encode($data['php_batchmove']); + } + + // Set the php_before_publish string to base64 string. + if (isset($data['php_before_publish'])) + { + $data['php_before_publish'] = base64_encode($data['php_before_publish']); + } + // Set the javascript_views_footer string to base64 string. if (isset($data['javascript_views_footer'])) { $data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']); } + // Set the php_after_publish string to base64 string. + if (isset($data['php_after_publish'])) + { + $data['php_after_publish'] = base64_encode($data['php_after_publish']); + } + + // Set the php_before_delete string to base64 string. + if (isset($data['php_before_delete'])) + { + $data['php_before_delete'] = base64_encode($data['php_before_delete']); + } + + // Set the php_after_delete string to base64 string. + if (isset($data['php_after_delete'])) + { + $data['php_after_delete'] = base64_encode($data['php_after_delete']); + } + // Set the php_controller string to base64 string. if (isset($data['php_controller'])) { $data['php_controller'] = base64_encode($data['php_controller']); } + // Set the php_document string to base64 string. + if (isset($data['php_document'])) + { + $data['php_document'] = base64_encode($data['php_document']); + } + // Set the php_model string to base64 string. if (isset($data['php_model'])) { @@ -1432,22 +1432,34 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_controller_list'] = base64_encode($data['php_controller_list']); } + // Set the sql string to base64 string. + if (isset($data['sql'])) + { + $data['sql'] = base64_encode($data['sql']); + } + // Set the php_model_list string to base64 string. if (isset($data['php_model_list'])) { $data['php_model_list'] = base64_encode($data['php_model_list']); } + // Set the php_import_display string to base64 string. + if (isset($data['php_import_display'])) + { + $data['php_import_display'] = base64_encode($data['php_import_display']); + } + // Set the php_ajaxmethod string to base64 string. if (isset($data['php_ajaxmethod'])) { $data['php_ajaxmethod'] = base64_encode($data['php_ajaxmethod']); } - // Set the html_import_view string to base64 string. - if (isset($data['html_import_view'])) + // Set the php_import string to base64 string. + if (isset($data['php_import'])) { - $data['html_import_view'] = base64_encode($data['html_import_view']); + $data['php_import'] = base64_encode($data['php_import']); } // Set the php_import_setdata string to base64 string. diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index f419a6d8d..258ab9079 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -262,68 +262,70 @@ class ComponentbuilderModelAdmin_views extends JModelList continue; } - // decode php_after_delete - $item->php_after_delete = base64_decode($item->php_after_delete); - // decode php_save - $item->php_save = base64_decode($item->php_save); - // decode php_batchmove - $item->php_batchmove = base64_decode($item->php_batchmove); - // decode php_allowedit - $item->php_allowedit = base64_decode($item->php_allowedit); - // decode php_after_publish - $item->php_after_publish = base64_decode($item->php_after_publish); - // decode php_getitems - $item->php_getitems = base64_decode($item->php_getitems); - // decode php_import - $item->php_import = base64_decode($item->php_import); - // decode php_getlistquery - $item->php_getlistquery = base64_decode($item->php_getlistquery); - // decode php_getitem - $item->php_getitem = base64_decode($item->php_getitem); - // decode php_getitems_after_all - $item->php_getitems_after_all = base64_decode($item->php_getitems_after_all); - // decode php_before_save - $item->php_before_save = base64_decode($item->php_before_save); - // decode php_postsavehook - $item->php_postsavehook = base64_decode($item->php_postsavehook); - // decode php_batchcopy - $item->php_batchcopy = base64_decode($item->php_batchcopy); - // decode php_before_publish - $item->php_before_publish = base64_decode($item->php_before_publish); - // decode php_before_delete - $item->php_before_delete = base64_decode($item->php_before_delete); - // decode php_document - $item->php_document = base64_decode($item->php_document); - // decode sql - $item->sql = base64_decode($item->sql); - // decode php_import_display - $item->php_import_display = base64_decode($item->php_import_display); + // decode php_import_headers + $item->php_import_headers = base64_decode($item->php_import_headers); + // decode html_import_view + $item->html_import_view = base64_decode($item->html_import_view); // decode php_import_save $item->php_import_save = base64_decode($item->php_import_save); + // decode php_getitem + $item->php_getitem = base64_decode($item->php_getitem); // decode css_view $item->css_view = base64_decode($item->css_view); + // decode php_getitems + $item->php_getitems = base64_decode($item->php_getitems); + // decode php_getitems_after_all + $item->php_getitems_after_all = base64_decode($item->php_getitems_after_all); // decode css_views $item->css_views = base64_decode($item->css_views); + // decode php_getlistquery + $item->php_getlistquery = base64_decode($item->php_getlistquery); + // decode php_before_save + $item->php_before_save = base64_decode($item->php_before_save); // decode javascript_view_file $item->javascript_view_file = base64_decode($item->javascript_view_file); + // decode php_save + $item->php_save = base64_decode($item->php_save); + // decode php_postsavehook + $item->php_postsavehook = base64_decode($item->php_postsavehook); // decode javascript_view_footer $item->javascript_view_footer = base64_decode($item->javascript_view_footer); + // decode php_allowedit + $item->php_allowedit = base64_decode($item->php_allowedit); + // decode php_batchcopy + $item->php_batchcopy = base64_decode($item->php_batchcopy); // decode javascript_views_file $item->javascript_views_file = base64_decode($item->javascript_views_file); + // decode php_batchmove + $item->php_batchmove = base64_decode($item->php_batchmove); + // decode php_before_publish + $item->php_before_publish = base64_decode($item->php_before_publish); // decode javascript_views_footer $item->javascript_views_footer = base64_decode($item->javascript_views_footer); + // decode php_after_publish + $item->php_after_publish = base64_decode($item->php_after_publish); + // decode php_before_delete + $item->php_before_delete = base64_decode($item->php_before_delete); + // decode php_after_delete + $item->php_after_delete = base64_decode($item->php_after_delete); // decode php_controller $item->php_controller = base64_decode($item->php_controller); + // decode php_document + $item->php_document = base64_decode($item->php_document); // decode php_model $item->php_model = base64_decode($item->php_model); // decode php_controller_list $item->php_controller_list = base64_decode($item->php_controller_list); + // decode sql + $item->sql = base64_decode($item->sql); // decode php_model_list $item->php_model_list = base64_decode($item->php_model_list); + // decode php_import_display + $item->php_import_display = base64_decode($item->php_import_display); // decode php_ajaxmethod $item->php_ajaxmethod = base64_decode($item->php_ajaxmethod); - // decode html_import_view - $item->html_import_view = base64_decode($item->html_import_view); + // decode php_import + $item->php_import = base64_decode($item->php_import); // decode php_import_setdata $item->php_import_setdata = base64_decode($item->php_import_setdata); // decode php_import_ext @@ -344,33 +346,6 @@ class ComponentbuilderModelAdmin_views extends JModelList } } return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__componentbuilder_admin_view"); - if (ComponentbuilderHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; } /** diff --git a/admin/models/custom_admin_views.php b/admin/models/custom_admin_views.php index b4b6f9f8b..43849e1b3 100644 --- a/admin/models/custom_admin_views.php +++ b/admin/models/custom_admin_views.php @@ -306,33 +306,6 @@ class ComponentbuilderModelCustom_admin_views extends JModelList } } return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__componentbuilder_custom_admin_view"); - if (ComponentbuilderHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; } /** diff --git a/admin/models/custom_codes.php b/admin/models/custom_codes.php index e7b32d13a..2e32d19ee 100644 --- a/admin/models/custom_codes.php +++ b/admin/models/custom_codes.php @@ -406,33 +406,6 @@ class ComponentbuilderModelCustom_codes extends JModelList } } return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__componentbuilder_custom_code"); - if (ComponentbuilderHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; } /** diff --git a/admin/models/dynamic_gets.php b/admin/models/dynamic_gets.php index c1895652e..c89189dce 100644 --- a/admin/models/dynamic_gets.php +++ b/admin/models/dynamic_gets.php @@ -351,33 +351,6 @@ class ComponentbuilderModelDynamic_gets extends JModelList } } return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__componentbuilder_dynamic_get"); - if (ComponentbuilderHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; } /** diff --git a/admin/models/fields.php b/admin/models/fields.php index 6666d984b..71e5b6e49 100644 --- a/admin/models/fields.php +++ b/admin/models/fields.php @@ -454,33 +454,6 @@ class ComponentbuilderModelFields extends JModelList } } return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__componentbuilder_field"); - if (ComponentbuilderHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; } /** diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php index 54cb01dd7..ab2e5c558 100644 --- a/admin/models/fieldtype.php +++ b/admin/models/fieldtype.php @@ -139,7 +139,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @return mixed An array of data items on success, false on failure. */ - public function getWaafields() + public function getWabfields() { // Get the user object. $user = JFactory::getUser(); @@ -223,13 +223,13 @@ class ComponentbuilderModelFieldtype extends JModelAdmin foreach ($items as $nr => &$item) { // convert datatype - $item->datatype = $this->selectionTranslationWaafields($item->datatype, 'datatype'); + $item->datatype = $this->selectionTranslationWabfields($item->datatype, 'datatype'); // convert indexes - $item->indexes = $this->selectionTranslationWaafields($item->indexes, 'indexes'); + $item->indexes = $this->selectionTranslationWabfields($item->indexes, 'indexes'); // convert null_switch - $item->null_switch = $this->selectionTranslationWaafields($item->null_switch, 'null_switch'); + $item->null_switch = $this->selectionTranslationWabfields($item->null_switch, 'null_switch'); // convert store - $item->store = $this->selectionTranslationWaafields($item->store, 'store'); + $item->store = $this->selectionTranslationWabfields($item->store, 'store'); } } @@ -243,7 +243,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin * * @return translatable string */ - public function selectionTranslationWaafields($value,$name) + public function selectionTranslationWabfields($value,$name) { // Array of datatype language strings if ($name === 'datatype') diff --git a/admin/models/fieldtypes.php b/admin/models/fieldtypes.php index bbab3cca7..2b038b530 100644 --- a/admin/models/fieldtypes.php +++ b/admin/models/fieldtypes.php @@ -306,33 +306,6 @@ class ComponentbuilderModelFieldtypes extends JModelList } } return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__componentbuilder_fieldtype"); - if (ComponentbuilderHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; } /** diff --git a/admin/models/forms/admin_view.js b/admin/models/forms/admin_view.js index c6228c10f..3cfa2980d 100644 --- a/admin/models/forms/admin_view.js +++ b/admin/models/forms/admin_view.js @@ -53,10 +53,11 @@ jform_vvvvvxyvxo_required = false; jform_vvvvvxyvxp_required = false; jform_vvvvvxyvxq_required = false; jform_vvvvvxyvxr_required = false; -jform_vvvvvyavxs_required = false; +jform_vvvvvxyvxs_required = false; jform_vvvvvyavxt_required = false; jform_vvvvvyavxu_required = false; jform_vvvvvyavxv_required = false; +jform_vvvvvyavxw_required = false; // Initial Script jQuery(document).ready(function() @@ -945,34 +946,44 @@ function vvvvvxy(add_custom_import_vvvvvxy) jform_vvvvvxyvxo_required = false; } - jQuery('#jform_php_import').closest('.control-group').show(); + jQuery('#jform_php_import_headers').closest('.control-group').show(); if (jform_vvvvvxyvxp_required) + { + updateFieldRequired('php_import_headers',0); + jQuery('#jform_php_import_headers').prop('required','required'); + jQuery('#jform_php_import_headers').attr('aria-required',true); + jQuery('#jform_php_import_headers').addClass('required'); + jform_vvvvvxyvxp_required = false; + } + + jQuery('#jform_php_import').closest('.control-group').show(); + if (jform_vvvvvxyvxq_required) { updateFieldRequired('php_import',0); jQuery('#jform_php_import').prop('required','required'); jQuery('#jform_php_import').attr('aria-required',true); jQuery('#jform_php_import').addClass('required'); - jform_vvvvvxyvxp_required = false; + jform_vvvvvxyvxq_required = false; } jQuery('#jform_php_import_save').closest('.control-group').show(); - if (jform_vvvvvxyvxq_required) + if (jform_vvvvvxyvxr_required) { updateFieldRequired('php_import_save',0); jQuery('#jform_php_import_save').prop('required','required'); jQuery('#jform_php_import_save').attr('aria-required',true); jQuery('#jform_php_import_save').addClass('required'); - jform_vvvvvxyvxq_required = false; + jform_vvvvvxyvxr_required = false; } jQuery('#jform_php_import_setdata').closest('.control-group').show(); - if (jform_vvvvvxyvxr_required) + if (jform_vvvvvxyvxs_required) { updateFieldRequired('php_import_setdata',0); jQuery('#jform_php_import_setdata').prop('required','required'); jQuery('#jform_php_import_setdata').attr('aria-required',true); jQuery('#jform_php_import_setdata').addClass('required'); - jform_vvvvvxyvxr_required = false; + jform_vvvvvxyvxs_required = false; } } @@ -1006,32 +1017,41 @@ function vvvvvxy(add_custom_import_vvvvvxy) jQuery('#jform_php_import_ext').removeClass('required'); jform_vvvvvxyvxo_required = true; } - jQuery('#jform_php_import').closest('.control-group').hide(); + jQuery('#jform_php_import_headers').closest('.control-group').hide(); if (!jform_vvvvvxyvxp_required) + { + updateFieldRequired('php_import_headers',1); + jQuery('#jform_php_import_headers').removeAttr('required'); + jQuery('#jform_php_import_headers').removeAttr('aria-required'); + jQuery('#jform_php_import_headers').removeClass('required'); + jform_vvvvvxyvxp_required = true; + } + jQuery('#jform_php_import').closest('.control-group').hide(); + if (!jform_vvvvvxyvxq_required) { updateFieldRequired('php_import',1); jQuery('#jform_php_import').removeAttr('required'); jQuery('#jform_php_import').removeAttr('aria-required'); jQuery('#jform_php_import').removeClass('required'); - jform_vvvvvxyvxp_required = true; + jform_vvvvvxyvxq_required = true; } jQuery('#jform_php_import_save').closest('.control-group').hide(); - if (!jform_vvvvvxyvxq_required) + if (!jform_vvvvvxyvxr_required) { updateFieldRequired('php_import_save',1); jQuery('#jform_php_import_save').removeAttr('required'); jQuery('#jform_php_import_save').removeAttr('aria-required'); jQuery('#jform_php_import_save').removeClass('required'); - jform_vvvvvxyvxq_required = true; + jform_vvvvvxyvxr_required = true; } jQuery('#jform_php_import_setdata').closest('.control-group').hide(); - if (!jform_vvvvvxyvxr_required) + if (!jform_vvvvvxyvxs_required) { updateFieldRequired('php_import_setdata',1); jQuery('#jform_php_import_setdata').removeAttr('required'); jQuery('#jform_php_import_setdata').removeAttr('aria-required'); jQuery('#jform_php_import_setdata').removeClass('required'); - jform_vvvvvxyvxr_required = true; + jform_vvvvvxyvxs_required = true; } } } @@ -1058,43 +1078,43 @@ function vvvvvya(add_custom_button_vvvvvya) { jQuery('#jform_custom_button-lbl').closest('.control-group').show(); jQuery('#jform_php_controller').closest('.control-group').show(); - if (jform_vvvvvyavxs_required) + if (jform_vvvvvyavxt_required) { updateFieldRequired('php_controller',0); jQuery('#jform_php_controller').prop('required','required'); jQuery('#jform_php_controller').attr('aria-required',true); jQuery('#jform_php_controller').addClass('required'); - jform_vvvvvyavxs_required = false; + jform_vvvvvyavxt_required = false; } jQuery('#jform_php_controller_list').closest('.control-group').show(); - if (jform_vvvvvyavxt_required) + if (jform_vvvvvyavxu_required) { updateFieldRequired('php_controller_list',0); jQuery('#jform_php_controller_list').prop('required','required'); jQuery('#jform_php_controller_list').attr('aria-required',true); jQuery('#jform_php_controller_list').addClass('required'); - jform_vvvvvyavxt_required = false; + jform_vvvvvyavxu_required = false; } jQuery('#jform_php_model').closest('.control-group').show(); - if (jform_vvvvvyavxu_required) + if (jform_vvvvvyavxv_required) { updateFieldRequired('php_model',0); jQuery('#jform_php_model').prop('required','required'); jQuery('#jform_php_model').attr('aria-required',true); jQuery('#jform_php_model').addClass('required'); - jform_vvvvvyavxu_required = false; + jform_vvvvvyavxv_required = false; } jQuery('#jform_php_model_list').closest('.control-group').show(); - if (jform_vvvvvyavxv_required) + if (jform_vvvvvyavxw_required) { updateFieldRequired('php_model_list',0); jQuery('#jform_php_model_list').prop('required','required'); jQuery('#jform_php_model_list').attr('aria-required',true); jQuery('#jform_php_model_list').addClass('required'); - jform_vvvvvyavxv_required = false; + jform_vvvvvyavxw_required = false; } } @@ -1102,40 +1122,40 @@ function vvvvvya(add_custom_button_vvvvvya) { jQuery('#jform_custom_button-lbl').closest('.control-group').hide(); jQuery('#jform_php_controller').closest('.control-group').hide(); - if (!jform_vvvvvyavxs_required) + if (!jform_vvvvvyavxt_required) { updateFieldRequired('php_controller',1); jQuery('#jform_php_controller').removeAttr('required'); jQuery('#jform_php_controller').removeAttr('aria-required'); jQuery('#jform_php_controller').removeClass('required'); - jform_vvvvvyavxs_required = true; + jform_vvvvvyavxt_required = true; } jQuery('#jform_php_controller_list').closest('.control-group').hide(); - if (!jform_vvvvvyavxt_required) + if (!jform_vvvvvyavxu_required) { updateFieldRequired('php_controller_list',1); jQuery('#jform_php_controller_list').removeAttr('required'); jQuery('#jform_php_controller_list').removeAttr('aria-required'); jQuery('#jform_php_controller_list').removeClass('required'); - jform_vvvvvyavxt_required = true; + jform_vvvvvyavxu_required = true; } jQuery('#jform_php_model').closest('.control-group').hide(); - if (!jform_vvvvvyavxu_required) + if (!jform_vvvvvyavxv_required) { updateFieldRequired('php_model',1); jQuery('#jform_php_model').removeAttr('required'); jQuery('#jform_php_model').removeAttr('aria-required'); jQuery('#jform_php_model').removeClass('required'); - jform_vvvvvyavxu_required = true; + jform_vvvvvyavxv_required = true; } jQuery('#jform_php_model_list').closest('.control-group').hide(); - if (!jform_vvvvvyavxv_required) + if (!jform_vvvvvyavxw_required) { updateFieldRequired('php_model_list',1); jQuery('#jform_php_model_list').removeAttr('required'); jQuery('#jform_php_model_list').removeAttr('aria-required'); jQuery('#jform_php_model_list').removeClass('required'); - jform_vvvvvyavxv_required = true; + jform_vvvvvyavxw_required = true; } } } @@ -1290,7 +1310,7 @@ function getLinked(){ } function getTableColumns_server(tableName){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json&vdm="+vastDevMod; if(token.length > 0 && tableName.length > 0){ var request = 'token='+token+'&table='+tableName; } @@ -1321,7 +1341,7 @@ function getTableColumns(fieldKey, table_, nr_){ } function getImportScripts_server(typpe){ - var getUrl = "index.php?option=com_componentbuilder&task=ajax.getImportScripts&format=json"; + var getUrl = "index.php?option=com_componentbuilder&task=ajax.getImportScripts&format=json&vdm="+vastDevMod; if(token.length > 0 && typpe.length > 0){ var request = 'token='+token+'&type='+typpe; } @@ -1339,6 +1359,7 @@ function getImportScripts(id){ // get the current values var current_import_display = jQuery('textarea#jform_php_import_display').val(); var current_import = jQuery('textarea#jform_php_import').val(); + var current_headers = jQuery('textarea#jform_php_import_headers').val(); var current_setdata = jQuery('textarea#jform_php_import_setdata').val(); var current_save = jQuery('textarea#jform_php_import_save').val(); var current_view = jQuery('textarea#jform_html_import_view').val(); @@ -1359,6 +1380,14 @@ function getImportScripts(id){ } }); } + // set the headers method script + if(current_headers.length == 0){ + getImportScripts_server('headers').done(function(result) { + if(result){ + jQuery('textarea#jform_php_import_headers').val(result); + } + }); + } // set the setData method script if(current_setdata.length == 0){ getImportScripts_server('setdata').done(function(result) { diff --git a/admin/models/forms/admin_view.xml b/admin/models/forms/admin_view.xml index 73fe5b727..a01895ae5 100644 --- a/admin/models/forms/admin_view.xml +++ b/admin/models/forms/admin_view.xml @@ -136,17 +136,17 @@ label="COM_COMPONENTBUILDER_ADMIN_VIEW_ICON_LABEL" description="COM_COMPONENTBUILDER_ADMIN_VIEW_ICON_DESCRIPTION" directory="" /> - - + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + - - + + + + + + COM_COMPONENTBUILDER_ADMIN_VIEW_ADD - - + + + + + + - + + +