<%--
  Class Name : EgovMenuManage.jsp
  Description : 메뉴관리 조회 화면
  Modification Information
 
      수정일         수정자                   수정내용
    -------    --------    ---------------------------
     2009.03.10    이용             최초 생성
     2011.08.31   JJY       경량환경 버전 생성
 
    author   : 공통서비스 개발팀 이용
    since    : 2009.03.10
--%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%
  /* Image Path 설정 */
  String imagePath_icon   = "/images/egovframework/sym/mpm/icon";
  String imagePath_button = "/images/egovframework/sym/mpm/button";
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="ko" >
<title>메뉴관리리스트</title>
<style type="text/css">
    h1 {font-size:12px;}
    caption {visibility:hidden; font-size:0; height:0; margin:0; padding:0; line-height:0;}
</style>
<script language="javascript1.2" type="text/javaScript">
/* ********************************************************
 * 멀티삭제 처리 함수
 ******************************************************** */
function fDeleteMenuList() {
	if($("input:checkbox[name='checkField']").is(":checked") == false){
		alert('선택된 매뉴가 없습니다.');
		return;
	}
	
	var checkField = document.menuManageForm.checkField;
    var menuNo = document.menuManageForm.checkMenuNo;
    var checkMenuNos = "";
    var checkedCount = 0;
    if(checkField) {

        if(checkField.length > 1) {
            for(var i=0; i < checkField.length; i++) {
                if(checkField[i].checked) {
                    checkMenuNos += ((checkedCount==0? "" : ",") + menuNo[i].value);
                    checkedCount++;
                }
            }
        } else {
            if(checkField.checked) {
                checkMenuNos = menuNo.value;
            }
        }
    }   

    document.menuManageForm.checkedMenuNoForDel.value=checkMenuNos;
    document.menuManageForm.pageIndex.value="1";
    document.menuManageForm.action = "<c:url value='/sym/mnu/mpm/EgovMenuManageListDelete.do'/>";
    document.menuManageForm.submit(); 
}

/* ********************************************************
 * 페이징 처리 함수
 ******************************************************** */
function linkPage(pageNo){
    var searchForm = document.searchForm ;
	searchForm.pageIndex.value = pageNo ;
	searchForm.searchCondition.value = $('#searchCondition').val();
	searchForm.searchKeyword.value = $('#searchKeyword').val();
	searchForm.action = "<c:url value='/sym/mnu/mpm/EgovMenuManageSelect.do'/>";
	searchForm.submit();
}

/* ********************************************************
 * 조회 처리 함수
 ******************************************************** */
function selectMenuManageList() {
	linkPage(1);
}
/* ********************************************************
 * 입력 화면 호출 함수
 ******************************************************** */
function insertMenuManage() {
	document.modiForm.action = "<c:url value='/sym/mnu/mpm/EgovMenuRegistInsert.do'/>";
	document.modiForm.submit();
}

/* ********************************************************
 * 일괄처리 화면호출 함수
 ******************************************************** */
/* function bndeInsertMenuManage() {
        document.menuManageForm.action = "<c:url value='/sym/mpm/EgovMenuRegistInsert.do'/>";
        document.menuManageForm.submit();   
    }
 */
function bndeInsertMenuManage() {
    document.menuManageForm.action = "<c:url value='/sym/mnu/mpm/EgovMenuBndeRegist.do'/>";
    document.menuManageForm.submit();
} 
/* ********************************************************
 * 상세조회처리 함수
 ******************************************************** */
function selectUpdtMenuManageDetail(menuNo) {
	document.modiForm.req_menuNo.value = menuNo;
	document.modiForm.action = "<c:url value='/sym/mnu/mpm/EgovMenuManageListDetailSelect.do'/>";
	document.modiForm.submit();
}
/* ********************************************************
 * 최초조회 함수
 ******************************************************** */
function fMenuManageSelect(){ 
    document.menuManageForm.action = "<c:url value='/sym/mpm/EgovMenuManageSelect.do'/>";
    document.menuManageForm.submit();
}

/* ********************************************************
 * 모두선택 처리 함수
 ******************************************************** */
 function fnCheckAll() {
    var checkField = document.menuManageForm.checkField;
    if(document.menuManageForm.checkAll.checked) {
        if(checkField) {
            if(checkField.length > 1) {
                for(var i=0; i < checkField.length; i++) {
                    checkField[i].checked = true;
                }
            } else {
                checkField.checked = true;
            }
        }
    } else {
        if(checkField) {
            if(checkField.length > 1) {
                for(var j=0; j < checkField.length; j++) {
                    checkField[j].checked = false;
                }
            } else {
                checkField.checked = false;
            }
        }
    }
}

