c-innovacion2/apply/board/list.jsp

205 lines
6.8 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/include/db/db_connect.jsp"%>
<%@include file="/include/function/function.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Main Management for C-Innovacion</title>
<link href="manager_system.css" rel="stylesheet" type="text/css">
<link href="style.css" rel="stylesheet" type="text/css">
<link href="cal_style.css" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="/js/calendar.js"></script>
</head>
<%
String c_home = "0";
String c_maker = "0";
String board_no = "0";
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">
<%
int c_relation = 0;
int c_relation2 = 0;
String sql_ok2 = "select * from tbl_menu where c_no = " + board_no;
ResultSet rss = stmt.executeQuery(sql_ok2);
if(rss.next()){
c_relation= rss.getInt("c_relation");
c_relation2= rss.getInt("c_relation2");
%>
<b>[ <%=rss.getString("c_name")%> ] board management</b>
<%
}
rss.close();
c_relation = 0;
c_relation2 = 1;
String para_t = "c_home=" + c_home + "&c_maker=" + c_maker + "&board_no=" + board_no + "&c_relaton=" + 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">Wirter</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">Clicks</td>
<td width="120" height="" scope="col" style="text-align:center; border-top:2px solid #9BBB67; border-bottom:1px solid #9BBB67">Date</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="/include/db/db_close.jsp"%>