first commit 2
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 💡 [핵심 1] 테마의 헤더 파일을 불러옵니다. (상단 메뉴, 로고 등 포함)
|
||||
//include_once(G5_THEME_PATH.'/head.php');
|
||||
|
||||
// 이 스킨의 전용 스타일시트를 불러옵니다.
|
||||
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . time() . '">', 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
|
||||
$option = '';
|
||||
$option_hidden = '';
|
||||
if ($is_notice || $is_html || $is_secret || $is_mail) {
|
||||
// HTML 사용을 기본으로 강제합니다.
|
||||
$option_hidden .= '<input type="hidden" name="html" value="html1">';
|
||||
}
|
||||
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>
|
||||
|
||||
<!-- 💡 [수정] CSS에 맞춘 이미지 미리보기 기능 구현 -->
|
||||
<?php for ($i=1; $is_file && $i<=$file_count; $i++) { ?>
|
||||
<div class="write_div">
|
||||
<label for="bf_file_<?php echo $i ?>" class="frm_label">대표 이미지 (파일 #<?php echo $i ?>)</label>
|
||||
|
||||
<div class="file_preview_wrapper">
|
||||
<div class="file_preview" id="preview_<?php echo $i ?>"
|
||||
style="<?php if($w=='u' && isset($file[$i-1]['path'])) echo 'background-image: url('.$file[$i-1]['path'].'/'.$file[$i-1]['file'].')'; ?>">
|
||||
<?php if(!($w=='u' && isset($file[$i-1]['path']))) { ?>
|
||||
<span class="preview_text">클릭하여 이미지 업로드</span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<input type="file" name="bf_file[]" id="bf_file_<?php echo $i ?>" style="display:none;" accept="image/*">
|
||||
|
||||
<div class="file_info">
|
||||
<span id="info_<?php echo $i ?>">
|
||||
<?php if ($w == 'u' && isset($file[$i-1]['source'])) { echo $file[$i-1]['source'].' ('.$file[$i-1]['size'].')'; } else { echo '선택된 파일 없음'; } ?>
|
||||
</span>
|
||||
<?php if ($w == 'u' && isset($file[$i-1]['source'])) { ?>
|
||||
<span class="file_del">
|
||||
<input type="checkbox" id="bf_file_del_<?php echo $i-1 ?>" name="bf_file_del[<?php echo $i-1; ?>]" value="1">
|
||||
<label for="bf_file_del_<?php echo $i-1 ?>">삭제</label>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<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>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 파일 미리보기 기능
|
||||
for (let i = 1; i <= <?php echo $file_count; ?>; i++) {
|
||||
const previewBox = document.getElementById(`preview_${i}`);
|
||||
const fileInput = document.getElementById(`bf_file_${i}`);
|
||||
const infoText = document.getElementById(`info_${i}`);
|
||||
|
||||
if (previewBox && fileInput && infoText) {
|
||||
const previewText = previewBox.querySelector('.preview_text');
|
||||
|
||||
previewBox.addEventListener('click', () => {
|
||||
fileInput.click();
|
||||
});
|
||||
|
||||
fileInput.addEventListener('change', (event) => {
|
||||
const file = event.target.files[0];
|
||||
if (file) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
previewBox.style.backgroundImage = `url(${e.target.result})`;
|
||||
if (previewText) {
|
||||
previewText.style.display = 'none';
|
||||
}
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
infoText.textContent = file.name;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function fwrite_submit(f) {
|
||||
<?php echo $editor_js; // 에디터 사용시 자바스크립트 부분 ?>
|
||||
// 추가적인 유효성 검사 로직이 필요하다면 여기에 추가
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
// 💡 [핵심 2] 테마의 푸터 파일을 불러옵니다. (하단 정보, 저작권 등 포함)
|
||||
//include_once(G5_THEME_PATH.'/tail.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user