From 0fff7bf00f8926d4095dcee6f43c201a93972068 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 5 Sep 2025 09:58:25 +0800 Subject: [PATCH 1/3] * [refac bug #65194] Add js for filelist wg. --- module/testtask/css/runcase.ui.css | 4 ++++ module/testtask/js/runcase.ui.js | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/module/testtask/css/runcase.ui.css b/module/testtask/css/runcase.ui.css index 535ac3bf60..02423ead57 100644 --- a/module/testtask/css/runcase.ui.css +++ b/module/testtask/css/runcase.ui.css @@ -11,3 +11,7 @@ #caseStepForm .step-item-id {color: var(--color-gray-500);} .modal[id^='fileModal'] .modal-dialog {max-height: 100%;} + +.files-list>li>a {display: inline; word-wrap: break-word; color: #313c52; line-height: 24px} +.files-list .icon.icon-file-text {padding-left: 7px} +.files-list .right-icon .btn {padding: 0 6px; height: 20px} diff --git a/module/testtask/js/runcase.ui.js b/module/testtask/js/runcase.ui.js index a215b7a7f7..c7326f8336 100644 --- a/module/testtask/js/runcase.ui.js +++ b/module/testtask/js/runcase.ui.js @@ -23,6 +23,17 @@ function loadResult() { loadCurrentPage({url: resultsLink, selector: '#casesResults', partial: true}); window.waitDom('#casesResults .result-item', function(){ $('#casesResults .result-item').first().trigger('click');}) + $(document).off('mouseover', 'li.file').on('mouseover', 'li.file', function() + { + $(this).children('span.right-icon').removeClass("hidden"); + $(this).addClass('backgroundColor'); + }); + + $(document).off('mouseout', 'li.file').on('mouseout', 'li.file', function() + { + $(this).children('span.right-icon').addClass("hidden"); + $(this).removeClass('backgroundColor'); + }); } /** From 909dc1ca8159ded9af75666f94a998bee6d3db3c Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 5 Sep 2025 10:21:48 +0800 Subject: [PATCH 2/3] * [refac bug #65215] Check upload file for import. --- module/caselib/control.php | 6 ++++-- module/testcase/control.php | 13 ++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/module/caselib/control.php b/module/caselib/control.php index 6dfd931cf9..0e0e35746d 100644 --- a/module/caselib/control.php +++ b/module/caselib/control.php @@ -430,11 +430,13 @@ class caselib extends control { $this->loadModel('testcase'); - if($_FILES) + if($_POST) { $file = $this->loadModel('file')->getUpload('file'); - $file = $file[0]; + if(empty($_FILES)) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat)); + if(empty($file[0])) return $this->send(array('result' => 'fail', 'message' => $this->lang->testcase->errorFileNotEmpty)); + $file = $file[0]; if(!$file || (isset($file['extension']) && $file['extension'] != 'csv')) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat)); $fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']); diff --git a/module/testcase/control.php b/module/testcase/control.php index f9419f6de6..a100690818 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1236,14 +1236,16 @@ class testcase extends control { $this->testcaseZen->checkProducts(); // 如果不存在产品,则跳转到产品创建页面。 - if($_FILES) + if($_POST) { /* 获取上传的文件。 */ /* Get file. */ $file = $this->loadModel('file')->getUpload('file'); + if(empty($_FILES)) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat)); if(empty($file[0])) return $this->send(array('result' => 'fail', 'message' => $this->lang->testcase->errorFileNotEmpty)); $file = $file[0]; + if(!$file || (isset($file['extension']) && $file['extension'] != 'csv')) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat)); /* 移动上传的文件。 */ /* Move file. */ @@ -1957,9 +1959,14 @@ class testcase extends control */ public function importXmind(int $productID, string $branch) { - if($_FILES) + if($_POST) { - if($_FILES['file']['size'][0] == 0) return $this->send(array('result' => 'fail', 'message' => $this->lang->testcase->errorFileNotEmpty)); + $file = $this->loadModel('file')->getUpload('file'); + if(empty($_FILES)) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat)); + if(empty($file[0])) return $this->send(array('result' => 'fail', 'message' => $this->lang->testcase->errorFileNotEmpty)); + + $file = $file[0]; + if(!$file || (isset($file['extension']) && $file['extension'] != 'xmind')) return $this->send(array('result' => 'fail', 'message' => $this->lang->file->errorFileFormat)); /* 保存xmind配置。*/ /* Sav xmind config. */ From fb591f619fa25549b8fb5ec68bfda09b9f3ccf05 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 5 Sep 2025 10:26:53 +0800 Subject: [PATCH 3/3] * [refac bug #65215] Adjust for sonar.. --- module/testcase/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/testcase/control.php b/module/testcase/control.php index a100690818..37a7b48113 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -981,7 +981,7 @@ class testcase extends control /* bug 分页。*/ /* Pager. */ $this->app->loadClass('pager', true); - $recTotal = count($bugs2Link); + if(empty($recTotal)) $recTotal = count($bugs2Link); $pager = new pager($recTotal, $recPerPage, $pageID); $bugs2Link = array_chunk($bugs2Link, $pager->recPerPage);