<% /************************************************************@@ * 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 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> 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"); %>
입력요령 / 관련자료    
<% if (boardList.size() > 0) { for (int i = 0; i < 20; i++) { Board b = boardList.get(i); if (i < boardList.size()) { %> <%} }%>
날짜 작성자 제목 파일첨부 조회수
<%= new SimpleDateFormat("yy/MM/dd").format(b.getWriteDate())%> <%= b.getUser(pm).getName()%> - <%= MString.getEllipsis(b.getTitle(), 26)%> + <% if (MString.isNull(usrFilenames)) { out.write(""); } else { out.write(usrFilenames); } %> <%= b.getVisit()%>
<%= boardTitle%>
 
<%= boardContents%>
<% int i = 0; for (i = 0; i < svrFilenameList.length; i++) { %> <% } for (; i < 5; i++) { %> <% } %>
+<%= Moumi.getMessageBundle().getString("moumi.message.file")%> <%= (i + 1)%> :  &fileName=<%=URLEncoder.encode(svrFilenameList[i], "UTF-8")%>&docID=<%=docID%>" target="hiddenIframe"><%= usrFilenameList[i]%>
 
<%if (buttonPrss.equals("/totsys/repoper/main.jsp") || buttonPrss.equals("/totsys/repoadm/main.jsp")) {%>
<%} else {%> <% if (isManager) { %> <% } else { %> <% } %>
<% }%>

<% } else { %>
등록된 글이 없습니다.
<% } %>
<% 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(); } %>