Fixed gh-678 moved the compilation success message out of the redirection message to a user state message, that get loaded to the page on successful compilation. This preserves the button scripts needed to install the compiled packages.

This commit is contained in:
Llewellyn van der Merwe 2021-03-04 08:13:05 +02:00
parent 934cf839c5
commit 1dfc674318
Signed by untrusted user: Llewellyn
GPG Key ID: EFC0C720A240551C
10 changed files with 86 additions and 26 deletions

View File

@ -143,11 +143,11 @@ 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*: 21st February, 2021 + *Last Build*: 4th March, 2021
+ *Version*: 2.12.7 + *Version*: 2.12.7
+ *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
+ *Line count*: **292151** + *Line count*: **292184**
+ *Field count*: **1629** + *Field count*: **1629**
+ *File count*: **1935** + *File count*: **1935**
+ *Folder count*: **322** + *Folder count*: **322**

View File

@ -143,11 +143,11 @@ 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*: 21st February, 2021 + *Last Build*: 4th March, 2021
+ *Version*: 2.12.7 + *Version*: 2.12.7
+ *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
+ *Line count*: **292151** + *Line count*: **292184**
+ *Field count*: **1629** + *Field count*: **1629**
+ *File count*: **1935** + *File count*: **1935**
+ *Folder count*: **322** + *Folder count*: **322**

View File

@ -255,8 +255,10 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$message[] = '<p><small><b>Remember!</b> This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!</small> </p>'; $message[] = '<p><small><b>Remember!</b> This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!</small> </p>';
} }
$message[] = '<p><small>Compilation took <b>'.$model->compiler->secondsCompiled.'</b> seconds to complete.</small> </p>'; $message[] = '<p><small>Compilation took <b>'.$model->compiler->secondsCompiled.'</b> seconds to complete.</small> </p>';
// pass the message via the user state... wow this is painful
$app->setUserState('com_componentbuilder.success_message', implode(PHP_EOL, $message));
// set redirect // set redirect
$this->setRedirect($redirect_url, implode(PHP_EOL, $message), 'message'); $this->setRedirect($redirect_url, '<h2>Successful Build!</h2>', 'message');
$app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']); $app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']);
// check if we have modules // check if we have modules
if ($add_module_install) if ($add_module_install)
@ -278,6 +280,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.component_folder_name', '');
$app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', '');
$app->setUserState('com_componentbuilder.plugins_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', '');
$app->setUserState('com_componentbuilder.success_message', '');
// set redirect // set redirect
$this->setRedirect($redirect_url, $message); $this->setRedirect($redirect_url, $message);
} }
@ -318,6 +321,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.component_folder_name', '');
$app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', '');
$app->setUserState('com_componentbuilder.plugins_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', '');
$app->setUserState('com_componentbuilder.success_message', '');
// loop and install all extensions found // loop and install all extensions found
foreach ($fileNames as $fileName) foreach ($fileNames as $fileName)
@ -372,6 +376,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.component_folder_name', '');
$app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', '');
$app->setUserState('com_componentbuilder.plugins_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', '');
$app->setUserState('com_componentbuilder.success_message', '');
if ($this->installExtension($fileName)) if ($this->installExtension($fileName))
{ {
@ -409,6 +414,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.component_folder_name', '');
$app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', '');
$app->setUserState('com_componentbuilder.plugins_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', '');
$app->setUserState('com_componentbuilder.success_message', '');
if (ComponentbuilderHelper::checkArray($fileNames)) if (ComponentbuilderHelper::checkArray($fileNames))
{ {
@ -451,6 +457,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$app->setUserState('com_componentbuilder.component_folder_name', ''); $app->setUserState('com_componentbuilder.component_folder_name', '');
$app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.modules_folder_name', '');
$app->setUserState('com_componentbuilder.plugins_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', '');
$app->setUserState('com_componentbuilder.success_message', '');
if (ComponentbuilderHelper::checkArray($fileNames)) if (ComponentbuilderHelper::checkArray($fileNames))
{ {
@ -564,6 +571,14 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
{ {
$message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); $message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB');
$this->setRedirect($redirect_url, $message, 'message'); $this->setRedirect($redirect_url, $message, 'message');
// get application
$app = JFactory::getApplication();
// wipe out the user c-m-p since we are done with them all
$app->setUserState('com_componentbuilder.component_folder_name', '');
$app->setUserState('com_componentbuilder.modules_folder_name', '');
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
$app->setUserState('com_componentbuilder.success_message', '');
return true; return true;
} }
} }

View File

@ -172,6 +172,14 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin
{ {
$message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); $message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB');
$this->setRedirect($redirect_url, $message, 'message'); $this->setRedirect($redirect_url, $message, 'message');
// get application
$app = JFactory::getApplication();
// wipe out the user c-m-p since we are done with them all
$app->setUserState('com_componentbuilder.component_folder_name', '');
$app->setUserState('com_componentbuilder.modules_folder_name', '');
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
$app->setUserState('com_componentbuilder.success_message', '');
return true; return true;
} }
} }

