<body>
<jsp:include page="/av/top.jsp"></jsp:include>
<jsp:include page="/av/module/head.jsp"></jsp:include>
<!-- nav -->
<div class="zsnavigation">aa<img src="av/images/erjidhimg.png" />发布aa</div>
<!-- main -->
<div class="zserjimain">
<div id="leftTree" class="zsermleft" style="overflow-y:auto ;height:480px;width:199px;border:0px solid black;">
<ul id="mytree" style="height:190px;"> </ul>
</div>
<div id="rightPage" class="zsermright">
<iframe id="dynaPage" src="<%=request.getContextPath()%>/av/module/knowledge/knowledgePublish/dynaPage.jsp" frameborder="0" width="100%" οnlοad="dyniframesize('dynaPage');"></iframe>
</div>
</div>
<!--
<div id="mm" class="easyui-menu" style="width: 120px;">
<div οnclick="MenuWin()" iconcls="icon-add">添加子菜单</div>
<div οnclick="updateMenu()" iconcls="icon-edit">修改</div>
<div οnclick="delMenu()" iconcls="icon-remove">删除</div>
</div>
-->
<div id="zhsh_foot">© 2013 </div>
<script type="text/javascript">
var baseurl = '<%=request.getContextPath()%>';
$(function(){
loadProcessTree();
dyniframesizeDiv("leftTree");
window.setTimeout("expand()", 400);
});
function loadProcessTree(id){
$('#mytree').tree({
checkbox: false,
lines : true,
method : 'post',
iconCls: 'icon-catalog',
url:'pl/templateClass/getTemplateClassTreeRoot.json?rootId='+(id==undefined||id==""?"KnowledgeTemplateClass":id),
onBeforeExpand:function(node,param){
$('#mytree').tree('options').url = "pl/templateClass/getChildNodeWithPrivilege.json?parentId=" + node.id ;
$('#mytree').tree('update', {
target: node.target,
iconCls: 'icon-file'
});
},
onClick:function(node){
var b = $("#tree").tree('isLeaf',node.target);
//document.getElementById("listTable").src="pl/template/templateListByclassId?tableName="+node.attributes.tableName;
if(b){
getTemplateForPublish(node);
}else{
getIntroductionInfo(node);
}
},
onContextMenu: function(e, node){
e.preventDefault();
$('#mytree').tree('select', node.target);
$('#mm').menu('show', {
left: e.pageX,
top: e.pageY
});
}
});
}
function getIntroductionInfo(node){
expand();
if(node){
window.frames['dynaPage'].loadIntroduction(node.id);
}
}
function getTemplateForPublish(node){
if(node){
if(node.attributes && node.attributes.tableName){
var tableName=node.attributes.tableName;
window.frames['dynaPage'].loadTemplage(tableName);
}
}
}
function expand() {
var node = $('#mytree').tree('getSelected');
if(node){
$('#mytree').tree('expand',node.target);
}else{
$('#mytree').tree('expandAll');
}
}
</script>
</body>
/**
*
* @return Collection 树的根,
* @throws Exception
*/
@RequestMapping("/getTemplateClassTreeRoot")
public void getTreeRoot(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String roodId = request.getParameter("rootId");
List<KmTemplateClass> classList = templateClassService
.getTreeRoot(roodId);
List<BmpCatalogTreeModel> resultList = templateClassService
.getCatalogTreeDataJson(classList);
ObjectMapper mapper = new ObjectMapper();
String dataStr = mapper.writeValueAsString(resultList);
response.getWriter().write(dataStr);
response.getWriter().flush();
response.getWriter().close();
}