| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <?php
- include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
- include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';
- $cd_brand = $_REQUEST['cd_brand'];
- $mp = "10"; //set top nav
- /*$ds_cate = $_REQUEST[ds_cate];
- if(!$ds_cate) $ds_cate='A0';
- */
- if($cd_brand!="" || $cd_brand!=null){
- $sql ="SELECT
- *
- FROM car_brand mst
- WHERE cd_brand='$cd_brand' AND ds_delind='N'";
- $col=mysql_fetch_array(mysql_query($sql));
- if (!empty($col['cd_brand'])){
- $cd_brand =$col["cd_brand"];
- $nm_brand =$col["nm_brand"];
- $cd_category =$col["cd_category"];
- $mode ="Update";
- }else{
- AlertBack("게시물을 가져오지 못하였습니다.");
- }
- $PageNo = $PageNo;
- }else{
- $mode="Add";
- }
- if ($mode=="Add"){
- $cd_userid = $_SESSION['admin_cd_userid'];
- }
- if($ds_open==""){$ds_open="Y";}
- ?>
- <? include("../inc/inc_top.php") ?>
- <? include("../inc/inc_header.php") ?>
- <section id="contents">
- <!-- 제조사 -->
- <h2>제조사</h2>
- <form id="frmForm" name="frmForm" method="post" action="brand_proc.php" enctype="multipart/form-data">
- <input type="hidden" name="mode" id="mode" value="<?=$mode?>"/>
- <input type="hidden" name="cd_userid" id="cd_userid" value="<?=$cd_userid?>"/>
- <input type="hidden" name="cd_brand" id="cd_brand" value="<?=$cd_brand?>"/>
- <input type="hidden" name="PageNo" id="PageNo" value="<?=$PageNo?>"/>
- <div class="tbl_wrap">
- <table class="tbl_list2 ty2">
- <colgroup>
- <col width="20%">
- <col width="*">
- </colgroup>
- <tr>
- <th>구분</th>
- <td>
- <span class="select2" style="width:200px;">
- <select id="cd_category" name="cd_category"></select>
- </span>
- </td>
- </tr>
- <tr>
- <th>제조사</th>
- <td><input type="text" class="inp_txt" style="width:60%;" name="nm_brand" id="nm_brand" value="<?=$nm_brand?>"></td>
- </tr>
- </table>
- </div>
- </form>
- <div class="btn_right">
- <? if($mode=="Add"){?>
- <a href="#" class="rnd_btn ty2 black" id="btn_write">등록</a>
- <?}elseif($mode=="Update"){?>
- <a href="#" class="rnd_btn ty2 black" id="btn_write">수정</a>
- <a href="#" class="rnd_btn ty2 black" onclick="fnDelete('<?=$cd_brand?>');" id="btn_delete">삭제</a>
- <?}?>
- <a href="#" class="rnd_btn ty2 black" onclick="fnList('<?=$cd_brand?>');return false;">목록</a>
- </div>
- </section>
- <form id="delFrm" name="delFrm" method="post" action="./brand_proc.php">
- <input type="hidden" name="mode" id="mode" value="Delete"/>
- <input type="hidden" name="cd_brand" id="cd_brand_del"/>
- <input type="hidden" name="ds_cate" value="<?=$ds_cate?>"/>
- </form>
- <script language="javascript" type="text/javascript">
- var ds_mode ="<?=$mode?>";
- function fnList(cd_brand){
- location.replace("./brand.php?cd_brand="+cd_brand);
- }
- function fnDelete(cd_brand){
- $("#cd_brand_del").val(cd_brand);
- var custom_opts = {
- title : '정말로 삭제 하시겠습니까?',
- btn_close_show : false,
- }
- custom_modal_confirm(custom_opts, function(confirm) {
- if(confirm) {
- $("#btn_delete").hide();
- var data = $("#delFrm").serialize();
- $.ajax({
- url : 'brand_proc.php',
- type: 'POST',
- dataType : 'json',
- data: data,
- success: function(res) {
- custom_modal_confirm_close();
- $("#btn_delete").show();
- //세션 종료시 로그인 페이지로 이동
- if(res.CODE != "0000") {
- custom_opts.title = res.MSG;
- if(res.CODE == "4444") {
- window.location.href = res.DATAS.URL;
- }
- custom_modal_alert(custom_opts);
- return false;
- }
- custom_opts.title = '삭제 되었습니다.';
- custom_opts.event_esc_key = false;
- custom_modal_alert(custom_opts, function() {
- link("<?=ADMIN_PATH?>/car/brand.php");
- });
- },
- error:function(request,status,error){
- $("#btn_delete").show();
- custom_modal_confirm_close();
- alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
- }
- });
- }else {
- $("#btn_delete").show();
- return false;
- }
- });
- }
- $(document).ready(function() {
- setCodeSelectJqTransForm("listcategory","cd_category", "car_category","cd_category","<?=$cd_category?>","선택하세요","");
- $("#btn_write").bind("click",function(){
- var fieldlist = [["cd_category","구분"],["nm_brand","제조사"]]
- if (!fnCheckForm(fieldlist)){
- return false;
- }
- var custom_opts = {
- title : '',
- btn_close_show : false,
- }
- var mode = "<?=$mode?>";
- if(mode == "Update") {
- custom_opts.title = '정보를 수정하시겠습니까?';
- }else {
- custom_opts.title = '정보를 등록하시겠습니까?';
- }
- custom_modal_confirm(custom_opts, function(confirm) {
- if(confirm) {
- $("#btn_write").hide();
- var data = $("#frmForm").serialize();
- $.ajax({
- url : 'brand_proc.php',
- type: 'POST',
- dataType : 'json',
- data: data,
- success: function(res) {
- custom_modal_confirm_close();
- $("#btn_write").show();
- //세션 종료시 로그인 페이지로 이동
- if(res.CODE != "0000") {
- custom_opts.title = res.MSG;
- if(res.CODE == "4444") {
- window.location.href = res.DATAS.URL;
- }
- custom_modal_alert(custom_opts);
- return false;
- }
- if(mode == "Update") {
- custom_opts.title = '수정이 완료되었습니다.';
- }else {
- custom_opts.title = '등록이 완료되었습니다.';
- }
- custom_opts.event_esc_key = false;
- custom_modal_alert(custom_opts, function() {
- reload();
- });
- },
- error:function(request,status,error){
- $("#btn_write").show();
- custom_modal_confirm_close();
- alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
- }
- });
- }else {
- $("#btn_write").show();
- return false;
- }
- });
- });
- });
- </script>
- <? include("../inc/inc_footer.php") ?>
- <? include("../inc/inc_bottom.php") ?>
- <?
- mysql_close($connect);
- ?>
|