From 8b1e4808c29f3e551c58ee1840b5738fd3f6300d Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Tue, 10 Nov 2020 08:49:00 +0800 Subject: [PATCH 1/2] * Finish task #8194. --- module/doc/control.php | 28 +++++++----- module/doc/view/browse.html.php | 2 +- module/doc/view/objectlibs.html.php | 2 + module/doc/view/showfiles.html.php | 2 +- module/product/view/browse.html.php | 2 + module/productplan/view/browse.html.php | 4 +- module/productplan/view/view.html.php | 12 ++--- module/project/view/bug.html.php | 2 + module/project/view/burn.html.php | 2 +- module/project/view/grouptask.html.php | 4 ++ module/project/view/story.html.php | 61 +++++++++++++------------ module/project/view/task.html.php | 2 + module/project/view/tree.html.php | 2 + module/release/view/browse.html.php | 2 + module/release/view/view.html.php | 34 +++++++------- module/story/control.php | 2 +- module/story/view/view.html.php | 4 +- 17 files changed, 99 insertions(+), 68 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 6e71529464..17242bec45 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -754,7 +754,12 @@ class doc extends control setcookie('docFilesViewType', $viewType, $this->config->cookieLife, $this->config->webRoot, '', false, true); $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT; - $object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch(); + $object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch(); + + /* Determines whether an object is editable. */ + $changeAllowed = true; + if($type == 'product' and !empty($this->config->global->closedProductStatus) and $object->status == 'closed') $changeAllowed = false; + if($type == 'project' and !empty($this->config->global->closedProjectStatus) and $object->status == 'closed') $changeAllowed = false; /* According the from, set menus. */ if($this->from == 'product') @@ -799,17 +804,18 @@ class doc extends control $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $this->view->title = $object->name; - $this->view->position[] = $object->name; + $this->view->title = $object->name; + $this->view->position[] = $object->name; - $this->view->type = $type; - $this->view->object = $object; - $this->view->files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager); - $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->pager = $pager; - $this->view->viewType = $viewType; - $this->view->orderBy = $orderBy; - $this->view->objectID = $objectID; + $this->view->type = $type; + $this->view->object = $object; + $this->view->files = $this->doc->getLibFiles($type, $objectID, $orderBy, $pager); + $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->view->pager = $pager; + $this->view->viewType = $viewType; + $this->view->orderBy = $orderBy; + $this->view->objectID = $objectID; + $this->view->changeAllowed = $changeAllowed; $this->display(); } diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php index 5d97f8c762..15c838008d 100644 --- a/module/doc/view/browse.html.php +++ b/module/doc/view/browse.html.php @@ -42,7 +42,7 @@ var browseType = ''; ", '', "title='{$lang->doc->browseTypeList['grid']}' class='btn btn-icon'");?> ", '', "title='{$lang->doc->browseTypeList['list']}' class='btn btn-icon text-primary'");?> - +
productplan->noPlan;?> - + config->global->closedProductStatus) or $product->status != 'closed') and common::hasPriv('productplan', 'create')):?> createLink('productplan', 'create', "productID=$product->id&branch=$branch"), " " . $lang->productplan->create, '', "class='btn btn-info'");?>
diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index 094cdb4773..80d6da9e63 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -42,9 +42,9 @@ { echo $this->buildOperateMenu($plan, 'view'); - if(common::hasPriv('productplan', 'create') and $plan->parent <= '0') echo html::a($this->createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"), " " . $this->lang->productplan->children , '', "class='btn btn-link' title='{$this->lang->productplan->children}'"); - if(common::hasPriv('productplan', 'edit')) echo html::a($this->createLink('productplan', 'edit', "planID=$plan->id"), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'"); - if(common::hasPriv('productplan', 'delete') and $plan->parent >= 0) echo html::a($this->createLink('productplan', 'delete', "planID=$plan->id"), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'"); + if(common::hasPriv('productplan', 'create', $plan) and $plan->parent <= '0') echo html::a($this->createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"), " " . $this->lang->productplan->children , '', "class='btn btn-link' title='{$this->lang->productplan->children}'"); + if(common::hasPriv('productplan', 'edit', $plan)) echo html::a($this->createLink('productplan', 'edit', "planID=$plan->id"), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'"); + if(common::hasPriv('productplan', 'delete', $plan) and $plan->parent >= 0) echo html::a($this->createLink('productplan', 'delete', "planID=$plan->id"), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'"); } ?>