<?
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/header.php";
if(!in_array("admin_manage",$_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["AUTH"]) && $_SESSION[$_SITE["DOMAIN"]]["ADMIN"]["GRADE"]!="ROOT"):
	jsMsg("권한이 없습니다.");
	jsHistory("-1");
endif;

//DB연결
$dblink = SetConn($_conf_db["main_db"]);
/*
$arrInfo = getArticleInfo($GLOBALS["_conf_tbl"]["admin"], $idx);

$arrAuth = explode(",",str_replace(" ","",$arrInfo["list"][0][a_auth]));
*/

$arrList = getAdminMenu1();
//DB해제
SetDisConn($dblink);
?>
<script type="text/javascript">
function checkForm(frm){
	//var isSeasonChk = false;
	var arr_Auth = document.getElementsByName("a_auth[]");
	var auth_var = "";
	for(var i=0;i<arr_Auth.length;i++){
		if(arr_Auth[i].checked == true) {
			//alert(arr_Auth[i].value);
			auth_var += arr_Auth[i].value;
			if(i<(arr_Auth.length-1)){
				auth_var += ",";
			}
		}
		
	}
	//alert(auth_var);
	//return false;
}

function checkForm1(type){
	var frm = document.frmOpenInfo;
	if(type=="1"){
		frm.evnType.value="1";
	}else{
		frm.evnType.value="2";
	}
	
	frm.submit();
}

