// ·©Å©¾÷ °Ô½ÃÆÇ »ç¿ëÀÚ Å¬·¡½º var RANKUP_BOARD = Class.create({ // Ãʱ⼳Á¤ initialize: function() { this.version = 'v2.0 r080828'; this.comment_items = null; this.board_url = domain+"rankup_module/rankup_board/"; this.index_url = null; this.registFrm = null; this.selectAttach = null; this.board_id = null; this.no = null; this.attach_max_width = null; this.attach_max_nums = null; this.clickObject = null; this.showLayer = null; }, // °Ô½Ã¹° Àбâ article_view: function(no, passwd) { var url = this.index_url+"/board.html?cmd=view_article&id="+this.board_id+"&ano="+no+"&passwd="+passwd; var myRequest = new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { if(!transport.responseText.match(null)) { var resultData = transport.responseXML.getElementsByTagName('resultData')[0]; if(resultData.firstChild.nodeValue.indexOf('alert')!=-1) eval(resultData.firstChild.nodeValue); else document.location.href = resultData.firstChild.nodeValue; } transport = null; }, onComplete: function() {myRequest=null} }); }, // °Ô½Ã¹° ¼öÁ¤ article_modify: function(click_obj, passwd) { var classObj = this; var url = "./board.html?cmd=modify_article&id="+this.board_id+"&ano="+this.no+"&passwd="+passwd; var classObj = this; var myRequest = new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { if(!transport.responseText.match(null)) { var resultData = transport.responseXML.getElementsByTagName('resultData')[0]; eval(resultData.firstChild.nodeValue); } transport = null; }, onComplete: function() {myRequest=null} }); }, // °Ô½Ã¹° »èÁ¦ article_delete: function(click_obj, passwd) { if(passwd!==undefined && !confirm("°Ô½Ã¹°À» »èÁ¦ÇϽðڽÀ´Ï±î?"+SPACE)) return false; var classObj = this; var url = "./board.html?cmd=delete_article&id="+this.board_id+"&ano="+this.no+"&passwd="+passwd; var myRequest = new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { if(!transport.responseText.match(null)) { var resultData = transport.responseXML.getElementsByTagName('resultData')[0]; eval(resultData.firstChild.nodeValue); } transport = null; }, onComplete: function() {myRequest=null} }); }, // °Ô½Ã¹° ¼±Åà check_all: function(val, img_obj) { var nos = document.getElementsByName("ano[]"); for(var i=0, j=0; i "; obj.innerHTML += item; }, // ¾ÆÀÌÅÛ ¸¶¿ì½º¿À¹ö/¾Æ¿ô½Ã toggle_className: function(event) { this.className = event.type!="mouseover" ? this.getAttribute("selected")!=null ? "attachSelectItem" : "attachNormalItem" : this.getAttribute("selected")!=null ? "attachSHoverItem" : "attachHoverItem"; }, // ÷ºÎÆÄÀÏ ·Îµå - ¼öÁ¤½Ã¿¡¸¸ »ç¿ë attach_load: function() { var attach_items = null; var classObj = this; var url = "./board.html?cmd=load_attach&id="+this.board_id+"&ano="+this.no; var myRequest = new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { if(!transport.responseText.match(null)) { var resultData = transport.responseXML.getElementsByTagName("resultData")[0]; var configData = resultData.getElementsByTagName('attach')[0]; classObj.attach_max_width = configData.getAttribute('max_width'); classObj.attach_max_nums = configData.getAttribute('max_nums'); attach_items = resultData.getElementsByTagName("item"); var obj = $('div_attach_item'); document.getElementsByName('attach')[0].disabled = attach_items.length>=classObj.attach_max_nums; if(attach_items.length) { for(var i=0; i("+fsize+")
"+fwh_size; Event.observe(new_item, 'click', classObj.attach_item_preview); } Event.observe(new_item, 'mouseover', classObj.toggle_className); Event.observe(new_item, 'mouseout', classObj.toggle_className); } new_item.className = "attachSelectItem"; new_item.setAttribute("selected", "selected"); // ÷ºÎÆÄÀÏ ¹Ì¸®º¸±â classObj.attach_item_preview(new_item, true); } } transport = null; }, onComplete: function() {myRequest = null} }); }, // ÷ºÎÆÄÀÏ Ç¥½Ã attach_draw: function(file_name, info) { // ¾ÆÀÌÅÛ Ãß°¡ var new_item = document.createElement("li"); new_item.className = "attachSelectItem"; new_item.setAttribute("selected", "selected"); new_item.setAttribute("fname", file_name); new_item.setAttribute("fwidth", info['width']); new_item.setAttribute("fheight", info['height']); new_item.setAttribute("ftype", info['type']); $('div_attach_item').appendChild(new_item); if(in_array(info['type'], new Array("jpg", "gif", "bmp", "png"))) { var new_img = new Image(); new_img.style.width = "110px"; new_img.style.height = "100%"; new_img.style.border = "#999999 1px solid"; new_img.src = domain + file_name; new_item.appendChild(new_img); new_item.style.padding = "0px"; Event.observe(new_img, 'click', this.attach_item_preview); } else { new_item.innerHTML = info['text']; Event.observe(new_item, 'click', this.attach_item_preview); } Event.observe(new_item, 'mouseover', this.toggle_className); Event.observe(new_item, 'mouseout', this.toggle_className); // ÷ºÎÆÄÀÏ ¹Ì¸®º¸±â this.attach_item_preview(new_item, true); document.getElementsByName('attach')[0].disabled = $('div_attach_item').getElementsByTagName('li').length>=this.attach_max_nums; }, // ¼±ÅþÆÀÌÅÛ ¹Ì¸®º¸±â - ¡Ø Ŭ·¡½º º¯¼ö¸íÀ» Á÷Á¢ »ç¿ë attach_item_preview: function(event, draw) { var fileObj = event.type=="click" ? Event.element(event) : event; if(fileObj.tagName.indexOf("IMG")!=-1) fileObj = fileObj.parentNode; if(draw!=true && fileObj===rankup_board.selectAttach) return false; var url = domain + fileObj.getAttribute('fname'); // domain : rankup_basic.class.php ¿¡¼­ Á¤ÀÇ var preview = $('div_attach_preview'); preview.innerHTML = ''; switch(fileObj.getAttribute('ftype')) { case "swf": rankup_board.append_flash_object(preview, url, "100%", "100%"); break; case "gif": case "jpg": case "bmp": case "png": var img = new Image(); img.style.width = img.style.height = "100%"; img.src = url; preview.appendChild(img); break; } if(rankup_board.selectAttach!=null) { rankup_board.selectAttach.removeAttribute("selected"); rankup_board.selectAttach.className = "attachNormalItem"; } fileObj.className = "attachSelectItem"; fileObj.setAttribute("selected", "selected"); rankup_board.selectAttach = fileObj; }, // ÷ºÎÆÄÀÏ »èÁ¦ attach_delete: function() { if(this.selectAttach==null) { alert("»èÁ¦ÇÏ½Ç Ã·ºÎÆÄÀÏÀ» ¼±ÅÃÇÏ¿© ÁֽʽÿÀ."+SPACE); return false; } if(!confirm("¼±ÅÃÇϽŠÆÄÀÏÀ» »èÁ¦ÇϽðڽÀ´Ï±î?"+SPACE)) return false; var classObj = this; var url = "./board.html?cmd=delete_attach&id="+this.board_id+"&ano="+this.no+"&file="+this.selectAttach.getAttribute('fname'); var myRequest = new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { if(!transport.responseText.match(null)) { var resultData = transport.responseXML.getElementsByTagName('resultData')[0]; alert(resultData.firstChild.nodeValue+SPACE); if(resultData.getAttribute('result')=="success") { // ¾ÆÀÌÅÛ ³ëµå »èÁ¦ $('div_attach_item').removeChild(classObj.selectAttach); $('div_attach_preview').update(''); classObj.selectAttach = null; document.getElementsByName('attach')[0].disabled = $('div_attach_item').getElementsByTagName('li').length>=classObj.attach_max_nums; } } transport = null; }, onComplete: function() {myRequest=null} }); }, // ÷ºÎÆÄÀÏ º»¹®¿¡ »ðÀÔ add_content: function(content) { // content : object_id if(this.selectAttach==null) { alert("º»¹®¿¡ »ðÀÔÇÒ Ã·ºÎÆÄÀÏÀ» ¼±ÅÃÇÏ¿© ÁֽʽÿÀ."+SPACE); return false; } var obj = this.selectAttach; if(!in_array(obj.getAttribute('ftype'), Array('gif', 'jpg', 'bmp', 'png', 'swf'))) { alert("º»¹®¿¡ »ðÀÔÇÒ ¼ö ¾ø´Â ÆÄÀÏ ÇüÅÂÀÔ´Ï´Ù."+SPACE); return false; } var contentObj = $("iframe"+content).contentWindow; switch(obj.getAttribute('ftype')) { case "gif": case "jpg": case "bmp": case "png": contentObj.focus(); var width_prefix = parseInt(obj.getAttribute('fwidth'), 10)>this.attach_max_width ? "\" width=\""+this.attach_max_width : ''; contentObj.document.execCommand('InsertImage', false, domain+obj.getAttribute('fname')+width_prefix); // À̹ÌÁö width ÁöÁ¤ break; // Ç÷¡½Ã °ü·Ã º»¹® »ðÀÔ ¼öÁ¤ÇؾßÇÔ case "swf": contentObj.focus(); var width = obj.getAttribute('fwidth'); var height = obj.getAttribute('fheight'); if(width>this.attach_max_width) { // »çÀÌÁî ±³Á¤ height = Math.ceil(height / (width / parseInt(this.attach_max_width, 10))); width = this.attach_max_width; alert(width +":"+ height); } this.append_flash_object(contentObj.document.body, domain+obj.getAttribute('fname'), width, height); break; } }, //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // ÄÚ¸àÆ® ·Îµå comment_load: function() { var classObj = this; var url = "./board.html?cmd=load_comment&id="+this.board_id+"&ano="+this.no; var myRequest = new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { if(!transport.responseText.match(null)) { var resultData = transport.responseXML.getElementsByTagName('resultData')[0]; classObj.comment_items = resultData.getElementsByTagName('item'); $('div_comment_articles').update(''); for(var i=0; i" : ''; var newDiv = document.createElement('div'); newDiv.id = "div_comment_item"; if(i%2) newDiv.className = "even"; newDiv.innerHTML = "\
  • \
    "+comment_icon+"
    \
    "+comment_author+"
    \
    "+comment_content+"
    \
  • \
  • \
    ¡¿
    \
    "+comment_wdate+"
    \
  • "; $('div_comment_articles').appendChild(newDiv); } } transport = null; }, onComplete: function() {myRequest=null} }); }, // ÄÚ¸àÆ® Ç¥½Ã comment_draw: function(info) { var form = document.commentRegistFrm; var comment_icon = form.icon.value ? "" : ''; var comment_content = document.all ? form.content.value.replace(/\r\n/gi, "
    ") : form.content.value.replace(/\n/gi, "
    "); var newDiv = document.createElement('div'); newDiv.id = "div_comment_item"; newDiv.innerHTML = "\
  • \
    "+comment_icon+"
    \
    "+form.nickname.value+"
    \
    "+comment_content+"
    \
  • \
  • \
    ¡¿
    \
    "+info.wdate+"
    \
  • "; if($('div_comment_articles').select("div[id=div_comment_item]").length%2) newDiv.className = "even"; $('div_comment_articles').appendChild(newDiv); var cnumObj = $('div_comment_nums').getElementsByTagName('span')[0]; cnumObj.innerHTML = parseInt(cnumObj.innerHTML, 10) + 1; // ´ñ±Û ¼ö Áõ°¡ form.reset(); }, // ÄÚ¸àÆ® »èÁ¦ comment_delete: function(no, passwd) { try { var click_obj = Event.element(event); this.clickObject = click_obj; } catch(e) { var click_obj = this.clickObject; this.clickObject = null; } var classObj = this; if(passwd!==undefined && !confirm("´ñ±ÛÀ» »èÁ¦ÇϽðڽÀ´Ï±î?"+SPACE)) return false; var url = "./board.html?cmd=delete_comment&id="+this.board_id+"&ano="+this.no+"&passwd="+passwd+"&no="+no; var myRequest = new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { if(!transport.responseText.match(null)) { var resultData = transport.responseXML.getElementsByTagName('resultData')[0]; eval(resultData.firstChild.nodeValue); } transport = null; }, onComplete: function() {myRequest=null} }); }, // ¾ÆÀÌÄÜ ¼±Åñâ select_icon: function() { var obj = $('div_comment_icon_box'); if(!obj.innerHTML) { for(var no=1; no<=10; no++) { var newLi = document.createElement('li'); newLi.innerHTML = ""; obj.appendChild(newLi); } Event.observe(document.commentRegistFrm, 'focusin', function() { obj.style.display = "none" }); $$('#div_comment_icon_box li').each(function(li) { Event.observe(li, 'click', function(el) { var _obj = Event.element(el); if(_obj.src==undefined) return; $('div_comment_icon').getElementsByTagName('img')[0].src = _obj.src; $('icon').value = _obj.getAttribute('no'); obj.style.display = "none"; }); }); } obj.style.display = "block"; }, // ºñ¹Ð¹øÈ£ ÀԷ±â scanf_passwd: function(no, click_obj, func_name, board_id) { var obj = $('div_scanf_passwd'); if(obj!=null) obj.parentNode.removeChild(obj); obj = document.createElement("span"); obj.id = "div_scanf_passwd"; obj.style.width = "186px"; // ¸®»çÀÌÁî obj.style.marginTop = "-21px"; obj.style.marginRight = "-3px"; obj.style.marginBottom = "0px"; obj.style.border = "#777777 1px solid"; obj.style.padding = "4px"; obj.style.paddingRight = "0px"; obj.style.backgroundColor = "white"; switch(func_name) { // ¸®½ºÅ¸ÀÏ case "article_view": // ºñ¹Ð±Û º¸±â obj.style.position = "absolute"; if(click_obj.innerHTML.toLowerCase().indexOf('img')!=-1) { obj.style.marginTop = "0px"; obj.style.marginLeft = "-186px"; } else { obj.style.marginTop = "-9px"; obj.style.marginLeft = "4px"; } if(board_id!==undefined && board_id!='') this.board_id = board_id; break; case "article_delete": // °Ô½Ã¹° »èÁ¦ case "article_modify": // °Ô½Ã¹° ¼öÁ¤ obj.style.position = "absolute"; obj.style.marginTop = "0px"; obj.style.marginLeft = "-186px"; break; } var classObj = this; setTimeout(function() { obj.innerHTML = ""; click_obj.parentNode.insertBefore(obj, click_obj.previousSibling); obj.getElementsByTagName('input')[0].focus(); },0); } }); var rankup_board = new RANKUP_BOARD;