/******************************************************************************* Description : GENERAL Script Last Modified : 2002/11/15 *******************************************************************************/ /******************************************************************************* CHECKBOX script *******************************************************************************/ function check_option() { // check option layer var obj = document.all["id_checkbox"]; // set position obj.style.posLeft = event.x + document.body.scrollLeft - 10; obj.style.posTop = event.y + document.body.scrollTop - 60; obj.style.visibility = "visible"; } function show_check_option() { document.all["id_checkbox"].style.visibility = "visible"; } function hide_check_option() { document.all["id_checkbox"].style.visibility = "hidden"; } function select_all() { for(var i = 1; i <= ARTICLE_ROWS; i++) { var obj = document.all["check" + i]; if(obj) { obj.value = document.all["article" + i + "_idx"].value; document.all["check_img" + i].src = PATH_SKIN + "images/chkbox_on.gif"; } } hide_check_option(); } function cancel_all() { for(var i = 1; i <= ARTICLE_ROWS; i++) { var obj = document.all["check" + i]; if(document.all["check" + i]) { obj.value = 0; document.all["check_img" + i].src = PATH_SKIN + "images/chkbox_off.gif"; } } hide_check_option(); } function reverse_chk() { for(var i = 1; i <= ARTICLE_ROWS; i++) { if(document.all["check" + i]) set_check(i); } hide_check_option(); } function set_check(row_num) { var obj = document.all["check" + row_num]; var idx = document.all["article" + row_num + "_idx"].value; if(obj.value == idx) { obj.value = 0; document.all["check_img" + row_num].src = PATH_SKIN + "images/chkbox_off.gif"; } else { obj.value = idx; document.all["check_img" + row_num].src = PATH_SKIN + "images/chkbox_on.gif"; } } /************************************************************************* PREVIEW script *************************************************************************/ function preview(content) { var obj = document.all["id_preview"]; // check content if(content == "") { obj.innerHTML = ""; return; } var text = ""; text = "" text += " "; text += " "; text += " "; text += "
"; text += " "; text += " "; text += " "; text += " "; text += "
"; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += "
"; text += "
" + content + "
"; text += "
"; obj.innerHTML = text; move_preview(); obj.style.visibility = "visible"; } function move_preview() { var obj = document.all["id_preview"]; if(obj.innerHTML != "") { obj.style.posLeft = event.x - 40 + document.body.scrollLeft; obj.style.posTop = event.y + 10 + document.body.scrollTop; } } function hide_preview() { document.all["id_preview"].style.visibility = "hidden"; } /******************************************************************************* USER_MENU script *******************************************************************************/ function user_menu(id, name, email, url) { // user menu layer var obj = document.all["id_user_menu"]; if(obj.style.visibility == "hidden") { // set position obj.style.posLeft = event.x + document.body.scrollLeft; obj.style.posTop = event.y + document.body.scrollTop; var text = ""; text += ""; text += ""; text += " "; text += " "; text += " "; text += "
"; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += "
"; text += " "; // id or name text += " "; text += " "; if(id != "") { text += " "; text += " "; } else { text += " "; text += " "; } text += " "; text += " "; // email if(email != "") { text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; } // url if(url != "" && url != "http://" && url != "HTTP://") { text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; } // memo and personal info if(id != "") { text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; text += " "; } text += "
SearchSearch
Mail
Home
Memo
Info
"; text += "
"; text += "
"; obj.innerHTML = text; obj.style.visibility = "visible"; } else { hide_user_menu(); } } function show_user_menu() { document.all["id_user_menu"].style.visibility = "visible"; } function hide_user_menu() { document.all["id_user_menu"].style.visibility = "hidden"; } function search_by_id(id) { location.href = "ttboard.cgi?act=list" + QUERY_DB + "&s_mode=def&s_id=1&s_key=" + id; hide_user_menu(); } function search_by_name(name) { location.href = "ttboard.cgi?act=list" + QUERY_DB + "&s_mode=def&s_name=1&s_key=" + name; hide_user_menu(); } function send_mail(email) { if(email == "") return; location.href = "mailto:" + email; } function ttmailer(email) { if(email == "") return; window.open("ttmailer.cgi?act=write&to="+email, "", "width=320, height=350, resizable=1, scrollbars=1"); } function open_url(url) { if(url == "") return; window.open(url, "", ""); } function user_info(id) { profile(id, 1, ""); } /******************************************************************************* SEARCH script *******************************************************************************/ function set_search(field) { var obj_field = document.all["s_"+field]; if(obj_field.value == 1) { document.all["s_"+field+"_chk"].src = PATH_SKIN + "images/chkbox_off.gif"; obj_field.value = 0; } else { document.all["s_"+field+"_chk"].src = PATH_SKIN + "images/chkbox_on.gif"; obj_field.value = 1; } } function set_search_num() { var total_num = SEARCH_TOTAL_COUNT; var search_num = search_form.s_num.value; if(search_num != '') { if(search_num > total_num) { search_num = total_num; search_form.s_num.value = total_num; } // show search field for(var i = 1; i <= total_num; i++) { if(i <= search_num) document.all["id_search" + i].style.display = "block"; else document.all["id_search" + i].style.display = "none"; } } } function show_adv_search() { document.all["id_default_search"].style.display = "none"; document.all["id_adv_search"].style.display = "block"; } function show_default_search() { document.all["id_default_search"].style.display = "block"; document.all["id_adv_search"].style.display = "none"; } function search(mode) { if(mode == "default") { if(search_form.s_id.value == 0 && search_form.s_name.value == 0 && search_form.s_title.value == 0 && search_form.s_content.value == 0) { alert("°Ë»öÇÒ Çʵ带 ¼±ÅÃÇØ ÁֽʽÿÀ."); return; } else if(search_form.s_key.value == "") { alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁֽʽÿÀ."); search_form.s_key.focus(); return; } search_form.action = "ttboard.cgi?act=list" + QUERY_DB + "&s_mode=def"; } else if(mode == "advanced") { // check search key for(var i = 1; i <= search_form.s_num.value; i++) { var obj = document.all["s_key" + i]; if(obj.value == "") { alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁֽʽÿÀ."); obj.focus(); return; } } search_form.action = "ttboard.cgi?act=list" + QUERY_DB + "&s_mode=adv"; } search_form.submit(); } /************************************************************************* COMMENT script *************************************************************************/ function add_comment(idx) { if(document.all["cmt"+idx+"_name"].value == "") { alert("À̸§À» ½á ÁÖ¼¼¿ä"); document.all["cmt"+idx+"_name"].focus(); return; } if(MEMBER_IDX == 0) { // ·Î±×ÀÎÇÑ °æ¿ì´Â ºñ¹Ð¹øÈ£¸¦ ¹ÞÁö¾ÊÀ½. if(document.all["cmt"+idx+"_pwd"].value == "") { alert("ºñ¹Ð¹øÈ£À» ½á ÁÖ¼¼¿ä"); document.all["cmt"+idx+"_pwd"].focus(); return; } } if(document.all["cmt"+idx+"_content"].value == "") { alert("³»¿ëÀ» ½á ÁÖ¼¼¿ä"); document.all["cmt"+idx+"_content"].focus(); return; } // set value comment_form.comment_name.value = document.all["cmt"+idx+"_name"].value; if(MEMBER_IDX == 0) { comment_form.comment_pwd.value = document.all["cmt"+idx+"_pwd"].value; } comment_form.comment_content.value = document.all["cmt"+idx+"_content"].value; comment_form.action = "ttboard.cgi?act=add_comment" + QUERY_DB + "&idx=" + idx; comment_form.submit(); } function show_comment_pwd(article_idx, comment_idx) { if(MEMBER_IDX == 0) { // before login var obj = document.all["id_comment_pwd"]; if(article_idx != 0 && comment_idx != 0) { comment_form.del_pwd.value = ""; comment_form.article_idx.value = article_idx; comment_form.comment_idx.value = comment_idx; obj.style.posLeft = event.x - 170 + document.body.scrollLeft; obj.style.posTop = event.y + document.body.scrollTop; } obj.style.visibility = "visible"; comment_form.del_pwd.focus(); } else { // after login comment_form.del_pwd.value = ""; comment_form.article_idx.value = article_idx; comment_form.comment_idx.value = comment_idx; del_comment(); event.returnValue = false; } } function hide_comment_pwd() { document.all["id_comment_pwd"].style.visibility = "hidden"; } function del_comment() { var pwd = comment_form.del_pwd.value; hide_comment_pwd(); comment_form.action = "ttboard.cgi?act=del_comment" + QUERY_DB + "&pwd=" + pwd; comment_form.submit(); } /******************************************************************************* WRITE script *******************************************************************************/ function verify_data() { // check name if(write_form.name.value == "") { alert("À̸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä."); write_form.name.focus(); return; } // check email if(write_form.email.value != "") { if(!check_email(write_form.email.value)) { alert("À̸ÞÀÏ Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù."); write_form.email.focus(); return; } } // check password if(WRITE_MODE != "modify" && MEMBER_IDX == 0) { if(write_form.pwd && write_form.pwd.value == "") { alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä."); write_form.pwd.focus(); return; } } // check title if(write_form.title.value == "") { alert("Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä."); write_form.title.focus(); return; } // check content if(write_form.content.value == "") { alert("³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä."); write_form.content.focus(); return; } // check category if(write_form.cate_idx) { // use categoy if(CATEGORY_WRITE_METHOD == 0) { // essential field if(write_form.cate_idx.value == "") { alert("Ä«Å×°í¸®¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä."); return; } } else if(CATEGORY_WRITE_METHOD == 1) { // alert message if(write_form.cate_idx.value == 0) { var bYes = confirm("Ä«Å×°í¸®¸¦ ¼±ÅÃÇÏÁö ¾ÊÀ¸¼Ì½À´Ï´Ù.\nÀúÀåÇϽðڽÀ´Ï±î?"); if(!bYes) return; } } else if(CATEGORY_WRITE_METHOD == 2) { // no action } } // set content info if(write_form.content_width) write_form.content_width.value = parseInt(document.all['content'].style.width); if(write_form.content_height) write_form.content_height.value = parseInt(document.all['content'].style.height); write_form.submit(); } // resize function resize_content_width(width) { var obj, total_count; // url resize_object_width("url", width, CONTENT_WIDTH); // title resize_object_width("title", width, CONTENT_WIDTH); // content resize_object_width("content", width, CONTENT_WIDTH); // file obj = document.all['file_num']; if(obj) { total_count = obj.options[obj.length-1].value; for(var i = 1; i <= total_count; i++) { resize_object_width("file"+i, width, FILE_WIDTH); resize_object_width("file"+i+"_desc", width, CONTENT_WIDTH); } } // link obj = document.all['link_num']; if(obj) { total_count = obj.options[obj.length-1].value; for(var i = 1; i <= total_count; i++) { resize_object_width("link"+i, width, FILE_WIDTH); } } } function resize_object_width(obj, width, min_width) { if(document.all[obj]) { var obj_width = parseInt(document.all[obj].style.width); if(obj_width + width >= min_width) document.all[obj].style.width = obj_width + width; } } function resize_content_height(height) { if(document.all["content"]) { var obj_height = parseInt(document.all['content'].style.height); if(obj_height + height >= CONTENT_HEIGHT) document.all['content'].style.height = obj_height + height; } } // file & link function show_file() { var obj = write_form.file_num; var file_num = obj.options[obj.selectedIndex].value; var total_file = obj.options[obj.length-1].value; for(var i = 1; i <= total_file; i++) { var obj_file = document.all["id_file" + i]; var obj_info = document.all["id_file" + i + "_info"]; if(i <= file_num) { obj_file.style.display = 'block'; if(obj_info) obj_info.style.display = 'block'; } else { obj_file.style.display = 'none'; if(obj_info) obj_info.style.display = 'none'; } } } function show_link() { var obj = write_form.link_num; var link_num = obj.options[obj.selectedIndex].value; var total_link = obj.options[obj.length-1].value; for(var i = 1; i <= total_link; i++) { if(i <= link_num) document.all["id_link" + i].style.display = 'block'; else document.all["id_link" + i].style.display = 'none'; } } function add_var(id, idx) { if(id == 'link') { write_form.all["content"].value += "{LINK:" + idx + "}"; } else if(id == 'file') { write_form.all["content"].value += "{FILE:" + idx + "}";; } } /******************************************************************************* ACTION script *******************************************************************************/ function check_enter(id) { if(event.keyCode == 13) { if(id == "search") search('default'); else if(id == "jump_page") jump_to(); else if(id == "search_num") set_search_num(); else if(id == "del_comment") del_comment(); event.returnValue = false; } } function read_article(idx) { if(LIST_TITLE_ON_CLICK == 0) { location.href = "ttboard.cgi?act=read" + QUERY + "&page=" + PAGE_CUR_PAGE + "&idx=" + idx; } else if(LIST_TITLE_ON_CLICK == 1) { window.open("ttboard.cgi?act=popup" + QUERY + "&page=" + PAGE_CUR_PAGE + "&idx=" + idx, "", "width="+LIST_POPUP_WIDTH+", height="+LIST_POPUP_HEIGHT+", scrollbars=1, resizable=1"); } else if(LIST_TITLE_ON_CLICK == 2) { window.open("ttboard.cgi?act=read" + QUERY + "&page=" + PAGE_CUR_PAGE + "&idx=" + idx, "", "width="+LIST_POPUP_WIDTH+", height="+LIST_POPUP_HEIGHT+", scrollbars=1, resizable=1"); } } function multi_read() { var flag = 0; // check index for(var i = 1; i <= ARTICLE_ROWS; i++) { var obj = document.all["check" + i]; if(obj && obj.value != 0) { // check secret article if(document.all["article" + i + "_secret"].value == 1) { alert("ºñ¹Ð °Ô½Ã¹°Àº ´ÙÁßÀб⸦ ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."); return; } flag = 1; } } if(!flag) { alert("ÀÐÀ» °Ô½Ã¹°À» ¼±ÅÃÇØÁֽʽÿÀ."); return; } list_form.action = "ttboard.cgi?act=multi_read" + QUERY; list_form.submit(); } function multi_delete() { var flag = 0; // check index for(var i = 1; i <= ARTICLE_ROWS; i++) { var obj = document.all["check" + i]; if(obj && obj.value != 0) flag = 1; } if(!flag) { alert("»èÁ¦ÇÒ °Ô½Ã¹°À» ¼±ÅÃÇØÁֽʽÿÀ."); return; } list_form.action = "ttboard.cgi?act=multi_del" + QUERY + "&page=" + PAGE_CUR_PAGE; list_form.submit(); } function reply_article(idx) { hform.action = "ttboard.cgi?act=reply" + QUERY + "&idx=" + idx; hform.submit(); } function modify_article(idx) { hform.action = "ttboard.cgi?act=modify" + QUERY + "&idx=" + idx; hform.submit(); } function delete_article(idx) { if(confirm("°Ô½Ã¹°À» »èÁ¦ÇϽðڽÀ´Ï±î?")) { hform.action = "ttboard.cgi?act=delete" + QUERY + "&idx=" + idx; hform.submit(); } } function recommend(idx) { location.href = "ttboard.cgi?act=recommend" + QUERY_DB + "&idx="+idx; } function jump_to() { var obj = document.all["jump_page"]; var page = obj.value; var last_page = document.all["last_page"].value; if(!check_number(page)) { alert("page¿¡´Â ¼ýÀÚ¸¸ ¾²½Ç ¼ö ÀÖ½À´Ï´Ù."); obj.value = ""; obj.focus(); return; } if(page != "") { if(parseInt(page) < 1) { alert("ÆäÀÌÁö´Â 1º¸´Ù Ä¿¾ßÇÕ´Ï´Ù."); obj.value = ""; obj.focus(); return; } else if(parseInt(page) > parseInt(last_page)) { alert(page + " ÆäÀÌÁö´Â Á¸ÀçÇÏÁö ¾Ê´Â ÆäÀÌÁöÀÔ´Ï´Ù."); obj.value = ""; obj.focus(); return; } else { location.href = "ttboard.cgi?act=list" + QUERY_DB + "&page="+page; } } }