From a2a50698ee45d4f3cb3a692c0932f5f115400fb2 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 3 Nov 2020 17:24:07 +0800 Subject: [PATCH 01/10] * Finish task #8199. --- db/update12.4.4.sql | 1 + db/zentao.sql | 1 + module/doc/control.php | 6 +- module/doc/css/create.css | 2 + module/doc/lang/de.php | 7 + module/doc/lang/en.php | 7 + module/doc/lang/fr.php | 7 + module/doc/lang/vi.php | 299 +++++++++++++++--------------- module/doc/lang/zh-cn.php | 7 + module/doc/model.php | 100 ++++++++++ module/doc/view/create.html.php | 11 ++ module/doc/view/edit.html.php | 11 ++ module/doc/view/sendmail.html.php | 35 ++++ module/message/config.php | 3 + 14 files changed, 349 insertions(+), 148 deletions(-) create mode 100644 db/update12.4.4.sql create mode 100644 module/doc/view/sendmail.html.php diff --git a/db/update12.4.4.sql b/db/update12.4.4.sql new file mode 100644 index 0000000000..4e83bbfc11 --- /dev/null +++ b/db/update12.4.4.sql @@ -0,0 +1 @@ +ALTER TABLE `zt_doc` ADD `mailto` text AFTER `editedDate`; diff --git a/db/zentao.sql b/db/zentao.sql index 04d63244d0..2a0fbb021d 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -304,6 +304,7 @@ CREATE TABLE IF NOT EXISTS `zt_doc` ( `addedDate` datetime NOT NULL, `editedBy` varchar(30) NOT NULL, `editedDate` datetime NOT NULL, + `mailto` text, `acl` varchar(10) NOT NULL DEFAULT 'open', `groups` varchar(255) NOT NULL, `users` text NOT NULL, diff --git a/module/doc/control.php b/module/doc/control.php index dd5ab8dbf9..9dbc452a94 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -320,6 +320,8 @@ class doc extends control $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->duplicate, $this->lang->doc->common), 'locate' => $this->createLink('doc', 'view', "docID=$docID"))); } + $this->executeHooks($docID); + $fileAction = ''; if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ; $this->action->create('doc', $docID, 'Created', $fileAction); @@ -371,7 +373,7 @@ class doc extends control $this->view->type = $type; $this->view->docType = $docType; $this->view->groups = $this->loadModel('group')->getPairs(); - $this->view->users = $this->user->getPairs('nocode'); + $this->view->users = $this->user->getPairs('nocode|noclosed|nodeleted'); $this->display(); } @@ -424,7 +426,7 @@ class doc extends control $this->view->type = $type; $this->view->libs = $this->doc->getLibs($type = 'all', $extra = 'withObject'); $this->view->groups = $this->loadModel('group')->getPairs(); - $this->view->users = $this->user->getPairs('noletter', $doc->users); + $this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted', $doc->users); $this->display(); } diff --git a/module/doc/css/create.css b/module/doc/css/create.css index f31a665884..f9cea96d28 100644 --- a/module/doc/css/create.css +++ b/module/doc/css/create.css @@ -1 +1,3 @@ #whiteListBox .input-group:last-child{margin-top:10px} +#mailtoGroup .input-group-btn > .btn {margin-left: -1px!important;} +#mailtoGroup .chosen-container-single a {border-left-width: 0px;} diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index c971aec9e2..705df7d315 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -47,6 +47,7 @@ $lang->doc->users = 'Benutzer'; $lang->doc->item = ' Einträge'; $lang->doc->num = 'Doks'; $lang->doc->searchResult = 'Suchergebnis'; +$lang->doc->mailto = 'Mailto'; $lang->doc->moduleDoc = 'Nach Modulen'; $lang->doc->searchDoc = 'Suche'; @@ -155,6 +156,12 @@ $lang->doc->customShowLibsList['zero'] = 'Display Empty Library'; $lang->doc->customShowLibsList['children'] = 'Display Child-category Documents'; $lang->doc->customShowLibsList['unclosed'] = "Display Active {$lang->projectCommon}s Only"; +$lang->doc->mail = new stdclass(); +$lang->doc->mail->create = new stdclass(); +$lang->doc->mail->edit = new stdclass(); +$lang->doc->mail->create->title = "%s created document #%s:%s"; +$lang->doc->mail->edit->title = "%s edited document #%s:%s"; + $lang->doc->confirmDelete = "Möchten Sie dieses Dokument löschen?"; $lang->doc->confirmDeleteLib = "Möchten Sie diese Bibliothek löschen?"; $lang->doc->errorEditSystemDoc = "System Dokumentenbibliothek darf nicht geändert werden."; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 6489696f55..709a8e8b8e 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -47,6 +47,7 @@ $lang->doc->users = 'Users'; $lang->doc->item = ' Items'; $lang->doc->num = 'Documents'; $lang->doc->searchResult = 'Search Result'; +$lang->doc->mailto = 'Mailto'; $lang->doc->moduleDoc = 'By Module'; $lang->doc->searchDoc = 'Search'; @@ -155,6 +156,12 @@ $lang->doc->customShowLibsList['zero'] = 'Display Empty Library'; $lang->doc->customShowLibsList['children'] = 'Display Child-category Documents'; $lang->doc->customShowLibsList['unclosed'] = "Display Active {$lang->projectCommon}s Only"; +$lang->doc->mail = new stdclass(); +$lang->doc->mail->create = new stdclass(); +$lang->doc->mail->edit = new stdclass(); +$lang->doc->mail->create->title = "%s created document #%s:%s"; +$lang->doc->mail->edit->title = "%s edited document #%s:%s"; + $lang->doc->confirmDelete = "Do you want to delete this document?"; $lang->doc->confirmDeleteLib = "Do you want to delete this document library?"; $lang->doc->errorEditSystemDoc = "You don't have to change system document library."; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index e5a30df8b5..e4f8887a60 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -47,6 +47,7 @@ $lang->doc->users = 'Utilisateurs'; $lang->doc->item = ' Objets'; $lang->doc->num = 'Documents'; $lang->doc->searchResult = 'Résultat de Recherche'; +$lang->doc->mailto = 'Mailto'; $lang->doc->moduleDoc = 'Par Module'; $lang->doc->searchDoc = 'Rechercher'; @@ -155,6 +156,12 @@ $lang->doc->customShowLibsList['zero'] = 'Montrer Bibliothèques Vides'; $lang->doc->customShowLibsList['children'] = 'Montrer sous-catégorie de Documents'; $lang->doc->customShowLibsList['unclosed'] = "Montrer {$lang->projectCommon}s actifs seulement"; +$lang->doc->mail = new stdclass(); +$lang->doc->mail->create = new stdclass(); +$lang->doc->mail->edit = new stdclass(); +$lang->doc->mail->create->title = "%s created document #%s:%s"; +$lang->doc->mail->edit->title = "%s edited document #%s:%s"; + $lang->doc->confirmDelete = "Voulez-vous supprimer ce document ?"; $lang->doc->confirmDeleteLib = "Voulez-vous supprimer cette Bibliothèque ?"; $lang->doc->errorEditSystemDoc = "Vous n'avez pas besoin de changer de système de Bibliothèque."; diff --git a/module/doc/lang/vi.php b/module/doc/lang/vi.php index d3ea1fd8d5..7e51f6941f 100644 --- a/module/doc/lang/vi.php +++ b/module/doc/lang/vi.php @@ -10,104 +10,105 @@ * @link http://www.zentao.net */ /* Fields. */ -$lang->doc->common = 'Tài liệu'; -$lang->doc->id = 'ID'; -$lang->doc->product = $lang->productCommon; -$lang->doc->project = $lang->projectCommon; -$lang->doc->lib = 'Thư viện'; -$lang->doc->module = 'Danh mục'; -$lang->doc->title = 'Tên'; -$lang->doc->digest = 'Tóm tắt'; -$lang->doc->comment = 'Nhận xét'; -$lang->doc->type = 'Loại'; -$lang->doc->content = 'Text'; -$lang->doc->keywords = 'Tags'; -$lang->doc->url = 'URL'; -$lang->doc->files = 'Files'; -$lang->doc->addedBy = 'Author'; -$lang->doc->addedDate = 'Đã thêm'; -$lang->doc->editedBy = 'UpdatedBy'; -$lang->doc->editedDate = 'UpdatedDate'; -$lang->doc->version = 'Phiên bản'; -$lang->doc->basicInfo = 'Thông tin cơ bản'; -$lang->doc->deleted = 'Đã xóa'; -$lang->doc->fileObject = 'Dependent Item'; -$lang->doc->whiteList = 'Danh sách trắng'; -$lang->doc->contentType = 'Định dạng'; -$lang->doc->separator = ""; -$lang->doc->fileTitle = 'File tên'; -$lang->doc->filePath = 'File Path'; -$lang->doc->extension = 'Extension'; -$lang->doc->size = 'Size'; -$lang->doc->download = 'Tải về'; -$lang->doc->acl = 'Right'; -$lang->doc->fileName = 'Files'; -$lang->doc->groups = 'Nhóm'; -$lang->doc->users = 'Người dùng'; -$lang->doc->item = ' Items'; -$lang->doc->num = 'Documents'; -$lang->doc->searchResult = 'Search kết quả'; +$lang->doc->common = 'Tài liệu'; +$lang->doc->id = 'ID'; +$lang->doc->product = $lang->productCommon; +$lang->doc->project = $lang->projectCommon; +$lang->doc->lib = 'Thư viện'; +$lang->doc->module = 'Danh mục'; +$lang->doc->title = 'Tên'; +$lang->doc->digest = 'Tóm tắt'; +$lang->doc->comment = 'Nhận xét'; +$lang->doc->type = 'Loại'; +$lang->doc->content = 'Text'; +$lang->doc->keywords = 'Tags'; +$lang->doc->url = 'URL'; +$lang->doc->files = 'Files'; +$lang->doc->addedBy = 'Author'; +$lang->doc->addedDate = 'Đã thêm'; +$lang->doc->editedBy = 'UpdatedBy'; +$lang->doc->editedDate = 'UpdatedDate'; +$lang->doc->version = 'Phiên bản'; +$lang->doc->basicInfo = 'Thông tin cơ bản'; +$lang->doc->deleted = 'Đã xóa'; +$lang->doc->fileObject = 'Dependent Item'; +$lang->doc->whiteList = 'Danh sách trắng'; +$lang->doc->contentType = 'Định dạng'; +$lang->doc->separator = ""; +$lang->doc->fileTitle = 'File tên'; +$lang->doc->filePath = 'File Path'; +$lang->doc->extension = 'Extension'; +$lang->doc->size = 'Size'; +$lang->doc->download = 'Tải về'; +$lang->doc->acl = 'Right'; +$lang->doc->fileName = 'Files'; +$lang->doc->groups = 'Nhóm'; +$lang->doc->users = 'Người dùng'; +$lang->doc->item = ' Items'; +$lang->doc->num = 'Documents'; +$lang->doc->searchResult = 'Search kết quả'; +$lang->doc->mailto = 'Mailto'; -$lang->doc->moduleDoc = 'By Module'; -$lang->doc->searchDoc = 'Tìm kiếm'; -$lang->doc->fast = 'Quick Entry'; -$lang->doc->allDoc = 'Tất cả tài liệu'; -$lang->doc->openedByMe = 'Của bạn'; -$lang->doc->orderByOpen = 'Recent Added'; -$lang->doc->orderByEdit = 'Recent Updated'; -$lang->doc->orderByVisit = 'Last Visited'; -$lang->doc->todayEdited = 'Updated Today'; -$lang->doc->pastEdited = 'Tổng Updated'; -$lang->doc->myDoc = 'My tài liệu'; -$lang->doc->myCollection = 'My Favorites'; +$lang->doc->moduleDoc = 'By Module'; +$lang->doc->searchDoc = 'Tìm kiếm'; +$lang->doc->fast = 'Quick Entry'; +$lang->doc->allDoc = 'Tất cả tài liệu'; +$lang->doc->openedByMe = 'Của bạn'; +$lang->doc->orderByOpen = 'Recent Added'; +$lang->doc->orderByEdit = 'Recent Updated'; +$lang->doc->orderByVisit = 'Last Visited'; +$lang->doc->todayEdited = 'Updated Today'; +$lang->doc->pastEdited = 'Tổng Updated'; +$lang->doc->myDoc = 'My tài liệu'; +$lang->doc->myCollection = 'My Favorites'; /* Methods list */ -$lang->doc->index = 'Document Home'; -$lang->doc->create = 'Tạo tài liệu'; -$lang->doc->edit = 'Sửa tài liệu'; -$lang->doc->delete = 'Xóa tài liệu'; -$lang->doc->browse = 'Document danh sách'; -$lang->doc->view = 'Document Detail'; -$lang->doc->diff = 'Diff'; -$lang->doc->diffAction = 'Diff tài liệu'; -$lang->doc->sort = 'Đánh giá tài liệu'; -$lang->doc->manageType = 'Quản lý danh mục'; -$lang->doc->editType = 'Sửa'; -$lang->doc->deleteType = 'Xóa'; -$lang->doc->addType = 'Thêm'; -$lang->doc->childType = 'Categories'; -$lang->doc->collect = 'Thêm Favorite'; -$lang->doc->cancelCollection = 'Remove Favorite'; -$lang->doc->deleteFile = 'Xóa File'; +$lang->doc->index = 'Document Home'; +$lang->doc->create = 'Tạo tài liệu'; +$lang->doc->edit = 'Sửa tài liệu'; +$lang->doc->delete = 'Xóa tài liệu'; +$lang->doc->browse = 'Document danh sách'; +$lang->doc->view = 'Document Detail'; +$lang->doc->diff = 'Diff'; +$lang->doc->diffAction = 'Diff tài liệu'; +$lang->doc->sort = 'Đánh giá tài liệu'; +$lang->doc->manageType = 'Quản lý danh mục'; +$lang->doc->editType = 'Sửa'; +$lang->doc->deleteType = 'Xóa'; +$lang->doc->addType = 'Thêm'; +$lang->doc->childType = 'Categories'; +$lang->doc->collect = 'Thêm Favorite'; +$lang->doc->cancelCollection = 'Remove Favorite'; +$lang->doc->deleteFile = 'Xóa File'; -$lang->doc->libName = 'Thư viện tài liệu'; -$lang->doc->libType = 'Danh mục'; -$lang->doc->custom = 'Tùy biến thư viện tài liệu'; -$lang->doc->customAB = 'Tùy biến Doc Lib'; -$lang->doc->createLib = 'Tạo thư viện tài liệu'; -$lang->doc->allLibs = 'Library danh sách'; -$lang->doc->objectLibs = "{$lang->productCommon}/{$lang->projectCommon} Libraries"; -$lang->doc->showFiles = 'Attachments'; -$lang->doc->editLib = 'Sửa thư viện tài liệu'; -$lang->doc->deleteLib = 'Xóa thư viện tài liệu'; -$lang->doc->fixedMenu = 'Sửa to Menu'; -$lang->doc->removeMenu = 'Remove from Menu'; -$lang->doc->search = 'Tìm kiếm'; +$lang->doc->libName = 'Thư viện tài liệu'; +$lang->doc->libType = 'Danh mục'; +$lang->doc->custom = 'Tùy biến thư viện tài liệu'; +$lang->doc->customAB = 'Tùy biến Doc Lib'; +$lang->doc->createLib = 'Tạo thư viện tài liệu'; +$lang->doc->allLibs = 'Library danh sách'; +$lang->doc->objectLibs = "{$lang->productCommon}/{$lang->projectCommon} Libraries"; +$lang->doc->showFiles = 'Attachments'; +$lang->doc->editLib = 'Sửa thư viện tài liệu'; +$lang->doc->deleteLib = 'Xóa thư viện tài liệu'; +$lang->doc->fixedMenu = 'Sửa to Menu'; +$lang->doc->removeMenu = 'Remove from Menu'; +$lang->doc->search = 'Tìm kiếm'; /* Query condition list. */ -$lang->doc->allProduct = 'All' . $lang->productCommon; -$lang->doc->allProject = 'All' . $lang->projectCommon; +$lang->doc->allProduct = 'All' . $lang->productCommon; +$lang->doc->allProject = 'All' . $lang->projectCommon; -$lang->doc->libTypeList['product'] = $lang->productCommon . ' thư viện'; -$lang->doc->libTypeList['project'] = $lang->projectCommon . ' thư viện'; -$lang->doc->libTypeList['custom'] = 'Tùy biến thư viện'; +$lang->doc->libTypeList['product'] = $lang->productCommon . ' thư viện'; +$lang->doc->libTypeList['project'] = $lang->projectCommon . ' thư viện'; +$lang->doc->libTypeList['custom'] = 'Tùy biến thư viện'; -$lang->doc->libIconList['product'] = 'icon-cube'; -$lang->doc->libIconList['project'] = 'icon-stack'; -$lang->doc->libIconList['custom'] = 'icon-folder-o'; +$lang->doc->libIconList['product'] = 'icon-cube'; +$lang->doc->libIconList['project'] = 'icon-stack'; +$lang->doc->libIconList['custom'] = 'icon-folder-o'; -$lang->doc->systemLibs['product'] = $lang->productCommon; -$lang->doc->systemLibs['project'] = $lang->projectCommon; +$lang->doc->systemLibs['product'] = $lang->productCommon; +$lang->doc->systemLibs['project'] = $lang->projectCommon; global $config; if($config->global->flow == 'onlyStory' or $config->global->flow == 'onlyTest') unset($lang->doc->systemLibs['project']); @@ -115,76 +116,82 @@ if($config->global->flow == 'onlyStory' or $config->global->flow == 'onlyTest') if($config->global->flow == 'onlyTask') unset($lang->doc->systemLibs['product']); if($config->global->flow == 'onlyTask') unset($lang->doc->libTypeList['product']); -$lang->doc->aclList['open'] = 'Công khai'; -$lang->doc->aclList['custom'] = 'Tùy biến'; -$lang->doc->aclList['private'] = 'Riêng tư'; +$lang->doc->aclList['open'] = 'Công khai'; +$lang->doc->aclList['custom'] = 'Tùy biến'; +$lang->doc->aclList['private'] = 'Riêng tư'; -$lang->doc->typeList['html'] = 'Html'; -$lang->doc->typeList['markdown'] = 'Markdown'; -$lang->doc->typeList['url'] = 'URL'; -$lang->doc->typeList['word'] = 'Word'; -$lang->doc->typeList['ppt'] = 'PPT'; -$lang->doc->typeList['excel'] = 'Excel'; +$lang->doc->typeList['html'] = 'Html'; +$lang->doc->typeList['markdown'] = 'Markdown'; +$lang->doc->typeList['url'] = 'URL'; +$lang->doc->typeList['word'] = 'Word'; +$lang->doc->typeList['ppt'] = 'PPT'; +$lang->doc->typeList['excel'] = 'Excel'; -$lang->doc->types['text'] = 'Text'; -$lang->doc->types['url'] = 'URL'; +$lang->doc->types['text'] = 'Text'; +$lang->doc->types['url'] = 'URL'; -$lang->doc->contentTypeList['html'] = 'HTML'; -$lang->doc->contentTypeList['markdown'] = 'MarkDown'; +$lang->doc->contentTypeList['html'] = 'HTML'; +$lang->doc->contentTypeList['markdown'] = 'MarkDown'; -$lang->doc->browseType = 'Danh mục'; -$lang->doc->browseTypeList['list'] = 'Danh sách'; -$lang->doc->browseTypeList['grid'] = 'Card'; +$lang->doc->browseType = 'Danh mục'; +$lang->doc->browseTypeList['list'] = 'Danh sách'; +$lang->doc->browseTypeList['grid'] = 'Card'; -$lang->doc->fastMenuList['byediteddate'] = 'Recent Edited'; -//$lang->doc->fastMenuList['visiteddate'] = 'Recently Visited'; -$lang->doc->fastMenuList['openedbyme'] = 'My tài liệu'; -$lang->doc->fastMenuList['collectedbyme'] = 'My Favorites'; +$lang->doc->fastMenuList['byediteddate'] = 'Recent Edited'; +//$lang->doc->fastMenuList['visiteddate'] = 'Recently Visited'; +$lang->doc->fastMenuList['openedbyme'] = 'My tài liệu'; +$lang->doc->fastMenuList['collectedbyme'] = 'My Favorites'; -$lang->doc->fastMenuIconList['byediteddate'] = 'icon-folder-upload'; -//$lang->doc->fastMenuIconList['visiteddate'] = 'icon-folder-move'; -$lang->doc->fastMenuIconList['openedbyme'] = 'icon-folder-account'; -$lang->doc->fastMenuIconList['collectedbyme'] = 'icon-folder-star'; +$lang->doc->fastMenuIconList['byediteddate'] = 'icon-folder-upload'; +//$lang->doc->fastMenuIconList['visiteddate'] = 'icon-folder-move'; +$lang->doc->fastMenuIconList['openedbyme'] = 'icon-folder-account'; +$lang->doc->fastMenuIconList['collectedbyme'] = 'icon-folder-star'; -$lang->doc->customObjectLibs['files'] = 'Hiện Attachment thư viện'; -$lang->doc->customObjectLibs['customFiles'] = 'Hiện Custom thư viện'; +$lang->doc->customObjectLibs['files'] = 'Hiện Attachment thư viện'; +$lang->doc->customObjectLibs['customFiles'] = 'Hiện Custom thư viện'; -$lang->doc->orderLib = 'Đánh giá Thiết lập'; -$lang->doc->customShowLibs = 'Display Thiết lập'; -$lang->doc->customShowLibsList['zero'] = 'Display Empty thư viện'; -$lang->doc->customShowLibsList['children'] = 'Display Child-category tài liệu'; -$lang->doc->customShowLibsList['unclosed'] = "Display Active {$lang->projectCommon} Only"; +$lang->doc->orderLib = 'Đánh giá Thiết lập'; +$lang->doc->customShowLibs = 'Display Thiết lập'; +$lang->doc->customShowLibsList['zero'] = 'Display Empty thư viện'; +$lang->doc->customShowLibsList['children'] = 'Display Child-category tài liệu'; +$lang->doc->customShowLibsList['unclosed'] = "Display Active {$lang->projectCommon} Only"; -$lang->doc->confirmDelete = "Bạn có muốn xóa this document?"; -$lang->doc->confirmDeleteLib = "Bạn có muốn xóa this document library?"; -$lang->doc->errorEditSystemDoc = "You don't have to change system document library."; -$lang->doc->errorEmptyProduct = "Không có {$lang->productCommon}. It cannot be created."; -$lang->doc->errorEmptyProject = "Không có {$lang->projectCommon}. It cannot be created."; -$lang->doc->errorMainSysLib = "This library không thể xóa."; -$lang->doc->accessDenied = "Access bị từ chối!"; -$lang->doc->versionNotFount = 'Nó does not exist in bản dựng này.'; -$lang->doc->noDoc = 'Không có documents. '; -$lang->doc->cannotCreateOffice = 'Sorry, %s can only be created in ZenTao Enterprise. Contact us at renee@easysoft.ltd to try ZenTao Enterprise.'; +$lang->doc->mail = new stdclass(); +$lang->doc->mail->create = new stdclass(); +$lang->doc->mail->edit = new stdclass(); +$lang->doc->mail->create->title = "%s created document #%s:%s"; +$lang->doc->mail->edit->title = "%s edited document #%s:%s"; + +$lang->doc->confirmDelete = "Bạn có muốn xóa this document?"; +$lang->doc->confirmDeleteLib = "Bạn có muốn xóa this document library?"; +$lang->doc->errorEditSystemDoc = "You don't have to change system document library."; +$lang->doc->errorEmptyProduct = "Không có {$lang->productCommon}. It cannot be created."; +$lang->doc->errorEmptyProject = "Không có {$lang->projectCommon}. It cannot be created."; +$lang->doc->errorMainSysLib = "This library không thể xóa."; +$lang->doc->accessDenied = "Access bị từ chối!"; +$lang->doc->versionNotFount = 'Nó does not exist in bản dựng này.'; +$lang->doc->noDoc = 'Không có documents. '; +$lang->doc->cannotCreateOffice = 'Sorry, %s can only be created in ZenTao Enterprise. Contact us at renee@easysoft.ltd to try ZenTao Enterprise.'; $lang->doc->notSetOffice = "

To create a %s document, you need to configure office convert.

"; -$lang->doc->noSearchedDoc = 'Không có documents found.'; -$lang->doc->noEditedDoc = 'Bạn có not edited any documents.'; -$lang->doc->noOpenedDoc = 'Bạn chưa tạo any documents.'; -$lang->doc->noCollectedDoc = 'Bạn có not favorited any documents.'; +$lang->doc->noSearchedDoc = 'Không có documents found.'; +$lang->doc->noEditedDoc = 'Bạn có not edited any documents.'; +$lang->doc->noOpenedDoc = 'Bạn chưa tạo any documents.'; +$lang->doc->noCollectedDoc = 'Bạn có not favorited any documents.'; -$lang->doc->noticeAcl['lib']['product']['default'] = 'Users who can access the selected product có thể truy cập nó.'; -$lang->doc->noticeAcl['lib']['product']['custom'] = 'Users who can access the selected product or users in the whiltelist có thể truy cập nó.'; -$lang->doc->noticeAcl['lib']['project']['default'] = 'Users who can access the selected project có thể truy cập nó.'; -$lang->doc->noticeAcl['lib']['project']['custom'] = 'Users who can access the selected project or users in the whiltelist có thể truy cập nó.'; -$lang->doc->noticeAcl['lib']['custom']['open'] = 'Tất cả users có thể truy cập nó.'; -$lang->doc->noticeAcl['lib']['custom']['custom'] = 'Users in the whitelist có thể truy cập nó.'; -$lang->doc->noticeAcl['lib']['custom']['private'] = 'Chỉ the one who created it có thể truy cập nó.'; +$lang->doc->noticeAcl['lib']['product']['default'] = 'Users who can access the selected product có thể truy cập nó.'; +$lang->doc->noticeAcl['lib']['product']['custom'] = 'Users who can access the selected product or users in the whiltelist có thể truy cập nó.'; +$lang->doc->noticeAcl['lib']['project']['default'] = 'Users who can access the selected project có thể truy cập nó.'; +$lang->doc->noticeAcl['lib']['project']['custom'] = 'Users who can access the selected project or users in the whiltelist có thể truy cập nó.'; +$lang->doc->noticeAcl['lib']['custom']['open'] = 'Tất cả users có thể truy cập nó.'; +$lang->doc->noticeAcl['lib']['custom']['custom'] = 'Users in the whitelist có thể truy cập nó.'; +$lang->doc->noticeAcl['lib']['custom']['private'] = 'Chỉ the one who created it có thể truy cập nó.'; -$lang->doc->noticeAcl['doc']['open'] = 'Users who can access the document library which the document belongs có thể truy cập nó.'; -$lang->doc->noticeAcl['doc']['custom'] = 'Users in the whiltelist có thể truy cập nó.'; -$lang->doc->noticeAcl['doc']['private'] = 'Chỉ the one who created it có thể truy cập nó.'; +$lang->doc->noticeAcl['doc']['open'] = 'Users who can access the document library which the document belongs có thể truy cập nó.'; +$lang->doc->noticeAcl['doc']['custom'] = 'Users in the whiltelist có thể truy cập nó.'; +$lang->doc->noticeAcl['doc']['private'] = 'Chỉ the one who created it có thể truy cập nó.'; -$lang->doc->placeholder = new stdclass(); -$lang->doc->placeholder->url = 'URL'; +$lang->doc->placeholder = new stdclass(); +$lang->doc->placeholder->url = 'URL'; $lang->doclib = new stdclass(); $lang->doclib->name = 'Tên'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 80bd9b4e93..66fc445b97 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -47,6 +47,7 @@ $lang->doc->users = '用户'; $lang->doc->item = '项'; $lang->doc->num = '文档数量'; $lang->doc->searchResult = '搜索结果'; +$lang->doc->mailto = '抄送给'; $lang->doc->moduleDoc = '按模块浏览'; $lang->doc->searchDoc = '搜索'; @@ -155,6 +156,12 @@ $lang->doc->customShowLibsList['zero'] = '显示空文档的库'; $lang->doc->customShowLibsList['children'] = '显示子分类的文档'; $lang->doc->customShowLibsList['unclosed'] = '只显示未关闭的项目'; +$lang->doc->mail = new stdclass(); +$lang->doc->mail->create = new stdclass(); +$lang->doc->mail->edit = new stdclass(); +$lang->doc->mail->create->title = "%s创建了文档 #%s:%s"; +$lang->doc->mail->edit->title = "%s编辑了文档 #%s:%s"; + $lang->doc->confirmDelete = "您确定删除该文档吗?"; $lang->doc->confirmDeleteLib = "您确定删除该文档库吗?"; $lang->doc->errorEditSystemDoc = "系统文档库无需修改。"; diff --git a/module/doc/model.php b/module/doc/model.php index 4c14f661d1..a928e479f2 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -618,6 +618,7 @@ class docModel extends model ->cleanInt('product,project,module,lib') ->join('groups', ',') ->join('users', ',') + ->join('mailto', ',') ->remove('files,labels,uid') ->get(); @@ -693,6 +694,7 @@ class docModel extends model ->cleanInt('module') ->join('groups', ',') ->join('users', ',') + ->join('mailto', ',') ->remove('comment,files,labels,uid') ->get(); if($doc->contentType == 'markdown') $doc->content = $this->post->content; @@ -1625,4 +1627,102 @@ class docModel extends model return $actions; } + + /** + * Send mail. + * + * @param int $docID + * @param int $actionID + * @access public + * @return void + */ + public function sendmail($docID, $actionID) + { + $this->loadModel('mail'); + $doc = $this->getById($docID); + $users = $this->loadModel('user')->getPairs('noletter'); + + /* Get action info. */ + $action = $this->loadModel('action')->getById($actionID); + $history = $this->action->getHistory($actionID); + $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); + + /* Get mail content. */ + $modulePath = $this->app->getModulePath($appName = '', 'doc'); + $oldcwd = getcwd(); + $viewFile = $modulePath . 'view/sendmail.html.php'; + chdir($modulePath . 'view'); + if(file_exists($modulePath . 'ext/view/sendmail.html.php')) + { + $viewFile = $modulePath . 'ext/view/sendmail.html.php'; + chdir($modulePath . 'ext/view'); + } + ob_start(); + include $viewFile; + foreach(glob($modulePath . 'ext/view/sendmail.*.html.hook.php') as $hookFile) include $hookFile; + $mailContent = ob_get_contents(); + ob_end_clean(); + chdir($oldcwd); + + $sendUsers = $this->getToAndCcList($doc); + if(!$sendUsers) return; + list($toList, $ccList) = $sendUsers; + $subject = $this->getSubject($doc, $action->action); + + /* Send mail. */ + $this->mail->send($toList, $subject, $mailContent, $ccList); + if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError())); + } + + /** + * Get mail subject. + * + * @param object $doc + * @param string $actionType created|edited + * @access public + * @return string + */ + public function getSubject($doc, $actionType) + { + /* Set email title. */ + if($actionType == 'created') + { + return sprintf($this->lang->doc->mail->create->title, $this->app->user->realname, $doc->id, $doc->title); + } + else + { + return sprintf($this->lang->doc->mail->edit->title, $this->app->user->realname, $doc->id, $doc->title); + } + } + + /** + * Get toList and ccList. + * + * @param object $doc + * @access public + * @return bool|array + */ + public function getToAndCcList($doc) + { + /* Set toList and ccList. */ + $toList = ''; + $ccList = str_replace(' ', '', trim($doc->mailto, ',')); + + if(empty($toList)) + { + if(empty($ccList)) return false; + if(strpos($ccList, ',') === false) + { + $toList = $ccList; + $ccList = ''; + } + else + { + $commaPos = strpos($ccList, ','); + $toList = substr($ccList, 0, $commaPos); + $ccList = substr($ccList, $commaPos + 1); + } + } + return array($toList, $ccList); + } } diff --git a/module/doc/view/create.html.php b/module/doc/view/create.html.php index bd066c5746..d0438e8ff9 100644 --- a/module/doc/view/create.html.php +++ b/module/doc/view/create.html.php @@ -82,6 +82,17 @@ doc->files;?> fetch('file', 'buildform');?> + + doc->mailto;?> + +

