<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@page import="com.blueland.bpm.engine.util.WorkFlowContants"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String processInstanceId=request.getParameter("processInstanceId");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="overflow-y: auto;overflow-x auto;">
<head>
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="${ctx}/resources/js/plugins/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css" />
<script type="text/javascript" src="${ctx}/resources/js/plugins/zTree/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/plugins/zTree/js/jquery.ztree.core-3.4.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/plugins/zTree/js/jquery.ztree.excheck-3.4.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/plugins/zTree/js/jquery.ztree.exedit-3.4.js"></script>
<SCRIPT type="text/javascript">
		
		var zNodes;  
		var url="${ctx}/workflow/trace/allProcessInstance.do";
		$.ajaxSetup({ 
		    async : false 
		});
		$.post(url, {processInstanceId:"<%=processInstanceId%>"},
				function (data, textStatus){
					//alert(data);
				    //var jsonObject = eval(data);
				    //alert(jsonObject);
				    zNodes=eval(data);
			});
		
		var setting = {
			view: {
				dblClickExpand : false,
				selectedMulti: false
			},
				edit: {
					enable: false,
					drag:{isMove:false}

				},
				data: {
					simpleData: {
						enable: true,  
			            idKey : "id",  
			            pIdKey : "pId" ,
			            DIY:"isAccessTopMenu"
					}
				},callback: {
			    	beforeClick: beforeClick
				}

		};
		
		
		
		function filter(treeId, parentNode, childNodes) {
			return childNodes;
		}
		function beforeClick(treeId, treeNode) {
			//alert(treeNode.isAccess);
			//判断是否有权限访问根节点
			if (treeNode.pId==""||treeNode.isAccessTopMenu=="false") {
				return false;
			} else {
				//if(treeNode.type=="${selectNodeType}"){
					$("#treeNodeId").val(treeNode.id);
					$("#treeNodeName").val(treeNode.name);
					$("#treeNodeType").val(treeNode.type);
				//}
			}
			parent.flushFlowLog(treeNode.id);
			return true;
		}
		$(document).ready(function(){
			$.fn.zTree.init($("#processTree"), setting,zNodes);
		});
		
	</SCRIPT>

</HEAD>
<ul id="processTree" class="ztree"></ul>
<form id="queryForm" name="queryForm" action="" method="post">
		<input name="treeNodeId" id="treeNodeId" type="hidden" /> <input
			name="treeNodeName" id="treeNodeName" type="hidden" /> <input
			name="treeNodeType" id="treeNodeType" type="hidden" /> <input
			name="filterNodeIdsStr" id="filterNodeIdsStr" type="hidden"
			value="${filterNodeIdsStr }" /> <input name="isShowCheckBox"
			id="isShowCheckBox" type="hidden" value="${isShowCheckBox }" /> <input
			name="showTreeType" id="showTreeType" type="hidden"
			value="${showTreeType }" /> <input name="selectNodeType"
			id="selectNodeType" type="hidden" value="${selectNodeType }" />
</form>
