사용후기, 상품문의 코드 수정 완료

This commit is contained in:
gnuboard
2013-06-18 18:05:07 +09:00
parent 4e37dc6abd
commit 3680563f12
12 changed files with 206 additions and 697 deletions

View File

@ -1,6 +1,7 @@
<?php
$sub_menu = '400660';
include_once('./_common.php');
include_once(G4_CKEDITOR_PATH.'/ckeditor.lib.php');
auth_check($auth[$sub_menu], "w");
@ -21,6 +22,13 @@ $qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
<?php//=subtitle($g4['title'])?>
<form name="fitemqaform" method="post" action="./itemqaformupdate.php" onsubmit="return fitemqaform_submit(this);">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="iq_id" value="<?php echo $iq_id; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<section class="cbox">
<h2>상품문의 수정/답변</h2>
<p>상품에 대한 문의에 답변하실 수 있습니다. 상품 문의 내용의 수정도 가능합니다.</p>
@ -48,11 +56,12 @@ $qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
</tr>
<tr>
<th scope="row"><label for="iq_question">질문</label></th>
<td><textarea name="iq_question" id="iq_question" rows="7" required class="required"><?php echo get_text($iq['iq_question']); ?></textarea></td>
<td><?php echo editor_html('iq_question', $iq['iq_question']); ?></td>
</tr>
<tr>
<th scope="row"><label for="iq_answer">답변</label></th>
<td><textarea name="iq_answer" id="iq_answer" rows="7"><?php echo get_text($iq['iq_answer']); ?></textarea></td>
<td><?php echo editor_html('iq_answer', $iq['iq_answer']); ?></td>
<!-- <td><textarea name="iq_answer" id="iq_answer" rows="7"><?php echo get_text($iq['iq_answer']); ?></textarea></td> -->
</tr>
</tbody>
</table>
@ -65,6 +74,16 @@ $qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
</section>
<script>
function fitemqaform_submit(f)
{
<?php echo get_editor_js('iq_question'); ?>
<?php echo get_editor_js('iq_answer'); ?>
return true;
}
</script>
<?php
include_once (G4_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -9,14 +9,10 @@ if ($w == 'd')
else
auth_check($auth[$sub_menu], "w");
$iq = sql_fetch(" select * from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ");
if (!$iq['iq_id']) {
alert('등록된 자료가 없습니다.');
}
$qstr = "page=$page&amp;sort1=$sort1&amp;sort2=$sort2";
if ($w == "u") {
if ($w == "u")
{
$sql = "update {$g4['shop_item_qa_table']}
set iq_subject = '$iq_subject',
iq_question = '$iq_question',
@ -25,12 +21,8 @@ if ($w == "u") {
sql_query($sql);
goto_url("./itemqaform.php?w=$w&amp;iq_id=$iq_id&amp;$qstr");
} else if ($w == "d") {
$sql = "delete from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ";
sql_query($sql);
goto_url("./itemqalist.php?$qstr");
} else {
}
else {
alert();
}
?>

View File

@ -110,9 +110,21 @@ if ($sfl || $stx) // 검색 결과일 때만 처음 버튼을 보여줌
<li><?php echo subject_sort_link('iq_answer'); ?>답변<span class="sound_only"> 순 정렬</span></a></li>
</ul>
<form name="fitemqalist" method="post" action="./itemqalistupdate.php" onsubmit="return fitemqalist_submit(this);" autocomplete="off">
<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="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<table class="frm_basic">
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">상품문의 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col">상품명</th>
<th scope="col">이름</th>
<th scope="col">질문</th>
@ -124,36 +136,84 @@ if ($sfl || $stx) // 검색 결과일 때만 처음 버튼을 보여줌
<?php
for ($i=0; $row=mysql_fetch_array($result); $i++) {
$row['iq_subject'] = cut_str($row['iq_subject'], 30, "...");
$href = G4_SHOP_URL.'/item.php?it_id='.$row['it_id'];
$name = get_sideview($row['mb_id'], $row['iq_name'], $row['mb_email'], $row['mb_homepage']);
$answer = $row['iq_answer'] ? 'Y' : '&nbsp;';
$iq_question = get_view_thumbnail($row['iq_question'], 300);
$iq_answer = $row['iq_answer'] ? get_view_thumbnail($row['iq_answer'], 300) : "답변이 등록되지 않았습니다.";
?>
<tr>
<td>
<label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['iq_subject']) ?> 상품문의</label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i; ?>">
<input type="hidden" name="iq_id[<?php echo $i; ?>]" value="<?php echo $row['iq_id']; ?>">
</td>
<td><a href="<?php echo $href; ?>"><?php echo get_it_image($row['it_id'], 50, 50); ?><?php echo cut_str($row['it_name'],30); ?></a></td>
<td class="td_name"><?php echo $name; ?></td>
<td class="sit_qa_subject"><?php echo $row['iq_subject']; ?></td>
<td class="sit_qa_subject">
<a href="#" class="qa_href" onclick="return false;" target="<?php echo $i; ?>"><?php echo $row['iq_subject']; ?></a>
<div id="qa_div<?php echo $i; ?>" class="qa_div" style="display:none;">
<strong>문의내용</strong><br>
<?php echo $iq_question; ?>
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</div>
</td>
<td class="sit_qa_answer"><?php echo $answer; ?></td>
<td class="td_smallmng">
<a href="./itemqaform.php?w=u&amp;iq_id=<?php echo $row['iq_id']; ?>&amp;<?php echo $qstr; ?>"><span class="sound_only"><?php echo $row['iq_subject']; ?> </span>수정</a>
<a href="javascript:del('./itemqaformupdate.php?w=d&amp;iq_id=<?php echo $row['iq_id']; ?>&amp;$qstr');"><span class="sound_only"><?php echo $row['iq_subject']; ?> </span>삭제</a>
</td>
</tr>
<?php
}
if ($i == 0) {
echo '<tr><td colspan="5" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
echo '<tr><td colspan="6" class="empty_table"><span>자료가 없습니다.</span></td></tr>';
}
?>
</tbody>
</table>
<div class="btn_list">
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
</section>
<?php echo get_paging(G4_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
function fitemqalist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
$(function(){
$(".qa_href").click(function(){
var $content = $("#qa_div"+$(this).attr("target"));
$(".qa_div").each(function(index, value){
if ($(this).get(0) == $content.get(0)) { // 객체의 비교시 .get(0) 를 사용한다.
$(this).is(":hidden") ? $(this).show() : $(this).hide();
} else {
$(this).hide();
}
});
});
});
</script>
<?php
include_once (G4_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,39 @@
<?php
$sub_menu = '400660';
include_once('./_common.php');
check_demo();
if (!count($_POST['chk'])) {
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
}
if ($_POST['act_button'] == "선택수정") {
auth_check($auth[$sub_menu], 'w');
for ($i=0; $i<count($_POST['chk']); $i++) {
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$sql = "update {$g4['shop_item_qa_table']}
set iq_confirm = '{$_POST['iq_confirm'][$k]}'
where iq_id = '{$_POST['iq_id'][$k]}' ";
sql_query($sql);
}
} else if ($_POST['act_button'] == "선택삭제") {
auth_check($auth[$sub_menu], 'd');
for ($i=0; $i<count($_POST['chk']); $i++) {
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$sql = "delete from {$g4['shop_item_qa_table']} where iq_id = '{$_POST['iq_id'][$k]}' ";
sql_query($sql);
}
}
goto_url("./itemqalist.php?sca=$sca&amp;sst=$sst&amp;sod=$sod&amp;sfl=$sfl&amp;stx=$stx&amp;page=$page");
?>

View File

@ -32,7 +32,6 @@ $qstr = 'page='.$page.'&amp;sort1='.$sort1.'&amp;sort2='.$sort2;
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<input type="hidden" name="is_confirm" value="<?php echo $is['is_confirm']; ?>">
<section class="cbox">
<h2>사용후기 수정</h2>