diff --git a/module/doc/control.php b/module/doc/control.php index 8084e96f9b..22ae79100f 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -387,6 +387,22 @@ class doc extends control $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('doc', 'view', "docID=$docID"))); } + $libs = $this->doc->getLibs(); + foreach($libs as $id => $libName) + { + $lib = $this->doc->getLibById($id); + if($lib->project != 0) + { + $project = $this->loadModel('project')->getByID($lib->project); + $libs[$id] = $project->name . '/' . $libName; + } + if($lib->product != 0) + { + $product = $this->loadModel('product')->getByID($lib->product); + $libs[$id] = $product->name . '/' . $libName; + } + } + /* Get doc and set menu. */ $doc = $this->doc->getById($docID); $libID = $doc->lib; @@ -404,6 +420,7 @@ class doc extends control $this->view->doc = $doc; $this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0); $this->view->type = $type; + $this->view->libs = $libs; $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('noletter', $doc->users); $this->display(); @@ -617,10 +634,11 @@ class doc extends control * @access public * @return void */ - public function ajaxGetChild($libID) + public function ajaxGetChild($libID, $type = 'module') { $childModules = $this->loadModel('tree')->getOptionMenu($libID, 'doc'); - die(html::select('parent', $childModules, '', "class='form-control'")); + $select = ($type == 'module') ? html::select('module', $childModules, '', "class='form-control chosen'") : html::select('parent', $childModules, '', "class='form-control chosen'"); + die($select); } /** diff --git a/module/doc/js/edit.js b/module/doc/js/edit.js index 66dae955b9..ee768cb4e7 100644 --- a/module/doc/js/edit.js +++ b/module/doc/js/edit.js @@ -16,3 +16,14 @@ $(function() } }) }) + +function loadDocModule(libID) +{ + link = createLink('doc', 'ajaxGetChild', 'libID=' + libID); + $.post(link, function(data) + { + $('#module').replaceWith(data); + $('#module_chosen').remove(); + $('#module').chosen(); + }) +} diff --git a/module/doc/model.php b/module/doc/model.php index 5b8308bcf3..1410756a24 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -658,7 +658,7 @@ class docModel extends model $doc = $this->loadModel('file')->processImgURL($doc, $this->config->doc->editor->edit['id'], $this->post->uid); $doc->product = $lib->product; $doc->project = $lib->project; - if($doc->type == 'url') $doc->content = $doc->url; + if(isset($doc->type) and $doc->type == 'url') $doc->content = $doc->url; unset($doc->url); $files = $this->file->saveUpload('doc', $docID); diff --git a/module/doc/view/edit.html.php b/module/doc/view/edit.html.php index 60eda1a97e..279b8bc963 100644 --- a/module/doc/view/edit.html.php +++ b/module/doc/view/edit.html.php @@ -24,10 +24,13 @@