From e9286e13d8a661ab645fef9bbb6fcf601b2089cf Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Thu, 12 Nov 2020 11:04:17 +0800 Subject: [PATCH] * Finish task #8194. --- module/doc/control.php | 17 ++++++++++++----- module/doc/view/browsebygrid.html.php | 4 +++- module/doc/view/objectlibs.html.php | 2 +- module/doc/view/objectlibsbylist.html.php | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 17242bec45..3947ea8fcb 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -853,8 +853,14 @@ class doc extends control setcookie('from', $from, $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(); if(empty($object)) $this->locate($this->createLink($type, 'create')); + + /* 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; + if($from == 'product') { $this->lang->doc->menu = $this->lang->product->menu; @@ -891,10 +897,11 @@ class doc extends control $this->view->title = $object->name; $this->view->position[] = $object->name; - $this->view->type = $type; - $this->view->object = $object; - $this->view->from = $from; - $this->view->libs = $this->doc->getLibsByObject($type, $objectID); + $this->view->type = $type; + $this->view->object = $object; + $this->view->from = $from; + $this->view->libs = $this->doc->getLibsByObject($type, $objectID); + $this->view->changeAllowed = $changeAllowed; $this->display(); } } diff --git a/module/doc/view/browsebygrid.html.php b/module/doc/view/browsebygrid.html.php index 950a1bf8a9..698c907977 100644 --- a/module/doc/view/browsebygrid.html.php +++ b/module/doc/view/browsebygrid.html.php @@ -16,7 +16,7 @@ ", '', "title='{$lang->doc->browseTypeList['grid']}' class='btn btn-icon text-primary'");?> ", '', "title='{$lang->doc->browseTypeList['list']}' class='btn btn-icon'");?> - + diff --git a/module/doc/view/objectlibs.html.php b/module/doc/view/objectlibs.html.php index 8eb9f68835..b77fad66d9 100644 --- a/module/doc/view/objectlibs.html.php +++ b/module/doc/view/objectlibs.html.php @@ -57,7 +57,7 @@ collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?> collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
- + " title="" class='btn btn-link ajaxCollect'> diff --git a/module/doc/view/objectlibsbylist.html.php b/module/doc/view/objectlibsbylist.html.php index caa5926713..1e32f50ed2 100644 --- a/module/doc/view/objectlibsbylist.html.php +++ b/module/doc/view/objectlibsbylist.html.php @@ -34,7 +34,7 @@ name);?> allCount . $lang->doc->item;?> - + collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?> collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>