* adjust code for uploading file when run case.

This commit is contained in:
chenfeiCF
2016-05-04 16:24:09 +08:00
parent c740876991
commit bd145bfe4e
4 changed files with 33 additions and 4 deletions
+3
View File
@@ -4,3 +4,6 @@
.btn-file {float:right; padding: 0px 5px!important}
.fix-border td {border:0px;}
.fix-position td {vertical-align: middle;}
#filesName {float: right;}
.nav > li {margin-right: 5px; display: inline-block; margin-top: 5px;}
+15
View File
@@ -28,3 +28,18 @@ function downloadFile(fileID)
window.open(url, '_blank');
return false;
}
/* Load files name when upload files. */
function loadFilesName()
{
$('#filesName').find('li').remove();//Remove file name in li label before uploading files every time.
$('.fileBox').each(function()
{
fileName = $(this).find('input[type="file"]').val();
if(fileName.lastIndexOf('\\')) fileName = fileName.substring(fileName.lastIndexOf('\\') + 1);//Process the file name.
labelName = $(this).find('input[type="text"]').val();
if(labelName) fileName = labelName;//If label name exits, set label name as file name.
if(fileName) $('#filesName').append("<li>" + fileName + '</li>');//Show file name.
})
}
+8 -4
View File
@@ -36,6 +36,7 @@
<?php
$class = ($result->caseResult == 'pass' ? 'success' : ($result->caseResult == 'fail' ? 'danger' : ($result->caseResult == 'blocked' ? 'warning' : '')));
if($class != 'success') $failCount++;
$fileCount = '(' . count($result->files) . ')';
?>
<tr class='result-item' style='cursor: pointer'>
<td class='w-120px'> &nbsp; #<?php echo $result->id?></td>
@@ -43,7 +44,7 @@
<td><?php echo $users[$result->lastRunner] . ' ' . $lang->testtask->runCase;?></td>
<td class='w-150px'><?php echo zget($builds, $result->build, '');?></td>
<td class='w-50px text-right'><strong class='text-<?php echo $class;?>'><?php echo $lang->testcase->resultList[$result->caseResult]?></strong></td>
<td class='w-40px'><?php if(!empty($result->files)) echo html::a("#caseResult{$result->id}", $lang->files, '', "data-toggle='modal' data-type='iframe'")?></td>
<td class='w-60px'><?php if(!empty($result->files)) echo html::a("#caseResult{$result->id}", $lang->files . $fileCount, '', "data-toggle='modal' data-type='iframe'")?></td>
<td class='w-50px text-center'><i class='collapse-handle icon-chevron-down text-muted'></i></td>
</tr>
<tr class='result-detail hide'>
@@ -56,14 +57,17 @@
<th class='w-p25'><?php echo $lang->testcase->stepExpect;?></th>
<th class='text-center'><?php echo $lang->testcase->result;?></th>
<th class='w-p20'><?php echo $lang->testcase->real;?></th>
<th class='w-50px'></th>
<th class='w-60px'></th>
</tr>
</thead>
<?php
$i = 1;
foreach($result->stepResults as $key => $stepResult):
?>
<?php $modalID = $result->id . '-' . $key;?>
<?php
$modalID = $result->id . '-' . $key;
$fileCount = '(' . count($stepResult['files']) . ')';
?>
<tr>
<td class='w-30px text-center'><?php echo $i;?></td>
<td><?php if(isset($stepResult['desc'])) echo nl2br($stepResult['desc']);?></td>
@@ -71,7 +75,7 @@
<?php if(!empty($stepResult['result'])):?>
<td class='<?php echo $stepResult['result'];?> text-center'><?php echo $lang->testcase->resultList[$stepResult['result']];?></td>
<td><?php echo $stepResult['real'];?></td>
<td class='text-center'><?php if(!empty($stepResult['files'])) echo html::a("#stepResult{$modalID}", $lang->files, '', "data-toggle='modal' data-type='iframe'")?></td>
<td class='text-center'><?php if(!empty($stepResult['files'])) echo html::a("#stepResult{$modalID}", $lang->files . $fileCount, '', "data-toggle='modal' data-type='iframe'")?></td>
</tr>
<?php else:?>
<td></td>
+7
View File
@@ -73,6 +73,7 @@
echo html::hidden('case', $run->case->id);
echo html::hidden('version', $run->case->currentVersion);
?>
<ul id='filesName' class='nav'></ul>
</td>
</tr>
</table>
@@ -89,6 +90,9 @@
<tr>
<td><?php echo $this->fetch('file', 'buildform');?></td>
</tr>
<tr>
<td class='text-center'><button type="button" class="btn btn-default" onclick='loadFilesName()' data-dismiss="modal" aria-hidden="true"><?php echo $lang->save;?></button></td>
<tr>
</table>
</div>
</div>
@@ -108,6 +112,9 @@
<tr>
<td><?php echo $this->fetch('file', 'buildform', array('fileCount' => 1, 'percent' => 0.9, 'filesName' => "files{$step->id}", 'labelsName' => "labels{$step->id}"));?></td>
</tr>
<tr>
<td class='text-center'><button type="button" class="btn btn-default" onclick='loadFilesName()' data-dismiss="modal" aria-hidden="true"><?php echo $lang->save;?></button></td>
<tr>
</table>
</div>
</div>