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

auth_check($auth[$sub_menu], 'w');

$g5['title'] = '페이지관리';
$administrator = 1;
include_once(G5_ADMIN_PATH.'/admin.head.php');

$bp_id = $bdb->esc($_GET['bp_id']);
$sfl = $bdb->esc($_GET['sfl']);
$stx = $bdb->esc($_GET['stx']);
$sst = $bdb->esc($_GET['sst']);
$sod = $bdb->esc($_GET['sod']);
$page = $bdb->esc($_GET['page']);

if($bp_id != ''){
	$sql = "SELECT * FROM ".$bt['page_table']." WHERE bp_id='".$bp_id."'";
	$row = $bdb->fetch($sql);
	
	$w = 'u';
	$readonly = 'readonly';
}else{
	$required = 'required';
    $required_valid = 'alnum_';
}

$editor_js = '';
$editor_js .= get_editor_js('bp_content');
$editor_js .= chk_editor_js('bp_content');
?>

<script type="text/javascript">
<!--
function fpageform_submit(f){
	<?php echo $editor_js; // 에디터 사용시 자바스크립트에서 내용을 폼필드로 넣어주며 내용이 입력되었는지 검사함   ?>
	
	return true;
}
//-->
</script>

<form name="fpageform" id="fpageform" action="./page_update.php" onsubmit="return fpageform_submit(this)" method="post" enctype="multipart/form-data">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">

<section id="anc_bo_basic">
    <h2 class="h2_frm">페이지 편집</h2>
    <?php echo $pg_anchor ?>

    <div class="tbl_frm01 tbl_wrap">
        <table>
        <caption>페이지 편집</caption>
        <colgroup>
            <col class="grid_4">
            <col>
            <col class="grid_3">
        </colgroup>
        <tbody>
        <tr>
            <th scope="row"><label for="bp_id">페이지아이디</label></th>
            <td colspan="2"><input type="text" name="bp_id" value="<?=$row['bp_id']?>" size="10" maxlength="20" <?php echo $required ?> <?php echo $readonly ?> class="frm_input <?php echo $reaonly ?> <?php echo $required ?> <?php echo $required_valid ?>" maxlength="20"></td>
        </tr>
        <tr>
        	<th scope="row"><label for="bp_title">페이지 제목</label></th>
        	<td colspan="2"><input type="text" name="bp_title" value="<?=$row['bp_title']?>" size="20" maxlength="20" <?php echo $required?> class="frm_input <?php echo $required?>" maxlength="100"></td>
        </tr>
        <tr>
        	<th scope="row"><label for="bp_content">내용입력</label></th>
        	<td colspan="2">
        		<span class="frm_info">모바일페이지를 위해 내용편집시 가로 크기를 고정 픽셀로 설정하지 않는게 좋습니다</span>
        		<?php echo editor_html("bp_content", $row['bp_content']); ?>
        	</td>
        </tr>
    	</tbody>
    	</table>
    </div>
</section>

<div class="btn_confirm01 btn_confirm">
    <input type="submit" value="확인" class="btn_submit" accesskey="s">
    <a href="page_list.php?<?php echo $qstr ?>">목록으로</a>
</div>

</form>

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