first commit 2
This commit is contained in:
@@ -0,0 +1,331 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 1. 자식 스킨의 설정 파일을 로드합니다.
|
||||
$config_path = __DIR__ . '/config.php';
|
||||
if (file_exists($config_path)) {
|
||||
include_once($config_path);
|
||||
}
|
||||
|
||||
// 이 스킨의 전용 스타일시트와 자바스크립트를 불러옵니다.
|
||||
add_stylesheet('<link rel="stylesheet" href="' . $board_skin_url . '/style.css?ver=' . time() . '">', 0);
|
||||
add_javascript('<script src="' . $board_skin_url . '/js/list.js?ver=' . time() . '"></script>', 0);
|
||||
|
||||
// 수정 링크 생성 함수
|
||||
function write_url($wr_id)
|
||||
{
|
||||
global $bo_table, $qstr;
|
||||
return G5_BBS_URL . "/write.php?w=u&bo_table={$bo_table}&wr_id={$wr_id}&{$qstr}";
|
||||
}
|
||||
|
||||
// 삭제 링크 생성 함수
|
||||
function delete_url($href)
|
||||
{
|
||||
return $href . "&sw=delete";
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- ▼▼▼ [핵심 수정] JS에서 사용할 PHP 변수를 전역 JS 변수로 선언합니다. ▼▼▼ -->
|
||||
<script>
|
||||
const board_skin_url = "<?php echo $board_skin_url; ?>";
|
||||
</script>
|
||||
<!-- ▲▲▲ 여기까지 ▲▲▲ -->
|
||||
<main class="main-content-wrapper">
|
||||
<div class="three-column-layout container">
|
||||
<?php if (isset($reviews_skin_config['left_ad']) && $reviews_skin_config['left_ad'] === true): ?>
|
||||
<aside class="layout-sidebar-left reveal-up">
|
||||
<div class="sidebar-inner">
|
||||
<!-- <h3 class="sidebar-title">광고 영역</h3>-->
|
||||
<!-- 💡 [수정] 좌측 모듈 영역에 고유 ID 부여 -->
|
||||
<div class="flex_box flex_box_l" data-layout="main-left"></div>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
<main class="layout-main-content">
|
||||
<!-- 게시판 목록 시작 -->
|
||||
<div id="bo_list" class="bo-list-container">
|
||||
|
||||
<!-- 게시판 상단 정보 및 버튼 영역 -->
|
||||
<div class="bo-list-header">
|
||||
<div class="bo-list-total">
|
||||
<span>Total <?php echo number_format($total_count) ?>건</span>
|
||||
<span class="sound_only"><?php echo $page ?> 페이지</span>
|
||||
</div>
|
||||
|
||||
<div class="bo-list-buttons">
|
||||
<button type="button" id="view-toggle-btn" class="btn-view-toggle" title="카드형으로 보기">
|
||||
<i class="fa fa-th-large" aria-hidden="true"></i>
|
||||
</button>
|
||||
<?php if ($admin_href) { ?><a href="<?php echo $admin_href ?>" class="btn-admin">
|
||||
관리자</a><?php } ?>
|
||||
<?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn-write">
|
||||
글쓰기</a><?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form name="fboardlist" id="fboardlist" action="<?php echo G5_BBS_URL; ?>/board_list_update.php"
|
||||
onsubmit="return fboardlist_submit(this);" method="post">
|
||||
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
|
||||
<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="sca" value="<?php echo $sca ?>">
|
||||
<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 ?>">
|
||||
<input type="hidden" name="sw" value="">
|
||||
|
||||
<!-- 게시물 리스트 (보기 전환 컨테이너) -->
|
||||
<div id="bo_list_body" class="list-view">
|
||||
<?php if ($is_checkbox) { ?>
|
||||
<div class="list-chk-all">
|
||||
<input type="checkbox" id="chkall"
|
||||
onclick="if (this.checked) all_checked(true); else all_checked(false);"
|
||||
class="selec_chk">
|
||||
<label for="chkall"> 현재 페이지 게시물 전체선택</label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
for ($i = 0; $i < count($list); $i++) {
|
||||
|
||||
// --- 💡 [핵심 수정] 게시물 상세 정보 및 상태 정보 가져오기 ---
|
||||
$write_table = $g5['write_prefix'] . $bo_table;
|
||||
$post_data = get_write($write_table, $list[$i]['wr_id']);
|
||||
|
||||
// 1. 썸네일 이미지 가져오기
|
||||
$thumbnail = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], 280, 180);
|
||||
|
||||
// 2. 이미지가 없을 경우, 본문 내용의 일부를 가져오기
|
||||
$content_preview = '';
|
||||
if (!$thumbnail['src'] && isset($post_data['wr_content'])) {
|
||||
$content_preview = cut_str(strip_tags($post_data['wr_content']), 150);
|
||||
}
|
||||
|
||||
// 3. 노출 상태 정보 처리
|
||||
$status_text = '정보 없음';
|
||||
$status_class = 'expired';
|
||||
$reservation_period = '';
|
||||
$is_hidden = !empty($post_data['wr_10']); // wr_10 필드가 1이면 '숨김' 상태
|
||||
$today = G5_TIME_YMD;
|
||||
|
||||
if ($is_hidden) {
|
||||
$status_text = '숨김';
|
||||
$status_class = 'hidden';
|
||||
} else if (isset($post_data['wr_1'])) {
|
||||
if ($post_data['wr_1'] == 'RESERVED') {
|
||||
$start_date = $post_data['wr_2'];
|
||||
$end_date = $post_data['wr_3'];
|
||||
$reservation_period = $start_date . ' ~ ' . $end_date;
|
||||
|
||||
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 { // IMMEDIATE
|
||||
$status_text = '즉시 노출';
|
||||
$status_class = 'active';
|
||||
}
|
||||
}
|
||||
// --- 데이터 준비 끝 ---
|
||||
?>
|
||||
<!-- 1. 목록형 아이템 (bo-list-item) -->
|
||||
<div class="bo-list-item">
|
||||
<?php if ($is_checkbox) { ?>
|
||||
<div class="item-chk">
|
||||
<input type="checkbox" name="chk_wr_id[]"
|
||||
value="<?php echo $list[$i]['wr_id'] ?>"
|
||||
id="chk_wr_id_<?php echo $i ?>" class="selec_chk">
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="item-main">
|
||||
<div class="item-subject">
|
||||
<a href="<?php echo $list[$i]['href'] ?>" class="item-title">
|
||||
<?php echo $list[$i]['subject'] ?>
|
||||
</a>
|
||||
<?php if ($list[$i]['comment_cnt']) { ?><span
|
||||
class="item-comment-count"><?php echo $list[$i]['wr_comment']; ?></span><?php } ?>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<span class="item-author"><?php echo $list[$i]['name'] ?></span>
|
||||
<span class="item-date"><?php echo $list[$i]['datetime2'] ?></span>
|
||||
<span class="item-views">조회 <?php echo $list[$i]['wr_hit'] ?></span>
|
||||
<span class="item-status-wrapper">
|
||||
<span class="status-badge status-<?php echo $status_class; ?>"><?php echo $status_text; ?></span>
|
||||
<?php if ($reservation_period) { ?>
|
||||
<span class="reservation-info">(<?php echo $reservation_period; ?>)</span>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($is_admin) { ?>
|
||||
<div class="item-actions">
|
||||
<div class="actions-group">
|
||||
<strong class="item-actions-label">노출 여부</strong>
|
||||
<button type="button"
|
||||
class="btn-status-toggle <?php echo $is_hidden ? 'status-off' : 'status-on'; ?>"
|
||||
data-wr-id="<?php echo $list[$i]['wr_id']; ?>"
|
||||
title="<?php echo $is_hidden ? '노출 상태로 변경' : '숨김 상태로 변경'; ?>">
|
||||
<i class="fa <?php echo $is_hidden ? 'fa-toggle-off' : 'fa-toggle-on'; ?>"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="action-group">
|
||||
<a href="<?php echo write_url($list[$i]['wr_id']); ?>"
|
||||
class="btn-action btn-modify">수정</a>
|
||||
<a href="<?php echo delete_url($list[$i]['href']); ?>"
|
||||
class="btn-action btn-delete" onclick="return delete_confirm(this);">삭제</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<!-- 2. 카드형 아이템 (bo-card-item) -->
|
||||
<div class="bo-card-item">
|
||||
<a href="<?php echo $list[$i]['href'] ?>" class="card-link">
|
||||
<div class="card-thumbnail">
|
||||
<?php if ($thumbnail['src']) { ?>
|
||||
<img src="<?php echo $thumbnail['src']; ?>"
|
||||
alt="<?php echo $thumbnail['alt']; ?>">
|
||||
<?php } else { ?>
|
||||
<div class="card-content-preview">
|
||||
<p><?php echo $content_preview ? $content_preview : '내용이 없습니다.'; ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<div class="card-subject">
|
||||
<?php echo $list[$i]['subject'] ?>
|
||||
<?php if ($list[$i]['comment_cnt']) { ?><span
|
||||
class="item-comment-count"><?php echo $list[$i]['wr_comment']; ?></span><?php } ?>
|
||||
</div>
|
||||
<div class="card-status-wrapper">
|
||||
<span class="status-badge status-<?php echo $status_class; ?>"><?php echo $status_text; ?></span>
|
||||
<?php if ($reservation_period) { ?>
|
||||
<span class="reservation-info"><?php echo $reservation_period; ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<!-- ▼▼▼ [핵심 추가] 카드형 보기용 토글 스위치 ▼▼▼ -->
|
||||
<?php if ($is_admin) { ?>
|
||||
<div class="card-actions">
|
||||
<div class="action-group">
|
||||
<strong class="item-actions-label">노출 여부</strong>
|
||||
<button type="button"
|
||||
class="btn-status-toggle <?php echo $is_hidden ? 'status-off' : 'status-on'; ?>"
|
||||
data-wr-id="<?php echo $list[$i]['wr_id']; ?>"
|
||||
title="<?php echo $is_hidden ? '노출 상태로 변경' : '숨김 상태로 변경'; ?>">
|
||||
<i class="fa <?php echo $is_hidden ? 'fa-toggle-off' : 'fa-toggle-on'; ?>"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="action-group">
|
||||
<a href="<?php echo write_url($list[$i]['wr_id']); ?>"
|
||||
class="btn-action btn-modify">수정</a>
|
||||
<a href="<?php echo delete_url($list[$i]['href']); ?>"
|
||||
class="btn-action btn-delete" onclick="return delete_confirm(this);">삭제</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- ▲▲▲ 여기까지 ▲▲▲ -->
|
||||
|
||||
<?php if ($is_checkbox) { ?>
|
||||
<div class="card-chk">
|
||||
<input type="checkbox" name="chk_wr_id_card[]"
|
||||
value="<?php echo $list[$i]['wr_id'] ?>"
|
||||
id="chk_wr_id_card_<?php echo $i ?>" class="selec_chk">
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (count($list) == 0) {
|
||||
echo '<div class="empty-list">게시물이 없습니다.</div>';
|
||||
} ?>
|
||||
</div>
|
||||
|
||||
<?php if ($is_checkbox) { ?>
|
||||
<div class="bo-list-footer">
|
||||
<button type="submit" name="btn_submit" value="선택삭제"
|
||||
onclick="document.pressed=this.value"
|
||||
class="btn-admin">선택삭제
|
||||
</button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
||||
<div class="bo-list-bottom-wrapper">
|
||||
<div class="bo-pagination"><?php echo $write_pages; ?></div>
|
||||
<fieldset id="bo_sch" class="bo-search-box">
|
||||
<legend class="sound_only">게시물 검색</legend>
|
||||
<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 ?>">
|
||||
<input type="hidden" name="sop" value="and">
|
||||
<select name="sfl" id="sfl"><?php echo get_board_sfl_select_options($sfl); ?></select>
|
||||
<input type="text" name="stx" value="<?php echo stripslashes($stx) ?>" required id="stx"
|
||||
class="sch-input" size="25" maxlength="20" placeholder="검색어를 입력해주세요">
|
||||
<button type="submit" class="sch-btn">검색</button>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<?php if (isset($reviews_skin_config['right_ad']) && $reviews_skin_config['right_ad'] === true): ?>
|
||||
<aside class="layout-sidebar-right reveal-up">
|
||||
<div class="sidebar-inner">
|
||||
<!-- <h3 class="sidebar-title">광고 영역</h3>-->
|
||||
<!-- 💡 [수정] 우측 모듈 영역에 고유 ID 부여 -->
|
||||
<div class="flex_box flex_box_r" data-layout="main-right"></div>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</main>
|
||||
<?php if ($is_checkbox) { ?>
|
||||
<script>
|
||||
function all_checked(sw) {
|
||||
var f = document.fboardlist;
|
||||
for (var i = 0; i < f.length; i++) {
|
||||
if (f.elements[i].name == "chk_wr_id[]" || f.elements[i].name == "chk_wr_id_card[]")
|
||||
f.elements[i].checked = sw;
|
||||
}
|
||||
}
|
||||
|
||||
function fboardlist_submit(f) {
|
||||
var chk_count = 0;
|
||||
for (var i = 0; i < f.length; i++) {
|
||||
if ((f.elements[i].name == "chk_wr_id[]" || f.elements[i].name == "chk_wr_id_card[]") && f.elements[i].checked)
|
||||
chk_count++;
|
||||
}
|
||||
|
||||
if (!chk_count) {
|
||||
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (document.pressed == "선택삭제") {
|
||||
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다."))
|
||||
return false;
|
||||
f.removeAttribute("target");
|
||||
f.action = "<?php echo G5_BBS_URL; ?>/board_list_update.php";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function delete_confirm(link) {
|
||||
if (confirm("한번 삭제한 자료는 복구할 수 없습니다.\n\n정말 삭제하시겠습니까?")) {
|
||||
window.location.href = link.href;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
<?php } ?>
|
||||
Reference in New Issue
Block a user