tablecontents.html.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. /**
  3. * The tableContents view file of doc 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 Shujie Tian<tianshujie@easycorp.ltd>
  7. * @package doc
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. jsVar('exportMethod', $exportMethod);
  12. $buildCreateLibBtn = function() use($type, $objectID, $libID)
  13. {
  14. if(!common::hasPriv('doc', 'createLib')) return null;
  15. global $lang;
  16. $createURL = createLink('doc', 'createLib', "type={$type}&objectID={$objectID}&libID={$libID}");
  17. $createLibBtn = function() use($createURL, $lang)
  18. {
  19. return btn
  20. (
  21. setClass('secondary createLib-btn'),
  22. set::icon('plus'),
  23. set::url($createURL),
  24. setData('toggle', 'modal'),
  25. setData('size', 'sm'),
  26. $lang->doc->createLib
  27. );
  28. };
  29. if($type != 'custom') return $createLibBtn();
  30. $buttonItems = array();
  31. if(common::hasPriv('doc', 'createSpace')) $buttonItems[] = array('text' => $lang->doc->createSpace, 'url' => createLink('doc', 'createSpace'), 'data-toggle' => 'modal', 'data-size' => 'sm', 'class' => 'createSpace-btn');
  32. if(empty($buttonItems)) return $createLibBtn();
  33. return btngroup
  34. (
  35. $createLibBtn(),
  36. dropdown
  37. (
  38. btn(setClass('btn secondary dropdown-toggle more-btn'),
  39. setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
  40. set::placement('bottom-end'),
  41. set::items($buttonItems)
  42. )
  43. );
  44. };
  45. if(empty($libTree))
  46. {
  47. featureBar();
  48. toolbar($buildCreateLibBtn());
  49. dtable(
  50. set::cols(array()),
  51. set::data(array()),
  52. set::createLink(createLink('doc', 'createLib', "type={$type}&objectID={$objectID}&libID={$libID}")),
  53. set::createTip($lang->doc->createLib),
  54. set::createAttr("data-toggle='modal'"),
  55. set::emptyTip($lang->doc->noLib)
  56. );
  57. if($objectID) include 'lefttree.html.php';
  58. return;
  59. }
  60. if(!empty($libTree)) include 'lefttree.html.php';
  61. if($libType != 'api' && $libID && common::hasPriv('doc', 'create')) include 'createbutton.html.php';
  62. if($canExport)
  63. {
  64. $exportLink = createLink('doc', $exportMethod, "libID={$libID}&moduleID={$moduleID}");
  65. if($libType == 'api') $exportLink = $this->createLink('api', $exportMethod, "libID={$libID}&version=0&release={$release}&moduleID={$moduleID}");
  66. }
  67. /* zin: Define the set::module('doc') feature bar on main menu. */
  68. featureBar
  69. (
  70. set::current($browseType),
  71. set::method('tableContents'),
  72. set::linkParams("objectID={$objectID}&libID={$libID}&moduleID={$moduleID}&browseType={key}"),
  73. li(searchToggle(set::module($type . $libType . 'Doc')))
  74. );
  75. toolbar
  76. (
  77. $libType == 'api' && common::hasPriv('api', 'struct') ? item(set(array
  78. (
  79. 'icon' => 'treemap',
  80. 'class' => 'ghost',
  81. 'text' => $lang->api->struct,
  82. 'url' => createLink('api', 'struct', "libID={$libID}")
  83. ))) : null,
  84. $libType == 'api' && common::hasPriv('api', 'releases') ? item(set(array
  85. (
  86. 'icon' => 'version',
  87. 'class' => 'ghost',
  88. 'text' => $lang->api->releases,
  89. 'url' => createLink('api', 'releases', "libID={$libID}"),
  90. 'data-toggle' => 'modal'
  91. ))) : null,
  92. $libType == 'api' && common::hasPriv('api', 'createRelease') ? item(set(array
  93. (
  94. 'icon' => 'publish',
  95. 'class' => 'ghost',
  96. 'text' => $lang->api->createRelease,
  97. 'url' => createLink('api', 'createRelease', "libID={$libID}"),
  98. 'data-toggle' => 'modal'
  99. ))) : null,
  100. $canExport ? item(set(array
  101. (
  102. 'id' => $exportMethod,
  103. 'icon' => 'export',
  104. 'class' => 'ghost export',
  105. 'text' => $lang->export,
  106. 'url' => $exportLink,
  107. 'data-size' => 'sm',
  108. 'data-toggle' => 'modal'
  109. ))) : null,
  110. $buildCreateLibBtn(),
  111. $libType == 'api' && common::hasPriv('api', 'create') ? item(set(array
  112. (
  113. 'icon' => 'plus',
  114. 'class' => 'btn primary ml-2',
  115. 'text' => $lang->api->createApi,
  116. 'url' => createLink('api', 'create', "libID={$libID}&moduleID={$moduleID}"),
  117. 'data-size' => 'lg',
  118. 'data-toggle' => 'modal'
  119. ))) : null,
  120. $libType != 'api' && $libID && common::hasPriv('doc', 'create') ? $createButton : null
  121. );
  122. if($browseType == 'annex')
  123. {
  124. include 'showfiles.html.php';
  125. }
  126. elseif($libType == 'api')
  127. {
  128. h::css(file_get_contents($app->getModuleRoot() . 'api/css/index.ui.css'));
  129. include '../../api/ui/index.html.php';
  130. }
  131. else
  132. {
  133. include 'doclist.html.php';
  134. }
  135. $docContent;