rundeploycase.html.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php include $app->getModuleRoot() . 'common/view/header.lite.html.php';?>
  2. <?php include $app->getModuleRoot() . 'common/view/form.html.php';?>
  3. <?php js::set('caseResultSave', $lang->save);?>
  4. <div id='mainContent' class='main-content'>
  5. <div class='main-header'>
  6. <h2>
  7. <span class='label label-id'><?php echo $run->case->id;?></span>
  8. <?php echo $run->case->title;?>
  9. <small class='text-muted'> <?php echo $lang->testtask->runCase;?></small>
  10. </h2>
  11. </div>
  12. <div class='main'>
  13. <form method='post' enctype='multipart/form-data' id='dataform' data-type='ajax'>
  14. <table class='table table-bordered' style='word-break:break-all' id='steps'>
  15. <thead>
  16. <tr>
  17. <td colspan='5' style='word-break: break-all;'><strong><?php echo $lang->testcase->precondition;?></strong> <?php echo $run->case->precondition;?></td>
  18. </tr>
  19. <tr>
  20. <th class='w-50px'><?php echo $lang->testcase->stepID;?></th>
  21. <th class='w-p30'><?php echo $lang->testcase->stepDesc;?></th>
  22. <th class='w-p30'><?php echo $lang->testcase->stepExpect;?></th>
  23. <th class='w-100px'><?php echo $lang->testcase->result;?></th>
  24. <th><?php echo $lang->testcase->real;?></th>
  25. </tr>
  26. </thead>
  27. <?php
  28. if(empty($run->case->steps))
  29. {
  30. $step = new stdclass();
  31. $step->id = 0;
  32. $step->parent = 0;
  33. $step->case = $run->case->id;
  34. $step->type = 'step';
  35. $step->desc = '';
  36. $step->expect = '';
  37. $run->case->steps[] = $step;
  38. }
  39. $stepId = $childId = 0;
  40. ?>
  41. <?php foreach($run->case->steps as $key => $step):?>
  42. <?php
  43. $stepClass = "step-{$step->type}";
  44. if($step->type == 'group' or $step->type == 'step')
  45. {
  46. $stepId++;
  47. $childId = 0;
  48. }
  49. ?>
  50. <tr class='step <?php echo $stepClass?>'>
  51. <th class='step-id'><?php echo $stepId;?></th>
  52. <td class='text-left' <?php if($step->type == 'group') echo "colspan='4'"?>>
  53. <div class='input-group'>
  54. <?php if($step->type == 'item') echo "<span class='step-item-id'>{$stepId}.{$childId}</span>";?>
  55. <?php echo nl2br($step->desc);?>
  56. </div>
  57. </td>
  58. <?php if($step->type != 'group'):?>
  59. <td class='text-left'><?php echo nl2br($step->expect);?></td>
  60. <td class='text-center'><?php echo html::select("steps[$step->id]", $lang->testcase->resultList, 'pass', "class='form-control'");?></td>
  61. <td>
  62. <div class='table-row'>
  63. <div class='table-col'><?php echo html::textarea("reals[$step->id]", '', "rows=1 class='form-control autosize'");?></div>
  64. <div class='table-col w-50px'><button type='button' title='<?php echo $lang->testtask->files?>' class='btn' data-toggle='modal' data-target='#fileModal<?php echo $step->id?>'><i class='icon icon-paper-clip'></i></button></div>
  65. </div>
  66. </td>
  67. <?php endif;?>
  68. </tr>
  69. <?php $childId ++;?>
  70. <?php endforeach;?>
  71. <tr>
  72. <td colspan='5' class='text-center form-actions'>
  73. <?php
  74. if($preCase) echo html::a(inlink('runDeployCase', "deployID={$deployID}&caseID={$preCase['caseID']}&version={$preCase['version']}"), $lang->testtask->pre, '', "id='pre' class='btn'");
  75. echo html::submitButton();
  76. if($nextCase) echo html::a(inlink('runDeployCase', "deployID={$deployID}&caseID={$nextCase['caseID']}&version={$nextCase['version']}"), $lang->testtask->next, '', "id='next' class='btn'");
  77. echo html::hidden('deploy', $deployID);
  78. echo html::hidden('case', $run->case->id);
  79. echo html::hidden('version', $run->case->currentVersion);
  80. ?>
  81. <ul id='filesName' class='nav'></ul>
  82. </td>
  83. </tr>
  84. </table>
  85. <?php foreach($run->case->steps as $key => $step):?>
  86. <div class="modal fade" id="fileModal<?php echo $step->id;?>">
  87. <div class="modal-dialog">
  88. <div class="modal-content">
  89. <div class="modal-header">
  90. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  91. <h4 class="modal-title"><?php echo $lang->testtask->files;?></h4>
  92. </div>
  93. <div class="modal-body">
  94. <table class='table table-form'>
  95. <tr>
  96. <td><?php echo $this->fetch('file', 'buildform', array('fileCount' => 1, 'percent' => 0.9, 'filesName' => "files{$step->id}", 'labelsName' => "labels{$step->id}"));?></td>
  97. </tr>
  98. <tr>
  99. <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>
  100. <tr>
  101. </table>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. <?php endforeach;?>
  107. </form>
  108. </div>
  109. <div class='main' id='resultsContainer'>
  110. </div>
  111. </div>
  112. <script>
  113. $(function()
  114. {
  115. $('#resultsContainer').load("<?php echo $this->createLink('testtask', 'deployCaseResults', "deployID={$deployID}&caseID=$caseID&version=$version");?> #casesResults", function()
  116. {
  117. $('.result-item').click(function()
  118. {
  119. var $this = $(this);
  120. $this.toggleClass('show-detail');
  121. var show = $this.hasClass('show-detail');
  122. $this.next('.result-detail').toggleClass('hide', !show);
  123. $this.find('.collapse-handle').toggleClass('icon-chevron-down', !show).toggleClass('icon-chevron-up', show);;
  124. });
  125. $('#casesResults table caption .result-tip').html($('#resultTip').html());
  126. });
  127. $("form[data-type='ajax']").unbind('submit');
  128. $.ajaxForm("form[data-type='ajax']", function(response)
  129. {
  130. if(response.locate)
  131. {
  132. if(response.locate == 'reload' && response.target == 'parent')
  133. {
  134. parent.$.cookie('selfClose', 1);
  135. parent.$.closeModal(null, 'this');
  136. }
  137. else if(response.next)
  138. {
  139. location.href = response.locate;
  140. }
  141. }
  142. });
  143. });
  144. </script>
  145. <?php include $app->getModuleRoot() . 'common/view/footer.lite.html.php';?>