From cb9c575ed28c057243d10bd556590e89a0e5f237 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 13 Apr 2023 17:07:28 +0800 Subject: [PATCH 01/14] * Adjust the column width of the owning object. --- module/doc/view/mydoclist.html.php | 3 ++- module/my/css/doc.css | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/module/doc/view/mydoclist.html.php b/module/doc/view/mydoclist.html.php index 5fd3c59bad..6cbe69887b 100644 --- a/module/doc/view/mydoclist.html.php +++ b/module/doc/view/mydoclist.html.php @@ -16,6 +16,7 @@ body {margin-bottom: 25px;} #docListForm th.c-user {width: 80px;} #docListForm th.c-actions {width: 84px; padding-left: 15px;} #docListForm .c-module, #docListForm .c-object {width: 120px; overflow: hidden; white-space: nowrap; text-overflow: clip;} +#docListForm .c-object {width: 180px;} #docListForm .table .c-name > .doc-title {display: inline-block; max-width: calc(100% - 80px); overflow: hidden; background: transparent; padding-right:0px;} #docListForm .table .c-name > span.doc-title {line-height: 0; vertical-align: inherit;} #docListForm .table .c-name > .draft {background-color:rgba(129, 102, 238, 0.12); color:#8166EE;} @@ -26,7 +27,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;} +

