caseheader.html.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <?php js::set('flow', $config->global->flow);?>
  2. <?php $this->app->loadLang('zanode');?>
  3. <?php $isProjectApp = $this->app->tab == 'project'?>
  4. <?php $currentModule = $isProjectApp ? 'project' : 'testcase';?>
  5. <?php $currentMethod = $isProjectApp ? 'testcase' : 'browse';?>
  6. <?php $projectParam = $isProjectApp ? "projectID={$this->session->project}&" : '';?>
  7. <?php if(common::checkNotCN()):?>
  8. <style> .btn-toolbar>.btn {margin-right: 3px !important;}</style>
  9. <?php endif;?>
  10. <?php if(!isset($branch)) $branch = 0;?>
  11. <?php if($config->global->flow == 'full'):?>
  12. <style>
  13. .btn-group a i.icon-plus {font-size: 16px;}
  14. .btn-group .icon-help {line-height: 30px;}
  15. .btn-group .popover {width:300px;}
  16. .btn-group a.btn-primary {border-right: 1px solid rgba(255,255,255,0.2);}
  17. .btn-group button.dropdown-toggle.btn-primary {padding:6px;}
  18. .body-modal #mainMenu>.btn-toolbar {width: auto;}
  19. #mainMenu .pull-left .checkbox-primary {margin-top: 6px;}
  20. #mainMenu .dividing-line {width: 1px; height: 16px; display: inline-block; background: #D8DBDE; margin: 7px 8px 0 0; float: left;}
  21. #byTypeTab li.split{border-top: 1px solid #eee;}
  22. </style>
  23. <div id='mainMenu' class='clearfix'>
  24. <?php if($this->app->rawMethod == 'browse'):?>
  25. <div id="sidebarHeader">
  26. <div class="title">
  27. <?php
  28. echo !empty($moduleID) ? $moduleName : $this->lang->tree->all;
  29. if(!empty($moduleID))
  30. {
  31. $removeLink = $browseType == 'bymodule' ? $this->createLink($currentModule, $currentMethod, $projectParam . "productID=$productID&branch=$branch&browseType=$browseType&param=0&caseType=&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("caseModule")';
  32. echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted' data-app='{$this->app->tab}'");
  33. }
  34. ?>
  35. </div>
  36. </div>
  37. <?php endif;?>
  38. <div class='btn-toolbar pull-left'>
  39. <?php
  40. $hasBrowsePriv = $isProjectApp ? common::hasPriv('project', 'testcase') : common::hasPriv('testcase', 'browse');
  41. $hasGroupPriv = common::hasPriv('testcase', 'groupcase');
  42. $hasZeroPriv = common::hasPriv('testcase', 'zerocase');
  43. $hasUnitPriv = common::hasPriv('testtask', 'browseunits');
  44. ?>
  45. <?php if($this->app->rawMethod == 'browseunits'):?>
  46. <?php
  47. $caseType = 'unit';
  48. $lang->testcase->typeList[''] = $lang->testcase->allType;
  49. $currentTypeName = zget($lang->testcase->typeList, $caseType, '');
  50. $currentLable = empty($currentTypeName) ? $lang->testcase->allType : $currentTypeName;
  51. if(!isset($param)) $param = 0;
  52. echo "<div id='byTypeTab' class='btn-group'>";
  53. echo html::a('javascript:;', "<span class='text'>{$currentLable}</span>" . " <span class='caret'></span>", '', "class='btn btn-link' data-toggle='dropdown'");
  54. echo "<ul class='dropdown-menu' style='max-height:240px; overflow-y:auto; width:130px;'>";
  55. foreach($lang->testcase->typeList as $type => $typeName)
  56. {
  57. echo '<li' . ($type == 'unit' ? " class='active'" : '') . '>';
  58. if($hasUnitPriv and $type == 'unit')
  59. {
  60. echo html::a($this->createLink('testtask', 'browseUnits', "productID=$productID&browseType=newest&orderBy=id_desc&recTotal=0&recPerPage=20&pageID=1&projectID=$projectID"), "{$lang->testcase->browseUnits}", '', " data-app='{$this->app->tab}'");
  61. }
  62. elseif(isset($groupBy))
  63. {
  64. echo html::a($this->createLink('testcase', 'groupCase', "productID=$productID&branch=$branch&groupBy=story&projectID=$projectID&caseType=$type"), $typeName);
  65. }
  66. else
  67. {
  68. echo html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=all&param=$param&caseType=$type"), $typeName);
  69. }
  70. echo "</li>";
  71. }
  72. echo '</ul></div>';
  73. ?>
  74. <?php foreach($lang->testtask->unitTag as $key => $label):?>
  75. <?php echo html::a(inlink('browseUnits', "productID=$productID&browseType=$key&orderBy=$orderBy"), "<span class='text'>$label</span>", '', "id='{$key}UnitTab' class='btn btn-link' data-app='{$this->app->tab}'");?>
  76. <?php endforeach;?>
  77. <?php else:?>
  78. <?php
  79. $rawModule = $this->app->rawModule;
  80. $rawMethod = $this->app->rawMethod;
  81. if(!isset($lang->{$rawModule}->featureBar[$rawMethod]))
  82. {
  83. $rawModule = $app->tab == 'project' ? 'project' : 'testcase';
  84. $rawMethod = $rawModule == 'testcase' ? 'browse' : 'testcase';
  85. }
  86. ?>
  87. <?php foreach(customModel::getFeatureMenu($rawModule, $rawMethod) as $menuItem):?>
  88. <?php
  89. if(isset($menuItem->hidden)) continue;
  90. $menuType = $menuItem->name;
  91. $caseType = isset($caseType) ? $caseType : '';
  92. if(!$config->testcase->needReview and empty($config->testcase->forceReview) and $menuType == 'wait') continue;
  93. if($hasBrowsePriv and $menuType == 'QUERY' and in_array($browseType, array('all', 'needconfirm', 'bysuite')))
  94. {
  95. $searchBrowseLink = $this->createLink($currentModule, $currentMethod, $projectParam . "productID=$productID&branch=$branch&browseType=bySearch&param=%s");
  96. $isBySearch = $browseType == 'bysearch';
  97. include '../../common/view/querymenu.html.php';
  98. }
  99. elseif($hasBrowsePriv and $menuType == 'casetype')
  100. {
  101. if($currentModule == 'project') continue;
  102. if($this->moduleName == 'testtask' and $this->methodName == 'browseunits') continue;
  103. if($this->moduleName == 'story' and $this->methodName == 'zerocase') continue;
  104. if($browseType == 'bysuite') continue;
  105. $lang->testcase->typeList[''] = $lang->testcase->allType;
  106. $currentTypeName = zget($lang->testcase->typeList, $caseType, '');
  107. $currentLable = empty($currentTypeName) ? $lang->testcase->allType : $currentTypeName;
  108. if(!isset($param)) $param = 0;
  109. echo "<div id='byTypeTab' class='btn-group'>";
  110. echo html::a('javascript:;', "<span class='text'>{$currentLable}</span>" . " <span class='caret'></span>", '', "class='btn btn-link' data-toggle='dropdown'");
  111. echo "<ul class='dropdown-menu' style='max-height:240px; overflow-y:auto; width:130px;'>";
  112. foreach($lang->testcase->typeList as $type => $typeName)
  113. {
  114. echo '<li' . ($type == $caseType ? " class='active'" : '') . '>';
  115. if($hasUnitPriv and $type == 'unit')
  116. {
  117. echo html::a($this->createLink('testtask', 'browseUnits', "productID=$productID&browseType=newest&orderBy=id_desc&recTotal=0&recPerPage=20&pageID=1&projectID=$projectID"), "{$lang->testcase->browseUnits}", '', " data-app='{$this->app->tab}'");
  118. }
  119. elseif(isset($groupBy))
  120. {
  121. echo html::a($this->createLink('testcase', 'groupCase', "productID=$productID&branch=$branch&groupBy=story&projectID=$projectID&caseType=$type"), $typeName);
  122. }
  123. else
  124. {
  125. echo html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=$browseType&param=$param&caseType=$type"), $typeName);
  126. }
  127. echo "</li>";
  128. }
  129. echo '</ul></div>';
  130. }
  131. elseif($hasBrowsePriv and $menuType == 'autocase')
  132. {
  133. if($this->moduleName == 'testtask' and $this->methodName == 'browseunits') continue;
  134. if($this->moduleName == 'story' and $this->methodName == 'zerocase') continue;
  135. if($browseType == 'bysuite' or $browseType == 'bysearch') continue;
  136. echo html::checkbox('showAutoCase', array('1' => $lang->testcase->automated), '', $this->cookie->showAutoCase ? 'checked=checked' : '');
  137. }
  138. elseif($hasBrowsePriv and ($menuType == 'all' or $menuType == 'needconfirm' or $menuType == 'wait'))
  139. {
  140. echo html::a($this->createLink($currentModule, $currentMethod, $projectParam . "productID=$productID&branch=$branch&browseType=$menuType&param=0&caseType=$caseType"), "<span class='text'>{$menuItem->text}</span>", '', "class='btn btn-link' id='{$menuType}Tab' data-app='{$this->app->tab}'");
  141. }
  142. elseif($hasBrowsePriv and $menuType == 'suite' and $this->app->tab == 'qa')
  143. {
  144. $currentSuiteID = isset($suiteID) ? (int)$suiteID : 0;
  145. $currentSuite = zget($suiteList, $currentSuiteID, '');
  146. $currentLable = empty($currentSuite) ? $lang->testsuite->common : $currentSuite->name;
  147. echo "<div id='bysuiteTab' class='btn-group'>";
  148. echo html::a('javascript:;', "<span class='text'>{$currentLable}</span>" . " <span class='caret'></span>", '', "class='btn btn-link' data-toggle='dropdown'");
  149. echo "<ul class='dropdown-menu' style='max-height:240px; overflow-y:auto'>";
  150. if(empty($productID) or common::canModify('product', $product))
  151. {
  152. if(empty($suiteList))
  153. {
  154. echo '<li>';
  155. echo html::a($this->createLink('testsuite', 'create', "productID=$productID"), "<i class='icon-plus'></i> " . $lang->testsuite->create);
  156. echo '</li>';
  157. }
  158. }
  159. foreach($suiteList as $suiteID => $suite)
  160. {
  161. $suiteName = $suite->name;
  162. echo '<li' . ($suiteID == (int)$currentSuiteID ? " class='active'" : '') . '>';
  163. echo html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySuite&param=$suiteID"), $suiteName);
  164. echo "</li>";
  165. }
  166. echo '</ul></div>';
  167. }
  168. elseif($hasGroupPriv and $menuType == 'group')
  169. {
  170. $groupBy = isset($groupBy) ? $groupBy : '';
  171. $active = !empty($groupBy) ? 'btn-active-text' : '';
  172. echo "<div id='groupTab' class='btn-group'>";
  173. echo html::a($this->createLink('testcase', 'groupCase', "productID=$productID&branch=$branch&groupBy=story&projectID=$projectID"), "<span class='text'>{$menuItem->text}</span>", '', "class='btn btn-link $active' data-app='{$this->app->tab}'");
  174. echo '</div>';
  175. }
  176. elseif($hasZeroPriv and $menuType == 'zerocase')
  177. {
  178. $projectID = $isProjectApp ? $this->session->project : 0;
  179. echo html::a($this->createLink('testcase', 'zeroCase', "productID=$productID&branch=$branch&orderBy=id_desc&projectID=$projectID"), "<span class='text'>{$menuItem->text}</span>", '', "class='btn btn-link' id='zerocaseTab' data-app='{$this->app->tab}'");
  180. }
  181. ?>
  182. <?php endforeach;?>
  183. <?php
  184. if($this->methodName == 'browse') echo "<a id='bysearchTab' class='btn btn-link querybox-toggle'><i class='icon-search icon'></i> {$lang->testcase->bySearch}</a>";
  185. ?>
  186. <?php endif;?>
  187. </div>
  188. <?php if(!isonlybody()):?>
  189. <div class='btn-toolbar pull-right'>
  190. <?php if(common::hasPriv('testcase', 'createScene') || common::hasPriv('testcase', 'editScene') || common::hasPriv('testcase', 'deleteScene') || common::hasPriv('testcase', 'changeScene') || common::hasPriv('testcase', 'batchChangeScene') || common::hasPriv('testcase', 'updateOrder') || common::hasPriv('testcase', 'importXmind') || common::hasPriv('testcase', 'getXmindImport') || common::hasPriv('testcase', 'showXMindImport') || common::hasPriv('testcase', 'exportXmind')): ?>
  191. <div class='btn-group btn btn-link'>
  192. <?php echo html::checkbox('onlyScene', array('1' => $lang->testcase->onlyScene), '', $this->cookie->onlyScene ? 'checked=checked' : '');?>
  193. </div>
  194. <?php endif;?>
  195. <?php if(!empty($productID)): ?>
  196. <div class='btn-group'>
  197. <button type='button' class='btn btn-link dropdown-toggle' data-toggle='dropdown'>
  198. <i class='icon icon-export muted'></i>
  199. <span class='caret'></span>
  200. </button>
  201. <ul class='dropdown-menu pull-right' id='exportActionMenu'>
  202. <?php
  203. $class = common::hasPriv('testcase', 'export') ? '' : "class=disabled";
  204. $misc = common::hasPriv('testcase', 'export') ? "class='export'" : "class=disabled";
  205. $link = common::hasPriv('testcase', 'export') ? $this->createLink('testcase', 'export', "productID=$productID&orderBy=$orderBy&taskID=0&browseType=$browseType") : '#';
  206. echo "<li $class>" . html::a($link, $lang->testcase->export, '', $misc . "data-app={$this->app->tab}") . "</li>";
  207. $class = common::hasPriv('testcase', 'exportTemplate') ? '' : "class=disabled";
  208. $misc = common::hasPriv('testcase', 'exportTemplate') ? "class='export'" : "class=disabled";
  209. $link = common::hasPriv('testcase', 'exportTemplate') ? $this->createLink('testcase', 'exportTemplate', "productID=$productID") : '#';
  210. echo "<li $class>" . html::a($link, $lang->testcase->exportTemplate, '', $misc . "data-app={$this->app->tab} data-width='65%'") . "</li>";
  211. $class = common::hasPriv('testcase', 'exportXmind') ? '' : "class=disabled";
  212. $misc = common::hasPriv('testcase', 'exportXmind') ? "class='export'" : "class=disabled";
  213. $link = common::hasPriv('testcase', 'exportXmind') ? $this->createLink('testcase', 'exportXmind', "productID=$productID&moduleID=$moduleID&branch=$branch") : '#';
  214. echo "<li $class>" . html::a($link, $lang->testcase->xmindExport, '', $misc . "data-app={$this->app->tab}") . "</li>";
  215. ?>
  216. </ul>
  217. </div>
  218. <?php endif;?>
  219. <?php if(empty($productID) or common::canModify('product', $product)):?>
  220. <?php if(!empty($productID) and (common::hasPriv('testcase', 'import') or common::hasPriv('testcase', 'importFromLib'))): ?>
  221. <div class='btn-group'>
  222. <button type='button' class='btn btn-link dropdown-toggle' data-toggle='dropdown' id='importAction'><i class='icon icon-import muted'></i> <span class='caret'></span></button>
  223. <ul class='dropdown-menu pull-right' id='importActionMenu'>
  224. <?php
  225. if(common::hasPriv('testcase', 'import')) echo "<li>" . html::a($this->createlink('testcase', 'import', "productID=$productID&branch=$branch"), $lang->testcase->fileImport, '', "class='export' data-app={$app->tab}") . "</li>";
  226. $link = $this->createLink('testcase', 'importFromLib', "productID=$productID&branch=$branch&libID=0&orderBy=id_desc&browseType=&queryID=10&recTotal=0&recPerPage=20&pageID=1&projectID=$projectID");
  227. if(common::hasPriv('testcase', 'importFromLib')) echo "<li>" . html::a($link, $lang->testcase->importFromLib, '', "data-app={$app->tab}") . "</li>";
  228. $class = common::hasPriv('testcase', 'importXmind') ? '' : "class=disabled";
  229. $misc = common::hasPriv('testcase', 'importXmind') ? "class='export'" : "class=disabled";
  230. $link = common::hasPriv('testcase', 'importXmind') ? $this->createLink('testcase', 'importXmind', "productID=$productID&branch=$branch") : '#';
  231. echo "<li $class>" . html::a($link, $lang->testcase->xmindImport, '', $misc . "data-app={$this->app->tab}") . "</li>";
  232. ?>
  233. </ul>
  234. </div>
  235. <?php endif;?>
  236. <?php if(!empty($productID)): ?>
  237. <div class='btn-group'>
  238. <?php common::printLink('testcase', 'automation', "productID=$productID", "<i class='icon-wrench muted'> </i>" . $lang->testcase->automation, '', "class='btn btn-link iframe' data-width='50%'", true, true)?>
  239. </div>
  240. <?php endif;?>
  241. <?php $initModule = isset($moduleID) ? (int)$moduleID : 0;?>
  242. <div class='btn-group dropdown'>
  243. <?php
  244. $createTestcaseLink = $this->createLink('testcase', 'create', "productID=$productID&branch=$branch&moduleID=$initModule");
  245. $batchCreateLink = $this->createLink('testcase', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$initModule");
  246. $createSceneLink = $this->createLink('testcase', 'createScene', "productID=$productID&branch=$branch&moduleID=$initModule");
  247. $buttonLink = '';
  248. $buttonTitle = '';
  249. if(common::hasPriv('testcase', 'createScene'))
  250. {
  251. $buttonLink = $createSceneLink;
  252. $buttonTitle = $lang->testcase->newScene;
  253. }
  254. if(common::hasPriv('testcase', 'batchCreate'))
  255. {
  256. $buttonLink = !empty($productID) ? $batchCreateLink : '';
  257. $buttonTitle = $lang->testcase->batchCreate;
  258. }
  259. if(common::hasPriv('testcase', 'create'))
  260. {
  261. $buttonLink = $createTestcaseLink;
  262. $buttonTitle = $lang->testcase->create;
  263. }
  264. $hidden = empty($buttonLink) ? 'hidden' : '';
  265. echo html::a($buttonLink, "<i class='icon-plus'></i> " . $buttonTitle, '', "class='btn btn-primary $hidden' data-app='{$this->app->tab}'");
  266. ?>
  267. <?php if(!empty($productID) and common::hasPriv('testcase', 'batchCreate') and common::hasPriv('testcase', 'create')):?>
  268. <button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>
  269. <ul class='dropdown-menu'>
  270. <li><?php echo html::a($createTestcaseLink, $lang->testcase->create);?></li>
  271. <li><?php echo html::a($batchCreateLink, $lang->testcase->batchCreate, '', "data-app='{$this->app->tab}'");?></li>
  272. <?php if(common::hasPriv('testcase', 'createScene')){ ?>
  273. <li><?php echo html::a($createSceneLink, $lang->testcase->newScene);?></li>
  274. <?php } ?>
  275. </ul>
  276. <?php endif;?>
  277. </div>
  278. <?php if($this->app->rawMethod == 'browseunits' and (empty($productID) or common::canModify('product', $product))):?>
  279. <?php common::printLink('testtask', 'importUnitResult', "product=$productID", "<i class='icon icon-import'></i> " . $lang->testtask->importUnitResult, '', "class='btn btn-primary' data-app='{$this->app->tab}'");?>
  280. <?php endif;?>
  281. <?php endif;?>
  282. </div>
  283. <?php endif;?>
  284. </div>
  285. <?php endif;?>
  286. <?php
  287. $headerHooks = glob(dirname(dirname(__FILE__)) . "/ext/view/featurebar.*.html.hook.php");
  288. if(!empty($headerHooks))
  289. {
  290. foreach($headerHooks as $fileName) include($fileName);
  291. }
  292. ?>
  293. <script>
  294. $(function()
  295. {
  296. var $allTab = $('#allTab');
  297. var $waitTab = $('#waitTab');
  298. var $needconfirmTab = $('#needconfirmTab');
  299. var $groupTab = $('#groupTab');
  300. var $zerocaseTab = $('#zerocaseTab');
  301. var $bysuiteTab = $('#bysuiteTab');
  302. var $browseunitsTab = $('#browseunitsTab');
  303. var hasAllTab = $allTab.length > 0;
  304. var hasWaitTab = $waitTab.length > 0;
  305. var hasNeedconfirmTab = $needconfirmTab.length > 0;
  306. var hasGroupTab = $groupTab.length > 0;
  307. var hasZerocaseTab = $zerocaseTab.length > 0;
  308. var hasbysuiteTab = $bysuiteTab.length > 0;
  309. var hasBrowseunitsTab = $browseunitsTab.length > 0;
  310. if((hasAllTab || hasWaitTab) && (hasNeedconfirmTab || hasGroupTab || hasbysuiteTab || hasZerocaseTab || hasBrowseunitsTab))
  311. {
  312. if(hasWaitTab)
  313. {
  314. $waitTab.after("<div class='dividing-line'></div>");
  315. }
  316. else
  317. {
  318. $allTab.after("<div class='dividing-line'></div>");
  319. }
  320. }
  321. if((hasNeedconfirmTab || hasGroupTab || hasZerocaseTab) && (hasbysuiteTab || hasBrowseunitsTab))
  322. {
  323. if(hasZerocaseTab)
  324. {
  325. $zerocaseTab.after("<div class='dividing-line'></div>");
  326. }
  327. else if(hasGroupTab)
  328. {
  329. $groupTab.after("<div class='dividing-line'></div>");
  330. }
  331. else
  332. {
  333. $needconfirmTab.after("<div class='dividing-line'></div>");
  334. }
  335. }
  336. $('[data-toggle="popover"]').popover();
  337. });
  338. </script>