View File

@ -1315,21 +1315,24 @@ class Fields extends Structure
$tab_name = "publishing"; $tab_name = "publishing";
$attributes = array( $attributes = array(
'name' => $field_name, 'name' => $field_name,
'type' => 'hidden', 'type' => 'hidden',
'default' => $component . ' ' . $nameSingleCode 'default' => $component . ' ' . $nameSingleCode
); );
ComponentbuilderHelper::xmlComment( ComponentbuilderHelper::xmlComment(
$fieldSetXML, $fieldSetXML,
$this->setLine(__LINE__) . " Was added due to Permissions JS needing a Title field" $this->setLine(__LINE__)
. " Was added due to Permissions JS needing a Title field"
); );
ComponentbuilderHelper::xmlComment( ComponentbuilderHelper::xmlComment(
$fieldSetXML, $fieldSetXML,
$this->setLine(__LINE__) . " Let us know at gh-629 should this change" $this->setLine(__LINE__)
. " Let us know at gh-629 should this change"
); );
ComponentbuilderHelper::xmlComment( ComponentbuilderHelper::xmlComment(
$fieldSetXML, $fieldSetXML,
$this->setLine(__LINE__) . " https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235" $this->setLine(__LINE__)
. " https://github.com/vdm-io/Joomla-Component-Builder/issues/629#issuecomment-750117235"
); );
$fieldXML = $fieldSetXML->addChild('field'); $fieldXML = $fieldSetXML->addChild('field');
ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes); ComponentbuilderHelper::xmlAddAttributes($fieldXML, $attributes);
@ -1486,6 +1489,7 @@ class Fields extends Structure
{ {
// set the permission for later // set the permission for later
$this->hasPermissions[$nameSingleCode] = true; $this->hasPermissions[$nameSingleCode] = true;
// break out here // break out here
return true; return true;
} }
@ -1508,6 +1512,7 @@ class Fields extends Structure
{ {
// set the permission for later // set the permission for later
$this->hasPermissions[$nameSingleCode] = true; $this->hasPermissions[$nameSingleCode] = true;
// break out here // break out here
return true; return true;
} }
@ -1530,12 +1535,14 @@ class Fields extends Structure
{ {
// set the permission for later // set the permission for later
$this->hasPermissions[$nameSingleCode] = true; $this->hasPermissions[$nameSingleCode] = true;
// break out here // break out here
return true; return true;
} }
} }
} }
} }
return $this->hasPermissions[$nameSingleCode]; return $this->hasPermissions[$nameSingleCode];
} }
@ -4981,7 +4988,8 @@ class Fields extends Structure
// load the category builder - TODO must move all to single view // load the category builder - TODO must move all to single view
$this->categoryBuilder[$nameListCode] = array('code' => $name, $this->categoryBuilder[$nameListCode] = array('code' => $name,
'name' => $listLangName, 'name' => $listLangName,
'extension' => $_extension); 'extension' => $_extension,
'filter' => $field['filter']);
// also set code name for title alias fix // also set code name for title alias fix
$this->catCodeBuilder[$nameSingleCode] = array('code' => $name, $this->catCodeBuilder[$nameSingleCode] = array('code' => $name,
'views' => $otherViews, 'views' => $otherViews,
@ -5800,7 +5808,9 @@ class Fields extends Structure
&& ComponentbuilderHelper::checkArray( && ComponentbuilderHelper::checkArray(
$this->categoryBuilder[$nameListCode] $this->categoryBuilder[$nameListCode]
) )
&& isset($this->categoryBuilder[$nameListCode]['extension'])) && isset($this->categoryBuilder[$nameListCode]['extension'])
&& isset($this->categoryBuilder[$nameListCode]['filter'])
&& $this->categoryBuilder[$nameListCode]['filter'] >= 1)
{ {
$field_filter_sets[] = $this->_t(2) . '<field'; $field_filter_sets[] = $this->_t(2) . '<field';
$field_filter_sets[] = $this->_t(3) . 'type="category"'; $field_filter_sets[] = $this->_t(3) . 'type="category"';

View File

@ -15723,10 +15723,13 @@ class Interpretation extends Fields
{ {
$categoryCodeName = $this->categoryBuilder[$nameListCode]['code']; $categoryCodeName = $this->categoryBuilder[$nameListCode]['code'];
$addCategory = true; $addCategory = true;
$addCategoryFilter
= $this->categoryBuilder[$nameListCode]['filter'];
} }
else else
{ {
$addCategory = false; $addCategory = false;
$addCategoryFilter = 0;
} }
// setup the query // setup the query
$query = "//" . $this->setLine(__LINE__) . " Get the user object."; $query = "//" . $this->setLine(__LINE__) . " Get the user object.";
@ -15842,7 +15845,7 @@ class Interpretation extends Fields
// set other filters // set other filters
$query .= $this->setFilterQuery($nameListCode); $query .= $this->setFilterQuery($nameListCode);
// add the category // add the category
if ($addCategory) if ($addCategory && $addCategoryFilter >= 1)
{ {
$query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine( $query .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(
__LINE__ __LINE__
@ -18653,7 +18656,9 @@ class Interpretation extends Fields
&& ComponentbuilderHelper::checkArray( && ComponentbuilderHelper::checkArray(
$this->categoryBuilder[$nameListCode] $this->categoryBuilder[$nameListCode]
) )
&& isset($this->categoryBuilder[$nameListCode]['extension'])) && isset($this->categoryBuilder[$nameListCode]['extension'])
&& isset($this->categoryBuilder[$nameListCode]['filter'])
&& $this->categoryBuilder[$nameListCode]['filter'] >= 1)
{ {
// set filter // set filter
$filter[] = PHP_EOL . $this->_t(2) . "//" $filter[] = PHP_EOL . $this->_t(2) . "//"
@ -22442,7 +22447,9 @@ class Interpretation extends Fields
&& ComponentbuilderHelper::checkArray( && ComponentbuilderHelper::checkArray(
$this->categoryBuilder[$nameListCode] $this->categoryBuilder[$nameListCode]
) )
&& isset($this->categoryBuilder[$nameListCode]['extension'])) && isset($this->categoryBuilder[$nameListCode]['extension'])
&& isset($this->categoryBuilder[$nameListCode]['filter'])
&& $this->categoryBuilder[$nameListCode]['filter'] >= 1)
{ {
// is found so add it // is found so add it
$add_category = true; $add_category = true;
@ -22466,18 +22473,28 @@ class Interpretation extends Fields
if (isset($filter['multi']) if (isset($filter['multi'])
&& $filter['multi'] == 2) && $filter['multi'] == 2)
{ {
// if this is a category we should make sure it must be added
if (!$add_category && $filter['type'] === 'category')
{
continue;
}
elseif ($add_category && $filter['type'] === 'category')
{
// already added here so no need to add again
$add_category = false;
}
// check if this was an access field
elseif ($filter['type'] === 'accesslevel')
{
// already added here so no need to add again
$add_access_levels = false;
}
// add the header // add the header
$headers[] $headers[]
= 'JHtml::_(\'formbehavior.chosen\', \'.multiple' = 'JHtml::_(\'formbehavior.chosen\', \'.multiple'
. $filter['class'] . $filter['class']
. '\', null, array(\'placeholder_text_multiple\' => \'- \' . JText::_(\'' . '\', null, array(\'placeholder_text_multiple\' => \'- \' . JText::_(\''
. $filter['lang_select'] . '\') . \' -\'));'; . $filter['lang_select'] . '\') . \' -\'));';
// check if this was an access field
if ($filter['type'] === 'accesslevel')
{
// already added here so no need to add again
$add_access_levels = false;
}
} }
elseif ($add_category && $filter['type'] === 'category') elseif ($add_category && $filter['type'] === 'category')
{ {

View File

@ -154,7 +154,7 @@ class ComponentbuilderModelCompiler extends JModelList
$db->setQuery($query); $db->setQuery($query);
// return the result // return the result
return $db->loadObjectList(); return $db->loadObjectList();
} }
public function getCompilerAnimations(&$errorMessage) public function getCompilerAnimations(&$errorMessage)
{ {

View File

@ -50,7 +50,10 @@ Joomla.submitbutton = function(task, key)
} }
// set the task value // set the task value
form.task.value = task; form.task.value = task;
form.submit(); // seems we need a little delay here
setTimeout(function() {
form.submit();
}, 100);
// some ui movements // some ui movements
if (task == 'compiler.compiler'){ if (task == 'compiler.compiler'){
// get the component name // get the component name
@ -124,6 +127,12 @@ jQuery('<div id="compiling"></div>')
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif; ?> <?php endif; ?>
<?php if (ComponentbuilderHelper::checkString($this->SuccessMessage)): ?>
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<?= $this->SuccessMessage; ?>
</div>
<?php endif; ?>
<div id="form"> <div id="form">
<div class="span4"> <div class="span4">
<h3><?= JText::_('COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT') ?></h3> <h3><?= JText::_('COM_COMPONENTBUILDER_READY_TO_COMPILE_A_COMPONENT') ?></h3>

View File

@ -37,6 +37,7 @@ class ComponentbuilderViewCompiler extends JViewLegacy
JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=compiler'); JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=compiler');
$this->sidebar = JHtmlSidebar::render(); $this->sidebar = JHtmlSidebar::render();
} }
$this->SuccessMessage = $this->app->getUserState('com_componentbuilder.success_message', false);
$this->Components = $this->get('Components'); $this->Components = $this->get('Components');
$this->form = $this->setForm(); $this->form = $this->setForm();
// set the compiler artwork from global settings // set the compiler artwork from global settings

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>21st February, 2021</creationDate> <creationDate>4th March, 2021</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>