function changeType(type){
	var arr_Auth = document.getElementsByName("a_auth[]");
	var auth_var = "";
	for(var i=0;i<arr_Auth.length;i++){
		arr_Auth[i].checked = false;
	}
	if(type=="1"){
		arr_Auth[2].checked = true;
	}else if(type=="2"){
		arr_Auth[2].checked = true;
		arr_Auth[12].checked = true;
	}else if(type=="3"){
		arr_Auth[2].checked = true;
		arr_Auth[7].checked = true;
		arr_Auth[16].checked = true;
	}else if(type=="4"){
		arr_Auth[2].checked = true;
		arr_Auth[7].checked = true;
		arr_Auth[12].checked = true;
		arr_Auth[16].checked = true;
	}else if(type=="5"){
		arr_Auth[2].checked = true;
		arr_Auth[7].checked = true;
		arr_Auth[9].checked = true;
		arr_Auth[10].checked = true;
		arr_Auth[11].checked = true;
		arr_Auth[19].checked = true;
	}else if(type=="6"){
		arr_Auth[2].checked = true;
		arr_Auth[7].checked = true;
		arr_Auth[9].checked = true;
		arr_Auth[10].checked = true;
		arr_Auth[11].checked = true;
		arr_Auth[12].checked = true;
		arr_Auth[19].checked = true;
	}
	arr_Auth[3].checked = true;
	arr_Auth[15].checked = true;
	arr_Auth[18].checked = true;
}
function initLog(updatemode){
	document.frmLogInfo.evnMode.value=updatemode;
	document.frmLogInfo.submit();
}
</script>
<div id="admin-container">
	<? include "menu.php"; ?>
    <div id="admin-content">
		<h2 class="admin-title">사이트설정</h2>
		<h3 class="admin-title-middle">관리자 수정</h3>

		<form name="frmLogInfo" method="post" action="admin_evn.php">
		<input type="hidden" name="evnMode" value="">
		</form>
		<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="button" value="접속통계 초기화" style="font-weight:bold" onclick="initLog('updateLog');"/></span>
		<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="button" value="영문추가" style="font-weight:bold" onclick="initLog('addEnMode');"/></span>
		<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="button" value="중문추가" style="font-weight:bold" onclick="initLog('addCnMode');"/></span>
		<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="button" value="일본어추가" style="font-weight:bold" onclick="initLog('addJpMode');"/></span>
		<br>
		<span style="color:red;font-weight:bold">다국어는 프로그램쪽만 추가되는부분임. 별도로 폴더생성되지않음</span>
		<br>
		<br>
		<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="button" value="전체게시판 테스트게시글 등록" style="font-weight:bold" onclick="initLog('addBoardAddTest');"/></span>
		<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="button" value="전체게시판 초기화" style="font-weight:bold" onclick="initLog('initBoard');"/></span>
		<br>
		<span style="color:red;font-weight:bold">전체게시판 초기화는 게시글 전체삭제됩니다. 사용주의!!</span>
		<br />	
		</form>
		<br>
		<form name="frmInfo" method="post" action="admin_evn.php" onsubmit="return checkForm(this)">
		<!--<form name="frmInfo" method="post" onsubmit="return checkForm(this)">-->
		<input type="hidden" name="evnMode" value="updateAuth">

		<div style="">
			<div style="position:relative;float:left;width:33%;margin-bottom:20px;">
				<span class="btn_pack medium"><a href="javascript:changeType('1')" >게시판형</a></span> 관리자+게시판+팝업+접속통계<br />
				<span class="btn_pack medium"><a href="javascript:changeType('2')" >게시판+문의형</a></span> 관리자+게시판+온라인문의+팝업+접속통계<br />
				<span class="btn_pack medium"><a href="javascript:changeType('3')" >기업형</a></span> 관리자+제품(분류)관리+게시판+팝업+접속통계<br />
				<span class="btn_pack medium"><a href="javascript:changeType('4')" >기업형+문의형</a></span> 관리자+제품(분류)관리+게시판+온라인문의+팝업+접속통계<br />
				<span class="btn_pack medium"><a href="javascript:changeType('5')" >쇼핑몰</a></span> 관리자+상품(분류)관리+게시판+회원관리+팝업+접속통계<br />
				<span class="btn_pack medium"><a href="javascript:changeType('6')" >쇼핑몰+문의형</a></span> 관리자+상품(분류)관리+게시판+온라인문의+회원관리+팝업+접속통계<br />
			</div>
		</div>
		<br />
		<!-- 기본정보 -->
		<table  class="admin-table-type1">
		  <colgroup>
		  <col width="120" />
		  <col width="*" />
		  </colgroup>
		  <tbody>
			<tr>
				<th>접근권한</th>
				<td class="space-left">
					<ul class="admin-restrictions">
					<?for($i=0;$i<$arrList["total"];$i++){?>
					<li><input type="checkbox" name="a_auth[]" id="a_auth_<?=$i?>" value="<?=$arrList["list"][$i][m_code]?>"<?=$arrList["list"][$i][is_use]=="Y"?" checked":""?>><label for="a_auth_<?=$i?>"><?=$arrList["list"][$i][m_name]?></label></li>
					<?}?>
					</ul>
				</td>
			</tr>
		  </tbody>
		</table>
		<div class="admin-buttons">
			<div class="cen">
				<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="submit" value="수정하기" style="font-weight:bold" /></span>
			</div>
		</div>
		</form>
		
		
		<div class="admin-comm" style="text-align:center">
			<form name="frmOpenInfo" method="post" action="admin_evn.php">
			<input type="hidden" name="evnMode" value="updateOpen">
			<input type="hidden" name="evnType" value="1">
			<div class="column1">
				<div class="admin-board" style="padding:10px">
				<h3>컨텐츠 변경</h3>
				테스트섭 : <input type="text" name="oldsite" value="<?=$arrSetInfo["list"][0][shop_url]?>" class="input" style="width:70%"/> <br />
				실도메인 : <input type="text" name="newsite" value="<?=$arrSetInfo["list"][0][shop_url2]?>" class="input" style="width:70%"/><br /> <br />
				<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="button" value="되돌리기" style="font-weight:bold" onclick="javascript:checkForm1('2')"/></span>
				<span class="btn_pack xlarge icon"><span class="refresh"></span><input type="button" value="오픈시클릭" style="font-weight:bold" onclick="javascript:checkForm1('1')"/></span>
				</div>
			</div>
			</form>

			
				<div class="column1 first" style="text-align:left;padding:0px;">
					<div class="admin-board" style="padding:10px;" >
					<h3>여분컬럼추가</h3>
					<input type="text" name="etc_snum" id="etc_snum" value="1" class="input" style="width:30%"/>~
					<input type="text" name="etc_enum" id="etc_enum" value="10" class="input" style="width:30%"/> 까지<br /><br />

					<span class="btn_pack large icon"><span class="refresh"></span><input type="submit" value="온라인문의" style="font-weight:bold" onclick="javascript:auto_sql('tbl_online_form', document.getElementById('etc_snum').value, document.getElementById('etc_enum').value);"/></span>
					<span class="btn_pack large icon"><span class="refresh"></span><input type="submit" value="제품관리" style="font-weight:bold" onclick="javascript:auto_sql('tbl_product',document.getElementById('etc_snum').value, document.getElementById('etc_enum').value);"/></span>
					<span class="btn_pack large icon"><span class="refresh"></span><input type="submit" value="상품관리" style="font-weight:bold" onclick="javascript:auto_sql('tbl_shop_good',document.getElementById('etc_snum').value, document.getElementById('etc_enum').value);"/></span>
					<!-- <span class="btn_pack large icon"><span class="refresh"></span><input type="submit" value="회원관리" style="font-weight:bold" onclick="javascript:;"/></span> -->
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
function auto_sql(tblid,start_num,end_num){
	document.frmAutoSql.tbl_id.value=tblid;
	document.frmAutoSql.column_snum.value=start_num;
	document.frmAutoSql.column_enum.value=end_num;
	document.frmAutoSql.submit();
}
</script>
<form name="frmAutoSql" method="get" action="auto_sql.php">
<input type="hidden" name="tbl_id" value=""/>
<input type="hidden" name="column_snum" value=""/>
<input type="hidden" name="column_enum" value=""/>
</form>
<?
include $_SERVER[DOCUMENT_ROOT] . "/backoffice/footer.php";
?>