view 화면에 선택분류
본문
팁을 이용해 list 하단에 선택분류를 만들었는데요
bbs/cate.php
<?php
include_once('./_common.php');
$act = "분류이동";
// 게시판 관리자 이상 복사, 이동 가능
if ($is_admin != 'board' && $is_admin != 'group' && $is_admin != 'super')
alert_close("게시판 관리자 이상 접근이 가능합니다.");
$g5['title'] = '게시물 ' . $act;
include_once(G5_PATH.'/head.sub.php');
$wr_id_list = '';
if ($wr_id)
$wr_id_list = $wr_id;
else {
$comma = '';
for ($i=0; $i<count($_POST['chk_wr_id']); $i++) {
$wr_id_list .= $comma . $_POST['chk_wr_id'][$i];
$comma = ',';
}
}
$catelist = $board['bo_category_list'];
$list = explode('|',$catelist);
?>
<div id="copymove" class="new_win">
<h1 id="win_title"><?php echo $g5['title'] ?></h1>
<form name="fboardmoveall" method="post" action="./cate_update.php" onsubmit="return fboardmoveall_submit(this);">
<input type="hidden" name="sw" value="<?php echo $sw ?>">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="wr_id_list" value="<?php echo $wr_id_list ?>">
<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 ?>">
<input type="hidden" name="act" value="<?php echo $act ?>">
<input type="hidden" name="url" value="<?php echo $_SERVER['HTTP_REFERER'] ?>">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $act ?>한개 이상 선택하여 주십시오.</caption>
<thead>
<tr>
<th scope="col">●</th>
<th scope="col">분류목록</th>
</tr>
</thead>
<tbody>
<tr class="">
<td class="td_chk">
<label for="chk0" class="sound_only">[분류없음]</label>
<input type="radio" value="" id="chk0" name="chk_bo_table[]">
</td>
<td>
<label for="chk0">[분류없음]</label>
</td>
</tr>
<?php for ($i=1; $i <= count($list); $i++) {
$atc_mark = '';
$atc_bg = '';
?>
<tr class="<?php echo $atc_bg; ?>">
<td class="td_chk">
<label for="chk<?php echo $i ?>" class="sound_only"><?php echo $list[$i-1] ?></label>
<input type="radio" value="<?php echo $list[$i-1] ?>" id="chk<?php echo $i ?>" name="chk_bo_table[]">
</td>
<td>
<label for="chk<?php echo $i ?>">
<?php echo $list[$i-1] ?>
<?php echo $atc_mark; ?>
</label>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="win_btn">
<input type="submit" value="<?php echo $act ?>" id="btn_submit" class="btn_submit">
</div>
</form>
</div>
<script>
$(function() {
$(".win_btn").append("<button type=\"button\" class=\"btn_cancel\">창닫기</button>");
$(".win_btn button").click(function() {
window.close();
});
});
function all_checked(sw) {
var f = document.fboardmoveall;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_bo_table[]")
f.elements[i].checked = sw;
}
}
function fboardmoveall_submit(f)
{
var check = false;
if (typeof(f.elements['chk_bo_table[]']) == 'undefined')
;
else {
if (typeof(f.elements['chk_bo_table[]'].length) == 'undefined') {
if (f.elements['chk_bo_table[]'].checked)
check = true;
} else {
for (i=0; i<f.elements['chk_bo_table[]'].length; i++) {
if (f.elements['chk_bo_table[]'][i].checked) {
check = true;
break;
}
}
}
}
if (!check) {
alert('게시물의 분류를 선택하세요.');
return false;
}
document.getElementById('btn_submit').disabled = true;
f.action = './cate_update.php';
return true;
}
</script>
<?php
include_once(G5_PATH.'/tail.sub.php');
?>
<?php
include_once('./_common.php');
// 게시판 관리자 이상 복사, 이동 가능
if ($is_admin != 'board' && $is_admin != 'group' && $is_admin != 'super')
alert_close('게시판 관리자 이상 접근이 가능합니다.');
if ($sw != 'cate')
alert('sw 값이 제대로 넘어오지 않았습니다.');
if(!count($_POST['chk_bo_table']))
alert('게시물 '.$act.'할 게시판을 한개 이상 선택해 주십시오.', $url);
//새로기록된 분류명
$newcate = $_POST['chk_bo_table'][0];
$sql = "update $write_table set ca_name='{$newcate}' where wr_id in ({$wr_id_list}) ";
$result = sql_query($sql);
$msg = '해당 게시물의 분류를 '.$newcate.'로 변경 하였습니다.';
$opener_href = './board.php?bo_table='.$bo_table.'&page='.$page.'&'.$qstr;
$opener_href1 = str_replace('&', '&', $opener_href);
echo <<<HEREDOC
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script>
alert("$msg");
opener.document.location.href = "$opener_href1";
window.close();
</script>
<noscript>
<p>
"$msg"
</p>
<a href="$opener_href">돌아가기</a>
</noscript>
HEREDOC;
?>
근데 view화면에다가도 넣고 싶은데
view화면에
<?php if ($move_href) { ?><li><a href="<?php echo $move_href ?>" class="btn_admin" onclick="board_move(this.href); return false;">이동</a></li><?php } ?>
이거는 이렇게 간단히 있는데
분류까지 넣으려면 또다른 파일이 있어야 되는걸까여?
관련 파일이 너무 많아서 ... view화면에도 [분류] 버튼을 넣으려면
어떤걸 비슷하게 따라넣어야될까여?
도움좀 부탁드립니다.
답변 2
제가 리스트 분류 변경으로 파악하고 말씀 드렸네요.
뷰에서 분류를 변경할 버튼이 필요하신거네요.
cart.php, cart_update.php 둘다 이상없이 준비가 되어 있다면
일단 /bbs/view.php에서
$move_href 찾아서 그 아래에
$cate_href = './cate.php?sw=cate&bo_table='.$bo_table.'&wr_id='.$wr_id.'&page='.$page.$qstr;
이렇게 넣어 주시고
스킨에선 이동 버튼 다음에 이동 버튼 복사해서 move_href를 cate_href로 변경해 주시면 끝날거 같습니다.
구지 리스트처럼 스크립트를 다르게 쓰고 싶으시면
function board_cate(href)
{
window.open(href, "boardcate", "left=50, top=50, width=500, height=550, scrollbars=1");
}
이렇게 만들어 board_move 스크립트 아래에 추가하고
만드신 분류 버튼에서 스크립트 호출 이름만 board_move 에서 board_cate 로 변경해 주시면
될거 같습니다.
!-->!-->
작업하신 내용만 올려 주신거 같습니다.
어떤걸 하고 싶어 이작업을 했다라는 얘기가 빠진거 같습니다.
말씀하신 분류가 게시판 관리의 분류인지도 궁금합니다.