From 44451f1017a0f52d1a5fe3bf39b0b9cb03b585c4 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 14 Apr 2019 22:20:01 +0200 Subject: [PATCH] Fixed the site view menu not being build as a result of new feature that builds edit site view menu. --- README.md | 2 +- admin/README.txt | 2 +- admin/compiler/joomla_3/edit.xml | 1 + admin/compiler/joomla_3/settings.json | 5 ++-- admin/helpers/compiler/b_Structure.php | 11 +++++--- admin/helpers/compiler/e_Interpretation.php | 25 ++++++++++++------- .../en-GB/en-GB.com_componentbuilder.ini | 4 +-- componentbuilder.xml | 2 +- 8 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 admin/compiler/joomla_3/edit.xml diff --git a/README.md b/README.md index abf2f9a31..d1cee05d1 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 9th April, 2019 ++ *Last Build*: 14th April, 2019 + *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 diff --git a/admin/README.txt b/admin/README.txt index abf2f9a31..d1cee05d1 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -146,7 +146,7 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 9th April, 2019 ++ *Last Build*: 14th April, 2019 + *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 diff --git a/admin/compiler/joomla_3/edit.xml b/admin/compiler/joomla_3/edit.xml new file mode 100644 index 000000000..10a8e4742 --- /dev/null +++ b/admin/compiler/joomla_3/edit.xml @@ -0,0 +1 @@ +###SITE_MENU_XML### \ No newline at end of file diff --git a/admin/compiler/joomla_3/settings.json b/admin/compiler/joomla_3/settings.json index 88fbbdfd9..619cf6b0c 100644 --- a/admin/compiler/joomla_3/settings.json +++ b/admin/compiler/joomla_3/settings.json @@ -600,10 +600,9 @@ "rename": false, "type": "menu" }, - "default.xml": { + "edit.xml": { "path": "c0mp0n3nt/site/views/VIEW/tmpl", - "rename": "new", - "newName": "edit.xml", + "rename": false, "type": "admin_menu" }, "module_forms.xml": { diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index cff0197e5..81cd2f8cf 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -1160,8 +1160,12 @@ class Structure extends Get */ public function buildDynamique($target, $type, $fileName = false, $config = false) { + // did we build the files (any number) + $build_status = false; + // check that we have the target values if (ComponentbuilderHelper::checkArray($target)) { + // search the target foreach ($target as $main => $name) { // make sure it is lower case @@ -1169,7 +1173,7 @@ class Structure extends Get // setup the files foreach ($this->joomlaVersionData->move->dynamic->{$main} as $item => $details) { - if ($details->type == $type) + if ($details->type === $type) { // set destination path $path = ''; @@ -1228,12 +1232,13 @@ class Structure extends Get } // store the new files $this->newFiles['dynamic'][$name][] = $newFIle; + // we have build atleast one + $build_status = true; } } } - return true; } - return false; + return $build_status; } /** diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 9d936e133..1d13289b0 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -1473,10 +1473,10 @@ class Interpretation extends Fields public function setAdminViewMenu(&$viewName_single, &$view) { $xml = ''; - // build the file + // build the file target values $target = array('site' => $viewName_single); - $done = $this->buildDynamique($target, 'admin_menu'); - if ($done) + // build the edit.xml file + if ($this->buildDynamique($target, 'admin_menu')) { // set the lang $lang = ComponentbuilderHelper::safeString('com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '_menu_' . $viewName_single, 'U'); @@ -1493,16 +1493,20 @@ class Interpretation extends Fields $xml .= PHP_EOL . $this->_t(1) . ''; $xml .= PHP_EOL . ''; } + else + { + $this->app->enqueueMessage(JText::sprintf('

Site menu for %s was not build.

', $viewName_single), 'Warning'); + } return $xml; } public function setCustomViewMenu(&$view) { $xml = ''; - // build the file + // build the file target values $target = array('site' => $view['settings']->code); - $done = $this->buildDynamique($target, 'menu'); - if ($done) + // build the default.xml file + if ($this->buildDynamique($target, 'menu')) { // set the lang $lang = ComponentbuilderHelper::safeString('com_' . $this->fileContentStatic[$this->hhh . 'component' . $this->hhh] . '_menu_' . $view['settings']->code, 'U'); @@ -1560,6 +1564,10 @@ class Interpretation extends Fields } $xml .= PHP_EOL . ''; } + else + { + $this->app->enqueueMessage(JText::sprintf('

Site menu for %s was not build.

', $view['settings']->code), 'Warning'); + } return $xml; } @@ -1573,10 +1581,9 @@ class Interpretation extends Fields $target = ComponentbuilderHelper::getBetween($field, 'display="', '"'); if (!ComponentbuilderHelper::checkString($target) || $target === 'menu') { - $field = str_replace('display="menu"', '', $field); - // we load fields that have options - if (strpos($field, 'Option Set. -->') !== false && strpos($field, $menuSetter) === false && !ComponentbuilderHelper::checkString($target)) + // we update fields that have options if not only added to menu + if ($target !== 'menu' && strpos($field, 'Option Set. -->') !== false && strpos($field, $menuSetter) === false && !ComponentbuilderHelper::checkString($target)) { // we add the global option $field = str_replace('Option Set. -->', $this->setLine(__LINE__) . ' Global & Option Set. -->' . PHP_EOL . $this->_t(3) . '', $field); diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index deeb39123..53ac9aa4e 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -5212,8 +5212,8 @@ Project duration: **###projectWeekTime### weeks** or **###projectMonthTime### mo * Ethereum: 0x9548144662b47327c954f3e214edb96662d51218 " COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_README_LABEL="Demo README (with all place-holders)" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_DESCRIPTION="During compilation the file will be moved to the FTP folder. You still need to point the above update server url to the xml file on your FTP server for it to work correctly." -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_LABEL="Select the FTP server used for your update server." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_DESCRIPTION="During compilation the file will be moved to the server. You still need to point the above update server url to the xml file location on your server for it to work correctly." +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_FTP_LABEL="Select the server used for your update server." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_OTHER_DESCRIPTION="Not really sure what other options to add.... so let me know. For now this option does not really do anything except adding the link above to your component as an update server. So it really could be called the manual option, since you will need to set the update server your self. You still need to point the above update server url to the manually created xml file for it to work correctly." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_OTHER_LABEL="The Other Options" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_UPDATE_SERVER_NOTE_ZIP_DESCRIPTION="The update server XML file will be added to the zipped package during compilation. You still need to point the above update server url to the xml wherever you have placed the files online." diff --git a/componentbuilder.xml b/componentbuilder.xml index fee0e27e2..6656bcc4a 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 9th April, 2019 + 14th April, 2019 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com