/** * popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 멀티미디어 컴포넌트 코드를 체크하여 * 있으면 가져와서 원하는 곳에 삽입 **/ var selected_node = null; function getTable() { // 부모 위지윅 에디터에서 선택된 영역이 있는지 확인 if(typeof(opener)=="undefined") return; var node = opener.editorPrevNode; selected_node = node; // 선택된 객체가 없으면 테이블 새로 추가 if(!selected_node) { doSelectOption('table'); } else { doSelectOption('cell'); } setFixedPopupSize(); } /* 테이블, 셀 선택 옵션의 처리 */ function doSelectOption(type) { // 셀 변경 if(selected_node && type == "cell") { xGetElementById("table_option").style.display = "block"; xGetElementById("cell_attribute").style.display = "block"; var cell_width = selected_node.style.width.replace(/(px|\%)$/,''); var cell_width_unit = selected_node.style.width.replace(/^([0-9]+)/,''); var cell_height = selected_node.style.height.replace(/px$/,''); var border_color = selected_node.style.borderColor.replace(/^#/,''); if(border_color.indexOf('rgb')>-1) { var tmp_color = border_color.replace(/([a-z\(\) ]*)/ig,'').split(','); border_color = xHex(tmp_color[0], 2, '')+xHex(tmp_color[1], 2, '')+xHex(tmp_color[2], 2, ''); } var bg_color = selected_node.style.backgroundColor.replace(/^#/,''); if(bg_color.indexOf('rgb')>-1) { var tmp_color = bg_color.replace(/([a-z\(\) ]*)/ig,'').split(','); bg_color = xHex(tmp_color[0], 2, '')+xHex(tmp_color[1], 2, '')+xHex(tmp_color[2], 2, ''); } if(!bg_color) bg_color = "FFFFFF"; xGetElementById("cell_width").value = cell_width?cell_width:0; if(cell_width_unit=="px") xGetElementById("cell_width_unit_pixel").checked = "true"; else xGetElementById("cell_width_unit_percent").value = "true"; xGetElementById("cell_height").value = cell_height?cell_height:0; xGetElementById("border_color_input").value = border_color; manual_select_color("border", xGetElementById("border_color_input")) xGetElementById("bg_color_input").value = bg_color; manual_select_color("bg", xGetElementById("bg_color_input")) xGetElementById("table_attribute").style.display = "none"; xGetElementById("cell_attribute").style.display = "block"; xGetElementById("cell_attribute_select").checked = true; xGetElementById("border_color_area").style.display = "none"; xGetElementById("bg_color_area").style.display = "block"; // 테이블 변경 } else { var table_obj = xParent(selected_node); while(table_obj && table_obj.nodeName != "TABLE") { table_obj = xParent(table_obj); } if(!table_obj) xGetElementById("col_row_area").style.display = "block"; else { xGetElementById("col_row_area").style.display = "none"; var width = table_obj.width.replace(/\%/,''); var width_unit = table_obj.width.replace(/^([0-9]+)/,''); if(!width_unit) xGetElementById("width_unit_pixel").checked = "true"; else xGetElementById("width_unit_percent").value = "true"; var border = table_obj.style.borderLeftWidth.replace(/px$/,''); if(!border) border = 0; var inner_border = table_obj.getAttribute("border"); if(!inner_border) inner_border = 0; var cellspacing = table_obj.getAttribute("cellspacing"); if(!cellspacing) cellspacing = 0; var cellpadding = table_obj.getAttribute("cellpadding"); if(!cellpadding) cellpadding = 1; var border_color = table_obj.style.borderColor.replace(/^#/,''); if(border_color.indexOf('rgb')>-1) { var tmp_color = border_color.replace(/([a-z\(\) ]*)/ig,'').split(','); border_color = xHex(tmp_color[0], 2, '')+xHex(tmp_color[1], 2, '')+xHex(tmp_color[2], 2, ''); } var bg_color = table_obj.style.backgroundColor.replace(/^#/,''); if(bg_color.indexOf('rgb')>-1) { var tmp_color = bg_color.replace(/([a-z\(\) ]*)/ig,'').split(','); bg_color = xHex(tmp_color[0], 2, '')+xHex(tmp_color[1], 2, '')+xHex(tmp_color[2], 2, ''); } xGetElementById("border_color_input").value = border_color; manual_select_color("border", xGetElementById("border_color_input")) xGetElementById("bg_color_input").value = bg_color; manual_select_color("bg", xGetElementById("bg_color_input")) xGetElementById("width").value = width; xGetElementById("border").value = border; xGetElementById("inner_border").value = inner_border; xGetElementById("cellspacing").value = cellspacing; xGetElementById("cellpadding").value = cellpadding } xGetElementById("table_attribute").style.display = "block"; xGetElementById("cell_attribute").style.display = "none"; xGetElementById("table_attribute_select").checked = true; xGetElementById("border_color_area").style.display = "block"; xGetElementById("bg_color_area").style.display = "block"; } setFixedPopupSize(); } /* 추가 버튼 클릭시 부모창의 위지윅 에디터에 인용구 추가 */ function insertTable() { if(typeof(opener)=="undefined") return; var table_obj = null; if(selected_node) { table_obj = xParent(selected_node); while(table_obj && table_obj.nodeName != "TABLE") { table_obj = xParent(table_obj); } } // 테이블 생성일 경우 if(xGetElementById("table_attribute_select").checked && !table_obj) { var cols_count = parseInt(xGetElementById("cols_count").value,10); if(!cols_count) cols_count = 1; var rows_count = parseInt(xGetElementById("rows_count").value,10); if(!rows_count) rows_count = 1; var width = parseInt(xGetElementById("width").value,10); var width_unit = "%"; if(xGetElementById("width_unit_pixel").checked) width_unit = ""; var border = parseInt(xGetElementById("border").value,10); var inner_border = parseInt(xGetElementById("inner_border").value,10); var cellspacing = parseInt(xGetElementById("cellspacing").value,10); var cellpadding = parseInt(xGetElementById("cellpadding").value,10); var border_color = xGetElementById("border_color_input").value; if(border_color.length!=6) border_color = "000000"; var bg_color = xGetElementById("bg_color_input").value; if(bg_color.length!=6) bg_color = "FFFFFF"; var text = ""; text += "