* Finish task #5110.

This commit is contained in:
Yagami
2018-11-13 11:12:23 +08:00
parent 30353dc9d4
commit 05cf1e5a34
3 changed files with 32 additions and 1 deletions
+12
View File
@@ -611,6 +611,18 @@ class doc extends control
die(json_encode($this->doc->getAllLibGroups()));
}
/**
* Ajax get all child module.
*
* @access public
* @return void
*/
public function ajaxGetChild($libID)
{
$childModules = $this->loadModel('tree')->getOptionMenu($libID, 'doc');
die(html::select('parent', $childModules, '', "class='form-control'"));
}
/**
* Show all libs by type.
*
+1
View File
@@ -240,6 +240,7 @@ class tree extends control
$this->view->module = $module;
$this->view->type = $type;
$this->view->libs = array('' => '') + $this->loadModel('doc')->getLibs();
$this->view->branch = $branch;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted', $module->owner);
+19 -1
View File
@@ -13,6 +13,7 @@
<?php
$webRoot = $this->app->getWebRoot();
$jsRoot = $webRoot . "js/";
js::set('type', $type);
?>
<?php include '../../common/view/chosen.html.php';?>
<div class='modal-dialog w-500px'>
@@ -30,6 +31,12 @@ $jsRoot = $webRoot . "js/";
</tr>
<?php endif;?>
<?php $hidden = ($type != 'story' and $module->type == 'story');?>
<?php if($type == 'doc'):?>
<tr>
<th class='w-80px'><?php echo $lang->doc->lib;?></th>
<td><?php echo html::select('root', $libs, $module->root, "class='form-control chosen' onchange=loadDocModule(this.value)");?></td>
</tr>
<?php endif;?>
<?php if($module->type != 'line'):?>
<tr <?php if($hidden) echo "style='display:none'";?>>
<th class='w-80px'><?php echo $lang->tree->parent;?></th>
@@ -75,6 +82,7 @@ function getProductModules(productID)
}
$(function()
{
if(type == 'doc') return;
$('#root').change(function()
{
if($(this).val() == currentRoot) return true;
@@ -86,5 +94,15 @@ $(function()
getProductModules($(this).val());
})
})
function loadDocModule(libID)
{
link = createLink('doc', 'ajaxGetChild', 'libID=' + libID);
$.post(link, function(data)
{
$('#parent').replaceWith(data);
$('#parent_chosen').remove();
$('#parent').chosen();
})
}
$(function(){$('.chosen').chosen();})
</script>
</script>