first commit 2
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
/**
|
||||
* rb.board.core :: list.skin.php
|
||||
* 💡 [최종판] 하이브리드 레이아웃 (지정 최신글 + 일반 목록)
|
||||
*/
|
||||
|
||||
// 뷰 모드 설정
|
||||
$default_view_mode = isset($board_config['list']['default_view_mode']) ? $board_config['list']['default_view_mode'] : 'card';
|
||||
$view_mode = get_cookie('board_' . $bo_table . '_view_mode') ?: $default_view_mode;
|
||||
|
||||
// 필드 맵 정의
|
||||
$field_map = array(
|
||||
'summary' => 'wr_1',
|
||||
'external_link' => 'wr_2', // 사용하지 않지만 유지
|
||||
'start_date' => 'wr_3',
|
||||
'end_date' => 'wr_4',
|
||||
'featured' => 'wr_10', // 지정 최신글 여부 (Y/N)
|
||||
);
|
||||
$ebook_link_field = 'wr_link1';
|
||||
|
||||
// 💡 [핵심] '지정 최신글'과 '일반글'을 분리
|
||||
$featured_list = array();
|
||||
$regular_list = array();
|
||||
// $list 변수는 list.php 에서 미리 생성된 그누보드 원본 목록입니다.
|
||||
foreach ($list as $item) {
|
||||
if ($item[$field_map['featured']] == 'Y') {
|
||||
$featured_list[] = $item;
|
||||
} else {
|
||||
$regular_list[] = $item;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="board-list-container" class="board-container">
|
||||
|
||||
<!-- 게시판 헤더 -->
|
||||
<div class="board-header">
|
||||
<div class="board-total">
|
||||
Total <span class="text-primary"><?php echo number_format($total_count) ?></span> / <?php echo $page ?> page
|
||||
</div>
|
||||
<div class="board-controls">
|
||||
<div class="view-mode-switcher">
|
||||
<button type="button" class="btn-view-mode <?php echo ($view_mode === 'card') ? 'active' : ''; ?>" data-mode="card" title="카드형으로 보기"><i class="fas fa-th-large"></i></button>
|
||||
<button type="button" class="btn-view-mode <?php echo ($view_mode === 'list') ? 'active' : ''; ?>" data-mode="list" title="리스트형으로 보기"><i class="fas fa-bars"></i></button>
|
||||
</div>
|
||||
<div class="board-search">
|
||||
<form name="fsearch" method="get">
|
||||
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>"><input type="hidden" name="sca" value="<?php echo $sca ?>">
|
||||
<div class="input-group">
|
||||
<select name="sfl" id="sfl"><option value="wr_subject"<?php echo get_selected($sfl, "wr_subject", true); ?>>제목</option><option value="wr_content"<?php echo get_selected($sfl, "wr_content"); ?>>내용</option><option value="wr_subject||wr_content"<?php echo get_selected($sfl, "wr_subject||wr_content"); ?>>제목+내용</option><option value="mb_id,1"<?php echo get_selected($sfl, "mb_id,1"); ?>>회원ID</option><option value="wr_name,1"<?php echo get_selected($sfl, "wr_name,1"); ?>>글쓴이</option></select>
|
||||
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required class="form-control" placeholder="검색어 입력">
|
||||
<button type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 💡 [핵심] 지정 최신글 출력 영역 (항상 카드형) -->
|
||||
<?php if (!empty($featured_list) && $page === 1): // 첫 페이지에서만 보여줍니다. ?>
|
||||
<div class="featured-list-wrapper">
|
||||
<ul class="card-list">
|
||||
<?php for ($i=0; $i<count($featured_list); $i++) {
|
||||
$item = $featured_list[$i];
|
||||
$thumb = get_list_thumbnail($bo_table, $item['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
|
||||
$href = $item[$ebook_link_field] ? $item[$ebook_link_field] : $item['href'];
|
||||
$target = $item[$ebook_link_field] ? '_blank' : '';
|
||||
$summary = cut_str(strip_tags($item[$field_map['summary']] ?: $item['wr_content']), 120);
|
||||
?>
|
||||
<li class="card-item is-featured">
|
||||
<a href="<?php echo $href; ?>" target="<?php echo $target; ?>" class="card-link">
|
||||
<div class="card-thumbnail"><img src="<?php echo $thumb['src']; ?>" alt="<?php echo $thumb['alt']; ?>"><span class="badge-featured"><i class="fa fa-star"></i> E-Book</span></div>
|
||||
<div class="card-content">
|
||||
<?php if ($is_category && $item['ca_name']): ?><span class="card-category"><?php echo $item['ca_name']; ?></span><?php endif; ?>
|
||||
<h3 class="card-title"><?php echo $item['subject']; ?></h3>
|
||||
<p class="card-summary"><?php echo $summary; ?></p>
|
||||
<div class="card-meta"><span class="card-date"><?php echo $item['datetime2']; ?></span></div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 💡 [핵심] 구분선 -->
|
||||
<div class="list-separator">
|
||||
<p>최신 6개를 제외하고 나머지는 pdf를 보여주거나 다운후 확인 할 수있습니다.</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<!-- 💡 [핵심] 일반 목록 출력 영역 (카드/리스트 전환) -->
|
||||
<div id="regular-list-container" data-view-mode="<?php echo $view_mode; ?>">
|
||||
<div class="board-list-wrapper">
|
||||
<?php if (empty($regular_list)): ?>
|
||||
<div class="empty-list">일반 게시물이 없습니다.</div>
|
||||
<?php else: ?>
|
||||
<!-- 카드형 목록 -->
|
||||
<div class="card-list-view">
|
||||
<ul class="card-list">
|
||||
<?php for ($i=0; $i<count($regular_list); $i++) {
|
||||
$item = $regular_list[$i];
|
||||
$thumb = get_list_thumbnail($bo_table, $item['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
|
||||
$href = $item['href'];
|
||||
$summary = cut_str(strip_tags($item[$field_map['summary']] ?: $item['wr_content']), 120);
|
||||
?>
|
||||
<li class="card-item">
|
||||
<a href="<?php echo $href; ?>" class="card-link">
|
||||
<div class="card-thumbnail"><img src="<?php echo $thumb['src']; ?>" alt="<?php echo $thumb['alt']; ?>"></div>
|
||||
<div class="card-content">
|
||||
<?php if ($is_category && $item['ca_name']): ?><span class="card-category"><?php echo $item['ca_name']; ?></span><?php endif; ?>
|
||||
<h3 class="card-title"><?php echo $item['subject']; ?></h3>
|
||||
<p class="card-summary"><?php echo $summary; ?></p>
|
||||
<div class="card-meta"><span class="card-date"><?php echo $item['datetime2']; ?></span></div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 리스트형 목록 -->
|
||||
<div class="list-view">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-header">
|
||||
<div class="list-cell num">번호</div><div class="list-cell title">제목</div><div class="list-cell name">글쓴이</div><div class="list-cell date">날짜</div><div class="list-cell hit">조회</div>
|
||||
</li>
|
||||
<?php for ($i=0; $i<count($regular_list); $i++) {
|
||||
$item = $regular_list[$i];
|
||||
?>
|
||||
<li class="list-group-item">
|
||||
<div class="list-cell num"><?php echo $item['num']; ?></div>
|
||||
<div class="list-cell title">
|
||||
<a href="<?php echo $item['href']; ?>">
|
||||
<?php echo $item['subject']; ?>
|
||||
<?php if ($item['icon_new']) echo ' <span class="icon-new">N</span>'; ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="list-cell name"><?php echo $item['name']; ?></div>
|
||||
<div class="list-cell date"><?php echo $item['datetime2']; ?></div>
|
||||
<div class="list-cell hit"><?php echo $item['wr_hit']; ?></div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
/**
|
||||
* rb.board.core :: pdf_fade_effect.skin.php
|
||||
* PDF 뷰어에 페이드 인/아웃 효과를 추가하는 확장 파일입니다.
|
||||
* 이 파일을 삭제하거나 이름을 바꾸면 효과가 비활성화됩니다.
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- 1. 페이드 효과를 위한 CSS -->
|
||||
<style>
|
||||
#pdf-canvas {
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 2. 페이드 효과를 적용하는 JavaScript -->
|
||||
<script>
|
||||
// 💡 [핵심] 기존 renderPage 함수를 덮어쓰기(Override)하여 페이드 효과를 추가합니다.
|
||||
// 이 스크립트는 원본 view.skin.php의 스크립트보다 나중에 실행되어야 합니다.
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 원본 뷰어의 핵심 요소들이 존재하는지 확인
|
||||
if (typeof pdfjsLib === 'undefined' || !document.getElementById('pdf-canvas')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 기존의 renderPage 함수를 백업합니다.
|
||||
const originalRenderPage = window.renderPage;
|
||||
|
||||
// 페이드 효과가 적용된 새로운 renderPage 함수를 정의합니다.
|
||||
window.renderPage = function(num) {
|
||||
const canvas = document.getElementById('pdf-canvas');
|
||||
|
||||
// 이미 렌더링 중이면 대기
|
||||
if (window.pageRendering) {
|
||||
window.pageNumPending = num;
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. 캔버스를 투명하게 만들어 사라지는 효과를 줍니다.
|
||||
canvas.style.opacity = 0;
|
||||
|
||||
// 2. 짧은 시간(애니메이션 시간) 후에 원래의 렌더링 함수를 호출합니다.
|
||||
setTimeout(() => {
|
||||
// 백업해둔 원래 함수를 호출하여 페이지를 그립니다.
|
||||
// originalRenderPage(num);
|
||||
// -> 원본 함수 내부의 변수 스코프 문제로 직접 실행이 어려우므로, 로직을 그대로 가져옵니다.
|
||||
|
||||
window.pageRendering = true;
|
||||
window.loadingIndicator.style.display = 'flex';
|
||||
|
||||
window.pdfDoc.getPage(num).then(function(page) {
|
||||
const desiredWidth = window.canvasWrapper.clientWidth;
|
||||
const viewport = page.getViewport({ scale: 1 });
|
||||
const scale = desiredWidth / viewport.width;
|
||||
const scaledViewport = page.getViewport({ scale: scale });
|
||||
|
||||
canvas.height = scaledViewport.height;
|
||||
canvas.width = scaledViewport.width;
|
||||
|
||||
const renderContext = { canvasContext: window.ctx, viewport: scaledViewport };
|
||||
const renderTask = page.render(renderContext);
|
||||
|
||||
renderTask.promise.then(function() {
|
||||
window.pageRendering = false;
|
||||
window.loadingIndicator.style.display = 'none';
|
||||
|
||||
// 3. 그리기가 끝나면 캔버스를 다시 나타나게 합니다.
|
||||
canvas.style.opacity = 1;
|
||||
|
||||
if (window.pageNumPending !== null) {
|
||||
window.renderPage(window.pageNumPending);
|
||||
window.pageNumPending = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
window.pageNumInput.value = num;
|
||||
|
||||
}, 200); // 0.2초의 딜레이
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
/**
|
||||
* rb.board.core :: view.skin.php
|
||||
* 💡 [최종판] '플러그인형 코어' 뷰 - 자식 스킨의 설정에 따라 전문 코어 파일을 불러옵니다.
|
||||
*/
|
||||
|
||||
if (!function_exists('get_extension')) {
|
||||
function get_extension($filename) {
|
||||
$filename = basename($filename);
|
||||
return substr(strrchr($filename, "."), 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 필드 맵 정의
|
||||
$field_map = array('summary' => 'wr_1');
|
||||
|
||||
// 💡 [핵심] 첨부파일 재구성 (다운로드 파일만 처리)
|
||||
$download_files = array();
|
||||
|
||||
if ($view['file']['count'] > 1) { // 썸네일(첫번째 파일)을 제외하고 2번째 파일부터 처리
|
||||
$temp_files = $view['file'];
|
||||
unset($temp_files['count']);
|
||||
|
||||
for ($i = 1; $i < $view['file']['count']; $i++) {
|
||||
if (!isset($temp_files[$i])) continue;
|
||||
$file = $temp_files[$i];
|
||||
|
||||
// 모든 파일을 다운로드 목록에 추가 (전문 코어에서 처리되지 않은 파일)
|
||||
$download_files[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
// 💡 [핵심] 어떤 전문 코어 뷰 파일을 불러올지 결정합니다.
|
||||
$core_type = isset($board_config['view']['core_type']) ? $board_config['view']['core_type'] : 'default';
|
||||
$core_view_file = __DIR__ . '.'.$core_type.'/view.skin.php';
|
||||
|
||||
?>
|
||||
|
||||
<div class="board-view-container">
|
||||
<article id="bo_v" class="view-article">
|
||||
<header class="view-header">
|
||||
<h1 id="bo_v_title"><?php echo cut_str(get_text($view['wr_subject']), 70); ?></h1>
|
||||
<div class="view-meta">
|
||||
<span class="meta-item"><i class="fa fa-user"></i> <?php echo $view['name'] ?></span>
|
||||
<span class="meta-item"><i class="fa fa-clock-o"></i> <?php echo $view['datetime2'] ?></span>
|
||||
<span class="meta-item"><i class="fa fa-eye"></i> <?php echo number_format($view['wr_hit']) ?></span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="view-content">
|
||||
<!-- 💡 [핵심] 요약 내용이 있을 경우에만, 그리고 config에서 show_summary_in_view가 true일 경우에만 표시합니다. -->
|
||||
<?php if ($view[$field_map['summary']] && (!isset($board_config['view']['show_summary_in_view']) || $board_config['view']['show_summary_in_view'] === true)): ?>
|
||||
<div class="view-summary">
|
||||
<?php echo get_text($view[$field_map['summary']]); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 💡 [핵심] 본문 내용은 전문 코어 파일에서 처리하도록 비워둡니다. -->
|
||||
<div class="view-detail-content">
|
||||
<?php
|
||||
// 이 부분은 전문 코어 파일에서 처리하므로 비워둡니다.
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// 💡 [핵심] 전문 코어 뷰 파일을 불러옵니다.
|
||||
if (file_exists($core_view_file)) {
|
||||
include($core_view_file);
|
||||
} else {
|
||||
echo '<div class="empty-list">전문 코어 뷰 파일을 찾을 수 없습니다: '.$core_view_file.'</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (!empty($download_files)): ?>
|
||||
<div class="download-box">
|
||||
<h3><i class="fa fa-download"></i> 첨부파일</h3>
|
||||
<ul class="download-list">
|
||||
<?php foreach ($download_files as $file):
|
||||
$ext = strtolower(get_extension($file['source']));
|
||||
$icon_class = 'fa-file-o';
|
||||
if ($ext == 'pdf') $icon_class = 'fa-file-pdf-o';
|
||||
else if (in_array($ext, ['jpg', 'jpeg', 'png', 'gif'])) $icon_class = 'fa-file-image-o';
|
||||
else if (in_array($ext, ['zip', 'rar', '7z'])) $icon_class = 'fa-file-archive-o';
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo $file['href']; ?>">
|
||||
<i class="fa <?php echo $icon_class; ?> file-icon" aria-hidden="true"></i>
|
||||
<span class="file-name"><?php echo $file['source']; ?></span>
|
||||
<span class="file-size">(<?php echo $file['size']; ?>)</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- 💡 [최종 수정] view-footer 섹션을 다시 추가합니다. -->
|
||||
<div class="view-footer">
|
||||
<div class="btn-group-left">
|
||||
<?php if ($prev_href): ?><a href="<?php echo $prev_href ?>" class="btn btn-secondary">이전글</a><?php endif; ?>
|
||||
<?php if ($next_href): ?><a href="<?php echo $next_href ?>" class="btn btn-secondary">다음글</a><?php endif; ?>
|
||||
</div>
|
||||
<div class="btn-group-right">
|
||||
<a href="<?php echo $list_href ?>" class="btn btn-primary">목록</a>
|
||||
<?php if ($update_href): ?><a href="<?php echo $update_href ?>" class="btn btn-secondary">수정</a><?php endif; ?>
|
||||
<?php if ($delete_href): ?><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;" class="btn btn-secondary">삭제</a><?php endif; ?>
|
||||
<?php if ($write_href): ?><a href="<?php echo $write_href ?>" class="btn btn-primary">글쓰기</a><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// 💡 [핵심] 페이드 효과 확장 파일을 불러옵니다. (journal 타입에서만 사용)
|
||||
if ($core_type === 'journal') {
|
||||
$fade_effect_skin = __DIR__ . '.journal/pdf_fade_effect.skin.php';
|
||||
if (file_exists($fade_effect_skin)) {
|
||||
include_once($fade_effect_skin);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
/**
|
||||
* rb.board.core :: write.skin.php
|
||||
* 💡 [최종판] '스마트 코어' 글쓰기 폼 - 에디터 전환 기능 및 wr_option 연동 오류 해결
|
||||
*/
|
||||
|
||||
$field_map = array(
|
||||
'summary' => 'wr_1',
|
||||
'featured' => 'wr_10',
|
||||
);
|
||||
$ebook_link_field = 'wr_link1';
|
||||
$cfg_write = isset($board_config['write']) ? $board_config['write'] : array();
|
||||
?>
|
||||
|
||||
<div class="board-write-container">
|
||||
<form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off" novalidate>
|
||||
<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 ?>">
|
||||
|
||||
<div class="write-form-group">
|
||||
<label for="wr_subject" class="form-label">제목<span class="required">*</span></label>
|
||||
<input type="text" name="wr_subject" value="<?php echo $subject ?>" id="wr_subject" required class="form-control" placeholder="제목을 입력하세요">
|
||||
</div>
|
||||
|
||||
<?php if ($is_category): ?>
|
||||
<div class="write-form-group">
|
||||
<label for="ca_name" class="form-label">카테고리<span class="required">*</span></label>
|
||||
<select name="ca_name" id="ca_name" required class="form-control"><option value="">선택하세요</option><?php echo $category_option ?></select>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($cfg_write['use_summary'])): ?>
|
||||
<div class="write-form-group">
|
||||
<label for="<?php echo $field_map['summary']; ?>" class="form-label"><?php echo $cfg_write['summary_label'] ?: '요약'; ?></label>
|
||||
<textarea name="<?php echo $field_map['summary']; ?>" id="<?php echo $field_map['summary']; ?>" class="form-control" rows="3" placeholder="<?php echo $cfg_write['summary_placeholder']; ?>"><?php echo $write[$field_map['summary']]; ?></textarea>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="write-form-group">
|
||||
<label for="wr_content" class="form-label">내용<span class="required">*</span></label>
|
||||
<div class="editor-toggle-buttons">
|
||||
<button type="button" class="btn btn-sm btn-editor-toggle <?php echo $is_dhtml_editor ? 'active' : ''; ?>" data-editor-type="dhtml">HTML 에디터</button>
|
||||
<button type="button" class="btn btn-sm btn-editor-toggle <?php echo $is_dhtml_editor ? '' : 'active'; ?>" data-editor-type="text">텍스트 에디터</button>
|
||||
</div>
|
||||
<div id="dhtml-editor-area" style="display: <?php echo $is_dhtml_editor ? 'block' : 'none'; ?>;">
|
||||
<?php if ($is_dhtml_editor) { echo $editor_html; } ?>
|
||||
</div>
|
||||
<div id="text-editor-area" style="display: <?php echo $is_dhtml_editor ? 'none' : 'block'; ?>;">
|
||||
<textarea id="wr_content_text" class="form-control" rows="10"><?php echo $content ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 💡 [핵심] 그누보드와 연동하기 위한 숨겨진 HTML 체크박스 -->
|
||||
<div style="display:none;">
|
||||
<?php if ($is_html) { ?>
|
||||
<input type="checkbox" id="html" name="html" value="html2" <?php echo ($html_value) ? "checked" : ""; ?>>
|
||||
<label for="html">html</label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<hr class="form-divider">
|
||||
|
||||
<?php for ($i=1; $is_file && $i<=$board['bo_upload_count']; $i++):
|
||||
$file_label = isset($cfg_write['file_labels'][$i]) ? $cfg_write['file_labels'][$i] : '첨부파일 #'.$i;
|
||||
$file_text = isset($cfg_write['file_texts'][$i]) ? $cfg_write['file_texts'][$i] : '';
|
||||
?>
|
||||
<div class="write-form-group file-upload-group">
|
||||
<label for="bf_file_<?php echo $i ?>" class="form-label"><?php echo $file_label; ?><?php if($i==1) echo '<span class="required">*</span>'; ?></label>
|
||||
<div class="file-input-wrapper">
|
||||
<input type="file" name="bf_file[]" id="bf_file_<?php echo $i ?>" title="파일첨부 <?php echo $i ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="form-control" <?php if ($w=='' && $i==1) echo 'required'; ?>>
|
||||
<?php if ($w == 'u' && $file[$i-1]['file']): ?>
|
||||
<span class="file-delete-wrap"><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 ?>"><?php echo $file[$i-1]['source'].'('.$file[$i-1]['size'].')'; ?> 파일 삭제</label></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if($file_text): ?><p class="form-text"><?php echo $file_text; ?></p><?php endif; ?>
|
||||
</div>
|
||||
<?php endfor; ?>
|
||||
|
||||
<hr class="form-divider">
|
||||
|
||||
<?php if ($is_admin): ?>
|
||||
<div class="admin-options-group">
|
||||
<h3 class="form-section-title">관리자 전용 설정</h3>
|
||||
<div class="write-form-group">
|
||||
<label class="form-check-label"><input type="checkbox" name="<?php echo $field_map['featured']; ?>" value="Y" id="is_featured" <?php echo ($write[$field_map['featured']] == 'Y') ? 'checked' : ''; ?>> 이 글을 '지정 최신글'로 설정합니다. (최대 6개)</label>
|
||||
</div>
|
||||
<div class="write-form-group" id="ebook-link-group" style="display: <?php echo ($write[$field_map['featured']] == 'Y') ? 'block' : 'none'; ?>;">
|
||||
<label for="<?php echo $ebook_link_field; ?>" class="form-label">E-book 링크</label>
|
||||
<input type="url" name="<?php echo $ebook_link_field; ?>" value="<?php echo $write[$ebook_link_field]; ?>" id="<?php echo $ebook_link_field; ?>" class="form-control" placeholder="https://example.com/ebook/123">
|
||||
<p class="form-text">'지정 최신글'로 설정했을 경우, 클릭 시 이동할 이북 주소를 입력하세요.</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="write-form-footer">
|
||||
<a href="<?php echo get_pretty_url($bo_table); ?>" class="btn btn-secondary">취소</a>
|
||||
<button type="submit" id="btn_submit" accesskey="s" class="btn btn-primary">작성완료</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const isFeaturedCheckbox = document.getElementById('is_featured');
|
||||
const ebookLinkGroup = document.getElementById('ebook-link-group');
|
||||
if (isFeaturedCheckbox && ebookLinkGroup) {
|
||||
isFeaturedCheckbox.addEventListener('change', function() {
|
||||
ebookLinkGroup.style.display = this.checked ? 'block' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
const dhtmlEditorArea = document.getElementById('dhtml-editor-area');
|
||||
const textEditorArea = document.getElementById('text-editor-area');
|
||||
const editorToggleButtons = document.querySelectorAll('.btn-editor-toggle');
|
||||
const wrContentTextarea = document.getElementById('wr_content_text');
|
||||
const htmlCheckbox = document.getElementById('html'); // 💡 [핵심] 숨겨진 html 체크박스
|
||||
|
||||
function setEditorMode(isDhtml) {
|
||||
if (isDhtml) {
|
||||
dhtmlEditorArea.style.display = 'block';
|
||||
textEditorArea.style.display = 'none';
|
||||
if (htmlCheckbox) htmlCheckbox.checked = true; // 💡 [핵심] HTML 모드일 때 체크
|
||||
} else {
|
||||
dhtmlEditorArea.style.display = 'none';
|
||||
textEditorArea.style.display = 'block';
|
||||
if (htmlCheckbox) htmlCheckbox.checked = false; // 💡 [핵심] 텍스트 모드일 때 체크 해제
|
||||
}
|
||||
editorToggleButtons.forEach(btn => {
|
||||
if ((btn.dataset.editorType === 'dhtml' && isDhtml) || (btn.dataset.editorType === 'text' && !isDhtml)) {
|
||||
btn.classList.add('active');
|
||||
} else {
|
||||
btn.classList.remove('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 초기 에디터 모드 설정
|
||||
setEditorMode(<?php echo $is_dhtml_editor ? 'true' : 'false'; ?>);
|
||||
|
||||
editorToggleButtons.forEach(button => {
|
||||
button.addEventListener('click', function() {
|
||||
const type = this.dataset.editorType;
|
||||
setEditorMode(type === 'dhtml');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function fwrite_submit(f) {
|
||||
// 💡 [핵심] 그누보드 에디터의 제출 로직을 항상 호출하여 wr_content 필드를 업데이트합니다.
|
||||
<?php echo $editor_js; ?>
|
||||
|
||||
// 텍스트 에디터가 활성화된 경우, 그 내용을 wr_content 필드로 옮겨줍니다.
|
||||
const textEditorArea = document.getElementById('text-editor-area');
|
||||
if (textEditorArea.style.display === 'block') {
|
||||
f.wr_content.value = document.getElementById('wr_content_text').value;
|
||||
}
|
||||
|
||||
// 최종적으로 wr_content 필드의 내용이 비어있는지 확인합니다.
|
||||
if (f.wr_content.value.trim() === '') {
|
||||
alert('내용을 입력해주세요.');
|
||||
// 활성화된 에디터에 포커스
|
||||
if (document.getElementById('dhtml-editor-area').style.display === 'block' && typeof CKEDITOR !== 'undefined' && CKEDITOR.instances.wr_content) {
|
||||
CKEDITOR.instances.wr_content.focus();
|
||||
} else {
|
||||
document.getElementById('wr_content_text').focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user