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.
 
 
 
 
 
 

290 lines
11 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);
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=3;
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");
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="/totsys/sysadm/board/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">
<tr>
<td nowrap width="0"></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<!---- 리스트 시작 ---->
<tr>
<td valign="top">
<table width="100%" padding="0" cellspacing="0">
<tr valign="middle" style="padding-top: 3">
<td width="500" align="center" nowrap class="kecttep_tdmenu">제목</td>
<td width="135" align="center" nowrap class="kecttep_tdmenu">날짜</td>
<td width="70" 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>
<td width="500" nowrap class="kecttep_graytd">
<img src="/totsys/totper/images/bu_002.gif" width="8" height="7" hspace="5">
<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 width="135" align="center" nowrap class="kecttep_graytd" height="25" align="center">&nbsp;<%=sdf.format(boardVO.getWriteDate())%></td>
<td width="70" align="center" nowrap class="kecttep_last_graytd">&nbsp;</td>
</tr>
<%
} //end of for list
} //end of if( count > 0)
else
{
%>
<tr>
<td colspan="7" class="report_no_data report_txt">등록된 자료가 없습니다.</td>
</tr>
<%
}
tx.rollback();
%>
</table>
</td>
</tr>
<tr>
<td height="15"></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">&nbsp;</td>
</tr>
</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();
}
%>