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

<!-- 권한 체크 -->
<!-- #include file="config.asp" -->

<%

Dim v_pagesize, v_block, length, v_totalpage, v_page
Dim is_tablename, R_Fields, pk_Field, opt_where_str, orderby_str
Dim p_keyword, p_search
Dim search_str, str_option
Dim SQL_T, strSQL, rs, i
Dim recordcount
Dim vData, vCnt
Dim po_idx, po_subject, po_group, po_addid, po_sdate, po_edate, po_chk, po_code, po_pk, po_wdate, po_mdate
Dim po_chk_str

' 페이징정보
v_pagesize	= 20	' 리스트 화면에 보여줄 갯수
v_block		= 10	' 페이징 갯수
length		= 30	' 내용 길이


' 테이블 기본 환경설정
is_tablename = "poll"		' 테이블명
R_Fields = "po_idx, po_subject, po_group, po_addid, po_sdate, po_edate, po_chk, po_code, po_pk, po_wdate, po_mdate" ' 레코드필드
pk_Field = "po_idx"
opt_where_str = ""			' 기본조건이 있을때 사용..없으면 '' 처리
orderby_str = " ORDER BY po_wdate desc " ' 정렬


p_keyword = inputvalue(request("p_keyword"))
p_search = inputvalue(request("p_search"))

' 옵션 부분
if trim(p_keyword) <> "" and p_search <> "" then ' 검색어가 있다면
	search_str = " AND "& v_search &" like '%"& replace(v_keyword,"'","''")&"%'"
End if

sql_option = search_str



' 전체 레코드 수 뽑기
SQL_T = "select count("&pk_Field&") as "&pk_Field&" from "&is_tablename&" where "&pk_Field&" <> 0 "
SQL_T = SQL_T & sql_option	' 검색옵션
Set rs = Dbcon.execute(SQL_T)
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 &" "& R_Fields &" FROM "& is_tablename &" WHERE	"& pk_Field &" NOT IN "
strSQL = strSQL & " ( SELECT  TOP "& v_pagesize*(v_page-1) &" "& pk_Field &" FROM "& is_tablename &" WHERE "&pk_Field&" <> 0 " & sql_option & orderby_str &" ) "
strSQL = strSQL & sql_option &" "& orderby_str 
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="po_subject" <%if v_search = "po_subject" 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="po_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="150" />
						<col width="70" />
						<col width="50" />
						<col width="50" />
						<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>
							<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(R_Fields, "vData", i)

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

						<tr>
							<td scope="row" class="center"><input type="checkbox" name="chk" value="<%=po_idx%>" title="해당 설문조사 선택" tabindex="<%=getTabIndex()%>" /></td>
							<!-- <td scope="row" class="center">
								<a href="move.asp?move=up&amp;po_idx=<%=po_idx%>&amp;po_code=<%=po_code%>" title="순서 위로 이동" tabindex="<%=getTabIndex()%>"><img src="/manager/img/ic_up.gif" width="10" height="9" alt="순서 위로 이동" /></a><a href="move.asp?move=down&amp;po_idx=<%=po_idx%>&amp;po_code=<%=po_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="#poll" onclick="window.open('/content/poll/list.asp');"><strong><%=po_subject%></strong></a></td>
							<td scope="row" class="center"><span class="orange"><%=po_sdate%> ~ <%=po_edate%></span></td>
							<td scope="row" class="center"><%=po_chk_str%></td>
							<td scope="row" class="center"><input type="button" value="수정" class="ct_bt01" onclick="dialog_open('설문조사 수정', 'write_ui.asp?po_idx=<%=po_idx%>', '');" tabindex="<%=getTabIndex()%>" /></td>
							<td scope="row" class="center"><input type="button" value="삭제" class="ct_bt01" onclick="d_chk('delete_ok.asp?po_idx=<%=po_idx%>&amp;<%=page_info%>');" tabindex="<%=getTabIndex()%>" /></td>
							<td scope="row" class="center"><input type="button" value="설정" class="ct_bt02" onclick="dialogFrame_open('설문조사 문항설정', '../04poll_question/write_ui.asp?po_pk=<%=po_pk%>', '');" 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>
							<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"-->
