$(document).ready(function() { $("#btn_go_list").click(function() { var url = "/reporter/reporter_article_list.asp" + "?mth=" + $("#mth").val() + "&natCd=" + $("#natCd").val() + "&pageNo=" + $("#page_no").val() + "&sort_field=" + $("#sort_field").val() + "&sort_order=" + $("#sort_order").val() + "&search_field=" + $("#search_field").val() + "&search_word=" + $("#search_word").val() + "#" + $("#tabNatCd").val() + "_" + $("#page_no").val() + "_" + $("#sort_field").val() + "_" + $("#sort_order").val() + "_" + $("#search_field").val() + "_" + $("#search_word").val(); document.location.href = url; return false; }); $("#btnArtRecommend").click(function() { var param = "repArtCd="+ $("#repArtCd").val(); $.ajax({ url: '/service/reporter/svc_article_recommend_ok.asp', type: 'POST', data: param, dataType: 'json', //timeout: 3000, error: function (p_data, status) { alert("추천하기 실패되었습니다.[ERRORCODE:1]"); }, success: function(p_data) { if (p_data.result == 'y'){ alert('추천하였습니다.'); $("#recommend").text(parseInt($("#recommend").text(), 10) + 1); //음.. }else{ alert('추천하기 실패되었습니다.[ERRORCODE:10]'); } } }); }); $("#Per_reporter_view").click(function() { var url = "/reporter/reporter_profile_arts.asp" + "?mth=" + $("#mth").val() + "&natCd=" + $("#natCd").val() + "&user_seq=" + $("#userSeq").val() + "#" + $("#tabNatCd").val() + "_1_"+ $("#userSeq").val(); document.location.href = url; return false; }); jQuery.historyInit(actionHandler); $("a[rel='history_rpt_art']").live("click", function() { $("#list_wrap").hide(); $("#loading_img").removeClass("hidden"); return dvf_historyHandler(this.href); }); }); function actionHandler(p_hash) { var arrHashToken; if(p_hash) { arrHashToken = p_hash.split("_"); } else { arrHashToken = $("#init_param").val().split("_"); } if (arrHashToken.length > 0) { $("#natCd").val(arrHashToken[0]); $("#repArtCd").val(arrHashToken[1]); $("#seq").val(arrHashToken[2]); $("#rnum").val(arrHashToken[3]); read_reporter_article_view(); } } function read_reporter_article_view() { var param = {natCd: $("#natCd").val(), tabNatCd: $("#tabNatCd").val(), mth: $("#mth").val(), repArtCd: $("#repArtCd").val(), seq: $("#seq").val(), rnum: $("#rnum").val(), sort_field: $("#sort_field").val(), sort_order: $("#sort_order").val(), search_field: $("#search_field").val(), search_word: $("#search_word").val()}; $.ajax({ url: "/service/reporter/svc_article_view.asp", type: 'POST', data: param, dataType: 'json', async: true, //timeout: 3000, error: function(p_req, p_status, p_err) { $("#loading_img").addClass("hidden"); $("#list_wrap").empty().text("통신원소식을 읽는 중 오류가 발생하였습니다. 잠시 후 이용바랍니다.").show(); }, success: function(p_data) { $("#loading_img").addClass("hidden"); if (undefined == p_data.report_article_code) { $("#list_wrap").empty().text("통신원소식이 없습니다.").show(); } else { var repArtCd; if (p_data != undefined){ repArtCd = p_data.report_article_code; $("#num").html($("#seq").val()); $("#userName").html(p_data.user_name_kor); $("#approval_date").html(p_data.approval_date); $("#readnum").html(p_data.readnum); $("#recommend").html(p_data.recommend); if ($.trim(p_data.pic_name) != "") { $("#view div.photo").html(""); } else { $("#view div.photo").html(""); } $("#title").html(f_recievedDataToServiceByDecode(p_data.title)); $("#currTitle").html($("#title").html()); if(p_data.eflag_html == "1"){ $("#contents").html(f_recievedDataToServiceByDecode(p_data.contents)); }else{ $("#contents").html(F_dataToHtml(f_recievedDataToServiceByDecode(p_data.contents))); } $("#list_wrap").show(); $("#article_prev").hide(); $("#article_next").hide(); if (p_data.prevNext != undefined){ $(p_data.prevNext).each(function() { var gubun = this.gubun; var report_article_code = this.report_article_code; var rnum = this.rnum; if(this.title != "" && gubun == "prev"){ $("#article_prev").show(); $("#prevTitle").html(f_recievedDataToServiceByDecode(this.title)); $("#prevTitle").removeAttr("href").attr("href", "#" + p_data.nation_code + "_" + report_article_code + "_" + (parseInt($("#seq").val(), 10) + 1) + "_" + rnum); } if(this.title != "" && gubun == "next"){ $("#article_next").show(); $("#nextTitle").html(f_recievedDataToServiceByDecode(this.title)); $("#nextTitle").removeAttr("href").attr("href", "#" + p_data.nation_code + "_" + report_article_code + "_" + (parseInt($("#seq").val(), 10) - 1) + "_" + rnum); } }); } //이 통신원의 전체 소식 보기 처리부분 $("#Per_reporter_view").unbind("click") .bind("click", function() { var url = "/reporter/reporter_profile_list.asp" + "?mth=" + $("#mth").val() + "&natCd=" + $("#natCd").val() + "#" + $("#tabNatCd").val() + "_1_"+ p_data.art_user_seq; document.location.href = url; return false; }); } } } }); } //검색 function reporterSearch(p_searchField, p_searchWord) { var url = "/reporter/reporter_article_list.asp" + "?mth=" + $("#mth").val() + "&natCd=" + $("#natCd").val() + "&pageNo=" + $("#page_no").val() + "&sort_field=" + $("#sort_field").val() + "&sort_order=" + $("#sort_order").val() + "&search_field=" + p_searchField + "&search_word=" + p_searchWord; document.location.href = url; }