
<%
/************************************************************@@
  * Program Name	: popup_form_list.jsp
  * Description		: 집계문서 등록 이전 집계문서 재사용
  * Author				: 강원중
  * Create Date		: 2004-11-06
  * History				:
@@************************************************************/
%>
<%@ page contentType="text/html; charset=UTF-8" import="java.util.Date"
	import="java.text.SimpleDateFormat"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.moumi.Moumi" import="kr.co.kihyun.util.MDate"
	import="kr.co.kihyun.lang.MInteger"
	import="kr.co.kihyun.text.html.ServletUtil"
	import="kr.co.kihyun.moumi.doc.MDoc"
	import="kr.co.kihyun.moumi.doc.table.MTable"
	import="kr.co.kihyun.beans.totsys.totper.TotPerDocList"
	import="kr.co.kihyun.lang.MString" import="kr.co.kihyun.lang.Encoder"%>

<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>

<%
try{
	/********** session내의 userId **********/
	String usID = HttpSSOLogin.getLoginID(request);

	/****** Parameter values ******/
	String findOption = clearXSS(MString.checkNull(request.getParameter("findOption")),"");
	String findWord	= clearXSS(Encoder.toJava(request.getParameter("findWord")),"");
	int accAuth = MInteger.parseInt(request.getParameter("accAuth"));
	int strPage = MInteger.parseInt(request.getParameter("strPage"), 1);
	String viewRange = clearXSS(Encoder.toJava(request.getParameter("viewRange")),"");

	/****** Project list data get ******/
	//TotPerDocList 클래스가 없음. 해당파일은 다른데서 인클루드하여 사용하므로 삭제하지 않고 남겨둠 
	
	//TotPerDocList docList = new TotPerDocList();
	//docList.formExistQuery(accAuth, usID, findOption, findWord, viewRange);

	int count = 0; //docList.getCount();
	Long[] docIDList = {};//docList.getIDList();
	String[] docNameList = {}; //docList.getName();
	String[] userIDList = {}; //docList.getUserIDList();
	String[] userNameList = {}; //docList.getUserNameList();
	String[] deptNameList = {}; //docList.getDeptNameList();
	Date[] regDateList = {}; //docList.getRegDateList();
	int[] tableTypeList = {}; //docList.getTypeList();

	/************ 리스트 페이지 구성 ************/
	int endPage = 0;
	int pageSize =0 ;
	int currentPage = 0;
	int absolutePage = 0;		
	int currentPageSetUp = 0;
	int recordSize = 15;
	
	currentPage=strPage;

	if((count%recordSize) == 0){
		pageSize = (int)(count/recordSize);	
	}else{
		pageSize = (int)(count/recordSize)+1;	
	}

	currentPageSetUp = (int)(currentPage/10)*10; 
	if (currentPage%10 == 0){
		currentPageSetUp-=10;
	}	
%>
<html>
<head>
<title><%=Moumi.getTitle()%></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/totsys/common/css/text.css"
	type="text/css">
<link rel="stylesheet" href="/totsys/common/css/kecttep.css"
	type="text/css">
<script src="/totsys/common/js/rollover.js"></script>
</head>

<body style='' leftmargin="0" topmargin="0" marginwidth="0"
	marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="10"></td>
	</tr>
	<!---- 리스트 시작 ---->
	<tr>
		<td valign="top" style="padding-left: 12; padding-right: 12">
		<table border="1" bordercolor="#abbddd" width="100%" cellpadding="0"
			cellspacing="0">
			<tr>
				<td nowrap align="center" class="kecttep_tdmenu">&nbsp;문서번호&nbsp;</td>
				<td align="center" class="kecttep_tdmenu">&nbsp문서명&nbsp;</td>
				<td align="center" class="kecttep_tdmenu">등록자</td>
				<td nowrap align="center" class="kecttep_tdmenu">&nbsp;기관/부서&nbsp;</td>
				<td nowrap align="center" class="kecttep_tdmenu">&nbsp;등록일&nbsp;</td>
				<td nowrap align="center" class="kecttep_tdmenu">&nbsp;비고&nbsp;</td>
			</tr>
			<%//for(int i=0; i < count; i++){%>

			<%
								int index = 0;     //배열에서 값을 꺼내오는 키값
								int nextCount = 0; //

								if(currentPage > 1){
									nextCount = ((currentPage-1)*recordSize);
								}
								
								for(int i = 0; (i < recordSize) && ((nextCount+i) < count); i++){
									index = nextCount+i;
						%>
			<tr style="padding-top: 3" valign="middle"
				onmouseover="this.style.backgroundColor='F9F9F9'"
				onmouseout="this.style.backgroundColor='white'" bgColor=#ffffff>
				<input type="hidden" name="repDocID" value="<%= docIDList[index] %>">
				<input type="hidden" name="docName"
					value="<%= docNameList[index] %>">
				<td width="80" nowrap height="25" align="center"><%= docIDList[index] %></td>
				<td>&nbsp;&nbsp;<!-- <a href="javascript:doLink('<%= docIDList[index] %>','<%= docNameList[index] %>');" ><%= docNameList[index] %></a> --></td>
				<td width="80" nowrap align="center"><%= userNameList[index] %></td>
				<td width="140" nowrap align="center"><%= deptNameList[index] %></td>
				<td width="120" nowrap align="center"><%= new SimpleDateFormat("yy/MM/dd").format(regDateList[index]) %></td>
				<td width="80" nowrap align="center">&nbsp;</td>
			</tr>
			<%	}	%>

			<%if(count > 0){%>
			<tr valign="middle">
				<td colspan="6" align="center"><!---- 페이지수 나오는 부분 시작 ---->
				<table width="100%" height="20" border="0" cellpadding="0"
					cellspacing="0">
					<tr bgcolor="ecf3f9">
						<td height="25" colspan="13" align="center"><jsp:include
							page="/totsys/common/inc/board/page.jsp" flush="true">
							<jsp:param name="uri" value="popup_form_list.jsp?tmpValue=-1" />
							<jsp:param name="pageSize" value="<%= pageSize %>" />
							<jsp:param name="currentPage" value="<%= currentPage %>" />
							<jsp:param name="currentPageSetUp"
								value="<%= currentPageSetUp %>" />
						</jsp:include></td>
					</tr>
				</table>
				</td>
			</tr>
			<%}else{%>
			<tr>
				<td colspan="11" height="25" align="center">등록된 집계문서가 없습니다.</td>
			</tr>
			<%}%>
		</table>
		</td>
	</tr>
	<!---- 리스트 끝---->

	<tr style="padding-top: 2px; padding-left: 12">
		<td valign="top">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<FORM name="searchForm" action="./popup_form_list.jsp" method="post">
			<tr>
				<!---- 검색 시작 ---->
				<td width="320"><select name="findOption" class="inputtxt"
					onchange="showMSG()">
					<option value="docName">문서명</option>
					<option value="docID">문서번호</option>
					<option value="regDate">등록일</option>
				</select> <input name="findWord" type="text" class="inputtxt" size="30"
					maxlength="30" value="<%= findWord %>"> <!---- 검색 끝 ----> <input
					type="image" src="images/search.gif"
					onclick="javascript:searchForm.submit();" align="absmiddle"></td>
				<td><span id="msg" style='display: none; padding-top: 5'><font
					color="#3c64ab">&nbsp;&nbsp;&nbsp;날짜 검색시 08-12-01 형식으로 입력</font></span></td>
			</tr>
			</FORM>
		</table>
		</td>
	</tr>
	<script>
	function showMSG(){
		if(searchForm.findOption.value == "regDate"){
			msg.style.display="block";
		}else{
			msg.style.display="none";
		}
	}
</script>

	<!--검색후 검색조건 선택하기위한 스크립트(히든값포함)-->
	<input type="hidden" name="tmpFind" value="<%=findOption%>">
	<script>
	if(tmpFind.value == "docID"){
		searchForm.findOption.selectedIndex=1;
	}else if(tmpFind.value == "regDate"){
		searchForm.findOption.selectedIndex=2;
	}
	if(searchForm.findOption.value == "regDate"){
			msg.style.display="block";
		}else{
			msg.style.display="none";
		}
</script>
	<!--검색후 검색조건 선택하기위한 스크립트 끝-->
</table>
</body>
</html>
<%
}catch(Exception ex){ex.printStackTrace();
	out.println(kr.co.kihyun.text.html.ServletUtil.getJavaScript("location='/servlet/kr.co.kihyun.beans.user.HttpSSOLogin?mode=logout';"));
}finally{
}
%>
