<!--#include virtual="/manager/common/file/top_ui.asp"-->
<!--#include file="config.asp"-->
<%


' 파라미터정보 
p_g_num	 = InputValue(request("g_num"))
cp_g_num = InputValue(request("cp_g_num")) ' 복사권한


If p_g_num = "0" then
	g_num_str = "비회원"
else
	g_num_str = get_level(p_g_num)
End if


If cp_g_num = "" then ' 복사권한이 없을땐.. 원래 권한이 복사권한으로..
	cp_g_num = p_g_num
End if



' 홈매니저 접속여부
R_Fields_gmr	= "g_manager"
R_tablename_str	= "member_group "
R_WHERE_str		= " WHERE g_num="&cp_g_num

Call SelectQuery (R_Fields_gmr, R_tablename_str, R_WHERE_str)

%>


		<!-- 내용영역 -->
		<div id="contents">

			<div id="contents_head"> 
				<div id="contents_title">
					<img src="/manager/img/tit_ic03.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/03member_group/write.asp" tabindex="<%=getTabIndex()%>">권한관리</a> &gt; <a href="awrite.asp" class="now" tabindex="<%=getTabIndex()%>">회원그룹/권한 설정</a>
				</div>
			</div>

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

				
				<form id="frm_cp" method="post" action="awrite.asp?g_num=<%=p_g_num%>" >
					<div class="contoll">
						<div class="contoll_left"><h2 class="<%=skin%>" style="text-align:left;">회원그룹 <strong class="orange">[<%=g_num_str%>]</strong> 게시판 권한</h2></div>
						<div class="contoll_right">
							<ul>
							<li class="pt5 pr5"><label for="cp_g_num"><strong>권한복사</strong></label> :</li>
							<li class="pt1">
								<select id="cp_g_num" name="cp_g_num" title="선택한 회원그룹 선택" tabindex="<%=getTabIndex()%>">
									<%

									R_Fields_mg = "g_num, g_code, g_menuname, g_chk"
									sql_mg = "Select "& R_Fields_mg&" from member_group where g_chk='Y' order by g_code "
									Set Rs = Dbcon.Execute (sql_mg)

									Do While Not rs.eof 
									%>

										<option value="<%=rs("g_num")%>" <%If cp_g_num = Trim(rs("g_num")) Then response.write "selected='selected'" End if %>><%=rs("g_menuname")%></option>

									<%
										rs.movenext
									Loop
									rs.close : Set rs = nothing
									%>
								</select>
							</li>
							<li class="pt5 pr2">권한으로</li>
							<li class="pl3"><div class="bt01"><a href="javascript:document.getElementById('frm_cp').submit();" tabindex="<%=getTabIndex()%>"><span>복사</span></a></div></li>
							</ul>
						</div>
					</div>
				</form>

				<form id="frm" method="post" action="awrite_ok.asp" >
					<fieldset>
						<legend>회원그룹 권한 설정</legend>
						<table cellspacing="0" class="bbs_<%=skin%>" summary="사이트에 사용하는 회원그룹 권한 설정을 관리합니다.">
						<caption>권한설정 서식</caption>
						<colgroup>
						<col width="40" />
						<col />
						<col width="50" />
						<col width="50" />
						<col width="50" />
						<col width="50" />
						<col width="50" />
						<col width="50" />
						</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>
						<%
							
							' 테이블 기본 환경설정 ********************************************************************************
							table		= "board_config" ' 테이블명
							' 레코드필드
							'Query_Fields = "a_num, a_bbsname, a_level, a_type, a_tablename, a_imgline, a_imgwidth, a_imgheight, a_member, a_ad_cms_id, a_ad_cms, a_cate, a_email, a_phone, a_home, a_jumin, a_jumin_opt, a_ftemp1, a_ftemp1_str, a_ftemp2, a_ftemp2_str, a_ftemp3, a_ftemp3_str, a_ftemp4, a_ftemp4_str, a_new, a_upload, a_upload_len, a_nofilesize, a_nofile, a_reply, a_replyOpt, a_command, a_date_list, a_sdate, a_edate, a_noword, a_width, a_displaysu, a_viewType, a_lt_a, a_lt_b, a_lt_c, a_lt_e, a_lt_f, a_header, a_hd_file, a_detail, a_dt_file, a_writecontent, a_topinclude, a_btminclude, a_skin, a_date"
							Query_Fields = "a_num, a_bbsname"
							' 정렬
							Query_OrderBy = " ORDER BY a_date DESC "
							' ****************************************************************************************************

							' -----------------------------리스트 출력 쿼리문 생성-----------------------------
							sql = "select "&Query_Fields&" from "&table & 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
							

							If vCnt>-1 Then

								bbs_cnt = 1

								For i=0 To vCnt
									a_num = vData(0,i)
									a_bbsname = vData(1,i)

									sql = "select * from board_access where g_num="&cp_g_num&" and a_num="&a_num
									Set Rs = Dbcon.Execute (sql)
									If Not rs.eof Then
										Bl_ad_cms	= rs("Bl_ad_cms")
										Bl_list		= rs("Bl_list")
										Bl_read		= rs("Bl_read")
										Bl_write	= rs("Bl_write")
										Bl_delete	= rs("Bl_delete")
										Bl_reply	= rs("Bl_reply")
									Else										
										Bl_ad_cms	= ""
										Bl_list		= ""
										Bl_read		= ""
										Bl_write	= ""
										Bl_delete	= ""
										Bl_reply	= ""
									End If
									rs.close : Set rs = nothing
