<%

po_pk	= InputValue(request("po_pk"))

' 레코드필드
R_Fields		= "po_idx, po_subject, po_group, po_addid, po_sdate, po_edate, po_chk, po_code, po_pk, po_wdate, po_mdate, po_count"
R_tablename_str	= "poll "
R_WHERE_str		= " WHERE po_pk="&po_pk

Call SelectQuery (R_Fields, R_tablename_str, R_WHERE_str)

If po_sdate = "" then

	po_sdate_y = Year(now)
	po_sdate_m = Month(now)
	po_sdate_d = Day(now)

Else

	po_sdate_arr	= split(po_sdate, "-")

	po_sdate_y = po_sdate_arr(0)
	po_sdate_m = po_sdate_arr(1)
	po_sdate_d = po_sdate_arr(2)

End if


If po_edate = "" Then
	
	nm = DateAdd("m", 1, now)

	po_edate_y = Year(nm)
	po_edate_m = Month(nm)
	po_edate_d = Day(nm)

else

	po_edate_arr	= split(po_edate, "-")

	po_edate_y = po_edate_arr(0)
	po_edate_m = po_edate_arr(1)
	po_edate_d = po_edate_arr(2)

End If

If Len(po_sdate_m)=1 Then po_sdate_m = "0" & po_sdate_m
If Len(po_sdate_d)=1 Then po_sdate_d = "0" & po_sdate_d
If Len(po_edate_m)=1 Then po_edate_m = "0" & po_edate_m
If Len(po_edate_d)=1 Then po_edate_d = "0" & po_edate_d



' 등급별 권한설정 -----------------------------------------------
if session("ss_g_num") = "" then
	g_num = 2 ' 비회원2 , 총관리자 1
else
	g_num = session("ss_g_num")
End if

g_num_str = "["&g_num&"]"

If InStr(po_group, g_num_str)=0 Then 
	Call Back_back("참가권한이 없습니다.")
	response.end
End if
'  -----------------------------------------------








' 테이블 기본 환경설정 ********************************************************************************
table			= "poll_question"	' 테이블명
idx_field		= "poq_idx"			' 기본키
oreder_filed	= "poq_code ASC"	' 정렬기준 필드
Query_Fields	= "poq_idx ,po_pk ,poq_code, poq_topmemo, poq_question, poq_type, poq_multi, poq_chk, poq_bogi1, poq_bogi2, poq_bogi3, poq_bogi4, poq_bogi5, poq_wdate, poq_mdate"	' 불러올 필드
' ****************************************************************************************************

' ---------------조합 쿼리문------------------------------------
If v_keyword <> "" then
	search_str = " AND "&v_search&" like '%"&v_keyword&"%'"
End If

Query_OrderBy = " ORDER BY "&oreder_filed
' ---------------------------------------------------------------

' -----------------------------리스트 출력 쿼리문 생성-----------------------------
sql = "select "&Query_Fields&" from "&table&" WHERE po_pk = "&po_pk&" AND poq_chk = 'Y' "
sql = sql & search_str & search_str2 & Query_OrderBy
Set Rs = Dbcon.Execute (sql)
If Not rs.eof Then
	vData = rs.getrows()
	vCnt = UBound(vData,2)
Else
	vCnt = -1
End If
rs.close : Set rs = Nothing
' ---------------------------------------------------------------------------------


%>

<!--#include virtual="/content/poll/top.asp"-->

<script type="text/javascript"> 
	ViewCss('/content/poll/skin1/css/common.css');
</script>
<script type="text/javascript" src="/content/poll/skin1/js/common.js"></script>



<!-- 리스트 -->
<div id="poll">

	<form id= "frm_list" action="poll_ok.asp?<%=page_info%>"  method='post'>
	<div>
		<input type="hidden" name="po_pk" value="<%=po_pk%>" />
		<input type="hidden" name="por_mid" value="<%=session("m_id")%>" />
	</div>

	<!-- 설문주제 타이틀 -->
	<div id="poll_tit">
		<div class="title_bg">
			<div class="title_bg_02">
				<div class="title">
					<img src="/content/poll/skin1/img/poll_tit_ic.gif" width="62" height="19" alt="설문주제" />
					<%=po_subject%>
				</div>
				<div class="title_content">
					<ul>
					<li>
						<strong>기&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;간</strong>
						: <%=po_sdate_y%>년 <%=po_sdate_m%>월 <%=po_sdate_d%>일 ~  <%=po_edate_y%>년 <%=po_edate_m%>월 <%=po_edate_d%>일
					</li>
					<li>
						<strong>총문항수</strong>
						: <%=total%> 문항
					</li>
					<li>
						<strong>참여자수</strong>
						: <%=po_count%> 명
					</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<!-- //설문주제 타이틀 -->


	<!-- 리스트 테이블 -->

<%
If vCnt>-1 Then

	For i=0 To vCnt

		Call arr2Value(Query_Fields, "vData", i)


		If poq_chk ="Y" then
			poq_chk_str = "<strong>사용</strong>"
		else
			poq_chk_str = "중지"
		End If
%>


	<div class="table_bwrite">
		<fieldset>
		<legend>설문문항 리스트</legend>
			<table cellspacing="0">
			<caption>리스트</caption>
				<colgroup>
				<col width="38" />
				<col width="" />
				</colgroup>
			<thead>
				<tr>
					<th scope="col" class="count"><%=i+1%></th>
					<th scope="col" class="subject"><%=poq_question%></th>
				</tr>
			</thead>

			<%If poq_type = "1" then ' 객관식일때%>
			<tbody>
				<tr>
					<td></td>
					<td class="content">
						<%
						For z=1 To 5
							
							execute("poq_bogi = poq_bogi"&z)

							If poq_bogi <> "" then ' 잇을때
				
						%>
						<div><label for="q_<%=poq_idx%>_<%=z%>"><input type="radio" id="q_<%=poq_idx%>_<%=z%>" name="q_<%=poq_idx%>" value="<%=z%>" title="<%=poq_bogi%>" tabindex="<%=getTabIndex()%>" /><%=poq_bogi%></label></div>
						
						<%
							End if

						next
						%>
						
					</td>
				</tr>
			</tbody>
			<% Else ' 주관식일때.%>
			<tbody>
				<tr>
					<td></td>
					<td class="content">
						<div><textarea style="width:98%;" cols="90" rows="5" id="q_<%=poq_idx%>" name="q_<%=poq_idx%>" title="내용 입력" tabindex="<%=getTabIndex()%>"></textarea></div>
					</td>
				</tr>
			</tbody>
			<%End if%>
			</table>
		</fieldset>
	</div>

	<div>
	<input type="hidden" name="chk" value="<%=poq_idx%>" />
	</div>




<%
	next
End if
%>

	<!-- //리스트 테이블 -->
	
	


	<!-- 버튼 -->
	<div class="poll_button2">
		<span><input type="image" src="/content/poll/skin1/img/poll_bt.gif" title="설문참여" tabindex="<%=getTabIndex()%>" /></span>
		<span><a href="list.asp?<%=page_info%>" title="목록" tabindex="<%=getTabIndex()%>" ><img src="/content/poll/skin1/img/list_bt.gif" width="62" height="23" alt="목록" /></a></span>
	</div>
	<!-- //버튼 -->
	</form>
</div>
<!-- //리스트 -->

<!--#include file="../bottom.asp"-->

