Files
dnssash/theme/rd.dnssash/skin/board/reviews/write.skin.php
T
2026-06-11 18:47:38 +09:00

107 lines
5.7 KiB
PHP

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// jQuery UI의 CSS와 JS를 불러와 달력(Datepicker) 기능을 사용합니다.
add_stylesheet('<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">', 0);
add_javascript('<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>', 0);
// 이 스킨의 전용 스타일시트를 불러옵니다.
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . time() . '">', 0);
// 이 스킨의 전용 자바스크립트 파일을 불러옵니다.
add_javascript('<script src="' . $board_skin_url . '/js/write.js?ver=' . time() . '"></script>', 0);
?>
<div id="bo_w">
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
<input type="hidden" name="w" value="<?php echo $w ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<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 ?>">
<?php
// 스마트에디터를 사용하기 위해 html1로 고정
$option_hidden = '<input type="hidden" name="html" value="1">';
echo $option_hidden;
?>
<div class="write_div">
<label for="wr_subject" class="frm_label">제목</label>
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="frm_input" size="50" maxlength="255" placeholder="메인 화면에 노출될 제목을 입력하세요.">
</div>
<div class="write_div">
<label for="wr_content" class="frm_label">상세 내용</label>
<?php echo $editor_html; // 스마트에디터 출력 ?>
</div>
<div class="write_div">
<label class="frm_label">이미지 또는 동영상 (최대 <?php echo $board['bo_upload_count']; ?>개, 각 10MB 이하)</label>
<div class="file_upload_grid">
<?php
for ($i=0; $i<$board['bo_upload_count']; $i++) {
$file_label_id = 'bf_file_'.$i;
?>
<div class="file_preview_wrapper">
<?php
// 💡 [핵심 수정] 수정 모드일 때 기존 파일의 URL을 가져와 미리보기 스타일을 생성합니다.
$file_preview_style = '';
if ($w == 'u' && isset($file[$i]['file']) && $file[$i]['file']) {
$file_url = $file[$i]['path'].'/'.$file[$i]['file'];
$file_preview_style = "background-image: url('{$file_url}');";
}
?>
<div class="file_preview" id="preview_<?php echo $i; ?>" style="<?php echo $file_preview_style; ?>">
<span class="preview_text" style="<?php echo $file_preview_style ? 'display:none;' : ''; ?>">클릭하여 파일 업로드</span>
</div>
<!-- 수정 모드이고, 이 슬롯에 파일이 이미 등록되어 있을 경우 파일 정보 표시 -->
<?php if ($w == 'u' && isset($file[$i]['file']) && $file[$i]['file']) { ?>
<div class="preview_info">
<span class="current_file_name" title="<?php echo $file[$i]['source'] ?>">
<?php echo $file[$i]['source'] ?>
</span>
<span class="file_del">
<input type="checkbox" id="bf_file_del_<?php echo $i ?>" name="bf_file_del[<?php echo $i ?>]" value="1">
<label for="bf_file_del_<?php echo $i ?>">삭제</label>
</span>
</div>
<?php } ?>
<!-- 실제 파일 입력 필드 (숨겨져 있음) -->
<input type="file" name="bf_file[]" id="<?php echo $file_label_id; ?>" style="display:none;" accept="image/*, video/mp4">
</div>
<?php } ?>
</div>
</div>
<div class="btn_confirm">
<a href="<?php echo get_pretty_url($bo_table); ?>" class="btn btn_cancel">취소</a>
<input type="submit" value="작성완료" id="btn_submit" accesskey="s" class="btn btn_submit">
</div>
</form>
</div>
<script>
function fwrite_submit(f) {
<?php echo $editor_js; // 에디터 사용시 자바스크립트 부분 ?>
// 예약 노출 선택 시 날짜 입력 유효성 검사
if (document.querySelector('input[name="wr_1"]:checked').value === 'RESERVED') {
if (f.wr_2.value === '' || f.wr_3.value === '') {
alert('예약 시작일과 종료일을 모두 선택해주세요.');
return false;
}
if (f.wr_2.value > f.wr_3.value) {
alert('예약 종료일은 시작일보다 빠를 수 없습니다.');
return false;
}
}
return true;
}
</script>