From 82fd08cf57460a0bec8cac6ef1c7bd62db908e4b Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 31 Mar 2017 23:28:16 +0200 Subject: [PATCH] Resolves gh-59 the repeatable field id problem. Also improved the export and import to insure snippets and linked admin views are re-mapped on import of the component. Also fixed the target and match field conditions in admin views to re-map the ids correctly. --- README.md | 2 +- admin/README.txt | 2 +- admin/assets/css/admin_view.css | 4 +- admin/assets/css/admin_views.css | 4 +- admin/assets/css/joomla_component.css | 4 +- admin/assets/css/joomla_components.css | 4 +- admin/controllers/admin_view.php | 4 +- admin/controllers/admin_views.php | 4 +- admin/controllers/joomla_component.php | 4 +- admin/controllers/joomla_components.php | 4 +- admin/helpers/compiler/c_Fields.php | 6 +- .../en-GB/en-GB.com_componentbuilder.ini | 6 +- .../admin_view/custom_buttons_fullwidth.php | 2 +- admin/models/admin_view.php | 28 +- admin/models/admin_views.php | 8 +- admin/models/forms/admin_view.js | 4 +- admin/models/forms/admin_view.xml | 20 +- admin/models/forms/joomla_component.js | 4 +- admin/models/import_joomla_components.php | 326 ++++++++++++++++-- admin/models/joomla_component.php | 4 +- admin/models/joomla_components.php | 169 ++++++++- admin/tables/admin_view.php | 4 +- admin/tables/joomla_component.php | 4 +- admin/views/admin_view/submitbutton.js | 4 +- admin/views/admin_view/tmpl/edit.php | 4 +- admin/views/admin_view/view.html.php | 4 +- admin/views/admin_views/tmpl/default.php | 4 +- .../admin_views/tmpl/default_batch_body.php | 4 +- .../admin_views/tmpl/default_batch_footer.php | 4 +- admin/views/admin_views/tmpl/default_body.php | 4 +- admin/views/admin_views/tmpl/default_foot.php | 4 +- admin/views/admin_views/tmpl/default_head.php | 4 +- .../admin_views/tmpl/default_toolbar.php | 4 +- admin/views/admin_views/view.html.php | 4 +- admin/views/joomla_component/submitbutton.js | 4 +- admin/views/joomla_component/tmpl/edit.php | 4 +- admin/views/joomla_component/view.html.php | 4 +- .../views/joomla_components/tmpl/default.php | 4 +- .../tmpl/default_batch_body.php | 4 +- .../tmpl/default_batch_footer.php | 4 +- .../joomla_components/tmpl/default_body.php | 4 +- .../joomla_components/tmpl/default_foot.php | 4 +- .../joomla_components/tmpl/default_head.php | 4 +- .../tmpl/default_toolbar.php | 4 +- admin/views/joomla_components/view.html.php | 4 +- script.php | 4 +- 46 files changed, 557 insertions(+), 156 deletions(-) diff --git a/README.md b/README.md index d10a8cf43..4f607d266 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.3.10 + *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*: **96064** ++ *Line count*: **96465** + *File count*: **578** + *Folder count*: **107** diff --git a/admin/README.txt b/admin/README.txt index d10a8cf43..4f607d266 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -109,7 +109,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.3.10 + *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*: **96064** ++ *Line count*: **96465** + *File count*: **578** + *Folder count*: **107** diff --git a/admin/assets/css/admin_view.css b/admin/assets/css/admin_view.css index db44338a4..709ce4654 100644 --- a/admin/assets/css/admin_view.css +++ b/admin/assets/css/admin_view.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_view.css diff --git a/admin/assets/css/admin_views.css b/admin/assets/css/admin_views.css index 7027a0964..c0a4b6141 100644 --- a/admin/assets/css/admin_views.css +++ b/admin/assets/css/admin_views.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_views.css diff --git a/admin/assets/css/joomla_component.css b/admin/assets/css/joomla_component.css index 867379060..0514a625e 100644 --- a/admin/assets/css/joomla_component.css +++ b/admin/assets/css/joomla_component.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage joomla_component.css diff --git a/admin/assets/css/joomla_components.css b/admin/assets/css/joomla_components.css index 3b099679c..878e59bab 100644 --- a/admin/assets/css/joomla_components.css +++ b/admin/assets/css/joomla_components.css @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage joomla_components.css diff --git a/admin/controllers/admin_view.php b/admin/controllers/admin_view.php index d9c1c71f6..41bc55bfa 100644 --- a/admin/controllers/admin_view.php +++ b/admin/controllers/admin_view.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_view.php diff --git a/admin/controllers/admin_views.php b/admin/controllers/admin_views.php index 3a7320c39..c98a2abca 100644 --- a/admin/controllers/admin_views.php +++ b/admin/controllers/admin_views.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_views.php diff --git a/admin/controllers/joomla_component.php b/admin/controllers/joomla_component.php index b79f070a9..56efe86cc 100644 --- a/admin/controllers/joomla_component.php +++ b/admin/controllers/joomla_component.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage joomla_component.php diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index d087ccefe..5a059a915 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage joomla_components.php diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php index 9a58c05ab..a6514a582 100644 --- a/admin/helpers/compiler/c_Fields.php +++ b/admin/helpers/compiler/c_Fields.php @@ -957,12 +957,12 @@ class Fields extends Structure if (strpos($fieldAttributes['fields'], ',') !== false) { // mulitpal fields - $fieldsSets = explode(',', $fieldAttributes['fields']); + $fieldsSets = (array) explode(',', $fieldAttributes['fields']); } - else + elseif (is_numeric($fieldAttributes['fields'])) { // single field - $fieldsSets[] = $fieldAttributes['fields']; + $fieldsSets[] = (int) $fieldAttributes['fields']; } // only continue if we have a field set if (ComponentbuilderHelper::checkArray($fieldsSets)) diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 53f0537ff..e5bdc54d2 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -713,15 +713,19 @@ COM_COMPONENTBUILDER_BDYNAMIC_GETB_IDS_MISMATCH_IN_BSB="Dynamic get id:%s COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE="Be cautious! Do not continue unless you trust the origin of this package!" COM_COMPONENTBUILDER_BFIELD_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BFIELDB_SO_THE_IDS_WAS_REMOVED="Field in %s has id mismatch of selected field. So the id:%s was removed!" COM_COMPONENTBUILDER_BFIELD_TYPEB_IDS_MISMATCH_IN_BSB="Field type id:%s mismatch in %s." +COM_COMPONENTBUILDER_BFIELD_TYPEB_NOT_SET_FOR_BSB="Field type not set for %s." COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA="Get the key from %s" COM_COMPONENTBUILDER_BIMAGESB_NOT_MOVE_TO_CORRECT_LOCATION="Images not move to correct location!" COM_COMPONENTBUILDER_BJOIN_VIEW_TABLE_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BVIEW_TABLEB_SO_THE_IDS_WAS_REMOVED="Join view table in %s has id mismatch of selected view table. So the id:%s was removed!" -COM_COMPONENTBUILDER_BLINKED_ADMIN_VIEW_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BADMIN_VIEWB_SO_THE_IDS_WAS_NOT_UPDATED="Linked admin view in %s has id mismatch of selected admin view. So the id:%s was not updated!" +COM_COMPONENTBUILDER_BLINKED_VIEWB_IDS_MISMATCH_IN_BADMIN_VIEWSB_AND_WAS_EMREMOVEDEM_FROM_THE_LINKED_VIEWS="Linked view id:%s mismatch in admin view:%s, and was removed from the linked views." COM_COMPONENTBUILDER_BMAIN_GETB_IDS_MISMATCH_IN_BSB="Main get id:%s mismatch in %s." +COM_COMPONENTBUILDER_BMAIN_GETB_NOT_SET_FOR_BSB="Main get not set for %s." +COM_COMPONENTBUILDER_BREPEATABLEB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_EMREMOVEDEM_FROM_THE_FIELD="Repeatable id:%s mismatch in field:%s, and was removed from the field." COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS="%s could not be imported%s" COM_COMPONENTBUILDER_BSB_EMCOMPONENT_DETAILSEM="%s component details" COM_COMPONENTBUILDER_BSB_HAS_ID_MISMATCH_OF_SELECTED_BFIELDB_SO_THE_IDS_WAS_REMOVED="%s has id mismatch of selected field. So the id:%s was removed!" COM_COMPONENTBUILDER_BSITE_VIEW_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BSITE_VIEWB_SO_THE_IDS_WAS_REMOVED="Site view in %s has id mismatch of selected site view. So the id:%s was removed!" +COM_COMPONENTBUILDER_BSNIPPETB_IDS_MISMATCH_IN_BSB="Snippet id:%s mismatch in %s." COM_COMPONENTBUILDER_BVIEW_TABLE_MAINB_IDS_MISMATCH_IN_BSB="View table main id:%s mismatch in %s." COM_COMPONENTBUILDER_CLEAR_TMP="Clear tmp" COM_COMPONENTBUILDER_COMPANY="Company" diff --git a/admin/layouts/admin_view/custom_buttons_fullwidth.php b/admin/layouts/admin_view/custom_buttons_fullwidth.php index aee535b65..9c543b6fa 100644 --- a/admin/layouts/admin_view/custom_buttons_fullwidth.php +++ b/admin/layouts/admin_view/custom_buttons_fullwidth.php @@ -31,8 +31,8 @@ $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( 'php_controller', - 'php_controller_list', 'php_model', + 'php_controller_list', 'php_model_list' ); diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index 21204775b..f74fc1517 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_view.php @@ -245,18 +245,18 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $item->php_controller = base64_decode($item->php_controller); } - if (!empty($item->php_controller_list)) - { - // base64 Decode php_controller_list. - $item->php_controller_list = base64_decode($item->php_controller_list); - } - if (!empty($item->php_model)) { // base64 Decode php_model. $item->php_model = base64_decode($item->php_model); } + if (!empty($item->php_controller_list)) + { + // base64 Decode php_controller_list. + $item->php_controller_list = base64_decode($item->php_controller_list); + } + if (!empty($item->php_model_list)) { // base64 Decode php_model_list. @@ -1428,18 +1428,18 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin $data['php_controller'] = base64_encode($data['php_controller']); } - // Set the php_controller_list string to base64 string. - if (isset($data['php_controller_list'])) - { - $data['php_controller_list'] = base64_encode($data['php_controller_list']); - } - // Set the php_model string to base64 string. if (isset($data['php_model'])) { $data['php_model'] = base64_encode($data['php_model']); } + // Set the php_controller_list string to base64 string. + if (isset($data['php_controller_list'])) + { + $data['php_controller_list'] = base64_encode($data['php_controller_list']); + } + // Set the php_model_list string to base64 string. if (isset($data['php_model_list'])) { diff --git a/admin/models/admin_views.php b/admin/models/admin_views.php index 0339ef6ad..680cf4ccc 100644 --- a/admin/models/admin_views.php +++ b/admin/models/admin_views.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_views.php @@ -312,10 +312,10 @@ class ComponentbuilderModelAdmin_views extends JModelList $item->javascript_views_footer = base64_decode($item->javascript_views_footer); // decode php_controller $item->php_controller = base64_decode($item->php_controller); - // decode php_controller_list - $item->php_controller_list = base64_decode($item->php_controller_list); // 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 php_model_list $item->php_model_list = base64_decode($item->php_model_list); // decode html_import_view diff --git a/admin/models/forms/admin_view.js b/admin/models/forms/admin_view.js index 6af715a49..b7df20449 100644 --- a/admin/models/forms/admin_view.js +++ b/admin/models/forms/admin_view.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_view.js diff --git a/admin/models/forms/admin_view.xml b/admin/models/forms/admin_view.xml index 6865450da..c7e83ce80 100644 --- a/admin/models/forms/admin_view.xml +++ b/admin/models/forms/admin_view.xml @@ -1917,17 +1917,17 @@ - + @@ -1969,17 +1969,17 @@ - + diff --git a/admin/models/forms/joomla_component.js b/admin/models/forms/joomla_component.js index f8855bbf6..53a7f2fca 100644 --- a/admin/models/forms/joomla_component.js +++ b/admin/models/forms/joomla_component.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage joomla_component.js diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php index db53f4c4a..fb29b3caa 100644 --- a/admin/models/import_joomla_components.php +++ b/admin/models/import_joomla_components.php @@ -81,11 +81,14 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy } protected $app; - protected $target = false; - protected $newID = array(); - protected $forceUpdate = 0; - protected $hasKey = 0; - protected $sleutle = null; + protected $target = false; + protected $newID = array(); + protected $forceUpdate = 0; + protected $hasKey = 0; + protected $sleutle = null; + protected $updateAfter = array('field' => array(), 'adminview' => array()); + protected $fieldTypes = array(); + protected $isRepeatable = array(); /** * Import an spreadsheet from either folder, url or upload. @@ -652,6 +655,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy { return false; } + // we then store the snippet + if (!$this->saveSmartItems($data, 'snippet', $db, $user, $today)) + { + return false; + } // we then store the dynamic_get if (!$this->saveSmartItems($data, 'dynamic_get', $db, $user, $today)) { @@ -687,6 +695,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy { return false; } + // do a after all run on all items that need it + $this->updateAfter($db); // lets move all the files to its correct location if (!$this->moveSmartStuff($dir)) { @@ -756,6 +766,11 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy $canEdit = $canDo->get('core.edit'); $canState = $canDo->get('core.edit.state'); $canCreate = $canDo->get('core.create'); + // set id keeper + if (!isset($this->newID[$type])) + { + $this->newID[$type] = array(); + } foreach ($items[$type] as $item) { $oldID = $item->id; @@ -769,7 +784,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy { // make sure we have the correct ID set $item->id = $local->id; - // yes it is newer, lets update + // yes it is newer, lets update (or is being forced) if ($canEdit && $id = $this->updateLocalItem($item, $type, $db, $user, $today, $canState)) { $this->newID[$type][$oldID] = $id; @@ -808,6 +823,120 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy return $success; } + /** + * Update some items after all + * + * @param object $db The database object + * + * @return void + * + **/ + protected function updateAfter($db) + { + if (ComponentbuilderHelper::checkArray($this->updateAfter['field'])) + { + // update repeatable + foreach ($this->updateAfter['field'] as $field) + { + if (isset($this->newID['field'][$field])) + { + $field = $this->newID['field'][$field]; + } + // get the field from db + if ($xml = ComponentbuilderHelper::getVar('field', $field, 'id', 'xml')) + { + if (ComponentbuilderHelper::checkJson($xml)) + { + $xml = json_decode($xml); + $fields = ComponentbuilderHelper::getBetween($xml, 'fields="', '"'); + $fieldsSets = array(); + if (strpos($fields, ',') !== false) + { + // multiple fields + $fieldsSets = array_map('trim', (array) explode(',', $fields)); + } + elseif (is_numeric($fields)) + { + // single field + $fieldsSets[] = (int) $fields; + } + // update the fields + if (ComponentbuilderHelper::checkArray($fieldsSets)) + { + $bucket = array(); + foreach ($fieldsSets as $id) + { + if (isset($this->newID['field'][$id])) + { + $bucket[] = $this->newID['field'][$id]; + } + else + { + $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BREPEATABLEB_IDS_MISMATCH_IN_BFIELDSB_AND_WAS_EMREMOVEDEM_FROM_THE_FIELD', $id, $field), 'warning'); + } + } + if (ComponentbuilderHelper::checkArray($bucket)) + { + $string = implode(',', $bucket); + $xml = json_encode(str_replace('fields="' . $fields . '"', 'fields="' . $string . '"', $xml)); + } + else + { + $xml = ''; + } + $object = new stdClass; + $object->id = $field; + $object->xml = $xml; + // update the field + $db->updateObject('#__componentbuilder_field', $object, 'id'); + } + } + } + } + } + // do a after all run on admin views that need it + if (ComponentbuilderHelper::checkArray($this->updateAfter['adminview'])) + { + // update the addlinked_views + foreach ($this->updateAfter['adminview'] as $adminview) + { + if (isset($this->newID['admin_view'][$adminview])) + { + $adminview = $this->newID['admin_view'][$adminview]; + } + // get the field from db + if ($addlinked_views = ComponentbuilderHelper::getVar('admin_view', $adminview, 'id', 'addlinked_views')) + { + if (ComponentbuilderHelper::checkJson($addlinked_views)) + { + $addlinked_views = json_decode($addlinked_views, true); + if (ComponentbuilderHelper::checkArray($addlinked_views['adminview'])) + { + foreach ($addlinked_views['adminview'] as $nr => $admin) + { + if (isset($this->newID['admin_view'][$admin])) + { + $addlinked_views['adminview'][$nr] = $this->newID['admin_view'][$admin]; + } + else + { + $addlinked_views['adminview'][$nr] = ''; + $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BLINKED_VIEWB_IDS_MISMATCH_IN_BADMIN_VIEWSB_AND_WAS_EMREMOVEDEM_FROM_THE_LINKED_VIEWS', $admin, $adminview), 'warning'); + } + } + // update the fields + $object = new stdClass; + $object->id = $adminview; + $object->addlinked_views = json_encode($addlinked_views); + // update the admin view + $db->updateObject('#__componentbuilder_admin_view', $object, 'id'); + } + } + } + } + } + } + /** * Prep the item * @@ -822,7 +951,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy **/ protected function prepItem($item, &$type, $action, &$user, &$today) { - $this->updateAfter = false; // actions to effect both if (isset($item->asset_id)) { @@ -841,9 +969,19 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy { case 'field': // update the fieldtype - if (isset($item->fieldtype) && isset($this->newID['fieldtype'][$item->fieldtype])) + if (isset($item->fieldtype) && is_numeric($item->fieldtype) && $item->fieldtype > 0 && isset($this->newID['fieldtype'][$item->fieldtype])) { $item->fieldtype = $this->newID['fieldtype'][$item->fieldtype]; + // update repeatable field values + if ($this->checkRepeatable($item->fieldtype)) + { + $this->updateAfter['field'][$item->id] = $item->id; // repeatable + } + } + elseif (!is_numeric($item->fieldtype) || $item->fieldtype == 0) + { + $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BFIELD_TYPEB_NOT_SET_FOR_BSB', ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'warning'); + unset($item->fieldtype); } else { @@ -853,7 +991,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy break; case 'dynamic_get': // update the view_table_main ID - if (isset($item->main_source) && $item->main_source == 1 && isset($item->view_table_main) && is_numeric($item->view_table_main)) + if (isset($item->main_source) && $item->main_source == 1 && isset($item->view_table_main) && is_numeric($item->view_table_main) && $item->view_table_main > 0) { if (isset($this->newID['admin_view'][$item->view_table_main])) { @@ -897,33 +1035,60 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy case 'layout': case 'template': // update the dynamic_get - if (isset($item->dynamic_get) && isset($this->newID['dynamic_get'][$item->dynamic_get])) + if (isset($item->dynamic_get) && is_numeric($item->dynamic_get) && $item->dynamic_get > 0 && isset($this->newID['dynamic_get'][$item->dynamic_get])) { $item->dynamic_get = $this->newID['dynamic_get'][$item->dynamic_get]; } + elseif (!is_numeric($item->dynamic_get) || $item->dynamic_get == 0) + { + unset($item->dynamic_get); + } else { $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BDYNAMIC_GETB_IDS_MISMATCH_IN_BSB', $item->dynamic_get, ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'warning'); unset($item->dynamic_get); } + // update the snippet + if (isset($item->snippet) && is_numeric($item->snippet) && $item->snippet > 0 && isset($this->newID['snippet'][$item->snippet])) + { + $item->snippet = $this->newID['snippet'][$item->snippet]; + } + elseif (!is_numeric($item->snippet) || $item->snippet == 0) + { + unset($item->snippet); + } + else + { + // $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSNIPPETB_IDS_MISMATCH_IN_BSB', $item->snippet, ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'warning'); + // unset($item->snippet); + } break; case 'custom_admin_view': case 'site_view': // update the main_get - if (isset($item->main_get) && isset($this->newID['dynamic_get'][$item->main_get])) + if (isset($item->main_get) && is_numeric($item->main_get) && $item->main_get > 0 && isset($this->newID['dynamic_get'][$item->main_get])) { $item->main_get = $this->newID['dynamic_get'][$item->main_get]; } + elseif (!is_numeric($item->main_get) || $item->main_get == 0) + { + $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BMAIN_GETB_NOT_SET_FOR_BSB', ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'warning'); + unset($item->main_get); + } else { $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BMAIN_GETB_IDS_MISMATCH_IN_BSB', $item->main_get, ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'error'); return false; } // update the dynamic_get - if (isset($item->dynamic_get) && isset($this->newID['dynamic_get'][$item->dynamic_get])) + if (isset($item->dynamic_get) && is_numeric($item->dynamic_get) && $item->dynamic_get > 0 && isset($this->newID['dynamic_get'][$item->dynamic_get])) { $item->dynamic_get = $this->newID['dynamic_get'][$item->dynamic_get]; } + elseif (!is_numeric($item->dynamic_get) || $item->dynamic_get == 0) + { + unset($item->dynamic_get); + } else { $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BDYNAMIC_GETB_IDS_MISMATCH_IN_BSB', $item->dynamic_get, ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'warning'); @@ -946,14 +1111,14 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy } else { - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BCUSTOM_GET_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BDYNAMIC_GETB_SO_THE_IDS_WAS_REMOVED', '('.ComponentbuilderHelper::safeString($type, 'w').':'.$item->id.')', $id), 'warning'); + $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BCUSTOM_GET_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BDYNAMIC_GETB_SO_THE_IDS_WAS_REMOVED', '('.ComponentbuilderHelper::safeString($type, 'w').':'.$item->id.')', $get), 'warning'); unset($custom_get[$nr]); } } // load it back if there is any remaining if (ComponentbuilderHelper::checkArray($custom_get)) { - $item->custom_get = json_encode($custom_get); + $item->custom_get = json_encode( (object) $custom_get); } else { @@ -964,6 +1129,20 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy { unset($item->custom_get); } + // update the snippet + if (isset($item->snippet) && is_numeric($item->snippet) && $item->snippet > 0 && isset($this->newID['snippet'][$item->snippet])) + { + $item->snippet = $this->newID['snippet'][$item->snippet]; + } + elseif (!is_numeric($item->snippet) || $item->snippet == 0) + { + unset($item->snippet); + } + else + { + // $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSNIPPETB_IDS_MISMATCH_IN_BSB', $item->snippet, ComponentbuilderHelper::safeString($type, 'w').':'.$item->id), 'warning'); + // unset($item->snippet); + } break; case 'admin_view': // we must clear the demo content (since it was not moved as far as we know) TODO @@ -1001,23 +1180,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy // update the addlinked_views if (isset($item->addlinked_views) && ComponentbuilderHelper::checkJson($item->addlinked_views)) { - $addlinked_views = json_decode($item->addlinked_views, true); - foreach ($addlinked_views['adminview'] as $nr => $id) - { - // update the addlinked_views - if (isset($this->newID['admin_view'][$id])) - { - $addlinked_views['adminview'][$nr] = $this->newID['admin_view'][$id]; - } - else - { - // this is painful but true... - $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BLINKED_ADMIN_VIEW_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BADMIN_VIEWB_SO_THE_IDS_WAS_NOT_UPDATED', '('.ComponentbuilderHelper::safeString($type, 'w').':'.$item->id.')', $id), 'warning'); - $this->updateAfter = true; - } - } - // load it back - $item->addlinked_views = json_encode($addlinked_views); + $this->updateAfter['adminview'][$item->id] = $item->id; // addlinked_views } else { @@ -1037,6 +1200,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy { $ids = array((int) $ids); } + // the bucket to load the items back + $bucket = array(); foreach ($ids as $id) { if (!is_numeric($id)) @@ -1045,14 +1210,22 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy } if (isset($this->newID['field'][$id])) { - $addconditions[$target][$nr] = $this->newID['field'][$id]; + $bucket[] = $this->newID['field'][$id]; } else { $this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_HAS_ID_MISMATCH_OF_SELECTED_BFIELDB_SO_THE_IDS_WAS_REMOVED', ComponentbuilderHelper::safeString($target, 'Ww') . ' in ('.ComponentbuilderHelper::safeString($type, 'w').':'.$item->id.')', $id), 'warning'); - $addconditions[$target][$nr] = ''; + $bucket[] = ''; } } + if (count($bucket) == 1) + { + $addconditions[$target][$nr] = $bucket[0]; + } + elseif (count($bucket) > 1) + { + $addconditions[$target][$nr] = $bucket; + } } } // load it back @@ -1209,6 +1382,80 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy return false; } + /** + * Check if a field is a repeatable field + * + * @param string $typeID The type ID + * + * @return bool true on success + * + */ + protected function checkRepeatable($typeID) + { + if(isset($this->isRepeatable[$typeID])) + { + return true; + } + elseif (ComponentbuilderHelper::checkArray($this->isRepeatable)) + { + return false; + } + elseif ($type = $this->getFieldType($typeID)) + { + if ('repeatable' === $type) + { + $this->isRepeatable[$typeID] = true; + return true; + } + } + return false; + } + + /** + * Get the field type + * + * @param string $id The field type id + * + * @return string field type + * + */ + protected function getFieldType($id) + { + if (!isset($this->fieldTypes[$id])) + { + $properties = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'properties'); + if (ComponentbuilderHelper::checkJson($properties)) + { + $properties = json_decode($properties, true); + if (isset($properties['name']) && ComponentbuilderHelper::checkArray($properties['name'])) + { + foreach ($properties['name'] as $key => $value) + { + if ('type' === $value) + { + if (isset($properties['example'][$key]) && ComponentbuilderHelper::checkString($properties['example'][$key])) + { + $this->fieldTypes[$id] = $properties['example'][$key]; + break; + } + } + } + } + } + // if not found + if (!isset($this->fieldTypes[$id]) && $name = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'name')) + { + $this->fieldTypes[$id] = ComponentbuilderHelper::safeString($name); + } + } + // return the type + if (isset($this->fieldTypes[$id])) + { + return $this->fieldTypes[$id]; + } + return false; + } + /** * Update the local item * @@ -1380,6 +1627,19 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy // get by code name (since there should only be one) $getter = 'alias'; break; + case 'snippet': + // get by snippet (since there should only be one snippet like that) + if ($retry == 2) + { + $getter = array('name', 'snippet', 'url', 'type', 'heading'); + } + else + { + // get by id name.. + $getter = array('id', 'name', 'snippet', 'url', 'type', 'heading'); + $retryAgain = 2; + } + break; case 'custom_code': // get by code to insure its correctly matched $getter = array('code', 'comment_type', 'target'); diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index 241aaaadf..b70a369cf 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage joomla_component.php diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php index 6dbc5c07c..e98069d68 100644 --- a/admin/models/joomla_components.php +++ b/admin/models/joomla_components.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage joomla_components.php @@ -81,6 +81,8 @@ class ComponentbuilderModelJoomla_components extends JModelList protected $layoutIds = array(); protected $customCodeIds = array(); protected $customCodeM = array(); + protected $fieldTypes = array(); + protected $isRepeatable = array(); /** * Method to build the export package @@ -390,7 +392,7 @@ class ComponentbuilderModelJoomla_components extends JModelList $values = json_decode($values, true); } // make sure we have an array - if (('custom_code' !== $table && 'component' !== $key) && (!ComponentbuilderHelper::checkArray($values) || !isset($values[$key]) || !ComponentbuilderHelper::checkArray($values[$key]))) + if (('custom_code' !== $table && 'component' !== $key && 'custom_get' !== $key) && (!ComponentbuilderHelper::checkArray($values) || !isset($values[$key]) || !ComponentbuilderHelper::checkArray($values[$key]))) { return false; } @@ -409,6 +411,10 @@ class ComponentbuilderModelJoomla_components extends JModelList { $query->where('a.component IN (' . implode(',',$values) . ')'); } + elseif ('custom_get' === $key) + { + $query->where('a.id IN (' . implode(',',$values) . ')'); + } else { $query->where('a.id IN (' . implode(',',$values[$key]) . ')'); @@ -438,6 +444,15 @@ class ComponentbuilderModelJoomla_components extends JModelList { $searchArray = array('php_view','php_jview','php_jview_display','php_document','js_document','css_document','css'); } + // reset the global array + if ('template' === $table) + { + $this->templateIds = array(); + } + elseif ('layout' === $table) + { + $this->layoutIds = array(); + } // start loading the data if (!isset($this->smartExport[$table])) { @@ -445,20 +460,20 @@ class ComponentbuilderModelJoomla_components extends JModelList } foreach ($items as $nr => &$item) { + // set the data per id only once if (isset($this->smartExport[$table][$item->id])) { continue; } + // load to global object + $this->smartExport[$table][$item->id] = $item; + // set the custom code ID's + $this->setCustomCodeIds($item, $table); // actions to take if table is admin_view if ('admin_view' === $table) { // add fields $this->setData($user, $db, 'field', $item->addfields, 'field'); - // add admin views - if (isset($item->addlinked_views)) - { - // $this->setData($user, $db, 'admin_view', $item->addlinked_views, 'adminview'); TODO infinite loop error - } // admin icon $this->moveIt(array('image' => array($item->icon)), 'image'); // admin icon_add @@ -471,6 +486,27 @@ class ComponentbuilderModelJoomla_components extends JModelList { // add field types $this->setData($user, $db, 'fieldtype', array('fieldtype' => array($item->fieldtype)), 'fieldtype'); + // we must add a repeatable field subfields + if ($this->checkRepeatable($item->fieldtype)) + { + $fields = ComponentbuilderHelper::getBetween(json_decode($item->xml), 'fields="', '"'); + $fieldsSets = array(); + if (strpos($fields, ',') !== false) + { + // multiple fields + $fieldsSets = (array) explode(',', $fields); + } + elseif (is_numeric($fields)) + { + // single field + $fieldsSets[] = (int) $fields; + } + // get fields + if (ComponentbuilderHelper::checkArray($fieldsSets)) + { + $this->setData($user, $db, 'field', array('field' => $fieldsSets), 'field'); + } + } } // actions to take if table is site_view and custom_admin_view if ('site_view' === $table || 'custom_admin_view' === $table) @@ -480,29 +516,116 @@ class ComponentbuilderModelJoomla_components extends JModelList // add search array templates and layouts foreach ($searchArray as $scripter) { - if (isset($view->{'add_'.$scripter}) && $view->{'add_'.$scripter} == 1) + if (isset($item->{'add_'.$scripter}) && $item->{'add_'.$scripter} == 1) { - $this->getTemplateLayout($view->$scripter, $db); + $this->getTemplateLayout($item->$scripter, $db); } } // add dynamic gets $this->setData($user, $db, 'dynamic_get', array('dynamic_get' => array($item->main_get)), 'dynamic_get'); - $this->setData($user, $db, 'dynamic_get', array('dynamic_get' => $item->custom_get), 'dynamic_get'); + $this->setData($user, $db, 'dynamic_get', $item->custom_get, 'custom_get'); if ('custom_admin_view' === $table && isset($item->icon)) { // view icon $this->moveIt(array('image' => array($item->icon)), 'image'); } + // add snippets + $this->setData($user, $db, 'snippet', array('snippet' => array($item->snippet)), 'snippet'); + } + // actions to take if table is template and layout + if ('layout' === $table || 'template' === $table) + { + // search for templates & layouts + $this->getTemplateLayout(base64_decode($item->$table), $db, $user); + // add search array templates and layouts + if (isset($item->add_php_view) && $item->add_php_view == 1) + { + $this->getTemplateLayout($item->php_view, $db, $user); + } + // add dynamic gets + $this->setData($user, $db, 'dynamic_get', array('dynamic_get' => $item->dynamic_get), 'dynamic_get'); + // add snippets + $this->setData($user, $db, 'snippet', array('snippet' => array($item->snippet)), 'snippet'); } - // set the custom code ID's - $this->setCustomCodeIds($item, $table); - // load to global object - $this->smartExport[$table][$item->id] = $item; } } } } + /** + * Check if a field is a repeatable field + * + * @param string $typeID The type ID + * + * @return bool true on success + * + */ + protected function checkRepeatable($typeID) + { + if(isset($this->isRepeatable[$typeID])) + { + return true; + } + elseif (ComponentbuilderHelper::checkArray($this->isRepeatable)) + { + return false; + } + elseif ($type = $this->getFieldType($typeID)) + { + if ('repeatable' === $type) + { + $this->isRepeatable[$typeID] = true; + return true; + } + } + return false; + } + + /** + * Get the field type + * + * @param string $id The field type id + * + * @return string field type + * + */ + protected function getFieldType($id) + { + if (!isset($this->fieldTypes[$id])) + { + $properties = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'properties'); + if (ComponentbuilderHelper::checkJson($properties)) + { + $properties = json_decode($properties, true); + if (isset($properties['name']) && ComponentbuilderHelper::checkArray($properties['name'])) + { + foreach ($properties['name'] as $key => $value) + { + if ('type' === $value) + { + if (isset($properties['example'][$key]) && ComponentbuilderHelper::checkString($properties['example'][$key])) + { + $this->fieldTypes[$id] = $properties['example'][$key]; + break; + } + } + } + } + } + // if not found + if (!isset($this->fieldTypes[$id]) && $name = ComponentbuilderHelper::getVar('fieldtype', $id, 'id', 'name')) + { + $this->fieldTypes[$id] = ComponentbuilderHelper::safeString($name); + } + } + // return the type + if (isset($this->fieldTypes[$id])) + { + return $this->fieldTypes[$id]; + } + return false; + } + /** * Set Template and Layout Data * @@ -511,7 +634,7 @@ class ComponentbuilderModelJoomla_components extends JModelList * @return void * */ - protected function getTemplateLayout($default, &$db) + protected function getTemplateLayout($default, &$db, $user = false) { // set the Template data $temp1 = ComponentbuilderHelper::getAllBetween($default, "\$this->loadTemplate('","')"); @@ -592,6 +715,20 @@ class ComponentbuilderModelJoomla_components extends JModelList $this->getTemplateLayout($get, $db); } } + // Set the Data + if ($user) + { + // add templates + if (ComponentbuilderHelper::checkArray($this->templateIds)) + { + $this->setData($user, $db, 'template', array('template' => $this->templateIds), 'template'); + } + // add layouts + if (ComponentbuilderHelper::checkArray($this->layoutIds)) + { + $this->setData($user, $db, 'layout', array('layout' => $this->layoutIds), 'layout'); + } + } } /** diff --git a/admin/tables/admin_view.php b/admin/tables/admin_view.php index 4c26cc467..53ea6be9a 100644 --- a/admin/tables/admin_view.php +++ b/admin/tables/admin_view.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage admin_view.php diff --git a/admin/tables/joomla_component.php b/admin/tables/joomla_component.php index d7c4571f0..16caa3f29 100644 --- a/admin/tables/joomla_component.php +++ b/admin/tables/joomla_component.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage joomla_component.php diff --git a/admin/views/admin_view/submitbutton.js b/admin/views/admin_view/submitbutton.js index 1320c082a..5859903fd 100644 --- a/admin/views/admin_view/submitbutton.js +++ b/admin/views/admin_view/submitbutton.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage submitbutton.js diff --git a/admin/views/admin_view/tmpl/edit.php b/admin/views/admin_view/tmpl/edit.php index f46c98d14..770bd018f 100644 --- a/admin/views/admin_view/tmpl/edit.php +++ b/admin/views/admin_view/tmpl/edit.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage edit.php diff --git a/admin/views/admin_view/view.html.php b/admin/views/admin_view/view.html.php index 51cdace95..d63d663c6 100644 --- a/admin/views/admin_view/view.html.php +++ b/admin/views/admin_view/view.html.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage view.html.php diff --git a/admin/views/admin_views/tmpl/default.php b/admin/views/admin_views/tmpl/default.php index aac226abb..0c9a1f3eb 100644 --- a/admin/views/admin_views/tmpl/default.php +++ b/admin/views/admin_views/tmpl/default.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage default.php diff --git a/admin/views/admin_views/tmpl/default_batch_body.php b/admin/views/admin_views/tmpl/default_batch_body.php index 396a8a65d..fa6e26239 100644 --- a/admin/views/admin_views/tmpl/default_batch_body.php +++ b/admin/views/admin_views/tmpl/default_batch_body.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage default_batch_body.php diff --git a/admin/views/admin_views/tmpl/default_batch_footer.php b/admin/views/admin_views/tmpl/default_batch_footer.php index 1060dfe74..fb8844fe4 100644 --- a/admin/views/admin_views/tmpl/default_batch_footer.php +++ b/admin/views/admin_views/tmpl/default_batch_footer.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage default_batch_footer.php diff --git a/admin/views/admin_views/tmpl/default_body.php b/admin/views/admin_views/tmpl/default_body.php index a6ee9650a..0e2c9f791 100644 --- a/admin/views/admin_views/tmpl/default_body.php +++ b/admin/views/admin_views/tmpl/default_body.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage default_body.php diff --git a/admin/views/admin_views/tmpl/default_foot.php b/admin/views/admin_views/tmpl/default_foot.php index d8909bd88..5c88c272b 100644 --- a/admin/views/admin_views/tmpl/default_foot.php +++ b/admin/views/admin_views/tmpl/default_foot.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage default_foot.php diff --git a/admin/views/admin_views/tmpl/default_head.php b/admin/views/admin_views/tmpl/default_head.php index cd3132037..e67774210 100644 --- a/admin/views/admin_views/tmpl/default_head.php +++ b/admin/views/admin_views/tmpl/default_head.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage default_head.php diff --git a/admin/views/admin_views/tmpl/default_toolbar.php b/admin/views/admin_views/tmpl/default_toolbar.php index 1d800771d..32e158aef 100644 --- a/admin/views/admin_views/tmpl/default_toolbar.php +++ b/admin/views/admin_views/tmpl/default_toolbar.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage default_toolbar.php diff --git a/admin/views/admin_views/view.html.php b/admin/views/admin_views/view.html.php index 5a4d7ffe7..6dbe11c74 100644 --- a/admin/views/admin_views/view.html.php +++ b/admin/views/admin_views/view.html.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 108 of this MVC - @build 24th March, 2017 + @version @update number 109 of this MVC + @build 31st March, 2017 @created 30th April, 2015 @package Component Builder @subpackage view.html.php diff --git a/admin/views/joomla_component/submitbutton.js b/admin/views/joomla_component/submitbutton.js index fabad5844..71b1b456b 100644 --- a/admin/views/joomla_component/submitbutton.js +++ b/admin/views/joomla_component/submitbutton.js @@ -9,8 +9,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage submitbutton.js diff --git a/admin/views/joomla_component/tmpl/edit.php b/admin/views/joomla_component/tmpl/edit.php index 9096925ce..4bf43a94d 100644 --- a/admin/views/joomla_component/tmpl/edit.php +++ b/admin/views/joomla_component/tmpl/edit.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage edit.php diff --git a/admin/views/joomla_component/view.html.php b/admin/views/joomla_component/view.html.php index 0b66c13a0..1dd8c0376 100644 --- a/admin/views/joomla_component/view.html.php +++ b/admin/views/joomla_component/view.html.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage view.html.php diff --git a/admin/views/joomla_components/tmpl/default.php b/admin/views/joomla_components/tmpl/default.php index 105802290..07393b20c 100644 --- a/admin/views/joomla_components/tmpl/default.php +++ b/admin/views/joomla_components/tmpl/default.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage default.php diff --git a/admin/views/joomla_components/tmpl/default_batch_body.php b/admin/views/joomla_components/tmpl/default_batch_body.php index 5f10312a3..7c2267b37 100644 --- a/admin/views/joomla_components/tmpl/default_batch_body.php +++ b/admin/views/joomla_components/tmpl/default_batch_body.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage default_batch_body.php diff --git a/admin/views/joomla_components/tmpl/default_batch_footer.php b/admin/views/joomla_components/tmpl/default_batch_footer.php index a9001b2ff..bf01cc5de 100644 --- a/admin/views/joomla_components/tmpl/default_batch_footer.php +++ b/admin/views/joomla_components/tmpl/default_batch_footer.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage default_batch_footer.php diff --git a/admin/views/joomla_components/tmpl/default_body.php b/admin/views/joomla_components/tmpl/default_body.php index d06508bb5..4d105c2d3 100644 --- a/admin/views/joomla_components/tmpl/default_body.php +++ b/admin/views/joomla_components/tmpl/default_body.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage default_body.php diff --git a/admin/views/joomla_components/tmpl/default_foot.php b/admin/views/joomla_components/tmpl/default_foot.php index 468b96b9f..c22ac85e2 100644 --- a/admin/views/joomla_components/tmpl/default_foot.php +++ b/admin/views/joomla_components/tmpl/default_foot.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage default_foot.php diff --git a/admin/views/joomla_components/tmpl/default_head.php b/admin/views/joomla_components/tmpl/default_head.php index 0996be333..349e77a04 100644 --- a/admin/views/joomla_components/tmpl/default_head.php +++ b/admin/views/joomla_components/tmpl/default_head.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage default_head.php diff --git a/admin/views/joomla_components/tmpl/default_toolbar.php b/admin/views/joomla_components/tmpl/default_toolbar.php index 8a6b5fe2e..487f08112 100644 --- a/admin/views/joomla_components/tmpl/default_toolbar.php +++ b/admin/views/joomla_components/tmpl/default_toolbar.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage default_toolbar.php diff --git a/admin/views/joomla_components/view.html.php b/admin/views/joomla_components/view.html.php index 6b76f0e20..5c4c1e75e 100644 --- a/admin/views/joomla_components/view.html.php +++ b/admin/views/joomla_components/view.html.php @@ -10,8 +10,8 @@ |_| /-------------------------------------------------------------------------------------------------------------------------------/ - @version @update number 266 of this MVC - @build 30th March, 2017 + @version @update number 297 of this MVC + @build 31st March, 2017 @created 6th May, 2015 @package Component Builder @subpackage view.html.php diff --git a/script.php b/script.php index f43591d9b..7e5605761 100644 --- a/script.php +++ b/script.php @@ -1361,7 +1361,7 @@ class com_componentbuilderInstallerScript $admin_view->type_title = 'Componentbuilder Admin_view'; $admin_view->type_alias = 'com_componentbuilder.admin_view'; $admin_view->table = '{"special": {"dbtable": "#__componentbuilder_admin_view","key": "id","type": "Admin_view","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $admin_view->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_single":"name_single","name_list":"name_list","short_description":"short_description","php_getitems_after_all":"php_getitems_after_all","php_after_publish":"php_after_publish","description":"description","add_fadein":"add_fadein","php_allowedit":"php_allowedit","icon":"icon","source":"source","icon_add":"icon_add","icon_category":"icon_category","php_save":"php_save","php_batchmove":"php_batchmove","php_after_delete":"php_after_delete","php_getitems":"php_getitems","php_getlistquery":"php_getlistquery","php_postsavehook":"php_postsavehook","php_batchcopy":"php_batchcopy","php_before_publish":"php_before_publish","php_before_delete":"php_before_delete","php_import":"php_import","php_document":"php_document","type":"type","sql":"sql","php_getitem":"php_getitem","php_import_display":"php_import_display","not_required":"not_required","php_import_save":"php_import_save","add_css_view":"add_css_view","add_php_getitem":"add_php_getitem","css_view":"css_view","add_php_getitems":"add_php_getitems","add_css_views":"add_css_views","add_php_getitems_after_all":"add_php_getitems_after_all","css_views":"css_views","add_php_getlistquery":"add_php_getlistquery","add_javascript_view_file":"add_javascript_view_file","add_php_save":"add_php_save","javascript_view_file":"javascript_view_file","add_php_postsavehook":"add_php_postsavehook","add_javascript_view_footer":"add_javascript_view_footer","add_php_allowedit":"add_php_allowedit","javascript_view_footer":"javascript_view_footer","add_php_batchcopy":"add_php_batchcopy","add_javascript_views_file":"add_javascript_views_file","add_php_batchmove":"add_php_batchmove","javascript_views_file":"javascript_views_file","add_php_before_publish":"add_php_before_publish","add_javascript_views_footer":"add_javascript_views_footer","add_php_after_publish":"add_php_after_publish","javascript_views_footer":"javascript_views_footer","add_php_before_delete":"add_php_before_delete","add_custom_button":"add_custom_button","add_php_after_delete":"add_php_after_delete","add_php_document":"add_php_document","php_controller":"php_controller","add_sql":"add_sql","php_controller_list":"php_controller_list","php_model":"php_model","php_model_list":"php_model_list","add_custom_import":"add_custom_import","add_php_ajax":"add_php_ajax","html_import_view":"html_import_view","php_ajaxmethod":"php_ajaxmethod","php_import_setdata":"php_import_setdata","php_import_ext":"php_import_ext"}}'; + $admin_view->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_single":"name_single","name_list":"name_list","short_description":"short_description","php_getitems_after_all":"php_getitems_after_all","php_after_publish":"php_after_publish","description":"description","add_fadein":"add_fadein","php_allowedit":"php_allowedit","icon":"icon","source":"source","icon_add":"icon_add","icon_category":"icon_category","php_save":"php_save","php_batchmove":"php_batchmove","php_after_delete":"php_after_delete","php_getitems":"php_getitems","php_getlistquery":"php_getlistquery","php_postsavehook":"php_postsavehook","php_batchcopy":"php_batchcopy","php_before_publish":"php_before_publish","php_before_delete":"php_before_delete","php_import":"php_import","php_document":"php_document","type":"type","sql":"sql","php_getitem":"php_getitem","php_import_display":"php_import_display","not_required":"not_required","php_import_save":"php_import_save","add_css_view":"add_css_view","add_php_getitem":"add_php_getitem","css_view":"css_view","add_php_getitems":"add_php_getitems","add_css_views":"add_css_views","add_php_getitems_after_all":"add_php_getitems_after_all","css_views":"css_views","add_php_getlistquery":"add_php_getlistquery","add_javascript_view_file":"add_javascript_view_file","add_php_save":"add_php_save","javascript_view_file":"javascript_view_file","add_php_postsavehook":"add_php_postsavehook","add_javascript_view_footer":"add_javascript_view_footer","add_php_allowedit":"add_php_allowedit","javascript_view_footer":"javascript_view_footer","add_php_batchcopy":"add_php_batchcopy","add_javascript_views_file":"add_javascript_views_file","add_php_batchmove":"add_php_batchmove","javascript_views_file":"javascript_views_file","add_php_before_publish":"add_php_before_publish","add_javascript_views_footer":"add_javascript_views_footer","add_php_after_publish":"add_php_after_publish","javascript_views_footer":"javascript_views_footer","add_php_before_delete":"add_php_before_delete","add_custom_button":"add_custom_button","add_php_after_delete":"add_php_after_delete","add_php_document":"add_php_document","php_controller":"php_controller","add_sql":"add_sql","php_model":"php_model","php_controller_list":"php_controller_list","php_model_list":"php_model_list","add_custom_import":"add_custom_import","add_php_ajax":"add_php_ajax","html_import_view":"html_import_view","php_ajaxmethod":"php_ajaxmethod","php_import_setdata":"php_import_setdata","php_import_ext":"php_import_ext"}}'; $admin_view->router = 'ComponentbuilderHelperRoute::getAdmin_viewRoute'; $admin_view->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/admin_view.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add_fadein","source","type","not_required","add_css_view","add_php_getitem","add_php_getitems","add_css_views","add_php_getitems_after_all","add_php_getlistquery","add_javascript_view_file","add_php_save","add_php_postsavehook","add_javascript_view_footer","add_php_allowedit","add_php_batchcopy","add_javascript_views_file","add_php_batchmove","add_php_before_publish","add_javascript_views_footer","add_php_after_publish","add_php_before_delete","add_custom_button","add_php_after_delete","add_php_document","add_sql","add_custom_import","add_php_ajax"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; @@ -1574,7 +1574,7 @@ class com_componentbuilderInstallerScript $admin_view->type_title = 'Componentbuilder Admin_view'; $admin_view->type_alias = 'com_componentbuilder.admin_view'; $admin_view->table = '{"special": {"dbtable": "#__componentbuilder_admin_view","key": "id","type": "Admin_view","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $admin_view->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_single":"name_single","name_list":"name_list","short_description":"short_description","php_getitems_after_all":"php_getitems_after_all","php_after_publish":"php_after_publish","description":"description","add_fadein":"add_fadein","php_allowedit":"php_allowedit","icon":"icon","source":"source","icon_add":"icon_add","icon_category":"icon_category","php_save":"php_save","php_batchmove":"php_batchmove","php_after_delete":"php_after_delete","php_getitems":"php_getitems","php_getlistquery":"php_getlistquery","php_postsavehook":"php_postsavehook","php_batchcopy":"php_batchcopy","php_before_publish":"php_before_publish","php_before_delete":"php_before_delete","php_import":"php_import","php_document":"php_document","type":"type","sql":"sql","php_getitem":"php_getitem","php_import_display":"php_import_display","not_required":"not_required","php_import_save":"php_import_save","add_css_view":"add_css_view","add_php_getitem":"add_php_getitem","css_view":"css_view","add_php_getitems":"add_php_getitems","add_css_views":"add_css_views","add_php_getitems_after_all":"add_php_getitems_after_all","css_views":"css_views","add_php_getlistquery":"add_php_getlistquery","add_javascript_view_file":"add_javascript_view_file","add_php_save":"add_php_save","javascript_view_file":"javascript_view_file","add_php_postsavehook":"add_php_postsavehook","add_javascript_view_footer":"add_javascript_view_footer","add_php_allowedit":"add_php_allowedit","javascript_view_footer":"javascript_view_footer","add_php_batchcopy":"add_php_batchcopy","add_javascript_views_file":"add_javascript_views_file","add_php_batchmove":"add_php_batchmove","javascript_views_file":"javascript_views_file","add_php_before_publish":"add_php_before_publish","add_javascript_views_footer":"add_javascript_views_footer","add_php_after_publish":"add_php_after_publish","javascript_views_footer":"javascript_views_footer","add_php_before_delete":"add_php_before_delete","add_custom_button":"add_custom_button","add_php_after_delete":"add_php_after_delete","add_php_document":"add_php_document","php_controller":"php_controller","add_sql":"add_sql","php_controller_list":"php_controller_list","php_model":"php_model","php_model_list":"php_model_list","add_custom_import":"add_custom_import","add_php_ajax":"add_php_ajax","html_import_view":"html_import_view","php_ajaxmethod":"php_ajaxmethod","php_import_setdata":"php_import_setdata","php_import_ext":"php_import_ext"}}'; + $admin_view->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "null","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"system_name":"system_name","name_single":"name_single","name_list":"name_list","short_description":"short_description","php_getitems_after_all":"php_getitems_after_all","php_after_publish":"php_after_publish","description":"description","add_fadein":"add_fadein","php_allowedit":"php_allowedit","icon":"icon","source":"source","icon_add":"icon_add","icon_category":"icon_category","php_save":"php_save","php_batchmove":"php_batchmove","php_after_delete":"php_after_delete","php_getitems":"php_getitems","php_getlistquery":"php_getlistquery","php_postsavehook":"php_postsavehook","php_batchcopy":"php_batchcopy","php_before_publish":"php_before_publish","php_before_delete":"php_before_delete","php_import":"php_import","php_document":"php_document","type":"type","sql":"sql","php_getitem":"php_getitem","php_import_display":"php_import_display","not_required":"not_required","php_import_save":"php_import_save","add_css_view":"add_css_view","add_php_getitem":"add_php_getitem","css_view":"css_view","add_php_getitems":"add_php_getitems","add_css_views":"add_css_views","add_php_getitems_after_all":"add_php_getitems_after_all","css_views":"css_views","add_php_getlistquery":"add_php_getlistquery","add_javascript_view_file":"add_javascript_view_file","add_php_save":"add_php_save","javascript_view_file":"javascript_view_file","add_php_postsavehook":"add_php_postsavehook","add_javascript_view_footer":"add_javascript_view_footer","add_php_allowedit":"add_php_allowedit","javascript_view_footer":"javascript_view_footer","add_php_batchcopy":"add_php_batchcopy","add_javascript_views_file":"add_javascript_views_file","add_php_batchmove":"add_php_batchmove","javascript_views_file":"javascript_views_file","add_php_before_publish":"add_php_before_publish","add_javascript_views_footer":"add_javascript_views_footer","add_php_after_publish":"add_php_after_publish","javascript_views_footer":"javascript_views_footer","add_php_before_delete":"add_php_before_delete","add_custom_button":"add_custom_button","add_php_after_delete":"add_php_after_delete","add_php_document":"add_php_document","php_controller":"php_controller","add_sql":"add_sql","php_model":"php_model","php_controller_list":"php_controller_list","php_model_list":"php_model_list","add_custom_import":"add_custom_import","add_php_ajax":"add_php_ajax","html_import_view":"html_import_view","php_ajaxmethod":"php_ajaxmethod","php_import_setdata":"php_import_setdata","php_import_ext":"php_import_ext"}}'; $admin_view->router = 'ComponentbuilderHelperRoute::getAdmin_viewRoute'; $admin_view->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/admin_view.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add_fadein","source","type","not_required","add_css_view","add_php_getitem","add_php_getitems","add_css_views","add_php_getitems_after_all","add_php_getlistquery","add_javascript_view_file","add_php_save","add_php_postsavehook","add_javascript_view_footer","add_php_allowedit","add_php_batchcopy","add_javascript_views_file","add_php_batchmove","add_php_before_publish","add_javascript_views_footer","add_php_after_publish","add_php_before_delete","add_custom_button","add_php_after_delete","add_php_document","add_sql","add_custom_import","add_php_ajax"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}';