var cache = { }; $(document).ready(function() { cache["loadimg"] = $("").attr("src", "http://image.eduhouse.net/2009_iae/image/loadinfo_s.gif"); cache["loadimg2"] = $("").attr("src", "http://image.eduhouse.net/2009_iae/image/loadinfo_s.gif"); jQuery.historyInit(actionHandler); $("a[rel='history_news']").live("click", function() { $("#news_list_cont").empty().append(cache["loadimg"]); // 관련 학교 정보 List도 clear한다. $("#sidebar_b div.school_cont").empty().append(cache["loadimg2"]); dvf_historyHandler(this.href); return false; }); // 지난 박람회 목록 중 첫번째 dl에 first-child class 설정 // IE6에서는 :first-child 선택자를 인식하지 못하므로 jquery로 처리 if (0 < $("#sidebar_b div.school_cont dl:first").length) { $("#sidebar_b div.school_cont dl:first").addClass("first_child"); } $("#sidebar_b div.school_cont a.best_form").live("click", function() { dvf_viewPopSchool(this.href, "800", "600"); return false; }); $("#sidebar_b div.school_cont a.en_lng").live("click", function() { dvf_viewPopSchool(this.href, "852", "600"); return false; }); $("#sidebar_b div.school_cont a.jp_uni").live("click", function() { dvf_viewPopSchool(this.href, "852", "600"); return false; }); }); function actionHandler(p_hash) { // hash doesn't contain the first # character. //trace("hash=" + 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]); var natIdEnd = arrHashToken[0]; // 기타국가의 li tag id값이 "nat_tab_etc" 이므로 코드값이 "0,1,2.." 형태(컴마가 있음)이면 "etc"로 바꿔준다. if (natIdEnd.indexOf(",") >= 0) natIdEnd = "etc"; // 국가 tab이 바뀐 경우에는 현재 국가 Tab 및 조회 기간의 href 값 변경 if (("#nat_tab_" + natIdEnd) != $("#nat_tab > li.on").attr("id")) { $("#nat_tab > li.on").removeClass("on"); var srcTarget = $("#nat_tab_" + natIdEnd); srcTarget.addClass("on"); $("#contents_b > div.news_cont_tit > h3").text(srcTarget.find("a").text() + " 학교소식"); $("#term_D").attr("href", "#" + $("#natCd").val() + "_D_1"); $("#term_W").attr("href", "#" + $("#natCd").val() + "_W_1"); $("#term_M").attr("href", "#" + $("#natCd").val() + "_M_1"); $("#term_A").attr("href", "#" + $("#natCd").val() + "_A_1"); } if (arrHashToken.length > 1) $("#term").val(arrHashToken[1]); if (arrHashToken.length > 2) $("#page_no").val(arrHashToken[2]); // 최소 국가코드는 지정되어야 뉴스를 읽어옴. 기간 및 페이지번호는 default 값 사용. read_news_list(); } } function read_news_list() { var param = {ntype: $("#ntype").val(), natCd: $("#natCd").val(), term: $("#term").val(), page_no: $("#page_no").val(), page_size: $("#page_size").val()}; $.ajax({ url: "/service/news/svc_news_list.asp", type: 'POST', data: param, dataType: 'json', async: true, //timeout: 3000, error: function(p_req, p_status, p_err) { //alert('ERR1'); alert("학교뉴스를 읽는 중 오류가 발생하였습니다. 잠시 후 이용바랍니다."); }, success: function(p_data) { var newsList = $("#news_list_cont"); newsList.empty(); $("div.news_cont_tit > h3").text(p_data.nat_gb_name + " 학교소식"); var schCodeList = ""; if (p_data.newsCnt <= 0) { newsList.append("등록된 뉴스가 없습니다."); } else { for (var idx = 0; idx < p_data.newsList.length; idx++) { var datarec = p_data.newsList[idx]; var viewPageUrl = "/news/news_view.asp" + "?mth=" + $("#search_method").val() + "&ntype=" + datarec.ntype + "&natCd=" + datarec.nation + "&term=" + $("#term").val() + "&page_no=" + $("#page_no").val() + "&page_size=" + $("#page_size").val() + "&seq=" + datarec.seq; newsList.append("
" + "
" + "[" + datarec.nat_name + "]" + dvf_html2entity(dvf_ellipsisStr(unescape(datarec.title),80)) + "
" + "
" + datarec.regdate + "|" + "조회 " + datarec.read_cnt + "
" + "
" + dvf_html2entity(dvf_ellipsisStr(unescape(datarec.summary),200)) + "
" + "
" + "
"); if (0 < datarec.sch_code ) { schCodeList += "," + datarec.sch_code; } } } // paging 다시 그리기 viewPaging(parseInt($("#page_no").val(),10), parseInt($("#page_size").val(),10), p_data.newsCnt, parseInt($("#view_paging_no").val(),10), "div.page_index"); // 새로 read한 news와 관련된 학교 정보 출력 $("ul.sidebar_b_tab > li.on").text("[" + p_data.nat_gb_name + "] 학교뉴스에 소개된 학교 보기"); if ("" != schCodeList) { schCodeList = schCodeList.substr(1); read_sch_list(schCodeList); } else { $("#sidebar_b div.school_cont").empty().append("

등록된 관련 학교 정보가 없습니다.

"); } } }); } function viewPaging(p_pageNo, p_pageSize, p_dataCnt, p_viewPagingNo, p_containerSelector) { var totPageCnt = Math.floor((p_dataCnt - 1) / p_pageSize) + 1; var stPageno = p_pageNo - ((p_pageNo - 1) % p_viewPagingNo); var endPageno = stPageno + p_viewPagingNo - 1; if (endPageno > totPageCnt) endPageno = totPageCnt; //trace("stPageno:" + stPageno + ", endPageno:" + endPageno + ", totPage:" + totPageCnt + ", viewPaing:" + p_viewPagingNo); var natCd = $("#natCd").val(); var term = $("#term").val(); var pagingTxt = 1 < p_pageNo ? "첫 페이지" : "첫 페이지"; pagingTxt += p_viewPagingNo < stPageno ? "이전" : "이전"; for (var idx = stPageno; idx <= endPageno; idx++) { pagingTxt += "" + idx + ""; } pagingTxt += totPageCnt > endPageno ? "다음" : "다음"; pagingTxt += totPageCnt > p_pageNo ? "끝 페이지" : "끝 페이지"; $("div.page_index").html(pagingTxt); } function read_sch_list(p_schCodeList) { var param = {sch_code_list: p_schCodeList}; $.ajax({ url: "/service/news/svc_sch_list_in_news.asp", type: 'POST', data: param, dataType: 'json', async: true, //timeout: 3000, error: function(p_req, p_status, p_err) { alert("학교뉴스에 소개된 학교를 읽는 중 오류가 발생하였습니다. 잠시 후 이용바랍니다."); }, success: function(p_data) { var schList = $("#sidebar_b div.school_cont"); schList.empty(); p_data.sch_list if (p_data.sch_list && (0 < p_data.sch_list.length)) { for (var idx = 0; idx < p_data.sch_list.length; idx++) { var datarec = p_data.sch_list[idx]; var lnkUrl = ""; var lnkClass = ""; if ("1004001" == datarec.lang_div_code) { if ("1003001" == datarec.course_div_code) { lnkUrl = "/study_info/pop_langsch_view.asp?school_index_code=" + datarec.sch_code; lnkClass = "en_lng"; } else { lnkUrl = "/study_info/pop_sch_view.asp?best_cd=" + datarec.sch_best_code; lnkClass = "best_form"; } } else { if ("1003002" == datarec.course_div_code) { lnkUrl = "/study_info/pop_unisch_jp_view.asp?school_index_code=" + datarec.sch_code; lnkClass = "jp_uni"; } else { lnkUrl = "/study_info/pop_sch_view.asp?best_cd=" + datarec.sch_best_code; lnkClass = "best_form"; } } schList.append( "
" + "
" + "
" + datarec.sch_name + "
" + "
" + " 위치 : " + datarec.sch_position + "
" + " 운영형태 : " + datarec.op_name + "
" + " 한국학생비율 : " + datarec.korean_rate + "
" + "
" + "
"); } // 지난 박람회 목록 중 첫번째 dl에 first-child class 설정 // IE6에서는 :first-child 선택자를 인식하지 못하므로 jquery로 처리 if (0 < $("#sidebar_b div.school_cont dl:first").length) { $("#sidebar_b div.school_cont dl:first").addClass("first_child"); } } else { schList.append("

등록된 관련 학교 정보가 없습니다.

"); } } }); }