From 6a38523843bccd8fccc425ffd81bf44a4107d27d Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 21 Jan 2022 16:41:54 +0200 Subject: [PATCH] Adds the option to overide the assignment in item dynamic custom gets. --- README.md | 2 +- admin/README.txt | 2 +- admin/helpers/compiler/e_Interpretation.php | 39 +++++++++++++------ .../dashboard_fullwidth.php | 4 +- admin/models/component_dashboard.php | 4 +- admin/models/componentbuilder.php | 12 +++--- admin/views/compiler/view.html.php | 4 +- componentbuilder.xml | 2 +- 8 files changed, 42 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 2fd4b4522..8b519c5e9 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,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*: 15th January, 2022 ++ *Last Build*: 21st January, 2022 + *Version*: 2.12.15 + *Copyright*: Copyright (C) 2015 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 2fd4b4522..8b519c5e9 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -143,7 +143,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*: 15th January, 2022 ++ *Last Build*: 21st January, 2022 + *Version*: 2.12.15 + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 515e6b16e..b47180df8 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -3700,17 +3700,8 @@ class Interpretation extends Fields { $getItem .= $this->setCustomViewGroup($get->group, $code, $tab); } - // get ready to get query - $getItem .= PHP_EOL . PHP_EOL . $tab . $this->_t(2) . "//" - . $this->setLine(__LINE__) - . " Reset the query using our newly populated query object."; - $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) - . "\$db->setQuery(\$query);"; - $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" - . $this->setLine(__LINE__) - . " Load the results as a stdClass object."; - $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) - . "\$data = \$db->loadObject();"; + // db set query data placeholder + $getItem .= $this->hhh . "DB_SET_QUERY_DATA" . $this->hhh; // set after item php if (isset($get->add_php_after_getitem) && $get->add_php_after_getitem == 1 @@ -3721,6 +3712,30 @@ class Interpretation extends Fields $get->php_after_getitem, $this->placeholders ); } + // check the getItem string to see if we should still add set query to data + if (strpos($getItem, '$data =') === false) + { + // get ready to get query + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] = + PHP_EOL . PHP_EOL . $tab . $this->_t(2) . "//" + . $this->setLine(__LINE__) + . " Reset the query using our newly populated query object."; + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] .= + PHP_EOL . $this->_t(1) . $tab . $this->_t(1) + . "\$db->setQuery(\$query);"; + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] .= + PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" + . $this->setLine(__LINE__) + . " Load the results as a stdClass object."; + $setQuery[$this->hhh . "DB_SET_QUERY_DATA" . $this->hhh] .= + PHP_EOL . $this->_t(1) . $tab . $this->_t(1) + . "\$data = \$db->loadObject();"; + // add the db set query to data + $getItem = str_replace( + array_keys($setQuery), + array_values($setQuery), $getItem + ); + } $getItem .= PHP_EOL . PHP_EOL . $tab . $this->_t(2) . "if (empty(\$data))"; $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{"; @@ -3778,7 +3793,7 @@ class Interpretation extends Fields . "return false;"; } $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "}"; - // dispatcher placholder + // dispatcher placeholder $getItem .= $this->hhh . "DISPATCHER" . $this->hhh; if (ComponentbuilderHelper::checkArray($get->main_get)) { diff --git a/admin/layouts/component_dashboard/dashboard_fullwidth.php b/admin/layouts/component_dashboard/dashboard_fullwidth.php index 49bfd713b..5a4a6f0c1 100644 --- a/admin/layouts/component_dashboard/dashboard_fullwidth.php +++ b/admin/layouts/component_dashboard/dashboard_fullwidth.php @@ -28,8 +28,8 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( 'note_php_dashboard_note', - 'dashboard_tab', - 'php_dashboard_methods' + 'php_dashboard_methods', + 'dashboard_tab' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/models/component_dashboard.php b/admin/models/component_dashboard.php index d7e2372d8..4ca14076a 100644 --- a/admin/models/component_dashboard.php +++ b/admin/models/component_dashboard.php @@ -31,8 +31,8 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin 'dashboard' => array( 'fullwidth' => array( 'note_php_dashboard_note', - 'dashboard_tab', - 'php_dashboard_methods' + 'php_dashboard_methods', + 'dashboard_tab' ), 'above' => array( 'joomla_component' diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index 25f89450e..5d86c665c 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -423,7 +423,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList .append("

