From bc4de003db0223c0d170883ad40d18231d2917d6 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 12 Apr 2023 10:20:11 +0800 Subject: [PATCH 01/18] * Code for bug #34052. --- module/doc/view/myspace.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/doc/view/myspace.html.php b/module/doc/view/myspace.html.php index 6ed9f3b87a..fd2a4d5f4f 100644 --- a/module/doc/view/myspace.html.php +++ b/module/doc/view/myspace.html.php @@ -41,7 +41,7 @@ echo html::a(helper::createLink('doc', 'createLib', "type=mine"), ' ' . $this->lang->doc->createLib, '', 'class="btn btn-secondary iframe" data-width="800px"'); } - if($libID and common::hasPriv('doc', 'create')) echo $this->doc->printCreateBtn($lib, 'mine', 0, 0); + if($libID and common::hasPriv('doc', 'create')) echo $this->doc->printCreateBtn($lib, 'mine', 0, $moduleID); ?> From 685b9489b2f0958142c45127f7f6ec2bd8ab16fe Mon Sep 17 00:00:00 2001 From: guofeilong Date: Wed, 12 Apr 2023 10:34:14 +0800 Subject: [PATCH 02/18] * Adjust code for style in crumbs . --- module/doc/css/view.css | 3 ++- module/doc/js/common.js | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/module/doc/css/view.css b/module/doc/css/view.css index 10b71539f8..668c85cbef 100644 --- a/module/doc/css/view.css +++ b/module/doc/css/view.css @@ -25,7 +25,6 @@ .article-content .info .keywords .label {padding-right:8px; padding-left:8px; color:#18A6FD; border-color:rgba(24, 166, 253, 0.25); height:22px; line-height:14px; margin-right:4px;} .article-content {width: 100%; display: inline-block;} -/* .outline-toggle i.icon-angle-right, i.icon-angle-left {width: 18px; height: 18px; border-radius: 50%; position: absolute; padding-left: 2px; padding-top: 1px;} */ .outline-toggle {position: absolute; right: 20px; top: 50px;} .outline-toggle i.icon-angle-right:before {content: "\e314"; cursor: pointer;} .outline-toggle i.icon-angle-left:before {content: "\e315"; cursor: pointer;} @@ -68,5 +67,7 @@ .crumbs a {padding: 6px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;} .crumbs .separator {flex: 0 0 15px; display: flex; justify-content: center; align-items: center;} .crumbs :last-child {flex: none;} +.crumbs a {flex: none;} +.flex-auto {flex: auto!important;} .main-col {position: relative;} diff --git a/module/doc/js/common.js b/module/doc/js/common.js index 6fd2a0f58f..1e00818dfe 100644 --- a/module/doc/js/common.js +++ b/module/doc/js/common.js @@ -408,14 +408,15 @@ function updateCrumbs() /* last crumbItem width major */ var $lastChild = $($crumbItems[$crumbItems.length -1]); - var $separator = "
>
" - var $ellipsis = "
...
" - if($lastChild.width() > $crumbs.width()) + var widthSum = 0 + $lastChild.width(); + var separatorWidth = 20; + for(var i = 0; i < $crumbItems.length - 1; i++) { - var $appendChild = $lastChild[0]; - $crumbs.empty(); - $crumbs.append($appendChild); - $crumbs.prepend($separator); - $crumbs.prepend($ellipsis); + var crumbItem = $crumbItems[i]; + var widthSum = widthSum + $(crumbItem).width() + separatorWidth; + if(widthSum >= crumbMaxWidth) + { + $(crumbItem).addClass('flex-auto'); + } } } From 26b79296d4b72c1365809276f9bcc9d384d9f2fa Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 12 Apr 2023 10:38:22 +0800 Subject: [PATCH 03/18] * Code for bug #34013, task #90781. --- module/block/view/docrecentupdateblock.html.php | 13 +++++++++++-- module/block/view/docstatisticblock.html.php | 11 +---------- module/doc/model.php | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/module/block/view/docrecentupdateblock.html.php b/module/block/view/docrecentupdateblock.html.php index d5ba89ab49..fc9fbd763f 100644 --- a/module/block/view/docrecentupdateblock.html.php +++ b/module/block/view/docrecentupdateblock.html.php @@ -12,7 +12,7 @@ ?> +
diff --git a/module/block/view/docstatisticblock.html.php b/module/block/view/docstatisticblock.html.php index 49815f2353..ce54c45dcf 100644 --- a/module/block/view/docstatisticblock.html.php +++ b/module/block/view/docstatisticblock.html.php @@ -17,18 +17,12 @@ .block-docstatistic .created {flex: 0 1 48%;} .block-docstatistic .edited {flex: 0 1 16%; padding-left: 20px;} .block-docstatistic .divider {border-right: 1px solid #eee; padding-right: 12%;} -.block-docstatistic .title-line {height: 32px;} -.block-docstatistic .panel-title {display: none;} -.block-docstatistic .panel-body {margin-top: -32px; padding: 30px;} -.block-docstatistic .tile-title {white-space: nowrap;} +.block-docstatistic .panel-body {padding-top: 0;} .block-docstatistic.block-sm .flex {justify-content: start;} .block-docstatistic.block-sm .panel-body.flex {flex-direction: column;} .block-docstatistic.block-sm .divider {border-right: none;} -.block-docstatistic.block-sm .panel-title {display: block;} -.block-docstatistic.block-sm .statistic .title-line {display: none;} .block-docstatistic.block-sm .statistic .flex {margin-top: -28px;} -.block-docstatistic.block-sm .title-line {height: 0; padding-top: 10px;} .block-docstatistic.block-sm .tile {padding: 10px 32px 20px;} .block-docstatistic.block-sm .panel-body {margin-top: 0px; padding: 10px;} .block-docstatistic.block-sm .flex-column .flex .tile:nth-child(1) {padding-left: 0;} @@ -39,7 +33,6 @@
-

doc->docStatistic;?>

totalDocs;?>
@@ -52,7 +45,6 @@
-

doc->openedByMe;?>

-

doc->editedByMe;?>

myEditedDocs;?>
diff --git a/module/doc/model.php b/module/doc/model.php index c958e291d6..c2b9ebd7f8 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2990,6 +2990,7 @@ class docModel extends model $docIDList = $this->getPrivDocs($lib->id); $docs = $this->dao->select('*, title as name')->from(TABLE_DOC) ->where('id')->in($docIDList) + ->andWhere("(status = 'normal' or (status = 'draft' and addedBy='{$this->app->user->account}'))") ->andWhere('deleted')->eq(0) ->andWhere('module')->eq(0) ->fetchAll('id'); From 77b6e791d2e1ed26ccbff5d28e88a541c0af5e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=87=91=E5=8B=87?= Date: Wed, 12 Apr 2023 02:57:43 +0000 Subject: [PATCH 04/18] * Fix setItem value. --- module/setting/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/setting/model.php b/module/setting/model.php index 619a0b9bc6..e0c003c0a4 100644 --- a/module/setting/model.php +++ b/module/setting/model.php @@ -52,7 +52,7 @@ class settingModel extends model $item = $this->parseItemPath($path); if(empty($item)) return false; - $item->value = $value; + $item->value = strval($value); $this->dao->replace(TABLE_CONFIG)->data($item)->exec(); } From 493e4a858979a3334d81358f46e1d33986be54b0 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 12 Apr 2023 11:10:01 +0800 Subject: [PATCH 05/18] * Modify no data tips. --- module/block/view/docrecentupdateblock.html.php | 9 +++++++-- module/doc/control.php | 5 +---- module/doc/model.php | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/module/block/view/docrecentupdateblock.html.php b/module/block/view/docrecentupdateblock.html.php index fc9fbd763f..3321d13b61 100644 --- a/module/block/view/docrecentupdateblock.html.php +++ b/module/block/view/docrecentupdateblock.html.php @@ -18,15 +18,17 @@ .block-docrecentupdate .doc-list > .doc-item .file-icon {float: left; padding: 8px 4px;} .block-docrecentupdate .doc-list > .doc-item > .plug-title {height: 16px; overflow: hidden;} .block-docrecentupdate .doc-list > .doc-item .edit-date {overflow: hidden; height: 16px;} +.block-docrecentupdate .no-doc {text-align: center; vertical-align: middle; height: 50px;} .block-docrecentupdate.block-sm .doc-list > .doc-item {flex: 1 1 100%;}
diff --git a/module/doc/control.php b/module/doc/control.php index ec02fc78ab..950ac4e2d8 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1147,11 +1147,11 @@ class doc extends control if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found')); return print(js::error($this->lang->notFound) . js::locate($this->inlink('index'))); } + if(!$this->doc->checkPrivDoc($doc)) return $this->accessDenied(); $lib = $this->doc->getLibById($doc->lib); if(!empty($lib) and $lib->deleted == '1') $appendLib = $doc->id; - $objectType = isset($lib->type) ? $lib->type : 'custom'; $type = $objectType == 'execution' && $this->app->tab != 'execution' ? 'project' : $objectType; $objectID = zget($doc, $type, 0); @@ -1162,9 +1162,6 @@ class doc extends control /* Get doc. */ if($docID) { - $doc = $this->doc->getById($docID, $version, true); - if(!$doc) return print(js::error($this->lang->notFound)); - $this->doc->createAction($docID, 'view'); $this->doc->removeEditing($doc); if($doc->keywords) diff --git a/module/doc/model.php b/module/doc/model.php index c2b9ebd7f8..82c8bddd2f 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -3146,7 +3146,7 @@ class docModel extends model */ public function printCreateBtn($lib, $type, $objectID, $moduleID, $from = '') { - if(!common::hasPriv('doc', 'create')) return null; + if(!common::hasPriv('doc', 'create') or !isset($lib->id)) return null; $class = $from == 'list' ? 'btn-info' : 'btn-primary'; $html = "
Date: Wed, 12 Apr 2023 14:02:07 +0800 Subject: [PATCH 17/18] * Fix testcase api bug and modify bug api data consistent. --- api/v1/entries/bugs.php | 21 +-------------------- api/v1/entries/testcases.php | 10 ++++++---- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/api/v1/entries/bugs.php b/api/v1/entries/bugs.php index fe4de03875..eef7cd1aaa 100644 --- a/api/v1/entries/bugs.php +++ b/api/v1/entries/bugs.php @@ -36,32 +36,13 @@ class bugsEntry extends entry $this->loadModel('product'); foreach($bugs as $bug) { - $status = array('code' => $bug->status, 'name' => $this->lang->bug->statusList[$bug->status]); - if($bug->status == 'active' and $bug->confirmed) $status = array('code' => 'confirmed', 'name' => $this->lang->bug->labelConfirmed); - if($bug->resolution == 'postponed') $status = array('code' => 'postponed', 'name' => $this->lang->bug->labelPostponed); - if(!empty($bug->delay)) $status = array('code' => 'delay', 'name' => $this->lang->bug->overdueBugs); - $bug->status = $status['code']; - $bug->statusName = $status['name']; - $product = $this->product->getById($bug->product); + $bug->statusName = $this->lang->bug->statusList[$bug->status]; $bug->productStatus = $product->status; $result[$bug->id] = $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool'); } - $storyChangeds = $this->dao->select('t1.id')->from(TABLE_BUG)->alias('t1') - ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id') - ->where('t1.id')->in(array_keys($result)) - ->andWhere('t1.story')->ne('0') - ->andWhere('t1.storyVersion != t2.version') - ->fetchPairs('id', 'id'); - foreach($storyChangeds as $bugID) - { - $status = array('code' => 'storyChanged', 'name' => $this->lang->bug->changed); - $result[$bugID]->status = $status['code']; - $result[$bugID]->statusName = $status['name']; - } - return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => array_values($result))); } diff --git a/api/v1/entries/testcases.php b/api/v1/entries/testcases.php index d4fcaab2a0..b56e78dc09 100644 --- a/api/v1/entries/testcases.php +++ b/api/v1/entries/testcases.php @@ -23,10 +23,8 @@ class testcasesEntry extends entry if(empty($productID)) $productID = $this->param('product', 0); if(empty($productID)) return $this->sendError(400, 'Need product id.'); - $this->app->cookie->caseModule = 0; - $this->app->cookie->caseSuite = 0; - $type = $this->param('status', 'all'); + $branch = $this->param('branch', ''); $param = 0; $moduleID = $this->param('module', 0); if($moduleID) @@ -35,8 +33,12 @@ class testcasesEntry extends entry $param = $moduleID; } + $this->app->cookie->caseModule = 0; + $this->app->cookie->caseSuite = 0; + $this->app->cookie->preBranch = $branch; + $control = $this->loadController('testcase', 'browse'); - $control->browse($productID, $this->param('branch', ''), $type, $param, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); + $control->browse($productID, $this->param('branch', ''), $type, $param, $this->param('caseType', ''), $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1)); $data = $this->getData(); From 875aee00b180e598f99617bd03346b044b575e4a Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 12 Apr 2023 14:31:37 +0800 Subject: [PATCH 18/18] * Modify doc priv style. --- module/block/control.php | 6 +- .../block/view/docrecentupdateblock.html.php | 68 ++++++++++--------- 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 659017502c..bfcb2c4ae6 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -2084,13 +2084,17 @@ class block extends control $pager = new pager(0, 6, 1); $docList = $this->loadModel('doc')->getDocsByBrowseType('byediteddate', 0, 0, 'editedDate_desc', $pager); + $libList = array(); foreach($docList as $doc) { $doc->editedDate = substr($doc->editedDate, 0, 10); $doc->editInterval = helper::getDateInterval($doc->editedDate); + + $libList[] = $doc->lib; } - $this->view->docList = $docList; + $this->view->pricDocs = $this->doc->getPrivDocs($libList); + $this->view->docList = $docList; } /** diff --git a/module/block/view/docrecentupdateblock.html.php b/module/block/view/docrecentupdateblock.html.php index 3321d13b61..8b07d377ac 100644 --- a/module/block/view/docrecentupdateblock.html.php +++ b/module/block/view/docrecentupdateblock.html.php @@ -11,28 +11,24 @@ */ ?>