diff --git a/module/doc/control.php b/module/doc/control.php index 8e060f7ca8..636148f606 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -214,7 +214,7 @@ class doc extends control if(!dao::isError()) { $this->action->create('docLib', $libID, 'Created'); - die(js::locate($this->createLink($this->moduleName, 'browse', "libID=$libID"), 'parent.parent')); + die(js::locate($this->createLink('doc', 'objectLibs', "type=$type&objectID=$objectID&libID=$libID"), 'parent.parent')); } else { @@ -222,9 +222,9 @@ class doc extends control } } - $projectID = $this->session->project; - $products = $this->product->getProductPairsByProject($projectID, 'noclosed'); - $executions = $this->execution->getByProject($projectID, 'all', 0, true); + $products = $this->product->getPairs(); + $projects = $this->project->getPairsByProgram(); + $executions = $this->execution->getPairs(); $libTypeList = $this->lang->doc->libTypeList; if(empty($products)) unset($libTypeList['product']); @@ -233,6 +233,7 @@ class doc extends control $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('nocode'); $this->view->products = $products; + $this->view->projects = $projects; $this->view->executions = $executions; $this->view->type = $type; $this->view->libTypeList = $libTypeList; @@ -306,7 +307,7 @@ class doc extends control * @access public * @return void */ - public function create($libID, $moduleID = 0, $docType = '') + public function create($type, $objectID, $libID, $moduleID = 0, $docType = '') { if(!empty($_POST)) { @@ -332,6 +333,22 @@ class doc extends control $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link)); } + if($this->app->openApp == 'product') + { + $this->product->setMenu($objectID); + unset($this->lang->product->menu->doc['subMenu']); + } + else if($this->app->openApp == 'project') + { + $this->project->setMenu($objectID); + unset($this->lang->project->menu->doc['subMenu']); + } + else if($this->app->openApp == 'execution') + { + $this->execution->setMenu($objectID); + unset($this->lang->exectuion->menu->doc['subMenu']); + } + $lib = $this->doc->getLibByID($libID); $type = $lib->type; @@ -883,9 +900,6 @@ class doc extends control $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)); @@ -898,6 +912,9 @@ class doc extends control $actionURL = $this->createLink('doc', 'browse', "lib=0&browseType=bySearch&queryID=myQueryID"); $this->doc->buildSearchForm(0, array(), 0, $actionURL, 'objectLibs'); + $this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib', "type=$type&objectID=$objectID"), " " . $this->lang->doc->createlib, '', "class='btn btn-secondary iframe' data-width='70%'") : ''; + $this->lang->TRActions .= common::hasPriv('doc', 'create') ? $this->doc->buildCreateButton4Doc($type, $objectID) : ''; + $this->view->customObjectLibs = $customObjectLibs; $this->view->showLibs = $this->config->doc->custom->objectLibs; diff --git a/module/doc/js/createlib.js b/module/doc/js/createlib.js index 94a784e005..8e756e199d 100644 --- a/module/doc/js/createlib.js +++ b/module/doc/js/createlib.js @@ -14,18 +14,28 @@ function changeByLibType(libType) if(libType == 'product') { $('table tr.product').removeClass('hidden'); + $('table tr.project').addClass('hidden'); + $('table tr.execution').addClass('hidden'); + changeDoclibAcl(libType); + } + else if(libType == 'project') + { + $('table tr.product').addClass('hidden'); + $('table tr.project').removeClass('hidden'); $('table tr.execution').addClass('hidden'); changeDoclibAcl(libType); } else if(libType == 'execution') { $('table tr.product').addClass('hidden'); + $('table tr.project').addClass('hidden'); $('table tr.execution').removeClass('hidden'); changeDoclibAcl(libType); } else { $('table tr.product').addClass('hidden'); + $('table tr.project').addClass('hidden'); $('table tr.execution').addClass('hidden'); changeDoclibAcl(libType); } diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 841a5ea44c..748ad2e933 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -104,6 +104,7 @@ $lang->doc->allProduct = 'All' . $lang->productCommon . 's'; $lang->doc->allExecutions = 'All' . $lang->executionCommon . 's'; $lang->doc->libTypeList['product'] = $lang->productCommon . ' Library'; +$lang->doc->libTypeList['project'] = 'Project Library'; $lang->doc->libTypeList['execution'] = $lang->executionCommon . ' Library'; $lang->doc->libTypeList['custom'] = 'Custom Library'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 83236121b6..137f36db1f 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -104,6 +104,7 @@ $lang->doc->allProduct = '所有' . $lang->productCommon; $lang->doc->allExecutions = '所有' . $lang->executionCommon; $lang->doc->libTypeList['product'] = $lang->productCommon . '文档库'; +$lang->doc->libTypeList['project'] = '项目文档库'; $lang->doc->libTypeList['execution'] = $lang->executionCommon . '文档库'; $lang->doc->libTypeList['custom'] = '自定义文档库'; diff --git a/module/doc/model.php b/module/doc/model.php index cfc6ab94df..80661d7dff 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1596,10 +1596,12 @@ class docModel extends model /** * Build document module index page create document button. * + * @param string $type + * @param int $objectID * @access public * @return string */ - public function buildCreateButton4Doc() + public function buildCreateButton4Doc($type, $objectID) { $libs = $this->getLibs('all', strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'unclosedProject' : ''); $html = ""; @@ -1613,7 +1615,7 @@ class docModel extends model { $class = strpos($this->config->doc->officeTypes, $typeKey) !== false ? 'iframe' : ''; $html .= "