diff --git a/module/doc/control.php b/module/doc/control.php index 77f2d56096..0ff5dfc3aa 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -128,6 +128,7 @@ class doc extends control $pager = new pager($recTotal, $recPerPage, $pageID); /* Append id for secend sort. */ + if($browseType == 'bymenu' and strtolower($orderBy) != 'editeddate_desc' and strtolower($orderBy) != 'addeddate_desc') $orderBy = 'title_asc'; $sort = $this->loadModel('common')->appendOrder($orderBy); /* Get docs by browse type. */ @@ -145,7 +146,7 @@ class doc extends control if($this->cookie->browseType == 'bymenu') { - $this->view->modules = $this->doc->getDocMenu($libID, $moduleID); + $this->view->modules = $this->doc->getDocMenu($libID, $moduleID, $orderBy == 'title_asc' ? 'name_asc' : 'id_desc'); $this->view->parents = $this->loadModel('tree')->getParents($moduleID); } elseif($this->cookie->browseType == 'bytree') @@ -704,23 +705,47 @@ class doc extends control * @access public * @return void */ - public function showFiles($type, $objectID) + public function showFiles($type, $objectID, $recTotal = 0, $recPerPage = 20, $pageID = 1) { $uri = $this->app->getURI(true); $this->app->session->set('taskList', $uri); $this->app->session->set('storyList', $uri); $this->app->session->set('docList', $uri); + /* According the from, set menus. */ + if($this->from == 'product') + { + $this->lang->doc->menu = $this->lang->product->menu; + $this->lang->doc->menuOrder = $this->lang->product->menuOrder; + $this->product->setMenu($this->product->getPairs(), $objectID); + $this->lang->set('menugroup.doc', 'product'); + } + elseif($this->from == 'project') + { + $this->lang->doc->menu = $this->lang->project->menu; + $this->lang->doc->menuOrder = $this->lang->project->menuOrder; + $this->project->setMenu($this->project->getPairs('nocode'), $objectID); + $this->lang->set('menugroup.doc', 'project'); + } + else + { + $this->doc->setMenu(array($this->lang->doclib->files), 0, $type); + } + + /* Load pager. */ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT; $object = $this->dao->select('id,name')->from($table)->where('id')->eq($objectID)->fetch(); - $this->doc->setMenu(array($this->lang->doclib->files), 0, $type); $this->view->title = $object->name; $this->view->position[] = $object->name; $this->view->type = $type; $this->view->object = $object; - $this->view->files = $this->doc->getLibFiles($type, $objectID); + $this->view->files = $this->doc->getLibFiles($type, $objectID, $pager); + $this->view->pager = $pager; $this->display(); } diff --git a/module/doc/css/index.css b/module/doc/css/index.css index 674e43389d..3c30337744 100644 --- a/module/doc/css/index.css +++ b/module/doc/css/index.css @@ -2,9 +2,9 @@ .lib-more a.more{font-weight:bold; display:block;} #libs .libs-group-heading{border:1px solid #ddd;} #libs .libs-group{border:1px solid #ddd; border-top:0px; margin-bottom:20px;} -#libs .libs-group.lib-more{border:0px; text-align:center; height:128px; line-height:110px;} +#libs .libs-group.lib-more{border:0px; text-align:center; height:120px; line-height:110px;} #libs .libs-group.lib-more:hover{background-color: #EBF2F9} -#libs .libs-custom-heading{text-align:left; height:128px;} +#libs .libs-custom-heading{text-align:center; height:120px; line-height:110px;} #libs .libs-custom-heading:hover{background-color: #EBF2F9} #libs .libs-custom-heading a{display:block;height:100%;} #libs hr {margin-top:0px;} diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 9e05b61d54..6b88812422 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -115,3 +115,6 @@ $lang->doclib->user = 'User'; $lang->doclib->files = 'Files'; $lang->doclib->all = 'All Libraries'; $lang->doclib->select = 'Select Library'; + +$lang->doclib->main['product'] = $lang->productCommon . ' Library'; +$lang->doclib->main['project'] = $lang->projectCommon . ' Library'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index fdfbd2ccb7..13e9dd7626 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -115,3 +115,6 @@ $lang->doclib->user = '用户'; $lang->doclib->files = '附件库'; $lang->doclib->all = '所有文档库'; $lang->doclib->select = '选择文档库'; + +$lang->doclib->main['product'] = $lang->productCommon . '库'; +$lang->doclib->main['project'] = $lang->projectCommon . '库'; diff --git a/module/doc/model.php b/module/doc/model.php index 5f3e9975ac..7434738de9 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -531,13 +531,14 @@ class docModel extends model * @param int $libID * @param int $parent * @access public - * @return void + * @return array */ - public function getDocMenu($libID, $parent) + public function getDocMenu($libID, $parent, $orderBy = 'name_asc') { return $this->dao->select('*')->from(TABLE_MODULE)->where('root')->eq($libID) ->andWhere('type')->eq('doc') ->andWhere('parent')->eq($parent) + ->orderBy($orderBy) ->fetchAll('id'); } diff --git a/module/doc/view/alllibs.html.php b/module/doc/view/alllibs.html.php index 07c5ec4a14..854bf7ce41 100644 --- a/module/doc/view/alllibs.html.php +++ b/module/doc/view/alllibs.html.php @@ -63,8 +63,7 @@ -