From 9dbf8a1becbd17e47d830308bc361d943e24ee53 Mon Sep 17 00:00:00 2001 From: daitingting Date: Fri, 27 Oct 2023 03:17:00 +0000 Subject: [PATCH] * Print action buttons based on permissions. --- module/caselib/ui/browse.html.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/module/caselib/ui/browse.html.php b/module/caselib/ui/browse.html.php index 32a9b2e3f1..e484c2bc9c 100644 --- a/module/caselib/ui/browse.html.php +++ b/module/caselib/ui/browse.html.php @@ -25,8 +25,6 @@ $canBatchAction = ($canBatchEdit or $canBatchDelete or $canBatchReview or $cols = $this->loadModel('datatable')->getSetting('caselib'); $tableData = initTableData($cases, $cols, $this->testcase); -$config->caselib->dtable->fieldList['openedBy']['map'] = $users; - featureBar ( set::current($browseType), @@ -34,6 +32,8 @@ featureBar li(searchToggle()) ); +$createCaseItem = array('text' => $lang->testcase->create, 'url' => helper::createLink('caselib', 'createCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0))); +$batchCreateCaseItem = array('text' => $lang->testcase->batchCreate, 'url' => helper::createLink('caselib', 'batchCreateCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0))); toolbar ( $canView ? a @@ -45,7 +45,7 @@ toolbar icon('list-alt'), $lang->caselib->view, ) : '', - $canExport && $canImport ? btngroup + $canExport || $canImport ? btngroup ( $canExport ? a ( @@ -76,28 +76,23 @@ toolbar ) : '', $canCreateCase && $canBatchCreateCase ? btngroup ( - $canCreateCase ? btn + btn ( setClass('btn primary'), set::icon('plus'), set::url(helper::createLink('caselib', 'createCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0))), $lang->testcase->create, - ) : '', + ), dropdown ( btn(setClass('btn primary dropdown-toggle'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))), - set::items - ( - array - ( - $canCreateCase ? array('text' => $lang->testcase->create, 'url' => helper::createLink('caselib', 'createCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0))) : '', - $canBatchCreateCase ? array('text' => $lang->testcase->batchCreate, 'url' => helper::createLink('caselib', 'batchCreateCase', "libID=$libID&moduleID=" . (isset($moduleID) ? $moduleID : 0))) : '', - ) - ), - set::placement('bottom-end'), + set::items(array($createCaseItem, $batchCreateCaseItem)), + set::placement('bottom-end') ), - ) : '', + ) : null, + $canCreateCase && !$canBatchCreateCase ? item(set($createCaseItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null, + $canBatchCreateCase && !$canCreateCase ? item(set($batchCreateCaseItem + array('class' => 'btn primary', 'icon' => 'plus'))) : null, ); $settingLink = $this->createLink('tree', 'browse', "libID={$libID}&view=caselib¤tModuleID=0&branch=0&from={$lang->navGroup->caselib}");