Commit f323b31b authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

V0.7: Fix export button breaking the form

Rather than trying to submit both format=raw and task=export in the export
button, simply use format=raw only and modify the controller to understand
format=raw as export.

The old way of using JS to set task=export was unable to reset the task and
thus broke all further use of the form controls, because then task=export was
submitted, even though no task was supposed to be used.

Fixes #3
parent ba493e52
BASE=eurecap
PLUGINTYPE=vmextended
VERSION=0.6
VERSION=0.7
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
# $(BASE)/
......
......@@ -57,21 +57,28 @@ class VirtuemartControllerEuRecap extends VmController {
$this->display();
}
function export($layout='export'){
$viewName = $this->_cname;
vRequest::setVar('controller', $viewName);
vRequest::setVar('view', $viewName);
vRequest::setVar('layout', $layout);
vRequest::setVar('task', $layout);
// vRequest::setVar('format', 'raw');
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView($viewName, $viewType);
$view->writeJs = false;
$view->setLayout($layout);
function display($layout='') {
if (vRequest::getVar('format')=='raw') {
// Raw forman means "Export"!!!
// Ideally, we would use an export task, but unfortunately
// we cannot both set format=raw and task=export in the export
// button. format=raw MUST be set, because otherwise a HTML
// document is initialized by default!
$layout = 'export';
$viewName = $this->_cname;
vRequest::setVar('controller', $viewName);
vRequest::setVar('view', $viewName);
vRequest::setVar('layout', $layout); // Set the layout to export!
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView($viewName, $viewType);
$view->writeJs = false;
$view->setLayout($layout);
}
$this->display();
return parent::display($layout);
}
/**
......
......@@ -7,7 +7,7 @@
<authorUrl>http://www.open-tools.net/</authorUrl>
<copyright>Copyright (C) 2015 Reinhold Kainhofer. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3</license>
<version>0.6</version>
<version>0.7</version>
<releaseDate>2016-01-01</releaseDate>
<releaseType>Update</releaseType>
<downloadUrl>http://www.open-tools.net</downloadUrl>
......
......@@ -53,7 +53,7 @@ $myCurrencyDisplay = CurrencyDisplay::getInstance();
</td>
<td align="right" style="vertical-align: top">
<div style="float: right"><?php echo $this->export_format_list; ?>
<button class="btn btn-small" name="format" value="raw" onclick="this.form.task.value='export'; this.form.submit();" style="vertical-align: top;"><?php echo vmText::_('VMEXT_EU_RECAP_EXPORT'); ?>
<button class="btn btn-small" name="format" value="raw" style="vertical-align: top;"><?php echo vmText::_('VMEXT_EU_RECAP_EXPORT'); ?>
</button></div>
</td>
</tr>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment