diff --git a/db/update20.8.sql b/db/update20.8.sql index 1116dd2a11..04ce06425c 100644 --- a/db/update20.8.sql +++ b/db/update20.8.sql @@ -51,3 +51,5 @@ INSERT INTO `zt_workflowgroup` (`type`, `projectModel`, `projectType`, `name`, ` ('project', 'scrum', 'project', '敏捷-项目型默认流程', 'scrumproject', 'normal', 'rnd', '1'), ('project', 'waterfall', 'product', '瀑布-产品型默认流程', 'waterfallproduct', 'normal', 'rnd', '1'), ('project', 'waterfall', 'project', '瀑布-项目型默认流程', 'waterfallproject', 'normal', 'rnd', '1'); + +ALTER TABLE `zt_doclib` ADD `orderBy` varchar(30) NOT NULL DEFAULT 'id_asc' AFTER `deleted`; diff --git a/db/zentao.sql b/db/zentao.sql index bda10ddc1b..e0fcaa56b3 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -824,6 +824,7 @@ CREATE TABLE IF NOT EXISTS `zt_doclib` ( `addedBy` varchar(30) NOT NULL DEFAULT '', `addedDate` datetime NULL, `deleted` enum('0','1') NOT NULL DEFAULT '0', + `orderBy` varchar(30) NOT NULL DEFAULT 'id_asc', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE INDEX `product` ON `zt_doclib`(`product`); diff --git a/module/doc/config/form.php b/module/doc/config/form.php index 20c8074986..6b26dc1b4d 100644 --- a/module/doc/config/form.php +++ b/module/doc/config/form.php @@ -26,12 +26,14 @@ $config->doc->form->createlib['users'] = array('type' => 'array', 'requir $config->doc->form->createlib['vision'] = array('type' => 'string', 'required' => false, 'default' => $config->vision); $config->doc->form->createlib['addedBy'] = array('type' => 'string', 'required' => false, 'default' => ''); $config->doc->form->createlib['addedDate'] = array('type' => 'datetime', 'required' => false, 'default' => $now); +$config->doc->form->createlib['orderBy'] = array('type' => 'string', 'required' => false, 'default' => 'id_asc'); -$config->doc->form->editlib['space'] = array('type' => 'string', 'required' => true, 'default' => ''); -$config->doc->form->editlib['name'] = array('type' => 'string', 'required' => true, 'default' => '', 'filter' => 'trim'); -$config->doc->form->editlib['acl'] = array('type' => 'string', 'required' => false, 'default' => ''); -$config->doc->form->editlib['groups'] = array('type' => 'array', 'required' => false, 'default' => '', 'filter' => 'join'); -$config->doc->form->editlib['users'] = array('type' => 'array', 'required' => false, 'default' => '', 'filter' => 'join'); +$config->doc->form->editlib['space'] = array('type' => 'string', 'required' => true, 'default' => ''); +$config->doc->form->editlib['name'] = array('type' => 'string', 'required' => true, 'default' => '', 'filter' => 'trim'); +$config->doc->form->editlib['acl'] = array('type' => 'string', 'required' => false, 'default' => ''); +$config->doc->form->editlib['groups'] = array('type' => 'array', 'required' => false, 'default' => '', 'filter' => 'join'); +$config->doc->form->editlib['users'] = array('type' => 'array', 'required' => false, 'default' => '', 'filter' => 'join'); +$config->doc->form->editlib['orderBy'] = array('type' => 'string', 'required' => false, 'default' => 'id_asc'); $config->doc->form->create['title'] = array('type' => 'string', 'required' => true, 'default' => '', 'filter' => 'trim'); $config->doc->form->create['version'] = array('type' => 'int', 'required' => false, 'default' => 1); diff --git a/module/doc/control.php b/module/doc/control.php index b866dbcbda..c8aeea468a 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -892,7 +892,7 @@ class doc extends control * @access public * @return void */ - public function productSpace(int $objectID = 0, int $libID = 0, int $moduleID = 0, string $browseType = 'all', string $orderBy = 'order_asc', int $param = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $mode = '', int $docID = 0, string $search = '') + public function productSpace(int $objectID = 0, int $libID = 0, int $moduleID = 0, string $browseType = 'all', string $orderBy = '', int $param = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $mode = '', int $docID = 0, string $search = '') { $noSpace = $this->app->tab != 'doc'; $mode = $noSpace ? 'list' : $mode; @@ -915,7 +915,7 @@ class doc extends control * @access public * @return void */ - public function projectSpace(int $objectID = 0, int $libID = 0, int $moduleID = 0, string $browseType = 'all', string $orderBy = 'order_asc', int $param = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $mode = '', int $docID = 0, string $search = '') + public function projectSpace(int $objectID = 0, int $libID = 0, int $moduleID = 0, string $browseType = 'all', string $orderBy = '', int $param = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $mode = '', int $docID = 0, string $search = '') { $noSpace = $this->app->tab != 'doc'; $mode = $noSpace ? 'list' : $mode; @@ -938,7 +938,7 @@ class doc extends control * @access public * @return void */ - public function teamSpace(int $objectID = 0, int $libID = 0, int $moduleID = 0, string $browseType = 'all', string $orderBy = 'order_asc', int $param = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $mode = '', int $docID = 0, string $search = '') + public function teamSpace(int $objectID = 0, int $libID = 0, int $moduleID = 0, string $browseType = 'all', string $orderBy = '', int $param = 0, int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $mode = '', int $docID = 0, string $search = '') { if(empty($objectID)) { @@ -1489,7 +1489,7 @@ class doc extends control * @access public * @return void */ - public function app(string $type = 'mine', int $spaceID = 0, int $libID = 0, int $moduleID = 0, int $docID = 0, string $mode = '', string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $filterType = '', string $search = '', bool $noSpace = false) + public function app(string $type = 'mine', int $spaceID = 0, int $libID = 0, int $moduleID = 0, int $docID = 0, string $mode = '', string $orderBy = '', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $filterType = '', string $search = '', bool $noSpace = false) { $isNotDocTab = $this->app->tab != 'doc'; if(empty($mode)) $mode = ($isNotDocTab || $type == 'execution' || $noSpace) ? 'list' : 'home'; @@ -1508,6 +1508,12 @@ class doc extends control else $menuType = $type == 'custom' ? 'team' : $type; if(isset($this->lang->doc->menu->{$menuType})) $this->lang->doc->menu->{$menuType}['alias'] .= ',' . $this->app->rawMethod; + if(empty($orderBy)) + { + $lib = $this->doc->getLibByID($libID); + if(!empty($lib)) $orderBy = $lib->orderBy; + } + $this->view->type = $type; $this->view->spaceID = $spaceID; $this->view->libID = $libID; diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index f53a6cb42d..a3c4102116 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -26,6 +26,7 @@ $lang->doclib->spaceName = 'Space Name'; $lang->doclib->createSpace = 'Create Space'; $lang->doclib->editSpace = 'Edit Space'; $lang->doclib->privateACL = "Private (Only creators and whitelisted users with %s permissions can access it)"; +$lang->doclib->defaultOrder = 'Document default order'; $lang->doclib->tip = new stdclass(); $lang->doclib->tip->selectExecution = "When execution is empty, the library created is the {$lang->projectCommon} library"; @@ -48,6 +49,10 @@ $lang->doclib->aclList['open'] = "Public (Users who can access doccan access $lang->doclib->aclList['default'] = "Default (Users who can access the selected %s or users in the whiltelist can access it)"; $lang->doclib->aclList['private'] = "Private (Only the one who created it or users in the whiltelist can access it)"; +$lang->doclib->idOrder = array(); +$lang->doclib->idOrder['id_asc'] = 'ID ascending order'; +$lang->doclib->idOrder['id_desc'] = 'ID descending order' ; + $lang->doclib->create['product'] = 'Create ' . $lang->productCommon . ' Library'; $lang->doclib->create['execution'] = 'Create ' . $lang->executionCommon . ' Library'; $lang->doclib->create['custom'] = 'Create Custom Library'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 858644ad1f..bad56186d2 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -26,6 +26,7 @@ $lang->doclib->spaceName = 'Space Name'; $lang->doclib->createSpace = 'Create Space'; $lang->doclib->editSpace = 'Edit Space'; $lang->doclib->privateACL = "Private (Only creators and whitelisted users with %s permissions can access it)"; +$lang->doclib->defaultOrder = 'Document default order'; $lang->doclib->tip = new stdclass(); $lang->doclib->tip->selectExecution = "When execution is empty, the library created is the {$lang->projectCommon} library"; @@ -48,6 +49,10 @@ $lang->doclib->aclList['open'] = "Public (Users who can access doccan access $lang->doclib->aclList['default'] = "Default (Users who can access the selected %s or users in the whiltelist can access it)"; $lang->doclib->aclList['private'] = "Private (Only the one who created it or users in the whiltelist can access it)"; +$lang->doclib->idOrder = array(); +$lang->doclib->idOrder['id_asc'] = 'ID ascending order'; +$lang->doclib->idOrder['id_desc'] = 'ID descending order' ; + $lang->doclib->create['product'] = 'Create ' . $lang->productCommon . ' Library'; $lang->doclib->create['execution'] = 'Create ' . $lang->executionCommon . ' Library'; $lang->doclib->create['custom'] = 'Create Custom Library'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 82e69fa1f6..7c5ca9f28d 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -26,6 +26,7 @@ $lang->doclib->spaceName = 'Space Name'; $lang->doclib->createSpace = 'Create Space'; $lang->doclib->editSpace = 'Edit Space'; $lang->doclib->privateACL = "Private (Only creators and whitelisted users with %s permissions can access it)"; +$lang->doclib->defaultOrder = 'Document default order'; $lang->doclib->tip = new stdclass(); $lang->doclib->tip->selectExecution = "When execution is empty, the library created is the {$lang->projectCommon} library"; @@ -48,6 +49,10 @@ $lang->doclib->aclList['open'] = "Public (Users who can access doccan access $lang->doclib->aclList['default'] = "Default (Users who can access the selected %s or users in the whiltelist can access it)"; $lang->doclib->aclList['private'] = "Private (Only the one who created it or users in the whiltelist can access it)"; +$lang->doclib->idOrder = array(); +$lang->doclib->idOrder['id_asc'] = 'ID ascending order'; +$lang->doclib->idOrder['id_desc'] = 'ID descending order' ; + $lang->doclib->create['product'] = 'Créer ' . $lang->productCommon . ' Library'; $lang->doclib->create['execution'] = 'Créer ' . 'Bibliothèque ' . $lang->executionCommon; $lang->doclib->create['custom'] = 'Créer Bibliothèque Personnelle'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 1253843f57..b3b164a2b6 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -26,6 +26,7 @@ $lang->doclib->spaceName = '空间名称'; $lang->doclib->createSpace = '新建空间'; $lang->doclib->editSpace = '编辑空间'; $lang->doclib->privateACL = "私有 (仅创建者和有%s权限的白名单用户可访问)"; +$lang->doclib->defaultOrder = '文档默认排序'; $lang->doclib->tip = new stdclass(); $lang->doclib->tip->selectExecution = "执行为空时,创建的库为{$lang->projectCommon}库"; @@ -48,6 +49,10 @@ $lang->doclib->aclList['open'] = "公开 (有文档视图权限即可访问 $lang->doclib->aclList['default'] = "默认 (有所选%s访问权限用户可以访问)"; $lang->doclib->aclList['private'] = "私有 (仅创建者和白名单用户可访问)"; +$lang->doclib->idOrder = array(); +$lang->doclib->idOrder['id_asc'] = 'ID 正序'; +$lang->doclib->idOrder['id_desc'] = 'ID 倒序'; + $lang->doclib->create['product'] = '创建' . $lang->productCommon . '文档库'; $lang->doclib->create['execution'] = '创建' . $lang->executionCommon . '文档库'; $lang->doclib->create['custom'] = '创建自定义文档库'; diff --git a/module/doc/ui/commoneditlib.html.php b/module/doc/ui/commoneditlib.html.php index e72796c7a4..50de6bf2b2 100644 --- a/module/doc/ui/commoneditlib.html.php +++ b/module/doc/ui/commoneditlib.html.php @@ -67,6 +67,22 @@ formPanel ) ), formRow + ( + setID('orderBox'), + formGroup + ( + set::label($lang->doclib->defaultOrder), + set::width('5/6'), + radioList + ( + set::name('orderBy'), + set::items($lang->doclib->idOrder), + set::value($lib->orderBy), + set::inline(true) + ) + ) + ), + formRow ( setID('whiteListBox'), setClass('hidden'), diff --git a/module/doc/ui/createlib.html.php b/module/doc/ui/createlib.html.php index ac976ea4d8..c1df926c95 100644 --- a/module/doc/ui/createlib.html.php +++ b/module/doc/ui/createlib.html.php @@ -151,6 +151,22 @@ formPanel ) ), formRow + ( + setID('orderBox'), + formGroup + ( + set::label($lang->doclib->defaultOrder), + set::width('5/6'), + radioList + ( + set::name('orderBy'), + set::items($lang->doclib->idOrder), + set::value('id_asc'), + set::inline(true) + ) + ) + ), + formRow ( setID('whiteListBox'), setClass('hidden'),