first commit 2
This commit is contained in:
@@ -0,0 +1,253 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 0. 중앙 광고 설정 파일을 로드합니다.
|
||||
include_once(G5_THEME_PATH . '/skin/board/board_ad_config.php');
|
||||
|
||||
// 1. 자식 스킨의 설정 파일을 로드합니다.
|
||||
$config_path = __DIR__ . '/config.php';
|
||||
if (file_exists($config_path)) {
|
||||
include_once($config_path);
|
||||
}
|
||||
|
||||
// 이 스킨의 전용 스타일시트와 자바스크립트를 불러옵니다.
|
||||
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/css/style.css?ver='.G5_SERVER_TIME.'">', 0);
|
||||
add_javascript('<script src="'.$board_skin_url.'/js/script.js?ver='.G5_SERVER_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";
|
||||
}
|
||||
|
||||
$default_view_mode = isset($board_config['list']['default_view_mode']) ? $board_config['list']['default_view_mode'] : 'list';
|
||||
$view_mode = get_cookie('board_' . $bo_table . '_view_mode') ?: $default_view_mode;
|
||||
?>
|
||||
|
||||
<div id="notice-board">
|
||||
<div class="three-column-layout container">
|
||||
<?php if (isset($board_ad_config['list_ad']['left']) && $board_ad_config['list_ad']['left'] === true): ?>
|
||||
<aside class="layout-sidebar-left">
|
||||
<div class="sidebar-inner">
|
||||
<?php if($is_admin) { ?> <h3 class="sidebar-title">좌측 광고 영역</h3> <?php } ?>
|
||||
<div class="flex_box flex_box_l" data-layout="notice-list-left"></div>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
|
||||
<main class="layout-main-content1">
|
||||
<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" class="btn-view-toggle" onclick="toggleViewMode()" title="보기 모드 전환">
|
||||
<i class="fa <?php echo ($view_mode === 'card') ? 'fa-list' : 'fa-th-large'; ?>" id="view-mode-icon"></i>
|
||||
</button>
|
||||
<?php if ($admin_href) { ?><a href="<?php echo $admin_href ?>" class="btn btn-secondary">관리자</a><?php } ?>
|
||||
<?php if ($write_href) { ?><a href="<?php echo $write_href ?>" class="btn btn-primary">글쓰기</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="">
|
||||
|
||||
<!-- 전체 선택 체크박스 -->
|
||||
<?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"><span></span> 전체선택</label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<!-- 💡 [수정] data-view-mode 속성으로 CSS 제어 -->
|
||||
<div id="bo_list_body" data-view-mode="<?php echo $view_mode; ?>">
|
||||
|
||||
<?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']);
|
||||
$thumbnail = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], 280, 180);
|
||||
|
||||
$status_text = '노출중';
|
||||
$status_class = 'active';
|
||||
if (!empty($post_data['wr_10'])) {
|
||||
$status_text = '숨김';
|
||||
$status_class = 'hidden';
|
||||
} elseif (isset($post_data['wr_9']) && $post_data['wr_9'] == 'RESERVED') {
|
||||
$today = G5_TIME_YMD;
|
||||
if ($today < $post_data['wr_2']) { $status_text = '예약됨'; $status_class = 'scheduled'; }
|
||||
elseif ($today > $post_data['wr_3']) { $status_text = '만료됨'; $status_class = 'expired'; }
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- 1. 리스트형 아이템 -->
|
||||
<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_list_<?php echo $i ?>" class="selec_chk">
|
||||
<label for="chk_wr_id_list_<?php echo $i ?>"><span></span></label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="item-subject">
|
||||
<a href="<?php echo $list[$i]['href'] ?>">
|
||||
<?php echo $list[$i]['subject'] ?>
|
||||
<?php if ($list[$i]['comment_cnt']) { ?><span class="cnt_cmt"><?php echo $list[$i]['wr_comment']; ?></span><?php } ?>
|
||||
</a>
|
||||
<span class="status-badge status-<?php echo $status_class; ?>"><?php echo $status_text; ?></span>
|
||||
</div>
|
||||
<div class="item-info">
|
||||
<span><?php echo $list[$i]['name'] ?></span>
|
||||
<span><?php echo $list[$i]['datetime2'] ?></span>
|
||||
<span>조회 <?php echo $list[$i]['wr_hit'] ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 2. 카드형 아이템 -->
|
||||
<div class="bo-card-item">
|
||||
<?php if ($is_checkbox) { ?>
|
||||
<div class="card-chk">
|
||||
<input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_card_<?php echo $i ?>" class="selec_chk">
|
||||
<label for="chk_wr_id_card_<?php echo $i ?>"><span></span></label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<a href="<?php echo $list[$i]['href'] ?>" class="card-link">
|
||||
<div class="card-thumb">
|
||||
<?php if ($thumbnail['src']) { ?>
|
||||
<img src="<?php echo $thumbnail['src']; ?>" alt="<?php echo $thumbnail['alt']; ?>">
|
||||
<?php } else { ?>
|
||||
<div class="no-img"><i class="fa fa-image"></i></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="card-title">
|
||||
<?php echo $list[$i]['subject'] ?>
|
||||
<span class="status-badge status-<?php echo $status_class; ?>"><?php echo $status_text; ?></span>
|
||||
</div>
|
||||
<div class="card-info">
|
||||
<span><?php echo $list[$i]['name'] ?></span>
|
||||
<span><?php echo $list[$i]['datetime2'] ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (count($list) == 0) { echo '<div class="empty-list">게시물이 없습니다.</div>'; } ?>
|
||||
</div>
|
||||
|
||||
<?php if ($is_checkbox) { ?>
|
||||
<div class="bo-list-footer" style="margin-top:20px; text-align:right;">
|
||||
<button type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value" class="btn btn-danger">선택삭제</button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</form>
|
||||
|
||||
<div class="bo-list-bottom-wrapper" style="margin-top:30px;">
|
||||
<div class="bo-pagination">
|
||||
<?php echo $write_pages; ?>
|
||||
</div>
|
||||
|
||||
<fieldset id="bo_sch" class="bo-search-box">
|
||||
<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 btn btn-secondary">검색</button>
|
||||
</form>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php if (isset($board_ad_config['list_ad']['right']) && $board_ad_config['list_ad']['right'] === true): ?>
|
||||
<aside class="layout-sidebar-right">
|
||||
<div class="sidebar-inner">
|
||||
<?php if($is_admin) { ?> <h3 class="sidebar-title">우측 광고 영역</h3> <?php } ?>
|
||||
<div class="flex_box flex_box_r" data-layout="notice-list-right"></div>
|
||||
</div>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 뷰 모드 전환 함수
|
||||
function toggleViewMode() {
|
||||
var body = document.getElementById('bo_list_body');
|
||||
var icon = document.getElementById('view-mode-icon');
|
||||
var currentMode = body.getAttribute('data-view-mode');
|
||||
var newMode = (currentMode === 'list') ? 'card' : 'list';
|
||||
|
||||
body.setAttribute('data-view-mode', newMode);
|
||||
|
||||
// 아이콘 변경
|
||||
if (newMode === 'card') {
|
||||
icon.className = 'fa fa-list';
|
||||
} else {
|
||||
icon.className = 'fa fa-th-large';
|
||||
}
|
||||
|
||||
// 쿠키 저장 (365일)
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
|
||||
document.cookie = "board_<?php echo $bo_table; ?>_view_mode=" + newMode + "; expires=" + date.toUTCString() + "; path=/";
|
||||
}
|
||||
|
||||
<?php if ($is_checkbox) { ?>
|
||||
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].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].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;
|
||||
}
|
||||
<?php } ?>
|
||||
</script>
|
||||
Reference in New Issue
Block a user