<%

'//파라미터정보 *************************************************************************************
b_num		= InputValue(request("b_num"))
b_type		= InputValue(request("b_type"))
'//**************************************************************************************************


'//조회수 추가
sql = "update " & a_tablename & " set b_count = b_count + 1 Where b_num = " & b_num
dbcon.execute sql



'//레코드필드
R_Fields = "b_num, b_type, b_id, b_name, b_pwd, b_subject, b_email, b_jumin, b_phone1, b_phone2, b_phone3, b_cate, b_catename, b_noticechk, b_content, b_ip, b_count, b_look, b_open, b_ref, b_step, b_level, b_regdate, b_chuchun, b_sbjclr, b_sdate, b_edate, b_temp1, b_temp2, b_temp3, b_temp4,  b_temp5,  b_temp6,  b_temp7, b_temp8, b_file1, b_file2, b_file3, b_file4, b_file5,b_keyword,b_c_count"

R_tablename_str		= a_tablename
R_WHERE_str			= " WHERE b_num=" & b_num

Call SelectQuery (R_Fields, R_tablename_str, R_WHERE_str)

If is_ad_cms <> "Y" then	'//관리자가아닐때 체크

	'//공개/비공개 체크*************************************************************************************
	if a_type = "Y" Or a_type = "T" then	'//공개여부 사용일때

		If b_open = "N" Or a_type = "T" then	'//비공개일때

			If SESSION("pwd_chk_" & a_num & "_" & b_num) <> "ok" Then
				Call locationhref( "pwd.asp?prepage=vie&a_num=" & a_num & "&b_num=" & b_num & "&" & page_info)
			End if

		End if

	End if
	'//**************************************************************************************************

End if


'If a_edit = "N" then		'//에디터 사용하지 않을때...
'
'	b_content	= getTextmode(b_content)
'	b_temp8		= getTextmode(b_temp8)
'
'End If

If a_edit = "N" then		'//에디터 사용하지 않을때...
	'2011-02-11 이전 게시물 태그제거
	
	If Left(b_regdate,10) < "2011-02-11" Then
		b_content = Replace( b_content, "&nbsp;" , " " ) 
		b_content = Replace( b_content, "</P>" , "vbcrlf" )
		b_content = Replace( b_content, vbcrlf , "vbcrlf" )
		b_content = remove_tags( b_content )
		b_content = Replace( b_content, "vbcrlf" , vbcrlf )
	End if
	b_content	= getTextmode(b_content)
End If

b_temp8		= getTextmode(b_temp8)



