You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
445 lines
21 KiB
445 lines
21 KiB
<%@page import="kr.co.kihyun.text.html.TagFilter"%> |
|
<% |
|
/********************************************************************************** |
|
프로그램명 : board_list.jsp |
|
프로그램설명 : |
|
작 성 자 : |
|
작 성 일 : |
|
최신변경일 : |
|
***********************************************************************************/ |
|
%> |
|
<%@ page contentType="text/html; charset=euc-kr" |
|
import="java.net.URLEncoder" import="java.text.SimpleDateFormat" |
|
import="java.util.Date" import="java.util.List" |
|
import="javax.jdo.PersistenceManager" import="javax.jdo.Transaction" |
|
import="javax.jdo.Query" import="kr.co.kihyun.beans.entity.*" |
|
import="kr.co.kihyun.beans.entity.util.*" |
|
import="kr.co.kihyun.beans.user.HttpSSOLogin" |
|
import="kr.co.kihyun.beans.user.User" |
|
import="kr.co.kihyun.lang.Encoder" import="kr.co.kihyun.lang.MString" |
|
import="kr.co.kihyun.service.*" import="kr.co.kihyun.service.vo.*" import="java.util.*" |
|
import="java.text.SimpleDateFormat" |
|
import="kr.co.kihyun.moumi.Moumi"%> |
|
|
|
<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%> |
|
|
|
<% |
|
response.setBufferSize(1024*8); |
|
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager()); |
|
Transaction tx = pm.currentTransaction(); |
|
try{ |
|
String usID = HttpSSOLogin.getLoginID(request); |
|
int sysAuth = HttpSSOLogin.getSysAuth(request); |
|
String dtID = HttpSSOLogin.getDeptID(request); |
|
|
|
/************ Parameter ************/ |
|
String boardGroupID = request.getParameter("boardGroupID"); |
|
String strPage = clearXSS(request.getParameter("strPage"),""); |
|
String findOption = clearXSS(request.getParameter("findOption"),null); |
|
String findWord = clearXSS(Encoder.toJava(request.getParameter("findWord")),null); |
|
String boardType = ""; |
|
Category category = pm.getObjectById(Category.class, boardGroupID); |
|
|
|
//////////////////////// |
|
// MUser user = pm.getObjectById(MUser.class, "stt01"); |
|
// tx.begin(); |
|
// for(int i = 0; i < 400 ; i++ ) { |
|
// Board instance = new Board(); |
|
// instance.setCategory(category); |
|
// instance.setUser(user); |
|
// instance.setRepLevel(0); |
|
// instance.setStep(0); |
|
// instance.setTitle(boardGroupID + "-테스트입력" + (i+1)); |
|
// instance.setContents(boardGroupID + "-테스트입력" + (i+1)); |
|
// instance.setVisit(0); |
|
// instance.setWriteDate(new Date()); |
|
// instance.setPopupYn(false); |
|
// pm.makePersistent(instance); |
|
// } |
|
// tx.commit(); |
|
// System.out.println("된다."); |
|
/////////////////////// |
|
|
|
// List<Board> boardList; |
|
// Query q = pm.newQuery(Board.class); |
|
// boardList = (List<Board>) q.execute(); |
|
// q = pm.newQuery(Board.class, boardList); |
|
// |
|
// //MJH 추가 20120316 정렬쿼리 시작 |
|
// String[] getPopYn; |
|
// Boolean[] getPopupyn; |
|
// int[] getId; |
|
// String[] getWritedate; |
|
// String[] getTitle; |
|
// String[] getUserName; |
|
// String[] getDeptName; |
|
// int[] getVisit; |
|
// int getCount; |
|
// |
|
// BoardModify board = new BoardModify(); |
|
// board.executeQuery(boardGroupID,findOption,findWord); |
|
// |
|
// getPopYn = board.getPopYn(); |
|
// getId = board.getId(); |
|
// getWritedate = board.getWritedate(); |
|
// getTitle = board.getTitle(); |
|
// getUserName = board.getUserName(); |
|
// getDeptName = board.getDeptName(); |
|
// getVisit = board.getVisit(); |
|
// getCount = board.getCount(); |
|
|
|
String method = clearXSS(request.getParameter("method"),""); |
|
if(method.equals("GET")) findWord = URLDecoder.decode(MString.checkNull(request.getParameter("findWord")), "UTF-8"); |
|
//String uri = URLEncoder.encode("board_list.jsp?boardGroupID="+boardGroupID+"&findOption="+MString.checkNull(findOption),"UTF-8")+"&method=GET"; |
|
|
|
/************ 리스트 페이지 구성 ************/ |
|
int endPage=0; |
|
int pageSize=0; |
|
int currentPage=0; |
|
int absolutePage=0; |
|
int currentPageSetUp=0; |
|
int recordSize=10; |
|
|
|
|
|
if(strPage == null || strPage.length()<=0){ |
|
currentPage = 1; |
|
}else if(strPage.equals("null")){ |
|
currentPage = 1; |
|
}else{ |
|
try{ |
|
currentPage=Integer.parseInt(strPage); |
|
}catch(NumberFormatException ex){ |
|
System.out.println(ex); |
|
} |
|
} |
|
|
|
//====================================================================== |
|
BoardService boardService = new BoardService(pm); |
|
//검색조건파라미터 |
|
Map params = new HashMap(); |
|
params.put("findOption", findOption); |
|
params.put("findWord", findWord); |
|
params.put("groupId", boardGroupID); |
|
|
|
//검색메인쿼리와 레코드갯수조회쿼리를 생성 후 멤버변수로 저장 |
|
boardService.createBoardListQuery(params); |
|
|
|
//레코드갯수조회쿼리를 실행하여 레코드갯수를 구함 |
|
int count = boardService.getCountFromMainQuery(); |
|
|
|
if((count%recordSize) == 0) { |
|
pageSize = (int)(count/recordSize); |
|
} else { |
|
pageSize = (int)(count/recordSize)+1; |
|
} |
|
|
|
if( currentPage > pageSize ) currentPage = pageSize; |
|
currentPageSetUp = (int)(currentPage/10)*10; |
|
if (currentPage%10 == 0){ |
|
currentPageSetUp-=10; |
|
} |
|
|
|
int startNo = (currentPage - 1) * recordSize + 1; |
|
int endNo = currentPage * recordSize; |
|
|
|
List list = null; |
|
|
|
//검색목록조회쿼리 실행 |
|
if( count > 0 ) { |
|
//페이징처리를 위한 추가파라미터 설정 |
|
boardService.getParams().put("startNo", startNo); |
|
boardService.getParams().put("endNo", endNo); |
|
|
|
//검색메인쿼리를 페이징처리를 위한 쿼리로 변환 |
|
boardService.convertToPagenatingQuery(); |
|
|
|
//만족하는 레코드가 존재하면 조회 |
|
list = boardService.executeQuery(BoardVO.class); |
|
} |
|
//====================================================================== |
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
session.setAttribute("envTagetURL", "/totsys/common/inc/sysadm/top/top.jsp"); |
|
session.setAttribute("homeTagetURL", "/totsys/sysadm/board/board_list.jsp"); |
|
|
|
if("ID_SYSTEM_NOTICE".equals(boardGroupID)){ |
|
boardType = Moumi.getMessageBundle().getString("moumi.message.board.notice"); |
|
}else if("ID_FAQ".equals(boardGroupID)){ |
|
boardType = Moumi.getMessageBundle().getString("moumi.message.board.faq"); |
|
}else if("ID_QNA".equals(boardGroupID)){ |
|
boardType = Moumi.getMessageBundle().getString("moumi.message.board.qna"); |
|
}else if("ID_PDS".equals(boardGroupID)){ |
|
boardType = Moumi.getMessageBundle().getString("moumi.message.board.pds"); |
|
} |
|
%> |
|
|
|
|
|
<%@page import="java.net.URLDecoder"%> |
|
<HTML> |
|
<HEAD> |
|
<TITLE><%=Moumi.getTitle()%></TITLE> |
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=euc-kr"> |
|
<link rel="stylesheet" href="/totsys/common/css/text.css" type="text/css"> |
|
<link rel="stylesheet" href="/totsys/common/css/kecttep.css" type="text/css"> |
|
<link rel="stylesheet" href="/totsys/common/css/SquareButtons.css" type="text/css"> |
|
<script src="/totsys/common/js/rollover.js"></script> |
|
<script src="/totsys/common/js/mouse.js"></script> |
|
<script language="javascript"> |
|
function find(){ |
|
var word = document.search.findWord.value.length; |
|
var option = document.search.select.options[document.search.select.selectedIndex].value; |
|
|
|
document.search.findOption.value = option; |
|
|
|
if(search.findWord.value == ""){ |
|
alert("검색 단어를 입력해 주세요"); |
|
return; |
|
} |
|
|
|
if(document.search.findOption.value!="id" && word < 2){ |
|
alert("검색어는 2글자 이상이어야 합니다.!"); |
|
return; |
|
} |
|
document.search.strPage.value = 1; |
|
document.search.submit(); |
|
} |
|
|
|
/* |
|
* 페이지이동처리함수 |
|
*/ |
|
function fn_goToPage(p_page) { |
|
document.search.strPage.value = p_page; |
|
document.search.submit(); |
|
} |
|
|
|
/* |
|
* 상세보기페이지로 이동처리하는 함수 |
|
* @param {type} p_boardId |
|
* @returns {undefined} |
|
*/ |
|
function fn_goToView(p_boardId) { |
|
document.f_view.boardID.value = p_boardId; |
|
document.f_view.submit(); |
|
} |
|
</script> |
|
</HEAD> |
|
|
|
<body style='' BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0> |
|
<form name="f_view" method="post" action="./board_view.jsp"> |
|
<input type="hidden" name="boardID" value=""> |
|
<input type="hidden" name="strPage" value="<%= currentPage %>"> |
|
<input type="hidden" name="boardGroupID" value="<%= boardGroupID %>"> |
|
<input type="hidden" name="findWord" value="<%= findWord %>"> |
|
<input type="hidden" name="findOption" value="<%= findOption %>"> |
|
</form> |
|
<table width="100%" height="70" border="0" cellpadding="0" cellspacing="0"> |
|
<jsp:include page="/totsys/common/inc/sysadm/top/top.jsp" flush="true" /> |
|
<tr> |
|
<td nowrap width="0"></td> |
|
<td> |
|
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> |
|
<jsp:include page="/totsys/common/inc/title/title.jsp" flush="true"> |
|
<jsp:param value='<%= URLEncoder.encode(boardType, "UTF-8")%>' name="title" /> |
|
</jsp:include> |
|
<tr class="toolbar"> |
|
<td valign="top"> |
|
<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
|
<tr> |
|
<td width="auto"> |
|
<FORM NAME="search" action="./board_list.jsp" onsubmit="find();" method="post" style="margin: 0px"> |
|
<input type="hidden" name="strPage" value="<%= currentPage %>"> |
|
<input type="hidden" name="boardGroupID" value="<%= boardGroupID %>"> |
|
<select name="select" class="inputtxt" onchange="showMSG()"> |
|
<option value="title">제목</option> |
|
<!--//<option value="mUser.name">작성자</option>//--> |
|
</select> |
|
<input type="text" name="findWord" class="inputtxt" size="30" maxlength="30" value="<%= MString.checkNull(findWord) %>" style="ime-mode: active;" /> |
|
<input type="hidden" name="findOption" value="<%= findOption %>"> <!---- 검색 끝 ----> |
|
<a href="#" onclick="find();" title="검색"> |
|
<!--<img src="/totsys/common/images/bt_search.gif" border="0" align="middle" style="MARGIN: 2px 0px 0px 0px">--> |
|
<img src="/totsys/common/images/bt_search_inquiry2.gif" border="0" align="middle" alt="검색" style="margin: 2px 0px 0px 0px;" /> |
|
</a> |
|
</FORM> |
|
</td> |
|
<td> |
|
<span id="msg" class="kecttep_date_search" style='display: none; padding-top: 5'> |
|
날짜검색시 10-12-01 형식으로 입력 |
|
</span> |
|
</td> |
|
<td align="right" width="8%"> |
|
<%if(sysAuth == Moumi.TOTPER && ("ID_QNA".equals(boardGroupID) )){ %> |
|
<!--<a class="simplebutton" href="./board_write.jsp?boardGroupID=<%=boardGroupID%>&strPage=<%=strPage%>"> |
|
<span class="regist" style="width: 82px; cursor: pointer"> |
|
<%= Moumi.getMessageBundle().getString("moumi.message.button.boardRegist") %> |
|
</span> |
|
</a>--> |
|
<a href="./board_write.jsp?boardGroupID=<%=boardGroupID%>&strPage=<%=strPage%>"> |
|
<img src="/totsys/common/images/bt_write.gif" align="middle" /> |
|
</a> |
|
<%}else if(sysAuth == Moumi.SYSADM){%> |
|
<!--<a class="simplebutton" href="./board_write.jsp?boardGroupID=<%=boardGroupID%>&strPage=<%=strPage%>"> |
|
<span class="regist" style="width: 82px; cursor: pointer"> |
|
<%= Moumi.getMessageBundle().getString("moumi.message.button.boardRegist") %> |
|
</span> |
|
</a>--> |
|
<a href="#" onclick="fn_goWritePage();" title="게시물작성"> |
|
<img src="/totsys/common/images/bt_write.gif" align="middle" /> |
|
</a> |
|
<form name="f_write" method="post" action="./board_write.jsp"> |
|
<input type="hidden" name="strPage" value="<%= currentPage %>"> |
|
<input type="hidden" name="boardGroupID" value="<%= boardGroupID %>"> |
|
<input type="hidden" name="findWord" value="<%= findWord %>"> |
|
<input type="hidden" name="findOption" value="<%= findOption %>"> |
|
</form> |
|
<script> |
|
/** |
|
* 게시물작성페이지로 이동처리하는 함수 |
|
* @returns {undefined} |
|
*/ |
|
function fn_goWritePage() { |
|
document.f_write.submit(); |
|
} |
|
</script> |
|
<%}%> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
</tr> |
|
<!---- 리스트 시작 ----> |
|
<tr> |
|
<td valign="top"> |
|
<table border="1px" bordercolor="#e3e3e3" class="kecttep_list_table" width="100%" cellpadding="0" cellspacing="0"> |
|
<tr valign="middle"> |
|
<% if("ID_SYSTEM_NOTICE".equals(boardGroupID)) { %> |
|
<td width="7%" align="center" nowrap class="kecttep_tdmenu">팝업공지</td> |
|
<% } %> |
|
<td width="10%" align="center" nowrap class="kecttep_tdmenu">번호</td> |
|
<td width="40%" align="center" nowrap class="kecttep_tdmenu">제목</td> |
|
<td width="10%" align="center" nowrap class="kecttep_tdmenu">작성자</td> |
|
<!--td width="10%" align="center" nowrap class="kecttep_tdmenu">기관/부서</td--> |
|
<td width="18%" align="center" nowrap class="kecttep_tdmenu">날짜</td> |
|
<td width="5%" align="center" nowrap class="kecttep_last_tdmenu">조회수</td> |
|
</tr> |
|
<% |
|
//[이전][이후]의 페이지별 이동을 위해 구해진 PAGE값에 1 값을 빼주고 10을 곱한 결과에 |
|
//1을 더해 줌으로서 10개의 레코드에 대한 부분을 리스트로 보여줍니다. |
|
/*int nextCount = 0; |
|
int index = 0; |
|
if(currentPage > 1){ |
|
nextCount = ((currentPage-1)*recordSize); |
|
}*/ |
|
%> |
|
<!-- start board 글목록 --> |
|
<% |
|
tx.begin(); |
|
//for(int i = 0; (i < recordSize) && ((nextCount+i) < getCount); i++){ |
|
//index = nextCount+i; |
|
if( count > 0 ) { |
|
int listCount = list.size(); |
|
for(int i = 0; i < listCount; i++){ |
|
BoardVO boardVO = (BoardVO)list.get(i); |
|
%> |
|
<tr style="padding-top: 3" valign="middle" onmouseover="this.style.backgroundColor='F9F9F9'" onmouseout="this.style.backgroundColor='white'" bgColor=#ffffff> |
|
<% if("ID_SYSTEM_NOTICE".equals(boardGroupID)) { %> |
|
<td align="center" nowrap class="kecttep_graytd"> |
|
<input type="checkbox" disabled<% if("Y".equals(boardVO.getPopupYn())){ %> checked <%}%> |
|
</td> |
|
<% } %> |
|
<td align="center" nowrap class="kecttep_graytd"> <%=boardVO.getId() %></td> |
|
<td nowrap class="kecttep_graytd"> |
|
|
|
<a onmouseover="balloon_on('<%= boardVO.getTitle() %>',this,10,4)" onmouseout="balloon_off()" href="javascript:fn_goToView('<%=boardVO.getId()%>');"> |
|
<%=MString.getEllipsis( TagFilter.unconvertedMeta(boardVO.getTitle()) , 60 )%> |
|
</a> |
|
</td> |
|
<td align="center" nowrap class="kecttep_graytd"> <%if("ID_SYSTEM_NOTICE".equals(boardGroupID) ||"ID_FAQ".equals(boardGroupID) || "ID_PDS".equals(boardGroupID)){%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.sysadm") %><%}else{%><%= boardVO.getUserName()%><%}%></td> |
|
<!--td align="center" nowrap class="kecttep_graytd"> <%=boardVO.getDeptName()%></td--> |
|
<td nowrap class="kecttep_graytd" height="25" align="center"> <%=sdf.format(boardVO.getWriteDate())%></td> |
|
<td align="center" nowrap class="kecttep_last_graytd"><%=boardVO.getVisit()%></td> |
|
</tr> |
|
<% } |
|
} |
|
tx.rollback(); |
|
%> |
|
</table> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td height="15"></td> |
|
</tr> |
|
<%if(count > 0){%> |
|
<tr style="padding-top: 3" valign="middle"> |
|
<td class="kecttep_board" colspan="6" align="center"><!---- 페이지수 나오는 부분 시작 ----> |
|
<table height="20" border="0" cellpadding="0" cellspacing="0"> |
|
<tr> |
|
<td align="center"> |
|
<jsp:include page="/totsys/common/inc/board/page_module.jsp" flush="true"> |
|
<jsp:param name="pageFunction" value="fn_goToPage" /> |
|
<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 class="kecttep_none_tdmenu" colspan="6" height="25" align="center"> |
|
게시된 <%= Moumi.getMessageBundle().getString("moumi.message.doc") %>가 없습니다. |
|
</td> |
|
</tr> |
|
<%}%> |
|
<!---- 리스트 끝 ----> |
|
<!--1픽셀 띄우기--> |
|
<tr> |
|
<td height="3"></td> |
|
</tr> |
|
|
|
<script> |
|
function showMSG(){ |
|
if(search.select.value == "regDate"){ |
|
msg.style.display="block"; |
|
}else{ |
|
msg.style.display="none"; |
|
} |
|
} |
|
</script> |
|
|
|
</table> |
|
</td> |
|
<td nowrap width="10"> </td> |
|
</tr> |
|
<!--검색후 검색조건 선택하기위한 스크립트(히든값포함)--> |
|
<input type="hidden" name="tmpFind" value="<%=findOption%>"> |
|
<script> |
|
if(tmpFind.value == "title"){ |
|
search.select.selectedIndex=0; |
|
}else if(tmpFind.value == "mUser.name"){ |
|
search.select.selectedIndex=1; |
|
} |
|
</script> |
|
<!--검색후 검색조건 선택하기위한 스크립트 끝--> |
|
<!------------------------------- buttom menu start -------------------------------> |
|
<!--//%@ include file="/totsys/common/inc/buttom/buttom.jsp"//--%> |
|
<!--%@ include file="/totsys/common/inc/buttom/buttom.jsp"%--> |
|
<!------------------------------- buttom menu end -------------------------------> |
|
</table> |
|
</BODY> |
|
</HTML> |
|
<% |
|
}catch(Exception ex){ |
|
//38.오류메세지를 통한 정보 노출(getMessage)_CWE-209 : Update by YOUNGJUN,CHO |
|
ex.printStackTrace(); |
|
//out.println(ex);//앤개 |
|
//out.println("<html><body style='overflow=auto' bgcolor='white'><h1>Can't contact servlet runner</h1><br><br>Message : "+ex.getMessage()+"</body></html>"); |
|
//out.println("<META HTTP-EQUIV='refresh' CONTENT='0.1; URL=/error/exception.jsp'>"); |
|
//================================================ |
|
}finally{ |
|
if(tx.isActive()) |
|
tx.rollback(); |
|
pm.close(); |
|
} |
|
%>
|
|
|