" + issue.title + "

") .append("\"@" ") .append("" + issue.user.login + " '.JText::_('COM_COMPONENTBUILDER_OPENED_THIS').' '.JText::_('COM_COMPONENTBUILDER_ISSUE').'-" + issue.number + " (" + timeago + ") ") - .append(marked(issue.body)) + .append(marked.parse(issue.body)) .append("'.JText::_('COM_COMPONENTBUILDER_RESPOND_TO_THIS_ISSUE_ON_GITHUB').'...
"); }); }); @@ -436,7 +436,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList .append("

" + issue.title + "

") .append("\"@" ") .append("" + issue.user.login + " '.JText::_('COM_COMPONENTBUILDER_OPENED').' '.JText::_('COM_COMPONENTBUILDER_ISSUE').'-" + issue.number + " (" + timeago + ")") - .append(marked(issue.body)) + .append(marked.parse(issue.body)) .append("'.JText::_('COM_COMPONENTBUILDER_REVIEW_THIS_ISSUE_ON_GITHUB').'...
"); }); }); @@ -475,7 +475,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList .append(activeNotice) .append("\"@" ") .append("" + tagrelease.author.login + " '.JText::_('COM_COMPONENTBUILDER_RELEASED_THIS').' " + tagrelease.tag_name+ " (" + timeago + ")") - .append(marked(tagrelease.body)) + .append(marked.parse(tagrelease.body)) .append(" " + tagrelease.assets[0].name + " (" + tagrelease.assets[0].download_count + ") ") .append("| '.JText::_('COM_COMPONENTBUILDER_OPEN_ON_GITHUB').'...
"); }); @@ -503,7 +503,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList jQuery(document).ready(function () { jQuery.get(gewiki) .success(function(wiki) { - jQuery("#wiki-md").html(marked(wiki)); + jQuery("#wiki-md").html(marked.parse(wiki)); }) .error(function(jqXHR, textStatus, errorThrown) { jQuery("#wiki-md").html("'.JText::_('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER').'"); @@ -527,7 +527,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList jQuery.get(noticeboard) .success(function(board) { if (board.length > 5) { - jQuery("#noticeboard-md").html(marked(board)); + jQuery("#noticeboard-md").html(marked.parse(board)); getIS(1,board).done(function(result) { if (result){ jQuery("#cpanel_tabTabs a").each(function() { @@ -599,7 +599,7 @@ jQuery(document).ready( function($) { jQuery.get(proboard) .success(function(board) { if (board.length > 5) { - jQuery("#proboard-md").html(marked(board)); + jQuery("#proboard-md").html(marked.parse(board)); } else { jQuery("#proboard-md").html("'.JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); } diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index db7d52ec6..1712a2639 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -310,7 +310,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy jQuery.get(noticeboard) .success(function(board) { if (board.length > 5) { - jQuery(\".noticeboard-md\").html(marked(board)); + jQuery(\".noticeboard-md\").html(marked.parse(board)); getIS(1,board).done(function(result) { if (result){ jQuery(\".vdm-new-notice\").show(); @@ -327,7 +327,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy jQuery.get(proboard) .success(function(board) { if (board.length > 5) { - jQuery(\".proboard-md\").html(marked(board)); + jQuery(\".proboard-md\").html(marked.parse(board)); } else { jQuery(\".proboard-md\").html(all_is_good); } diff --git a/componentbuilder.xml b/componentbuilder.xml index 01a31a84d..142f1cb3d 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 15th January, 2022 + 21st January, 2022 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com