From 4e69741e7013929d51b2bee99f44e232149acdcb Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Thu, 12 Nov 2020 14:18:08 +0800 Subject: [PATCH] * Finish task #8194. --- module/doc/model.php | 9 +++++++- module/project/control.php | 29 +++++++++++++++----------- module/project/view/treestory.html.php | 4 ++-- module/project/view/treetask.html.php | 6 +++--- module/project/view/view.html.php | 4 ++-- module/story/view/view.html.php | 2 +- module/testcase/view/view.html.php | 6 +++--- 7 files changed, 36 insertions(+), 24 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index e08db05a43..a399234707 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -107,8 +107,15 @@ class docModel extends model } } + /* Determines whether the doc lib is editable. */ + $docLib = new stdClass(); + $docLib->product = $productID; + $docLib->project = $projectID; + $changeAllowed = common::checkObjectChangeAllowed('doc', $docLib); + + $lib = isset($lib) ? $lib : new stdClass(); $actions = $this->setFastMenu($fastLib); - $actions .= common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib', "type={$type}&objectID={$currentLib}"), " " . $this->lang->doc->createLib, '', "class='btn btn-secondary iframe'") : ''; + $actions .= ($changeAllowed and common::hasPriv('doc', 'createLib', $lib)) ? html::a(helper::createLink('doc', 'createLib', "type={$type}&objectID={$currentLib}"), " " . $this->lang->doc->createLib, '', "class='btn btn-secondary iframe'") : ''; $this->lang->TRActions = $actions; } diff --git a/module/project/control.php b/module/project/control.php index 5d75a981b0..7672abbd4e 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1576,6 +1576,10 @@ class project extends control $project = $this->project->getById($projectID, true); if(!$project) die(js::error($this->lang->notFound) . js::locate('back')); + /* Determines whether an object is editable. */ + $changeAllowed = true; + if(!empty($this->config->global->closedProjectStatus) and $project->status == 'closed') $changeAllowed = false; + $products = $this->project->getProducts($project->id); $linkedBranches = array(); foreach($products as $product) @@ -1600,18 +1604,19 @@ class project extends control $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); $this->view->position[] = $this->view->title; - $this->view->project = $project; - $this->view->products = $products; - $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), '', $linkedBranches); - $this->view->planGroups = $this->project->getPlans($products); - $this->view->groups = $this->loadModel('group')->getPairs(); - $this->view->actions = $this->loadModel('action')->getList('project', $projectID); - $this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager, 'all', $projectID); - $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->teamMembers = $this->project->getTeamMembers($projectID); - $this->view->docLibs = $this->loadModel('doc')->getLibsByObject('project', $projectID); - $this->view->statData = $this->project->statRelatedData($projectID); - $this->view->chartData = $chartData; + $this->view->project = $project; + $this->view->products = $products; + $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), '', $linkedBranches); + $this->view->planGroups = $this->project->getPlans($products); + $this->view->groups = $this->loadModel('group')->getPairs(); + $this->view->actions = $this->loadModel('action')->getList('project', $projectID); + $this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager, 'all', $projectID); + $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->view->teamMembers = $this->project->getTeamMembers($projectID); + $this->view->docLibs = $this->loadModel('doc')->getLibsByObject('project', $projectID); + $this->view->statData = $this->project->statRelatedData($projectID); + $this->view->chartData = $chartData; + $this->view->changeAllowed = $changeAllowed; $this->display(); } diff --git a/module/project/view/treestory.html.php b/module/project/view/treestory.html.php index 593fb0ba83..436360f244 100644 --- a/module/project/view/treestory.html.php +++ b/module/project/view/treestory.html.php @@ -32,7 +32,7 @@ verify) ? $story->verify : "
" . $lang->noData . '
';?> -fetch('file', 'printFiles', array('files' => $story->files, 'fieldset' => 'true'));?> +fetch('file', 'printFiles', array('files' => $story->files, 'fieldset' => 'true', 'object' => $story));?>
story->legendBasicInfo;?> @@ -341,7 +341,7 @@
-createLink('action', 'comment', "objectType=story&objectID=$story->id");?> +createLink('action', 'comment', "objectType=story&objectID=$story->id");?>