view.html.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <?php
  2. /**
  3. * The view file of story 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 story
  9. * @version $Id: view.html.php 4952 2013-07-02 01:14:58Z 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/kindeditor.html.php';?>
  15. <?php $browseLink = $app->session->storyList ? $app->session->storyList : $this->createLink('product', 'browse', "productID=$story->product");?>
  16. <?php js::set('sysurl', common::getSysUrl());?>
  17. <?php if(strpos($_SERVER["QUERY_STRING"], 'isNotice=1') === false):?>
  18. <div id="mainMenu" class="clearfix">
  19. <div class="btn-toolbar pull-left">
  20. <?php if(!isonlybody()):?>
  21. <?php echo html::a($browseLink, '<i class="icon icon-back icon-sm"></i> ' . $lang->goback, '', "class='btn btn-secondary'");?>
  22. <div class="divider"></div>
  23. <?php endif;?>
  24. <div class="page-title">
  25. <span class="label label-id"><?php echo $story->id?></span>
  26. <span class="text" title='<?php echo $story->title;?>' style='color: <?php echo $story->color;?>'>
  27. <?php if($story->parent > 0) echo '<span class="label label-badge label-primary no-margin">' . $this->lang->story->childrenAB . '</span>';?>
  28. <?php if($story->parent > 0) echo isset($story->parentName) ? html::a(inlink('view', "storyID={$story->parent}"), $story->parentName) . ' / ' : '';?><?php echo $story->title;?>
  29. </span>
  30. <?php if($story->version > 1):?>
  31. <small class='dropdown'>
  32. <a href='#' data-toggle='dropdown' class='text-muted'><?php echo '#' . $version;?> <span class='caret'></span></a>
  33. <ul class='dropdown-menu'>
  34. <?php
  35. for($i = $story->version; $i >= 1; $i --)
  36. {
  37. $class = $i == $version ? " class='active'" : '';
  38. echo '<li' . $class .'>' . html::a(inlink('view', "storyID=$story->id&version=$i"), '#' . $i) . '</li>';
  39. }
  40. ?>
  41. </ul>
  42. </small>
  43. <?php endif; ?>
  44. <?php if($story->deleted):?>
  45. <span class='label label-danger'><?php echo $lang->story->deleted;?></span>
  46. <?php endif; ?>
  47. </div>
  48. </div>
  49. <?php if(!isonlybody()):?>
  50. <div class="btn-toolbar pull-right">
  51. <?php if(common::canModify('product', $product)): ?>
  52. <?php
  53. $otherParam = 'storyID=&projectID=';
  54. if($this->app->rawModule == 'projectstory') $otherParam = "storyID=&projectID={$this->session->project}";
  55. ?>
  56. <?php common::printLink('story', 'create', "productID={$story->product}&branch={$story->branch}&moduleID={$story->module}&$otherParam&bugID=0&planID=0&todoID=0&extra=&type=$story->type", "<i class='icon icon-plus'></i> " . $lang->story->create, '', "class='btn btn-primary' data-app='project'"); ?>
  57. <?php endif;?>
  58. </div>
  59. <?php endif;?>
  60. </div>
  61. <?php if($this->app->getViewType() == 'xhtml'):?>
  62. <div id="scrollContent">
  63. <?php endif;?>
  64. <?php endif;?>
  65. <div id="mainContent" class="main-row">
  66. <div class="main-col col-8">
  67. <div class="cell">
  68. <div class="detail">
  69. <div class="detail-title"><?php echo $lang->story->legendSpec;?></div>
  70. <div class="detail-content article-content"><?php echo $story->spec;?></div>
  71. </div>
  72. <?php echo $this->fetch('file', 'printFiles', array('files' => $story->files, 'fieldset' => 'true', 'object' => $story, 'method' => 'view', 'showDelete' => false));?>
  73. <?php
  74. $canBeChanged = common::canBeChanged('story', $story);
  75. if($canBeChanged) $actionFormLink = $this->createLink('action', 'comment', "objectType=story&objectID=$story->id");
  76. ?>
  77. <?php if(!empty($story->children)):?>
  78. <div class='detail'>
  79. <div class='detail-title'><?php echo $this->lang->story->children;?></div>
  80. <div class='detail-content article-content'>
  81. <table class='table table-hover table-fixed'>
  82. <thead>
  83. <tr class='text-center'>
  84. <th class='w-50px'> <?php echo $lang->story->id;?></th>
  85. <th class='w-40px'> <?php echo $lang->priAB;?></th>
  86. <th> <?php echo $lang->story->title;?></th>
  87. <th class='w-100px'><?php echo $lang->story->assignedTo;?></th>
  88. <th class='w-90px'> <?php echo $lang->story->estimate;?></th>
  89. <th class='w-80px'> <?php echo $lang->story->status;?></th>
  90. <th class='w-230px'><?php echo $lang->actions;?></th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. <?php foreach($story->children as $child):?>
  95. <tr class='text-center'>
  96. <td><?php echo $child->id;?></td>
  97. <td>
  98. <?php
  99. echo "<span class='pri-" . $child->pri . "'>";
  100. echo $child->pri == '0' ? '' : zget($this->lang->story->priList, $child->pri, $child->pri);
  101. echo "</span>";
  102. ?>
  103. </td>
  104. <td class='text-left' title='<?php echo $child->title;?>'><a class="iframe" data-width="90%" href="<?php echo $this->createLink('story', 'view', "storyID=$child->id", '', true); ?>"><?php echo $child->title;?></a></td>
  105. <td><?php echo zget($users, $child->assignedTo);?></td>
  106. <td title="<?php echo $child->estimate . ' ' . $lang->hourCommon;?>"><?php echo $child->estimate . $config->hourUnit;?></td>
  107. <td><?php echo $this->processStatus('story', $child);?></td>
  108. <td class='c-actions'>
  109. <?php
  110. common::printIcon('story', 'change', "storyID=$child->id", $child, 'list', 'alter');
  111. if(strpos('draft,changing', $child->status) !== false)
  112. {
  113. common::printIcon('story', 'submitReview', "storyID=$child->id", $child, 'list', 'confirm', '', 'iframe showinonlybody', true);
  114. }
  115. else
  116. {
  117. common::printIcon('story', 'review', "storyID=$child->id", $child, 'list', 'search', '', 'iframe showinonlybody', true);
  118. }
  119. common::printIcon('story', 'assignTo', "storyID=$child->id", $child, 'list', '', '', 'iframe showinonlybody', true);
  120. common::printIcon('story', 'close', "storyID=$child->id", $child, 'list', '', '', 'iframe showinonlybody', true);
  121. common::printIcon('story', 'activate', "storyID=$child->id", $child, 'list', '', '', 'iframe showinonlybody', true);
  122. common::printIcon('story', 'edit', "storyID=$child->id", $child, 'list');
  123. ?>
  124. </td>
  125. </tr>
  126. <?php endforeach;?>
  127. </tbody>
  128. </table>
  129. </div>
  130. </div>
  131. <?php endif;?>
  132. </div>
  133. <?php $this->printExtendFields($story, 'div', "position=left&inForm=0&inCell=1");?>
  134. <?php if($this->app->getViewType() != 'xhtml'):?>
  135. <div class="cell"><?php include $this->app->getModuleRoot() . 'common/view/action.html.php';?></div>
  136. <?php endif;?>
  137. <div class='main-actions'>
  138. <div class="btn-toolbar">
  139. <?php common::printBack($browseLink);?>
  140. <?php if(!isonlybody()) echo "<div class='divider'></div>";?>
  141. <?php if(!$story->deleted):?>
  142. <?php
  143. common::printIcon('story', 'change', "storyID=$story->id", $story, 'button', 'alter', '', 'showinonlybody');
  144. if(strpos('draft,changing', $story->status) !== false)
  145. {
  146. common::printIcon('story', 'submitReview', "storyID=$story->id", $story, 'button', 'confirm', '', 'iframe showinonlybody', true);
  147. }
  148. else
  149. {
  150. common::printIcon('story', 'review', "storyID=$story->id", $story, 'button', 'search', '', 'iframe showinonlybody', true);
  151. }
  152. if($story->status == 'active' and $story->stage == 'wait' and $story->parent <= 0 and !isonlybody())
  153. {
  154. $divideLang = $lang->story->subdivide;
  155. $misc = "class='btn divideStory' data-toggle='modal' data-type='iframe' data-width='95%'";
  156. $link = $this->createLink('story', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", '', true);
  157. if(common::hasPriv('story', 'batchCreate', $story)) echo html::a($link, "<i class='icon icon-split'></i> " . $divideLang, '', $misc);
  158. }
  159. common::printIcon('story', 'assignTo', "storyID=$story->id", $story, 'button', '', '', 'iframe showinonlybody', true);
  160. common::printIcon('story', 'close', "storyID=$story->id", $story, 'button', '', '', 'iframe showinonlybody', true);
  161. common::printIcon('story', 'activate', "storyID=$story->id", $story, 'button', '', '', 'iframe showinonlybody', true);
  162. if($from == 'execution' and strpos('draft,reviewing,closed', $story->status) === false) common::printIcon('task', 'create', "execution=$param&storyID=$story->id&moduleID=$story->module", $story, 'button', 'plus', '', 'showinonlybody');
  163. echo "<div class='divider'></div>";
  164. common::printIcon('story', 'edit', "storyID=$story->id", $story);
  165. common::printIcon('story', 'create', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id&executionID=0&bugID=0&planID=0&todoID=0&extra=&type=$story->type", $story, 'button', 'copy', '', '', '', "data-width='1050'");
  166. common::printIcon('story', 'delete', "storyID=$story->id", $story, 'button', 'trash', 'hiddenwin');
  167. ?>
  168. <?php endif;?>
  169. </div>
  170. </div>
  171. </div>
  172. <div class="side-col col-4">
  173. <div class="cell">
  174. <div class='tabs'>
  175. <ul class='nav nav-tabs'>
  176. <li class='active'><a href='#legendBasicInfo' data-toggle='tab'><?php echo $lang->story->legendBasicInfo;?></a></li>
  177. <li><a href='#legendLifeTime' data-toggle='tab'><?php echo $lang->story->legendLifeTime;?></a></li>
  178. </ul>
  179. <div class='tab-content'>
  180. <div class='tab-pane active' id='legendBasicInfo'>
  181. <table class="table table-data">
  182. <tbody>
  183. <tr class='w-90px'>
  184. <th><?php echo $lang->story->module;?></th>
  185. <?php
  186. $moduleTitle = '';
  187. ob_start();
  188. if(empty($modulePath))
  189. {
  190. $moduleTitle .= '/';
  191. echo "/";
  192. }
  193. else
  194. {
  195. if($storyModule->branch and isset($branches[$storyModule->branch]))
  196. {
  197. $moduleTitle .= $branches[$storyModule->branch] . '/';
  198. echo $branches[$storyModule->branch] . $lang->arrow;
  199. }
  200. foreach($modulePath as $key => $module)
  201. {
  202. $moduleTitle .= $module->name;
  203. if(!common::printLink('projectstory', 'story', "projectID={$this->session->project}&productID=$story->product&branch=$story->branch&browseType=byModule&param=$module->id", $module->name, '', "data-app='project'")) echo $module->name;
  204. if(isset($modulePath[$key + 1]))
  205. {
  206. $moduleTitle .= '/';
  207. echo $lang->arrow;
  208. }
  209. }
  210. }
  211. $printModule = ob_get_contents();
  212. ob_end_clean();
  213. ?>
  214. <td title='<?php echo $moduleTitle?>'><?php echo $printModule?></td>
  215. </tr>
  216. <tr>
  217. <th><?php echo $lang->story->status;?></th>
  218. <td><span class='status-story status-<?php echo $story->status?>'><span class="label label-dot"></span> <?php echo $this->processStatus('story', $story);?></span></td>
  219. </tr>
  220. <tr>
  221. <th><?php echo $lang->story->pri;?></th>
  222. <td><span class='label-pri <?php echo 'label-pri-' . $story->pri;?>' title='<?php echo zget($lang->story->priList, $story->pri)?>'><?php echo zget($lang->story->priList, $story->pri)?></span></td>
  223. </tr>
  224. <tr>
  225. <th><?php echo $lang->story->estimate;?></th>
  226. <td title="<?php echo $story->estimate . ' ' . $lang->hourCommon;?>"><?php echo $story->estimate . $config->hourUnit;?></td>
  227. </tr>
  228. <tr>
  229. <th><?php echo $lang->story->keywords;?></th>
  230. <td><?php echo $story->keywords;?></td>
  231. </tr>
  232. <tr>
  233. <th><?php echo $lang->story->legendMailto;?></th>
  234. <td>
  235. <?php
  236. if(!empty($story->mailto))
  237. {
  238. foreach(explode(',', $story->mailto) as $account)
  239. {
  240. if(empty($account)) continue;
  241. echo "<span>" . zget($users, trim($account)) . '</span> &nbsp;';
  242. }
  243. }
  244. ?>
  245. </td>
  246. </tr>
  247. </tbody>
  248. </table>
  249. </div>
  250. <div class='tab-pane' id='legendLifeTime'>
  251. <table class="table table-data">
  252. <tbody>
  253. <tr>
  254. <th class='thWidth'><?php echo $lang->story->openedBy;?></th>
  255. <td><?php echo zget($users, $story->openedBy) . $lang->at . $story->openedDate;?></td>
  256. </tr>
  257. <tr>
  258. <th><?php echo $lang->story->assignedTo;?></th>
  259. <td><?php if($story->assignedTo) echo zget($users, $story->assignedTo) . $lang->at . $story->assignedDate;?></td>
  260. </tr>
  261. <tr>
  262. <th><?php echo $lang->story->reviewers;?></th>
  263. <td>
  264. <?php
  265. if($reviewers)
  266. {
  267. foreach($reviewers as $reviewer => $result)
  268. {
  269. echo !empty($result) ? '<span style="color: #cbd0db" title="' . $lang->story->reviewed . '"> ' . zget($users, $reviewer) . '</span>' : '<span title="' . $lang->story->toBeReviewed .'"> ' . zget($users, $reviewer) . '</span>';
  270. }
  271. }
  272. ?>
  273. </td>
  274. </tr>
  275. <tr>
  276. <th><?php echo $lang->story->reviewedDate;?></th>
  277. <td><?php if($story->reviewedBy) echo $story->reviewedDate;?></td>
  278. </tr>
  279. <tr>
  280. <th><?php echo $lang->story->closedBy;?></th>
  281. <td><?php if($story->closedBy) echo zget($users, $story->closedBy) . $lang->at . $story->closedDate;?></td>
  282. </tr>
  283. <tr>
  284. <th><?php echo $lang->story->closedReason;?></th>
  285. <td>
  286. <?php
  287. if($story->closedReason) echo $lang->story->reasonList[$story->closedReason];
  288. if(isset($story->extraStories[$story->duplicateStory]))
  289. {
  290. echo html::a(inlink('view', "storyID=$story->duplicateStory"), '#' . $story->duplicateStory . ' ' . $story->extraStories[$story->duplicateStory]);
  291. }
  292. ?>
  293. </td>
  294. </tr>
  295. <tr>
  296. <th><?php echo $lang->story->lastEditedBy;?></th>
  297. <td><?php if($story->lastEditedBy) echo zget($users, $story->lastEditedBy) . $lang->at . $story->lastEditedDate;?></td>
  298. </tr>
  299. </tbody>
  300. </table>
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. <div class="cell">
  306. <div class='tabs'>
  307. <ul class='nav nav-tabs'>
  308. <li class="active"><a href='#legendProjectAndTask' data-toggle='tab'><?php echo $lang->story->legendProjectAndTask;?></a></li>
  309. </ul>
  310. <div class='tab-content'>
  311. <div class="tab-pane active" id='legendProjectAndTask'>
  312. <ul class="list-unstyled">
  313. <?php
  314. foreach($story->tasks as $executionTasks)
  315. {
  316. foreach($executionTasks as $task)
  317. {
  318. if(!isset($executions[$task->execution])) continue;
  319. $executionName = $executions[$task->execution];
  320. $taskInfo = $task->id . '&nbsp<span class="label label-success label-outline">' . $this->lang->task->statusList[$task->status] . '</span>&nbsp' . $task->name;
  321. $class = isonlybody() ? 'showinonlybody' : 'iframe';
  322. echo "<li title='$task->name'>" . html::a($this->createLink('task', 'view', "taskID=$task->id", '', true), $taskInfo, '', "class=$class data-width='80%'");
  323. echo html::a($this->createLink('execution', 'browse', "executionID=$task->execution"), $executionName, '', "class='text-muted'") . '</li>';
  324. }
  325. }
  326. if(count($story->tasks) == 0)
  327. {
  328. foreach($story->executions as $executionID => $execution)
  329. {
  330. echo "<li title='$execution->name'>" . html::a($this->createLink('execution', 'browse', "executionID=$executionID"), $execution->name, '', "class='text-muted'") . '</li>';
  331. }
  332. }
  333. ?>
  334. </ul>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339. <?php $this->printExtendFields($story, 'div', "position=right&inForm=0&inCell=1");?>
  340. </div>
  341. </div>
  342. <?php if($this->app->getViewType() == 'xhtml'):?>
  343. </div>
  344. <?php endif;?>
  345. <div id="mainActions" class='main-actions'>
  346. <?php common::printPreAndNext($preAndNext);?>
  347. </div>
  348. <?php
  349. js::set('canCreate', common::hasPriv('story', 'story'));
  350. js::set('createStory', $lang->story->create);
  351. js::set('productID', $story->product);
  352. js::set('branch', $story->branch);
  353. js::set('moduleID', $story->module);
  354. js::set('storyType', $story->type);
  355. js::set('unlink', $lang->story->unlink);
  356. js::set('cancel', $lang->cancel);
  357. js::set('rawModule', $this->app->rawModule);
  358. ?>
  359. <script>
  360. </script>
  361. <?php include $this->app->getModuleRoot() . 'common/view/syntaxhighlighter.html.php';?>
  362. <?php include $this->app->getModuleRoot() . 'common/view/footer.html.php';?>