<?
include_once('./_common.php');

$g4['title'] = $board['bo_subject'].' 게시판 아미나스킨 설정';

if(G4_IS_MOBILE && !$loc) $loc = 'm';

include_once(G4_ADMIN_PATH.'/admin.head.php');

if(file_exists(G4_PATH.'/setup.php')) {
		$is_amina_setup = true;
		echo "<script> alert('셋업을 클릭하여 DB에 테이블과 필드를 생성해 주세요.');</script>";
} else {
	$is_amina_setup = false;
}

include_once(AMINA_PATH.'/lib/admin.lib.php');


//Button
$amina_btn = "<span class=\"right\">\n";
if($is_amina_setup) {
	$amina_btn .= "<input type=\"button\" value=\"게시판\" onclick=\"amina_href('".G4_BBS_URL."/board.php?bo_table=".$bo_table."');\" class=\"btn_gray\">\n";
	$amina_btn .= "<input type=\"button\" value=\"셋업하기\" onclick=\"amina_href('".G4_URL."/setup.php?bo_table=".$bo_table."');\" class=\"btn_red\">\n";
} else {
	switch($loc) {
		case 'func'		: $loc_func = "btn_red"; $loc_m = "btn_gray"; $loc_pc = "btn_gray"; $loc_ma = "btn_gray"; break;
		case 'm'		: $loc_func = "btn_gray"; $loc_m = "btn_green"; $loc_pc = "btn_gray"; $loc_ma = "btn_gray"; break;
		case 'ma'		: $loc_func = "btn_gray"; $loc_m = "btn_gray"; $loc_pc = "btn_gray"; $loc_ma = "btn_red"; break;
		default			: $loc_func = "btn_gray"; $loc_m = "btn_gray"; $loc_pc = "btn_blue"; $loc_ma = "btn_gray"; break;
	}

	$amina_btn .= "<input type=\"button\" value=\" PC \" onclick=\"amina_href('".G4_ADMIN_URL."/amina.admin.php?bo_table=".$bo_table."&loc=pc&sca=".urlencode($sca)."');\" class=\"".$loc_pc."\">\n &nbsp; \n";
	$amina_btn .= "<input type=\"button\" value=\"모바일\" onclick=\"amina_href('".G4_ADMIN_URL."/amina.admin.php?bo_table=".$bo_table."&loc=m&sca=".urlencode($sca)."');\" class=\"".$loc_m."\">\n &nbsp; \n";
	$amina_btn .= "<input type=\"button\" value=\" 기능 \" onclick=\"amina_href('".G4_ADMIN_URL."/amina.admin.php?bo_table=".$bo_table."&loc=func&sca=".urlencode($sca)."');\" class=\"".$loc_func."\">\n &nbsp; \n";
	if($loc != "ma") $amina_btn .= "<input type=\"submit\" accesskey=\"s\" value=\" 저장 \" class=\"btn_black\">\n &nbsp; \n";
	$amina_btn .= "<input type=\"button\" value=\"게시판\" onclick=\"amina_href('".G4_BBS_URL."/board.php?bo_table=".$bo_table."&sca=".urlencode($sca)."');\" class=\"btn_gray\">\n &nbsp; \n";
	$amina_btn .= "<input type=\"button\" value=\" 관리 \" onclick=\"amina_href('".G4_ADMIN_URL."/amina.admin.php?bo_table=".$bo_table."&loc=ma&sca=".urlencode($sca)."');\" class=\"".$loc_ma."\">\n";
}
$amina_btn .= "</span>\n";

if(AMINA == "g4s") echo "<br /><br />\n";

?>

<link rel="stylesheet" href="<?=AMINA_URL?>/css/admin.css" />
<script>
	var amina_url = "<?=AMINA_URL?>";
	var bo_table  = "<?=$bo_table?>";
</script>
<script src="<?=AMINA_URL?>/js/admin.js"></script>

<section id="amina_setup" class="cbox">
	<h1 class="main_title">AMINA SKIN 3.x SETUP #Version <span><?=$amina_skin_version?></span></h1>
	<? 
		if($loc == "func") {
			include_once (AMINA_PATH.'/admin.form.func.php'); 
		} else if($loc == "ma") {
			include_once (AMINA_PATH.'/admin.form.ma.php'); 
		} else {
			include_once (AMINA_PATH.'/admin.form.skin.php');
		}
	?>
</section>

<? include_once (G4_ADMIN_PATH.'/admin.tail.php'); ?>
