* refactor testcase/import view.

This commit is contained in:
Catouse
2018-05-24 16:51:27 +08:00
parent 9f10cc9733
commit ca065c7685
6 changed files with 66 additions and 48 deletions
+8 -4
View File
@@ -477,10 +477,14 @@ $lang->proVersion = "<a href='http://api.zentao.pm/goto.php?item=proversion&
$lang->downNotify = "Download Desktop Notification";
$lang->website = "http://www.zentao.pm";
$lang->suhosinInfo = "Warning! Data is reaching the limit. Please change <font color=red>sohusin.post.max_vars</font> and <font color=red>sohusin.request.max_vars</font> (set larger %s value) in php.ini, then save and restart Apache or php-fpm, or some data will not be saved.";
$lang->maxVarsInfo = "Warning! Data is reaching the limit. Please change <font color=red>max_input_vars</font> (set larger %s value) in php.ini, then save and restart Apache or php-fpm, or some data will not be saved.";
$lang->pasteTextInfo = "Paste text here. Each line will be the title of each record. ";
$lang->noticeImport = "<p style='font-size:14px'>Imported data contains data that has already existed in system. Please confirm you actions on the date </p><p><a href='javascript:submitForm(\"cover\")' class='btn btn-mini'>Override</a> <a href='javascript:submitForm(\"insert\")' class='btn btn-mini'>New Insertion</a></p>";
$lang->suhosinInfo = "Warning! Data is reaching the limit. Please change <font color=red>sohusin.post.max_vars</font> and <font color=red>sohusin.request.max_vars</font> (set larger %s value) in php.ini, then save and restart Apache or php-fpm, or some data will not be saved.";
$lang->maxVarsInfo = "Warning! Data is reaching the limit. Please change <font color=red>max_input_vars</font> (set larger %s value) in php.ini, then save and restart Apache or php-fpm, or some data will not be saved.";
$lang->pasteTextInfo = "Paste text here. Each line will be the title of each record. ";
$lang->noticeImport = "Imported data contains data that has already existed in system. Please confirm you actions on the date.";
$lang->importConfirm = "Import Confirm";
$lang->importAndCover = "Override";
$lang->importAndInsert = "New Insertion";
$lang->noResultsMatch = "No results match!";
$lang->searchMore = "More results:";
+8 -4
View File
@@ -477,10 +477,14 @@ $lang->proVersion = "<a href='http://api.zentao.net/goto.php?item=proversion&fro
$lang->downNotify = "下载桌面提醒";
$lang->website = "http://www.zentao.net";
$lang->suhosinInfo = "警告:数据太多,请在php.ini中修改<font color=red>sohusin.post.max_vars</font>和<font color=red>sohusin.request.max_vars</font>(大于%s的数)。 保存并重新启动apache或php-fpm,否则会造成部分数据无法保存。";
$lang->maxVarsInfo = "警告:数据太多,请在php.ini中修改<font color=red>max_input_vars</font>(大于%s的数)。 保存并重新启动apache或php-fpm,否则会造成部分数据无法保存。";
$lang->pasteTextInfo = "粘贴文本到文本域中,每行文字作为一条数据的标题。";
$lang->noticeImport = "<p style='font-size:14px'>导入数据中,含有已经存在系统的数据,请确认这些数据要覆盖或者全新插入</p><p><a href='javascript:submitForm(\"cover\")' class='btn btn-mini'>覆盖</a> <a href='javascript:submitForm(\"insert\")' class='btn btn-mini'>全新插入</a></p>";
$lang->suhosinInfo = "警告:数据太多,请在php.ini中修改<font color=red>sohusin.post.max_vars</font>和<font color=red>sohusin.request.max_vars</font>(大于%s的数)。 保存并重新启动apache或php-fpm,否则会造成部分数据无法保存。";
$lang->maxVarsInfo = "警告:数据太多,请在php.ini中修改<font color=red>max_input_vars</font>(大于%s的数)。 保存并重新启动apache或php-fpm,否则会造成部分数据无法保存。";
$lang->pasteTextInfo = "粘贴文本到文本域中,每行文字作为一条数据的标题。";
$lang->noticeImport = "导入数据中,含有已经存在系统的数据,请确认这些数据要覆盖或者全新插入。";
$lang->importConfirm = "导入确认";
$lang->importAndCover = "覆盖";
$lang->importAndInsert = "全新插入";
$lang->noResultsMatch = "没有匹配结果";
$lang->searchMore = "搜索此关键字的更多结果:";
+16 -13
View File
@@ -1,28 +1,31 @@
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade" id="importNoticeModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog w-600px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<button type="button" class="close" data-dismiss="modal"><i class="icon icon-close"></i></button>
<h4 class="modal-title"><?php echo $lang->importConfirm;?></h4>
</div>
<div class="modal-body">
<?php echo html::hidden('insert', '');?>
<div class='alert alert-info'><?php echo $lang->noticeImport;?></div>
<div class='alert with-icon'>
<i class="icon icon-exclamation-sign"></i>
<div class="content">
<?php echo $lang->noticeImport;?>
</div>
</div>
<div class="text-center form-actions">
<a href='javascript:submitForm(\"cover\")' class='btn btn-danger btn-wide'><?php echo $lang->importAndCover;?></a>
<a href='javascript:submitForm(\"insert\")' class='btn btn-primary btn-wide'><?php echo $lang->importAndInsert;?></a>
<button class="btn btn-wide" type="button" data-dismiss="modal"><?php echo $lang->goback;?></button>
</div>
</div>
</div>
</div>
</div>
<script>
$(function(){$("button[data-toggle='myModal']").click(function(){$('#myModal').modal('show')})});
function submitForm(type)
{
if(type == 'insert')
{
$('#insert').val('1');
}
else
{
$('#insert').val('0');
}
$("button[data-toggle='myModal']").closest('form').submit();
$('#insert').val(type == 'insert' ? 1 : 0);
$("button[data-target='#importNoticeModal']").closest('form').submit();
}
</script>
+23 -19
View File
@@ -1,22 +1,26 @@
<?php include '../../common/view/header.lite.html.php';?>
<div class='main-content'>
<div class='main-header'>
<h2><?php echo $lang->testcase->importFile;?></h2>
<main>
<div class="container">
<div id="mainContent" class='main-content'>
<div class='main-header'>
<h2><?php echo $lang->testcase->importFile;?></h2>
</div>
<form method='post' enctype='multipart/form-data' target='hiddenwin' style="padding: 20px 0 15px">
<table class='table table-form w-p100'>
<tr>
<td align='center'>
<input type='file' name='file' class='form-control'/>
</td>
<td class="w-150px">
<?php echo html::select('encode', $config->charsets[$this->cookie->lang], 'utf-8', "class='form-control'");?>
</td>
<td class="w-150px">
<?php echo html::submitButton('', '', 'btn btn-primary btn-block');?>
</td>
</tr>
</table>
</form>
</div>
</div>
<form method='post' enctype='multipart/form-data' target='hiddenwin' style="padding:30px">
<table class='table table-form w-p100'>
<tr>
<td align='center'>
<input type='file' name='file' class='form-control'/>
</td>
<td>
<?php echo html::select('encode', $config->charsets[$this->cookie->lang], 'utf-8', "class='form-control'");?>
</td>
<td>
<?php echo html::submitButton('', '', 'btn btn-primary btn-wide');?>
</td>
</tr>
</table>
</form>
</div>
</main>
<?php include '../../common/view/footer.lite.html.php';?>
+8 -5
View File
@@ -6,8 +6,11 @@
<div class='alert alert-info'><?php echo $suhosinInfo?></div>
<?php else:?>
<div id="mainContent" class="main-content">
<div class="main-header clearfix">
<h2><?php echo $lang->testcase->import;?></h2>
</div>
<form target='hiddenwin' method='post'>
<table class='table table-fixed active-disabled table-custom' id='showData'>
<table class='table table-form' id='showData'>
<thead>
<tr>
<th class='w-50px'><?php echo $lang->lineNumber?></th>
@@ -86,12 +89,11 @@
</tbody>
<tfoot>
<tr>
<td colspan='<?php echo !empty($branches) ? 12 : 11;?>' class='text-center'>
<td colspan='<?php echo !empty($branches) ? 12 : 11;?>' class='text-center form-actions'>
<?php
if(!$insert)
{
include '../../common/view/noticeimport.html.php';
echo "<button type='button' data-toggle='myModal' class='btn btn-primary btn-wide'>{$lang->save}</button>";
echo "<button type='button' data-toggle='modal' data-target='#importNoticeModal' class='btn btn-primary btn-wide'>{$lang->save}</button>";
}
else
{
@@ -103,11 +105,11 @@
</tr>
</tfoot>
</table>
<?php if(!$insert) include '../../common/view/noticeimport.html.php';?>
</form>
</div>
<?php endif;?>
<script>
$(function(){affix('#showData thead')})
function affix(obj)
{
var fixH = $(obj).offset().top;
@@ -129,5 +131,6 @@ function affix(obj)
}
});
}
$(function(){affix('#showData thead')});
</script>
<?php include '../../common/view/footer.html.php';?>
+3 -3
View File
@@ -78,12 +78,11 @@
<?php
if(!$insert)
{
include '../../common/view/noticeimport.html.php';
echo "<button type='button' data-toggle='myModal' class='btn btn-primary btn-wide'>{$lang->save}</button>";
echo "<button type='button' data-toggle='modal' data-target='#importNoticeModal' class='btn btn-primary btn-wide'>{$lang->save}</button>";
}
else
{
echo html::submitButton('', '', 'btn btn-primary btn-wide');
echo html::submitButton('', '', 'btn btn-primary btn-wide');
}
echo ' &nbsp; ' . html::backButton('', '', 'btn btn-wide')
?>
@@ -91,6 +90,7 @@
</tr>
</tfoot>
</table>
<?php if(!$insert) include '../../common/view/noticeimport.html.php';?>
</form>
</div>
<?php endif;?>