/home/mjc1/public_html/j3demo/adm/product_qa_reg.inc.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
$dir 
".";
include_once(
$dir."/_common.php");
if(
$code!=''){
    
$sql "select a.*, b.name from shop_prod_qa a left join product_m b on a.pcode = b.code where idx = '{$code}' ";
    
$cinfo sql_fetch($sql,$connect_j3);
} else {
    
$cinfo['iq_time'] = date("Y-m-d H:i:s",time());
    
$cinfo['iq_as_time'] = date("Y-m-d H:i:s",time());
}
?>
<style>
    .cust_modal1, 
    .cust_modal2 { border:0px solid #e1e1e1; width:1000px; padding:10px; font-size:13px }
    .cust_modal1 h4, 
    .cust_modal2 h4 { position:relative; top:-5px; font-size:14px; font-weight:bold; }
    .cust_modal2 { margin-top:0px; }
    .table-top-border tbody { border-top:1px solid #e1e1e1;}
    .cust_modal1 table tbody td,
    .cust_modal2 table tbody td { text-align:left; padding-left:5px;  }
    .cust_modal1 table tbody td input,
    .cust_modal2 table tbody td input{ border:1px solid #e9e9e9;  }
    .input_readonly {background:#E9E9E9; }
    .width_500 { width:500px !important; }
    .width_80 { width:80px !important; }
    .width_120 { width:120px !important; }
</style>
<form name='prod_qa_reg_form' id='stock_reg_form' method='post' action=''>
<input type='hidden' name='qstr' value=''>
<input type='hidden' name='code' value='<?php echo $cinfo['idx'];?>'>
<input type='hidden' name='ccode' value='<?php echo $cinfo['ccode'];?>'>

<div class='cust_modal1'>
    <h4>기본정보</h4>
    <table class="order-sheet table-top-border">
        <caption class="screen_out">기본정보</caption>
        <colgroup>
            <col style="width:150px;"><col style="width:850px;">
        </colgroup>

        <tbody>
        <tr>
            <th>상품</th>
            <td colspan=3>
                <input type='hidden' name='pcode' class='' value='<?php echo $cinfo['pcode'];?>'>
                <input type='text' name='pname' class='width_200 input_readonly' value='<?php echo $cinfo['name'];?>'>
                <?php if($code==''){?>&nbsp;<span class='prod_open'>[상품검색]</span><?php }?>
            </td>
        </tr>
        <tr>
            <th>비밀글 여부</th>
            <td colspan=3>
                <input type='radio' name='iq_secret' class=' ' value='0' <?php if($cinfo['iq_secret']=='0' || $cinfo['iq_secret']==''){?>checked<?php }?>> 공개글&nbsp;
                <input type='radio' name='iq_secret' class=' ' value='1' <?php if($cinfo['iq_secret']=='1'){?>checked<?php }?>> 비밀글&nbsp;
            </td>
        </tr>
        <tr>
            <th>작성자</th>
            <td colspan=3>
                <input type='text' name='iq_name' class='width_100 ' value='<?php echo $cinfo['iq_name'];?>'>
            </td>
        </tr>
        <tr>
            <th>문의 제목</th>
            <td colspan=3>
                <input type='text' name='iq_subject' class='width_500' value='<?php echo $cinfo['iq_subject'];?>'>
            </td>
        </tr>
        <tr>
            <th>문의 내용</th>
            <td colspan=3>
                <textarea name='iq_question' id='iq_question'><?php echo $cinfo['iq_question'];?></textarea>
            </td>
        </tr>
        <tr>
            <th>답변 내용</th>
            <td colspan=3>
                <textarea name='iq_answer' id='iq_answer'><?php echo $cinfo['iq_answer'];?></textarea>
            </td>
        </tr>
        <tr>
            <th>작성 일자</th>
            <td colspan=3>
                <input type='text' name='iq_time' class='width_200 ' value='<?php echo $cinfo['iq_time'];?>'>
            </td>
        </tr>
        <tr>
            <th>답변 일자</th>
            <td colspan=3>
                <input type='text' name='iq_as_time' class='width_200 ' value='<?php echo $cinfo['iq_as_time'];?>'>
            </td>
        </tr>
    </table>
</div>
</form>
<script>
$(function(){
    $(".prod_open").css("cursor","pointer").click(function(){
        $.get("product_list.inc.php?mode=stock",function(rtn){
            $("#modal_member_box2").html(rtn).dialog({
                resizable: true, height:740, width:1150, modal: true, title:"거래처 [검색]",
                buttons: {
                    닫기: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
            $("#modal_member_box").css("left","0px;");
        });
    });

    CKEDITOR.replace( 'iq_question', {    height: 250    } );
    CKEDITOR.replace( 'iq_answer', {    height: 250    } );
});

function form_save(){
    $form_obj = $("#stock_reg_form");
    if($form_obj.find("input[name='pcode']").val()==''){
        alert('상품을 선택하시기 바랍니다.'); return;
    }
    if($form_obj.find("input[name='iq_name']").val()==''){
        alert('작성자를 입력하시기 바랍니다.'); return;
    }
    if($form_obj.find("input[name='iq_subject']").val()==''){
        alert('문의 제목을 입력하시기 바랍니다.'); return;
    }
    v1 = CKEDITOR.instances.iq_question.getData();
    $("#iq_question").val(v1);
    if($form_obj.find("textarea[name='iq_question']").val()==''){
        alert('문의 내용을 입력하시기 바랍니다.'); return;
    }
    v1 = CKEDITOR.instances.iq_answer.getData();
    $("#iq_answer").val(v1);

    form_data = $form_obj.serialize(); 
    $.ajax({type:"post", url:"ajax.product_qa_process.php", data:form_data, async:false, dataType : "xml", 
        success:function(xml){    
            var v_mode = $(xml).find("mode").text();
            var v_mode_ok = $(xml).find("mode_ok").text();
            var v_msg = $(xml).find("msg").text();
            if(v_mode_ok!='Y'){
                alert(v_msg);
            } else {
                document.location.reload();
            }
        },
        error:function(rtn,status,error){    alert(error);        }
    });
}
</script>