improved the answer for gh-106 to insure the correct form is submitted on compile

This commit is contained in:
Llewellyn van der Merwe 2017-08-05 12:28:24 +01:00
parent 7a902d454a
commit fb7b5027c2
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
7 changed files with 17 additions and 23 deletions

View File

@ -112,7 +112,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.4.9 + *Version*: 2.4.9
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **106286** + *Line count*: **106280**
+ *File count*: **650** + *File count*: **650**
+ *Folder count*: **115** + *Folder count*: **115**

View File

@ -112,7 +112,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.4.9 + *Version*: 2.4.9
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **106286** + *Line count*: **106280**
+ *File count*: **650** + *File count*: **650**
+ *Folder count*: **115** + *Folder count*: **115**

View File

@ -9,7 +9,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 51 of this MVC @version @update number 53 of this MVC
@build 5th August, 2017 @build 5th August, 2017
@created 1st February, 2017 @created 1st February, 2017
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 51 of this MVC @version @update number 53 of this MVC
@build 5th August, 2017 @build 5th August, 2017
@created 1st February, 2017 @created 1st February, 2017
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 51 of this MVC @version @update number 53 of this MVC
@build 5th August, 2017 @build 5th August, 2017
@created 1st February, 2017 @created 1st February, 2017
@package Component Builder @package Component Builder

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 51 of this MVC @version @update number 53 of this MVC
@build 5th August, 2017 @build 5th August, 2017
@created 1st February, 2017 @created 1st February, 2017
@package Component Builder @package Component Builder
@ -37,24 +37,12 @@ JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
?> ?>
<?php if ($this->canDo->get('compiler.access')): ?> <?php if ($this->canDo->get('compiler.access')): ?>
<script type="text/javascript">
Joomla.submitbutton = function(task) {
if (task === 'compiler.back') {
parent.history.back();
return false;
} else {
var form = document.getElementById('adminForm');
form.task.value = task;
form.submit();
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=compiler'); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data"> <form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=compiler'); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
Joomla.submitbutton2 = function(task) Joomla.submitbutton = function(task)
{ {
if (task == ''){ if (task == ''){
return false; return false;
@ -67,9 +55,15 @@ Joomla.submitbutton2 = function(task)
} }
if (isValid){ if (isValid){
jQuery('#form').hide(); jQuery('#form').hide();
var form = document.getElementById('compilerForm'); // get correct form based on task
if (task == 'compiler.compiler') {
var form = document.getElementById('compilerForm');
} else {
var form = document.getElementById('adminForm');
}
form.task.value = task; form.task.value = task;
form.submit(); form.submit();
// some ui movements
if (task == 'compiler.compiler'){ if (task == 'compiler.compiler'){
jQuery('#compiler').show(); jQuery('#compiler').show();
} else if (task == 'compiler.clearTmp'){ } else if (task == 'compiler.clearTmp'){
@ -128,7 +122,7 @@ jQuery(document).ready(function($) {
</div> </div>
<br /> <br />
<div class="clearfix"></div> <div class="clearfix"></div>
<button class="btn btn-small btn-success" onclick="Joomla.submitbutton2('compiler.compiler')"><span class="icon-cog icon-white"></span> <button class="btn btn-small btn-success" onclick="Joomla.submitbutton('compiler.compiler')"><span class="icon-cog icon-white"></span>
<?php echo JText::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT'); ?> <?php echo JText::_('COM_COMPONENTBUILDER_COMPILE_COMPONENT'); ?>
</button> </button>
<input type="hidden" name="version" value="3" /> <input type="hidden" name="version" value="3" />

View File

@ -10,7 +10,7 @@
|_| |_|
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 51 of this MVC @version @update number 53 of this MVC
@build 5th August, 2017 @build 5th August, 2017
@created 1st February, 2017 @created 1st February, 2017
@package Component Builder @package Component Builder