diff --git a/modules/editor/components/image_link/icon.gif b/modules/editor/components/image_link/icon.gif new file mode 100644 index 000000000..3b9334c2d Binary files /dev/null and b/modules/editor/components/image_link/icon.gif differ diff --git a/modules/editor/components/image_link/image_link.class.php b/modules/editor/components/image_link/image_link.class.php new file mode 100644 index 000000000..8f91428b8 --- /dev/null +++ b/modules/editor/components/image_link/image_link.class.php @@ -0,0 +1,97 @@ +editor_sequence = $editor_sequence; + $this->component_path = $component_path; + } + + /** + * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 + **/ + function getPopupContent() { + // 템플릿을 미리 컴파일해서 컴파일된 소스를 return + $tpl_path = $this->component_path.'tpl'; + $tpl_file = 'popup.html'; + + Context::set("tpl_path", $tpl_path); + + $oTemplate = &TemplateHandler::getInstance(); + return $oTemplate->compile($tpl_path, $tpl_file); + } + + /** + * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method + * + * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서 + * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 + **/ + function transHTML($xml_obj) { + $src = $xml_obj->attrs->src; + $width = $xml_obj->attrs->width; + $height = $xml_obj->attrs->height; + $align = $xml_obj->attrs->align; + $alt = $xml_obj->attrs->alt; + $border = (int)$xml_obj->attrs->border; + $link_url = $xml_obj->attrs->link_url; + $open_window = $xml_obj->attrs->open_window; + $style = $xml_obj->attrs->style; + $margin = (int)$xml_obj->attrs->margin; + + if(!$alt) { + $tmp_arr = explode('/',$src); + $alt = array_pop($tmp_arr); + } + + $src = str_replace(array('&','"'), array('&','&qout;'), $src); + if(!$alt) $alt = $src; + + $attr_output = array(); + $attr_output = array("src=\"".$src."\""); + if($alt) { + $attr_output[] = "alt=\"".$alt."\""; + $attr_output[] = "title=\"".$alt."\""; + } + if($margin) { + $style = trim(preg_replace('/margin[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';'; + $style = str_replace(';;',';',$style); + if($style == ';') $style = ''; + $style .= ' margin:'.$margin.'px;'; + } + if($align) $attr_output[] = "align=\"".$align."\""; + + if(preg_match("/\.png$/i",$src)) $attr_output[] = "class=\"iePngFix\""; + + if($width) $attr_output[] = 'width="'.$width.'"'; + if($height) $attr_output[] = 'height="'.$height.'"'; + if($border) { + $style = trim(preg_replace('/border[a-z\-]*[ ]*:[ ]*[0-9 a-z]+(;| )/i','', $style)).';'; + $style = str_replace(';;',';',$style); + if($style == ';') $style = ''; + $style .= ' border-style: solid; border-width:'.$border.'px;'; + } + + $code = sprintf("", implode(' ',$attr_output), $style); + + 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/info.xml b/modules/editor/components/image_link/info.xml new file mode 100644 index 000000000..670a4e856 --- /dev/null +++ b/modules/editor/components/image_link/info.xml @@ -0,0 +1,29 @@ + + + 이미지 추가 + イメージ追加 + 插入图像 + Add Images + Añadir imágenes + Добавление изображений + 圖片連結 + 에디터에 이미지를 추가하거나 속성을 변경할 수 있습니다. + エディターでイメージの追加、属性の変更が出来ます。 + 可以插入图像或编辑其相应属性。 + It can add an image to editor or change the attribution of image. + Se puede añadir una imagen a editor o cambiar la atribución de la imagen. + Это может добавить изображение в редактор или изменить параметры изображения. + 可以新增或編輯其相關屬性。 + 0.1 + 2007-02-28 + + + zero + zero + zero + zero + zero + zero + zero + + diff --git a/modules/editor/components/image_link/lang/en.lang.php b/modules/editor/components/image_link/lang/en.lang.php new file mode 100644 index 000000000..568914d1d --- /dev/null +++ b/modules/editor/components/image_link/lang/en.lang.php @@ -0,0 +1,22 @@ + + * @brief editor Module > language pack of image_link component + **/ + + $lang->image_url = "Image Path"; + $lang->image_alt = "Input Description"; + $lang->image_scale = "Image Size"; + $lang->image_align = "Align Style"; + $lang->image_align_normal = "Occupy a Paragraph"; + $lang->image_align_left = "Left of Article"; + $lang->image_align_middle = "Center"; + $lang->image_align_right = "Right of Article"; + $lang->image_border = "Border Thickness"; + $lang->urllink_url = "URL"; + $lang->image_margin = 'Image Margin'; + + $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/es.lang.php b/modules/editor/components/image_link/lang/es.lang.php new file mode 100644 index 000000000..221d794a0 --- /dev/null +++ b/modules/editor/components/image_link/lang/es.lang.php @@ -0,0 +1,22 @@ + + * @brief editor Module > language pack of image_link component + **/ + + $lang->image_url = "Ruta de la imagen"; + $lang->image_alt = "Descripcion de Entrada"; + $lang->image_scale = "Tamano de la Imagen"; + $lang->image_align = "Alinear Estilo"; + $lang->image_align_normal = "Occupy un parrafo"; + $lang->image_align_left = "Izquierda del articulo"; + $lang->image_align_middle = "Centro"; + $lang->image_align_right = "Derecho de articulo"; + $lang->image_border = "Grosor de Fronteras"; + $lang->urllink_url = "URL"; + $lang->image_margin = 'Image Margin'; + + $lang->about_url_link_open_window = "Hacer el vinculo para abrir una nueva ventana"; + $lang->cmd_get_scale = "Obtener tamano de la imagen"; +?> diff --git a/modules/editor/components/image_link/lang/jp.lang.php b/modules/editor/components/image_link/lang/jp.lang.php new file mode 100644 index 000000000..fe87b5f59 --- /dev/null +++ b/modules/editor/components/image_link/lang/jp.lang.php @@ -0,0 +1,23 @@ + 翻訳:RisaPapa、ミニミ + * @brief ウィジウィグエディター(editor)モジュール > イメージリンク(image_link)コンポネント言語パッケージ + **/ + + $lang->image_url = "イメージパス"; + $lang->image_alt = "説明(Alt)入力"; + $lang->image_scale = "イメージサイズ"; + $lang->image_align = "アライン位置"; + $lang->image_align_normal = "一段落"; + $lang->image_align_left = "左揃え"; + $lang->image_align_middle = "中央揃え"; + $lang->image_align_right = "右揃え"; + $lang->image_border = "ボーダー"; + $lang->image_margin = '外側の空白(Margin)'; + + $lang->urllink_open_window = "新しいウィンドウで開く"; + $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 new file mode 100644 index 000000000..20eeb8d87 --- /dev/null +++ b/modules/editor/components/image_link/lang/ko.lang.php @@ -0,0 +1,23 @@ + + * @brief 위지윅에디터(editor) 모듈 > 이미지링크(image_link) 컴포넌트의 언어팩 + **/ + + $lang->image_url = '이미지 경로'; + $lang->image_alt = '설명 입력'; + $lang->image_scale = '이미지크기'; + $lang->image_align = '정렬 방법'; + $lang->image_align_normal = '한 문단을 차지'; + $lang->image_align_left = '글의 왼쪽으로'; + $lang->image_align_middle = '가운데'; + $lang->image_align_right = '글의 우측으로'; + $lang->image_border = '경계선 두께'; + $lang->image_margin = '바깥 여백'; + + $lang->urllink_open_window = '새창열기'; + $lang->about_url_link_open_window = '선택하시면 링크 선택시 새창으로 열립니다'; + + $lang->cmd_get_scale = '크기 구하기'; +?> diff --git a/modules/editor/components/image_link/lang/ru.lang.php b/modules/editor/components/image_link/lang/ru.lang.php new file mode 100644 index 000000000..26424e0e1 --- /dev/null +++ b/modules/editor/components/image_link/lang/ru.lang.php @@ -0,0 +1,22 @@ + | translation by Maslennikov Evgeny aka X-[Vr]bL1s5 | e-mail: x-bliss[a]tut.by; ICQ: 225035467; + * @brief editor Module > language pack of image_link component + **/ + + $lang->image_url = "Путь изображения"; + $lang->image_alt = "Введите описание"; + $lang->image_scale = "Размер изображения"; + $lang->image_align = "Стиль выравнивания"; + $lang->image_align_normal = "Занять параграф"; + $lang->image_align_left = "Лево"; + $lang->image_align_middle = "Центр"; + $lang->image_align_right = "Право"; + $lang->image_border = "Толщина рамки"; + $lang->urllink_url = "URL"; + $lang->image_margin = 'Image Margin'; + + $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 new file mode 100644 index 000000000..2dcd9c656 --- /dev/null +++ b/modules/editor/components/image_link/lang/zh-CN.lang.php @@ -0,0 +1,23 @@ + + * @brief 网页编辑器(editor) 模块 > 图像链接(image_link) 组件的语言包 + **/ + + $lang->image_url = "图像路径"; + $lang->image_alt = "图像说明"; + $lang->image_scale = "图像大小"; + $lang->image_align = "对齐方式"; + $lang->image_align_normal = "占一个段落"; + $lang->image_align_left = "内容左侧"; + $lang->image_align_middle = "居中"; + $lang->image_align_right = "内容右侧"; + $lang->image_border = "边框粗细"; + $lang->image_margin = '外边距'; + + $lang->urllink_open_window = '新窗口打开'; + $lang->about_url_link_open_window = "将在新窗口中打开链接。"; + + $lang->cmd_get_scale = "获得图片大小"; +?> diff --git a/modules/editor/components/image_link/lang/zh-TW.lang.php b/modules/editor/components/image_link/lang/zh-TW.lang.php new file mode 100644 index 000000000..f3873b679 --- /dev/null +++ b/modules/editor/components/image_link/lang/zh-TW.lang.php @@ -0,0 +1,22 @@ + 翻譯:royallin + * @brief 網頁編輯器(editor)模組 > 圖片連結(image_link)組件語言 + **/ + + $lang->image_url = "圖片路徑"; + $lang->image_alt = "圖片說明"; + $lang->image_scale = "圖片大小"; + $lang->image_align = "對齊方式"; + $lang->image_align_normal = "段落"; + $lang->image_align_left = "靠左"; + $lang->image_align_middle = "置中"; + $lang->image_align_right = "靠右"; + $lang->image_border = "邊框粗細"; + $lang->urllink_url = "網址"; + $lang->image_margin = '圖片邊距'; + + $lang->about_url_link_open_window = "開啟連結於新視窗。"; + $lang->cmd_get_scale = "取得圖片大小"; +?> diff --git a/modules/editor/components/image_link/tpl/images/align_left.gif b/modules/editor/components/image_link/tpl/images/align_left.gif new file mode 100644 index 000000000..cc9a91b73 Binary files /dev/null and b/modules/editor/components/image_link/tpl/images/align_left.gif differ diff --git a/modules/editor/components/image_link/tpl/images/align_middle.gif b/modules/editor/components/image_link/tpl/images/align_middle.gif new file mode 100644 index 000000000..5e9a00d35 Binary files /dev/null and b/modules/editor/components/image_link/tpl/images/align_middle.gif differ diff --git a/modules/editor/components/image_link/tpl/images/align_normal.gif b/modules/editor/components/image_link/tpl/images/align_normal.gif new file mode 100644 index 000000000..f16697d91 Binary files /dev/null and b/modules/editor/components/image_link/tpl/images/align_normal.gif differ diff --git a/modules/editor/components/image_link/tpl/images/align_right.gif b/modules/editor/components/image_link/tpl/images/align_right.gif new file mode 100644 index 000000000..0ac97aa0b Binary files /dev/null and b/modules/editor/components/image_link/tpl/images/align_right.gif differ diff --git a/modules/editor/components/image_link/tpl/popup.css b/modules/editor/components/image_link/tpl/popup.css new file mode 100644 index 000000000..35a990cc9 --- /dev/null +++ b/modules/editor/components/image_link/tpl/popup.css @@ -0,0 +1,10 @@ +@charset "utf-8"; +@import url(../../../../../modules/admin/tpl/css/admin.css); + +.image_align { + margin:0px 0px 5px 0px; + float:left; + width:200px; +} + +li {list-style:none; float:left; margin-right:.5em;} diff --git a/modules/editor/components/image_link/tpl/popup.html b/modules/editor/components/image_link/tpl/popup.html new file mode 100644 index 000000000..8631487bc --- /dev/null +++ b/modules/editor/components/image_link/tpl/popup.html @@ -0,0 +1,93 @@ + + + + +
+

{$component_info->title} ver. {$component_info->version}

+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->image_url}
{$lang->image_scale}
+ +
URL
{$lang->urllink_open_window}
{$lang->about_url_link_open_window}
{$lang->image_alt}
{$lang->image_align}
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
{$lang->image_border}
px
{$lang->image_margin}
px
+
+
+ {$lang->cmd_insert} + {$lang->about_component} +
+ +
diff --git a/modules/editor/components/image_link/tpl/popup.js b/modules/editor/components/image_link/tpl/popup.js new file mode 100644 index 000000000..357e82452 --- /dev/null +++ b/modules/editor/components/image_link/tpl/popup.js @@ -0,0 +1,156 @@ +/** + * popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 이미지가 있는지 체크하여 + * 있으면 가져와서 원하는 곳에 삽입 + **/ + +var orig_width = 0; +var orig_height = 0; +function getImage() { + // 부모 위지윅 에디터에서 선택된 영역이 있는지 확인 + if(typeof(opener)=="undefined") return; + + // url이 미리 입력되어 있을 경우 scale구해줌 + if(xGetElementById("image_url").value) { + getImageScale(); + return; + } + + // 부모 위지윅 에디터에서 선택된 영역이 있으면 처리 + var node = opener.editorPrevNode; + if(!node || node.nodeName != "IMG") { + return; + } + var src = node.getAttribute("src"); + var border = node.style.borderWidth ? + node.style.borderWidth.match("[0-9]+") : node.getAttribute("border"); + var align = node.style.cssFloat ? + node.style.cssFloat : node.style.styleFloat; + if(!align) align = node.style.verticalAlign? + node.style.verticalAlign : node.getAttribute("align"); + var margin = node.style.margin ? + node.style.margin.match("[0-9]+") : node.getAttribute("margin"); + var alt = node.getAttribute("alt"); + var width = xWidth(node); + var height = xHeight(node); + 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; + case 'right' : xGetElementById("align_right").checked = true; break; + default : xGetElementById("align_normal").checked = true; break; + } + + if(margin) { + xGetElementById('image_margin').value = margin; + } + + if(border) { + xGetElementById("image_border").value = border; + } + + xGetElementById("width").value = width; + xGetElementById("height").value = height; + +} + +function getImageScale() { + var url = xGetElementById("image_url").value; + if(!url) return; + + var img = new Image(); + img.src = url; + + 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 = ""; + if(xGetElementById("align_normal").checked==true) align = ""; + else if(xGetElementById("align_left").checked==true) align = "float: left"; + else if(xGetElementById("align_middle").checked==true) align = "vertical-align: middle"; + else if(xGetElementById("align_right").checked==true) align = "float: right"; + var border = parseInt(xGetElementById("image_border").value,10); + var margin = parseInt(xGetElementById("image_margin").value,10); + + var width = xGetElementById("width").value; + var height = xGetElementById("height").value; + + if(!url) { + window.close(); + return; + } + + url = url.replace(request_uri,''); + var text = "