knu project
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.
 
 
 
 
 
 

352 lines
20 KiB

<%
/************************************************************@@
* Program Name : list.jsp
* Description : /집계자/공지사항
* Author : 강원중
* Create Date : 2004.10.11
* History :
@@************************************************************/
%>
<%@ page contentType="text/html; charset=UTF-8"
import="java.util.Date"
import="java.net.URLEncoder"
import="java.util.List"
import="java.text.SimpleDateFormat"
import="kr.co.kihyun.lang.MString"
import="kr.co.kihyun.lang.MInteger"
import="kr.co.kihyun.util.MDate"
import="kr.co.kihyun.text.html.TagFilter"
import="kr.co.kihyun.lang.MLong"
import="javax.jdo.PersistenceManager"
import="javax.jdo.Transaction"
import="kr.co.kihyun.beans.entity.util.*"
import="kr.co.kihyun.beans.entity.*"%>
<%@ page import="java.util.Map.Entry"%>
<%@ page import="java.util.List"%>
<%@ page import="kr.co.kihyun.text.html.ServletUtil"%>
<%@ page import="kr.co.kihyun.moumi.Moumi"%>
<%@ page import="kr.co.kihyun.lang.StringConverter"%>
<%@ page import="kr.co.kihyun.beans.user.HttpSSOLogin"%>
<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<% PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
Transaction tx = pm.currentTransaction();
try {
/****** Parameter ******/
Long docID = MLong.parseLong(request.getParameter("docID"), null);
String boardGroupID = Category.ID_TOT_DOC_COMMENT;
String url = clearXSS(request.getParameter("url"), "");
if (url == null) {
url = "";
}
TotDoc totDoc = pm.getObjectById(TotDoc.class, docID);
Category category = pm.getObjectById(Category.class, boardGroupID);
List<Board> boardList = totDoc.getBoards(pm, category);
if (boardList.size() < 1) {
// return;
}
/*********** User HttpSSOLogin check ***********/
if (!HttpSSOLogin.isLogin(request)) {
String connURL = "opener.location='/totsys/login/login.jsp';";
out.println(ServletUtil.getJavaScript(connURL));
out.println(ServletUtil.getJavaScript("window.close();"));
return;
}
/********** session내의 userId **********/
String usID = HttpSSOLogin.getLoginID(request);
/*********** Parameter values ***********/
Long boardID = null;
if (boardList.size() > 0) {
boardID = boardList.get(0).getId();
}
/*********** Board View vlaues ***********/
Board board = null;
String regID = "";
String boardTitle = "";
String boardContents = "";
String usrFilenames = "";
String svrFilenames = "";
int visit = 0;
tx.begin();
if (boardList.size() > 0) {
board = boardID == null ? null : pm.getObjectById(Board.class, boardID);
regID = board.getUser(pm) == null ? null : board.getUser(pm).getId();
boardTitle = board.getTitle();
boardContents = TagFilter.convertSpace(board.getContents());
for (Entry<String, List<Byte>> entry : board.getAttachments().entrySet()) {
usrFilenames += entry.getKey() + ";";
svrFilenames += entry.getKey() + ";";
}
docID = board.getTotDoc() == null ? null : board.getTotDoc().getId();
boardGroupID = board.getCategory().getId();
visit = board.getVisit();
board.setVisit(visit + 1);
pm.makePersistent(board);
}
/*********** append file name vlaues ***********/
String[] usrFilenameList = usrFilenames.split(";");
String[] svrFilenameList = svrFilenames.split(";");
/****** 본인 유무 처리 ******/
boolean isManager = false;
if (usID.equals(regID)) {
isManager = true;
}
/***** 버튼 처리 ******/
String buttonPrss = (String) session.getAttribute("homeTagetURL");
%>
<SCRIPT>
function opener(url, width, height) {
var leftpos = (screen.width - width) / 2;
var toppos = (screen.height - height) / 2;
post= window.open(url, "post","width="+width+", height="+height+", toolbar=no,menubar=no,status=no,location=no,scrollbars=no,resizable=no,directories=no,left=" + leftpos + ",top=" + toppos);
post.focus();
}
</SCRIPT>
<tr>
<td colspan="4">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 14"><img src="images/ico_1.gif"></td>
<td class="kecttep_title" style="padding-left: 5" align="left" width="100%">입력요령 / 관련자료</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="3"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="50" colspan="4" valign="top">
<table border="1" bordercolor="#abbddd" width="100%" cellpadding="0" cellspacing="0">
<tr align="center" style="padding-top: 3;">
<td width="130" class="kecttep_tdmenu" nowrap bgcolor="EAEAEA">날짜</td>
<td width="130" class="kecttep_tdmenu" nowrap bgcolor="EAEAEA">작성자</td>
<td bgcolor="EAEAEA" class="kecttep_tdmenu">제목</td>
<td nowrap width="162" class="kecttep_tdmenu">파일첨부</td>
<td width="80" nowrap class="kecttep_tdmenu">조회수</td>
</tr>
<%
if (boardList.size() > 0) {
for (int i = 0; i < 20; i++) {
Board b = boardList.get(i);
if (i < boardList.size()) {
%>
<tr style="padding-top: 3;">
<td height="25" align="center"><%= new SimpleDateFormat("yy/MM/dd").format(b.getWriteDate())%></td>
<td height="25" align="center"><%= b.getUser(pm).getName()%></td>
<td style="padding-left: 15;">
<font style="cursor: hand;" onclick="opener('/totsys/common/inc/board/doc/popup_view.jsp?boardID=<%= b.getId()%>','518','488');"
color="#FF6600"><b>-</b>&nbsp;<%= MString.getEllipsis(b.getTitle(), 26)%></font></td>
<td style="padding-left: 15;"><font color="#FF6600"><b>+</b></font>
<%
if (MString.isNull(usrFilenames)) {
out.write("");
} else {
out.write(usrFilenames);
}
%>
</td>
<td style="padding-left: 15;"><font color="#FF6600"></font><%= b.getVisit()%></td>
</tr>
<%}
}%>
<tr align="right" style="padding-top: 3;">
<!-- 집계자 본인일때만 글쓰기 가능-->
<td colspan="5" style="padding-right: 10;">
<link rel="stylesheet" href="/totsys/common/css/text.css" type="text/css">
<script src="/totsys/common/js/rollover.js"></script>
<SCRIPT language="JAVASCRIPT">
function goList(){
window.close();
}
function boardDel(){
if(confirm("삭제 하시겠습니까?")){
location.href = "/servlet/kr.co.kihyun.beans.totsys.board.HttpBoardDelete?docID=<%= docID%>&boardID=<%= boardID%>&boardGroupID=<%=boardGroupID%>";
}
}
function boardModify(){
window.open('/totsys/common/inc/board/doc/popup_modify.jsp?boardID=<%=boardID%>&docID=<%=docID%>','','width=538, height=540,toolbar=no, directories=no, status=no, menubar=no, resizable=no');
// window.close();
}
function alertModify(){
alert("해당 주의사항에 대한 변경 권한이 없습니다.");
}
function alertDel(){
alert("해당 주의사항에 대한 삭제 권한이 없습니다.");
}
</SCRIPT>
</head>
<body style='' bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<!--스타일시트-->
<link rel="stylesheet" href="/totsys/common/css/kecttep.css" type="text/css">
<tr>
<td height="66" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top">
<table border="1" bordercolor="#abbddd" width="100%" cellpadding="0" cellspacing="0">
<!-----제목 ---->
<TR vAlign=center>
<TD vAlign=top bgColor=#ffffff colSpan=2 height=27>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR bgColor=#f9fee7>
<td class="kecttep_tdmenu" align="center"><b><%= boardTitle%></b></td>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
<tr>
<td bgcolor="#FFFFFF" valign="top" colspan="2" height="220">
<table width="95%" border="0" cellspacing="0" cellpadding="0" height="100%" align="center">
<tr>
<td valign="top" height="10">&nbsp;</td>
</tr>
<!----- 내용 시작---->
<tr>
<td valign="top"><%= boardContents%></td>
</tr>
<!----- 내용 끝---->
</table>
</td>
</tr>
<!----- 첨부파일 시작 ---->
<tr>
<td bgcolor="#FFFFFF" valign="bottom" colspan="2">
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<%
int i = 0;
for (i = 0; i < svrFilenameList.length; i++) {
%>
<tr>
<td height="17" style="padding-left: 3; padding-top: 4">
<font color="#FF6600"><b>+</b><%= Moumi.getMessageBundle().getString("moumi.message.file")%></font>
<%= (i + 1)%>&nbsp;:&nbsp; <a
href="/servlet/kr.co.kihyun.text.html.HttpViewer?saveAs=<%=URLEncoder.encode(usrFilenameList[i], "UTF-8")%>&fileName=<%=URLEncoder.encode(svrFilenameList[i], "UTF-8")%>&docID=<%=docID%>"
target="hiddenIframe"><%= usrFilenameList[i]%></a></td>
</tr>
<%
}
for (; i < 5; i++) {
%>
<tr>
<td height="17" style="padding-left: 3; padding-top: 4">
&nbsp;</td>
</tr>
<% }
%>
</table>
</td>
</tr>
<!----- 첨부파일 끝 ---->
</table>
</td>
</tr>
</table>
<table width="145" border="0" cellspacing="0" cellpadding="0"
align="right">
<!---- 버튼 (목록, 수정, 삭제 버튼 ) ---->
<tr valign="top">
<td valign="bottom" height="25">
<%if (buttonPrss.equals("/totsys/repoper/main.jsp") || buttonPrss.equals("/totsys/repoadm/main.jsp")) {%>
<table width="130" border="0" cellspacing="0" cellpadding="0"
height="18" align="right">
<tr>
<td style="padding-left: 13;" align="right"><a href="#"
onclick="self.close()"><img src="images/bt_close.gif"
border="0"></a></td>
</tr>
</table>
<%} else {%>
<table width="130" border="0" cellspacing="0" cellpadding="0"
align="right">
<tr>
<td style="padding-left: 13;"><a href="#"
onclick="goList()"><img
src="images/notice_view_list.gif" border="0"></a></td>
<%
if (isManager) {
%>
<td style="padding-left: 9;"><a href="#"
onclick="boardModify();"><img
src="images/notice_modify.gif" border="0"></a></td>
<td style="padding-left: 9;"><a href="#"
onclick="boardDel();"><img src="images/notice_del.gif"
border="0"></a></td>
<% } else {
%>
<td style="padding-left: 9;"><a href="#"
onclick="alertModify();"><img
src="images/notice_modify.gif" border="0"></a></td>
<td style="padding-left: 9;"><a href="#"
onclick="alertDel();"><img src="images/notice_del.gif"
border="0"></a></td>
<% }
%>
</tr>
</table>
<% }%>
</td>
<td height="7" width="12"></td>
</tr>
</table>
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
} else {
%>
<tr align="right" style="padding-top: 3;">
<td height="35" align="center" colspan="5">등록된 글이 없습니다.</td>
</tr>
<!-- 집계자 본인일때만 글쓰기 가능-->
<tr align="right" style="padding-top: 3;">
<td height="35" colspan="5" align="right" style="padding-right: 15;">
<% }
%>
</td>
</tr>
<!---- 공지사항 끝 ---->
</table>
</td>
</tr>
<%
tx.commit();
} 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 {
if (tx.isActive()) {
tx.rollback();
}
pm.close();
}
%>
<iframe name="hiddenIframe" width="0" height="0" style="display: none;"></iframe>