<?php
$sub_menu = "777200";
include_once('./_common.php');

if(!$bo_table) {
	$loc = "ma";
} else {
	if(!$loc) {
		$loc = G5_IS_MOBILE ? 'm' : 'pc';
	}
}

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

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

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

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

//Button
$amina_btn = "<span class=\"right\">\n";
if($is_amina_setup) {
	$amina_btn .= "<input type=\"button\" value=\"게시판\" onclick=\"amina_href('".G5_BBS_URL."/board.php?bo_table=".$bo_table."');\" class=\"btn_gray\">\n";
	$amina_btn .= "<input type=\"button\" value=\"셋업하기\" onclick=\"amina_href('".G5_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;
	}

	if($bo_table) {
		$amina_btn .= "<input type=\"button\" value=\" PC \" onclick=\"amina_href('".AMINA_URL."/admin.dashboard.php?bo_table=".$bo_table."&loc=pc');\" class=\"".$loc_pc."\">\n &nbsp; \n";
		$amina_btn .= "<input type=\"button\" value=\"모바일\" onclick=\"amina_href('".AMINA_URL."/admin.dashboard.php?bo_table=".$bo_table."&loc=m');\" class=\"".$loc_m."\">\n &nbsp; \n";
		$amina_btn .= "<input type=\"button\" value=\" 기능 \" onclick=\"amina_href('".AMINA_URL."/admin.dashboard.php?bo_table=".$bo_table."&loc=func');\" 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('".G5_BBS_URL."/board.php?bo_table=".$bo_table."');\" class=\"btn_gray\">\n &nbsp; \n";
		$amina_btn .= "<input type=\"button\" value=\" 그누 \" onclick=\"amina_href('".G5_ADMIN_URL."/board_form.php?w=u&bo_table=".$bo_table."');\" class=\"btn_gray\">\n &nbsp; \n";
	}
	$amina_btn .= "<input type=\"button\" value=\" 관리 \" onclick=\"amina_href('".AMINA_URL."/admin.dashboard.php?bo_table=".$bo_table."&loc=ma');\" class=\"".$loc_ma."\">\n";
}
$amina_btn .= "</span>\n";

$amina_set_padding = '';
if(AMINA) {
	echo '<br /><br />'."\n";
	$amina_set_padding = ' style="padding:0px 15px;"';
}

?>

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

<div id="amina_setup"<?php echo $amina_set_padding; ?>>
	<h1 class="main_title">AMINA SKIN <span><?php echo AMINA_VERSION; ?></span> SETUP</h1>
	<?php echo ($board['bo_subject']) ? '<div style="background:#fafafa; padding:10px; border-bottom:1px solid #ddd;"><b>● 현재 위치 : '.$board['bo_subject'].'('.$board['bo_table'].')</b></div>' : ''; ?>
	<?php 
		if($loc == "func") {
			include_once (AMINA_PATH.'/admin.form.func.php'); 
		} else if ($loc == "pc" || $loc == "m") {
			include_once (AMINA_PATH.'/admin.form.skin.php');
		} else {
			include_once (AMINA_PATH.'/admin.form.ma.php'); 
		}
	?>
</div>

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