view.html.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <?php
  2. /**
  3. * The view of roadmap 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 roadmap
  9. * @version $Id: view.html.php 5096 2013-07-11 07:02:43Z chencongzhi520@gmail.com $
  10. * @link http://www.zentao.net
  11. */
  12. ?>
  13. <?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
  14. <?php include $app->getModuleRoot() . 'common/view/kindeditor.html.php';?>
  15. <?php include $app->getModuleRoot() . 'common/view/sortable.html.php';?>
  16. <?php include $app->getModuleRoot() . 'common/view/tablesorter.html.php';?>
  17. <?php js::set('confirmUnlinkStory', $lang->roadmap->confirmUnlinkStory)?>
  18. <?php js::set('roadmapID', $roadmap->id);?>
  19. <?php js::set('product', $roadmap->product);?>
  20. <?php js::set('storyPageID', $storyPager->pageID);?>
  21. <?php js::set('storyRecPerPage', $storyPager->recPerPage);?>
  22. <?php js::set('storyRecTotal', $storyPager->recTotal);?>
  23. <?php js::set('storySummary', $summary);?>
  24. <?php js::set('storyCommon', $lang->SRCommon);?>
  25. <?php js::set('checkedSummary', $lang->roadmap->checkedSummary);?>
  26. <?php js::set('confirmBatchUnlinkStory', $lang->roadmap->confirmBatchUnlinkStory);?>
  27. <?php js::set('storyListSession', $this->session->storyList);?>
  28. <div id='mainMenu' class='clearfix'>
  29. <div class='btn-toolbar pull-left'>
  30. <?php $browseLink = $this->session->roadmapList ? $this->session->roadmapList : inlink('browse', "roadmapID=$roadmap->product");?>
  31. <?php common::printBack($browseLink, 'btn btn-primary');?>
  32. <div class='divider'></div>
  33. <div class='page-title'>
  34. <span class='label label-id'><?php echo $roadmap->id;?></span>
  35. <span title='<?php echo $roadmap->name;?>' class='text'><?php echo $roadmap->name;?></span>
  36. <span class='label label-info label-badge'>
  37. <?php echo ($roadmap->begin == $config->roadmap->future || $roadmap->end == $config->roadmap->future) ? $lang->roadmap->future : $roadmap->begin . '~' . $roadmap->end;?>
  38. </span>
  39. <?php if($roadmap->deleted):?>
  40. <span class='label label-danger'><?php echo $lang->product->deleted;?></span>
  41. <?php endif; ?>
  42. </div>
  43. </div>
  44. <?php if($config->vision == 'or'):?>
  45. <div class='btn-toolbar pull-right' id='actionsBox'>
  46. <?php if(!$roadmap->deleted && !isonlybody()) echo $this->roadmap->buildOperateMenu($roadmap, 'view'); ?>
  47. </div>
  48. <?php endif;?>
  49. </div>
  50. <div id='mainContent' class='main-content'>
  51. <div class='tabs' id='tabsNav'>
  52. <?php if($this->app->getViewType() == 'xhtml'):?>
  53. <div class="roadmap-title"><?php echo $product->name . ' ' . $roadmap->name ?></div>
  54. <div class='tab-btn-container'>
  55. <?php endif;?>
  56. <ul class='nav nav-tabs'>
  57. <li class='<?php if($type == 'story') echo 'active'?>'>
  58. <a href='#stories' data-toggle='tab'>
  59. <?php echo html::icon($lang->icons['story'], 'text-primary') . ' ' . $lang->roadmap->linkedURS;?>
  60. <?php if($this->app->getViewType() == 'xhtml'):?>
  61. <span>(<?php echo $storyPager->recTotal;?>)</span>
  62. <?php endif;?>
  63. </a>
  64. </li>
  65. <li class='<?php if($type == 'roadmapInfo') echo 'active'?>'>
  66. <a href='#roadmapInfo' data-toggle='tab'><?php echo html::icon($lang->icons['plan'], 'text-info') . ' ' . $lang->roadmap->view;?></a>
  67. </li>
  68. </ul>
  69. <?php if($this->app->getViewType() == 'xhtml'):?>
  70. </div>
  71. <?php endif;?>
  72. <div class='tab-content'>
  73. <div id='stories' class='tab-pane <?php if($type == 'story') echo 'active'?>'>
  74. <?php $canOrder = common::hasPriv('execution', 'storySort');?>
  75. <div class='actions'>
  76. <?php if(common::hasPriv('roadmap', 'linkUR', $roadmap) and $config->vision == 'or') echo html::a("javascript:showLink($roadmap->id, \"story\")", '<i class="icon-link"></i> ' . $lang->roadmap->linkUR, '', "class='btn btn-primary'");?>
  77. </div>
  78. <?php if(common::hasPriv('roadmap', 'linkUR')):?>
  79. <div class='linkBox cell hidden'></div>
  80. <?php endif;?>
  81. <form class='main-table table-story<?php if($link === 'true' and $type == 'story') echo " hidden";?>' data-ride="" method='post' target='hiddenwin' id="roadmapURList" action="<?php echo inlink('batchUnlinkUR', "roadmapID=$roadmap->id&orderBy=$orderBy");?>">
  82. <table class='table has-sort-head' id='storyList'>
  83. <?php
  84. $canBatchClose = common::hasPriv('requirement', 'batchClose');
  85. $canBatchEdit = common::hasPriv('requirement', 'batchEdit');
  86. $canBatchChangeBranch = common::hasPriv('requirement', 'batchChangeBranch');
  87. $canBatchChangeModule = common::hasPriv('requirement', 'batchChangeModule');
  88. $canBatchChangeRoadmap = common::hasPriv('requirement', 'batchChangeRoadmap');
  89. $canBatchAssignTo = common::hasPriv('requirement', 'batchAssignTo');
  90. $canBatchAction = ($canBeChanged and ($canBatchUnlink or $canBatchClose or $canBatchEdit or $canBatchChangeBranch or $canBatchChangeModule or $canBatchChangeRoadmap or $canBatchAssignTo));
  91. $vars = "roadmapID={$roadmap->id}&type=story&orderBy=%s&link=$link&param=$param";
  92. ?>
  93. <thead>
  94. <tr class='text-center'>
  95. <?php if($this->app->getViewType() == 'xhtml'):?>
  96. <th class='c-id text-left'>
  97. <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?>
  98. </th>
  99. <th class='text-left'><?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
  100. <th class='w-70px' title='<?php echo $lang->pri;?>'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
  101. <th class='w-70px'> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
  102. <?php else:?>
  103. <th class='c-id text-left'>
  104. <?php if($roadmapStories && $canBatchAction):?>
  105. <div class="checkbox-primary check-all" title="<?php echo $lang->selectAll?>">
  106. <label></label>
  107. </div>
  108. <?php endif;?>
  109. <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?>
  110. </th>
  111. <?php if($canOrder):?>
  112. <th class='w-90px'><?php echo $lang->roadmap->updateOrder;?></th>
  113. <?php endif;?>
  114. <th class='w-70px' title='<?php echo $lang->pri;?>'><?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
  115. <th class='text-left'><?php common::printOrderLink('title', $orderBy, $vars, $lang->story->requirement);?></th>
  116. <th class='w-90px text-left'><?php common::printOrderLink('module', $orderBy, $vars, $lang->story->module);?></th>
  117. <th class='c-user'><?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
  118. <th class='w-70px'><?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
  119. <?php if($config->vision == 'or'):?>
  120. <th class='c-actions-1 w-90px'><?php echo $lang->actions?></th>
  121. <?php endif;?>
  122. <?php endif;?>
  123. </tr>
  124. </thead>
  125. <tbody class='sortable text-center'>
  126. <?php
  127. $totalEstimate = 0.0;
  128. ?>
  129. <?php foreach($roadmapStories as $story):?>
  130. <?php
  131. $viewLink = $this->createLink('story', 'view', "storyID=$story->id&version=0&param=0&storyType=requirement");
  132. $totalEstimate += $story->estimate;
  133. ?>
  134. <tr data-id='<?php echo $story->id;?>' data-estimate='<?php echo $story->estimate?>' <?php if(!empty($story->children)) echo "data-children=" . count($story->children);?> data-cases='<?php echo zget($storyCases, $story->id, 0);?>'>
  135. <?php if($this->app->getViewType() == 'xhtml'):?>
  136. <td class='c-id text-left'>
  137. <?php printf('%03d', $story->id);?>
  138. </td>
  139. <td class='text-left nobr' title='<?php echo $story->title?>'>
  140. <?php
  141. if($story->parent > 0) echo "<span class='label label-badge label-light' title={$gradeGroup[$story->type][$story->grade]}>{$gradeGroup[$story->type][$story->grade]}</span>";
  142. echo $story->title;
  143. ?>
  144. </td>
  145. <td><span class="<?php echo $story->pri ? 'label-pri label-pri-' . $story->pri : "";?>" title='<?php echo zget($lang->story->priList, $story->pri);?>'><?php echo zget($lang->story->priList, $story->pri);?></span></td>
  146. <td>
  147. <span class='status-story status-<?php echo $story->status?>'>
  148. <?php echo $this->processStatus('story', $story);?>
  149. </span>
  150. </td>
  151. <?php else:?>
  152. <td class='c-id text-left'>
  153. <?php if($canBatchAction):?>
  154. <?php echo html::checkbox('storyIdList', array($story->id => sprintf('%03d', $story->id)));?>
  155. <?php else:?>
  156. <?php printf('%03d', $story->id);?>
  157. <?php endif;?>
  158. </td>
  159. <?php if($canOrder):?><td class='sort-handler'><i class='icon-move'></i></td><?php endif;?>
  160. <td><span class="<?php echo $story->pri ? 'label-pri label-pri-' . $story->pri : "";?>" title='<?php echo zget($lang->story->priList, $story->pri);?>'><?php echo zget($lang->story->priList, $story->pri);?></span></td>
  161. <td class='text-left nobr' title='<?php echo $story->title?>'>
  162. <?php
  163. if($story->parent > 0) echo "<span class='label label-badge label-light' title={$gradeGroup[$story->type][$story->grade]}>{$gradeGroup[$story->type][$story->grade]}</span>";
  164. echo html::a($viewLink , $story->title, '', "style='color: $story->color' data-app={$this->app->tab}");
  165. ?>
  166. </td>
  167. <td class='text-left nobr' title='<?php echo zget($modulePairs, $story->module, '');?>'><?php echo zget($modulePairs, $story->module, '');?></td>
  168. <td><?php echo zget($users, $story->openedBy);?></td>
  169. <td>
  170. <span class='status-story status-<?php echo $story->status?>'><?php echo $this->processStatus('story', $story);?></span>
  171. </td>
  172. <?php if($config->vision == 'or'):?>
  173. <td class='c-actions'>
  174. <?php
  175. if($canBeChanged and common::hasPriv('roadmap', 'unlinkUR'))
  176. {
  177. $unlinkURL = $this->createLink('roadmap', 'unlinkUR', "story=$story->id&roadmap=$roadmap->id", '', true);
  178. $unlinkDisabled = !in_array($story->status, array('developing', 'closed')) ? '' : 'disabled';
  179. $unlinkTitle = $lang->roadmap->unlinkUR;
  180. echo html::a($unlinkURL, '<i class="icon-unlink"></i>', 'hiddenwin', "class='btn $unlinkDisabled iframe' data-width='90%' title='$unlinkTitle'");
  181. }
  182. ?>
  183. </td>
  184. <?php endif;?>
  185. <?php endif;?>
  186. </tr>
  187. <?php endforeach;?>
  188. </tbody>
  189. </table>
  190. <?php if($roadmapStories):?>
  191. <div class='table-footer'>
  192. <?php if($canBatchAction and $this->app->getViewType() != 'xhtml' and $config->vision == 'or'):?>
  193. <div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
  194. <div class='table-actions btn-toolbar'>
  195. <div class='btn-group dropup'>
  196. <?php echo html::commonButton($lang->roadmap->unlinkURAB, "id='batchUnlinkBtn'", 'btn btn-primary');?>
  197. <button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>
  198. <ul class='dropdown-menu'>
  199. <?php
  200. $class = "class='disabled'";
  201. $actionLink = $this->createLink('story', 'batchClose', "productID={$roadmap->product}&executionID=0&storyType=requirement");
  202. $misc = $canBatchClose ? "onclick=\"setFormAction('$actionLink', '', this)\"" : $class;
  203. echo "<li>" . html::a('#', $lang->close, '', $misc) . "</li>";
  204. $actionLink = $this->createLink('story', 'batchEdit', "productID=$roadmap->product&projectID=$projectID&branch=$branch&storyType=requirement");
  205. $misc = $canBatchEdit ? "onclick=\"setFormAction('$actionLink', '', this)\"" : $class;
  206. echo "<li>" . html::a('#', $lang->edit, '', $misc) . "</li>";
  207. if($canBatchChangeRoadmap)
  208. {
  209. $roadmapClass = in_array($roadmap->status, array('launching', 'launched', 'closed')) ? "disabled" : 'dropdown-submenu';
  210. $changeRoadmapTips = sprintf($lang->roadmap->changeRoadmapTips, strtolower(zget($lang->roadmap->statusList, $roadmap->status)));
  211. $roadmapTips = in_array($roadmap->status, array('launching', 'launched', 'closed')) ? "title='{$changeRoadmapTips}'" : '';
  212. echo "<li class='$roadmapClass' $roadmapTips>";
  213. echo html::a('javascript:;', $this->lang->roadmap->common, '', "id='roadmapItem'");
  214. echo "<div class='dropdown-menu with-search'>";
  215. echo '<ul class="dropdown-list" id=roadmapRows>';
  216. echo '</ul>';
  217. echo "<div class='menu-search' id='searchMenu'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></div>";
  218. echo "</li>";
  219. }
  220. else
  221. {
  222. echo '<li>' . html::a('javascript:;', $lang->roadmap->common, '', $class) . '</li>';
  223. }
  224. if($canBatchChangeBranch and $this->session->currentProductType != 'normal')
  225. {
  226. $withSearch = count($branchTagOption) > 8;
  227. echo "<li class='dropdown-submenu'>";
  228. echo html::a('javascript:;', $lang->product->branchName[$this->session->currentProductType], '', "id='branchItem'");
  229. echo "<div class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
  230. echo '<ul class="dropdown-list">';
  231. foreach($branchTagOption as $branchID => $branchName)
  232. {
  233. $actionLink = $this->createLink('story', 'batchChangeBranch', "branchID=$branchID");
  234. echo "<li class='option' data-key='$branchID'>" . html::a('#', $branchName, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin', this)\"") . "</li>";
  235. }
  236. echo '</ul>';
  237. if($withSearch) echo "<div class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></div>";
  238. echo '</div></li>';
  239. }
  240. if($canBatchChangeModule)
  241. {
  242. $withSearch = count($modules) > 8;
  243. echo "<li class='dropdown-submenu'>";
  244. echo html::a('javascript:;', $lang->story->moduleAB, '', "id='moduleItem'");
  245. echo "<div class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
  246. echo '<ul class="dropdown-list">';
  247. foreach($modules as $moduleId => $module)
  248. {
  249. $actionLink = $this->createLink('story', 'batchChangeModule', "moduleID=$moduleId");
  250. echo "<li class='option' data-key='$moduleId'>" . html::a('#', $module, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin', this)\"") . "</li>";
  251. }
  252. echo '</ul>';
  253. if($withSearch) echo "<div class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></div>";
  254. echo '</div></li>';
  255. }
  256. else
  257. {
  258. echo '<li>' . html::a('javascript:;', $lang->story->moduleAB, '', $class) . '</li>';
  259. }
  260. if($canBatchAssignTo)
  261. {
  262. $withSearch = count($users) > 10;
  263. $actionLink = $this->createLink('story', 'batchAssignTo', "productID=$roadmap->product");
  264. echo html::select('assignedTo', $users, '', 'class="hidden"');
  265. echo "<li class='dropdown-submenu'>";
  266. echo html::a('javascript::', $lang->story->assignedTo, '', 'id="assignItem"');
  267. echo "<div class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
  268. echo '<ul class="dropdown-list">';
  269. foreach ($users as $key => $value)
  270. {
  271. if(empty($key) or $key == 'closed') continue;
  272. echo "<li class='option' data-key='$key'>" . html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\", false, \"#storyList\")", $value, '', '') . '</li>';
  273. }
  274. echo "</ul>";
  275. if($withSearch) echo "<div class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></div>";
  276. echo "</div></li>";
  277. }
  278. else
  279. {
  280. echo '<li>' . html::a('javascript:;', $lang->story->assignedTo, '', $class) . '</li>';
  281. }
  282. ?>
  283. </ul>
  284. </div>
  285. </div>
  286. <?php endif;?>
  287. <?php if($this->app->getViewType() != 'xhtml'):?>
  288. <div class='table-statistic'><?php echo $summary;?></div>
  289. <?php endif;?>
  290. <?php
  291. $this->app->rawParams['type'] = 'story';
  292. $storyPager->show('right', 'pagerjs');
  293. $this->app->rawParams['type'] = $type;
  294. ?>
  295. </div>
  296. <?php endif;?>
  297. </form>
  298. </div>
  299. <div id='roadmapInfo' class='tab-pane <?php if($type == 'roadmapInfo') echo 'active';?>'>
  300. <div class='cell'>
  301. <div class='detail'>
  302. <div class='detail-title'><?php echo $lang->roadmap->basicInfo;?></div>
  303. <div class='detail-content'>
  304. <table class='table table-data table-condensed table-borderless'>
  305. <tr>
  306. <th class='w-80px strong'><?php echo $lang->roadmap->name;?></th>
  307. <td><?php echo $roadmap->name;?></td>
  308. </tr>
  309. <?php if($product->type != 'normal'):?>
  310. <tr>
  311. <th><?php echo $lang->product->branch;?></th>
  312. <?php
  313. $branches = '';
  314. foreach(explode(',', $branch) as $branchID) $branches .= "{$branchOption[$branchID]},";
  315. ?>
  316. <td><?php echo trim($branches, ',');?></td>
  317. </tr>
  318. <?php endif;?>
  319. <tr>
  320. <th><?php echo $lang->roadmap->begin;?></th>
  321. <td><?php echo $roadmap->begin == $config->roadmap->future ? $lang->roadmap->future : $roadmap->begin;?></td>
  322. </tr>
  323. <tr>
  324. <th><?php echo $lang->roadmap->end;?></th>
  325. <td><?php echo $roadmap->end == $config->roadmap->future ? $lang->roadmap->future : $roadmap->end;?></td>
  326. </tr>
  327. <?php $this->printExtendFields($roadmap, 'table', 'inForm=0');?>
  328. <tr>
  329. <th><?php echo $lang->roadmap->status;?></th>
  330. <td><?php echo $lang->roadmap->statusList[$roadmap->status];?></td>
  331. </tr>
  332. <tr>
  333. <th><?php echo $lang->roadmap->desc;?></th>
  334. <td><?php echo $roadmap->desc;?></td>
  335. </tr>
  336. </table>
  337. </div>
  338. </div>
  339. <?php if($this->app->getViewType() != 'xhtml') include $app->getModuleRoot() . 'common/view/action.html.php';?>
  340. </div>
  341. </div>
  342. </div>
  343. </div>
  344. </div>
  345. <?php js::set('param', helper::safe64Decode($param))?>
  346. <?php js::set('link', $link)?>
  347. <?php js::set('orderBy', $orderBy)?>
  348. <?php js::set('type', $type)?>
  349. <?php js::set('roadmapStories', $roadmapStories)?>
  350. <?php js::set('canBatchChangeRoadmap', $canBatchChangeRoadmap)?>
  351. <?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>