|
|
<%@ |
|
|
page contentType="text/html; charset=UTF-8" |
|
|
import="kr.co.kihyun.beans.user.HttpSSOLogin" |
|
|
import="kr.co.kihyun.moumi.Moumi" |
|
|
import="kr.co.kihyun.lang.MString" |
|
|
import="kr.co.kihyun.lang.MLong" |
|
|
import="kr.co.kihyun.beans.user.Dept" |
|
|
import="kr.co.kihyun.beans.user.PartList" |
|
|
%> |
|
|
<% |
|
|
String rootId = request.getParameter("rootID"); |
|
|
String keyWord = request.getParameter("keyWord"); |
|
|
String usID = HttpSSOLogin.getLoginID(request); |
|
|
String dpID = HttpSSOLogin.getDeptID(request); |
|
|
//System.out.println(":::usID::::"+usID+"::dpID:::"+dpID); |
|
|
%> |
|
|
<!DOCTYPE html> |
|
|
<html> |
|
|
<head> |
|
|
<meta charset="UTF-8"> |
|
|
<title>±×·ìºÎ¼</title> |
|
|
<script src="/totsys/common/js/jquery-1.12.4.min.js"></script> |
|
|
<script src="/totsys/common/js/jquery.cookie.js"></script> |
|
|
<script src="/totsys/common/js/jquery.hotkeys.js"></script> |
|
|
<script src="/totsys/common/js/jquery.jstree.js"></script> |
|
|
<style> |
|
|
#newTree { text-align: justify; font-size:9pt; vertical-align:middle; } |
|
|
</style> |
|
|
</head> |
|
|
<body> |
|
|
<input type="button" class="button" value="Search" id="search" style="display:none" /> |
|
|
<input type="button" class="button" value="Search clear" id="searchClear" style="display:none" /> |
|
|
<input type="button" class="button" value="checked Id" id="checkbtn" style="display:none" /> |
|
|
<input type="button" class="button" value="focus Move" id="focusMove" style="display:none" /> |
|
|
<div id="searchType" style="display:none"></div> |
|
|
<div id="searchWord" style="display:none"></div> |
|
|
<div id="moveType" style="display:none"></div> |
|
|
<div id="newTree" class="newTree"></div> |
|
|
<div id="autoExpanded" style="display:none">Y</div> |
|
|
|
|
|
<script type="text/javascript" class="source"> |
|
|
var gSearchGubun = "GROUP"; //default=GROUP |
|
|
var gblSearched = false; |
|
|
|
|
|
$(function() { |
|
|
$("#newTree").jstree({ |
|
|
"plugins": ["themes", "json_data", "checkbox", "search", "types", "ui", "core"], |
|
|
"themes": { |
|
|
"theme": "classic", |
|
|
"dots": true, |
|
|
"icons": true, |
|
|
"url": "/totsys/common/js/themes/classic/style.css" |
|
|
}, |
|
|
"json_data": { |
|
|
"data": [ |
|
|
{ |
|
|
"data": "ºÎ¼±×·ì", |
|
|
"state": "closed", |
|
|
"attr": {"id": "ROOT", "rel": "ROOT", "rootid": '<%=rootId%>'} |
|
|
} |
|
|
], |
|
|
"ajax": { |
|
|
"type": "POST", |
|
|
"url": "/servlet/kr.co.kihyun.tree.Tree", |
|
|
"data": function(n) { |
|
|
var data = {}; |
|
|
data.id = n.attr("id"); |
|
|
data.rootId = n.attr("rootId"); |
|
|
data.gubun = "DEPT"; |
|
|
data.userYN = "N"; |
|
|
return data; |
|
|
} |
|
|
}, |
|
|
"progressive_render": true |
|
|
}, |
|
|
"checkbox": {state_type: "three-state"}, |
|
|
"search": { |
|
|
"case_insensitive": true, |
|
|
"ajax": { |
|
|
"type": "POST", |
|
|
"url": "/servlet/kr.co.kihyun.tree.TreeSearch", |
|
|
"data": function(str) { |
|
|
var data = {}; |
|
|
data.keyWord = str; |
|
|
data.startId = encodeURIComponent('<%=rootId%>'); |
|
|
data.gubun = "GROUP_DEPT"; |
|
|
return data; |
|
|
}, |
|
|
"async": false, |
|
|
"success": function(data) { |
|
|
//alert("data = " + data); |
|
|
if (data.length == 0 || data == "#" || data == ('#' + '<%=rootId%>')) { |
|
|
alert('<%=Moumi.getMessageBundle().getString("moumi.message.popup.notSearchGroupDept")%>'); //°Ë»öµÈ ±×·ì¸í/ºÎ¼¸íÀÌ ¾ø½À´Ï´Ù. |
|
|
gblSearched = false; |
|
|
} else { |
|
|
gblSearched = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
"types": { |
|
|
"valid_children": ["ROOT", "DEPT", "USER"], |
|
|
"types": { |
|
|
"ROOT": { |
|
|
"icon": {"image": "/totsys/common/images/pc-user.gif"} |
|
|
}, |
|
|
"USER": { |
|
|
"icon": {"image": "/totsys/common/images/person.png"} |
|
|
} |
|
|
} |
|
|
}, |
|
|
"core": {'initially_open': ['ROOT']} |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#searchClear").click(function() { |
|
|
$("#newTree").jstree("clear_search"); |
|
|
$("#searchResult").empty(); |
|
|
}); |
|
|
|
|
|
$("#search").click(function() { |
|
|
gblSearched = false; |
|
|
$("#newTree").jstree("search", $('#searchWord').text()); |
|
|
}); |
|
|
|
|
|
//### °Ë»öÀ» Á¾·áÇÑ ÈÄ¿¡ ½ÇÇàµÈ´Ù. : °Ë»öµÈ °ÍÀÌ ÀÖÀ¸¸é ÃÖÃÊ·Î Æ÷Ä¿½º¸¦ À̵¿½ÃŲ´Ù. |
|
|
$("#newTree").bind("search.jstree", function(e, data) { |
|
|
if (data.rslt.nodes.length > 0) { |
|
|
//1.ÀÌÀü¿¡ ¼±ÅÃµÈ ¸ðµç ³ëµå¸¦ ÇØÁ¦ÇÑ´Ù. |
|
|
$('#newTree').jstree('deselect_all'); |
|
|
|
|
|
//2.°Ë»öÀ¯Çü°ú ´Ù¸¥ °ÍÀº style¸¦ Á¦°ÅÇÑ´Ù. |
|
|
var tmpRel = ""; |
|
|
$("#newTree").find(".jstree-search").each(function() { |
|
|
tmpRel = $(this).parent("li").attr("rel"); |
|
|
//alert("rel = " + tmpRel ); |
|
|
if (gSearchGubun !== tmpRel) { |
|
|
try { |
|
|
$(this).removeClass("jstree-search"); |
|
|
} catch (e) { |
|
|
alert(e); |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
//ãÀº °ÍÀÌ ÀÖ´Ù¸é ... |
|
|
if (gblSearched == true) { |
|
|
$("#moveType").text("down"); |
|
|
$("#focusMove").click(); |
|
|
} |
|
|
} |
|
|
|
|
|
//@@@ gblSearching = false; |
|
|
//alert("Found " + data.rslt.nodes.length + " nodes matching '" + data.rslt.str + "'."); |
|
|
}); |
|
|
|
|
|
$("#newTree").bind("check_node.jstree", function(e, data) { |
|
|
// //ÀÚµ¿ÆîħÀ» ¼±ÅÃÇØ ³õ°í °ø¿ë/Áö¿ª/ºÎ¼/Àüü¸¦ Áß¿¡¼ º¯°æÇÏ¿© ¼±ÅÃÇÑ °æ¿ì autoExpandedÀÇ °ªÀÌ ¾øÀ¸¹Ç·Î |
|
|
// if($("#autoExpanded").text() == "") { |
|
|
// //alert($("#autoExpanded").text() ); |
|
|
// parent.fn_onAutoExpanded(); |
|
|
// } |
|
|
|
|
|
//ÆîÄ£´Ù! ÄݹéÇÔ¼ö¸¦ »ç¿ëÇÏ¿©¾ß ÇÑ´Ù. |
|
|
//alert($("#autoExpanded").text()); |
|
|
$("#autoExpanded").text("N"); |
|
|
data.inst.open_node(data.rslt.obj, false, true); |
|
|
}); |
|
|
|
|
|
$("#newTree").bind("after_open.jstree", function(e, data) { |
|
|
//alert($("#autoExpanded").text()); |
|
|
//ÀÚµ¿ÆîħÀÌ ¾Æ´Ñ °æ¿ì ÇÏÀ§³ëµå¸¦ Ŭ·ÎÁîÇϰí, ÀÚµ¿ÆîħÀ¸·Î ¼³Á¤ÇÑ´Ù. |
|
|
if($("#autoExpanded").text() == "N") { |
|
|
data.inst.close_node(data.rslt.obj, true); |
|
|
$("#autoExpanded").text("Y"); |
|
|
} |
|
|
}); |
|
|
|
|
|
//üũµÈ°ÍÀÌ Ãß°¡¹öưÀ» Ŭ¸¯ÇÏ¸é ºÎ¼ ¸®½ºÆ®·Î Ãß°¡µÈ´Ù. |
|
|
$("#checkbtn").click(function() { |
|
|
iChkCnt = 0 |
|
|
|
|
|
$("#newTree").jstree("get_checked", null, true).each(function() { |
|
|
//alert(" this.id = " + this.id); |
|
|
//alert(" this.deptname = " + this.deptname); |
|
|
//alert(" this.organdeptname = " + this.organdeptname); |
|
|
//alert(" this.upperdeptname = " + this.upperdeptname); |
|
|
|
|
|
if (this.id.length > 10 || this.id == 'ROOT') |
|
|
return; |
|
|
var testID = this.id; |
|
|
testID = testID.substring(1, 2); |
|
|
testID = testID.replace(" ", ""); |
|
|
if (testID == "9") { |
|
|
} else { |
|
|
iChkCnt = iChkCnt + 1; |
|
|
//parent.putSelId(this.id); |
|
|
//ie10,11 ¿¡¼ undefined ¹®Á¦ ÇØ°á |
|
|
var upperdeptname=$(this).attr('upperdeptname'); |
|
|
if(!upperdeptname)upperdeptname=''; |
|
|
parent.putSelId2(this.id, |
|
|
$(this).attr('deptname'), |
|
|
$(this).attr('organdeptname'), |
|
|
upperdeptname); |
|
|
} |
|
|
//parent.putSelId(this.id); |
|
|
}); |
|
|
|
|
|
if (iChkCnt == 0) { |
|
|
alert('<%=Moumi.getMessageBundle().getString("moumi.message.doc.SubmitDevision")%>'); //Á¦ÃâºÎ¼¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä. |
|
|
} else { |
|
|
//¿À¸¥ÂÊÀÇ ºÎ¼ ¸®½ºÆ®¿¡ Ç¥½ÃµÈ´Ù. |
|
|
parent.document.list.submit(); |
|
|
} |
|
|
}); |
|
|
|
|
|
//Á¶Á÷µµ¿¡¼ °Ë»öµÈ ³ëµå·Î Æ÷Ä¿½º¸¦ À̵¿½ÃŲ´Ù. strType : down, up |
|
|
$("#focusMove").click(function() { |
|
|
var moveType = $("#moveType").text(); //down,up |
|
|
//alert("moveType = " + moveType); |
|
|
|
|
|
//1.ÇöÀç ¼±ÅÃµÈ objectÀÇ offset.top¸¦ ±¸ÇÑ´Ù. |
|
|
var NODE = $.jstree._focused().get_selected(); |
|
|
var nodeId = $(NODE).attr("id"); |
|
|
if (nodeId == undefined) { |
|
|
nodeId = ""; |
|
|
} |
|
|
|
|
|
var currentObj = $('#' + nodeId); |
|
|
var currentOffset = currentObj.offset(); |
|
|
var currentOffsetTop = -1; |
|
|
if (currentOffset != null) { |
|
|
currentOffsetTop = currentOffset.top; |
|
|
} |
|
|
|
|
|
//2.ÇöÀç currentOffsetTop º¸´Ù Å« °ª¿¡ Á¸ÀçÇÏ´Â id¸¦ ã¾Æ¼ ¸®ÅÏÇÑ´Ù. |
|
|
var currentNodeId = ""; |
|
|
currentNodeId = getDeptUserId(nodeId, currentOffsetTop, moveType); |
|
|
|
|
|
//3.¸®ÅÏµÈ id°¡ ¾ø´Ù¸é ¸Þ¼¼Áö¸¦ ¶ç¿ì°í ¸®ÅÏÇÑ´Ù. |
|
|
if (currentNodeId === null || currentNodeId === "") { |
|
|
alert("´õ ÀÌ»ó ãÀ» ¼ö ¾ø½À´Ï´Ù."); |
|
|
return; |
|
|
} |
|
|
|
|
|
//4.ÀÌÀü¿¡ ¼±ÅÃµÈ ¸ðµç ³ëµå¸¦ ÇØÁ¦ÇÑ´Ù. |
|
|
$('#newTree').jstree('deselect_all'); |
|
|
|
|
|
//5.¸®ÅÏµÈ id·Î ³ëµå¸¦ ¼±ÅÃÇÑ´Ù. |
|
|
$("#newTree").jstree("select_node", '#' + currentNodeId); //591 |
|
|
|
|
|
try { |
|
|
var selectedObj = $('#' + currentNodeId); |
|
|
var elementOffset = selectedObj.offset(); |
|
|
//ie10,11 ¹× ȣȯ¼º º¸±â ±îÁö ÀüºÎ µ¿ÀÛÇϵµ·Ï ¼öÁ¤ |
|
|
var verticalCenterPosition = $(window).height() / 2; |
|
|
//// Áï½ÃÀ̵¿ |
|
|
//$("html").scrollTop(elementOffset.top - verticalCenterPosition); |
|
|
|
|
|
// ºÎµå·´°Ô À̵¿(500ms) |
|
|
$("html").animate({ |
|
|
scrollTop: elementOffset.top - verticalCenterPosition |
|
|
}, 500); |
|
|
|
|
|
} catch (e) { |
|
|
alert(e); |
|
|
} |
|
|
}); |
|
|
|
|
|
//´õºíŬ¸¯ ½Ã¿¡ ... |
|
|
$("#newTree").bind("dblclick.jstree", function(e, data) { |
|
|
iChkCnt = 0 |
|
|
|
|
|
var NODE = $.jstree._focused().get_selected(); |
|
|
var nodeId = $(NODE).attr("id"); |
|
|
var deptname = $(NODE).attr("deptname"); |
|
|
var organdeptname = $(NODE).attr("organdeptname"); |
|
|
var upperdeptname = $(NODE).attr("upperdeptname"); |
|
|
|
|
|
if (deptname == undefined) { deptname = ""; } |
|
|
if (organdeptname == undefined) { organdeptname = ""; } |
|
|
if (upperdeptname == undefined) { upperdeptname = ""; } |
|
|
|
|
|
//alert(" nodeId = " + nodeId); |
|
|
//alert(" deptname = " + deptname); |
|
|
//alert(" organdeptname = " + organdeptname); |
|
|
//alert(" upperdeptname = " + upperdeptname); |
|
|
|
|
|
if (nodeId == undefined) { |
|
|
return; |
|
|
} |
|
|
if (nodeId.length > 10 || nodeId == 'ROOT') { // this.id == 'ROOT') |
|
|
return; |
|
|
} |
|
|
var testID = nodeId; |
|
|
testID = testID.substring(1, 2); |
|
|
testID = testID.replace(" ", ""); |
|
|
if (testID == "9") { |
|
|
} else { |
|
|
iChkCnt = iChkCnt + 1; |
|
|
//parent.putSelId(nodeId); |
|
|
parent.putSelId2(nodeId, deptname, organdeptname, upperdeptname); |
|
|
} |
|
|
//parent.putSelId(nodeId); |
|
|
if (iChkCnt == 0) { |
|
|
alert('<%=Moumi.getMessageBundle().getString("moumi.message.doc.SubmitDevision")%>'); //Á¦ÃâºÎ¼¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä. |
|
|
} else { |
|
|
//¿À¸¥ÂÊÀÇ ºÎ¼ ¸®½ºÆ®¿¡ Ç¥½ÃµÈ´Ù. |
|
|
parent.document.list.submit(); |
|
|
} |
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
//´Ù¿î,¾÷ ¹öư Ŭ¸¯ ½Ã : 2.ÇöÀç currentOffsetTop º¸´Ù Å« °ª¿¡ Á¸ÀçÇÏ´Â id¸¦ ã¾Æ¼ ¸®ÅÏÇÑ´Ù. |
|
|
function getDeptUserId(strId, intTop, strType) { |
|
|
//alert("strId = " + strId + ", intTop = " + intTop + ", strType = " + strType); |
|
|
var id = ""; |
|
|
var idArray = new Array(); |
|
|
var returnId = ""; |
|
|
var blSearchOk = false; |
|
|
|
|
|
if (strType === "down") { |
|
|
$("#newTree").find(".jstree-search").each(function() { |
|
|
id = $(this).parent("li").attr("id"); |
|
|
|
|
|
if (blSearchOk === false && strId !== id) { |
|
|
var selectedObj = $('#' + id); |
|
|
var elementOffset = selectedObj.offset(); |
|
|
|
|
|
if (elementOffset.top > intTop) { |
|
|
//alert("[offset.top] : " + elementOffset.top + "\n[offset.left] : " + elementOffset.left); |
|
|
returnId = id |
|
|
blSearchOk = true; |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
if (strType === "up") { |
|
|
$("#newTree").find(".jstree-search").each(function() { |
|
|
idArray.push($(this).parent("li").attr("id")); |
|
|
}); |
|
|
idArray.reverse(); |
|
|
|
|
|
for (var i = 0; i < idArray.length; i++) { |
|
|
id = idArray[i].toString(); |
|
|
|
|
|
if (blSearchOk === false && strId !== id) { |
|
|
var selectedObj = $('#' + id); |
|
|
var elementOffset = selectedObj.offset(); |
|
|
|
|
|
if (elementOffset.top < intTop) { |
|
|
//alert("[offset.top] : " + elementOffset.top + "\n[offset.left] : " + elementOffset.left); |
|
|
returnId = id |
|
|
blSearchOk = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
return returnId; |
|
|
} |
|
|
|
|
|
</script> |
|
|
|
|
|
</body> |
|
|
</html>
|
|
|
|