* Finish task #8194.

This commit is contained in:
holan20180123
2020-11-12 11:04:17 +08:00
parent 8acfd6867f
commit e9286e13d8
4 changed files with 17 additions and 8 deletions
+12 -5
View File
@@ -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();
}
}
+3 -1
View File
@@ -16,7 +16,7 @@
<?php echo html::a('javascript:setBrowseType("bygrid")', "<i class='icon icon-cards-view'></i>", '', "title='{$lang->doc->browseTypeList['grid']}' class='btn btn-icon text-primary'");?>
<?php echo html::a('javascript:setBrowseType("bylist")', "<i class='icon icon-bars'></i>", '', "title='{$lang->doc->browseTypeList['list']}' class='btn btn-icon'");?>
</div>
<?php if($libID):?>
<?php if($libID and common::checkObjectChangeAllowed('doc', $currentLib)):?>
<div class="dropdown">
<button class="btn" type="button" data-toggle="dropdown"><i class='icon-cog'></i> <span class="caret"></span></button>
<ul class='dropdown-menu'>
@@ -133,11 +133,13 @@
<div class="text-primary file-info"><?php echo zget($users, $doc->addedBy);?></div>
</a>
<div class="actions">
<?php if(common::checkObjectChangeAllowed('doc', $doc)):?>
<?php if(common::hasPriv('doc', 'collect')):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID={$doc->id}&objectType=doc");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<?php endif;?>
<?php common::printLink('doc', 'edit', "docID={$doc->id}", "<i class='icon icon-edit'></i>", '', "title='{$lang->edit}' class='btn btn-link'")?>
<?php common::printLink('doc', 'delete', "docID={$doc->id}", "<i class='icon icon-trash'></i>", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?>
<?php endif;?>
</div>
</div>
<?php endforeach;?>
+1 -1
View File
@@ -57,7 +57,7 @@
<?php $star = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $collectTitle = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<div class="actions">
<?php if(common::checkObjectChangeAllowed('doc', $object)):?>
<?php if($changeAllowed):?>
<?php if(common::hasPriv('doc', 'collect')):?>
<a data-url="<?php echo $this->createLink('doc', 'collect', "objectID=$libID&objectType=doclib");?>" title="<?php echo $collectTitle;?>" class='btn btn-link ajaxCollect'><i class='icon <?php echo $star;?>'></i></a>
<?php endif;?>
+1 -1
View File
@@ -34,7 +34,7 @@
<td class="c-name"><?php echo html::a($libLink, $lib->name);?></td>
<td class="c-num"><?php echo $lib->allCount . $lang->doc->item;?></td>
<td class="c-actions">
<?php if($libID != 'project' and $libID != 'files'):?>
<?php if($changeAllowed and $libID != 'project' and $libID != 'files'):?>
<?php $star = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? 'icon-star text-yellow' : 'icon-star-empty';?>
<?php $collectTitle = strpos($lib->collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?>
<?php if(common::hasPriv('doc', 'collect')):?>