From dce40a2fac5f03dd9f15f14adf04c15ec3aa0108 Mon Sep 17 00:00:00 2001 From: zero Date: Tue, 7 Aug 2007 03:49:30 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A7=81=ED=81=AC?= =?UTF-8?q?=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=EC=97=90=20=EB=A7=81?= =?UTF-8?q?=ED=81=AC=EB=A5=BC=20=EC=B6=94=EA=B0=80=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20=ED=81=AC=EA=B8=B0=20=EC=A1=B0=EC=A0=88?= =?UTF-8?q?=EC=8B=9C=20=EB=B9=84=EC=9C=A8=EC=9D=84=20=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/trunk@2231 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .../image_link/image_link.class.php | 40 +++++++++++------ .../components/image_link/lang/en.lang.php | 2 + .../components/image_link/lang/jp.lang.php | 2 + .../components/image_link/lang/ko.lang.php | 3 ++ .../components/image_link/lang/zh-CN.lang.php | 2 + .../components/image_link/tpl/popup.html | 12 ++++- .../editor/components/image_link/tpl/popup.js | 45 ++++++++++++++++++- 7 files changed, 89 insertions(+), 17 deletions(-) diff --git a/modules/editor/components/image_link/image_link.class.php b/modules/editor/components/image_link/image_link.class.php index 27bc066a2..963bdb5bf 100644 --- a/modules/editor/components/image_link/image_link.class.php +++ b/modules/editor/components/image_link/image_link.class.php @@ -41,28 +41,42 @@ **/ function transHTML($xml_obj) { $src = $xml_obj->attrs->src; - $style = $xml_obj->attrs->style; $width = $xml_obj->attrs->width; $height = $xml_obj->attrs->height; $align = $xml_obj->attrs->align; + $alt = $xml_obj->attrs->alt; $border = $xml_obj->attrs->border; + $link_url = $xml_obj->attrs->link_url; + $open_window = $xml_obj->attrs->open_window; - $tmp_arr = explode('/',$src); - $alt = array_pop($tmp_arr); + if(!$alt) { + $tmp_arr = explode('/',$src); + $alt = array_pop($tmp_arr); + } $src = str_replace(array('&','"'), array('&','&qout;'), $src); if(!$alt) $alt = $src; - $output = array(); - $output = array("src=\"".$src."\""); - if($alt) $output[] = "alt=\"".$alt."\""; - if($alt) $output[] = "title=\"".$alt."\""; - if($width) $output[] = "width=\"".$width."\""; - if($height) $output[] = "height=\"".$height."\""; - if($align) $output[] = "align=\"".$align."\""; - if($border) $output[] = "border=\"".$border."\""; - if($style) $output[] = "style=\"".$style."\""; - return ""; + $attr_output = array(); + $style_output = array(); + $attr_output = array("src=\"".$src."\""); + if($alt) { + $attr_output[] = "alt=\"".$alt."\""; + $attr_output[] = "title=\"".$alt."\""; + } + if($align) $attr_output[] = "align=\"".$align."\""; + + if($width) $style_output[] = "width:".$width."px"; + if($height) $style_output[] = "height:".$height."px"; + if(!$align) $style_output[] = "display:block"; + if($border) $style_output[] = "border:".$border."px"; + $code = sprintf("", implode(" ",$attr_output), implode(";",$style_output)); + + if($link_url) { + if($open_window =='Y') $code = sprintf('%s', $link_url, $code); + else $code = sprintf('%s', $link_url, $code); + } + return $code; } } diff --git a/modules/editor/components/image_link/lang/en.lang.php b/modules/editor/components/image_link/lang/en.lang.php index 61f348452..ecc125a8f 100644 --- a/modules/editor/components/image_link/lang/en.lang.php +++ b/modules/editor/components/image_link/lang/en.lang.php @@ -14,6 +14,8 @@ $lang->image_align_middle = "Center"; $lang->image_align_right = "Right of Article"; $lang->image_border = "Border Thickness"; + $lang->urllink_url = "URL"; + $lang->about_url_link_open_window = "Make the link to open as a new window"; $lang->cmd_get_scale = "Get Image Size"; ?> diff --git a/modules/editor/components/image_link/lang/jp.lang.php b/modules/editor/components/image_link/lang/jp.lang.php index cfe60220c..9aee062dd 100644 --- a/modules/editor/components/image_link/lang/jp.lang.php +++ b/modules/editor/components/image_link/lang/jp.lang.php @@ -14,6 +14,8 @@ $lang->image_align_middle = "中央揃え"; $lang->image_align_right = "右揃え"; $lang->image_border = "ボーダー"; + $lang->urllink_url = "URL"; + $lang->about_url_link_open_window = "チェックするとリンクをクリックした時に、新しいウィンドウで開きます。"; $lang->cmd_get_scale = "サイズ表示"; ?> diff --git a/modules/editor/components/image_link/lang/ko.lang.php b/modules/editor/components/image_link/lang/ko.lang.php index 14e25d203..d8f9bfbbe 100644 --- a/modules/editor/components/image_link/lang/ko.lang.php +++ b/modules/editor/components/image_link/lang/ko.lang.php @@ -15,5 +15,8 @@ $lang->image_align_right = "글의 우측으로"; $lang->image_border = "경계선 두께"; + $lang->urllink_open_window = "새창열기"; + $lang->about_url_link_open_window = "선택하시면 링크 선택시 새창으로 열립니다"; + $lang->cmd_get_scale = "크기 구하기"; ?> diff --git a/modules/editor/components/image_link/lang/zh-CN.lang.php b/modules/editor/components/image_link/lang/zh-CN.lang.php index 2a06e0512..72163ad03 100644 --- a/modules/editor/components/image_link/lang/zh-CN.lang.php +++ b/modules/editor/components/image_link/lang/zh-CN.lang.php @@ -14,6 +14,8 @@ $lang->image_align_middle = "居中"; $lang->image_align_right = "内容右侧"; $lang->image_border = "边框粗细"; + $lang->urllink_url = "URL"; + $lang->about_url_link_open_window = "将在新窗口中打开链接。"; $lang->cmd_get_scale = "获得图片大小"; ?> diff --git a/modules/editor/components/image_link/tpl/popup.html b/modules/editor/components/image_link/tpl/popup.html index 3ea64c262..b0f190e4e 100644 --- a/modules/editor/components/image_link/tpl/popup.html +++ b/modules/editor/components/image_link/tpl/popup.html @@ -21,12 +21,20 @@ {$lang->image_scale} + + URL + + + + {$lang->urllink_open_window} + {$lang->about_url_link_open_window} + {$lang->image_alt} diff --git a/modules/editor/components/image_link/tpl/popup.js b/modules/editor/components/image_link/tpl/popup.js index 3730c5fd2..2661942a8 100644 --- a/modules/editor/components/image_link/tpl/popup.js +++ b/modules/editor/components/image_link/tpl/popup.js @@ -2,6 +2,9 @@ * popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 이미지가 있는지 체크하여 * 있으면 가져와서 원하는 곳에 삽입 **/ + +var orig_width = 0; +var orig_height = 0; function getImage() { // 부모 위지윅 에디터에서 선택된 영역이 있는지 확인 if(typeof(opener)=="undefined") return; @@ -23,10 +26,20 @@ function getImage() { var alt = node.getAttribute("alt"); var width = node.getAttribute("width"); var height = node.getAttribute("height"); + orig_width = width; + orig_height = height; + var link_url = node.getAttribute("link_url"); + var open_window = node.getAttribute("open_window"); xGetElementById("image_url").value = src; xGetElementById("image_alt").value = alt; + if(link_url) { + link_url = link_url.replace(/<([^>]*)>/ig,'').replace(/</ig,'<').replace(/>/ig,'>').replace(/&/ig,'&'); + xGetElementById('link_url').value = link_url; + } + if(open_window == 'Y') xGetElementById('open_window').checked = "true"; + switch(align) { case 'left' : xGetElementById("align_left").checked = true; break; case 'middle' : xGetElementById("align_middle").checked = true; break; @@ -50,11 +63,18 @@ function getImageScale() { xGetElementById("width").value = img.width; xGetElementById("height").value = img.height; - + + orig_width = img.width; + orig_height = img.height; } function insertImage(obj) { if(typeof(opener)=="undefined") return; + var link_url = xGetElementById('link_url').value; + if(link_url) link_url = link_url.replace(/&/ig,'&').replace(//ig,'>'); + var open_window = 'N'; + if(xGetElementById('open_window').checked) open_window = 'Y'; + var url = xGetElementById("image_url").value; var alt = xGetElementById("image_alt").value; var align = ""; @@ -75,9 +95,10 @@ function insertImage(obj) { url = url.replace(request_uri,''); var text = "