투표목록 선택삭제기능 추가

This commit is contained in:
chicpro
2013-02-15 17:39:56 +09:00
parent 596acb0d97
commit 7c02b02430
2 changed files with 50 additions and 24 deletions

27
adm/poll_delete.php Normal file
View File

@ -0,0 +1,27 @@
<?php
$sub_menu = "200900";
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], 'd');
check_token();
$count = count($_POST['chk']);
if(!$count)
alert('삭제할 투표목록을 1개이상 선택해 주세요.');
for($i=0; $i<$count; $i++) {
$po_id = $_POST['chk'][$i];
$sql = " delete from {$g4['poll_table']} where po_id = '$po_id' ";
sql_query($sql);
$sql = " delete from {$g4['poll_etc_table']} where po_id = '$po_id' ";
sql_query($sql);
}
goto_url('./poll_list.php?'.$qstr);
?>

View File

@ -76,6 +76,13 @@ $colspan = 6;
<section class="cbox">
<h2>투표목록</h2>
<form id="fpolllist" name="fpolllist" method="post" action="./poll_delete.php">
<input type="hidden" name="sst" value="<?=$sst?>">
<input type="hidden" name="sod" value="<?=$sod?>">
<input type="hidden" name="sfl" value="<?=$sfl?>">
<input type="hidden" name="stx" value="<?=$stx?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="token" value="<?=$token?>">
<table>
<thead>
<tr>
@ -101,8 +108,7 @@ $colspan = 6;
<tr>
<td class="td_chk">
<input type="hidden" name="" value="">
<input type="checkbox" id="chk_<?=$i?>" name="chk[]" value="<?=$i?>" title="투표선택">
<input type="checkbox" id="chk_<?=$i?>" name="chk[]" value="<?=$row['po_id']?>" title="투표선택">
</td>
<td class="td_num"><?=$row['po_id']?></td>
<td><?=cut_str(get_text($row['po_subject']),70)?></td>
@ -123,8 +129,8 @@ $colspan = 6;
<div class="btn_list">
<button>선택삭제</button>
<input type="submit" name="btn_submit" value="선택삭제">
</div>
</form>
</section>
<?=get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page=");?>
@ -135,30 +141,23 @@ if (isset($stx))
?>
<script>
// POST 방식으로 삭제
function post_delete(action_url, val)
{
var f = document.fpost;
$(function() {
$('#fpolllist').submit(function() {
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
var cnt = $('input[name^=chk]:checked').length;
if(cnt < 1) {
alert('삭제할 투표목록을 1개이상 선택해 주세요.');
return false;
}
if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) {
f.po_id.value = val;
f.action = action_url;
f.submit();
}
}
return true;
} else {
return false;
}
});
});
</script>
<form id="fpost" name="fpost" method="post">
<input type="hidden" name="sst" value="<?=$sst?>">
<input type="hidden" name="sod" value="<?=$sod?>">
<input type="hidden" name="sfl" value="<?=$sfl?>">
<input type="hidden" name="stx" value="<?=$stx?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="token" value="<?=$token?>">
<input type="hidden" name="w" value='d'>
<input type="hidden" name="po_id">
</form>
<?
include_once ('./admin.tail.php');
?>