diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index a01621e869..d6f2352e6c 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -158,6 +158,8 @@ $lang->product->menuOrder[55] = 'setting'; $lang->product->menuOrder[60] = 'create'; $lang->product->menuOrder[65] = 'all'; +$lang->product->menu->doc['subMenu'] = new stdclass(); + $lang->product->menu->settings['subMenu'] = new stdclass(); $lang->product->menu->settings['subMenu']->view = array('link' => "{$lang->overview}|product|view|productID=%s", 'alias' => 'edit'); $lang->product->menu->settings['subMenu']->module = array('link' => "{$lang->module}|tree|browse|product=%s&view=story", 'subModule' => 'tree'); @@ -197,6 +199,8 @@ $lang->scrum->menuOrder[40] = 'release'; $lang->scrum->menuOrder[48] = 'dynamic'; $lang->scrum->menuOrder[50] = 'settings'; +$lang->scrum->menu->doc['subMenu'] = new stdclass(); + $lang->scrum->menu->qa['subMenu'] = new stdclass(); //$lang->scrum->menu->qa['subMenu']->index = array('link' => "$lang->dashboard|project|qa|projectID=%s"); $lang->scrum->menu->qa['subMenu']->bug = array('link' => "{$lang->bug->common}|project|bug|projectID=%s", 'subModule' => 'bug'); @@ -245,6 +249,8 @@ $lang->execution->menuOrder[55] = 'release'; $lang->execution->menuOrder[60] = 'action'; $lang->execution->menuOrder[65] = 'setting'; +$lang->execution->menu->doc['subMenu'] = new stdclass(); + $lang->execution->menu->view['subMenu'] = new stdclass(); $lang->execution->menu->view['subMenu']->groupTask = "$lang->groupView|execution|grouptask|executionID=%s"; $lang->execution->menu->view['subMenu']->tree = "$lang->treeView|execution|tree|executionID=%s"; @@ -320,8 +326,8 @@ $lang->doc->menu->dashboard = array('link' => "{$lang->dashboard}|doc|index"); $lang->doc->menu->recent = array('link' => "{$lang->doc->recent}|doc|browse|libID=0&browseTyp=byediteddate", 'alias' => 'recent'); $lang->doc->menu->my = array('link' => "{$lang->doc->my}|doc|browse|libID=0&browseTyp=openedbyme", 'alias' => 'my'); $lang->doc->menu->collect = array('link' => "{$lang->doc->favorite}|doc|browse|libID=0&browseTyp=collectedbyme", 'alias' => 'collect'); -$lang->doc->menu->product = array('link' => "{$lang->doc->product}|doc|objectLibs|type=product"); -$lang->doc->menu->project = array('link' => "{$lang->doc->project}|doc|objectLibs|type=project"); +$lang->doc->menu->product = array('link' => "{$lang->doc->product}|doc|objectLibs|type=product", 'alias' => 'product'); +$lang->doc->menu->project = array('link' => "{$lang->doc->project}|doc|objectLibs|type=project", 'alias' => 'project'); $lang->doc->menu->custom = array('link' => "{$lang->doc->custom}|doc|objectLibs|libID=0"); $lang->doc->dividerMenu = ',product,'; @@ -335,6 +341,9 @@ $lang->doc->menuOrder[25] = 'product'; $lang->doc->menuOrder[30] = 'project'; $lang->doc->menuOrder[35] = 'custom'; +$lang->doc->menu->product['subMenu'] = new stdclass(); +$lang->doc->menu->project['subMenu'] = new stdclass(); + /* Report menu.*/ $lang->report->menu = new stdclass(); $lang->report->menu->annual = array('link' => "{$lang->report->annual}|report|annualData|year=&dept=&userID=" . (isset($_SESSION['user']) ? zget($_SESSION['user'], 'id', 0) : 0), 'target' => '_blank'); diff --git a/module/doc/control.php b/module/doc/control.php index b9ffb0c8a5..8e060f7ca8 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -47,10 +47,6 @@ class doc extends control $this->app->loadClass('pager', $static = true); $pager = new pager(0, 5, 1); - $this->lang->TRActions = $this->doc->setFastMenu($this->lang->doc->fast); - $this->lang->TRActions .= common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), " " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : ''; - $this->lang->TRActions .= common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc() : ''; - $actionURL = $this->createLink('doc', 'browse', "lib=0&browseType=bySearch&queryID=myQueryID"); $this->doc->buildSearchForm(0, array(), 0, $actionURL, 'index'); @@ -859,12 +855,37 @@ class doc extends control * @access public * @return void */ - public function objectLibs($type, $objectID = 0) + public function objectLibs($type, $objectID = 0, $libID = 0) { // setcookie('from', $from, $this->config->cookieLife, $this->config->webRoot, '', false, true); $this->session->set('docList', $this->app->getURI(true), 'doc'); - $table = $type == 'product' ? TABLE_PRODUCT : TABLE_PROJECT; + if($type == 'product') + { + $objects = $this->loadModel('product')->getPairs('nocode'); + $objectID = $this->product->saveState($objectID, $objects); + $table = TABLE_PRODUCT; + + $libs = $this->doc->getLibsByObject('product', $objectID); + $this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID == 0 ? key($libs) : $libID); + + $this->app->rawMethod = 'product'; + } + else + { + $objects = $this->loadModel('project')->getPairsByProgram(); + $objectID = $this->project->saveState($objectID, $objects); + $table = TABLE_PROJECT; + + $libs = $this->doc->getLibsByObject('project', $objectID); + $this->lang->modulePageNav = $this->doc->select($type, $objects, $objectID, $libs, $libID == 0 ? key($libs) : $libID); + + $this->app->rawMethod = 'project'; + } + + $this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), " " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : ''; + $this->lang->TRActions .= common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc() : ''; + $object = $this->dao->select('id,name,status')->from($table)->where('id')->eq($objectID)->fetch(); if(empty($object)) $this->locate($this->createLink($type, 'create', '', '', '', $this->session->project)); diff --git a/module/doc/css/objectlibs.css b/module/doc/css/objectlibs.css index 42e741fb34..33aec7c1f9 100644 --- a/module/doc/css/objectlibs.css +++ b/module/doc/css/objectlibs.css @@ -5,3 +5,4 @@ #dropMenu {min-width: 250px; box-sizing: inhert;} .main-col .block-files .panel-heading {padding-right: 20px;} .main-col .block-files .panel-heading .panel-title {height: 35px; line-height: 30px;} +#dropMenu .table-col .list-group {padding-top: 10px;} diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index cbd766b9ce..841a5ea44c 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -13,6 +13,7 @@ $lang->doc->common = 'Document'; $lang->doc->id = 'ID'; $lang->doc->product = $lang->productCommon; +$lang->doc->project = 'Project'; $lang->doc->execution = $lang->executionCommon; $lang->doc->lib = 'Library'; $lang->doc->module = 'Category'; @@ -82,6 +83,8 @@ $lang->doc->collect = 'Add Favorite'; $lang->doc->cancelCollection = 'Remove Favorite'; $lang->doc->deleteFile = 'Delete File'; +$lang->doc->collectAction = 'Add Favorite'; + $lang->doc->libName = 'Document Library'; $lang->doc->libType = 'Category'; $lang->doc->custom = 'Custom Document Library'; @@ -212,6 +215,7 @@ $lang->doclib->create['execution'] = 'Create ' . $lang->executionCommon . ' Libr $lang->doclib->create['custom'] = 'Create Custom Library'; $lang->doclib->main['product'] = 'Primary Library'; +$lang->doclib->main['project'] = 'Primary Library'; $lang->doclib->main['execution'] = 'Primary Library'; $lang->doclib->tabList['product'] = $lang->productCommon; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index ddf398a44d..83236121b6 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -13,6 +13,7 @@ $lang->doc->common = '文档'; $lang->doc->id = '文档编号'; $lang->doc->product = '所属' . $lang->productCommon; +$lang->doc->project = '所属项目'; $lang->doc->execution = '所属' . $lang->executionCommon; $lang->doc->lib = '所属文档库'; $lang->doc->module = '所属分类'; @@ -214,6 +215,7 @@ $lang->doclib->create['execution'] = '创建' . $lang->executionCommon . '文档 $lang->doclib->create['custom'] = '创建自定义文档库'; $lang->doclib->main['product'] = $lang->productCommon . '主库'; +$lang->doclib->main['project'] = '项目主库'; $lang->doclib->main['execution'] = $lang->executionCommon . '主库'; $lang->doclib->tabList['product'] = $lang->productCommon; diff --git a/module/doc/model.php b/module/doc/model.php index fd5b8a535b..cfc6ab94df 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1117,6 +1117,7 @@ class docModel extends model public function getLibsByObject($type, $objectID, $mode = '') { if($type != 'product' and $type != 'project' and $type != 'execution') return false; + $objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->andWhere($type)->eq($objectID)->orderBy('`order`, id')->fetchAll('id'); if($type == 'product') @@ -1139,12 +1140,14 @@ class docModel extends model $itemCounts = $this->statLibCounts(array_keys($libs)); foreach($libs as $libID => $lib) $libs[$libID]->allCount = $itemCounts[$libID]; + /* if(common::hasPriv('doc', 'showFiles')) { $libs['files'] = new stdclass(); $libs['files']->name = $this->lang->doclib->files; $libs['files']->allCount = count($this->getLibFiles($type, $objectID, 'id_desc')); } + */ return $libs; } @@ -1203,6 +1206,7 @@ class docModel extends model public function getLibFiles($type, $objectID, $orderBy, $pager = null) { if($type != 'execution' and $type != 'project' and $type != 'product') return true; + $this->loadModel('file'); $docs = $this->dao->select('*')->from(TABLE_DOC)->where($type)->eq($objectID)->fetchAll('id'); foreach($docs as $id => $doc) @@ -1289,7 +1293,8 @@ class docModel extends model $executionIdList = join(',', $executionIdList); $files = $this->dao->select('*')->from(TABLE_FILE)->alias('t1') ->where('size')->gt('0') - ->andWhere("(objectType = 'execution' and objectID in ($executionIdList))", true) + ->andWhere("(objectType = 'project' and objectID = $objectID)", true) + ->orWhere("(objectType = 'execution' and objectID in ($executionIdList))") ->orWhere("(objectType = 'doc' and objectID in ($docIdList))") ->orWhere("(objectType = 'task' and objectID in ($taskIdList))") ->orWhere("(objectType = 'build' and objectID in ($buildIdList))") @@ -1767,4 +1772,44 @@ EOF; } return $navCSS; } + + /** + * Create the select code of doc. + * + * @param string $type + * @param array $objects + * @param int $objectID + * @param array $libs + * @param int $libID + * @access public + * @return string + */ + public function select($type, $objects, $objectID, $libs, $libID = 0) + { + if(empty($objects)) return ''; + + $output = ''; + $dropMenuLink = helper::createLink('repo', 'ajaxGetDropMenu'); + + $output = "