var tree; function $(id){ return document.getElementById(id); } function createTree(){ initLoading(); tree = new dhtmlXTreeObject("treeBox","100%","100%",0); tree.setSkin('dhx_skyblue'); tree.setImagePath("../images/csh_dhx_skyblue/"); var url = "ModuleGridSource.aspx?handle=modtree&uid="+newGuid(); tree.loadJSON(url,function(){ finishLoading(); }); tree.attachEvent("onClick", function(id){ if(tree.isItemChecked(id)){ tree.closeItem(id); tree.setCheck(id,false); }else{ tree.openItem(id); tree.setCheck(id,true); } }); tree.enableCheckBoxes(true); // setTimeout(function(){ // var id = $("h_moduleid").value; // // tree.selectItem(id,false); // tree.openItem(id); // },100); } function newGuid(){ var guid = ""; for (var i = 1; i <= 32; i++){ var n = Math.floor(Math.random()*16.0).toString(16); guid += n; if((i==8)||(i==12)||(i==16)||(i==20)) guid += "-"; } return guid.toUpperCase(); } function focusOnTree(){; if(tree != null){ if($("h_moduleid").value != ""){ var id = $("h_moduleid").value; } } } function assignTo(){ var modArg = new Array(); var selParentObj = $("sel_module"); if(tree != null){ if(tree.getAllChecked().indexOf(",") >= 0){ //modArg = tree.getAllChecked().split(","); alert("指定错误,只能指定一个模块作为父模块"); return; }else{ modArg.push(tree.getAllChecked()); } if(selParentObj.options.length < 1){ var varItem = new Option(tree.getItemText(modArg[0]), modArg[0]); selParentObj.options.add(varItem); window.opener.document.getElementById("txt_parent").value = tree.getItemText(modArg[0]); window.opener.document.getElementById("h_parentid").value = modArg[0]; //var parentId = window.opener.document.getElementById("h_parentid").value; }else{ alert("已指定父模块信息,不能重复添加,请先移除后再添加"); return; } } } function removeAssign(){ var selParentObj = $("sel_module"); if(selParentObj.options.length > 0){ selParentObj.options.remove(0); window.opener.document.getElementById("txt_parent").value = ""; window.opener.document.getElementById("h_parentid").value = ""; } } function mouseMoveImg(obj,type){ var imgUrl = obj.src; var urlArg = imgUrl.split("/"); if(type == 1){ if(urlArg[urlArg.length-1] == "edit_left.gif"){ var newUrl = ""; for(var i=0;i