Merge branch 'master' of github.com:gnuboard/yc4s

This commit is contained in:
whitedot
2013-05-13 18:21:33 +09:00
6 changed files with 60 additions and 43 deletions

View File

@ -8,6 +8,7 @@ $g4['title'] = '상품 복사';
include_once(G4_PATH.'/head.sub.php');
?>
<form name="fitemcopy">
<div class="cbox">
<h1>상품 복사</h1>
@ -15,7 +16,7 @@ include_once(G4_PATH.'/head.sub.php');
<tbody>
<tr>
<th scope="row"><label for="new_it_id">상품코드</label></th>
<td><input type="text" value="<?php echo time(); ?>" id="new_it_id" class="frm_input"></td>
<td><input type="text" name="new_it_id" value="<?php echo time(); ?>" id="new_it_id" class="frm_input" maxlength="20"></td>
</tr>
</tbody>
</table>
@ -29,12 +30,19 @@ include_once(G4_PATH.'/head.sub.php');
</form>
<script>
// <![CDATA[
function _copy(link)
{
var new_it_id = document.getElementById('new_it_id').value;
opener.parent.location.href = encodeURI(link+'&amp;new_it_id='+new_it_id);
var t_it_id = new_it_id.replace(/[A-Za-z0-9\-]/g, "");
if(t_it_id.length > 0) {
alert("상품코드는 영문자, 숫자, - 만 사용할 수 있습니다.");
return false;
}
opener.parent.location.href = encodeURI(link+'&new_it_id='+new_it_id);
self.close();
}
// ]]>
</script>
<?php

View File

@ -10,6 +10,10 @@ if ($is_admin != "super")
if (!trim($it_id))
alert("복사할 상품코드가 없습니다.");
$t_it_id = preg_replace("/[A-Za-z0-9\-]/", "", $new_it_id);
if($t_it_id)
alert("상품코드는 영문자, 숫자, - 만 사용할 수 있습니다.");
$row = sql_fetch(" select count(*) as cnt from {$g4['shop_item_table']} where it_id = '$new_it_id' ");
if ($row['cnt'])
alert('이미 존재하는 상품코드 입니다.');
@ -60,7 +64,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
sql_query($sql);
}
$qstr = "$ca_id=$ca_id&amp;sfl=$sfl&amp;sca=$sca&amp;page=$page&amp;stx=".urlencode($stx)."&amp;save_stx=".urlencode($save_stx);
$qstr = "ca_id=$ca_id&amp;sfl=$sfl&amp;sca=$sca&amp;page=$page&amp;stx=".urlencode($stx)."&amp;save_stx=".urlencode($save_stx);
goto_url("itemlist.php?$qstr");
?>

View File

