Adds the option to overide the assignment in item dynamic custom gets.

This commit is contained in:
Llewellyn van der Merwe 2022-01-21 16:41:54 +02:00
parent e5d599d5a5
commit 6a38523843
Signed by untrusted user: Llewellyn
GPG Key ID: EFC0C720A240551C
8 changed files with 42 additions and 27 deletions

View File

@ -143,7 +143,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 15th January, 2022 + *Last Build*: 21st January, 2022
+ *Version*: 2.12.15 + *Version*: 2.12.15
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -143,7 +143,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 15th January, 2022 + *Last Build*: 21st January, 2022
+ *Version*: 2.12.15 + *Version*: 2.12.15
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -3700,17 +3700,8 @@ class Interpretation extends Fields
{ {
$getItem .= $this->setCustomViewGroup($get->group, $code, $tab); $getItem .= $this->setCustomViewGroup($get->group, $code, $tab);
} }
// get ready to get query // db set query data placeholder
$getItem .= PHP_EOL . PHP_EOL . $tab . $this->_t(2) . "//" $getItem .= $this->hhh . "DB_SET_QUERY_DATA" . $this->hhh;
. $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();";
// set after item php // set after item php
if (isset($get->add_php_after_getitem) if (isset($get->add_php_after_getitem)
&& $get->add_php_after_getitem == 1 && $get->add_php_after_getitem == 1
@ -3721,6 +3712,30 @@ class Interpretation extends Fields
$get->php_after_getitem, $this->placeholders $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) $getItem .= PHP_EOL . PHP_EOL . $tab . $this->_t(2)
. "if (empty(\$data))"; . "if (empty(\$data))";
$getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{"; $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "{";
@ -3778,7 +3793,7 @@ class Interpretation extends Fields
. "return false;"; . "return false;";
} }
$getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "}"; $getItem .= PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "}";
// dispatcher placholder // dispatcher placeholder
$getItem .= $this->hhh . "DISPATCHER" . $this->hhh; $getItem .= $this->hhh . "DISPATCHER" . $this->hhh;
if (ComponentbuilderHelper::checkArray($get->main_get)) if (ComponentbuilderHelper::checkArray($get->main_get))
{ {

View File

@ -28,8 +28,8 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields // get the fields
$fields = $displayData->get($fields_tab_layout) ?: array( $fields = $displayData->get($fields_tab_layout) ?: array(
'note_php_dashboard_note', 'note_php_dashboard_note',
'dashboard_tab', 'php_dashboard_methods',
'php_dashboard_methods' 'dashboard_tab'
); );
$hiddenFields = $displayData->get('hidden_fields') ?: array(); $hiddenFields = $displayData->get('hidden_fields') ?: array();

View File

@ -31,8 +31,8 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
'dashboard' => array( 'dashboard' => array(
'fullwidth' => array( 'fullwidth' => array(
'note_php_dashboard_note', 'note_php_dashboard_note',
'dashboard_tab', 'php_dashboard_methods',
'php_dashboard_methods' 'dashboard_tab'
), ),
'above' => array( 'above' => array(
'joomla_component' 'joomla_component'

View File

@ -423,7 +423,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
.append("<h3><a href=\"" + issue.html_url + "\" target=\"_blank\">" + issue.title + "</a></h3>") .append("<h3><a href=\"" + issue.html_url + "\" target=\"_blank\">" + issue.title + "</a></h3>")
.append("<img alt=\"@" + issue.user.login + "\" style=\"vertical-align: baseline;\" src=\"" + issue.user.avatar_url +"&amp;s=60\" width=\"30\" height=\"30\"> ") .append("<img alt=\"@" + issue.user.login + "\" style=\"vertical-align: baseline;\" src=\"" + issue.user.avatar_url +"&amp;s=60\" width=\"30\" height=\"30\"> ")
.append("<em><a href=\"" + issue.user.html_url + "\" target=\"_blank\">" + issue.user.login + "</a> '.JText::_('COM_COMPONENTBUILDER_OPENED_THIS').' <a href=\"" + issue.html_url + "\" target=\"_blank\">'.JText::_('COM_COMPONENTBUILDER_ISSUE').'-" + issue.number + "</a> (" + timeago + ")</em> ") .append("<em><a href=\"" + issue.user.html_url + "\" target=\"_blank\">" + issue.user.login + "</a> '.JText::_('COM_COMPONENTBUILDER_OPENED_THIS').' <a href=\"" + issue.html_url + "\" target=\"_blank\">'.JText::_('COM_COMPONENTBUILDER_ISSUE').'-" + issue.number + "</a> (" + timeago + ")</em> ")
.append(marked(issue.body)) .append(marked.parse(issue.body))
.append("<a href=\"" + issue.html_url + "\" target=\"_blank\"><span class=\'icon-new-tab\'></span>'.JText::_('COM_COMPONENTBUILDER_RESPOND_TO_THIS_ISSUE_ON_GITHUB').'</a>...<hr />"); .append("<a href=\"" + issue.html_url + "\" target=\"_blank\"><span class=\'icon-new-tab\'></span>'.JText::_('COM_COMPONENTBUILDER_RESPOND_TO_THIS_ISSUE_ON_GITHUB').'</a>...<hr />");
}); });
}); });
@ -436,7 +436,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
.append("<h3><a href=\"" + issue.html_url + "\" target=\"_blank\">" + issue.title + "</a></h3>") .append("<h3><a href=\"" + issue.html_url + "\" target=\"_blank\">" + issue.title + "</a></h3>")
.append("<img alt=\"@" + issue.user.login + "\" style=\"vertical-align: baseline;\" src=\"" + issue.user.avatar_url +"&amp;s=60\" width=\"30\" height=\"30\"> ") .append("<img alt=\"@" + issue.user.login + "\" style=\"vertical-align: baseline;\" src=\"" + issue.user.avatar_url +"&amp;s=60\" width=\"30\" height=\"30\"> ")
.append("<em><a href=\"" + issue.user.html_url + "\" target=\"_blank\">" + issue.user.login + "</a> '.JText::_('COM_COMPONENTBUILDER_OPENED').' <a href=\"" + issue.html_url + "\" target=\"_blank\">'.JText::_('COM_COMPONENTBUILDER_ISSUE').'-" + issue.number + "</a> (" + timeago + ")</em>") .append("<em><a href=\"" + issue.user.html_url + "\" target=\"_blank\">" + issue.user.login + "</a> '.JText::_('COM_COMPONENTBUILDER_OPENED').' <a href=\"" + issue.html_url + "\" target=\"_blank\">'.JText::_('COM_COMPONENTBUILDER_ISSUE').'-" + issue.number + "</a> (" + timeago + ")</em>")
.append(marked(issue.body)) .append(marked.parse(issue.body))
.append("<a href=\"" + issue.html_url + "\" target=\"_blank\"><span class=\'icon-new-tab\'></span>'.JText::_('COM_COMPONENTBUILDER_REVIEW_THIS_ISSUE_ON_GITHUB').'</a>...<hr />"); .append("<a href=\"" + issue.html_url + "\" target=\"_blank\"><span class=\'icon-new-tab\'></span>'.JText::_('COM_COMPONENTBUILDER_REVIEW_THIS_ISSUE_ON_GITHUB').'</a>...<hr />");
}); });
}); });
@ -475,7 +475,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
.append(activeNotice) .append(activeNotice)
.append("<img alt=\"@" + tagrelease.author.login + "\" style=\"vertical-align: baseline;\" src=\"" + tagrelease.author.avatar_url +"&amp;s=60\" width=\"30\" height=\"30\"> ") .append("<img alt=\"@" + tagrelease.author.login + "\" style=\"vertical-align: baseline;\" src=\"" + tagrelease.author.avatar_url +"&amp;s=60\" width=\"30\" height=\"30\"> ")
.append("<em><a href=\"" + tagrelease.author.html_url + "\" target=\"_blank\">" + tagrelease.author.login + "</a> '.JText::_('COM_COMPONENTBUILDER_RELEASED_THIS').'<em> <b><span class=\'icon-tag-2\'></span>" + tagrelease.tag_name+ "</b> (" + timeago + ")") .append("<em><a href=\"" + tagrelease.author.html_url + "\" target=\"_blank\">" + tagrelease.author.login + "</a> '.JText::_('COM_COMPONENTBUILDER_RELEASED_THIS').'<em> <b><span class=\'icon-tag-2\'></span>" + tagrelease.tag_name+ "</b> (" + timeago + ")")
.append(marked(tagrelease.body)) .append(marked.parse(tagrelease.body))
.append(" <a class=\"hasTooltip\" href=\"" + tagrelease.assets[0].browser_download_url + "\" title=\"'.JText::_('COM_COMPONENTBUILDER_DOWNLOAD').' " + tagrelease.assets[0].name + "\" target=\"_self\"><span class=\'icon-download\'></span>" + tagrelease.assets[0].name + "</a> (<a class=\"hasTooltip\" href=\"" + tagrelease.assets[0].browser_download_url + "\" title=\"'.JText::_('COM_COMPONENTBUILDER_TOTAL_DOWNLOADS').'\"><small>" + tagrelease.assets[0].download_count + "</small></a>) ") .append(" <a class=\"hasTooltip\" href=\"" + tagrelease.assets[0].browser_download_url + "\" title=\"'.JText::_('COM_COMPONENTBUILDER_DOWNLOAD').' " + tagrelease.assets[0].name + "\" target=\"_self\"><span class=\'icon-download\'></span>" + tagrelease.assets[0].name + "</a> (<a class=\"hasTooltip\" href=\"" + tagrelease.assets[0].browser_download_url + "\" title=\"'.JText::_('COM_COMPONENTBUILDER_TOTAL_DOWNLOADS').'\"><small>" + tagrelease.assets[0].download_count + "</small></a>) ")
.append("| <a href=\"" + tagrelease.html_url + "\" target=\"_blank\" title=\"'.JText::_('COM_COMPONENTBUILDER_OPEN').' " + tagrelease.name + " '.JText::_('COM_COMPONENTBUILDER_ON_GITHUB').'\"><span class=\'icon-new-tab\'></span>'.JText::_('COM_COMPONENTBUILDER_OPEN_ON_GITHUB').'</a>...<hr />"); .append("| <a href=\"" + tagrelease.html_url + "\" target=\"_blank\" title=\"'.JText::_('COM_COMPONENTBUILDER_OPEN').' " + tagrelease.name + " '.JText::_('COM_COMPONENTBUILDER_ON_GITHUB').'\"><span class=\'icon-new-tab\'></span>'.JText::_('COM_COMPONENTBUILDER_OPEN_ON_GITHUB').'</a>...<hr />");
}); });
@ -503,7 +503,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery.get(gewiki) jQuery.get(gewiki)
.success(function(wiki) { .success(function(wiki) {
jQuery("#wiki-md").html(marked(wiki)); jQuery("#wiki-md").html(marked.parse(wiki));
}) })
.error(function(jqXHR, textStatus, errorThrown) { .error(function(jqXHR, textStatus, errorThrown) {
jQuery("#wiki-md").html("'.JText::_('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER').'"); jQuery("#wiki-md").html("'.JText::_('COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER').'");
@ -527,7 +527,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
jQuery.get(noticeboard) jQuery.get(noticeboard)
.success(function(board) { .success(function(board) {
if (board.length > 5) { if (board.length > 5) {
jQuery("#noticeboard-md").html(marked(board)); jQuery("#noticeboard-md").html(marked.parse(board));
getIS(1,board).done(function(result) { getIS(1,board).done(function(result) {
if (result){ if (result){
jQuery("#cpanel_tabTabs a").each(function() { jQuery("#cpanel_tabTabs a").each(function() {
@ -599,7 +599,7 @@ jQuery(document).ready( function($) {
jQuery.get(proboard) jQuery.get(proboard)
.success(function(board) { .success(function(board) {
if (board.length > 5) { if (board.length > 5) {
jQuery("#proboard-md").html(marked(board)); jQuery("#proboard-md").html(marked.parse(board));
} else { } else {
jQuery("#proboard-md").html("'.JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'"); jQuery("#proboard-md").html("'.JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER').'");
} }

View File

@ -310,7 +310,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy
jQuery.get(noticeboard) jQuery.get(noticeboard)
.success(function(board) { .success(function(board) {
if (board.length > 5) { if (board.length > 5) {
jQuery(\".noticeboard-md\").html(marked(board)); jQuery(\".noticeboard-md\").html(marked.parse(board));
getIS(1,board).done(function(result) { getIS(1,board).done(function(result) {
if (result){ if (result){
jQuery(\".vdm-new-notice\").show(); jQuery(\".vdm-new-notice\").show();
@ -327,7 +327,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy
jQuery.get(proboard) jQuery.get(proboard)
.success(function(board) { .success(function(board) {
if (board.length > 5) { if (board.length > 5) {
jQuery(\".proboard-md\").html(marked(board)); jQuery(\".proboard-md\").html(marked.parse(board));
} else { } else {
jQuery(\".proboard-md\").html(all_is_good); jQuery(\".proboard-md\").html(all_is_good);
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade"> <extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>15th January, 2022</creationDate> <creationDate>21st January, 2022</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>