diff --git a/module/port/control.php b/module/port/control.php
index c0e28ee02e..00d927ffb1 100644
--- a/module/port/control.php
+++ b/module/port/control.php
@@ -123,5 +123,25 @@ class port extends control
}
}
+ /**
+ * ajaxGetOptions
+ *
+ * @param string $model
+ * @param string $field
+ * @param string $value
+ * @param string $index
+ * @access public
+ * @return void
+ */
+ public function ajaxGetOptions($model = '', $field = '', $value = '', $index = '')
+ {
+ $this->app->loadConfig($model);
+ $fields = $this->config->$model->templateFields;
+ $fieldList = $this->port->initFieldList($model, $fields, false);
+ if(!isset($fieldList[$field]['values'][''])) $fieldList[$field]['values'][''] = '';
+ $multiple = $fieldList[$field]['control'] == 'multiple' ? 'multiple' : '';
+
+ return print(html::select($field. "[$index]", $fieldList[$field]['values'], $value, "class='form-control picker-select' $multiple"));
+ }
}
diff --git a/module/port/model.php b/module/port/model.php
index 9bb367ab05..60074ba786 100644
--- a/module/port/model.php
+++ b/module/port/model.php
@@ -907,6 +907,37 @@ class portModel extends model
return $fields;
}
+ /**
+ * Get view datas.
+ *
+ * @param string $model
+ * @param string $datas
+ * @param string $title
+ * @param int $pagerID
+ * @param int $maxImport
+ * @access public
+ * @return void
+ */
+ public function getViewDatas($model = '', $datas = '', $title = '', $pagerID = 1, $maxImport = 0, $insert)
+ {
+ $suhosinInfo = $this->checkSuhosinInfo($datas->datas);
+
+ $fields = $this->config->$model->templateFields;
+
+ $datas->title = $title ? $title : $this->lang->port->showImport;
+ $datas->requiredFields = $this->config->$model->create->requiredFields;
+ $datas->allPager = isset($datas->allPager) ? $datas->allPager : 1;
+ $datas->pagerID = $pagerID;
+ $datas->isEndPage = $pagerID >= $datas->allPager;
+ $datas->maxImport = $maxImport;
+ $datas->dataInsert = $insert;
+ $datas->fields = $this->initFieldList($model, $fields, false);
+ $datas->suhosinInfo = $suhosinInfo;
+ $datas->model = $model;
+
+ return $datas;
+ }
+
/**
* Update children datas.
*
@@ -1053,8 +1084,10 @@ class portModel extends model
* @access public
* @return void
*/
- public function saveImportDatas($model, $datas)
+ public function saveImportDatas($model, $datas = '')
{
+ if(empty($datas)) $datas = $this->initPostFields($model);
+
foreach($datas as $key => $data)
{
$subDatas = array();
@@ -1135,4 +1168,41 @@ class portModel extends model
$modelConfig->listFields = isset($modelConfig->listFields) ? $modelConfig->listFields : $portConfig->listFields;
}
+ /**
+ * Read excel and format data .
+ *
+ * @param string $model
+ * @param int $pagerID
+ * @param int $maxImport
+ * @access public
+ * @return void
+ */
+ public function readExcel($model = '', $pagerID = 1, $maxImport = 0)
+ {
+ /* Bulid import paris (field => name) .*/
+ $fields = $this->getImportFields('bug');
+
+ /* Check tmpfile. */
+ $tmpFile = $this->checkTmpFile();
+
+ /* If tmpfile not isset create tmpfile .*/
+ if(!$tmpFile)
+ {
+ $rows = $this->checkRowsFromExcel();
+
+ $bugData = $this->processRows4Fields($rows, $fields);
+
+ $bugData = $this->getNatureDatas('bug', $bugData);
+
+ $this->createTmpFile($bugData);
+ }
+ else
+ {
+ $bugData = $this->getDatasByFile($tmpFile);
+ }
+
+ /* Get page by datas.*/
+ return $this->getPageDatas($bugData, $pagerID, $maxImport);
+ }
+
}
diff --git a/module/port/view/showimport.html.php b/module/port/view/showimport.html.php
index 3d1a174883..cef9feeda1 100644
--- a/module/port/view/showimport.html.php
+++ b/module/port/view/showimport.html.php
@@ -1,18 +1,30 @@
+title;
+ $requiredFields = $datas->requiredFields;
+ $allCount = $datas->allCount;
+ $allPager = $datas->allPager;
+ $pagerID = $datas->pagerID;
+ $isEndPage = $datas->isEndPage;
+ $maxImport = $datas->maxImport;
+ $dataInsert = $datas->dataInsert;
+ $fields = $datas->fields;
+ $suhosinInfo = $datas->suhosinInfo;
+ $model = $datas->model;
+ $datas = $datas->datas;
+?>
getModuleRoot() . 'common/view/header.html.php';?>
-
+
-
task->import;?>
+ port->import;?>
file->importSummary, $allCount, html::input('maxImport', $config->file->maxImport, "style='width:50px'"), ceil($allCount / $config->file->maxImport));?>
import, "id='import'", 'btn btn-primary');?>
@@ -24,49 +36,37 @@ $(function()
{
if(parseInt($('#maxImport').val())) $('#times').html(Math.ceil(parseInt($('#allCount').html()) / parseInt($('#maxImport').val())));
});
-
- $('#import').click(function(){
- $.cookie('maxImport', $('#maxImport').val());
- location.href = "";
+ $('#import').click(function()
+ {
+ $.cookie('maxImport', $('#maxImport').val())
+ window.location.reload();
})
});
+
-
task->import;?>
+ port->import;?>