</script>
</head>
<body>
<form name="menuManageForm" action ="<c:url value='/sym/mnu/mpm/EgovMenuManageSelect.do'/>" method="post">
	<input name="pageIndex" type="hidden" value="<c:out value='${searchVO.pageIndex}'/>"/>
	<input name="checkedMenuNoForDel" type="hidden" />
	<input name="req_menuNo" type="hidden"  />
	
	<div class="ad_content">
	<div class="ad_con_head">
		<div class="ad_head_text">
			<p class="today_txt">메뉴목록관리</p>
			<div class="ad_head_ment">
				<p class="today_last_txt"><span id="cnt_cate_list"></span></p>
			</div>
		</div>
	</div>
	<div class="ad_subcon">
		<div class="ad_con_body">
			<div class="ad_bo_h3">
				<div class="board1_div1">
					<select name="searchCondition" id="searchCondition" title="검색조건" class="select" >
					   <option value='' <c:if test="${searchVO.searchCondition == ''}">selected="selected"</c:if>>선택하세요</option>
			           <option value='A' <c:if test="${searchVO.searchCondition == 'A'}">selected="selected"</c:if>>관리자화면</option>
			           <option value='U' <c:if test="${searchVO.searchCondition == 'U'}">selected="selected"</c:if>>사용자화면</option>
			           <option value='C' <c:if test="${searchVO.searchCondition == 'C'}">selected="selected"</c:if>>메뉴번호</option>
			        </select>
			        
					메뉴명 : 
					<input id="searchKeyword" name="searchKeyword" type="text" value="<c:out value='${searchVO.searchKeyword}'/>" size="25" title="검색"  />
					<ul class="board1_div2_ul">
						<li><button class="board1_list_btn" onclick="selectMenuManageList(); return false;">검 색</button></li>
						<li><button class="board1_del_btn" onclick="fDeleteMenuList(); return false;">삭 제</button></li>
						<li><button class="board1_save_btn" onclick="insertMenuManage(); return false;">등 록</button></li>
					</ul>
				</div>
			</div>
		</div>
		<p class="mem_count">조회건수 : <c:out value="${paginationInfo.totalRecordCount}"/></p>
		<div class="ad_mem_list">
			<table>
				<tr>
					<th>번호</th>
					<th>
						<input name="checkAll" type="checkbox" title="Check All" onclick="fnCheckAll();"/>
					</th>
					<th>메뉴번호</th>
					<th>메뉴명</th>
					<th>프로그램파일명</th>
					<th>메뉴설명</th>
					<th>상위메뉴번호</th>
					<th>화면종류</th>
				</tr>
				<c:forEach var="result" items="${list_menumanage}" varStatus="status">
				<tr>
					<td><c:out value="${(searchVO.pageIndex - 1) * searchVO.pageSize + status.count}"/></td>
					<td>
						<input type="checkbox" name="checkField" class="check2" title="선택"/>
					    <input name="checkMenuNo" type="hidden" value="<c:out value='${result.menuNo}'/>"/>
					</td>
					<td>
						<a href="#" onclick="selectUpdtMenuManageDetail('<c:out value="${result.menuNo}"/>'); return false;">
							<c:out value="${result.menuNo}"/>
						</a>
					</td>
					<td>
						<c:out value="${result.menuNm}"/>
					</td>
					<td><c:out value="${result.progrmFileNm}"/></td>
					<td><c:out value="${result.menuDc}"/></td>
					<td><c:out value="${result.upperMenuId}"/></td>
					<td>
						<c:forEach items="${menUserTypeList}" var="menUserTypeList" varStatus="status">
							<c:if test="${menUserTypeList.code eq result.menuUserType}">  
								${menUserTypeList.codeNm}
							</c:if>
						</c:forEach>
						<%-- <c:out value="${result.menuUserType}"/> --%>
					</td>
				</tr>
				</c:forEach>
				<c:if test="${empty list_menumanage}">
         			<tr><td colspan="7"><spring:message code="common.nodata.msg" /></td></tr>
         		</c:if>     
			</table>
			<!-- 페이지 네비게이션 시작 -->
			<c:if test="${!empty list_menumanage}">
		 		<div class="board1_btn">
		    		<ul>
		    			<ui:pagination paginationInfo = "${paginationInfo}"  type="image" jsFunction="linkPage" />
		    		</ul>	
		    	</div>  
		  	</c:if>                      
		    <!-- //페이지 네비게이션 끝 --> 
		</div>
	</div>
	</div>
</form>
<form name="searchForm" method="get">
	<input name="searchKeyword" type="hidden" />
	<input name="pageIndex" type="hidden" />
	<input name="searchCondition" type="hidden" value="U" />
</form>
<form name="modiForm" method="get">
	<input name="req_menuNo" type="hidden" />
</form>
</body>
</html>