first commit 2
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
/**
|
||||
* rb.board.core.coverage :: list.skin.php
|
||||
* '심층취재' 타입 전용 목록 페이지
|
||||
*/
|
||||
|
||||
// 💡 [추가] 메인 노출 개수 관련 로직
|
||||
$main_view_max = 'N/A';
|
||||
$main_display_count = 0;
|
||||
|
||||
if ($is_admin) {
|
||||
// 게시판 여분필드(bo_1 ~ bo_10) 중 제목이 'main_view_max'인 필드의 값을 가져옵니다.
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
if (isset($board['bo_'.$i.'_subj']) && $board['bo_'.$i.'_subj'] == 'main_view_max') {
|
||||
$main_view_max = $board['bo_'.$i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 현재 메인에 노출된 글의 개수를 카운트합니다.
|
||||
$sql_count = "SELECT COUNT(*) as cnt FROM {$g5['write_prefix']}{$bo_table} WHERE wr_8 = 'Y'";
|
||||
$row_count = sql_fetch($sql_count);
|
||||
$main_display_count = $row_count['cnt'];
|
||||
|
||||
// 최대값이 설정되지 않았거나, 숫자가 아니거나, 비어있으면 '무제한'으로 표시
|
||||
if ($main_view_max === 'N/A' || $main_view_max === '' || !is_numeric($main_view_max)) {
|
||||
$main_view_max = '∞';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 뷰 모드 설정
|
||||
$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',
|
||||
'featured' => 'wr_10',
|
||||
);
|
||||
$ebook_link_field = 'wr_link1';
|
||||
|
||||
// '지정 최신글'과 '일반글'을 분리
|
||||
$featured_list = array();
|
||||
$regular_list = array();
|
||||
foreach ($list as $item) {
|
||||
if ($item[$field_map['featured']] == 'Y') {
|
||||
$featured_list[] = $item;
|
||||
} else {
|
||||
$regular_list[] = $item;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div 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
|
||||
<?php if ($is_admin): ?>
|
||||
<span class="main-display-count">(메인 노출: <?php echo $main_display_count; ?> / <?php echo $main_view_max; ?>)</span>
|
||||
<?php endif; ?>
|
||||
</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 class="board-list-wrapper" data-view-mode="<?php echo $view_mode; ?>">
|
||||
<?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);
|
||||
// var_dump($thumb);
|
||||
$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>
|
||||
<style>
|
||||
.main-display-count {
|
||||
margin-left: 10px;
|
||||
font-size: 0.9em;
|
||||
color: #777;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
/**
|
||||
* rb.board.core.coverage :: view.skin.php
|
||||
* '심층취재' 타입 전용 뷰어 - 본문/이미지 출력 및 콘텐츠 타입에 따른 렌더링 담당
|
||||
*/
|
||||
|
||||
if (!function_exists('get_extension')) {
|
||||
function get_extension($filename) {
|
||||
$filename = basename($filename);
|
||||
return substr(strrchr($filename, "."), 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 💡 [핵심] 첨부파일 재구성: 썸네일(첫번째 파일)을 제외하고, 본문 이미지를 구성합니다.
|
||||
$body_images = 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];
|
||||
$ext = strtolower(get_extension($file['source']));
|
||||
|
||||
// 이미지 파일이면 본문 이미지 배열에 추가
|
||||
if (in_array($ext, ['jpg', 'jpeg', 'png', 'gif'])) {
|
||||
$body_images[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="coverage-board">
|
||||
<!-- 💡 [추가] 관리자용 메인 노출 상태 표시 -->
|
||||
<?php if ($is_admin && $view['wr_8'] == 'Y'): ?>
|
||||
<div class="admin-option-item">
|
||||
<span class="option-text">💡 이 글은 메인 화면 포트폴리오 영역에 노출되고 있습니다.</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- 💡 [핵심] 본문 내용을 콘텐츠 타입에 따라 올바르게 출력합니다. -->
|
||||
<div class="view-detail-content">
|
||||
<?php
|
||||
// HTML 에디터 사용 여부에 따라 conv_content 처리
|
||||
$html = 1;
|
||||
if (strstr($view['wr_option'], 'html1')) {
|
||||
$html = 1;
|
||||
} else if (strstr($view['wr_option'], 'html2')) {
|
||||
$html = 2;
|
||||
}
|
||||
|
||||
// 💡 [최종 수정] HTML 에디터로 작성된 경우 conv_content로 HTML 렌더링, 아니면 줄바꿈 유지 텍스트
|
||||
if ($html > 0) {
|
||||
// 💡 [핵심] g5_dynamic_img_url 함수를 적용하여 이미지 경로를 동적으로 변경합니다.
|
||||
echo g5_dynamic_img_url(conv_content($view['wr_content'], $html));
|
||||
} else {
|
||||
echo nl2br(get_text($view['wr_content']));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($body_images)): ?>
|
||||
<div class="view-body-images">
|
||||
<?php foreach ($body_images as $image): ?>
|
||||
<figure class="body-image-item">
|
||||
<img src="<?php echo $image['path'].'/'.$image['file']; ?>" alt="<?php echo $image['source']; ?>">
|
||||
<figcaption><?php echo $image['content']; ?></figcaption>
|
||||
</figure>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<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>
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
/**
|
||||
* rb.board.core.coverage :: write.skin.php
|
||||
* 💡 [최종 수정] 그누보드 표준 방식을 준수하는 에디터 전환 기능
|
||||
*/
|
||||
|
||||
// 💡 [추가] 메인 노출 관련 로직
|
||||
$main_view_max = null;
|
||||
|
||||
// 게시판 여분필드(bo_1 ~ bo_10) 중 제목이 'main_view_max'인 필드의 값을 가져옵니다.
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
if (isset($board['bo_'.$i.'_subj']) && $board['bo_'.$i.'_subj'] == 'main_view_max') {
|
||||
$main_view_max = $board['bo_'.$i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$main_display_count = 0;
|
||||
$main_display_titles = '';
|
||||
|
||||
// main_view_max가 숫자이거나, 비어있거나, null일 때만 유효한 것으로 간주
|
||||
$is_main_view_max_valid = ($main_view_max === null || $main_view_max === '' || is_numeric($main_view_max));
|
||||
|
||||
if ($is_main_view_max_valid && is_numeric($main_view_max) && $main_view_max !== '') {
|
||||
$sql = "SELECT wr_subject FROM {$g5['write_prefix']}{$bo_table} WHERE wr_8 = 'Y'";
|
||||
if ($w == 'u') {
|
||||
// 수정 모드에서는 현재 글을 제외하고 카운트
|
||||
$sql .= " AND wr_id != '{$wr_id}'";
|
||||
}
|
||||
$result = sql_query($sql);
|
||||
$titles = array();
|
||||
while ($row = sql_fetch_array($result)) {
|
||||
$titles[] = $row['wr_subject'];
|
||||
}
|
||||
$main_display_count = count($titles);
|
||||
$main_display_titles = implode(', ', $titles);
|
||||
}
|
||||
|
||||
|
||||
$field_map = array(
|
||||
'summary' => 'wr_1',
|
||||
'featured' => 'wr_10',
|
||||
'main_display' => 'wr_8', // 💡 [추가] 메인 화면 노출 필드 매핑
|
||||
);
|
||||
$ebook_link_field = 'wr_link1';
|
||||
$cfg_write = isset($board_config['write']) ? $board_config['write'] : array();
|
||||
?>
|
||||
|
||||
<div id="coverage-board" 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>
|
||||
|
||||
<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' && isset($file[$i-1]) && !empty($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="admin-option-item">
|
||||
<label class="form-check-label" for="is_main_display">
|
||||
<input type="checkbox" name="<?php echo $field_map['main_display']; ?>" value="Y" id="is_main_display" class="admin-option-checkbox" <?php echo isset($write[$field_map['main_display']]) && ($write[$field_map['main_display']] == 'Y') ? 'checked' : ''; ?>>
|
||||
<span class="option-text">메인 화면 노출 (체크 시 메인 페이지 포트폴리오 영역에 노출됩니다)</span>
|
||||
</label>
|
||||
</div>
|
||||
<!-- <div class="admin-option-item">
|
||||
<label class="form-check-label" for="is_featured">
|
||||
<input type="checkbox" name="<?php /*echo $field_map['featured']; */?>" value="Y" id="is_featured" class="admin-option-checkbox" <?php /*echo ($write[$field_map['featured']] == 'Y') ? 'checked' : ''; */?>>
|
||||
<span class="option-text">이 글을 '지정 최신글'로 설정합니다. (최대 6개)</span>
|
||||
</label>
|
||||
<div id="ebook-link-group" style="display: <?php /*echo ($write[$field_map['featured']] == 'Y') ? 'block' : 'none'; */?>; margin-top: 15px;">
|
||||
<label for="<?php /*echo $ebook_link_field; */?>" class="form-label" style="margin-top:0;">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>-->
|
||||
</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');
|
||||
|
||||
function setEditorMode(isDhtml) {
|
||||
if (isDhtml) {
|
||||
dhtmlEditorArea.style.display = 'block';
|
||||
textEditorArea.style.display = 'none';
|
||||
if (htmlCheckbox) htmlCheckbox.checked = true;
|
||||
if (typeof CKEDITOR !== 'undefined' && CKEDITOR.instances.wr_content) {
|
||||
CKEDITOR.instances.wr_content.setData(wrContentTextarea.value);
|
||||
}
|
||||
} else {
|
||||
dhtmlEditorArea.style.display = 'none';
|
||||
textEditorArea.style.display = 'block';
|
||||
if (htmlCheckbox) htmlCheckbox.checked = false;
|
||||
if (typeof CKEDITOR !== 'undefined' && CKEDITOR.instances.wr_content) {
|
||||
wrContentTextarea.value = CKEDITOR.instances.wr_content.getData();
|
||||
}
|
||||
}
|
||||
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) {
|
||||
const textEditorArea = document.getElementById('text-editor-area');
|
||||
if (textEditorArea.style.display === 'block') {
|
||||
f.wr_content.value = document.getElementById('wr_content_text').value;
|
||||
}
|
||||
|
||||
// 💡 [추가] 메인 노출 개수 제한 검사
|
||||
const mainDisplayCheckbox = document.getElementById('is_main_display');
|
||||
if (mainDisplayCheckbox && mainDisplayCheckbox.checked) {
|
||||
const mainViewMax = <?php echo json_encode($main_view_max); ?>;
|
||||
const isMainViewMaxValid = <?php echo json_encode($is_main_view_max_valid); ?>;
|
||||
|
||||
if (!isMainViewMaxValid) {
|
||||
alert('게시판의 "main_view_max" 여분 필드 설정값이 숫자가 아닙니다. 관리자에게 문의하여 설정을 수정해주세요.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mainViewMax !== null && mainViewMax !== '' && !isNaN(parseInt(mainViewMax))) {
|
||||
const mainViewMaxInt = parseInt(mainViewMax, 10);
|
||||
const mainDisplayCount = <?php echo (int)$main_display_count; ?>;
|
||||
|
||||
if (mainDisplayCount >= mainViewMaxInt) {
|
||||
const mainDisplayTitles = <?php echo json_encode($main_display_titles); ?>;
|
||||
alert('메인 노출 최대 개수(' + mainViewMaxInt + '개)를 초과하여 더 이상 설정할 수 없습니다.\n\n현재 설정된 글:\n' + mainDisplayTitles);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<?php echo $editor_js; ?>
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user