최종 코드 업데이트

This commit is contained in:
USER
2026-08-14 19:21:08 +09:00
committed by USER
parent 529de50dab
commit cd2ec1c411
19 changed files with 1463 additions and 0 deletions
@@ -0,0 +1,2 @@
<%@ page pageEncoding="UTF-8"%>
<form id="commonForm" name="commonForm"></form>
@@ -0,0 +1,15 @@
<%@ page pageEncoding="UTF-8"%>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>bloggers</title>
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ taglib prefix="fn" uri="jakarta.tags.functions" %>
<%@ taglib prefix="fmt" uri="jakarta.tags.fmt" %>
<link rel="stylesheet" type="text/css" href="<c:url value='/css/ui.css'/>" />
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="<c:url value='/js/common.js'/>" charset="UTF-8"></script>
@@ -0,0 +1,94 @@
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ include file ="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
<h2>게시판 목록</h2>
<table class="board_list">
<colgroup>
<col width="10%"/>
<col width="50"/>
</colgroup>
<thead>
<tr>
<th scope="col">글번호</th>
<th scope="col">제목</th>
</tr>
</thead>
<tbody>
<c:choose>
<c:when test="${fn:length(list) > 0}"> <!-- boolean -->
<c:forEach items="${list }" var="row" varStatus="status">
<tr>
<td>${row.IDX }</td>
<td class="title">
<a href="#this" name="title">${row.TITLE }</a>
<input type="hidden" id="IDX" value="${row.IDX }">
</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="4">조회된 결과가 없습니다.</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
<c:if test="${not empty paginationInfo }">
<ui:pagination paginationInfo = "${paginationInfo }" type="text" jsFunction="fn_search"/>
</c:if>
<input type="hidden" id="currentPageNo" name="currentPageNo"/>
<br/>
<a href="#this" class="btn" id="write">글쓰기</a>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
$(document).ready(function(){
$("#write").on("click", function(e){ //글쓰기 버튼
e.preventDefault();
fn_openBoardWrite();
});
$("a[name='title']").on("click", function(e){ //제목
e.preventDefault();
fn_openBoardDetail($(this)); //$(this)의미 : jQuery <a 태그의미
});
});
function fn_openBoardWrite(){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardWrite.do' />");
comSubmit.submit();
}
function fn_openBoardDetail(obj){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardDetail.do' />");
comSubmit.addParam("IDX", obj.parent().find("#IDX").val()); // key와 value값
comSubmit.submit();
}
function fn_search(pageNo)
{
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do'/>");
comSubmit.addParam("currentPageNo", pageNo);
comSubmit.submit();
}
</script>
</body>
</html>
@@ -0,0 +1,24 @@
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<script src="http://ajax.googleapis.com/ajax/libs/1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var name = $('#name');
var greeting = $('#greeting');
name.bind('keydown', function(){
setTimeout(greeting.text('HELLO,' + name.val() + '!!!'),0);
});
});
</script>
<title>Insert title here</title>
</head>
<body>
<input id="name" value=""/>
<p id="greeting"></p>
</body>
</html>
@@ -0,0 +1,103 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
<table class="board_view">
<colgroup>
<col width="15%"/>
<col width="35%"/>
<col width="15%"/>
<col width="35%"/>
</colgroup>
<caption>게시글 상세</caption>
<tbody>
<tr>
<th scope="row">글 번호</th>
<td>${map.IDX }</td>
<th scope="row">조회수</th>
<td>${map.HIT_CNT }</td>
</tr>
<tr>
<th scope="row">작성자</th>
<td>${map.CREA_ID }</td>
<th scope="row">작성시간</th>
<td>${map.CREA_DTM }</td>
</tr>
<tr>
<th scope="row">제목</th>
<td colspan="3">${map.TITLE }</td>
</tr>
<tr>
<td colspan="4">${map.CONTENTS }</td>
</tr>
<tr>
<th scope="row">첨부파일</th>
<td colspan="3">
<c:choose>
<c:when test="${fn:length(list) >0 }"> <!-- boolean -->
<c:forEach var="row" items="${list}">
<input type="hidden" id="IDX" value="${row.IDX }">
<a href="#this" name="file">${row.ORIGINAL_FILE_NAME }</a>
(${row.FILE_SIZE }kb)
</c:forEach>
</c:when>
<c:otherwise>첨부된 파일이 없습니다.!</c:otherwise>
</c:choose>
</td>
</tr>
</tbody>
</table>
<a href="#this" class="btn" id="list">목록으로</a>
<a href="#this" class="btn" id="update">수정하기</a>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
$(document).ready(function(){
$("#list").on("click", function(e){ //목록으로 버튼
e.preventDefault();
fn_openBoardList();
});
$("#update").on("click", function(e){ //수정하기 버튼
e.preventDefault();
fn_openBoardUpdate();
});
$("a[name='file']").on("click", function(e){ //파일이름
e.preventDefault();
fn_downloadFile($(this));
});
});
function fn_openBoardList(){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do' />");
comSubmit.submit();
}
function fn_openBoardUpdate(){
var idx = "${map.IDX}";
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardUpdate.do' />");
comSubmit.addParam("IDX", idx);
comSubmit.submit();
}
function fn_downloadFile(obj)
{
var idx = obj.parent().find("#IDX").val();
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/common/downloadFile.do'/>");
comSubmit.addParam("IDX", idx);
comSubmit.submit();
}
</script>
</body>
</html>
@@ -0,0 +1,98 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file ="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
<h2>게시판 목록</h2>
<table class="board_list">
<colgroup>
<col width="10%"/>
<col width="*"/>
<col width="15%"/>
<col width="20%"/>
</colgroup>
<thead>
<tr>
<th scope="col">글번호</th>
<th scope="col">제목</th>
<th scope="col">조회수</th>
<th scope="col">작성일</th>
</tr>
</thead>
<tbody>
<c:choose>
<c:when test="${fn:length(list) > 0}"> <!-- boolean -->
<c:forEach items="${list }" var="row" varStatus="status">
<tr>
<td>${row.IDX }</td>
<td class="title">
<a href="#this" name="title">${row.TITLE }</a>
<input type="hidden" id="IDX" value="${row.IDX }">
</td>
<td>${row.HIT_CNT }</td>
<td>${row.CREA_DTM }</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="4">조회된 결과가 없습니다.</td>
</tr>
</c:otherwise>
</c:choose>
</tbody>
</table>
<c:if test="${not empty paginationInfo }">
<ui:pagination paginationInfo = "${paginationInfo }" type="text" jsFunction="fn_search"/>
</c:if>
<input type="hidden" id="currentPageNo" name="currentPageNo"/>
<br/>
<a href="#this" class="btn" id="write">글쓰기</a>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
$(document).ready(function(){
$("#write").on("click", function(e){ //글쓰기 버튼
e.preventDefault();
fn_openBoardWrite();
});
$("a[name='title']").on("click", function(e){ //제목
e.preventDefault();
fn_openBoardDetail($(this)); //$(this)의미 : jQuery <a 태그의미
});
});
function fn_openBoardWrite(){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardWrite.do' />");
comSubmit.submit();
}
function fn_openBoardDetail(obj){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardDetail.do' />");
comSubmit.addParam("IDX", obj.parent().find("#IDX").val()); // key와 value값
comSubmit.submit();
}
function fn_search(pageNo)
{
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do'/>");
comSubmit.addParam("currentPageNo", pageNo);
comSubmit.submit();
}
</script>
</body>
</html>
@@ -0,0 +1,13 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
<%@ include file="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
HI~
<%@ include file="/WEB-INF/include/include-body.jspf" %>
</body>
</html>
@@ -0,0 +1,164 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file="/WEB-INF/include/include-header.jspf" %>
</head>
<body>
<form id="frm" name="frm" enctype="multipart/form-data">
<table class="board_view">
<colgroup>
<col width="15%"/>
<col width="35%"/>
<col width="15%"/>
<col width="35%"/>
</colgroup>
<caption>게시글 상세</caption>
<tbody>
<tr>
<th scope="row">글 번호</th>
<td>
${map.IDX }
<input type="hidden" id="IDX" name="IDX" value="${map.IDX }">
</td>
<th scope="row">조회수</th>
<td>${map.HIT_CNT }</td>
</tr>
<tr>
<th scope="row">작성자</th>
<td>${map.CREA_ID }</td>
<th scope="row">작성시간</th>
<td>${map.CREA_DTM }</td>
</tr>
<tr>
<th scope="row">제목</th>
<td colspan="3">
<input type="text" id="TITLE" name="TITLE" class="wdp_90" value="${map.TITLE }">
</td>
</tr>
<tr>
<td colspan="4" class="view_text">
<textarea rows="20" cols="100" title="내용" id="CONTENTS" name="CONTENTS">${map.CONTENTS }</textarea>
</td>
</tr>
<tr>
<th scope="row">첨부파일</th>
<td colspan="3">
<div id="fileDiv">
<c:choose>
<c:when test="${fn:length(list)>0 }">
<c:forEach var="row" items="${list }" varStatus="var">
<p>
<input type="hidden" id="IDX" name="IDX_${var.index }" value="${row.IDX }">
<a href="#this" id="name_${var.index }" name="name_${var.index }">${row.ORIGINAL_FILE_NAME }</a>
<input type="file" id="file_${var.index }" name="file_${var.index }">
(${row.FILE_SIZE }kb)
<a href="#this" class="btn" id="delete_${var.index }" name="delete_${var.index }">삭제</a>
</p>
</c:forEach>
</c:when>
<c:otherwise>첨부된 파일이 없습니다!</c:otherwise>
</c:choose>
</div>
</td>
</tr>
</tbody>
</table>
</form>
<a href="#this" class="btn" id="addFile">파일추가</a>
<a href="#this" class="btn" id="list">목록으로</a>
<a href="#this" class="btn" id="update">저장하기</a>
<a href="#this" class="btn" id="delete">삭제하기</a>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
var gfv_count = "${fn:length(list)+1}";
$(document).ready(function(){
$("#list").on("click",function(e){
e.preventDefault();
fn_openBoardList();
});
$("#update").on("click",function(e){
e.preventDefault();
fn_updateBoard();
});
$("#delete").on("click",function(e){
e.preventDefault();
fn_deleteBoard();
});
$("#addFile").on("click", function(e){ //파일 추가
e.preventDefault();
fn_addFile();
});
$("a[name^='delete']").on("click", function(e){
e.preventDefault();
fn_deleteFile($(this));
});
});
function fn_openBoardList()
{
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do'/>");
comSubmit.submit();
}
function fn_updateBoard()
{
var comSubmit = new ComSubmit("frm");
comSubmit.setUrl("<c:url value='/sample/updateBoard.do'/>");
comSubmit.submit();
}
function fn_deleteBoard()
{
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/deleteBoard.do'/>");
comSubmit.addParam("IDX",$("#IDX").val());
comSubmit.submit();
}
function fn_addFile()
{
var str = "<p><input type='file' id='file_"+(gfv_count)+"' name='file_"+(gfv_count)+"'>"+
"<a href='#this' class='btn' id='delete_"+(gfv_count)+"' name='delete_"+(gfv_count)+"'>삭제</a></p>";
$("#fileDiv").append(str);
$("#delete_"+(gfv_count++)).on("click", function(e){
e.preventDefault();
fn_deleteFile($(this));
});
}
//boardWrite.jsp 와 비교
/* function fn_addFile(){
var str = "<p><input type='file' name='file_"+(gfv_count++)+"'><a href='#this' class='btn' name='delete'>삭제</a></p>";
$("#fileDiv").append(str);
$("a[name='delete']").on("click", function(e){ //삭제 버튼
e.preventDefault();
fn_deleteFile($(this));
});
} */
function fn_deleteFile(obj)
{
obj.parent().remove();
}
</script>
</body>
</html>
@@ -0,0 +1,97 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ko">
<head>
<%@ include file="/WEB-INF/include/include-header.jspf" %>
<title>Insert title here</title>
</head>
<body>
<form id="frm" name="frm" enctype="multipart/form-data">
<table class="board_view">
<colgroup>
<col width="15%">
<col width="*"/>
</colgroup>
<caption>게시글 작성</caption>
<tbody>
<tr>
<th scope="row">제목</th>
<td><input type="text" id="TITLE" name="TITLE" class="wdp_90"></input></td>
</tr>
<tr>
<td colspan="2" class="view_text">
<textarea rows="20" cols="80" title="내용" id="CONTENTS" name="CONTENTS"></textarea>
</td>
</tr>
</tbody>
</table>
<!-- <input type="file" name="file"><br/><br/> -->
<div id="fileDiv">
<p>
<input type="file" id="file" name="file_0">
<a href="#this" class="btn" id="delete" name="delete">삭제</a>
</p>
</div>
<br/><br/>
<a href="#this" class="btn" id="addFile">파일추가</a>
<a href="#this" class="btn" id="write">작성하기</a>
<a href="#this" class="btn" id="list">목록으로</a>
</form>
<%@ include file="/WEB-INF/include/include-body.jspf" %>
<script type="text/javascript">
var gfv_count = 1;
$(document).ready(function(){
$("#list").on("click", function(e){ //목록으로 버튼
e.preventDefault();
fn_openBoardList();
});
$("#write").on("click", function(e){ //작성하기 버튼
e.preventDefault();
fn_insertBoard();
});
$("#addFile").on("click", function(e){ //파일추가하기
e.preventDefault();
fn_addFile();
});
$("a[name='delete']").on("click", function(e){ //추가한 파일 삭제하기
e.prevnetDefault();
fn_deleteFile($(this));
});
});
function fn_openBoardList(){
var comSubmit = new ComSubmit();
comSubmit.setUrl("<c:url value='/sample/openBoardList.do' />");
comSubmit.submit();
}
function fn_insertBoard(){
var comSubmit = new ComSubmit("frm");
comSubmit.setUrl("<c:url value='/sample/insertBoard.do' />");
comSubmit.submit();
}
function fn_addFile(){
var str = "<p><input type='file' name='file_"+(gfv_count++)+"'><a href='#this' class='btn' name='delete'>삭제</a></p>";
$("#fileDiv").append(str);
$("a[name='delete']").on("click", function(e){ //삭제 버튼
e.preventDefault();
fn_deleteFile($(this));
});
}
function fn_deleteFile(obj)
{
obj.parent().remove(); //<p>태그 삭제
}
</script>
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
kkkk
</body>
</html>
+15
View File
@@ -0,0 +1,15 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>
Hello world!
</h1>
<P> The time on the server is ${serverTime}. </P>
</body>
</html>
+23
View File
@@ -0,0 +1,23 @@
@CHARSET "UTF-8";
a:link, a:visited {text-decoration: none; color: #656565;}
.board_list {width:100%;border-top:2px solid #252525;border-bottom:1px solid #ccc}
.board_list thead th:first-child{background-image:none}
.board_list thead th {border-bottom:1px solid #ccc;padding:12px 0 13px 0;color:#3b3a3a;vertical-align:middle}
.board_list tbody td {border-top:1px solid #ccc;padding:10px 0;text-align:center;vertical-align:middle}
.board_list tbody tr:first-child td {border:none}
.board_list tbody td.title {text-align:left; padding-left:20px}
.board_list tbody td a {display:inline-block}
.board_view {width:30%;border-top:2px solid #252525;border-bottom:1px solid #ccc}
.board_view tbody th {text-align:left;background:#f7f7f7;color:#3b3a3a}
.board_view tbody th.list_tit {font-size:13px;color:#000;letter-spacing:0.1px}
.board_view tbody .no_line_b th, .board_view tbody .no_line_b td {border-bottom:none}
.board_view tbody th, .board_view tbody td {padding:15px 0 16px 16px;border-bottom:1px solid #ccc}
.board_view tbody td.view_text {border-top:1px solid #ccc; border-bottom:1px solid #ccc;padding:45px 18px 45px 18px}
.board_view tbody th.th_file {padding:0 0 0 15px; vertical-align:middle}
.wdp_90 {width:60%}
.btn {border-radius:3px;padding:5px 11px;color:#fff !important; display:inline-block; background-color:#6b9ab8; border:1px solid #56819d;vertical-align:middle}
.pad_5 {padding: 5px}
+12
View File
@@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<jsp:forward page="/sample/openSampleList.do"/>
</body>
</html>
+179
View File
@@ -0,0 +1,179 @@
function gfn_isNull(str) {
if (str == null) return true;
if (str == "NaN") return true;
if (new String(str).valueOf() == "undefined") return true;
var chkStr = new String(str);
if( chkStr.valueOf() == "undefined" ) return true;
if (chkStr == null) return true;
if (chkStr.toString().length == 0 ) return true;
return false;
}
/**
* 공통 서브밋 객체 (Target/Popup 대응 버전)
*/
function ComSubmit(opt_formId) {
this.formId = (typeof opt_formId === "undefined" || opt_formId === null || opt_formId === "") ? "commonForm" : opt_formId;
this.url = "";
this.target = "_self"; // 기본값은 현재 창
var $targetForm = $("#" + this.formId);
// [1] 초기화: commonForm일 경우 내부를 비우고 target도 기본값으로 리셋
if ($targetForm.length > 0 && this.formId === "commonForm") {
$targetForm.empty();
$targetForm.attr("target", "_self"); // 이전 타겟 설정 제거
}
this.setUrl = function setUrl(url) {
this.url = url;
};
/**
* [2] 타겟 설정 (팝업창 이름이나 _blank 등)
*/
this.setTarget = function setTarget(target) {
this.target = target;
};
this.addParam = function addParam(key, value) {
if ($targetForm.length === 0) return;
var $existingParam = $targetForm.find("input[name='" + key + "']");
if ($existingParam.length > 0) {
$existingParam.val(value);
} else {
var inputHtml = $("<input>", { type: "hidden", name: key, id: key, value: value });
$targetForm.append(inputHtml);
}
};
/**
* [3] 서버 전송
*/
this.submit = function submit() {
if ($targetForm.length === 0) return;
var frm = $targetForm[0];
if (!this.url) {
alert("전송할 URL이 설정되지 않았습니다.");
return;
}
frm.action = this.url;
frm.method = "post";
frm.target = this.target; // 설정된 타겟 적용
frm.submit();
};
}
var gfv_ajaxCallback = "";
function ComAjax(opt_formId)
{
this.url = "";
this.formId = gfn_isNull(opt_formId) == true?"commonForm":opt_formId;
this.param = "";
if(this.formId == "commonForm")
{
var frm = $("#commonForm");
if(frm.length>0){
frm.remove();
}
var str = "<form id='commonForm' name='commonForm'></form>";
$('body').append(str);
}
this.setUrl = function setUrl(url)
{
this.url = url;
};
this.setCallback = function setCallback(callBack)
{
fv_ajaxCallback = callBack;
};
this.addParam = function addParam(key, value)
{
this.param = this.param + "&" + key + "=" + value;
};
this.ajax = function ajax()
{
if(this.formId != "commonForm"){
this.param += "&" + $("#" + this.formId).serialize();
}
$.ajax({
url : this.url,
type : "post",
data : this.param,
async : false,
success : function(data, status){
if(typeof(fv_ajaxCallback) == "function"){
fv_ajaxCallback(data);
}else{
eval(fv_ajaxCallback + "(data);");
}
}
});
};
}
//페이징 태그부분
/*
* divId : 페이징 태그가 그려질 div
* pageIndx : 현재 페이지 위치가 저장될 input 태그 id
* recordCount : 페이지당 레코드 수
* totalCount : 전체 조회 건수
* eventName : 페이징 하단의 숫자 등의 버튼이 클릭되었을때 호출될 함수 이름
*/
var gfv_pageIndex = null;
var gfv_eventName = null;
function gfn_renderPaging(params)
{
var divId = params.divId; //페이징이 그려질 div id
gfv_pageIndex = params.pageIndex; //현재 위치가 저장될 input 태그
var totalCount = params.totalCount; //전체 조회 건수
var currentIndex = $("#"+params.pageIndex).val(); //현재 위치
if($("#"+params.pageIndex).length == 0 || gfn_isNull(currentIndex) == true){
currentIndex = 1;
}
var recordCount = params.recordCount; //페이지당 레코드 수
if(gfn_isNull(recordCount) == true){
recordCount = 20;
}
var totalIndexCount = Math.ceil(totalCount/recordCount); //전체 인덱스 수
gfn_eventName = params.eventName;
/*
* Math.floor : 소수점 버림
* Math.ceil : 소수점 올림
* Math.round : 반올림
* Math.random : 랜덤함수
* Math.sqrt : 제곱근
* Math.pow : 제곱
* Math.abs : 절대값
*/
$("#"+divId).empty();
var preStr = "";
var postStr = "";
var str = "";
var first = (parseInt((currentIndex-1)/10)*10) + 1;
var last = (parseInt(totalCount/10)==parseInt(currentIndex/10))?totalIndexCount%10:10;
var prev = (parseInt((currentIndex-1)/10)*10) - 9 > 0 ? (parseInt((currentIndex-1)/10)*10) - 9 : 1;
var next = (parseInt((currentIndex-1)/10)+1) * 10 + 1 < totalIndexCount ? (parseInt((currentIndex-1)/10)+1) * 10 + 1 : totalIndexCount;
if(totalIndexCount>10){
preStr += "<a href='#this' class='pad_5' onclick='_movePage(1)'>[<<]</a>"
}
}