// button submit added in toolbar for AdminImportController
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
|
||||
<div id="required_column" class="warning warn" style="display:none;">
|
||||
<h3>'.Tools::displayError('Column').' <span id="missing_column"> </span> '.Tools::displayError('must be set').'</h3>
|
||||
<h3>{l s='Column'} <span id="missing_column"> </span> {l s='must be set'}</h3>
|
||||
</div>
|
||||
|
||||
<form action="{$current}&token={$token}" method="post" id="import_form" name="import_form">
|
||||
@@ -72,6 +72,7 @@
|
||||
<input type="hidden" name="multiple_value_separator" value="{$fields_value.multiple_value_separator}">
|
||||
<script type="text/javascript">
|
||||
var current = 0;
|
||||
|
||||
function showTable(nb)
|
||||
{
|
||||
getE('btn_left').disabled = null;
|
||||
@@ -90,6 +91,24 @@
|
||||
current = nb;
|
||||
toggle(getE('table'+current), true);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var btn_save_import = $('span[class~="process-icon-save-import"]').parent();
|
||||
var btn_submit_import = $('#import');
|
||||
|
||||
if (btn_save_import.length > 0 && btn_submit_import.length > 0)
|
||||
{
|
||||
btn_submit_import.hide();
|
||||
btn_save_import.find('span').removeClass('process-icon-save-import');
|
||||
btn_save_import.find('span').addClass('process-icon-save');
|
||||
btn_save_import.click(function() {
|
||||
btn_submit_import.before('<input type="hidden" name="'+btn_submit_import.attr("name")+'" value="1" />');
|
||||
|
||||
$('#import_form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<table>
|
||||
@@ -112,11 +131,6 @@
|
||||
<input id="btn_right" value="{l s='>>'}" type="button" class="button" onclick="showTable(current + 1)" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<input name="import" type="submit" onclick="return (validateImportation(new Array({$res})));" id="import" value="{l s='Import CSV data'}" class="button" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script type="text/javascript">showTable(current);</script>
|
||||
</form>
|
||||
|
||||
@@ -385,14 +385,6 @@ class AdminImportController extends AdminController
|
||||
|
||||
public function initView()
|
||||
{
|
||||
$this->toolbar_fix = false;
|
||||
$this->toolbar_btn = array(
|
||||
'cancel' => array(
|
||||
'href' => self::$currentIndex.'&token='.$this->token,
|
||||
'desc' => $this->l('Cancel')
|
||||
)
|
||||
);
|
||||
|
||||
$this->addJS(_PS_JS_DIR_.'adminImport.js');
|
||||
|
||||
$glue = Tools::getValue('separator', ';');
|
||||
@@ -432,6 +424,30 @@ class AdminImportController extends AdminController
|
||||
return parent::initView();
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
switch ($this->display)
|
||||
{
|
||||
// @todo defining default buttons
|
||||
case 'import':
|
||||
// Default cancel button - like old back link
|
||||
$back = Tools::safeOutput(Tools::getValue('back', ''));
|
||||
if (empty($back))
|
||||
$back = self::$currentIndex.'&token='.$this->token;
|
||||
|
||||
$this->toolbar_btn['cancel'] = array(
|
||||
'href' => $back,
|
||||
'desc' => $this->l('Cancel')
|
||||
);
|
||||
// Default save button - action dynamically handled in javascript
|
||||
$this->toolbar_btn['save-import'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Import CSV data')
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private function generateContentTable($current_table, $nb_column, $handle, $glue)
|
||||
{
|
||||
$html = '<table id="table'.$current_table.'" style="display: none;" class="table" cellspacing="0" cellpadding="0">
|
||||
@@ -1656,7 +1672,7 @@ class AdminImportController extends AdminController
|
||||
$handle = fopen(_PS_ADMIN_DIR_.'/import/'.strval(preg_replace('/\.{2,}/', '.', Tools::getValue('csv'))), 'r');
|
||||
|
||||
if (!$handle)
|
||||
die(Tools::displayError('Cannot read the CSV file'));
|
||||
$this->_errors[] = Tools::displayError('Cannot read the CSV file');
|
||||
|
||||
self::rewindBomAware($handle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user