diff --git a/module/doc/control.php b/module/doc/control.php index a681df9fd4..af8f38132e 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -79,6 +79,7 @@ class doc extends control $browseType = strtolower($browseType); $queryID = ($browseType == 'bysearch') ? (int)$param : 0; $moduleID = ($browseType == 'bymodule') ? (int)$param : 0; + $libID = ($browseType == 'bylib') ? (int)$param : 0; /* Set header and position. */ $this->view->title = $this->lang->doc->common; @@ -103,13 +104,22 @@ class doc extends control $this->app->rawMethod = 'recent'; } + $libs = $this->doc->getLibsByObject('mine', 0); + $libTree = $this->doc->getLibTree($libID, $libs, 'mine', 0); + $this->view->moduleID = $moduleID; $this->view->docs = $this->doc->getDocsByBrowseType($browseType, $queryID, $moduleID, $sort, $pager); $this->view->users = $this->user->getPairs('noletter'); $this->view->orderBy = $orderBy; $this->view->browseType = $browseType; $this->view->param = $param; + $this->view->libID = $libID; + $this->view->libTree = $libTree; $this->view->pager = $pager; + $this->view->type = 'mine'; + $this->view->objectID = 0; + $this->view->canExport = 0; + $this->view->libType = 'mine'; $this->display(); } @@ -126,7 +136,7 @@ class doc extends control { if(!empty($_POST)) { - $libID = $this->doc->createlib(); + $libID = $this->doc->createLib(); if(!dao::isError()) { if($type == 'project' and $this->post->project) $objectID = $this->post->project; @@ -167,21 +177,38 @@ class doc extends control if($execution->type == 'stage') $this->lang->doc->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->execution); } - if($type == 'custom') unset($this->lang->doclib->aclList['default']); - if($type != 'custom') + $acl = 'default'; + if($type == 'custom') + { + $acl = 'open'; + unset($this->lang->doclib->aclList['default']); + } + elseif($type == 'mine') + { + $acl = 'private'; + unset($this->lang->doclib->aclList['open']); + unset($this->lang->doclib->aclList['default']); + $this->lang->doclib->aclList['private'] = $this->lang->doclib->aclListB['private']; + } + + if($type != 'custom' and $type != 'mine') { $this->lang->doclib->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common); $this->lang->doclib->aclList['private'] = sprintf($this->lang->doclib->privateACL, $this->lang->{$type}->common); unset($this->lang->doclib->aclList['open']); } - $this->app->loadLang('api'); - $this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common); + if($type != 'mine') + { + $this->app->loadLang('api'); + $this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common); + } $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('nocode|noclosed'); $this->view->objects = $objects; $this->view->type = $type; + $this->view->acl = $acl; $this->view->objectID = $objectID; $this->display(); } diff --git a/module/doc/model.php b/module/doc/model.php index 6948a52e0f..3ffe6134f6 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1478,15 +1478,15 @@ class docModel extends model */ public function getLibsByObject($type, $objectID, $mode = '', $appendLib = 0) { - if($type == 'custom' or $type == 'book') + if($type == 'custom' or $type == 'book' or $type == 'mine') { $objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB) ->where('deleted')->eq(0) ->andWhere('vision')->eq($this->config->vision) ->andWhere('type')->eq($type) ->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi() - ->beginIF($type == 'custom')->orderBy('`order` asc, id_asc')->fi() - ->beginIF($type == 'book')->orderBy('`order` asc, id_asc')->fi() + ->beginIF($type == 'mine')->orWhere('addedBy')->eq($this->app->user->account)->fi() + ->orderBy('`order` asc, id_asc') ->fetchAll('id'); } elseif($type != 'product' and $type != 'project' and $type != 'execution') diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php index f3c2b0c765..f22e426a98 100644 --- a/module/doc/view/browse.html.php +++ b/module/doc/view/browse.html.php @@ -16,7 +16,30 @@ doc);?> doc->confirmDelete)?> tab)?> +
>
+
diff --git a/module/doc/view/createlib.html.php b/module/doc/view/createlib.html.php index c0a173fbf9..b3d6a59c9f 100644 --- a/module/doc/view/createlib.html.php +++ b/module/doc/view/createlib.html.php @@ -60,7 +60,7 @@ doclib->control;?> - doclib->aclList, $type == 'custom' ? 'open' : 'default', "onchange='toggleAcl(this.value, \"lib\")'", 'block')?> + doclib->aclList, $acl, "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>