상품문의를 ajax 방식으로 변경
This commit is contained in:
@ -1,217 +0,0 @@
|
||||
<?php
|
||||
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
|
||||
include_once(G4_LIB_PATH.'/thumb.lib.php');
|
||||
?>
|
||||
|
||||
<table id="sit_ps_tbl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>제목</th>
|
||||
<th>작성자</th>
|
||||
<th>작성일</th>
|
||||
<th>평점</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$sql_common = " from {$g4['shop_item_use_table']} where it_id = '{$it['it_id']}' and is_confirm = '1' ";
|
||||
|
||||
// 테이블의 전체 레코드수만 얻음
|
||||
$sql = " select COUNT(*) as cnt " . $sql_common;
|
||||
$row = sql_fetch($sql);
|
||||
$use_total_count = $row['cnt'];
|
||||
|
||||
$use_total_page = ceil($use_total_count / $use_page_rows); // 전체 페이지 계산
|
||||
if ($use_page == "") $use_page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$use_from_record = ($use_page - 1) * $use_page_rows; // 시작 레코드 구함
|
||||
|
||||
$sql = "select * $sql_common order by is_id desc limit $use_from_record, $use_page_rows ";
|
||||
$result = sql_query($sql);
|
||||
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$num = $use_total_count - ($use_page - 1) * $use_page_rows - $i;
|
||||
|
||||
$star = get_star($row['is_score']);
|
||||
|
||||
$is_name = get_text($row['is_name']);
|
||||
$is_subject = conv_subject($row['is_subject'],50,"…");
|
||||
//$is_content = conv_content($row[is_content],0);
|
||||
$is_content = $row['is_content'];
|
||||
//$is_content = preg_replace_callback("#<img[^>]+>#iS", "g4_thumb", $is_content);
|
||||
|
||||
$thumb = new g4_thumb(G4_DATA_PATH.'/itemuse', 500);
|
||||
$is_content = $thumb->run($is_content);
|
||||
|
||||
$is_time = substr($row['is_time'], 2, 14);
|
||||
?>
|
||||
|
||||
<li class="sit_ps_li">
|
||||
<button type="button" class="sit_ps_li_title" onclick="javascript:qa_menu('sit_ps_con_<?php echo $i; ?>')"><?php echo $num; ?>. <?php echo $iq_subject; ?></button>
|
||||
<dl class="sit_ps_dl">
|
||||
<dt>작성자</dt>
|
||||
<dd><?php echo $iq_name; ?></dd>
|
||||
<dt>작성일</dt>
|
||||
<dd><?php echo $iq_time; ?></dd>
|
||||
<dt>상태</dt>
|
||||
<dd><?php echo $iq_stats; ?></dd>
|
||||
</dl>
|
||||
|
||||
<div id="sit_ps_con_<?php echo $i; ?>" class="sit_ps_con">
|
||||
<p class="sit_ps_qaq">
|
||||
<strong>문의내용</strong><br>
|
||||
<?php echo $iq_question; // 상품 문의 내용 ?>
|
||||
</p>
|
||||
<p class="sit_ps_qaa">
|
||||
<strong>답변</strong><br>
|
||||
<?php echo $iq_answer; ?>
|
||||
</p>
|
||||
|
||||
<textarea id="tmp_iq_id<?php echo $i; ?>"><?php echo $row['iq_id']; ?></textarea>
|
||||
<textarea id="tmp_iq_name<?php echo $i; ?>"><?php echo $row['iq_name']; ?></textarea>
|
||||
<textarea id="tmp_iq_subject<?php echo $i; ?>"><?php echo $row['iq_subject']; ?></textarea>
|
||||
<textarea id="tmp_iq_question<?php echo $i; ?>"><?php echo $row['iq_question']; ?></textarea>
|
||||
|
||||
<?php if ($row['mb_id'] == $member['mb_id'] && $iq_answer == 0) { ?>
|
||||
<div class="sit_ps_cmd">
|
||||
<button onclick="javascript:itemqa_update(<?php echo $i; ?>);" class="btn01">수정</button>
|
||||
<button onclick="javascript:itemqa_delete(fitemqa_password<?php echo $i; ?>, <?php echo $i; ?>);" class="btn01">삭제</button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td><?php echo $num; ?><span class="sound_only">번</span></td>
|
||||
<td>
|
||||
<a href="javascript:;" onclick="use_menu('is<?php echo $i; ?>')"><?php echo $is_subject; ?></a>
|
||||
<div>
|
||||
<div>
|
||||
<?php echo $is_content; ?>
|
||||
</div>
|
||||
<textarea id="tmp_is_id<?php echo $i; ?>"><?php echo $row['is_id']; ?></textarea>
|
||||
<textarea id="tmp_is_name<?php echo $i; ?>"><?php echo $row['is_name']; ?></textarea>
|
||||
<textarea id="tmp_is_subject<?php echo $i; ?>"><?php echo $row['is_subject']; ?></textarea>
|
||||
<textarea id="tmp_is_content<?php echo $i; ?>"><?php echo $row['is_content']; ?></textarea>
|
||||
|
||||
<?php if ($row[mb_id] == $member[mb_id]) { ?>
|
||||
<a href="javascript:itemusewin('is_id=<?php echo $row['is_id']; ?>&w=u');">수정</a>
|
||||
<a href="javascript:itemuse_delete(fitemuse_password<?php echo $i; ?>, <?php echo $i; ?>);">삭제</a>
|
||||
<?php } ?>
|
||||
<div id="is<?php echo $i; ?>">
|
||||
<!-- 사용후기 삭제 패스워드 입력 폼 -->
|
||||
<form name="fitemuse_password<?php echo $i; ?>" method="post" action="./itemuseupdate.php" autocomplete="off">
|
||||
<input type="hidden" name="w" value="">
|
||||
<input type="hidden" name="is_id" value="">
|
||||
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
|
||||
<label for="is_password_<?php echo $i; ?>">패스워드</label>
|
||||
<input type="password" name="is_password" id="is_password_<?php echo $i; ?>" required>
|
||||
<input type="submit" value="확인">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><?php echo $is_name; ?></td>
|
||||
<td><?php echo $is_time; ?></td>
|
||||
<td><img src="<?php echo G4_URL; ?>/img/shop/s_star<?php echo $star; ?>.png" alt="별<?php echo $star; ?>개"></td>
|
||||
</tr>
|
||||
|
||||
<?
|
||||
}
|
||||
|
||||
if (!$i)
|
||||
{
|
||||
echo '<tr><td class="empty_class">등록된 사용후기가 없습니다.</td></tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
if ($use_pages) {
|
||||
$use_pages = get_paging(10, $use_page, $use_total_page, "./item.php?it_id=$it_id&$qstr&use_page=", "#use");
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="javascript:itemusewin('it_id=<?php echo $it_id; ?>');">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
|
||||
|
||||
<script>
|
||||
function itemusewin(query_string)
|
||||
{
|
||||
window.open("./itemusewin.php?"+query_string, "itemusewin", "width=800,height=700");
|
||||
}
|
||||
|
||||
function fitemuse_submit(f)
|
||||
{
|
||||
if (!check_kcaptcha(f.is_key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
f.action = "itemuseupdate.php"
|
||||
return true;
|
||||
}
|
||||
|
||||
function itemuse_insert()
|
||||
{
|
||||
/*
|
||||
if (!g4_is_member) {
|
||||
alert("로그인 하시기 바랍니다.");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
var f = document.fitemuse;
|
||||
var id = document.getElementById('itemuse');
|
||||
|
||||
id.style.display = 'block';
|
||||
|
||||
f.w.value = '';
|
||||
f.is_id.value = '';
|
||||
if (!g4_is_member)
|
||||
{
|
||||
f.is_name.value = '';
|
||||
f.is_name.readOnly = false;
|
||||
f.is_password.value = '';
|
||||
}
|
||||
f.is_subject.value = '';
|
||||
f.is_content.value = '';
|
||||
}
|
||||
|
||||
function itemuse_update(idx)
|
||||
{
|
||||
var f = document.fitemuse;
|
||||
var id = document.getElementById('itemuse');
|
||||
|
||||
id.style.display = 'block';
|
||||
|
||||
f.w.value = 'u';
|
||||
f.is_id.value = document.getElementById('tmp_is_id'+idx).value;
|
||||
if (!g4_is_member)
|
||||
{
|
||||
f.is_name.value = document.getElementById('tmp_is_name'+idx).value;
|
||||
f.is_name.readOnly = true;
|
||||
}
|
||||
f.is_subject.value = document.getElementById('tmp_is_subject'+idx).value;
|
||||
f.is_content.value = document.getElementById('tmp_is_content'+idx).value;
|
||||
}
|
||||
|
||||
function itemuse_delete(f, idx)
|
||||
{
|
||||
var id = document.getElementById('itemuse');
|
||||
|
||||
f.w.value = 'd';
|
||||
f.is_id.value = document.getElementById('tmp_is_id'+idx).value;
|
||||
|
||||
if (g4_is_member)
|
||||
{
|
||||
if (confirm("삭제하시겠습니까?"))
|
||||
f.submit();
|
||||
}
|
||||
else
|
||||
{
|
||||
id.style.display = 'none';
|
||||
document.getElementById('itemuse_password'+idx).style.display = 'block';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
104
mobile/shop/itemuseform.php
Normal file
104
mobile/shop/itemuseform.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
// 사용후기의 내용에 쓸수 있는 최대 글자수 (한글은 영문3자)
|
||||
$is_content_max_length = 10000;
|
||||
|
||||
$w = escape_trim($_REQUEST['w']);
|
||||
$it_id = escape_trim($_REQUEST['it_id']);
|
||||
$is_id = escape_trim($_REQUEST['is_id']);
|
||||
|
||||
if (!$is_member) {
|
||||
alert("사용후기는 회원만 평가가 가능합니다.", G4_BBS_URL."/login.php");
|
||||
}
|
||||
|
||||
if ($w == "") {
|
||||
$is_score = 10;
|
||||
} else if ($w == "u") {
|
||||
$use = sql_fetch(" select * from {$g4['shop_item_use_table']} where is_id = '$is_id' ");
|
||||
if (!$use) {
|
||||
alert_close("사용후기 정보가 없습니다.");
|
||||
}
|
||||
|
||||
$it_id = $use['it_id'];
|
||||
$is_score = $use['is_score'];
|
||||
|
||||
if (!$is_admin && $use['mb_id'] != $member['mb_id']) {
|
||||
alert_close("자신의 사용후기만 수정이 가능합니다.");
|
||||
}
|
||||
}
|
||||
|
||||
include_once(G4_PATH.'/head.sub.php');
|
||||
?>
|
||||
<style>
|
||||
ul {list-style:none;margin:0px;padding:0px;}
|
||||
label {width:130px;vertical-align:top;padding:3px 0;}
|
||||
</style>
|
||||
|
||||
<div style="padding:10px;">
|
||||
<form name="fitemuse" method="post" action="./itemuseformupdate.php" onsubmit="return fitemuse_submit(this);" autocomplete="off">
|
||||
<input type="hidden" name="w" value="<?php echo $w; ?>">
|
||||
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
|
||||
<input type="hidden" name="is_id" value="<?php echo $is_id; ?>">
|
||||
<fieldset style="padding:0 10px 10px;">
|
||||
<legend><strong>사용후기 쓰기</strong></legend>
|
||||
<ul style="padding:10px;">
|
||||
<li>
|
||||
<label for="is_subject">제목</label>
|
||||
<input type="text" id="is_subject" name="is_subject" size="100" class="ed" minlength="2" maxlength="250" required itemname="제목" value="<?php echo get_text($use['is_subject']); ?>">
|
||||
</li>
|
||||
<li>
|
||||
<label for="is_content" style="width:200px;">내용</label>
|
||||
<textarea name="is_content" id="is_content"><?php echo $$use['is_content']; ?></textarea>
|
||||
</li>
|
||||
<li>
|
||||
<label>평가</label>
|
||||
<input type=radio name=is_score value='10' <?php echo ($is_score==10)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star5.gif' align=absmiddle>
|
||||
<input type=radio name=is_score value='8' <?php echo ($is_score==8)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star4.gif' align=absmiddle>
|
||||
<input type=radio name=is_score value='6' <?php echo ($is_score==6)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star3.gif' align=absmiddle>
|
||||
<input type=radio name=is_score value='4' <?php echo ($is_score==4)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star2.gif' align=absmiddle>
|
||||
<input type=radio name=is_score value='2' <?php echo ($is_score==2)?"checked='checked'":""; ?>><img src='<?php echo G4_SHOP_URL; ?>/img/star1.gif' align=absmiddle>
|
||||
</li>
|
||||
</ul>
|
||||
<input type="submit" value=" 확 인 ">
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
self.focus();
|
||||
|
||||
function fitemuse_submit(f)
|
||||
{
|
||||
/*
|
||||
if (document.getElementById('tx_is_content')) {
|
||||
var len = ed_is_content.inputLength();
|
||||
if (len == 0) {
|
||||
alert('내용을 입력하십시오.');
|
||||
ed_is_content.returnFalse();
|
||||
return false;
|
||||
} else if (len > 1000) {
|
||||
alert('내용은 1000글자 까지만 입력해 주세요.');
|
||||
ed_is_content.returnFalse();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (is_content_editor_data.length > <?php echo $is_content_max_length; ?>) {
|
||||
alert("내용은 <?php echo $is_content_max_length; ?> 글자 이내에서 작성해 주세요. (한글은 영문 3자)\n\n현재 : "+is_content_editor_data.length+" 글자");
|
||||
CKEDITOR.instances.is_content.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$("#is_subject").focus();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G4_PATH.'/tail.sub.php');
|
||||
?>
|
||||
153
mobile/shop/itemuselist.php
Normal file
153
mobile/shop/itemuselist.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
include_once(G4_LIB_PATH.'/thumb.lib.php');
|
||||
|
||||
$sfl = escape_trim($_REQUEST['sfl']);
|
||||
$stx = escape_trim($_REQUEST['stx']);
|
||||
|
||||
$g4['title'] = '사용후기';
|
||||
include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
|
||||
$sql_common = " from `{$g4['shop_item_use_table']}` a join `{$g4['shop_item_table']}` b on (a.it_id=b.it_id) ";
|
||||
$sql_search = " where a.is_confirm = '1' ";
|
||||
|
||||
if ($stx) {
|
||||
$sql_search .= " and ( ";
|
||||
switch ($sfl) {
|
||||
case "a.it_id" :
|
||||
$sql_search .= " ($sfl like '$stx%') ";
|
||||
break;
|
||||
case "a.is_name" :
|
||||
case "a.mb_id" :
|
||||
$sql_search .= " ($sfl = '$stx') ";
|
||||
break;
|
||||
default :
|
||||
$sql_search .= " ($sfl like '%$stx%') ";
|
||||
break;
|
||||
}
|
||||
$sql_search .= " ) ";
|
||||
}
|
||||
|
||||
if (!$sst) {
|
||||
$sst = "a.is_id";
|
||||
$sod = "desc";
|
||||
}
|
||||
$sql_order = " order by $sst $sod ";
|
||||
|
||||
/*
|
||||
$sql_common = " from {$g4['shop_item_use_table']} where is_confirm = '1' ";
|
||||
$sql_order = " order by is_id desc ";
|
||||
*/
|
||||
|
||||
$sql = " select count(*) as cnt
|
||||
$sql_common
|
||||
$sql_search
|
||||
$sql_order ";
|
||||
$row = sql_fetch($sql);
|
||||
$total_count = $row['cnt'];
|
||||
|
||||
$rows = $config['cf_page_rows'];
|
||||
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
|
||||
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
|
||||
$from_record = ($page - 1) * $rows; // 시작 열을 구함
|
||||
?>
|
||||
|
||||
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">전체보기</a>
|
||||
|
||||
<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||
<select name="sfl" required title="검색항목선택">
|
||||
<option value="">선택</option>
|
||||
<option value="b.it_name" <?php echo get_selected($_GET['sfl'], "b.it_name", true); ?>>상품명</option>
|
||||
<option value="a.it_id" <?php echo get_selected($_GET['sfl'], "a.it_id"); ?>>상품코드</option>
|
||||
<option value="a.is_subject"<?php echo get_selected($_GET['sfl'], "a.is_subject"); ?>>후기제목</option>
|
||||
<option value="a.is_content">후기제목</option>
|
||||
<option value="a.is_name">작성자명</option>
|
||||
<option value="a.mb_id">작성자아이디</option>
|
||||
</select>
|
||||
<input type="text" name="stx" required title="검색어" value="<?php echo $stx; ?>">
|
||||
<input type="submit" value="검색">
|
||||
</form>
|
||||
|
||||
<div id="sps">
|
||||
|
||||
<!-- <p><?php echo $config['cf_title']; ?> 전체 사용후기 목록입니다.</p> -->
|
||||
|
||||
<?php
|
||||
$sql = " select *
|
||||
$sql_common
|
||||
$sql_search
|
||||
$sql_order
|
||||
limit $from_record, $rows ";
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
{
|
||||
$num = $total_count - ($page - 1) * $rows - $i;
|
||||
$star = get_star($row['is_score']);
|
||||
|
||||
$is_content = get_view_thumbnail($row['is_content'], 500);
|
||||
$is_time = substr($row['is_time'], 2, 14);
|
||||
$small_image = $row['it_id'];
|
||||
|
||||
$row2 = sql_fetch(" select it_name from {$g4['shop_item_table']} where it_id = '{$row['it_id']}' ");
|
||||
$it_href = G4_SHOP_URL."/item.php?it_id={$row['it_id']}";
|
||||
|
||||
if ($i == 0) echo '<ol>';
|
||||
?>
|
||||
<li>
|
||||
|
||||
<div class="sps_img">
|
||||
<a href="<?php echo $it_href; ?>">
|
||||
<?php echo get_it_image($small_image, 70, 70); ?>
|
||||
<span><?php echo $row2['it_name']; ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<section class="sps_section">
|
||||
<h2><?php echo $row['is_subject']; ?></h2>
|
||||
|
||||
<dl class="sps_dl">
|
||||
<dt>작성자</dt>
|
||||
<dd><?php echo $row['is_name']; ?></dd>
|
||||
<dt>작성일</dt>
|
||||
<dd><?php echo substr($row['is_time'],0,10); ?></dd>
|
||||
<dt>평가점수</dt>
|
||||
<dd><img src="<?php echo G4_URL; ?>/img/shop/s_star<?php echo $star; ?>.png" alt="별<?php echo $star; ?>개"></dd>
|
||||
</dl>
|
||||
|
||||
<div id="sps_con_<?php echo $i; ?>" style="display:none;">
|
||||
<?php echo $is_content; // 상품 문의 내용 ?>
|
||||
</div>
|
||||
|
||||
<div class="sps_con_btn"><button class="sps_con_<?php echo $i; ?>">보기</button></div>
|
||||
</section>
|
||||
|
||||
</li>
|
||||
<?php }
|
||||
if ($i > 0) echo '</ol>';
|
||||
if ($i == 0) echo '<p id="sps_empty">자료가 없습니다.</p>';
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&page="); ?>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
// 사용후기 더보기
|
||||
$(".sps_con_btn button").click(function(){
|
||||
var sps_con_no = $(this).attr("class");
|
||||
$("#"+sps_con_no).is(":hidden") ? $("#"+sps_con_no).show() : $("#"+sps_con_no).hide();
|
||||
});
|
||||
|
||||
$(".sps_con_btn button").toggle(function(){
|
||||
$(this).text("닫기");
|
||||
}, function(){
|
||||
$(this).text("보기");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
include_once(G4_MSHOP_PATH.'/_tail.php');
|
||||
?>
|
||||
@ -106,7 +106,7 @@ $qstr1 .= 'ca_id='.$ca_id;
|
||||
if($skin)
|
||||
$qstr1 .= '&skin='.$skin;
|
||||
$qstr1 .='&ev_id='.$ev_id.'&sort='.$sort.'&sortodr='.$sortodr;
|
||||
echo get_paging($config['cf_write_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$qstr1.'&page=');
|
||||
echo get_paging($config['cf_mobile_pages'], $page, $total_page, $_SERVER['PHP_SELF'].'?'.$qstr1.'&page=');
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user