<!--#include virtual="/manager/common/file/other_top.asp"-->
<!--#include file="config.asp"-->
<script type="text/javascript" src="/common/js/04ebook.js"></script>
<%


' 테이블 기본 환경설정 ********************************************************************************

table			= "ebook"			' 테이블명
idx_field		= "eb_idx"			' 기본키
oreder_filed	= "eb_code ASC"	' 정렬기준 필드
Query_Fields	= "eb_idx,  eb_subject, eb_code, eb_skin, eb_logoimg, eb_wdate, eb_mdate, eb_chk, eb_pk"				' 불러올 필드

v_pagesize		= 20				' '목록개수
v_block			= 10				' '페이지개수
' ****************************************************************************************************


' ---------------조합 쿼리문------------------------------------
v_search = inputvalue(request("v_search"))
v_keyword = inputvalue(request("v_keyword"))
Query_Where = ""	'기본 검색

If v_keyword <> "" then
	Query_Where = Query_Where & " and "&v_search&" like '%"&v_keyword&"%'"
End If
'' 조건 있을때 여기에 계속 추가

If Query_Where<>"" Then
	Query_Where2 = " WHERE " & Mid(Query_Where,5)
End If

Query_OrderBy = " ORDER BY "&oreder_filed

' ---------------------------------------------------------------



' ---------------------전체 레코드 수 뽑기----------------------------------------
sql = "select count("& idx_field &") as "& idx_field &" from "& table & Query_Where2
Set Rs = Dbcon.Execute (sql)
recordcount = rs(0)	'이 전체레코드갯수를 이용해서 페이지갯수를 뽑아 낼것이다.
rs.close : Set rs = nothing
' ---------------------------------------------------------------------------------


v_totalpage	= int((recordcount-1)/v_pagesize)+1		'전체덩어리갯수 
v_page		= request("p_page")
If v_page<>"" Then v_page = Int(v_page)

If v_page = "" then
	v_page = 1
ElseIf v_page < 1 then
	v_page = 1
ElseIf v_page > v_totalpage then
	v_page = v_totalpage
End If


' -----------------------------리스트 출력 쿼리문 생성-----------------------------
strSQL = " SELECT TOP "& v_pagesize &" "& Query_Fields &" FROM "& table &" WHERE "& idx_field &" NOT IN "
strSQL = strSQL & " ( SELECT  TOP "& v_pagesize*(v_page-1) &" "& idx_field &" FROM "& table & Query_Where2 & Query_OrderBy &" ) "
strSQL = strSQL & Query_Where &" "& Query_OrderBy 
Set rs = Dbcon.execute(strSQL)
If Not rs.eof Then
	vData = rs.getrows()
	vCnt = UBound(vData,2)
Else
	vCnt = -1
End If
rs.close : Set rs = Nothing
' ---------------------------------------------------------------------------------


%>
<!-- 등록/수정UI -->
<div id="dialog" style="text-align:center;vertical-align:middle;">
	<p id="dialogContent"></p>
</div>
		<!-- 내용영역 -->
		<div id="contents">

			<div id="contents_head"> 
				<div id="contents_title">
					<img src="/manager/img/tit_ic06.gif" width="22" height="21" class="<%=skin%> center" alt="" /> <h1><span>이북 리스트</span></h1>
				</div>
				<div id="location">
					<a href="/manager/" tabindex="<%=getTabIndex()%>">Home</a> &gt; <a href="/manager/content/04popup/list.asp" tabindex="<%=getTabIndex()%>">부가기능</a> &gt; <a href="list.asp" tabindex="<%=getTabIndex()%>">이북관리</a> &gt; <a href="list.asp" class="now" tabindex="<%=getTabIndex()%>">이북 리스트</a>
				</div>
			</div>

			<!-- 내용들어가는곳 -->
			<div id="contents_area">

				

					<h2 class="space"></h2>


					<div class="write_info">

						<div class="write_form pt7">
							<form id="frm_sch" action="list.asp"  method="post">

							<ul>
							<li class="search"><label for="p_search">이북검색</label> :</li>
							<li><select id="p_search" name="p_search" title="검색형태 선택" tabindex="<%=getTabIndex()%>">
								<option value="eb_subject" <%if v_search = "eb_subject" Then response.write "selected='selected'" End if %>>제목</option>
								<option value="content" <%if v_search = "content" Then response.write "selected='selected'" End If %>>내용</option>
							</select></li>
							<li><input type="text" size="64" title="검색어를 입력하세요" id="p_keyword" name="p_keyword" class="input_box input" onfocus="focus_on1_<%=skin%>(this);" onblur="focus_off1(this);" value="<%=v_keyword%>" tabindex="<%=getTabIndex()%>" /></li>
							<li><div id="<%=skin%>_bt"><span class="button"><input type="submit" value="검색" tabindex="<%=getTabIndex()%>" /></span></div></li>
							<li><div id="w01_bt"><span class="button"><input type="button" value="전체보기" onclick="page_go1('list.asp');" tabindex="<%=getTabIndex()%>" /></span></div></li>
							</ul>

							</form>
						</div>

					</div>

					<div class="list_count" style="height:20px">
						<div id="<%=skin%>_bt" class="list_left">
							<span class="button"><input type="button" value="신규이북생성" onclick="dialog_open('신규이북생성', 'write_ui.asp', '');" /></span>
						</div>
						전체 <strong><%=recordcount%></strong>개 (페이지 <strong class="orange"><%=v_page%></strong>/<%=v_totalpage%>)
					</div>

				<form id= "frm_list" action=""  method='post'>
					<div>
						<input type="hidden" name="status" />
						<input type="hidden" name="eb_chk" />

						<input type="hidden" id="chk_all" name="chk_all" />
						
					</div>


					<fieldset>
						<legend>이북관리 수정/삭제/보기</legend>
						<table cellspacing="0" class="bbs_<%=skin%>" summary="이북을 관리합니다.">
						<caption>이북관리 서식</caption>
						<colgroup>
						<col width="40" />
						<col width="50" />
						<col />
						<col width="70" />
						<col width="60" />
						<col width="60" />
						<col width="60" />
						</colgroup>

						<thead>
						<tr>
							<th scope="col">선택</th>
							<th scope="col">순서</th>
							<th scope="col">제목</th>
							<th scope="col">사용여부</th>
							<th scope="col">수정</th>
							<th scope="col">삭제</th>
							<th scope="col">페이지</th>
						</tr>
						</thead>

						<tbody>

