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 BASE=eurecap
PLUGINTYPE=vmextended PLUGINTYPE=vmextended
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
# $(BASE)/ # $(BASE)/
...@@ -57,21 +57,28 @@ class VirtuemartControllerEuRecap extends VmController { ...@@ -57,21 +57,28 @@ class VirtuemartControllerEuRecap extends VmController {
$this->display(); $this->display();
} }
function export($layout='export'){ function display($layout='') {
$viewName = $this->_cname; if (vRequest::getVar('format')=='raw') {
vRequest::setVar('controller', $viewName); // Raw forman means "Export"!!!
vRequest::setVar('view', $viewName); // Ideally, we would use an export task, but unfortunately
vRequest::setVar('layout', $layout); // we cannot both set format=raw and task=export in the export
vRequest::setVar('task', $layout); // button. format=raw MUST be set, because otherwise a HTML
// vRequest::setVar('format', 'raw'); // document is initialized by default!
$layout = 'export';
$document = JFactory::getDocument();
$viewType = $document->getType(); $viewName = $this->_cname;
$view = $this->getView($viewName, $viewType); vRequest::setVar('controller', $viewName);
$view->writeJs = false; vRequest::setVar('view', $viewName);
$view->setLayout($layout); vRequest::setVar('layout', $layout); // Set the layout to export!
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView($viewName, $viewType);
$view->writeJs = false;
$this->display(); return parent::display($layout);
} }
/** /**
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<authorUrl></authorUrl> <authorUrl></authorUrl>
<copyright>Copyright (C) 2015 Reinhold Kainhofer. All rights reserved.</copyright> <copyright>Copyright (C) 2015 Reinhold Kainhofer. All rights reserved.</copyright>
<license> GNU/GPLv3</license> <license> GNU/GPLv3</license>
<version>0.6</version> <version>0.7</version>
<releaseDate>2016-01-01</releaseDate> <releaseDate>2016-01-01</releaseDate>
<releaseType>Update</releaseType> <releaseType>Update</releaseType>
<downloadUrl></downloadUrl> <downloadUrl></downloadUrl>
...@@ -53,7 +53,7 @@ $myCurrencyDisplay = CurrencyDisplay::getInstance(); ...@@ -53,7 +53,7 @@ $myCurrencyDisplay = CurrencyDisplay::getInstance();
</td> </td>
<td align="right" style="vertical-align: top"> <td align="right" style="vertical-align: top">
<div style="float: right"><?php echo $this->export_format_list; ?> <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> </button></div>
</td> </td>
</tr> </tr>
Supports Markdown
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