@@ -192,5 +193,11 @@ $(function() return checkedTotal ? checkedSummary.replace('%total%', checkedTotal) : pageSummary; } }); + + $('.ajaxCollect').click(function() + { + if(isMyCollection) window.location.reload(); + }); + }); From 2088b588b14ea2c1b27fb5503891d1223709161f Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 14 Apr 2023 11:17:56 +0800 Subject: [PATCH 12/14] * Modify the interaction of the Create document button. --- module/doc/config.php | 2 ++ module/doc/css/common.css | 2 ++ module/doc/lang/de.php | 3 +-- module/doc/lang/en.php | 3 +-- module/doc/lang/fr.php | 3 +-- module/doc/lang/zh-cn.php | 3 +-- module/doc/model.php | 19 ++++++++----------- module/doc/view/doclist.html.php | 2 +- module/doc/view/mydoclist.html.php | 2 +- 9 files changed, 18 insertions(+), 21 deletions(-) diff --git a/module/doc/config.php b/module/doc/config.php index 2355516b6f..509dfaa28c 100644 --- a/module/doc/config.php +++ b/module/doc/config.php @@ -34,6 +34,8 @@ $config->doc->markdown->create = array('id' => 'contentMarkdown', 'tools' => 'wi $config->doc->iconList['html'] = 'rich-text'; $config->doc->iconList['markdown'] = 'markdown'; $config->doc->iconList['url'] = 'text-link'; +$config->doc->iconList['text'] = 'wiki-file'; +$config->doc->iconList['template'] = 'wiki-file'; $config->doc->iconList['word'] = 'word'; $config->doc->iconList['ppt'] = 'ppt'; $config->doc->iconList['excel'] = 'excel'; diff --git a/module/doc/css/common.css b/module/doc/css/common.css index 81483d0f0f..411d292a42 100644 --- a/module/doc/css/common.css +++ b/module/doc/css/common.css @@ -112,3 +112,5 @@ ol, ul {margin-bottom: 0} #outlineMenu {background: #fff; position: absolute; height: calc(100vh - 180px)!important; overflow-y: auto; top: 50px; right: 25px;} .pl-0px {padding-left:0px !important;} .icon {cursor: pointer;} + +#mainMenu .pull-right .createDropdown li > a .file-icon {margin-bottom: 1px;} diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index 53974cb385..fc9763f459 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -253,8 +253,7 @@ $lang->doc->typeList['word'] = 'Word'; $lang->doc->typeList['ppt'] = 'PPT'; $lang->doc->typeList['excel'] = 'Excel'; -$lang->doc->createList['html'] = 'Create Document'; -$lang->doc->createList['template'] = 'Create By Template'; +$lang->doc->createList['template'] = 'Wiki'; $lang->doc->createList['word'] = 'Word'; $lang->doc->createList['ppt'] = 'PPT'; $lang->doc->createList['excel'] = 'Excel'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index d89d603f29..ca9503447e 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -253,8 +253,7 @@ $lang->doc->typeList['word'] = 'Word'; $lang->doc->typeList['ppt'] = 'PPT'; $lang->doc->typeList['excel'] = 'Excel'; -$lang->doc->createList['html'] = 'Create Document'; -$lang->doc->createList['template'] = 'Create By Template'; +$lang->doc->createList['template'] = 'Wiki'; $lang->doc->createList['word'] = 'Word'; $lang->doc->createList['ppt'] = 'PPT'; $lang->doc->createList['excel'] = 'Excel'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 50e1d84b99..5db826b07a 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -253,8 +253,7 @@ $lang->doc->typeList['word'] = 'Word'; $lang->doc->typeList['ppt'] = 'PPT'; $lang->doc->typeList['excel'] = 'Excel'; -$lang->doc->createList['html'] = 'Create Document'; -$lang->doc->createList['template'] = 'Create By Template'; +$lang->doc->createList['template'] = 'Wiki'; $lang->doc->createList['word'] = 'Word'; $lang->doc->createList['ppt'] = 'PPT'; $lang->doc->createList['excel'] = 'Excel'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 01d95214dc..a1c6250c82 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -253,8 +253,7 @@ $lang->doc->typeList['word'] = 'Word'; $lang->doc->typeList['ppt'] = 'PPT'; $lang->doc->typeList['excel'] = 'Excel'; -$lang->doc->createList['html'] = '创建文档'; -$lang->doc->createList['template'] = '由模板创建'; +$lang->doc->createList['template'] = 'Wiki文档'; $lang->doc->createList['word'] = 'Word'; $lang->doc->createList['ppt'] = 'PPT'; $lang->doc->createList['excel'] = 'Excel'; diff --git a/module/doc/model.php b/module/doc/model.php index 44144fd638..d893142158 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -3144,21 +3144,18 @@ class docModel extends model foreach($this->lang->doc->createList as $typeKey => $typeName) { - if($this->config->edition != 'max' and $typeKey == 'template') continue; - - $attr = "data-app='{$this->app->tab}'"; - $class = strpos($this->config->doc->officeTypes, $typeKey) !== false ? 'iframe' : ''; - $params = "objectType={$lib->type}&objectID=$objectID&libID={$lib->id}&moduleID=$moduleID&type=$typeKey"; - if($typeKey == 'template') $params = "objectType={$lib->type}&objectID=$objectID&libID={$lib->id}&moduleID=$moduleID&type=html&from=template"; + $docType = zget($this->config->doc->iconList, $typeKey); + $icon = html::image("static/svg/{$docType}.svg", "class='file-icon'"); + $attr = "data-app='{$this->app->tab}'"; + $class = strpos($this->config->doc->officeTypes, $typeKey) !== false ? 'iframe' : ''; + $params = "objectType={$lib->type}&objectID=$objectID&libID={$lib->id}&moduleID=$moduleID&type=$typeKey"; + if($typeKey == 'template' and $this->config->edition == 'max') $params = "objectType={$lib->type}&objectID=$objectID&libID={$lib->id}&moduleID=$moduleID&type=html&from=template"; $html .= "

  • "; - $html .= html::a(helper::createLink('doc', 'create', $params, '', $class ? true : false), $typeName, '', "class='$class' $attr"); + $html .= html::a(helper::createLink('doc', 'create', $params, '', $class ? true : false), $icon . ' ' . $typeName, '', "class='$class' $attr"); $html .= "
  • "; - $printDivider = false; - if($typeKey == 'template') $printDivider = true; - if($this->config->edition != 'max' and $typeKey == 'html') $printDivider = true; - if($printDivider) $html .= '
  • '; + if($typeKey == 'template') $html .= '
  • '; } $html .= '
    '; diff --git a/module/doc/view/doclist.html.php b/module/doc/view/doclist.html.php index e20f81e770..ec6f430bf8 100644 --- a/module/doc/view/doclist.html.php +++ b/module/doc/view/doclist.html.php @@ -81,7 +81,7 @@ body {margin-bottom: 25px;} type == 'text' ? 'wiki-file' : $doc->type; + $docType = zget($config->doc->iconList, $doc->type); $icon = html::image("static/svg/{$docType}.svg", "class='file-icon'"); if(common::hasPriv('doc', 'view')) { diff --git a/module/doc/view/mydoclist.html.php b/module/doc/view/mydoclist.html.php index 4d2851d585..478aa10c09 100644 --- a/module/doc/view/mydoclist.html.php +++ b/module/doc/view/mydoclist.html.php @@ -97,7 +97,7 @@ body {margin-bottom: 25px;} type == 'text' ? 'wiki-file' : $doc->type; + $docType = zget($config->doc->iconList, $doc->type); $icon = html::image("static/svg/{$docType}.svg", "class='file-icon'"); if(common::hasPriv('doc', 'view')) { From 99c8caffaf8887a19c567a996a719f5fd3fe2b2a Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 14 Apr 2023 11:30:25 +0800 Subject: [PATCH 13/14] * Fix bug #34184. --- module/doc/control.php | 27 ++++++++++++++++++++++----- module/doc/model.php | 8 -------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 135c094775..8f9212b9cc 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -541,16 +541,25 @@ class doc extends control if(!empty($changes)) $this->action->logHistory($actionID, $changes); } - $link = $this->session->docList ? $this->session->docList : $this->createLink('doc', 'index'); + $link = $this->createLink('doc', 'view', "docID={$docID}") . "#app={$this->app->tab}"; $oldLib = $doc->lib; $doc = $this->doc->getById($docID); $lib = $this->doc->getLibById($doc->lib); $objectID = zget($lib, $lib->type, 0); - if($oldLib != $doc->lib) $link = $this->createLink('doc', 'view', "docID={$docID}"); - - if(!empty($objectType) and $objectType != 'doc' and $doc->type != 'chapter' and $doc->type != 'article') + if(!$this->doc->checkPrivDoc($doc)) { - $link = $this->createLink('doc', 'view', "docID=$docID") . "#app={$this->app->tab}"; + $moduleName = 'doc'; + if($this->app->tab == 'execution') + { + $moduleName = 'execution'; + $methodName = 'doc'; + } + else + { + $methodName = zget($this->config->doc->spaceMethod, $lib->type); + } + $params = "objectID=$objectID&libID={$doc->lib}"; + $link = $this->createLink($moduleName, $methodName, $params); } if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); @@ -1103,6 +1112,14 @@ class doc extends control public function view($docID = 0, $version = 0, $appendLib = 0) { $doc = $this->doc->getById($docID); + if(!$this->doc->checkPrivDoc($doc)) + { + echo(js::alert($this->lang->doc->accessDenied)); + $loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login"; + if(strpos($this->server->http_referer, $loginLink) !== false) return print(js::locate(inlink('index'))); + helper::end(print(js::locate('back'))); + } + if(!$doc or !isset($doc->id)) { if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found')); diff --git a/module/doc/model.php b/module/doc/model.php index d893142158..2cc17b8d61 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -748,14 +748,6 @@ class docModel extends model ->fetch(); if(!$doc) return false; - if(!$this->checkPrivDoc($doc)) - { - echo(js::alert($this->lang->doc->accessDenied)); - $loginLink = $this->config->requestType == 'GET' ? "?{$this->config->moduleVar}=user&{$this->config->methodVar}=login" : "user{$this->config->requestFix}login"; - if(strpos($this->server->http_referer, $loginLink) !== false) return print(js::locate(inlink('index'))); - helper::end(print(js::locate('back'))); - die; - } $docs = $this->processCollector(array($doc->id => $doc)); $doc = $docs[$doc->id]; From 9cb069b33a55a2529e56c6c7134c0816f0f836eb Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 14 Apr 2023 13:47:27 +0800 Subject: [PATCH 14/14] * Optimized Level 2.5 dropdown interaction. --- module/doc/model.php | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index 256b9c064f..1493bc528a 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2735,20 +2735,8 @@ class docModel extends model $objectDropdown = ''; if(in_array($type, array('project', 'product', 'execution'))) { - $objects = $this->getOrderedObjects($type); - $objectID = $this->loadModel($type)->saveState($objectID, $objects); - $table = $this->config->objectTables[$type]; - $libs = $this->getLibsByObject($type, $objectID, '', $appendLib); - - if(($libID == 0 or !isset($libs[$libID])) and !empty($libs)) $libID = reset($libs)->id; - $object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch(); - $objectTitle = zget($objects, $objectID, ''); - $objectDropdown = $this->select($type, $objectTitle, $objectID); - if($type == 'execution' and isset($libs[$libID])) - { - $objectTitle = zget($libs[$libID], 'name', ''); - $objectDropdown = "
    {$objectTitle}
    "; - } + $table = $this->config->objectTables[$type]; + $object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch(); if(empty($object)) { @@ -2756,6 +2744,22 @@ class docModel extends model $methodName = ($type == 'project' and $this->config->vision != 'lite') ? 'createGuide' : 'create'; return print(js::locate(helper::createLink($type, $methodName, $param))); } + + $objects = $this->getOrderedObjects($type); + $objectID = $this->loadModel($type)->saveState($objectID, $objects); + $libs = $this->getLibsByObject($type, $objectID, '', $appendLib); + if(($libID == 0 or !isset($libs[$libID])) and !empty($libs)) $libID = reset($libs)->id; + + $objectTitle = zget($objects, $objectID, ''); + if($this->app->tab != 'doc' and isset($libs[$libID])) + { + $objectTitle = zget($libs[$libID], 'name', ''); + $objectDropdown = "
    {$objectTitle}
    "; + } + else + { + $objectDropdown = $this->select($type, $objectTitle, $objectID); + } } else {