browse.html.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. <?php
  2. /**
  3. * The browse view file of product 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 Chunsheng Wang <chunsheng@cnezsoft.com>
  8. * @package product
  9. * @version $Id: browse.html.php 4909 2013-06-26 07:23:50Z chencongzhi520@gmail.com $
  10. * @link http://www.zentao.net
  11. */
  12. ?>
  13. <?php include $this->app->getModuleRoot() . '/common/view/header.html.php';?>
  14. <?php include $this->app->getModuleRoot() . '/common/view/datatable.fix.html.php';?>
  15. <style>
  16. body {margin-bottom: 25px;}
  17. #mainMenu .btn-toolbar .btn-group .dropdown-menu .btn-active-text:hover .text {color: #fff;}
  18. #mainMenu .btn-toolbar .btn-group .dropdown-menu .btn-active-text:hover .text:after {border-bottom: unset;}
  19. .body-modal #mainMenu>.btn-toolbar {width: auto;}
  20. .assignedTo{border-radius: 4px !important;}
  21. #productStoryForm table tbody tr td.c-actions .dividing-line {width: 1px; height: 16px; display: inline-block; vertical-align: middle; background: #F4F5F7; margin: 0 4px 0 0;}
  22. </style>
  23. <?php
  24. $lang->story->createCommon = $storyType == 'story' ? $lang->story->createStory : $lang->story->createRequirement;
  25. $unfoldStories = isset($config->product->browse->unfoldStories) ? json_decode($config->product->browse->unfoldStories, true) : array();
  26. $unfoldStories = zget($unfoldStories, $productID, array());
  27. $isProjectStory = $this->app->rawModule == 'projectstory';
  28. $projectHasProduct = $isProjectStory && !empty($project->hasProduct);
  29. $projectIDParam = $isProjectStory ? "projectID=$projectID&" : '';
  30. js::set('unfoldStories', $unfoldStories);
  31. js::set('unfoldAll', $lang->execution->treeLevel['all']);
  32. js::set('foldAll', $lang->execution->treeLevel['root']);
  33. js::set('storyType', $storyType);
  34. js::set('browseType', $browseType);
  35. js::set('productID', $productID);
  36. js::set('projectID', $projectID);
  37. js::set('branch', $branch);
  38. js::set('rawModule', $this->app->rawModule);
  39. js::set('productType', $this->app->tab == 'product' ? $product->type : '');
  40. js::set('projectHasProduct', $projectHasProduct);
  41. js::set('URAndSR', $this->config->URAndSR);
  42. js::set('vision', $this->config->vision);
  43. ?>
  44. <style>
  45. .btn-group .icon-close:before {font-size: 5px; vertical-align: 25%;}
  46. .btn-group a i.icon-plus, .btn-group a i.icon-link {font-size: 16px;}
  47. .btn-group a.btn-secondary, .btn-group a.btn-primary {border-right: 1px solid rgba(255,255,255,0.2);}
  48. .btn-group button.dropdown-toggle.btn-secondary, .btn-group button.dropdown-toggle.btn-primary {padding:6px;}
  49. </style>
  50. <div id="mainMenu" class="clearfix">
  51. <div id="sidebarHeader">
  52. <div class="title" title="<?php echo $moduleName;?>">
  53. <?php
  54. echo $moduleName;
  55. if($moduleID and $moduleID !== 'all')
  56. {
  57. $removeLink = $browseType == 'bymodule' ? $this->createLink($this->app->rawModule, $this->app->rawMethod, $projectIDParam . "productID=$productID&branch=$branch&browseType=$browseType&param=0&storyType=$storyType&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("storyModule")';
  58. echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted'");
  59. }
  60. ?>
  61. </div>
  62. </div>
  63. <div class="btn-toolbar pull-left">
  64. <?php
  65. if(!commonModel::isTutorialMode())
  66. {
  67. foreach(customModel::getFeatureMenu($this->app->rawModule, $this->app->rawMethod) as $menuItem)
  68. {
  69. if(isset($menuItem->hidden)) continue;
  70. if($menuItem->name == 'emptysr' && $storyType == 'story') continue;
  71. $menuBrowseType = strpos($menuItem->name, 'QUERY') === 0 ? 'bySearch' : $menuItem->name;
  72. if($menuItem->name == 'more')
  73. {
  74. if(!empty($lang->product->moreSelects))
  75. {
  76. $moreLabel = $lang->more;
  77. $moreLabelActive = '';
  78. $storyBrowseType = $this->session->storyBrowseType;
  79. if(isset($lang->product->moreSelects[$storyBrowseType]))
  80. {
  81. $moreLabel = "<span class='text'>{$lang->product->moreSelects[$storyBrowseType]}</span> <span class='label label-light label-badge'>{$pager->recTotal}</span>";
  82. $moreLabelActive = 'btn-active-text';
  83. }
  84. echo '<div class="btn-group" id="more">';
  85. echo html::a('javascript:;', $moreLabel . " <span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link $moreLabelActive'");
  86. echo "<ul class='dropdown-menu'>";
  87. foreach($lang->product->moreSelects as $key => $value)
  88. {
  89. $active = $key == $storyBrowseType ? 'btn-active-text' : '';
  90. echo '<li>' . html::a($this->createLink($this->app->rawModule, $this->app->rawMethod, $projectIDParam . "productID=$productID&branch=$branch&browseType=$key&param=0&storyType=$storyType"), "<span class='text'>{$value}</span>", '', "class='btn btn-link $active'") . '</li>';
  91. }
  92. echo '</ul></div>';
  93. }
  94. }
  95. elseif($menuItem->name == 'QUERY')
  96. {
  97. $searchBrowseLink = $this->createLink($this->app->rawModule, $this->app->rawMethod, $projectIDParam . "productID=$productID&branch=$branch&browseType=$menuBrowseType&param=%s&storyType=$storyType");
  98. $isBySearch = $this->session->storyBrowseType == 'bysearch';
  99. include $this->app->getModuleRoot() . '/common/view/querymenu.html.php';
  100. }
  101. else
  102. {
  103. $menuItemName = strtolower($menuItem->name);
  104. echo html::a($this->createLink($this->app->rawModule, $this->app->rawMethod, $projectIDParam . "productID=$productID&branch=$branch&browseType=$menuBrowseType&param=0&storyType=$storyType"), "<span class='text'>$menuItem->text</span>" . ($menuItemName == $this->session->storyBrowseType ? ' <span class="label label-light label-badge">' . $pager->recTotal . '</span>' : ''), '', "id='{$menuItem->name}Tab' class='btn btn-link" . ($this->session->storyBrowseType == $menuItemName ? ' btn-active-text' : '') . "'");
  105. }
  106. }
  107. }
  108. ?>
  109. <a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->product->searchStory;?></a>
  110. </div>
  111. <?php if(!isonlybody()):?>
  112. <div class="btn-toolbar pull-right">
  113. <?php if($this->app->rawModule != 'projectstory') common::printIcon('story', 'report', "productID=$productID&branchID=$branch&storyType=$storyType&browseType=$browseType&moduleID=$moduleID&chartType=pie", '', 'button', 'bar-chart muted'); ?>
  114. <div class="btn-group">
  115. <button class="btn pull-right btn-link" data-toggle="dropdown"><i class="icon icon-export muted"></i> <span class="text"><?php echo $lang->export ?></span> <span class="caret"></span></button>
  116. <ul class="dropdown-menu" id='exportActionMenu'>
  117. <?php
  118. $tab = $isProjectStory ? 'project' : 'product';
  119. $class = common::hasPriv('story', 'export') ? '' : "class=disabled";
  120. $misc = common::hasPriv('story', 'export') ? "data-toggle='modal' data-type='iframe' class='export' data-app='$tab'" : "class=disabled";
  121. $link = common::hasPriv('story', 'export') ? $this->createLink('story', 'export', "productID=$productID&orderBy=$orderBy&executionID=$projectID&browseType=$browseType&type=$storyType") : '#';
  122. echo "<li $class>" . html::a($link, $lang->story->export, '', $misc) . "</li>";
  123. ?>
  124. </ul>
  125. </div>
  126. <?php if(common::canModify('product', $product)):?>
  127. <div class='btn-group dropdown'>
  128. <?php
  129. $createStoryLink = $this->createLink('story', 'create', "product=$productID&branch=$branch&moduleID=$moduleID&storyID=0&projectID=$projectID&bugID=0&planID=0&todoID=0&extra=&type=$storyType");
  130. $batchCreateLink = $this->createLink('story', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$moduleID&storyID=0&project=$projectID&plan=0&type=$storyType");
  131. $buttonLink = '';
  132. $buttonTitle = '';
  133. $buttonType = $from == 'project' ? 'btn-secondary' : 'btn-primary';
  134. if(common::hasPriv('story', 'batchCreate'))
  135. {
  136. $buttonLink = empty($productID) ? '' : $batchCreateLink;
  137. $buttonTitle = $lang->story->batchCreate;
  138. }
  139. if(common::hasPriv('story', 'create'))
  140. {
  141. $buttonLink = $createStoryLink;
  142. $buttonTitle = $lang->story->create;
  143. }
  144. $hidden = empty($buttonLink) ? 'hidden' : '';
  145. echo html::a($buttonLink, "<i class='icon icon-plus'></i> $buttonTitle", '', "class='btn $buttonType $hidden create-story-btn' data-app='$tab'");
  146. ?>
  147. <?php if(!empty($productID) and common::hasPriv('story', 'batchCreate') and common::hasPriv('story', 'create')): ?>
  148. <button type='button' class="btn <?php echo $buttonType?> dropdown-toggle" data-toggle='dropdown'><span class='caret'></span></button>
  149. <ul class='dropdown-menu pull-right'>
  150. <li>
  151. <?php
  152. if(commonModel::isTutorialMode())
  153. {
  154. $wizardParams = helper::safe64Encode("productID=$productID&branch=$branch&moduleID=$moduleID");
  155. if($isProjectStory) $wizardParams = helper::safe64Encode("productID=$productID&branch=$branch&moduleID=$moduleID&storyID=&projectID=$projectID");
  156. $link = $this->createLink('tutorial', 'wizard', "module=story&method=create&params=$wizardParams");
  157. echo html::a($link, $lang->story->createCommon, '', "data-app='$tab'");
  158. }
  159. else
  160. {
  161. echo html::a($createStoryLink, $lang->story->create, '', "data-group='$tab'");
  162. }
  163. ?>
  164. </li>
  165. <li><?php echo html::a($batchCreateLink, $lang->story->batchCreate, '', "data-group='$tab'");?></li>
  166. </ul>
  167. <?php endif;?>
  168. </div>
  169. <?php endif;?>
  170. </div>
  171. <?php endif;?>
  172. </div>
  173. <?php if($this->app->getViewType() == 'xhtml'):?>
  174. <div id="xx-title">
  175. <strong>
  176. <?php echo $this->product->getByID($productID)->name ?>
  177. </strong>
  178. </div>
  179. <?php endif;?>
  180. <div id="mainContent" class="main-row fade">
  181. <div class="side-col" id="sidebar">
  182. <div class="sidebar-toggle"><i class="icon icon-angle-left"></i></div>
  183. <div class="cell">
  184. <?php if(!$moduleTree):?>
  185. <hr class="space">
  186. <div class="text-center text-muted">
  187. <?php echo $lang->product->noModule;?>
  188. </div>
  189. <hr class="space">
  190. <?php endif;?>
  191. <?php echo $moduleTree;?>
  192. <div class="text-center">
  193. <?php if($productID) common::printLink('tree', 'browse', "rootID=$productID&view=story&currentModuleID=0&branch=$branchID&from=&projectID=$projectID", $lang->tree->manageMenu, '', "class='btn btn-info btn-wide'");?>
  194. <hr class="space-sm" />
  195. </div>
  196. </div>
  197. </div>
  198. <div class="main-col">
  199. <div class="cell<?php if($browseType == 'bysearch') echo ' show';?>" id="queryBox" data-module='story'></div>
  200. <?php if(empty($stories)):?>
  201. <div class="table-empty-tip">
  202. <p>
  203. <span class="text-muted"><?php echo $storyType == 'story' ? $lang->story->noStory : $lang->story->noRequirement;?></span>
  204. <?php if(common::canModify('product', $product) and common::hasPriv('story', 'create')):?>
  205. <?php echo html::a($this->createLink('story', 'create', "productID={$productID}&branch={$branch}&moduleID={$moduleID}&storyID=0&projectID=$projectID&bugID=0&planID=0&todoID=0&extra=&type=$storyType"), "<i class='icon icon-plus'></i> " . $lang->story->create, '', "class='btn btn-info' data-app='$from'");?>
  206. <?php endif;?>
  207. </p>
  208. </div>
  209. <?php else:?>
  210. <form class="main-table table-story skip-iframe-modal" method="post" id='productStoryForm'>
  211. <div class="table-header fixed-right">
  212. <nav class="btn-toolbar pull-right"></nav>
  213. </div>
  214. <?php
  215. $datatableId = $this->moduleName . ucfirst($this->methodName);
  216. $useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable');
  217. $vars = "productID=$productID&branch=$branch&browseType=$browseType&param=$param&storyType=$storyType&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
  218. if($from == 'project') $vars = "projectID=$projectID&productID=$productID&branch=$branch&browseType=$browseType&param=$param&storyType=$storyType&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
  219. if($useDatatable) include $this->app->getModuleRoot() . '/common/view/datatable.html.php';
  220. $setting = $this->datatable->getSetting('product');
  221. $widths = $this->datatable->setFixedFieldWidth($setting);
  222. $columns = 0;
  223. $canBeChanged = common::canModify('product', $product);
  224. $canBatchEdit = ($canBeChanged and common::hasPriv('story', 'batchEdit'));
  225. $canBatchClose = (common::hasPriv('story', 'batchClose') and strtolower($browseType) != 'closedbyme' and strtolower($browseType) != 'closedstory');
  226. $canBatchReview = ($canBeChanged and common::hasPriv('story', 'batchReview'));
  227. $canBatchChangeStage = ($canBeChanged and common::hasPriv('story', 'batchChangeStage'));
  228. $canBatchChangeBranch = ($canBeChanged and common::hasPriv('story', 'batchChangeBranch'));
  229. $canBatchChangeModule = ($canBeChanged and common::hasPriv('story', 'batchChangeModule'));
  230. $canBatchChangePlan = ($canBeChanged and common::hasPriv('story', 'batchChangePlan'));
  231. $canBatchAssignTo = ($canBeChanged and common::hasPriv('story', 'batchAssignTo'));
  232. $canBatchUnlink = ($canBeChanged and $this->app->tab == 'project' and common::hasPriv('projectstory', 'batchUnlinkStory'));
  233. $canBatchImportToLib = ($canBeChanged and $this->app->tab == 'project' and isset($this->config->maxVersion) and common::hasPriv('story', 'batchImportToLib'));
  234. $canBatchAction = ($canBatchEdit or $canBatchClose or $canBatchReview or $canBatchChangeStage or $canBatchChangeModule or $canBatchChangePlan or $canBatchAssignTo or $canBatchUnlink or $canBatchImportToLib);
  235. ?>
  236. <?php if(!$useDatatable) echo '<div class="table-responsive">';?>
  237. <table class='table has-sort-head<?php if($useDatatable) echo ' datatable';?>' id='storyList' data-fixed-left-width='<?php echo $widths['leftWidth']?>' data-fixed-right-width='<?php echo $widths['rightWidth']?>'>
  238. <thead>
  239. <tr>
  240. <?php if($this->app->getViewType() == 'xhtml'):?>
  241. <?php
  242. foreach($setting as $key => $value)
  243. {
  244. if($value->id == 'title' || $value->id == 'id' || $value->id == 'pri' || $value->id == 'status')
  245. {
  246. if($storyType == 'requirement' and (in_array($value->id, array('plan', 'stage')))) $value->show = false;
  247. if($value->show)
  248. {
  249. $this->datatable->printHead($value, $orderBy, $vars, $canBatchAction);
  250. $columns ++;
  251. }
  252. }
  253. }?>
  254. <?php else:?>
  255. <?php
  256. foreach($setting as $key => $value)
  257. {
  258. if($storyType == 'requirement' and (in_array($value->id, array('plan', 'stage')))) $value->show = false;
  259. if($value->show)
  260. {
  261. $this->datatable->printHead($value, $orderBy, $vars, $canBatchAction);
  262. $columns ++;
  263. }
  264. }
  265. ?>
  266. <?php endif;?>
  267. </tr>
  268. </thead>
  269. <tbody>
  270. <?php foreach($stories as $story):?>
  271. <tr data-id='<?php echo $story->id?>' data-estimate='<?php echo $story->estimate?>' data-cases='<?php echo zget($storyCases, $story->id, 0);?>'>
  272. <?php $story->from = $from;?>
  273. <?php if($this->app->getViewType() == 'xhtml'):?>
  274. <?php
  275. foreach($setting as $key => $value)
  276. {
  277. if($value->id == 'title' || $value->id == 'id' || $value->id == 'pri' || $value->id == 'status')
  278. {
  279. $this->story->printCell($value, $story, $users, $branchOption, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table');
  280. }
  281. }?>
  282. <?php else:?>
  283. <?php foreach($setting as $key => $value) $this->story->printCell($value, $story, $users, $branchOption, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table');?>
  284. <?php endif;?>
  285. </tr>
  286. <?php if(!empty($story->children)):?>
  287. <?php $i = 0;?>
  288. <?php foreach($story->children as $key => $child):?>
  289. <?php $child->from = $from;?>
  290. <?php $class = $i == 0 ? ' table-child-top' : '';?>
  291. <?php $class .= ($i + 1 == count($story->children)) ? ' table-child-bottom' : '';?>
  292. <tr class='table-children<?php echo $class;?> parent-<?php echo $story->id;?>' data-id='<?php echo $child->id?>' data-status='<?php echo $child->status?>' data-estimate='<?php echo $child->estimate?>'>
  293. <?php if($this->app->getViewType() == 'xhtml'):?>
  294. <?php
  295. foreach($setting as $key => $value)
  296. {
  297. if($value->id == 'title' || $value->id == 'id' || $value->id == 'pri' || $value->id == 'status')
  298. {
  299. $this->story->printCell($value, $child, $users, $branchOption, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table', $storyType);
  300. }
  301. }?>
  302. <?php else:?>
  303. <?php foreach($setting as $key => $value) $this->story->printCell($value, $child, $users, $branchOption, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table', $storyType);?>
  304. <?php endif;?>
  305. </tr>
  306. <?php $i ++;?>
  307. <?php endforeach;?>
  308. <?php endif;?>
  309. <?php endforeach;?>
  310. </tbody>
  311. </table>
  312. <?php if(!$useDatatable) echo '</div>';?>
  313. <div class="table-footer">
  314. <?php if($canBatchAction):?>
  315. <div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
  316. <?php endif;?>
  317. <div class="table-actions btn-toolbar">
  318. <div class='btn-group dropup'>
  319. <?php
  320. $disabled = $canBatchEdit ? '' : "disabled='disabled'";
  321. $actionLink = $this->createLink('story', 'batchEdit', "productID=$productID&projectID=$projectID&branch=$branch&storyType=$storyType");
  322. ?>
  323. <?php echo html::commonButton($lang->edit, "data-form-action='$actionLink' $disabled");?>
  324. <button type='button' class='btn dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>
  325. <ul class='dropdown-menu'>
  326. <?php
  327. $class = $canBatchClose ? '' : "class='disabled'";
  328. $actionLink = $this->createLink('story', 'batchClose', "productID=$productID&projectID=0&storyType=$storyType");
  329. $misc = $canBatchClose ? "onclick=\"setFormAction('$actionLink', '', '#productStoryForm')\"" : '';
  330. echo "<li $class>" . html::a('#', $lang->close, '', $misc) . "</li>";
  331. if($canBatchReview)
  332. {
  333. echo "<li class='dropdown-submenu'>";
  334. echo html::a('javascript:;', $lang->story->review, '', "id='reviewItem'");
  335. echo "<ul class='dropdown-menu'>";
  336. unset($lang->story->reviewResultList['']);
  337. unset($lang->story->reviewResultList['revert']);
  338. foreach($lang->story->reviewResultList as $key => $result)
  339. {
  340. $actionLink = $this->createLink('story', 'batchReview', "result=$key");
  341. if($key == 'reject')
  342. {
  343. echo "<li class='dropdown-submenu'>";
  344. echo html::a('#', $result, '', "id='rejectItem'");
  345. echo "<ul class='dropdown-menu'>";
  346. unset($lang->story->reasonList['']);
  347. unset($lang->story->reasonList['subdivided']);
  348. unset($lang->story->reasonList['duplicate']);
  349. foreach($lang->story->reasonList as $key => $reason)
  350. {
  351. $actionLink = $this->createLink('story', 'batchReview', "result=reject&reason=$key");
  352. echo "<li>";
  353. echo html::a('#', $reason, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin', '#productStoryForm')\"");
  354. echo "</li>";
  355. }
  356. echo '</ul></li>';
  357. }
  358. else
  359. {
  360. echo '<li>' . html::a('#', $result, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin', '#productStoryForm')\"") . '</li>';
  361. }
  362. }
  363. echo '</ul></li>';
  364. }
  365. else
  366. {
  367. $class= "class='disabled'";
  368. echo "<li $class>" . html::a('javascript:;', $lang->story->review, '', $class) . '</li>';
  369. }
  370. ?>
  371. </ul>
  372. </div>
  373. <?php $isShowModuleBTN = ($this->app->tab == 'project' and $browseType != 'bybranch') ? false : true;?>
  374. <?php if($canBatchChangeModule and $productID and $branchID !== 'all' and $isShowModuleBTN):?>
  375. <div class="btn-group dropup">
  376. <button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->story->moduleAB;?> <span class="caret"></span></button>
  377. <?php $withSearch = count($modules) > 8;?>
  378. <div class="dropdown-menu search-list<?php if($withSearch) echo ' search-box-sink';?>" data-ride="searchList">
  379. <?php if($withSearch):?>
  380. <div class="input-control search-box has-icon-left has-icon-right search-example">
  381. <input id="moduleSearchBox" type="search" autocomplete="off" class="form-control search-input">
  382. <label for="moduleSearchBox" class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>
  383. <a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>
  384. </div>
  385. <?php $modulesPinYin = common::convert2Pinyin($modules);
  386. ?>
  387. <?php endif;?>
  388. <div class="list-group">
  389. <?php
  390. foreach($modules as $moduleId => $module)
  391. {
  392. $searchKey = $withSearch ? ('data-key="' . zget($modulesPinYin, $module, '') . '"') : '';
  393. $actionLink = $this->createLink('story', 'batchChangeModule', "moduleID=$moduleId");
  394. echo html::a('#', empty($module) ? '/' : $module, '', "$searchKey onclick=\"setFormAction('$actionLink', 'hiddenwin', '#productStoryForm')\"");
  395. }
  396. ?>
  397. </div>
  398. </div>
  399. </div>
  400. <?php endif;?>
  401. <?php if($canBatchAssignTo):?>
  402. <div class="btn-group dropup">
  403. <button data-toggle="dropdown" type="button" class="btn assignedTo"><?php echo $lang->story->assignedTo;?> <span class="caret"></span></button>
  404. <?php
  405. $withSearch = count($users) > 10;
  406. $actionLink = $this->createLink('story', 'batchAssignTo', "productID=$productID");
  407. echo html::select('assignedTo', $teamMembers, '', 'class="hidden"');
  408. ?>
  409. <div class="dropdown-menu search-list<?php if($withSearch) echo ' search-box-sink';?>" data-ride="searchList">
  410. <?php if($withSearch):?>
  411. <?php $usersPinYin = common::convert2Pinyin($users);?>
  412. <div class="input-control search-box has-icon-left has-icon-right search-example">
  413. <input id="userSearchBox" type="search" autocomplete="off" class="form-control search-input">
  414. <label for="userSearchBox" class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label>
  415. <a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a>
  416. </div>
  417. <?php endif;?>
  418. <div class="list-group">
  419. <?php foreach ($teamMembers as $key => $value):?>
  420. <?php
  421. if(empty($key) or $key == 'closed') continue;
  422. $searchKey = $withSearch ? ('data-key="' . zget($usersPinYin, $value, '') . " @$key\"") : "data-key='@$key'";
  423. echo html::a("javascript:$(\"#assignedTo\").val(\"$key\");setFormAction(\"$actionLink\", \"hiddenwin\", \"#productStoryForm\")", $value, '', $searchKey);
  424. ?>
  425. <?php endforeach;?>
  426. </div>
  427. </div>
  428. </div>
  429. <?php endif;?>
  430. </div>
  431. <div class="table-statistic"><?php echo $summary;?></div>
  432. <?php $pager->show('right', 'pagerjs');?>
  433. </div>
  434. </form>
  435. <?php endif;?>
  436. </div>
  437. </div>
  438. <div class="modal fade" id="linkStoryByPlan">
  439. <div class="modal-dialog mw-500px">
  440. <div class="modal-content">
  441. <div class="modal-header">
  442. <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
  443. <h4 class="modal-title"><?php echo $lang->execution->linkStoryByPlan;?></h4><?php echo '(' . $lang->project->linkStoryByPlanTips . ')';?>
  444. </div>
  445. <div class="modal-body">
  446. <div class='input-group'>
  447. <?php echo html::select('plan', zget($productPlans, $productID, ''), '', "class='form-control chosen' id='plan'");?>
  448. <span class='input-group-btn'><?php echo html::commonButton($lang->execution->linkStory, "id='toTaskButton'", 'btn btn-primary');?></span>
  449. </div>
  450. </div>
  451. </div>
  452. </div>
  453. </div>
  454. <div class="modal fade" id="batchImportToLib">
  455. <div class="modal-dialog mw-500px">
  456. <div class="modal-content">
  457. <div class="modal-header">
  458. <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
  459. <h4 class="modal-title"><?php echo $lang->story->importToLib;?></h4>
  460. </div>
  461. <div class="modal-body">
  462. <form method='post' class='form-ajax' action='<?php echo $this->createLink('story', 'batchImportToLib');?>'>
  463. <table class='table table-form'>
  464. <tr>
  465. <th><?php echo $lang->story->lib;?></th>
  466. <td>
  467. <?php echo html::select('lib', $libs, '', "class='form-control chosen' required");?>
  468. </td>
  469. </tr>
  470. <?php if(!common::hasPriv('assetlib', 'approveStory') and !common::hasPriv('assetlib', 'batchApproveStory')):?>
  471. <tr>
  472. <th><?php echo $lang->story->approver;?></th>
  473. <td>
  474. <?php echo html::select('assignedTo', $approvers, '', "class='form-control chosen'");?>
  475. </td>
  476. </tr>
  477. <?php endif;?>
  478. <tr>
  479. <td colspan='2' class='text-center'>
  480. <?php echo html::hidden('storyIdList', '');?>
  481. <?php echo html::submitButton($lang->import, '', 'btn btn-primary');?>
  482. </td>
  483. </tr>
  484. </table>
  485. </form>
  486. </div>
  487. </div>
  488. </div>
  489. </div>
  490. <div class="modal fade" id="batchUnlinkStoryTip">
  491. <div class="modal-dialog mw-700px">
  492. <div class="modal-content">
  493. <div class="modal-header">
  494. <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
  495. <h4 class="modal-title"><strong><?php echo $lang->projectstory->batchUnlinkTip;?></strong></h4>
  496. </div>
  497. <div class="modal-body">
  498. <table class='table'>
  499. <thead>
  500. <tr>
  501. <th><?php echo $lang->story->title;?></th>
  502. <th class='w-200px'><?php echo $lang->story->link . $lang->execution->common;?></th>
  503. </tr>
  504. </thead>
  505. <tbody>
  506. </tbody>
  507. <tfoot>
  508. <tr>
  509. <td colspan='2' class='text-center'>
  510. <?php echo html::commonButton($lang->projectstory->confirm, 'data-dismiss="modal" id="confirmBtn"', 'btn btn-primary');?>
  511. </td>
  512. </tr>
  513. </tfoot>
  514. </table>
  515. </div>
  516. </div>
  517. </div>
  518. </div>
  519. <script>
  520. var moduleID = <?php echo $moduleID?>;
  521. var branchID = $.cookie('storyBranch');
  522. $('#module<?php echo $moduleID;?>').closest('li').addClass('active');
  523. $('#branch' + branchID).closest('li').addClass('active');
  524. $(function()
  525. {
  526. // Update table summary text.
  527. <?php $storyCommon = $storyType == 'requirement' ? $lang->URCommon : $lang->SRCommon;?>
  528. var checkedSummary = '<?php echo str_replace('%storyCommon%', $storyCommon, $lang->product->checkedSummary)?>';
  529. $('#productStoryForm').table(
  530. {
  531. statisticCreator: function(table)
  532. {
  533. var $checkedRows = table.getTable().find(table.isDataTable ? '.datatable-row-left.checked' : 'tbody>tr.checked');
  534. var $originTable = table.isDataTable ? table.$.find('.datatable-origin') : null;
  535. var checkedTotal = $checkedRows.length;
  536. if(!checkedTotal) return;
  537. var checkedEstimate = 0;
  538. var checkedCase = 0;
  539. $checkedRows.each(function()
  540. {
  541. var $row = $(this);
  542. if ($originTable)
  543. {
  544. $row = $originTable.find('tbody>tr[data-id="' + $row.data('id') + '"]');
  545. }
  546. var data = $row.data();
  547. checkedEstimate += data.estimate;
  548. if(data.cases > 0) checkedCase += 1;
  549. });
  550. }
  551. });
  552. });
  553. /**
  554. * Set the color of the badge to white.
  555. *
  556. * @param object obj
  557. * @param bool isShow
  558. * @access public
  559. * @return void
  560. */
  561. function setBadgeStyle(obj, isShow)
  562. {
  563. var $label = $(obj);
  564. if(isShow == true)
  565. {
  566. $label.find('.label-badge').css({"color":"#fff", "border-color":"#fff"});
  567. }
  568. else
  569. {
  570. $label.find('.label-badge').css({"color":"#838a9d", "border-color":"#838a9d"});
  571. }
  572. }
  573. </script>
  574. <?php include $this->app->getModuleRoot() . '/common/view/footer.html.php';?>