From 22f4b33a66ea8881ad4720155ace29c0522c3776 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 13 Apr 2023 11:19:28 +0800 Subject: [PATCH 01/20] * Code for story #43645,43646. --- module/doc/model.php | 84 +++++++++++++++---------------------- module/my/css/doc.css | 11 ++++- module/my/view/doc.html.php | 50 ++++++++++++---------- 3 files changed, 72 insertions(+), 73 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index 5a801ce31f..8a915df712 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -386,11 +386,6 @@ class docModel extends model $allLibIDList = array_keys($allLibs); $hasPrivDocIdList = $this->getPrivDocs(0, $moduleID); - $files = $this->dao->select('*')->from(TABLE_FILE) - ->where('objectType')->eq('doc') - ->andWhere('objectID')->in($hasPrivDocIdList) - ->fetchGroup('objectID'); - if($browseType == "all") { $docs = $this->getDocs(0, 0, $browseType, $sort, $pager); @@ -422,13 +417,14 @@ class docModel extends model ->andWhere('actor')->eq($this->app->user->account) ->andWhere('action')->eq('edited') ->fetchAll('objectID'); - $docs = $this->dao->select('*')->from(TABLE_DOC) - ->where('deleted')->eq(0) + $docs = $this->dao->select('t1.*, t2.name as libName, t2.type as objectType')->from(TABLE_DOC)->alias('t1') + ->leftJoin(TABLE_DOCLIB)->alias('t2')->on("t1.lib=t2.id") + ->where('t1.deleted')->eq(0) ->andWhere($query) - ->andWhere('lib')->in($allLibIDList) - ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi() - ->andWhere('addedBy', 1)->eq($this->app->user->account) - ->orWhere('id')->in(array_keys($docIDList)) + ->andWhere('t1.lib')->in($allLibIDList) + ->beginIF($this->config->doc->notArticleType)->andWhere('t1.type')->notIN($this->config->doc->notArticleType)->fi() + ->andWhere('t1.addedBy', 1)->eq($this->app->user->account) + ->orWhere('t1.id')->in(array_keys($docIDList)) ->markRight(1) ->orderBy($sort) ->page($pager) @@ -436,12 +432,13 @@ class docModel extends model } elseif($browseType == "openedbyme") { - $docs = $this->dao->select('*')->from(TABLE_DOC) - ->where('deleted')->eq(0) - ->andWhere('lib')->in($allLibIDList) - ->andWhere('id')->in($hasPrivDocIdList) - ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi() - ->andWhere('addedBy')->eq($this->app->user->account) + $docs = $this->dao->select('t1.*, t2.name as libName, t2.type as objectType')->from(TABLE_DOC)->alias('t1') + ->leftJoin(TABLE_DOCLIB)->alias('t2')->on("t1.lib=t2.id") + ->where('t1.deleted')->eq(0) + ->andWhere('t1.lib')->in($allLibIDList) + ->andWhere('t1.id')->in($hasPrivDocIdList) + ->beginIF($this->config->doc->notArticleType)->andWhere('t1.type')->notIN($this->config->doc->notArticleType)->fi() + ->andWhere('t1.addedBy')->eq($this->app->user->account) ->orderBy($sort) ->page($pager) ->fetchAll('id'); @@ -454,11 +451,13 @@ class docModel extends model ->andWhere('objectID')->in($hasPrivDocIdList) ->andWhere('action')->eq('edited') ->fetchAll('objectID'); - $docs = $this->dao->select('*')->from(TABLE_DOC) - ->where('deleted')->eq(0) - ->andWhere('id')->in(array_keys($docIDList)) - ->andWhere('lib')->in($allLibIDList) - ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi() + + $docs = $this->dao->select('t1.*, t2.name as libName, t2.type as objectType')->from(TABLE_DOC)->alias('t1') + ->leftJoin(TABLE_DOCLIB)->alias('t2')->on("t1.lib=t2.id") + ->where('t1.deleted')->eq(0) + ->andWhere('t1.id')->in(array_keys($docIDList)) + ->andWhere('t1.lib')->in($allLibIDList) + ->beginIF($this->config->doc->notArticleType)->andWhere('t1.type')->notIN($this->config->doc->notArticleType)->fi() ->orderBy($sort) ->page($pager) ->fetchAll('id'); @@ -490,44 +489,27 @@ class docModel extends model if(empty($docs)) return array(); - /* Get projects, executions and products by docIdList. */ - $docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc'); - foreach($docs as $index => $doc) + if(in_array($browseType, array('bySearch', 'openedbyme', 'editedbyme'))) { - $docs[$index]->fileSize = 0; - if(isset($files[$index])) + $objects = array(); + list($objects['project'], $objects['execution'], $objects['product']) = $this->getObjectsByDoc(array_keys($docs)); + foreach($docs as $docID => $doc) { - $docContent = $docContents[$index]; - $fileSize = 0; - foreach($files[$index] as $file) + $doc->objectID = zget($doc, $doc->objectType, 0); + $doc->objectName = ''; + if(isset($objects[$doc->objectType])) { - if(strpos(",{$docContent->files},", ",{$file->id},") === false) continue; - $fileSize += $file->size; - } - - if($fileSize < 1024) - { - $fileSize .= 'B'; - } - elseif($fileSize < 1024 * 1024) - { - $fileSize = round($fileSize / 1024, 2) . 'KB'; - } - elseif($fileSize < 1024 * 1024 * 1024) - { - $fileSize = round($fileSize / 1024 / 1024, 2) . 'MB'; + $doc->objectName = $objects[$doc->objectType][$doc->objectID]; } else { - $fileSize = round($fileSize / 1024 / 1024 / 1024, 2) . 'G'; + if($doc->objectType == 'mine') $doc->objectName = $this->lang->doc->person; + if($doc->objectType == 'custom') $doc->objectName = $this->lang->doc->team; } - - $docs[$index]->fileSize = $fileSize; } } - $docs = $this->processCollector($docs); - return $docs; + return $this->processCollector($docs); } /** @@ -1092,7 +1074,7 @@ class docModel extends model $products = $this->product->getPairs(); $this->config->doc->search['params']['project']['values'] = array('' => '') + $this->loadModel('project')->getPairsByProgram('', 'all', false, 'order_asc', 'kanban') + array('all' => $this->lang->doc->allProjects); - $this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs(0, 'sprint,stage', 'multiple,leaf,noprefix') + array('all' => $this->lang->doc->allExecutions); + $this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs(0, 'sprint,stage', 'multiple,leaf,noprefix,withobject') + array('all' => $this->lang->doc->allExecutions); $this->config->doc->search['params']['lib']['values'] = array('' => '') + $this->loadModel('doc')->getLibs('all', 'withObject') + array('all' => $this->lang->doclib->all); $this->config->doc->search['params']['product']['values'] = array('' => '') + $products + array('all' => $this->lang->doc->allProduct); diff --git a/module/my/css/doc.css b/module/my/css/doc.css index 9fad24d9d2..93805dfe53 100644 --- a/module/my/css/doc.css +++ b/module/my/css/doc.css @@ -1,2 +1,11 @@ +body {margin-bottom: 25px;} .fullscreen-close {top: 8px !important;} -.btn.ajaxCollect > img {width: 20px;} +#docList.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: 0px;} +#docList th.c-id {width: 72px;} +#docList th.c-user {width: 80px;} +#docList th.c-actions {width: 84px; padding-left: 15px;} +#docList .c-object {width: 120px; overflow: hidden; white-space: nowrap; text-overflow: clip;} +#docList.table .c-name > .doc-title {display: inline-block; max-width: calc(100% - 80px); overflow: hidden; background: transparent; padding-right:0px;} +#docList.table .c-name > span.doc-title {line-height: 0; vertical-align: inherit;} +#docList.table .c-name > .draft {background-color:rgba(129, 102, 238, 0.12); color:#8166EE;} +#docList .btn {padding: 0 2px;} diff --git a/module/my/view/doc.html.php b/module/my/view/doc.html.php index e45c44f210..eaa037a4f3 100644 --- a/module/my/view/doc.html.php +++ b/module/my/view/doc.html.php @@ -34,23 +34,22 @@
>
-
+ - - + - + - + - - + + @@ -59,29 +58,38 @@ collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?> - - + - - + - +
doc->id;?> doc->title;?>doc->object;?>doc->size;?>doc->object;?> doc->addedByAB;?> doc->addedDate;?>doc->addedDate;?> doc->lastEditedBy;?>doc->editedBy;?> doc->editedDate;?>actions;?>doc->editedDate;?>actions;?>
id;?>createLink('doc', 'view', "docID=$doc->id&version=0&from={$lang->navGroup->doc}", '', true), "  " . $doc->title, '', "title='{$doc->title}' class='iframe' data-width='90%'");?> - objectType)):?> - {$doc->objectType}->common . ' : ';?> - objectID");?>' data-app="objectType;?>"> - objectName;?> - - + + type == 'text' ? 'wiki-file' : $doc->type; + $icon = html::image("static/svg/{$docType}.svg", "class='file-icon'"); + if(common::hasPriv('doc', 'view')) + { + echo html::a($this->createLink('doc', 'view', "docID=$doc->id"), $icon . $doc->title, '', "title='{$doc->title}' class='doc-title' data-app='doc'"); + } + else + { + echo "$icon {$doc->title}"; + } + ?> + status == 'draft') echo "{$lang->doc->draft}";?> + + id&objectType=doc");?>" title="" class='btn btn-link ajaxCollect'> + + + doc->objectIconList, $doc->objectType);?> + " . $doc->objectName;?> fileSize ? $doc->fileSize : '-';?> addedBy);?> addedDate, 'y-m-d');?>addedDate, 'Y-m-d');?> editedBy);?> editedDate, 'y-m-d');?>editedDate, 'Y-m-d');?> - - id&objectType=doc");?>" title="" class='btn btn-link ajaxCollect'> - id&comment=false&from={$lang->navGroup->doc}", "", '', "title='{$lang->edit}' class='btn btn-link' data-app='doc'", true, false)?> id&confirm=no&from={$lang->navGroup->doc}", "", 'hiddenwin', "title='{$lang->delete}' class='btn btn-link'")?> From 0c935c7eea0293edd68e6be823ca9826b6854738 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 13 Apr 2023 15:45:51 +0800 Subject: [PATCH 02/20] * Modify jump link. --- module/action/lang/en.php | 2 +- module/doc/css/tablecontents.css | 2 +- module/doc/view/doclist.html.php | 2 +- module/doc/view/lefttree.html.php | 3 ++- module/doc/view/mydoclist.html.php | 2 +- module/execution/control.php | 4 ++-- module/execution/view/view.html.php | 8 ++++---- module/my/css/doc.css | 2 ++ module/product/control.php | 2 +- module/project/config.php | 4 ++-- 10 files changed, 17 insertions(+), 14 deletions(-) diff --git a/module/action/lang/en.php b/module/action/lang/en.php index d874c37d33..6e9e7534b5 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -754,7 +754,7 @@ $lang->action->label->testtask = 'Request|testtask|view|caseID=%s'; $lang->action->label->testsuite = 'Test Suite|testsuite|view|suiteID=%s'; $lang->action->label->caselib = 'Case Library|caselib|view|libID=%s'; $lang->action->label->todo = 'Todo|todo|view|todoID=%s'; -$lang->action->label->doclib = 'Doc Library|doc|objectLibs|type=%s&objectID=%s&libID=%s'; +$lang->action->label->doclib = 'Doc Library|doc|tablecontents|type=%s&objectID=%s&libID=%s'; $lang->action->label->doc = 'Doc|doc|view|docID=%s'; $lang->action->label->user = 'User|user|view|account=%s'; $lang->action->label->testreport = 'Report|testreport|view|report=%s'; diff --git a/module/doc/css/tablecontents.css b/module/doc/css/tablecontents.css index b7196e25cc..f53186b0c9 100644 --- a/module/doc/css/tablecontents.css +++ b/module/doc/css/tablecontents.css @@ -49,7 +49,7 @@ li.drag-shadow ul {display: none!important;} .table .c-name > .doc-title {display: inline-block; max-width: calc(100% - 80px); overflow: hidden; background: transparent; padding-right:0px;} .table .c-name > span.doc-title {line-height: 0; vertical-align: inherit;} .table .c-name > .draft {background-color:rgba(129, 102, 238, 0.12); color:#8166EE;} -.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: 0px;} +.table .c-name > .ajaxCollect {float: right; position: relative; right: 10px; top: 0px; padding: 0 6px;} table.table > thead > tr {height: 32px;} #bysearchTab::before {display: none;} diff --git a/module/doc/view/doclist.html.php b/module/doc/view/doclist.html.php index f6bc1c6b85..7f6e2e26bd 100644 --- a/module/doc/view/doclist.html.php +++ b/module/doc/view/doclist.html.php @@ -20,7 +20,7 @@ body {margin-bottom: 25px;} #docListForm .checkbox-primary > label {height: 16px; line-height: 16px; padding-left: 16px;} #docListForm .checkbox-primary > label:before {left: -1px; font-size: 10px;} #docListForm .checkbox-primary > label:after {width: 12px; height: 12px;} -.table-files .btn {padding: 0 2px;} +.table-files .btn {padding: 2px;}