diff --git a/module/doc/control.php b/module/doc/control.php index 02e0c29bf4..b33c405781 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -132,11 +132,10 @@ class doc extends control $libID = $this->doc->createlib(); if(!dao::isError()) { - $objectType = $this->post->type; - if($objectType == 'project' and $this->post->project) $objectID = $this->post->project; - if($objectType == 'product' and $this->post->product) $objectID = $this->post->product; - if($objectType == 'execution' and $this->post->execution) $objectID = $this->post->execution; - if($objectType == 'custom' or $objectType == 'book') $objectID = 0; + if($type == 'project' and $this->post->project) $objectID = $this->post->project; + if($type == 'product' and $this->post->product) $objectID = $this->post->product; + if($type == 'execution' and $this->post->execution) $objectID = $this->post->execution; + if($type == 'custom') $objectID = 0; $this->action->create('docLib', $libID, 'Created'); @@ -149,54 +148,49 @@ class doc extends control } } - $products = $this->product->getPairs(); - $projects = $this->project->getPairsByProgram('', 'all', true); - $executions = $this->execution->getList(); + if(in_array($type, array('product', 'project'))) $this->app->loadLang('api'); - /* Splice project name. */ - foreach($executions as $executionID => $execution) + if($type == 'product') $objects = $this->product->getPairs(); + if($type == 'project') $objects = $this->project->getPairsByProgram(); + if($type == 'execution') { - if($execution->multiple) - { - if($execution->type == 'stage' and $execution->grade > 1) - { - $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); - $execution->name = implode('/', $parentExecutions); - } - - $executionPrefix = isset($projects[$execution->project]) ? $projects[$execution->project] . '/' : ''; - $executions[$executionID] = $executionPrefix . $execution->name; - } - else - { - unset($executions[$executionID]); - } + $objects = $this->execution->getList(); + $projects = $this->project->getPairsByProgram('', 'all', true); } - /* Get the project that has permission to view. */ - foreach($projects as $projectID => $project) if(!$this->app->user->admin and strpos(',' . $this->app->user->view->projects . ',', ',' . $projectID . ',') === false) unset($projects[$projectID]); + /* Splice project name. */ + if($type == 'object') + { + foreach($objects as $id => $object) + { + if($object->multiple) + { + if($object->type == 'stage' and $object->grade > 1) + { + $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($object->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); + $object->name = implode('/', $parentExecutions); + } + + $objectPrefix = isset($projects[$object->project]) ? $projects[$object->project] . '/' : ''; + $objects[$id] = $objectPrefix . $object->name; + } + else + { + unset($objects[$id]); + } + } + } if($type == 'execution') { $execution = $this->execution->getByID($objectID); if($execution->type == 'stage') $this->lang->doc->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->execution); - if($execution->type == 'stage') $this->lang->doc->libTypeList['execution'] = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->libTypeList['execution']); } - $libTypeList = $this->lang->doc->libTypeList; - if(empty($products)) unset($libTypeList['product']); - if(empty($projects)) unset($libTypeList['project']); - if(empty($executions)) unset($libTypeList['execution']); - - $this->app->loadLang('api'); - $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('nocode|noclosed'); - $this->view->products = $products; - $this->view->projects = $projects; - $this->view->executions = $executions; + $this->view->objects = $objects; $this->view->type = $type; - $this->view->libTypeList = $libTypeList; $this->view->objectID = $objectID; $this->display(); } diff --git a/module/doc/css/createlib.css b/module/doc/css/createlib.css index 7a5b6bbfba..0baf88c868 100644 --- a/module/doc/css/createlib.css +++ b/module/doc/css/createlib.css @@ -8,3 +8,4 @@ table {width: 90% !important;} #execution_chosen {width: 50% !important;} #groups_chosen.chosen-container .chosen-results, #users_chosen.chosen-container .chosen-results {max-height: 160px;} +.objectBox > td.required:after {right: 274px;} diff --git a/module/doc/js/common.js b/module/doc/js/common.js index be9b87367f..9b798ba2eb 100644 --- a/module/doc/js/common.js +++ b/module/doc/js/common.js @@ -46,12 +46,6 @@ function toggleAcl(acl, type) if(type == 'lib') { - var libType = $('input[name="type"]:checked').val(); - var notice = typeof(noticeAcl[libType][acl]) != 'undefined' ? noticeAcl[libType][acl] : ''; - $('#noticeAcl').html(notice); - - if((libType == 'custom' || libType == 'api' || libType == 'book') && acl == 'private') $('#whiteListBox').addClass('hidden'); - if(libType == 'project' && typeof(doclibID) != 'undefined') { var link = createLink('doc', 'ajaxGetWhitelist', 'doclibID=' + doclibID + '&acl=' + acl); diff --git a/module/doc/js/createlib.js b/module/doc/js/createlib.js index 109cb8c86a..ee7acfa3ef 100644 --- a/module/doc/js/createlib.js +++ b/module/doc/js/createlib.js @@ -124,9 +124,6 @@ function changeByLibType(libType) changeDoclibAcl(libType); } - var acl = $('form [name=acl]').val(); - var notice = typeof(noticeAcl[libType][acl]) != 'undefined' ? noticeAcl[libType][acl] : ''; - $('#noticeAcl').html(notice); $('#whiteListBox').addClass('hidden'); } diff --git a/module/doc/view/createlib.html.php b/module/doc/view/createlib.html.php index 8dcc0847a5..3be904d5e9 100644 --- a/module/doc/view/createlib.html.php +++ b/module/doc/view/createlib.html.php @@ -12,6 +12,7 @@ ?> +