mydoclist.html.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * The mydoclist 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('spaceMethodList', $config->doc->spaceMethod);
  12. jsVar('myspacePriv', common::hasPriv('doc', 'myspace'));
  13. jsVar('productspacePriv', common::hasPriv('doc', 'productspace'));
  14. jsVar('projectspacePriv', common::hasPriv('doc', 'projectspace'));
  15. jsVar('teamspacePriv', common::hasPriv('doc', 'teamspace'));
  16. $cols = array();
  17. $config->doc->dtable->fieldList['actions']['menu'] = array('edit', 'movedoc', 'delete');
  18. foreach($config->doc->dtable->fieldList as $colName => $col)
  19. {
  20. if($type == 'mine' && in_array($colName, array('objectName', 'module', 'editedBy'))) continue;
  21. if($colName == 'addedBy' && in_array($type, array('mine', 'createdby'))) continue;
  22. if($canExport && $colName == 'id') $col['type'] = 'checkID';
  23. $cols[$colName] = $col;
  24. }
  25. $params = "libID={$libID}&moduleID={$moduleID}&browseType={$browseType}&param={$param}&orderBy={$orderBy}&recTotal={recTotal}&recPerPage={recPerPage}&pageID={page}";
  26. $sortParams = "libID={$libID}&moduleID={$moduleID}&browseType={$browseType}&param={$param}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";
  27. $tableData = empty($docs) ? array() : initTableData($docs, $cols);
  28. $createType = empty($lib) ? '' : $lib->type;
  29. $createDocLink = '';
  30. if($browseType != 'bysearch' && $libID && common::hasPriv('doc', 'create')) $createDocLink = createLink('doc', 'create', "objectType={$createType}&objectID={$objectID}&libID={$libID}&moduleID={$moduleID}&type=html");
  31. if($app->rawMethod == 'myspace')
  32. {
  33. $sortParams = "type={$type}&" . $sortParams;
  34. $params = "type={$type}&" . $params;
  35. }
  36. /* Remove move doc action when doc under project/product/execution. */
  37. foreach($tableData as $key => $row)
  38. {
  39. if(($row->project || $row->product || $row->execution) && isset($row->actions))
  40. {
  41. foreach($row->actions as $id => $action)
  42. {
  43. if($action['name'] == 'movedoc')
  44. {
  45. $tableData[$key]->actions[$id]['disabled'] = true;
  46. break;
  47. }
  48. }
  49. }
  50. }
  51. $docContent = dtable
  52. (
  53. setID('docTable'),
  54. set::iconList($config->doc->iconList),
  55. set::draftText($lang->doc->draft),
  56. set::canViewDoc(common::hasPriv('doc', 'view')),
  57. set::canCollect(common::hasPriv('doc', 'collect') && $libType && $libType != 'api'),
  58. set::currentAccount($app->user->account),
  59. set::currentTab($app->tab),
  60. set::userMap($users),
  61. set::cols($cols),
  62. set::data($tableData),
  63. set::checkable($canExport),
  64. set::onRenderCell(jsRaw('window.rendDocCell')),
  65. set::emptyTip($lang->doc->noDoc),
  66. set::createLink($createDocLink),
  67. set::createTip($lang->doc->create),
  68. set::orderBy($orderBy),
  69. set::sortable(boolval($canUpdateOrder)),
  70. set::onSortEnd(jsRaw('window.onSortEnd')),
  71. set::plugins(array('sortable')),
  72. set::sortLink(createLink('doc', $app->rawMethod, $sortParams)),
  73. set::footPager(usePager(array('linkCreator' => helper::createLink('doc', $app->rawMethod, $params))))
  74. );