<%
If vCnt >-1 Then

	If v_page = 1 then
		num = recordcount
	else
		num = recordcount - ((v_page - 1) * v_pagesize)
	End if	

	For i=0 To vCnt

		Call arr2Value(Query_Fields, "vData", i)

		If eb_chk = "Y" then
			eb_chk_str = "<strong>사용</strong>"
		ElseIf eb_chk = "N" then
			eb_chk_str = "중지"
		End if
%>

						<tr>
							<td scope="row" class="center"><input type="checkbox" name="chk" value="<%=eb_idx%>" title="해당 이북 선택" tabindex="<%=getTabIndex()%>" /></td>
							<td scope="row" class="center">
								<a href="move.asp?move=up&amp;eb_idx=<%=eb_idx%>&amp;eb_code=<%=eb_code%>" title="순서 위로 이동" tabindex="<%=getTabIndex()%>"><img src="/manager/img/ic_up.gif" width="10" height="9" alt="순서 위로 이동" /></a><a href="move.asp?move=down&amp;eb_idx=<%=eb_idx%>&amp;eb_code=<%=eb_code%>" title="순서 아래로 이동" tabindex="<%=getTabIndex()%>"><img src="/manager/img/ic_down.gif" width="10" height="9" alt="순서 아래로 이동" /></a>
							</td>
							<td scope="row" class="left"><a href="javascript:win_popup(<%=eb_pk%>,'no','no','no','no',1000,650);"><strong><%=eb_subject%></strong></a></td>
							<td scope="row" class="center"><%=eb_chk_str%></td>
							<td scope="row" class="center"><input type="button" value="수정" class="ct_bt01" onclick="dialog_open('이북수정', 'write_ui.asp?eb_idx=<%=eb_idx%>', '');" tabindex="<%=getTabIndex()%>" /></td>
							<td scope="row" class="center"><input type="button" value="삭제" class="ct_bt01" onclick="d_chk('delete_ok.asp?eb_idx=<%=eb_idx%>&amp;<%=page_info%>');" tabindex="<%=getTabIndex()%>" /></td>
							<td scope="row" class="center"><input type="button" value="설정" class="ct_bt02" onclick="dialogFrame_open('페이지 설정', '../04ebook_page/write_ui.asp?eb_pk=<%=eb_pk%>&amp;<%=page_info%>', '');" tabindex="<%=getTabIndex()%>"/></td>
						</tr>


<%
		num = num + 1
	next

Else
%>

						<tr>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
							<td scope="row" class="left"></td>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
						</tr>


<%
End If
%>


						</tbody>
						</table>
					</fieldset>

					<div class="contoll_box2">
						<ul>
						<li><img src="/manager/img/line01.gif" width="36" height="21" alt="" /></li>
						<li class="pt7"><div class="bt01"><a href="javascript:checkAll();" tabindex="<%=getTabIndex()%>"><span>전체 선택/해제</span></a></div><div class="bt01"><a href="javascript:delete2();" tabindex="<%=getTabIndex()%>"><span>선택 이북삭제</span></a></div></li>
						<li class="pt7 pl4"><span class="gray">|</span> &nbsp;선택한 이북을 
								<select id="tot_m_level" name="tot_level_chk" title="선택한 이북 사용여부 선택" tabindex="<%=getTabIndex()%>">
									<option value="Y" selected="selected">사용</option>
									<option value="N">중지</option>
								</select>으로
						</li>
						<li class="pt7 pl2"><div class="bt01"><a href="javascript:tot_levelchage('<%=page_info%>');" tabindex="<%=getTabIndex()%>"><span>변경</span></a></div></li>
						</ul>
					</div>

					<!-- 페이징 -->
					<div class="paginate">
						<%page("list.asp")%>
					</div>
					<!-- //페이징 -->

				</form>

			</div>
			<!-- 내용들어가는곳 -->

		</div>
		<!-- //내용영역 -->


<!--#include virtual="/manager/common/file/sub_bottom.asp"-->
