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

if(!$is_admin) exit;

$ncode	= base64_decode($ncode);
//-- 공지사항 삭제 --------------------------------------------------------------------------------
if($mode == "del") {
	sql_query("delete from $zmb[table_popup_notice] where db_recno='$ncode'");
	alert("공지사항을 삭제 했습니다.", "./zm.popup_notice.php");
	exit;
}

//-- 공지사항 저장 --------------------------------------------------------------------------------
if($mode) {
	if(!$in_width || !$in_height || !$in_top || !$in_left) {
		alert("창의 정보가 부족 합니다.");
	}

	if(!$in_subject) alert("제목이 없습니다.");

	$in_winsize			= $in_width . "x" . $in_height;
	$in_winpos			= $in_top . "x" . $in_left;
	$in_start_datetime	= $in_start_date_y . "-" . $in_start_date_m . "-" . $in_start_date_d . " " . $in_start_time_h . ":" . $in_start_time_i . ":" . $in_start_time_s;
	$in_end_datetime	= $in_end_date_y . "-" . $in_end_date_m . "-" . $in_end_date_d . " " . $in_end_time_h . ":" . $in_end_time_i . ":" . $in_end_time_s;

	if($in_start_datetime > $in_end_datetime) alert("종료일이 시작일보다 빠릅니다.");

	$n		= date("Y-m-d H:i:s", $g4[server_time]);
	if($mode == "save") {
		$sql	= "insert into $zmb[table_popup_notice] set db_winstyle='$in_winstyle', db_winsize='$in_winsize', db_winpos='$in_winpos', db_start_datetime='$in_start_datetime', db_end_datetime='$in_end_datetime', db_target_level='$in_target_level', db_subject='$in_subject', db_content='$in_content', db_skin='$in_skin', db_datetime='$n'";
	}elseif($mode == "update") {
		$sql	= "update $zmb[table_popup_notice] set db_winstyle='$in_winstyle', db_winsize='$in_winsize', db_winpos='$in_winpos', db_start_datetime='$in_start_datetime', db_end_datetime='$in_end_datetime', db_target_level='$in_target_level', db_subject='$in_subject', db_content='$in_content', db_skin='$in_skin' where db_recno='$recno'";
	}
	sql_query($sql);

	alert("공지사항을 저장 했습니다.", "./zm.popup_notice.php");
}
?>