c-innovacion2/resoft/field_manager/process/board/bcb/list.jsp

190 lines
6.5 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/field_manager/include/manager_head.jsp"%>
<%
String c_home = r_call(request.getParameter("c_home"));
String c_maker = r_call(request.getParameter("c_maker"));
String board_no = r_call(request.getParameter("board_no"));
String c_relation= r_call(request.getParameter("c_relation"));
String c_relation2= r_call(request.getParameter("c_relation2"));
if(board_no == null || board_no.equals("")){
%>
<script>
alert("Wrong connection.")
</script>
<%
}else{
%>
<center>
<br>
<br>
<br>
<table width="1000" cellSpacing="0" cellPadding="0" border="0" bgcolor=ffffff>
<tr style="font-size:14px;">
<td height="60">
<%
String board_name = "BCB 공지사항";
if(c_relation2.equals("1074")){
board_name = "BCB 자료실";
}
if(c_relation2.equals("1075")){
board_name = "BCB 교육영상자료";
}
%>
<b>[ <%=board_name%> ] board management</b>
<%
String para_t = "c_home=" + c_home + "&c_maker=" + c_maker + "&board_no=" + board_no + "&c_relation=" + c_relation + "&c_relation2=" + c_relation2;
%>
<br>
</td>
</tr>
</table>
<%
String where_t = " c_use = 0 and ";
int totalRecord = 0; //총레코드개수
int numPerPage = 10; //한페이지당 보여줄레코드개수
int totalPage = 0; //총페이지수
int pagePerBlock = 10; //블록당페이지수
int nowPage = 1; //현재페이지
String sql1 = "";
sql1 = " select count(c_no) ";
sql1 = sql1 + " from tbl_board ";
sql1 = sql1 + " where "+ where_t +" c_relation = "+ c_relation +" and c_relation2 = "+ c_relation2 +" and c_home = "+ c_home +" and c_maker = "+ c_maker +" and c_board_no = "+ board_no +" ";
ResultSet rst = stmt.executeQuery(sql1);
if (rst.next()) {
totalRecord = rst.getInt(1);
}
rst.close();
if ( r_call(request.getParameter("nowPage")) != null && !r_call(request.getParameter("nowPage")).equals("")) {
nowPage = Integer.parseInt(r_call(request.getParameter("nowPage")));
}
//nowPage = 93;
//totalRecord =1240;
int pfirst = 0; //첫페이지 번호
int plast = 0; // 끝페이지 번호
int plast_org = 0;
pfirst = ((nowPage-1)/pagePerBlock)*pagePerBlock + 1;
plast = pfirst + pagePerBlock - 1;
plast_org = (totalRecord-1)/numPerPage + 1;
if(plast > plast_org){
plast = plast_org;
}
int c_number=totalRecord-(nowPage-1)*numPerPage;
int sql_now_page = (nowPage - 1) * numPerPage;
%>
<table width="1000" cellSpacing="0" cellPadding="0" border="0" bgcolor=ffffff>
<tr style="font-size:14px;">
<td width="60" height="40" scope="col" style="text-align:center; border-top:2px solid #9BBB67; border-bottom:1px solid #9BBB67">No</td>
<td height="" scope="col" style="text-align:center; border-top:2px solid #9BBB67; border-bottom:1px solid #9BBB67">Title</td>
<td width="80" height="" scope="col" style="text-align:center; border-top:2px solid #9BBB67; border-bottom:1px solid #9BBB67">Writer</td>
<td width="50" height="" scope="col" style="text-align:center; border-top:2px solid #9BBB67; border-bottom:1px solid #9BBB67">File</td>
<td width="50" height="" scope="col" style="text-align:center; border-top:2px solid #9BBB67; border-bottom:1px solid #9BBB67">Click</td>
<td width="120" height="" scope="col" style="text-align:center; border-top:2px solid #9BBB67; border-bottom:1px solid #9BBB67">Data</td>
</tr>
<%if(totalRecord==0) {%>
<tr>
<td width="" height="60" align="center" colspan=6>
No data.
</td>
</tr>
<tr>
<td colspan="6" height="1" bgcolor="e5e5e6"></td>
</tr>
<%}else{%>
<%
sql1 = " select t.* from ( select a.* ";
sql1 = sql1 + " from tbl_board a ";
sql1 = sql1 + " where "+ where_t +" a.c_relation = "+ c_relation +" and a.c_relation2 = "+ c_relation2 +" and a.c_home = "+ c_home +" and a.c_maker = "+ c_maker +" and a.c_board_no = "+ board_no +") t ";
sql1 = sql1 + " order by t.c_no desc ";
sql1 = sql1 + " limit "+ sql_now_page +" , "+ numPerPage +" ";
rst = stmt.executeQuery(sql1);
while (rst.next()) {
%>
<tr>
<td height="30" align=center>
<%=c_number%>
</td>
<td align=left style="padding:3px">
<a href="view.jsp?<%=para_t%>&c_no=<%=rst.getString("c_no")%>&nowPage=<%=nowPage%>"><%=rst.getString("c_title")%></a>
</td>
<td align=center>
<%=rst.getString("c_name")%>
</td>
<td align=center>
<%if(!rst.getString("c_file").equals("")){%>
O
<%}%>
</td>
<td align=center>
<%=rst.getString("c_click")%>
</td>
<td align=center>
<%=rst.getString("c_date").substring(0,10)%>
</td>
</tr>
<tr>
<td colspan="6" height="1" bgcolor="e5e5e6"></td>
</tr>
<%
c_number=c_number-1;
}
rst.close();
%>
<%} %>
<tr>
<td></td>
<td height="35" align="center" colspan="9" style="padding-bottom:10px;padding-top:10px">
<table align=center border=0 cellspacing=0 cellpadding=0>
<tr>
<%if(pfirst > 1){ %>
<td align=center width="32" style='padding=0,4,0,4'>
<a href="list.jsp?nowPage=1&<%=para_t%>">〈〈</a>
</td>
<td align=center width="32" style='padding=0,4,0,0'>
<a href="list.jsp?nowPage=<%=pfirst-1%>&<%=para_t%>">〈</a>
</td>
<%}%>
<% for(int i=pfirst;i<plast+1;i=i+1){%>
<td align=center width="32" style='padding=0,0,0,0' valign=top>
<% if(i==nowPage){%>
<font color=#4D9ACF size=3><b><%=i%>
<%}else{%>
<a href="list.jsp?nowPage=<%=i%>&<%=para_t%>"><font color=#787878 size=3><b><%=i%></b></a>
<%}%>
</td>
<%}%>
<%if(plast < plast_org){ %>
<td align=center width="32" style='padding=0,4,0,4'>
<a href="list.jsp?nowPage=<%=plast+1%>&<%=para_t%>">〉</a>
</td>
<td align=center width="32" style='padding=0,4,0,0'>
<a href="list.jsp?nowPage=<%=plast_org%>&<%=para_t%>">〉〉</a>
</td>
<%}%>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td height="35" align="right" colspan="9" style="padding-bottom:10px;padding-top:10px">
<a href="insert.jsp?<%=para_t%>" style="width: 98px; line-height: 30px; text-align: center;display: inline-block; background: #5e7cc4; border: 1px solid #555; border-radius: 5px; color: #ffffff;">Insert</a>
</td>
<td></td>
</tr>
</table>
<%}%>
<%@ include file="/field_manager/include/manager_bottom.jsp"%>