%>
						<tr>
							<td scope="row" class="center"><%=bbs_cnt%></td>
							<td scope="row" class="left bold"><%=a_bbsname%><!--게시판PK--><input type="hidden" name="a_num<%=bbs_cnt%>" value="<%=a_num%>" /> </td>
							<td scope="row" class="center"><input type="checkbox" name="Bl_ad_cms<%=bbs_cnt%>" value="Y" title="관리 권한 선택" <%if Bl_ad_cms = "Y" Then response.write "checked" End If %> tabindex="<%=getTabIndex()%>"/></td>
							<td scope="row" class="center"><input type="checkbox" name="Bl_list<%=bbs_cnt%>" value="Y" title="목록 권한 선택" <%if Bl_list = "Y" Then response.write "checked" End If %> tabindex="<%=getTabIndex()%>"/></td>
							<td scope="row" class="center"><input type="checkbox" name="Bl_read<%=bbs_cnt%>" value="Y" title="읽기 권한 선택" <%if Bl_read = "Y" Then response.write "checked" End If %> tabindex="<%=getTabIndex()%>"/></td>
							<td scope="row" class="center"><input type="checkbox" name="Bl_write<%=bbs_cnt%>" value="Y" title="쓰기 권한 선택" <%if Bl_write = "Y" Then response.write "checked" End If %> tabindex="<%=getTabIndex()%>"/></td>
							<td scope="row" class="center"><input type="checkbox" name="Bl_delete<%=bbs_cnt%>" value="Y" title="삭제 권한 선택" <%if Bl_delete = "Y" Then response.write "checked" End If %> tabindex="<%=getTabIndex()%>"/></td>
							<td scope="row" class="center"><input type="checkbox" name="Bl_reply<%=bbs_cnt%>" value="Y" title="답변 권한 선택" <%if Bl_reply = "Y" Then response.write "checked" End If %> tabindex="<%=getTabIndex()%>"/></td>
						</tr>




<%
									bbs_cnt = bbs_cnt + 1
								next

							Else
%>

						<tr>
							<td scope="row" class="center"></td>
							<td scope="row" class="left bold"></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>
							<td scope="row" class="center"></td>
						</tr>



<%
							End if
							
