From a817bae01038f23d2082621fc54d1538a2d8a8af Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 9 Apr 2019 23:54:54 +0200 Subject: [PATCH] Resolved gh-321 by adding the option te set a create menu for admin edit views that are also added to the front-end. --- README.md | 2 +- admin/README.txt | 2 +- admin/compiler/joomla_3/settings.json | 6 +++++ admin/helpers/compiler/a_Get.php | 2 +- admin/helpers/compiler/b_Structure.php | 2 +- admin/helpers/compiler/e_Interpretation.php | 26 +++++++++++++++++++ admin/helpers/compiler/f_Infusion.php | 12 ++++++--- .../en-GB/en-GB.com_componentbuilder.ini | 3 +++ admin/models/forms/component_admin_views.xml | 20 +++++++++----- 9 files changed, 61 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 33d6db07a..abf2f9a31 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ TODO + *Version*: 2.9.15 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **203724** ++ *Line count*: **203733** + *Field count*: **1116** + *File count*: **1338** + *Folder count*: **209** diff --git a/admin/README.txt b/admin/README.txt index 33d6db07a..abf2f9a31 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -150,7 +150,7 @@ TODO + *Version*: 2.9.15 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **203724** ++ *Line count*: **203733** + *Field count*: **1116** + *File count*: **1338** + *Folder count*: **209** diff --git a/admin/compiler/joomla_3/settings.json b/admin/compiler/joomla_3/settings.json index 7a49c9bea..88fbbdfd9 100644 --- a/admin/compiler/joomla_3/settings.json +++ b/admin/compiler/joomla_3/settings.json @@ -600,6 +600,12 @@ "rename": false, "type": "menu" }, + "default.xml": { + "path": "c0mp0n3nt/site/views/VIEW/tmpl", + "rename": "new", + "newName": "edit.xml", + "type": "admin_menu" + }, "module_forms.xml": { "path": "c0mp0n3nt/site/models/forms", "rename": "module_forms", diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 00e62fbbf..50adbd094 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -1162,7 +1162,7 @@ class Get return $value; }, $array); // check if we must add to site - if (isset($array['edit_create_site_view']) && $array['edit_create_site_view']) + if (isset($array['edit_create_site_view']) && is_numeric($array['edit_create_site_view']) && $array['edit_create_site_view'] > 0) { $this->siteEditView[$array['adminview']] = true; $this->lang = 'both'; diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index e66f71548..cff0197e5 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -963,7 +963,7 @@ class Structure extends Get $config = array($this->hhh . 'CREATIONDATE' . $this->hhh => $created, $this->hhh . 'BUILDDATE' . $this->hhh => $modified, $this->hhh . 'VERSION' . $this->hhh => $view['settings']->version); $this->buildDynamique($target, 'single', false, $config); } - if (isset($view['edit_create_site_view']) && $view['edit_create_site_view']) + if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0) { // setup the front site edit-view files $target = array('site' => $view['settings']->name_single); diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 2f5db303a..9d936e133 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -1470,6 +1470,32 @@ class Interpretation extends Fields return ''; } + public function setAdminViewMenu(&$viewName_single, &$view) + { + $xml = ''; + // build the file + $target = array('site' => $viewName_single); + $done = $this->buildDynamique($target, 'admin_menu'); + if ($done) + { + // set the lang + $lang = ComponentbuilderHelper::safeString('com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '_menu_' . $viewName_single, 'U'); + $this->langContent['adminsys'][$lang . '_TITLE'] = 'Create ' . $view['settings']->name_single; + $this->langContent['adminsys'][$lang . '_OPTION'] = 'Create ' . $view['settings']->name_single; + $this->langContent['adminsys'][$lang . '_DESC'] = $view['settings']->short_description; + //start loading xml + $xml = ''; + $xml .= PHP_EOL . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(3) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . ''; + } + return $xml; + } + public function setCustomViewMenu(&$view) { $xml = ''; diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 666461538..af5d955c4 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -248,7 +248,7 @@ class Infusion extends Interpretation $this->setViewPlaceholders($view['settings']); // set site edit view array - if (isset($view['edit_create_site_view']) && $view['edit_create_site_view']) + if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0) { $site_edit_view_array[] = $this->_t(4) . "'" . $viewName_single . "'"; $this->lang = 'both'; @@ -357,9 +357,15 @@ class Infusion extends Interpretation $this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEWCSS' . $this->hhh] = $this->getCustomScriptBuilder('css_view', $viewName_single, '', null, true); // add css to front end - if (isset($view['edit_create_site_view']) && $view['edit_create_site_view']) + if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0) { $this->fileContentDynamic[$viewName_single][$this->hhh . 'SITE_VIEWCSS' . $this->hhh] = $this->fileContentDynamic[$viewName_single][$this->hhh . 'VIEWCSS' . $this->hhh]; + // check if we should add a create menu + if ($view['edit_create_site_view'] == 2) + { + // SITE_MENU_XML <<>> + $this->fileContentDynamic[$viewName_single][$this->hhh . 'SITE_MENU_XML' . $this->hhh] = $this->setAdminViewMenu($viewName_single, $view); + } } } // set the views names @@ -552,7 +558,7 @@ class Infusion extends Interpretation } $this->fileContentStatic[$this->hhh . 'ROUTEHELPER' . $this->hhh] .= $this->setRouterHelp($viewName_single, $viewName_list); - if (isset($view['edit_create_site_view']) && $view['edit_create_site_view']) + if (isset($view['edit_create_site_view']) && is_numeric($view['edit_create_site_view']) && $view['edit_create_site_view'] > 0) { // add needed router stuff for front edit views $this->fileContentStatic[$this->hhh . 'ROUTER_PARSE_SWITCH' . $this->hhh] .= $this->routerParseSwitch($viewName_single, null, false); diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index a578e1c95..deeb39123 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -1846,9 +1846,11 @@ COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Component Upda COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS="Component Admin Views" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ACCESS_DESCRIPTION="Select if this view
should use access." COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ACCESS_LABEL="Add Access" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADD="Add" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS="Addadmin Views" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS_DESCRIPTION="Setup the admin views for this component." COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS_LABEL="Admin Views" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDMENU="Add+Menu" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDRESS="Address" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADMINVIEW="Adminview" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADMINVIEW_DESCRIPTION="Select an admin view" @@ -2012,6 +2014,7 @@ COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEW="A New Component Admin Views" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEW_TAB="New Tab" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEW_TAB_TWO="New Tab 2" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEXT="Next" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NONE="None" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NOTE_ON_ADMIN_VIEWS_DESCRIPTION="Do not add the same view twice it will not work. Please watch this tutorial for more help." COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NOTE_ON_ADMIN_VIEWS_LABEL="Setting Admin Views" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NOTIFICATION="Notification" diff --git a/admin/models/forms/component_admin_views.xml b/admin/models/forms/component_admin_views.xml index 629fb5c22..b64545c1f 100644 --- a/admin/models/forms/component_admin_views.xml +++ b/admin/models/forms/component_admin_views.xml @@ -664,17 +664,23 @@ description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_PORT_DESCRIPTION" class="inputbox" /> - + + class="list_class fieldMedium" + multiple="false" + required="false"> + + + + +