From 3674d3e7c836c509711faed5487c46322958b6c6 Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 23 Mar 2007 06:51:56 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@624 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .../image_gallery/image_gallery.class.php | 27 +++++++++---------- .../components/image_gallery/lang/ko.lang.php | 1 + .../image_gallery/tpl/image_gallery.css | 2 -- .../image_gallery/tpl/image_gallery.html | 18 ------------- .../image_gallery/tpl/image_gallery.js | 22 +++++++-------- .../components/image_gallery/tpl/popup.html | 6 ++--- .../components/image_gallery/tpl/popup.js | 13 ++++----- .../image_gallery/tpl/slide_gallery.html | 17 ++++++++++++ 8 files changed, 50 insertions(+), 56 deletions(-) delete mode 100644 modules/editor/components/image_gallery/tpl/image_gallery.html create mode 100644 modules/editor/components/image_gallery/tpl/slide_gallery.html diff --git a/modules/editor/components/image_gallery/image_gallery.class.php b/modules/editor/components/image_gallery/image_gallery.class.php index c5f4a0581..82444d10e 100644 --- a/modules/editor/components/image_gallery/image_gallery.class.php +++ b/modules/editor/components/image_gallery/image_gallery.class.php @@ -41,25 +41,24 @@ * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 **/ function transHTML($xml_obj) { - $width = $xml_obj->attrs->width; - $height = $xml_obj->attrs->height; + $gallery_info->srl = rand(111111,999999); + $gallery_info->width = $xml_obj->attrs->width; + $gallery_info->border_thickness = $xml_obj->attrs->border_thickness; + $gallery_info->gallery_style = $xml_obj->attrs->gallery_style; + $gallery_info->border_color = $xml_obj->attrs->border_color; + $gallery_info->bg_color = $xml_obj->attrs->bg_color; - $make_thumbnail = $xml_obj->attrs->make_thumbnail; - if(!$make_thumbnail) $make_thumbnail = "N"; - else $make_thumbnail = "Y"; + $body = trim($xml_obj->body); + $gallery_info->image_list = explode("\n",$body); - $body = $xml_obj->body; - $image_list = explode("\n",$body); - - Context::set("image_gallery_width", $width); - Context::set("image_gallery_height", $height); - Context::set("image_gallery_images", $image_list); - Context::set("image_gallery_srl", rand(111111,999999)); + Context::set('gallery_info', $gallery_info); $tpl_path = $this->component_path.'tpl'; - $tpl_file = 'image_gallery.html'; - Context::set("tpl_path", $tpl_path); + + if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html'; + else $tpl_file = 'slide_gallery.html'; + require_once("./classes/template/TemplateHandler.class.php"); $oTemplate = new TemplateHandler(); return $oTemplate->compile($tpl_path, $tpl_file); diff --git a/modules/editor/components/image_gallery/lang/ko.lang.php b/modules/editor/components/image_gallery/lang/ko.lang.php index 18e302224..36f2d6ca0 100644 --- a/modules/editor/components/image_gallery/lang/ko.lang.php +++ b/modules/editor/components/image_gallery/lang/ko.lang.php @@ -13,6 +13,7 @@ $lang->gallery_slide_style = "슬라이드 형식"; $lang->gallery_list_style = "모두 펼침"; $lang->gallery_border_color = "테두리색"; + $lang->gallery_border_thickness = "테두리 두께"; $lang->gallery_bg_color = "배경색"; $lang->about_image_list = "이미지 갤러리에 추가할 파일을 선택하세요. 선택후 드래그 또는 shift+클릭(범위선택), ctrl+클릭(개별선택) 가능합니다"; ?> diff --git a/modules/editor/components/image_gallery/tpl/image_gallery.css b/modules/editor/components/image_gallery/tpl/image_gallery.css index 675a0b5bb..24bd645fa 100644 --- a/modules/editor/components/image_gallery/tpl/image_gallery.css +++ b/modules/editor/components/image_gallery/tpl/image_gallery.css @@ -9,12 +9,10 @@ .image_gallery_main_image_box { border:3px solid #EEEEEE; - background-color:#FFFFFF; margin:10px; } .image_gallery_thumbnail_image_box { - background-color:#FFFFFF; margin:10px; text-align:center; } diff --git a/modules/editor/components/image_gallery/tpl/image_gallery.html b/modules/editor/components/image_gallery/tpl/image_gallery.html deleted file mode 100644 index b07f0ac77..000000000 --- a/modules/editor/components/image_gallery/tpl/image_gallery.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/modules/editor/components/image_gallery/tpl/image_gallery.js b/modules/editor/components/image_gallery/tpl/image_gallery.js index 979ef60a0..b0ee1f33d 100644 --- a/modules/editor/components/image_gallery/tpl/image_gallery.js +++ b/modules/editor/components/image_gallery/tpl/image_gallery.js @@ -44,16 +44,14 @@ function image_gallery_add_image(srl, thumbnail_url, image_url) { // 이미지갤러리쇼 시작 function start_image_gallery() { - // 등록된 모든 이미지 목록을 돌면서 thumbnail 목록을 만들어줌 for(var srl in image_gallery_images) { + // 등록된 이미지가 없으면 pass~ + if(!image_gallery_images[srl].length) continue; // 첫번째 이미지의 경우 큰 이미지 출력 시작 이미지 출력 display_gallery_image(image_gallery_images[srl][0]); - // 등록된 이미지가 없으면 pass~ - if(!image_gallery_images[srl].length) continue; - // 메인이미지가 나올 곳과 썸네일이 노출될 곳의 객체를 구함 var zone_thumbnail = xGetElementById('zone_thumbnail_'+srl); @@ -70,8 +68,9 @@ function display_gallery_image(obj) { var zone = xGetElementById('zone_image_gallery_' + obj.srl ); // 갤러리 외부 박스보다 이미지가 클 경우 resizing시킴 - var zone_width = xWidth(zone); - var zone_height = xHeight(zone); + var borderLeft = parseInt(zone.style.borderLeftWidth.replace(/px$/,''),10); + var borderRight= parseInt(zone.style.borderRightWidth.replace(/px$/,''),10); + var zone_width = xWidth(zone) - borderRight - borderLeft; var image_width = obj.image.width; var image_height = obj.image.height; @@ -85,14 +84,11 @@ function display_gallery_image(obj) { image_height = parseInt(image_height*resize_scale,10); } - if(image_height>(zone_height-30)) { - resize_scale = (zone_height-30)/image_height; - image_width = parseInt(image_width*resize_scale,10); - image_height = parseInt(image_height*resize_scale,10); - } + var borderTop = parseInt(zone.style.borderTopWidth.replace(/px$/,''),10); + var borderBottom = parseInt(zone.style.borderBottomWidth.replace(/px$/,''),10); + xHeight(zone, image_height+20+borderTop+borderBottom); var x = parseInt((zone_width - image_width)/2,10)-3; - var y = parseInt((zone_height - image_height)/2,10)-3; // 로딩 텍스트 없앰 xGetElementById("image_gallery_loading_text").style.display = "none"; @@ -111,7 +107,7 @@ function display_gallery_image(obj) { xHeight(target_image, image_height); target_image.style.margin = "0px;"; - target_image.style.marginTop = y+"px"; + target_image.style.marginTop = "10px"; target_image.style.marginLeft = x+"px"; target_image.style.display = "block"; diff --git a/modules/editor/components/image_gallery/tpl/popup.html b/modules/editor/components/image_gallery/tpl/popup.html index 9e9cbdd10..da27a0529 100644 --- a/modules/editor/components/image_gallery/tpl/popup.html +++ b/modules/editor/components/image_gallery/tpl/popup.html @@ -11,9 +11,6 @@
{$lang->width}
px
-
{$lang->height}
-
px
-
{$lang->gallery_style}
+
{$lang->gallery_border_thickness}
+
px
+
{$lang->gallery_border_color}
diff --git a/modules/editor/components/image_gallery/tpl/popup.js b/modules/editor/components/image_gallery/tpl/popup.js index 25dbe6acf..8e8173aa1 100644 --- a/modules/editor/components/image_gallery/tpl/popup.js +++ b/modules/editor/components/image_gallery/tpl/popup.js @@ -10,17 +10,19 @@ function getSlideShow() { selected_node = node; var width = xWidth(selected_node)-6; - var height = xHeight(selected_node)-6; var gallery_style = selected_node.getAttribute("gallery_style"); var border_color = selected_node.getAttribute("border_color"); var bg_color = selected_node.getAttribute("bg_color"); + var border_thickness = selected_node.getAttribute("border_thickness"); + if(!border_thickness) border_thickness = 1; xGetElementById("width").value = width; - xGetElementById("height").value = height; if(gallery_style=="list") xGetElementById("gallery_style").selectedIndex = 1; else xGetElementById("gallery_style").selectedIndex = 0; + xGetElementById("border_thickness").value = border_thickness; + xGetElementById("border_color_input").value = border_color; manual_select_color("border", xGetElementById("border_color_input")); @@ -73,9 +75,9 @@ function insertSlideShow() { } var width = xGetElementById("width").value; - var height = xGetElementById("height").value; var gallery_style = xGetElementById("gallery_style").options[xGetElementById("gallery_style").selectedIndex].value; + var border_thickness = xGetElementById("border_thickness").value; var border_color = xGetElementById("border_color_input").value; var bg_color = xGetElementById("bg_color_input").value; @@ -86,15 +88,14 @@ function insertSlideShow() { if(selected_node) { selected_node.setAttribute("width", width); - selected_node.setAttribute("height", height); selected_node.setAttribute("gallery_style", gallery_style); + selected_node.setAttribute("border_thickness", border_thickness); selected_node.setAttribute("border_color", border_color); selected_node.setAttribute("bg_color", bg_color); selected_node.style.width = width+"px"; - selected_node.style.height = height+"px"; xInnerHtml(selected_node, images_list); } else { - var text = "
"+images_list+"
"; + var text = "
"+images_list+"
"; opener.editorFocus(opener.editorPrevSrl); var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl) opener.editorReplaceHTML(iframe_obj, text); diff --git a/modules/editor/components/image_gallery/tpl/slide_gallery.html b/modules/editor/components/image_gallery/tpl/slide_gallery.html new file mode 100644 index 000000000..f4ad1516a --- /dev/null +++ b/modules/editor/components/image_gallery/tpl/slide_gallery.html @@ -0,0 +1,17 @@ + + + + + +