diff --git a/module/doc/control.php b/module/doc/control.php index 7724b65df6..35f930da6f 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -70,7 +70,12 @@ class doc extends control */ public function browse($browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { - $this->session->set('docList', $this->app->getURI(true), 'doc'); + /* Save session, load module. */ + $uri = $this->app->getURI(true); + $this->session->set('docList', $uri, 'doc'); + $this->session->set('productList', $uri, 'product'); + $this->session->set('executionList', $uri, 'execution'); + $this->session->set('projectList', $uri, 'project'); $this->loadModel('search'); /* Set browseType.*/ diff --git a/module/doc/js/browse.js b/module/doc/js/browse.js index 0b95e564e5..7069c7e805 100644 --- a/module/doc/js/browse.js +++ b/module/doc/js/browse.js @@ -1,4 +1,7 @@ $('.ajaxCollect').click(function() { - window.location.reload(); + if(browseType == 'collectedbyme') + { + window.location.reload(); + } }) diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index de3c45d8fe..25cd16baa5 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -16,6 +16,7 @@ $lang->doc->product = $lang->productCommon; $lang->doc->execution = $lang->executionCommon; $lang->doc->lib = 'Bibliothek'; $lang->doc->module = 'Modul'; +$lang->doc->object = 'Object'; $lang->doc->title = 'Titel'; $lang->doc->digest = 'Zusammenfassung'; $lang->doc->comment = 'Bemerkung'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 86ad3fcb9c..95b90e6c8e 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -17,6 +17,7 @@ $lang->doc->project = 'Project'; $lang->doc->execution = $lang->executionCommon; $lang->doc->lib = 'Library'; $lang->doc->module = 'Catalog'; +$lang->doc->object = 'Object'; $lang->doc->title = 'Name'; $lang->doc->digest = 'Summary'; $lang->doc->comment = 'Comment'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index b7130464e3..b13b96b2c3 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -16,6 +16,7 @@ $lang->doc->product = $lang->productCommon; $lang->doc->execution = $lang->executionCommon; $lang->doc->lib = 'Bibliothèque'; $lang->doc->module = 'Catégorie'; +$lang->doc->object = 'Object'; $lang->doc->title = 'Nom'; $lang->doc->digest = 'Résumé'; $lang->doc->comment = 'Commentaire'; diff --git a/module/doc/lang/vi.php b/module/doc/lang/vi.php index 6104d9e766..d232acb35f 100644 --- a/module/doc/lang/vi.php +++ b/module/doc/lang/vi.php @@ -16,6 +16,7 @@ $lang->doc->product = $lang->productCommon; $lang->doc->execution = $lang->executionCommon; $lang->doc->lib = 'Thư viện'; $lang->doc->module = 'Danh mục'; +$lang->doc->object = 'Object'; $lang->doc->title = 'Tên'; $lang->doc->digest = 'Tóm tắt'; $lang->doc->comment = 'Nhận xét'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 20d4dc8fd4..821eeb15ad 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -17,6 +17,7 @@ $lang->doc->project = '所属项目'; $lang->doc->execution = '所属' . $lang->executionCommon; $lang->doc->lib = '所属文档库'; $lang->doc->module = '所属目录'; +$lang->doc->object = '所属对象'; $lang->doc->title = '文档标题'; $lang->doc->digest = '文档摘要'; $lang->doc->comment = '文档备注'; diff --git a/module/doc/model.php b/module/doc/model.php index 6d46b39d42..a30c4b5658 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -255,9 +255,38 @@ class docModel extends model ->fetchAll('id'); } + $projects = $this->dao->select('t1.id, t1.name')->from(TABLE_PROJECT)->alias('t1') + ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.project') + ->where('t2.id')->in(array_keys($docs)) + ->andWhere('t2.execution')->eq(0) + ->fetchPairs(); + + $executions = $this->dao->select('t1.id, t1.name')->from(TABLE_EXECUTION)->alias('t1') + ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.execution') + ->where('t2.id')->in(array_keys($docs)) + ->fetchPairs(); + + $products = $this->dao->select('t1.id, t1.name')->from(TABLE_PRODUCT)->alias('t1') + ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.product') + ->where('t2.id')->in(array_keys($docs)) + ->fetchPairs(); + $docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc'); + + $objects = array('product' => 'products', 'execution' => 'executions', 'project' => 'projects'); foreach($docs as $index => $doc) { + foreach($objects as $type => $object) + { + if(!empty($doc->{$type})) + { + $doc->objectID = $doc->{$type}; + $doc->objectName = ${$object}[$doc->{$type}]; + $doc->objectType = $type; + break; + } + } + $docs[$index]->fileSize = 0; if(isset($files[$index])) { diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php index 2c4a7ad128..2b93faab33 100644 --- a/module/doc/view/browse.html.php +++ b/module/doc/view/browse.html.php @@ -36,6 +36,7 @@ doc->title;?> + doc->object;?> doc->size;?> doc->addedBy;?> doc->addedDate;?> @@ -49,6 +50,14 @@ collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?> createLink('doc', 'view', "docID=$doc->id&version=0", '', true), "  " . $doc->title, '', "title={$doc->title} class='iframe' data-width='90%'");?> + + objectType)):?> + {$doc->objectType}->common . ' : ';?> + objectID");?>' data-app="objectType;?>"> + objectName;?> + + + fileSize ? $doc->fileSize : '-';?> addedBy);?> addedDate, 'y-m-d');?> diff --git a/module/my/control.php b/module/my/control.php index 2bb5f21477..d27d9ae06e 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -480,9 +480,14 @@ class my extends control public function doc($type = 'openedbyme', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save session, load lang. */ - if($this->app->viewType != 'json') $this->session->set('docList', $this->app->getURI(true), 'doc'); + $uri = $this->app->getURI(true); + if($this->app->viewType != 'json') $this->session->set('docList', $uri, 'doc'); $this->loadModel('doc'); + $this->session->set('productList', $uri, 'product'); + $this->session->set('executionList', $uri, 'execution'); + $this->session->set('projectList', $uri, 'project'); + /* Load pager. */ $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); diff --git a/module/my/view/doc.html.php b/module/my/view/doc.html.php index 7dc567d712..4c777bbdc7 100644 --- a/module/my/view/doc.html.php +++ b/module/my/view/doc.html.php @@ -34,6 +34,7 @@ doc->title;?> + doc->object;?> doc->size;?> doc->addedBy;?> @@ -49,6 +50,14 @@ collector, ',' . $this->app->user->account . ',') !== false ? $lang->doc->cancelCollection : $lang->doc->collect;?> createLink('doc', 'view', "docID=$doc->id&version=0&from={$lang->navGroup->doc}", '', true), "  " . $doc->title, '', "title={$doc->title} class='iframe' data-width='90%'");?> + + objectType)):?> + {$doc->objectType}->common . ' : ';?> + objectID");?>' data-app="objectType;?>"> + objectName;?> + + + fileSize ? $doc->fileSize : '-';?> addedBy);?> diff --git a/module/program/model.php b/module/program/model.php index 197b011be2..5b891db4f4 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -773,7 +773,7 @@ class programModel extends model $treeMenu = array(); foreach($modules as $module) { - if(strpos($this->app->user->view->programs, $module->id) === false) continue; + if(strpos($this->app->user->view->programs, $module->id) === false and (!$this->app->user->admin)) continue; $moduleName = '/'; $parentModules = explode(',', $module->path);