@ -6,6 +6,20 @@ include_once(G4_LIB_PATH.'/iteminfo.lib.php');
auth_check($auth[$sub_menu], "w");
// it_id type 수정
$sql = " SHOW COLUMNS FROM `{$g4['shop_item_table']}` WHERE field = 'it_id' ";
$row = sql_fetch($sql);
if(intval(preg_replace("/[^0-9]/", "", $row['Type'])) != 20) {
sql_query(" ALTER TABLE `{$g4['shop_item_table']}` MODIFY COLUMN it_id VARCHAR(20) NOT NULL DEFAULT '' ", false);
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}` MODIFY COLUMN it_id VARCHAR(20) NOT NULL DEFAULT '' ", false);
sql_query(" ALTER TABLE `{$g4['shop_item_qa_table']}` MODIFY COLUMN it_id VARCHAR(20) NOT NULL DEFAULT '' ", false);
sql_query(" ALTER TABLE `{$g4['shop_item_ps_table']}` MODIFY COLUMN it_id VARCHAR(20) NOT NULL DEFAULT '' ", false);
sql_query(" ALTER TABLE `{$g4['shop_item_relation_table']}` MODIFY COLUMN it_id VARCHAR(20) NOT NULL DEFAULT '' ", false);
sql_query(" ALTER TABLE `{$g4['shop_item_relation_table']}` MODIFY COLUMN it_id2 VARCHAR(20) NOT NULL DEFAULT '' ", false);
sql_query(" ALTER TABLE `{$g4['shop_event_item_table']}` MODIFY COLUMN it_id VARCHAR(20) NOT NULL DEFAULT '' ", false);
sql_query(" ALTER TABLE `{$g4['shop_wish_table']}` MODIFY COLUMN it_id VARCHAR(20) NOT NULL DEFAULT '' ", false);
}
$html_title = "상품 ";
if ($w == "")
@ -204,8 +218,8 @@ $pg_anchor ='<ul class="anchor">
<?php if ($w == '') { // 추가 ?>
<!-- 최근에 입력한 코드(자동 생성시)가 목록의 상단에 출력되게 하려면 아래의 코드로 대체하십시오. -->
<!-- <input type=text class=required name=it_id value="<?php echo 10000000000-time()?>" size=12 maxlength=10 required> <a href='javascript:;' onclick="codedupcheck(document.all.it_id.value)"><img src='./img/btn_code.gif' border=0 align=absmiddle></a> -->
<?php echo help("상품의 코드는 10자리 숫자로 자동생성합니다. <b>직접 상품코드를 입력할 수도 있습니다.</b>\n상품코드는 영문자 숫자만 입력 가능합니다."); ?>
<input type="text" name="it_id" value="<?php echo time(); ?>" id="it_id" required class="frm_input required" size="12" maxlength="10">
<?php echo help("상품의 코드는 10자리 숫자로 자동생성합니다. <b>직접 상품코드를 입력할 수도 있습니다.</b>\n상품코드는 영문자, 숫자, - 만 입력 가능합니다."); ?>
<input type="text" name="it_id" value="<?php echo time(); ?>" id="it_id" required class="frm_input required" size="20" maxlength="20">
<?php if ($default['de_code_dup_use']) { ?><a href='javascript:;' onclick="codedupcheck(document.all.it_id.value)"><img src="<?php echo G4_ADMIN_URL; ?>/img/btn_code.gif"></a><?php } ?>
<?php } else { ?>
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
@ -972,6 +986,12 @@ function codedupcheck(id)
return;
}
var it_id = id.replace(/[A-Za-z0-9\-]/g, "");
if(it_id.length > 0) {
alert("상품코드는 영문자, 숫자, - 만 사용할 수 있습니다.");
return false;
}
$.post(
"./codedupcheck.php",
{ it_id: id },

View File

@ -283,10 +283,16 @@ $sql_common = " ca_id = '$ca_id',
if ($w == "")
{
$it_id = $_POST['it_id'];
if (!trim($it_id)) {
alert("상품 코드가 없으므로 상품을 추가하실 수 없습니다.");
alert('상품 코드가 없으므로 상품을 추가하실 수 없습니다.');
}
$t_it_id = preg_replace("/[A-Za-z0-9\-]/", "", $it_id);
if($t_it_id)
alert('상품 코드는 영문자, 숫자, - 만 사용할 수 있습니다.');
$sql = " insert {$g4['shop_item_table']}
set it_id = '$it_id',
$sql_common ";

View File

@ -191,7 +191,7 @@ if ($sfl || $stx) // 검색렬일 때만 처음 버튼을 보여줌
<td rowspan="2"><?php echo $row['it_hit']; ?></td>
<td rowspan="2" class="td_mng">
<a href="<?php echo $href; ?>"><img src="./img/icon_view.jpg" alt="<?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> 보기"></a>
<a href="javascript:_copy('<?php echo $row['it_id']; ?>', '<?php echo $row['ca_id']; ?>');"><img src="./img/icon_copy.jpg" alt="<?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> 복사"></a>
<a href="./item_copy.php?it_id=<?php echo $row['it_id']; ?>&amp;ca_id=<?php echo $row['ca_id']; ?>" class="item_copy" target="_blank"><img src="./img/icon_copy.jpg" alt="<?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> 복사"></a>
<a href="./itemform.php?w=u&amp;it_id=<?php echo $row['it_id']; ?>&amp;ca_id=<?php echo $row['ca_id']; ?>&amp;<?php echo $qstr; ?>"><img src="./img/icon_mod.jpg" alt="<?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> 수정"></a>
<a href="./itemformupdate.php?w=d&amp;it_id=<?php echo $row['it_id']; ?>&amp;ca_id=<?php echo $row['ca_id']; ?>&amp;<?php echo $qstr; ?>" onclick="return delete_confirm();"><img src="./img/icon_del.jpg" alt="<?php echo htmlspecialchars2(cut_str($row['it_name'],250, "")); ?> 삭제"></a>
</td>
@ -219,34 +219,13 @@ if ($sfl || $stx) // 검색렬일 때만 처음 버튼을 보여줌
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
function _trim(str)
{
var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자
return str.replace(pattern, "");
}
/*
function _copy(it_name, link)
{
var now = new Date();
var time = now.getTime() + '';
var new_it_id = prompt("'"+it_name+"' 상품을 복사하시겠습니까? 상품코드를 입력하세요.", time.substring(3,13));
if (!new_it_id) {
alert('상품코드를 입력하세요.');
return;
}
if (g4_charset.toUpperCase() == 'EUC-KR')
location.href = link+'&amp;new_it_id='+new_it_id;
else
location.href = encodeURI(link+'&amp;new_it_id='+new_it_id);
}
*/
function _copy(it_id, ca_id)
{
window.open('./item_copy.php?it_id='+it_id+'&amp;ca_id='+ca_id, 'copywin', 'left=100, top=100, width=300, height=200, scrollbars=0');
}
$(function() {
$(".item_copy").click(function() {
var href = $(this).attr("href");
window.open(href, "copywin", "left=100, top=100, width=300, height=200, scrollbars=0");
return false;
});
});
</script>
<?php

View File

@ -56,7 +56,7 @@ DROP TABLE IF EXISTS `shop_cart`;
CREATE TABLE IF NOT EXISTS `shop_cart` (
`ct_id` int(11) NOT NULL AUTO_INCREMENT,
`uq_id` bigint(20) unsigned NOT NULL,
`it_id` varchar(10) NOT NULL DEFAULT '0',
`it_id` varchar(20) NOT NULL DEFAULT '',
`it_opt1` varchar(255) NOT NULL DEFAULT '',
`it_opt2` varchar(255) NOT NULL DEFAULT '',
`it_opt3` varchar(255) NOT NULL DEFAULT '',
@ -317,7 +317,7 @@ CREATE TABLE IF NOT EXISTS `shop_event` (
DROP TABLE IF EXISTS `shop_event_item`;
CREATE TABLE IF NOT EXISTS `shop_event_item` (
`ev_id` int(11) NOT NULL DEFAULT '0',
`it_id` varchar(10) NOT NULL DEFAULT '',
`it_id` varchar(20) NOT NULL DEFAULT '',
PRIMARY KEY (`ev_id`,`it_id`),
KEY `it_id` (`it_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -363,7 +363,7 @@ CREATE TABLE IF NOT EXISTS `shop_faq_master` (
DROP TABLE IF EXISTS `shop_item`;
CREATE TABLE IF NOT EXISTS `shop_item` (
`it_id` varchar(10) NOT NULL DEFAULT '',
`it_id` varchar(20) NOT NULL DEFAULT '',
`ca_id` varchar(10) NOT NULL DEFAULT '0',
`ca_id2` varchar(255) NOT NULL DEFAULT '',
`ca_id3` varchar(255) NOT NULL DEFAULT '',
@ -424,7 +424,7 @@ CREATE TABLE IF NOT EXISTS `shop_item` (
DROP TABLE IF EXISTS `shop_item_info`;
CREATE TABLE IF NOT EXISTS `shop_item_info` (
`ii_id` int(11) NOT NULL AUTO_INCREMENT,
`it_id` varchar(10) NOT NULL,
`it_id` varchar(20) NOT NULL,
`ii_gubun` varchar(50) NOT NULL,
`ii_article` varchar(50) NOT NULL,
`ii_title` varchar(255) NOT NULL,
@ -442,7 +442,7 @@ CREATE TABLE IF NOT EXISTS `shop_item_info` (
DROP TABLE IF EXISTS `shop_item_ps`;
CREATE TABLE IF NOT EXISTS `shop_item_ps` (
`is_id` int(11) NOT NULL AUTO_INCREMENT,
`it_id` varchar(10) NOT NULL DEFAULT '0',
`it_id` varchar(20) NOT NULL DEFAULT '0',
`mb_id` varchar(20) NOT NULL DEFAULT '',
`is_name` varchar(255) NOT NULL DEFAULT '',
`is_password` varchar(255) NOT NULL DEFAULT '',
@ -465,7 +465,7 @@ CREATE TABLE IF NOT EXISTS `shop_item_ps` (
DROP TABLE IF EXISTS `shop_item_qa`;
CREATE TABLE IF NOT EXISTS `shop_item_qa` (
`iq_id` int(11) NOT NULL AUTO_INCREMENT,
`it_id` varchar(10) NOT NULL DEFAULT '',
`it_id` varchar(20) NOT NULL DEFAULT '',
`mb_id` varchar(20) NOT NULL DEFAULT '',
`iq_name` varchar(255) NOT NULL DEFAULT '',
`iq_password` varchar(255) NOT NULL DEFAULT '',
@ -485,7 +485,7 @@ CREATE TABLE IF NOT EXISTS `shop_item_qa` (
DROP TABLE IF EXISTS `shop_item_relation`;
CREATE TABLE IF NOT EXISTS `shop_item_relation` (
`it_id` varchar(10) NOT NULL DEFAULT '',
`it_id` varchar(20) NOT NULL DEFAULT '',
`it_id2` varchar(10) NOT NULL DEFAULT '',
PRIMARY KEY (`it_id`,`it_id2`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@ -607,7 +607,7 @@ DROP TABLE IF EXISTS `shop_wish`;
CREATE TABLE IF NOT EXISTS `shop_wish` (
`wi_id` int(11) NOT NULL AUTO_INCREMENT,
`mb_id` varchar(20) NOT NULL DEFAULT '',
`it_id` varchar(10) NOT NULL DEFAULT '0',
`it_id` varchar(20) NOT NULL DEFAULT '0',
`wi_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`wi_ip` varchar(25) NOT NULL DEFAULT '',
PRIMARY KEY (`wi_id`),