From bc620ef34d23ebb9c2105caa52240dfa15e1b60e Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 3 Jan 2023 17:36:33 +0800 Subject: [PATCH] * Code for task#81779. --- module/bug/view/create.html.php | 2 +- module/file/control.php | 4 +++- module/file/view/viewfiles.html.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index 732402cf5e..3a3b919865 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -369,7 +369,7 @@ if($this->app->tab == 'project') js::set('objectID', $projectID); fetch('file', 'printFiles', array('files' => $caseFiles, 'fieldset' => 'false', 'object' => null, 'method' => 'edit')); + echo $this->fetch('file', 'printFiles', array('files' => $caseFiles, 'fieldset' => 'false', 'object' => null, 'method' => 'edit', 'showDelete' => true, 'showEdit' => false)); echo html::hidden('caseFiles', implode(',', array_keys($caseFiles))); } ?> diff --git a/module/file/control.php b/module/file/control.php index 7bf6ae7588..7f2a80b4f3 100755 --- a/module/file/control.php +++ b/module/file/control.php @@ -293,16 +293,18 @@ class file extends control * @param object $object * @param string $method * @param bool $showDelete + * @param bool $showEdit * @access public * @return void */ - public function printFiles($files, $fieldset, $object = null, $method = 'view', $showDelete = true) + public function printFiles($files, $fieldset, $object = null, $method = 'view', $showDelete = true, $showEdit = true) { $this->view->files = $files; $this->view->fieldset = $fieldset; $this->view->object = $object; $this->view->method = $method; $this->view->showDelete = $showDelete; + $this->view->showEdit = $showEdit; if(strpos('view,edit', $method) !== false and $this->app->clientDevice != 'mobile') return $this->display('file', 'viewfiles'); $this->display(); diff --git a/module/file/view/viewfiles.html.php b/module/file/view/viewfiles.html.php index 2668b72ede..4ebd743da8 100644 --- a/module/file/view/viewfiles.html.php +++ b/module/file/view/viewfiles.html.php @@ -220,7 +220,7 @@ function setFileName(fileID) common::printLink('file', 'download', "fileID=$file->id", "", '_blank', "class='fileAction btn btn-link text-primary' title='{$lang->file->downloadFile}'"); if(common::hasPriv($objectType, 'edit', $object)) { - if(common::hasPriv('file', 'edit')) echo html::a('###', "", '', "id='renameFile$file->id' class='fileAction btn btn-link edit text-primary' onclick='showRenameBox($file->id)' title='{$lang->file->edit}'"); + if($showEdit and common::hasPriv('file', 'edit')) echo html::a('###', "", '', "id='renameFile$file->id' class='fileAction btn btn-link edit text-primary' onclick='showRenameBox($file->id)' title='{$lang->file->edit}'"); if($showDelete and common::hasPriv('file', 'delete')) echo html::a('###', "", '', "class='fileAction btn btn-link text-primary' onclick='deleteFile($file->id, this)' title='$lang->delete'"); } echo '';