linkbug.html.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * The linkBug view file of productplan module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Wang Yidong <yidong@easycorp.ltd>
  7. * @package productplan
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('users', $users);
  12. $buildModule = $app->tab == 'project' ? 'projectbuild' : 'build';
  13. $cols = array();
  14. foreach($config->build->defaultFields['linkBug'] as $field)
  15. {
  16. $cols[$field] = zget($config->bug->dtable->fieldList, $field, array());
  17. if($field == 'resolvedBy')
  18. {
  19. $cols['resolvedByControl'] = $cols['resolvedBy'];
  20. $cols['resolvedByControl']['type'] = 'control';
  21. $cols['resolvedByControl']['control'] = 'picker';
  22. $cols['resolvedByControl']['controlItems'] = $users;
  23. $cols['resolvedByControl']['defaultValue'] = $app->user->account;
  24. unset($cols['resolvedBy']);
  25. }
  26. if($field != 'resolvedBy') $cols[$field]['sort'] = true;
  27. if(!empty($cols[$field]['sortType'])) unset($cols[$field]['sortType']);
  28. }
  29. $cols['title']['data-toggle'] = 'modal';
  30. $cols['title']['data-size'] = 'lg';
  31. $cols = array_map(function($col){$col['show'] = true; return $col;}, $cols);
  32. searchForm
  33. (
  34. set('zui-key', 'searchForm'),
  35. set::module('bug'),
  36. set::simple(true),
  37. set::show(true),
  38. set::onSearch(jsRaw("window.onSearchLinks.bind(null, 'bug')"))
  39. );
  40. dtable
  41. (
  42. setID('unlinkBugList'),
  43. set::userMap($users),
  44. set::checkable(true),
  45. set::cols($cols),
  46. set::data(array_values($allBugs)),
  47. set::loadPartial(true),
  48. set::extraHeight('+144'),
  49. set::onRenderCell(jsRaw('window.renderBugCell')),
  50. set::plugins(array('form')),
  51. set::footToolbar(array
  52. (
  53. 'items' => array(array
  54. (
  55. 'text' => $lang->build->linkBug,
  56. 'btnType' => 'primary',
  57. 'className' => 'size-sm linkObjectBtn',
  58. 'data-type' => 'bug',
  59. 'data-url' => createLink($buildModule, 'linkBug', "buildID=$build->id&browseType=$browseType&param=$param"),
  60. 'zui-on-click' => 'handleLinkObjectClick($target)'
  61. ))
  62. )),
  63. set::footer(array('checkbox', 'toolbar', array('html' => html::a(createLink($buildModule, 'view', "buildID=$build->id&type=bug"), $lang->goback, '', "class='btn size-sm'")), 'flex', 'pager')),
  64. set::footPager(usePager())
  65. );
  66. render();