first commit 2
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
|
||||
|
||||
// 이 스킨의 전용 스타일시트를 불러옵니다.
|
||||
$style_ver = file_exists($board_skin_path . '/style.css') ? filemtime($board_skin_path . '/style.css') : G5_CSS_VER;
|
||||
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . $style_ver . '">', 0);
|
||||
|
||||
// 노출 상태 계산
|
||||
$status_text = '정보 없음';
|
||||
$status_class = 'expired';
|
||||
$is_hidden = ($view['wr_10'] == '1');
|
||||
$today = G5_TIME_YMD;
|
||||
|
||||
if ($is_hidden) {
|
||||
$status_text = '숨김 (노출 안 함)';
|
||||
$status_class = 'hidden';
|
||||
} else if ($view['wr_9'] == 'RESERVED') {
|
||||
$start_date = $view['wr_2'];
|
||||
$end_date = $view['wr_3'];
|
||||
|
||||
if ($today >= $start_date && $today <= $end_date) {
|
||||
$status_text = '노출중 (예약)';
|
||||
$status_class = 'active';
|
||||
} elseif ($today < $start_date) {
|
||||
$status_text = '예약됨 (대기)';
|
||||
$status_class = 'scheduled';
|
||||
} else {
|
||||
$status_text = '기간만료';
|
||||
$status_class = 'expired';
|
||||
}
|
||||
} else {
|
||||
$status_text = '즉시 노출';
|
||||
$status_class = 'active';
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="bo_v">
|
||||
<h2>제목</h2>
|
||||
<h3 id="bo_v_title">
|
||||
<?php if ($category_name) { ?><span class="item-category"><?php echo $view['ca_name']; ?></span><?php } ?>
|
||||
<?php echo cut_str(get_text($view['wr_subject']), 70); // 글제목 출력 ?>
|
||||
<span class="status-badge status-<?php echo $status_class; ?>" style="font-size: 14px; vertical-align: middle; margin-left: 10px;"><?php echo $status_text; ?></span>
|
||||
</h3>
|
||||
|
||||
<div id="bo_v_info">
|
||||
<fieldset class="write_div">
|
||||
<h3 class="frm_label" style="margin-bottom: 0;"><strong>노출 설정</strong></h3>
|
||||
<div class="option_group">
|
||||
<label>
|
||||
<input type="radio" name="wr_9_view" value="IMMEDIATE" <?php echo ($view['wr_9'] !== 'RESERVED') ? 'checked' : ''; ?> disabled>
|
||||
<span class="custom-radio"></span> 즉시 노출
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="wr_9_view" value="RESERVED" <?php echo ($view['wr_9'] === 'RESERVED') ? 'checked' : ''; ?> disabled>
|
||||
<span class="custom-radio"></span> 예약 노출
|
||||
</label>
|
||||
<!-- 💡 [수정] 숨김 설정 표시 -->
|
||||
<label style="margin-left: 20px;">
|
||||
<input type="checkbox" name="wr_10_view" value="1" <?php echo $is_hidden ? 'checked': '0' ; ?> disabled>
|
||||
<span class="custom-checkbox"></span> 숨김 (노출 안 함)
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php if ($view['wr_9'] === 'RESERVED') { ?>
|
||||
<div id="reservation_fields" class="write_div">
|
||||
<div class="date_picker_group">
|
||||
<div class="date_item">
|
||||
<label class="frm_label"><?php echo $board['bo_2_subj'] ?: '시작일' ?></label>
|
||||
<div class="frm_static"><?php echo $view['wr_2']; ?></div>
|
||||
</div>
|
||||
<span class="date_divider">~</span>
|
||||
<div class="date_item">
|
||||
<label class="frm_label"><?php echo $board['bo_3_subj'] ?: '종료일' ?></label>
|
||||
<div class="frm_static"><?php echo $view['wr_3']; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<!-- 💡 [추가] 링크 정보 표시 -->
|
||||
<?php if ($view['wr_link1']) { ?>
|
||||
<div class="write_div">
|
||||
<h3 class="frm_label"><strong>링크 #1</strong></h3>
|
||||
<div class="frm_static">
|
||||
<a href="<?php echo $view['wr_link1']; ?>" target="_blank"><?php echo $view['wr_link1']; ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div id="bo_v_atc">
|
||||
<!-- 본문 내용 -->
|
||||
<div id="write_div">
|
||||
<h3 >상세 내용</h3>
|
||||
<div class="view_content">
|
||||
<?php echo conv_content($view['wr_content'], 1); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// 📌 [핵심] 첨부파일을 하단에 갤러리 형태로 표시합니다.
|
||||
if (isset($view['file']) && count($view['file']) > 0) {
|
||||
echo "<div id=\"bo_v_gallery\">\n";
|
||||
echo "<h3>첨부 파일</h3>";
|
||||
echo "<div class='gallery_grid'>";
|
||||
for ($i = 0; $i < $view['file']['count']; $i++) {
|
||||
$file = $view['file'][$i];
|
||||
if (empty($file['file'])) continue;
|
||||
|
||||
$file_ext = strtolower(pathinfo($file['file'], PATHINFO_EXTENSION));
|
||||
$is_image = in_array($file_ext, ['gif', 'jpg', 'jpeg', 'png', 'webp']);
|
||||
$file_url = $file['path'].'/'.$file['file'];
|
||||
|
||||
if ($is_image) {
|
||||
// 썸네일 생성
|
||||
$source_path = G5_DATA_PATH.'/file/'.$bo_table;
|
||||
$thumb = thumbnail($file['file'], $source_path, $source_path, 200, 200, false, true);
|
||||
$thumb_url = G5_DATA_URL.'/file/'.$bo_table.'/'.$thumb;
|
||||
|
||||
echo '<a href="'.$file_url.'" class="view_image_link">';
|
||||
echo '<img src="'.$thumb_url.'" alt="'.get_text($file['source']).'">';
|
||||
echo '</a>';
|
||||
} else {
|
||||
// 이미지가 아닌 파일은 다운로드 링크 제공
|
||||
echo '<div class="gallery_item_other">';
|
||||
echo '<a href="'.$file['href'].'" class="view_file_link" download>';
|
||||
echo '<i class="fa fa-download"></i> '.get_text($file['source']);
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
echo "</div>"; // .gallery_grid
|
||||
echo "</div>\n"; // #bo_v_gallery
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="bo_v_bot">
|
||||
<div class="btn_area">
|
||||
<?php if ($update_href) { ?><a href="<?php echo $update_href ?>" class="btn_b02 btn">수정</a><?php } ?>
|
||||
<?php if ($delete_href) { ?><a href="<?php echo $delete_href ?>" onclick="del(this.href); return false;" class="btn_b02 btn">삭제</a><?php } ?>
|
||||
<?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn_b02 btn">글쓰기</a><?php } ?>
|
||||
<a href="<?php echo $list_href ?>" class="btn_b01 btn">목록</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 이미지 팝업(라이트박스) HTML과 스크립트 -->
|
||||
<div id="image_lightbox" class="image_lightbox">
|
||||
<span class="lightbox_close">×</span>
|
||||
<img class="lightbox_content" id="lightbox_image">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const lightbox = document.getElementById('image_lightbox');
|
||||
const lightboxImage = document.getElementById('lightbox_image');
|
||||
const imageLinks = document.querySelectorAll('.view_image_link');
|
||||
const closeBtn = document.querySelector('.lightbox_close');
|
||||
|
||||
if (!lightbox || !imageLinks.length) return;
|
||||
|
||||
imageLinks.forEach(link => {
|
||||
// 💡 [개선] 이미지 파일이 아닌 경우 라이트박스 이벤트를 적용하지 않습니다.
|
||||
if (!link.hasAttribute('download')) {
|
||||
link.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
lightboxImage.src = this.href;
|
||||
lightbox.style.display = 'flex';
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function closeModal() {
|
||||
lightbox.style.display = 'none';
|
||||
lightboxImage.src = '';
|
||||
}
|
||||
|
||||
if(closeBtn) {
|
||||
closeBtn.addEventListener('click', closeModal);
|
||||
}
|
||||
|
||||
lightbox.addEventListener('click', function(e) {
|
||||
if (e.target === lightbox) {
|
||||
closeModal();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape' && lightbox.style.display === 'flex') {
|
||||
closeModal();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user