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
PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html
# $(BASE)/
......@@ -57,21 +57,28 @@ class VirtuemartControllerEuRecap extends VmController {
function export($layout='export'){
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);
vRequest::setVar('task', $layout);
// vRequest::setVar('format', 'raw');
vRequest::setVar('layout', $layout); // Set the layout to export!
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView($viewName, $viewType);
$view->writeJs = false;
return parent::display($layout);
......@@ -7,7 +7,7 @@
<copyright>Copyright (C) 2015 Reinhold Kainhofer. All rights reserved.</copyright>
<license> GNU/GPLv3</license>
......@@ -53,7 +53,7 @@ $myCurrencyDisplay = CurrencyDisplay::getInstance();
<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'); ?>
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