* Code for showimport.

This commit is contained in:
tanghucheng
2022-08-02 09:54:21 +08:00
parent 76a1bf7c50
commit 7898a041bc
4 changed files with 25 additions and 93 deletions
-1
View File
@@ -83,7 +83,6 @@ $(function()
$insert = true;
$addID = 1;
$colspan = 1;
?>
<?php foreach($datas as $key => $object):?>
<tr class='text-top'>
-43
View File
@@ -1,43 +0,0 @@
$("[name^='product']").each(function()
{
var id = $(this).attr('id');
$(this).attr('id', 'product' + id.match(/\d+/));
});
$("[name^='branch']").each(function()
{
var id = $(this).attr('id');
$(this).attr('id', 'branch' + id.match(/\d+/));
});
$("[name^='module']").each(function()
{
var id = $(this).attr('id');
$(this).attr('id', 'module' + id.match(/\d+/));
});
$("[name^='story']").each(function()
{
var id = $(this).attr('id');
var num = id.substring(5);
var productID = $('#product' + num).val();
var branchID = $('#branch' + num).val();
var moduleID = $('#module' + num).val();
var storyID = $("#story" + num).val();
var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num);
$.get(storyLink, function(stories)
{
if(!stories) stories = '<select id="story' + num + '" name="story[' + num + ']" class="form-control"></select>';
$('#story' + num).replaceWith(stories);
$('#story' + num + "_chosen").remove();
$('#story' + num).next('.picker').remove();
$('#story' + num).attr('name', 'story[' + num + ']').chosen();
$('#story' + num).val(storyID).trigger('chosen:updated');
});
});
$(function()
{
if(parseInt($('.c-name').css('width')) < 90) $('.c-name').css('width', '90px');
});
@@ -1,48 +0,0 @@
<?php include '../../common/view/header.lite.html.php';?>
<script>
function setDownloading()
{
if(navigator.userAgent.toLowerCase().indexOf("opera") > -1) return true; // Opera don't support, omit it.
$.cookie('downloading', 0);
time = setInterval("closeWindow()", 300);
return true;
}
function closeWindow()
{
if($.cookie('downloading') == 1)
{
parent.$.closeModal();
$.cookie('downloading', null);
clearInterval(time);
}
}
</script>
<div id='mainContent' class='main-content'>
<div class='main-header'>
<h2><?php echo $lang->testcase->exportTemplate;?></h2>
</div>
<form method='post' target='hiddenwin' onsubmit='setDownloading();' style='padding: 40px 5%'>
<table class='w-p100'>
<tr>
<td>
<div class='input-group'>
<span class='input-group-addon'><?php echo $lang->testcase->num;?></span>
<?php
echo html::input('num', '10', "class='form-control'");
?>
</div>
</td>
<td class='w-100px'>
<?php echo html::select('encode', $config->charsets[$this->cookie->lang], 'utf-8', "class='form-control'");?>
</td>
<td>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
<?php include '../../common/view/footer.lite.html.php';?>
+25 -1
View File
@@ -11,6 +11,8 @@
$suhosinInfo = $datas->suhosinInfo;
$model = $datas->model;
$datas = $datas->datas;
$appendFields = $this->session->appendFields;
$notEmptyRule = $this->session->notEmptyRule;
?>
<style>
form{overflow-x: scroll}
@@ -111,7 +113,10 @@ $(function()
<?php foreach($fields as $field => $value):?>
<?php if($value['control'] == 'select'):?>
<td><?php echo html::select("{$field}[$key]", $value['values'], !empty($object->$field) ? $object->$field : '', "class='form-control chosen'")?></td>
<?php $selected = !empty($object->$field) ? $object->$field : '';$list = array();?>
<?php if(!empty($value['values'][$selected])) $list = array($selected => $value['values'][$selected]);?>
<?php if(!empty($value['values'][$selected]) and isset($value['values'][0])) $list = array_slice($value['values'], 0, 1);?>
<td><?php echo html::select("{$field}[$key]", $list, $selected, "class='form-control picker-select' data-field='{$field}'")?></td>
<?php elseif($value['control'] == 'multiple'):?>
<?php if(!isset($value['values'][''])) $value['values'][''] = '';?>
@@ -214,6 +219,25 @@ $(function()
</div>
<?php endif;?>
<script>
$.ajaxSetup({async: false});
$('#showData').on('mouseenter', '.picker', function(e){
var myPicker = $(this);
var field = myPicker.prev().attr('data-field');
var id = myPicker.prev().attr('id');
var name = myPicker.prev().attr('name');
var index = Number(name.replace(/[^\d]/g, " "));
var value = myPicker.prev().val();
if($('#' + id).attr('isInit')) return;
$.get(createLink('port', 'ajaxGetOptions', 'model=<?php echo $model;?>&field=' + field + '&value=' + value + '&index=' + index), function(data)
{
$('#' + id).parent().html(data);
$('#' + id).picker({chosenMode: true});
$('#' + id).attr('isInit', true);
});
})
$(function()
{
$.fixedTableHead('#showData');