diff --git a/module/doc/control.php b/module/doc/control.php index f6b3bf117a..63e5c7b261 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -289,6 +289,7 @@ class doc extends control public function createLib(string $type = '', int $objectID = 0, int $libID = 0) { $this->app->loadLang('api'); + $this->doc->setMenuByType($type, (int)$objectID, (int)$libID); if(!empty($_POST)) { @@ -308,10 +309,10 @@ class doc extends control } $objects = array(); - if($type == 'project' && $this->app->tab == 'doc') + if($type == 'project') { - $this->view->executionPairs = $this->execution->getPairs($objectID, 'all', 'multiple,leaf,noprefix'); - $this->view->project = $this->project->getById($objectID); + $this->view->project = $this->project->getById($objectID); + if($this->app->tab == 'doc') $this->view->executionPairs = $this->execution->getPairs($objectID, 'all', 'multiple,leaf,noprefix'); } if($type == 'execution') @@ -319,6 +320,7 @@ class doc extends control $objects = $this->execution->getPairs(0, 'all', 'multiple,leaf,noprefix,withobject'); $execution = $this->execution->getByID($objectID); if($execution->type == 'stage') $this->lang->doc->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->execution); + $this->view->execution = $this->doc->fetchByID($objectID, 'execution'); } if($type == 'custom' || $type == 'mine' || $type == 'doctemplate') @@ -1804,6 +1806,7 @@ class doc extends control $this->doc->setMenuByType($type, $spaceID, $libID); $objectKey = $type . 'ID'; $this->view->$objectKey = $spaceID; + $this->view->$type = $this->doc->fetchByID($spaceID, $type); } if($type == 'mine') $menuType = 'my'; diff --git a/module/doc/ui/app.html.php b/module/doc/ui/app.html.php index 156f19e25b..0c3744883f 100644 --- a/module/doc/ui/app.html.php +++ b/module/doc/ui/app.html.php @@ -25,26 +25,27 @@ if($type === 'project') * 定义文档界面上的权限。 * Define the privs of doc app. */ -$hasCustomSpace = $type == 'mine' || $type == 'custom'; +$hasCustomSpace = $type == 'mine' || $type == 'custom'; +$projectTemplate = ($type === 'project' && !empty($project->isTpl)) || ($type == 'execution' && !empty($execution->isTpl)); $privs = array(); -$privs['create'] = hasPriv('doc', 'create'); -$privs['edit'] = hasPriv('doc', 'edit'); -$privs['delete'] = hasPriv('doc', 'delete'); +$privs['create'] = hasPriv('doc', 'create') && !$projectTemplate; +$privs['edit'] = hasPriv('doc', 'edit') && !$projectTemplate; +$privs['delete'] = hasPriv('doc', 'delete') && !$projectTemplate; $privs['view'] = hasPriv('doc', 'view'); $privs['effort'] = $this->config->edition != 'open' && hasPriv('effort', 'createForObject'); -$privs['exportDoc'] = $this->config->edition != 'open' && hasPriv('doc', $type . '2export'); +$privs['exportDoc'] = $this->config->edition != 'open' && hasPriv('doc', $type . '2export') && !$projectTemplate; $privs['exportApi'] = $this->config->edition != 'open' && hasPriv('api', 'export'); -$privs['moveDoc'] = hasPriv('doc', 'moveDoc'); +$privs['moveDoc'] = hasPriv('doc', 'moveDoc') && !$projectTemplate; $privs['collect'] = hasPriv('doc', 'collect'); $privs['createLib'] = hasPriv('doc', 'createLib'); $privs['editLib'] = hasPriv('doc', 'editLib'); -$privs['moveLib'] = hasPriv('doc', 'moveLib'); +$privs['moveLib'] = hasPriv('doc', 'moveLib') && !$projectTemplate; $privs['deleteLib'] = hasPriv('doc', 'deleteLib'); $privs['sortDocLib'] = hasPriv('doc', 'sortDocLib'); -$privs['uploadFile'] = hasPriv('doc', 'create'); +$privs['uploadFile'] = hasPriv('doc', 'create') && !$projectTemplate; $privs['editFile'] = hasPriv('file', 'edit'); $privs['deleteFile'] = hasPriv('doc', 'deleteFile'); -$privs['exportFiles'] = hasPriv('doc', 'exportFiles'); +$privs['exportFiles'] = hasPriv('doc', 'exportFiles') && !$projectTemplate; $privs['createSpace'] = $hasCustomSpace && hasPriv('doc', 'createSpace'); $privs['deleteSpace'] = $hasCustomSpace && hasPriv('doc', 'deleteSpace'); $privs['editSpace'] = $hasCustomSpace && hasPriv('doc', 'editSpace'); diff --git a/module/doc/ui/createlib.html.php b/module/doc/ui/createlib.html.php index dcadcd160f..121cb7b93c 100644 --- a/module/doc/ui/createlib.html.php +++ b/module/doc/ui/createlib.html.php @@ -26,6 +26,7 @@ $renderObjectBox = function(string $type) use ($lang, $objects, $objectID) return formRow( setClass('objectBox'), formGroup( + set::id('object'), set::width('5/6'), set::label($lang->doc->{$type}), set::name($type),