' 게시글 이동시 내용에 게시판으로 링크를 걸어야 하는게 있는데.. 에디터 사용여부에 따라서 태그가 먹질 않아서.. (/content/board/move_ok.asp 참고)
b_content = Replace(b_content, "[[board_link_s]]", "<a href=""/content/board/list.asp?a_num=")
b_content = Replace(b_content, "[[board_link_m]]", """>")
b_content = Replace(b_content, "[[board_link_e]]", "</a>")
b_content = Replace(b_content, "[[br_tag]]", "<br/>")



'//이전글  ------------------------------------------------------------------------------------------------
sql_p_opt1 = " WHERE b_look = 'Y' AND b_num <> " & b_num & " AND b_ref <= " & b_ref & " AND b_step >=" & b_step
sql_p_orderby = " ORDER BY b_ref DESC, b_step ASC"


'//답변글 사용하지 않을때..적용
If a_reply = "N" then sql_p_opt2 = " AND b_type='N'"

sql_p = "SELECT top 1 b_num, b_subject FROM " & a_tablename
sql_p = sql_p & sql_p_opt1 & sql_p_opt2 & sql_p_orderby
Set rs_prev = dbcon.execute( sql_p )

If rs_prev.bof Or rs_prev.eof then
	prev_b_num = ""
else
	prev_b_num		= rs_prev("b_num")
	prev_b_subject	= rs_prev("b_subject")
End If
Set rs_prev = nothing

'//이전글끝  ------------------------------------------------------------------------------------------------



'//다음글  ------------------------------------------------------------------------------------------------
sql_p_opt1 = " WHERE b_look = 'Y' AND b_num <> " & b_num & " AND b_ref >= " & b_ref & " AND b_step <=" & b_step
sql_p_orderby = " ORDER BY b_ref ASC, b_step DESC"


'//답변글 사용하지 않을때..적용
If a_reply = "N" then sql_p_opt2 = " AND b_type='N'"

sql_p = "SELECT top 1 b_num, b_subject FROM " & a_tablename
sql_p = sql_p & sql_p_opt1 & sql_p_opt2 & sql_p_orderby
Set rs_next = dbcon.execute( sql_p )

If rs_next.bof Or rs_next.eof then
	next_b_num = ""
else
	next_b_num		= rs_next("b_num")
	next_b_subject	= rs_next("b_subject")
End If

Set rs_next = nothing

'//다음글끝  ------------------------------------------------------------------------------------------------




%>
<!--#include virtual="/content/board/top.asp"-->
<!-- 보기 -->
<div id="board" style="width:<%=a_width%>;">
	
	<!-- 보기 테이블 -->
	<div class="table_bview">

			<table cellspacing="0">
			<caption><%=replace( tit_name," | ", "")%></caption>
				<colgroup>
				<col width="130" />
				<col width="" />
				</colgroup>
			<thead>
				<tr>
					<th scope="col"></th>
					<th scope="col" class="th_end"><%If a_cate = "Y" Then response.write "<span class='category_color'>" & b_cate_str( b_cate ) & "</span>"%> <%=b_subject%></th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<th scope="row">작성자</th>
					<td><%=b_name%></td>
				</tr>
				<tr>
					<th scope="row">작성일</th>
					<td><%=b_regdate%></td>
				</tr>
				<% If is_ad_cms = "Y" And a_email = "Y"  then%>
				<tr>
					<th scope="row">이메일</th>
					<td><%=b_email%></td>
				</tr>
				<% End If %>
				<% If is_ad_cms = "Y" And a_phone = "Y"  then%>
				<tr>
					<th scope="row">전화번호</th>
					<td><%=b_phone1&"-"&b_phone2&"-"&b_phone3%></td>
				</tr>
				<% End If %>

				<!-- <tr>
					<th scope="row">조회</th>
					<td><?=$b_count?></td>
				</tr> -->

				<%
				'//사용자필드
				for z=1 To 4
					a_ftemp		= eval("a_ftemp" & z )
					a_ftemp_str	= eval("a_ftemp" & z & "_str")
					b_temp		= eval("b_temp" & z )

					If a_ftemp = "Y" then
				%>
				<tr>
					<td></td>
					<td>
						<dl class="info">
							<dt><%=a_ftemp_str%></dt>
							<dd><%=b_temp%></dd>
						</dl>
					</td>
					<td></td>
				</tr>

				<%
					End if
				next
				%>
				<%If a_upload = "Y" and (b_file1 <> "" or b_file2 <> "" or b_file3 <> "" or b_file4 <> "" or b_file5 <> "" ) then	'//첨부파일 사용일때{%>
				<tr>
					<td></td>
					<td>
						<dl class="info">
							<dt>첨부파일</dt>
							<dd>
								<%
									For z=1 To 5
										b_file_name = eval("b_file" & z)
										b_file_name_tmp = b_file_name

										If b_file_name <> "" Then	'//파일이 있으면..

											strDir		= server.mappath("/data/board/") & "\" & a_tablename & "\"
											'response.write b_file_name
								%>

									<img src="/content/board/nninc_simple/img/file/<%=get_FileName1(b_file_name_tmp)%>" alt="<%=b_file_name%>" /><a href="down.asp?a_tablename=<%=a_tablename%>&amp;filename=<%=b_file_name%>" ><%=b_file_name%></a> <span class="size">(<%=Folderfilesize(strDir& b_file_name)%> byte)</span>
									&nbsp;

								<%
										End if
									next
								%>
							</dd>
						</dl>
					</td>
					<td></td>
				</tr>
				<%End if%>
				<tr>
					<th scope="row">내용</th>
					<td style="padding:10px;"><%=b_content%></td>
				</tr>


				<%If b_temp8 <> "" then%>
				<tr>
					<td colspan="2" class="answer"><strong>답변</strong></td>
				</tr>
				<tr>
					<th scope="row">답변자(부서)</th>
					<td><%=b_temp5%></td>
				</tr>
				<tr>
					<th scope="row">처리기간</th>
					<td><%=b_temp6%></td>
				</tr>
				<tr>
					<th scope="row">처리현황</th>
					<td><strong><%=b_temp7%></strong></td>
				</tr>
				<tr>
					<th scope="row">내용</th>
					<td style="padding:10px;"><%=b_temp8%></td>
				</tr>

				<%End if%>
			</tbody>
			</table>

	</div>
	<!-- //보기 테이블 -->

	<!-- 버튼 -->


	<div class="board_button">
		
		<div class="fr pt10">
			<%If is_reply = "Y" then	'//답변%>
			<span><a href="reply.asp?a_num=<%=a_num%>&amp;b_num=<%=b_num%>&amp;<%=page_info%>" ><img src="/content/board/nninc_qna/img/reply_bt.gif" width="62" height="23" alt="답변" /></a></span>
			<%End if%>
			<%If is_write = "Y" then	'//쓰기/수정권한%>
			<span><a href="write.asp?a_num=<%=a_num%>" ><img src="/content/board/default_calendar/img/write_bt.gif" width="62" height="23" alt="쓰기" /></a></span>

			<span><a href="write.asp?a_num=<%=a_num%>&amp;b_num=<%=b_num%>&amp;<%=page_info%>" ><img src="/content/board/default_calendar/img/modify_bt.gif" width="62" height="23" alt="수정" /></a></span>
			<%End if%>
			
			<%If is_delete = "Y" then
				msg = "정말 삭제하시겠습니까?"
				querystring = "msg=" & server.urlencode( msg )
				querystring = querystring & "&ok=" & server.urlencode("/content/board/delete_ok.asp?a_num=" & a_num & "&b_num=" & b_num & "&" & page_info)
				querystring = querystring & "&no=" & server.urlencode(nowpage)
				go_url = "/content/board/message.asp?a_num=" & a_num & "&amp;" & querystring
			%>
			<span><a href="<%=go_url%>" ><img src="/content/board/default_calendar/img/delete_bt.gif" width="62" height="23" alt="삭제" /></a></span>
			<%End if%>

			<span><a href="list.asp?a_num=<%=a_num%>&amp;<%=page_info%>" ><img src="/content/board/default_calendar/img/list_bt.gif" width="62" height="23" alt="목록" /></a></span>
		</div>
	</div>
	<!-- //버튼 -->




	<!-- 댓글 -->
	<%If a_command = "Y" Then%>
	<!--#include virtual="/content/board/command.asp"-->
	<%End if%>
	<!-- //댓글 -->



	
</div>
<!-- //보기 -->
<!--#include virtual="/content/board/bottom.asp"-->
