m.view.html.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <?php
  2. /**
  3. * The view mobile view file of testcase module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Yidong Wang <yidong@cnezsoft.com>
  8. * @package testcase
  9. * @version $Id$
  10. * @link http://www.zentao.net
  11. */
  12. $bodyClass = 'with-nav-bottom';
  13. ?>
  14. <?php include '../../common/view/m.header.html.php';?>
  15. <div id='page' class='list-with-actions'>
  16. <div class='heading'>
  17. <div class='title'>
  18. <span class="prefix"> <strong><?php echo $case->id;?></strong></span>
  19. <strong style='color: <?php echo $case->color; ?>'><?php echo $case->title;?></strong>
  20. <?php if($case->version > 1):?>
  21. <select id='version'>
  22. <?php
  23. for($i = $case->version; $i >= 1; $i --)
  24. {
  25. $class = $i == $version ? " selected" : '';
  26. echo "<option value='$i'$class> #$i</option>";
  27. }
  28. ?>
  29. </select>
  30. <script>
  31. $('#version').change(function()
  32. {
  33. location.href = createLink('testcase', 'view', "caseID=<?php echo $case->id?>&version=" + $(this).val() + "&from=<?php echo $from;?>&taskID=<?php echo $taskID;?>");
  34. });
  35. </script>
  36. <?php endif; ?>
  37. </div>
  38. <nav class='nav'>
  39. <a href='javascript:history.go(-1);' class='btn primary'><?php echo $lang->goback;?></a>
  40. </nav>
  41. </div>
  42. <div class='section no-margin'>
  43. <div class="outline">
  44. <nav class="nav" data-display="" data-selector="a" data-show-single="true" data-active-class="active" data-animate="false">
  45. <a class="active" data-target="#legendView"><?php echo $lang->testcase->view?></a>
  46. <a data-target="#legendBasicInfo"><?php echo $lang->testcase->legendBasicInfo?></a>
  47. </nav>
  48. <div>
  49. <div class="display in" id="legendView">
  50. <div class='heading gray'>
  51. <div class='title'><strong><?php echo $lang->testcase->precondition;?></strong></div>
  52. </div>
  53. <div class='article'><?php echo nl2br($case->precondition); ?></div>
  54. <div class='heading gray'>
  55. <div class='title'><strong><?php echo $lang->testcase->steps;?></strong></div>
  56. </div>
  57. <div class='article'>
  58. <table class='table bordered compact' id='steps'>
  59. <thead>
  60. <tr>
  61. <th class='w-50px'><?php echo $lang->testcase->stepID;?></th>
  62. <th class='w-p70 text-left'><?php echo $lang->testcase->stepDesc;?></th>
  63. <th class='text-left'><?php echo $lang->testcase->stepExpect;?></th>
  64. </tr>
  65. </thead>
  66. <?php
  67. $stepId = $childId = 0;
  68. foreach($case->steps as $stepID => $step)
  69. {
  70. $stepClass = "step-{$step->type}";
  71. if($step->type == 'group' or $step->type == 'step')
  72. {
  73. $stepId++;
  74. $childId = 0;
  75. }
  76. if($step->type == 'step') $stepClass = 'step-group';
  77. echo "<tr class='step {$stepClass}'>";
  78. echo "<th class='step-id'>$stepId</th>";
  79. echo "<td class='text-left'><div class='input-group'>";
  80. if($step->type == 'item') echo "<span class='step-item-id'>{$stepId}.{$childId}</span>";
  81. echo nl2br($step->desc) . "</td>";
  82. echo "<td class='text-left'>" . nl2br($step->expect) . "</div></td>";
  83. echo "</tr>";
  84. $childId ++;
  85. }
  86. ?>
  87. </table>
  88. </div>
  89. <?php echo $this->fetch('file', 'printFiles', array('files' => $case->files, 'fieldset' => 'true'));?>
  90. <?php include '../../common/view/m.action.html.php';?>
  91. </div>
  92. <div class="display hidden" id="legendBasicInfo">
  93. <table class='table bordered table-detail'>
  94. <?php if($isLibCase):?>
  95. <tr>
  96. <th class='w-80px'><?php echo $lang->testcase->lib;?></th>
  97. <td><?php if(!common::printLink('caselib', 'browse', "libID=$case->lib", $libName)) echo $libName;?></td>
  98. </tr>
  99. <?php else:?>
  100. <tr>
  101. <th class='w-80px'><?php echo $lang->testcase->product;?></th>
  102. <td><?php if(!common::printLink('testcase', 'browse', "productID=$case->product", $productName)) echo $productName;?></td>
  103. </tr>
  104. <?php if($this->session->currentProductType != 'normal'):?>
  105. <tr>
  106. <th><?php echo $lang->product->branch;?></th>
  107. <td><?php if(!common::printLink('testcase', 'browse', "productID=$case->product&branch=$case->branch", $branchName)) echo $branchName;?></td>
  108. </tr>
  109. <?php endif;?>
  110. <?php endif;?>
  111. <tr>
  112. <th><?php echo $lang->testcase->module;?></th>
  113. <td>
  114. <?php
  115. if(empty($modulePath))
  116. {
  117. echo "/";
  118. }
  119. else
  120. {
  121. foreach($modulePath as $key => $module)
  122. {
  123. if(!common::printLink('testcase', 'browse', "productID=$case->product&branch=$module->branch&browseType=byModule&param=$module->id", $module->name)) echo $module->name;
  124. if(isset($modulePath[$key + 1])) echo $lang->arrow;
  125. }
  126. }
  127. ?>
  128. </td>
  129. </tr>
  130. <?php if(!$isLibCase):?>
  131. <tr class='nofixed'>
  132. <th><?php echo $lang->testcase->story;?></th>
  133. <td>
  134. <?php
  135. if(isset($case->storyTitle)) echo html::a($this->createLink('story', 'view', "storyID=$case->story"), "#$case->story:$case->storyTitle");
  136. if($case->story and $case->storyStatus == 'active' and $case->latestStoryVersion > $case->storyVersion)
  137. {
  138. echo "(<span class='warning'>{$lang->story->changed}</span> ";
  139. echo html::a($this->createLink('testcase', 'confirmStoryChange', "caseID=$case->id"), $lang->confirm, 'hiddenwin');
  140. echo ")";
  141. }
  142. ?>
  143. </td>
  144. </tr>
  145. <?php endif;?>
  146. <tr>
  147. <th><?php echo $lang->testcase->type;?></th>
  148. <td><?php echo $lang->testcase->typeList[$case->type];?></td>
  149. </tr>
  150. <tr>
  151. <th><?php echo $lang->testcase->stage;?></th>
  152. <td>
  153. <?php
  154. if($case->stage)
  155. {
  156. $stags = explode(',', $case->stage);
  157. foreach($stags as $stage)
  158. {
  159. if(empty($stage)) continue;
  160. isset($lang->testcase->stageList[$stage]) ? print($lang->testcase->stageList[$stage]) : print($stage);
  161. echo "<br />";
  162. }
  163. }
  164. ?>
  165. </td>
  166. </tr>
  167. <tr>
  168. <th><?php echo $lang->testcase->pri;?></th>
  169. <td><span class='<?php echo 'pri' . zget($lang->testcase->priList, $case->pri);?>'><?php echo zget($lang->testcase->priList, $case->pri)?></span></td>
  170. </tr>
  171. <tr>
  172. <th><?php echo $lang->testcase->status;?></th>
  173. <td>
  174. <?php
  175. echo $lang->testcase->statusList[$case->status];
  176. if($case->version > $case->currentVersion and $from == 'testtask')
  177. {
  178. echo " (<span class='warning'>{$lang->testcase->changed}</span> ";
  179. echo html::a($this->createLink('testcase', 'confirmchange', "caseID=$case->id"), $lang->confirm, 'hiddenwin');
  180. echo ")";
  181. }
  182. ?>
  183. </td>
  184. </tr>
  185. <?php if(!$isLibCase):?>
  186. <tr>
  187. <th><?php echo $this->app->loadLang('testtask')->testtask->lastRunTime;?></th>
  188. <td><?php if(!helper::isZeroDate($case->lastRunDate)) echo $case->lastRunDate;?></td>
  189. </tr>
  190. <tr>
  191. <th><?php echo $this->app->loadLang('testtask')->testtask->lastRunResult;?></th>
  192. <td><?php if($case->lastRunResult) echo $lang->testcase->resultList[$case->lastRunResult];?></td>
  193. </tr>
  194. <?php endif;?>
  195. <tr>
  196. <th><?php echo $lang->testcase->keywords;?></th>
  197. <td><?php echo $case->keywords;?></td>
  198. </tr>
  199. <?php if(!$isLibCase):?>
  200. <tr>
  201. <th><?php echo $lang->testcase->linkCase;?></th>
  202. <td>
  203. <?php
  204. if(isset($case->linkCaseTitles))
  205. {
  206. foreach($case->linkCaseTitles as $linkCaseID => $linkCaseTitle)
  207. {
  208. echo html::a($this->createLink('testcase', 'view', "caseID=$linkCaseID"), "#$linkCaseID $linkCaseTitle", '_blank') . '<br />';
  209. }
  210. }
  211. ?>
  212. </td>
  213. </tr>
  214. <?php endif;?>
  215. <?php if(!$isLibCase):?>
  216. <?php if($case->fromBug):?>
  217. <tr>
  218. <th><?php echo $lang->testcase->fromBug;?></th>
  219. <td><?php echo html::a($this->createLink('bug', 'view', "bugID=$case->fromBug"), $case->fromBugTitle);?></td>
  220. </tr>
  221. <?php endif;?>
  222. <?php if($case->toBugs):?>
  223. <tr>
  224. <th valign="top"><?php echo $lang->testcase->toBug;?></th>
  225. <td>
  226. <?php
  227. foreach($case->toBugs as $bugID => $bugTitle)
  228. {
  229. echo '<p style="margin-bottom:0;">' . html::a($this->createLink('bug', 'view', "bugID=$bugID"), $bugTitle) . '</p>';
  230. }
  231. ?>
  232. </td>
  233. </tr>
  234. <?php endif;?>
  235. <?php endif;?>
  236. <tr>
  237. <th><?php echo $lang->testcase->openedBy;?></th>
  238. <td><?php echo $users[$case->openedBy] . $lang->at . $case->openedDate;?></td>
  239. </tr>
  240. <?php if($config->testcase->needReview):?>
  241. <tr>
  242. <th><?php echo $lang->testcase->reviewedBy;?></th>
  243. <td><?php $reviewedBy = explode(',', $case->reviewedBy); foreach($reviewedBy as $account) echo ' ' . $users[trim($account)]; ?></td>
  244. </tr>
  245. <tr>
  246. <th><?php echo $lang->testcase->reviewedDate;?></th>
  247. <td><?php if($case->reviewedBy) echo $case->reviewedDate;?></td>
  248. </tr>
  249. <?php endif;?>
  250. <tr>
  251. <th><?php echo $lang->testcase->lblLastEdited;?></th>
  252. <td><?php if($case->lastEditedBy) echo $users[$case->lastEditedBy] . $lang->at . $case->lastEditedDate;?></td>
  253. </tr>
  254. </table>
  255. </div>
  256. </div>
  257. </div>
  258. </div>
  259. <nav class='nav nav-auto affix dock-bottom footer-actions'>
  260. <?php
  261. if($config->testcase->needReview) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'button', '', '', '', false, "data-display='modal' data-placement='bottom'", $lang->testcase->review);
  262. if(common::hasPriv('testcase', 'delete')) echo html::a($this->createLink('testcase', 'delete', "caseID=$case->id"), $lang->delete, 'hiddenwin');
  263. if(common::hasPriv('action', 'comment', $case)) echo html::a('#commentBox', $lang->comment, '', "data-display data-backdrop='true'");
  264. ?>
  265. </nav>
  266. </div>
  267. <div id='commentBox' class='enter-from-bottom hidden affix layer'>
  268. <div class='heading'>
  269. <div class="title"><?php echo $lang->comment;?></div>
  270. <nav class='nav'><a data-dismiss='display' class='muted'><i class='icon-remove'></i></a></nav>
  271. </div>
  272. <form id='commentForm' target='hiddenwin' class='has-padding' data-form-refresh='#history' method='post' action='<?php echo $this->createLink('action', 'comment',"objectType=case&objectID=$case->id")?>'>
  273. <div class='control'><?php echo html::textarea('comment', '',"rows='5' class='textarea' data-default-val");?></div>
  274. <div class='control'><button type='submit' class='btn primary'><?php echo $lang->save ?></button></div>
  275. </form>
  276. </div>
  277. <?php include '../../common/view/m.footer.html.php';?>