+ fetch('my', 'buildContactLists'); + ?> +
+ + doclib->control;?> diff --git a/module/doc/view/edit.html.php b/module/doc/view/edit.html.php index 5e47a4c99b..62781f1fbd 100644 --- a/module/doc/view/edit.html.php +++ b/module/doc/view/edit.html.php @@ -59,6 +59,17 @@ doc->files;?> fetch('file', 'buildform');?> + + doc->mailto;?> + +
+ fetch('my', 'buildContactLists'); + ?> +
+ + doclib->control;?> diff --git a/module/doc/view/sendmail.html.php b/module/doc/view/sendmail.html.php new file mode 100644 index 0000000000..0eb84c2042 --- /dev/null +++ b/module/doc/view/sendmail.html.php @@ -0,0 +1,35 @@ + + * @package doc + * @version $Id: sendmail.html.php 3717 2020-11-03 15:35:07Z tianshujie@easycorp.ltd $ + * @link https://www.zentao.net + */ +?> +id . ' ' . $doc->title;?> +app->getModuleRoot() . 'common/view/mail.header.html.php';?> + + + + + + +
+ color) ? '#333' : $doc->color;?> + config->mail, 'domain', common::getSysURL()) . helper::createLink('doc', 'view', "docID=$doc->id", 'html'), $mailTitle, '', "style='color: {$color}; text-decoration: underline;'");?> +
+ + + + +
+ lang->doc->content;?> +
content;?>
+
+ + +app->getModuleRoot() . 'common/view/mail.footer.html.php';?> diff --git a/module/message/config.php b/module/message/config.php index ee6124f295..2bb98c694b 100644 --- a/module/message/config.php +++ b/module/message/config.php @@ -9,12 +9,14 @@ $config->message->objectTypes['bug'] = array('opened', 'edited', 'commen $config->message->objectTypes['case'] = array('opened', 'edited', 'commented', 'reviewed', 'confirmed'); $config->message->objectTypes['testtask'] = array('opened', 'edited', 'started', 'blocked', 'closed', 'activated'); $config->message->objectTypes['todo'] = array('opened', 'edited'); +$config->message->objectTypes['doc'] = array('created', 'edited'); $config->message->available = array(); $config->message->available['mail']['story'] = $config->message->objectTypes['story']; $config->message->available['mail']['task'] = $config->message->objectTypes['task']; $config->message->available['mail']['bug'] = $config->message->objectTypes['bug']; $config->message->available['mail']['testtask'] = array('opened', 'edited', 'closed'); +$config->message->available['mail']['doc'] = $config->message->objectTypes['doc']; $config->message->available['webhook'] = $config->message->objectTypes; @@ -23,6 +25,7 @@ $config->message->available['message']['story'] = $config->message->objectTyp $config->message->available['message']['task'] = $config->message->objectTypes['task']; $config->message->available['message']['testtask'] = $config->message->objectTypes['testtask']; $config->message->available['message']['todo'] = $config->message->objectTypes['todo']; +$config->message->available['message']['doc'] = $config->message->objectTypes['doc']; $config->message->typeLink = array(); $config->message->typeLink['mail'] = 'mail|index'; From a13f8cd4c0df9cd0137fe0e31c4f3f65bcce6c04 Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Tue, 3 Nov 2020 17:26:51 +0800 Subject: [PATCH 02/10] * Adjust the logic of the assigned to. --- module/task/control.php | 9 +++++++-- module/task/view/start.html.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index cb18eb20b7..cb5aa720ac 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -738,11 +738,16 @@ class task extends control die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } + $users = $this->loadModel('user')->getPairs('noletter'); + $members = $this->loadModel('project')->getTeamMemberPairs($task->project, 'nodeleted'); + $assignedTo = in_array(zget($this->app->user->account, $users), $members) === TRUE ? $this->app->user->account : ''; + $this->view->title = $this->view->project->name . $this->lang->colon .$this->lang->task->start; $this->view->position[] = $this->lang->task->start; - $this->view->members = $this->loadModel('project')->getTeamMemberPairs($task->project, 'nodeleted'); - $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->view->users = $users; + $this->view->members = $members; + $this->view->assignedTo = $task->assignedTo == '' ? $assignedTo : $task->assignedTo; $this->display(); } diff --git a/module/task/view/start.html.php b/module/task/view/start.html.php index 70fc5c50ce..8c8520f4a9 100644 --- a/module/task/view/start.html.php +++ b/module/task/view/start.html.php @@ -42,7 +42,7 @@ task->assignedTo;?> - app->user->account, "class='form-control chosen'");?> + From fd4876f1d02d1305887223c624677fcfc882a62f Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 3 Nov 2020 17:30:17 +0800 Subject: [PATCH 03/10] * Adjust code style. --- module/doc/control.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 9dbc452a94..43158a3c9a 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -320,8 +320,6 @@ class doc extends control $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->duplicate, $this->lang->doc->common), 'locate' => $this->createLink('doc', 'view', "docID=$docID"))); } - $this->executeHooks($docID); - $fileAction = ''; if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ; $this->action->create('doc', $docID, 'Created', $fileAction); From 7ef58a2d4020b62fe839d094c660ad1190debbf3 Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Tue, 3 Nov 2020 17:41:31 +0800 Subject: [PATCH 04/10] * Add the title of the doc. --- module/doc/view/index.html.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/doc/view/index.html.php b/module/doc/view/index.html.php index 5c497bf2cf..6c2c5876c0 100644 --- a/module/doc/view/index.html.php +++ b/module/doc/view/index.html.php @@ -37,7 +37,7 @@ id}");?>"> - title;?> + title;?> fileSize ? $doc->fileSize : '-';?> addedBy);?> editedDate == '0000-00-00 00:00:00' ? formatTime($doc->addedDate, 'Y-m-d') : formatTime($doc->editedDate, 'Y-m-d');?> @@ -172,7 +172,7 @@ id}");?>"> - title;?> + title;?> addedBy);?> editedDate) ? formatTime($doc->editedDate, 'Y-m-d') : formatTime($doc->addedDate, 'y-m-d');?> From 43174e39ec52627b3ba15e6ecae49c6405522f87 Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Wed, 4 Nov 2020 09:06:41 +0800 Subject: [PATCH 05/10] * Finish task#8200: Add the lib field for search testcase. --- module/testcase/config.php | 2 ++ module/testcase/control.php | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/module/testcase/config.php b/module/testcase/config.php index 487f67fa13..e100b19c06 100644 --- a/module/testcase/config.php +++ b/module/testcase/config.php @@ -47,6 +47,7 @@ $config->testcase->search['fields']['branch'] = ''; $config->testcase->search['fields']['stage'] = $lang->testcase->stage; $config->testcase->search['fields']['module'] = $lang->testcase->module; $config->testcase->search['fields']['pri'] = $lang->testcase->pri; +$config->testcase->search['fields']['lib'] = $lang->testcase->lib; $config->testcase->search['fields']['lastRunner'] = $lang->testcase->lastRunner; $config->testcase->search['fields']['lastRunResult'] = $lang->testcase->lastRunResult; @@ -66,6 +67,7 @@ $config->testcase->search['params']['status'] = array('operator' => '=', $config->testcase->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->testcase->search['params']['branch'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->testcase->search['params']['stage'] = array('operator' => 'include', 'control' => 'select', 'values' => $lang->testcase->stageList); +$config->testcase->search['params']['lib'] = array('operator' => '=', 'control' => 'select', 'values' => ''); $config->testcase->search['params']['lastRunner'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); $config->testcase->search['params']['lastRunResult'] = array('operator' => '=', 'control' => 'select', 'values' => array_diff($lang->testcase->resultList, array('n/a' => $lang->testcase->resultList['n/a']))); diff --git a/module/testcase/control.php b/module/testcase/control.php index 8b7baa26c1..276a653594 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -108,9 +108,12 @@ class testcase extends control /* Build the search form. */ $actionURL = $this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); $this->config->testcase->search['onMenuBar'] = 'yes'; + + $libs = $this->loadModel('caselib')->getLibraries(); + $this->config->testcase->search['params']['lib']['values'] = $libs; $this->testcase->buildSearchForm($productID, $this->products, $queryID, $actionURL); - $showModule = !empty($this->config->datatable->testcaseBrowse->showModule) ? $this->config->datatable->testcaseBrowse->showModule : ''; + $showModule = !empty($this->config->datatable->testcaseBrowse->showModule) ? $this->config->datatable->testcaseBrowse->showModule : ''; $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array(); /* Assign. */ @@ -137,6 +140,7 @@ class testcase extends control $this->view->suiteList = $this->loadModel('testsuite')->getSuites($productID); $this->view->suiteID = $suiteID; $this->view->setModule = true; + $this->view->libs = $libs; $this->display(); } From 0e31686cdcad2e6983085d61409acb49de5ba327 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Wed, 4 Nov 2020 09:14:57 +0800 Subject: [PATCH 06/10] * Finish task#8219. --- module/story/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/control.php b/module/story/control.php index d06b04fb39..31ee0c403f 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -412,7 +412,7 @@ class story extends control $this->view->type = $type; $this->view->branch = $branch; $this->view->branches = $this->loadModel('branch')->getPairs($productID); - $this->view->needReview = ($this->app->user->account == $product->PO || $this->config->story->needReview == 0) ? 0 : 1; + $this->view->needReview = ($this->app->user->account == $product->PO || $project > 0 || $this->config->story->needReview == 0) ? 0 : 1; $this->display(); } From 47aa8bd9b56608e628cb3199e879728c373309fd Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Wed, 4 Nov 2020 09:58:15 +0800 Subject: [PATCH 07/10] * Finish task#8212. --- module/bug/model.php | 3 ++- module/story/control.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 4ec513e36a..31d6731c1f 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1603,11 +1603,12 @@ class bugModel extends model * @access public * @return array */ - public function getStoryBugs($storyID) + public function getStoryBugs($storyID, $projectID = 0) { return $this->dao->select('id, title, pri, type, status, assignedTo, resolvedBy, resolution') ->from(TABLE_BUG) ->where('story')->eq((int)$storyID) + ->beginIF($projectID)->andWhere('project')->eq($projectID)->fi() ->andWhere('deleted')->eq(0) ->fetchAll('id'); } diff --git a/module/story/control.php b/module/story/control.php index 31ee0c403f..705ab7653e 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1219,10 +1219,10 @@ class story extends control * @access public * @return void */ - public function bugs($storyID) + public function bugs($storyID, $projectID = 0) { $this->loadModel('bug'); - $this->view->bugs = $this->bug->getStoryBugs($storyID); + $this->view->bugs = $this->bug->getStoryBugs($storyID, $projectID); $this->view->users = $this->user->getPairs('noletter'); $this->display(); } From 1dd736e9ed03af3239eabab3fde4f001f3c2e6f1 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 4 Nov 2020 10:05:03 +0800 Subject: [PATCH 08/10] * Finish task #8264. --- module/doc/control.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/doc/control.php b/module/doc/control.php index 43158a3c9a..1e64aa8f0e 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -445,6 +445,8 @@ class doc extends control { $hyperdown = $this->app->loadClass('hyperdown'); $doc->content = $hyperdown->makeHtml($doc->content); + $doc->content = str_replace("", "", $doc->content); + $doc->content = str_replace("", "", $doc->content); $doc->digest = $hyperdown->makeHtml($doc->digest); } From 770309794d98419b44dfbf2397f337c8dc8155d0 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 4 Nov 2020 10:12:49 +0800 Subject: [PATCH 09/10] * Add comment. --- module/doc/control.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/doc/control.php b/module/doc/control.php index 1e64aa8f0e..6e71529464 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -432,6 +432,7 @@ class doc extends control * View a doc. * * @param int $docID + * @param int $version * @access public * @return void */ @@ -445,6 +446,7 @@ class doc extends control { $hyperdown = $this->app->loadClass('hyperdown'); $doc->content = $hyperdown->makeHtml($doc->content); + /* Add a newline attribute to the table. */ $doc->content = str_replace("", "", $doc->content); $doc->content = str_replace("", "", $doc->content); $doc->digest = $hyperdown->makeHtml($doc->digest); From d3356b16757480cdb685dc40aaf123fea93be487 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 4 Nov 2020 10:36:36 +0800 Subject: [PATCH 10/10] * Finish task #8228. --- module/extension/control.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/extension/control.php b/module/extension/control.php index 4ca71c2bda..67f038bc94 100644 --- a/module/extension/control.php +++ b/module/extension/control.php @@ -26,6 +26,9 @@ class extension extends control $statusFile = $this->loadModel('common')->checkSafeFile(); if($statusFile) { + $this->view->title = $this->lang->extension->browse; + $this->view->position[] = $this->lang->extension->browse; + $this->view->error = sprintf($this->lang->extension->noticeOkFile, str_replace('\\', '/', $statusFile)); die($this->display('extension', 'safe')); }