%>



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



					<h2 class="<%=skin%>" style="text-align:left;">회원그룹 <strong class="orange">[<%=g_num_str%>]</strong> 홈매니저 접속권한 및 사용메뉴 권한</h2>
					<fieldset>
						<legend>사용메뉴 대메뉴 권한 설정</legend>
						<table cellspacing="0" class="bbs_<%=skin%>" summary="사용메뉴 대메뉴 권한설정을 위한 입력 양식입니다.">
						<caption>사용메뉴 대메뉴 서식</caption>
						<colgroup>
						<col width="140" />
						<col width="580" />
						</colgroup>

						<tr>
							<th scope="row"><label for="g_manager">홈매니저 접속 권한</label></th>
							<td class="left">
								<select id="g_manager" name="g_manager" title="홈매니저 접속 권한 선택" tabindex="<%=getTabIndex()%>">
									<option value="Y" <%If g_manager = "Y" Then response.write "selected='selected'" End If %> >사용</option>
									<option value="N" <%If g_manager = "N" Then response.write "selected='selected'" End If %>>중지</option>
								</select>
								<span class="text1">* 사용으로 설정하시면 홈매니저(관리페이지)로 접속을 하실 수 있습니다.</span>
							</td>
						</tr>
						

						<%


						
						' 관리메뉴 부분(대메뉴)
						R_Fields_L = "ct_idx, ct_name"
						sql = "Select "&R_Fields_L&" from manager_menu where ct_chk='Y' AND ct_depth = '1' order by ct_code ASC" 
						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
						
						If vCnt>-1 Then

							menu_cnt = 1
							For i=0 To vCnt
								ct_idx = vData(0,i)
								ct_name = vData(1,i)
						%>
						<tr>
							<th scope="row"><%=ct_name%></th>
							<td class="left">
								<fieldset>
									<table cellspacing="0" class="bbs_2step" summary="사용메뉴 2단계메뉴 권한설정을 위한 입력 양식입니다.">
									<colgroup>
									<col width="130" />
									<col width="428" />
									</colgroup>

									<%

									' 관리메뉴 부분(소메뉴)
									R_Fields_S = "ct_idx, ct_name"

									sql = "SELECT "&R_Fields_S&" FROM manager_menu WHERE ct_ref="&ct_idx&" AND ct_chk='Y'  AND ct_depth = '2' ORDER BY ct_code ASC"
									Set Rs = Dbcon.Execute (sql)
									If Not rs.eof Then
										sData = rs.getrows()
										sCnt = UBound(sData,2)
									Else
										sCnt = -1
									End If
									rs.close : Set rs = Nothing
									
									If sCnt>-1 Then
										For j=0 To sCnt
											ct_idx2	 = sData(0,j)
											ct_name2 = sData(1,j)									
									%>
									<tr>
										<th scope="row"><%=ct_name2%></th>
										<td class="left">
											<fieldset>
												<table cellspacing="0" class="bbs_3step" summary="사용메뉴 3단계메뉴 권한설정을 위한 입력 양식입니다.">
												<colgroup>
												<col width="33%" />
												<col width="33%" />
												<col width="33%" />
												</colgroup>
												<tr>
												<%											

												' 관리메뉴 부분(소소메뉴)
												R_Fields_SS = "ct_idx, ct_name, ct_codeno"

												sql = "SELECT "&R_Fields_SS&" FROM manager_menu WHERE ct_ref="&ct_idx2&" AND ct_chk='Y'  AND ct_depth = '3' ORDER BY ct_code ASC" 
												Set Rs = Dbcon.Execute (sql)
												If Not rs.eof Then
													eData = rs.getrows()
													eCnt = UBound(eData,2)
												Else
													eCnt = -1
												End If
												rs.close : Set rs = Nothing
												
												If eCnt>-1 Then
													zz = 1
													For k=0 To eCnt											

														ct_idx3		= eData(0,k)
														ct_name3	= eData(1,k)
														ct_codeno3	= eData(2,k)

														sql = "select count(num) as chked from manager_menu_access where g_num='"&cp_g_num&"' and ct_idx="&ct_idx3
														Set Rs = Dbcon.Execute (sql)
														chked = rs("chked")
														rs.close : Set rs = nothing

												%>
												
													<td>
														<input type="hidden" name="ct_codeno<%=menu_cnt%>" value="<%=ct_codeno3%>" />
														<input type="checkbox" id="ct_idx<%=menu_cnt%>" name="ct_idx<%=menu_cnt%>" value="<%=ct_idx3%>" <%if chked = "1" Then response.write "checked" End if %> tabindex="<%=getTabIndex()%>" /><%=ct_name3%>
													</td>
												
												<%	
													menu_cnt	= menu_cnt + 1
													zz			= zz + 1
													
													
														If  zz =4 then
															response.write "</tr> <tr>"
															zz=1
														End If
														
													Next
												End If
												
												%>
												</tr>
												</table>
											</fieldset>
										</td>
									</tr>
									<%	
										
										Next
									End if
									%>



									</table>
								</fieldset>
							</td>
						</tr>

						<%	
							Next
						End if
						%>
						
						</table>
					</fieldset>


					

					<div class="contoll_box">
						<div id="<%=skin%>_bt"><span class="button"><input type="submit" value="등록" tabindex="<%=getTabIndex()%>"/></span>  <span class="button"><input type="button" value="취소" onclick="dialog_close();" tabindex="<%=getTabIndex()%>"/></span></div>
					</div>

					<div>
						<input type="hidden" name="menu_cnt" value="<%=menu_cnt-1%>" />
						<input type="hidden" name="bbs_cnt" value="<%=bbs_cnt-1%>" />
						<input type="hidden" name="g_num" value="<%=p_g_num%>" /><!-- (수정일때사용) -->
					</div>

				</form>

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

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


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