git-svn-id: http://xe-core.googlecode.com/svn/trunk@624 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-03-23 06:51:56 +00:00
parent 3a4e8847bb
commit 3674d3e7c8
8 changed files with 50 additions and 56 deletions

View file

@ -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);

View file

@ -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+클릭(개별선택) 가능합니다";
?>

View file

@ -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;
}

View file

@ -1,18 +0,0 @@
<!--%import("image_gallery.js")-->
<!--%import("image_gallery.css")-->
<script type='text/javascript'>
// 이미지갤러리에 보여줄 이미지 등록
<!--@foreach($image_gallery_images as $image)-->
image_gallery_add_image({$image_gallery_srl},'{$image}','{$image}');
<!--@end-->
// window.onLoad 이벤트 후에 이미지갤러리 시작
xAddEventListener(window,'load',start_image_gallery);
</script>
<div id='zone_image_gallery_{$image_gallery_srl}' style="width:{$image_gallery_width}px;height:{$image_gallery_height}px;" class="image_gallery_main_image_box">
<div id="image_gallery_loading_text" class="image_gallery_loading_text">loading images...</div>
<img id="image_gallery_main_image_{$image_gallery_srl}" border="0" style="display:none" alt="image_gallery" />
</div>
<div id='zone_thumbnail_{$image_gallery_srl}' class="image_gallery_thumbnail_image_box" style="width:{$image_gallery_width}px;"></div>

View file

@ -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";

View file

@ -11,9 +11,6 @@
<div class="short_header">{$lang->width}</div>
<div class="short_body"><input type="text" class="editor_input" id="width" value="600" />px</div>
<div class="short_header">{$lang->height}</div>
<div class="short_body"><input type="text" class="editor_input" id="height" value="600" />px</div>
<div class="header">{$lang->gallery_style}</div>
<div class="body">
<select id="gallery_style">
@ -22,6 +19,9 @@
</select>
</div>
<div class="header">{$lang->gallery_border_thickness}</div>
<div class="body"><input type="text" class="editor_input" id="border_thickness" value="1" />px</div>
<div class="header">{$lang->gallery_border_color}</div>
<div class="body">
<div class="editor_color_box">

View file

@ -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 = "<div editor_component=\"image_gallery\" class=\"editor_component_output\" width=\""+width+"\" height=\""+height+"\" gallery_style=\"+gallery_style+\" border_color=\""+border_color+"\" bg_color=\""+bg_color+"\" style=\"width:"+width+"px;height:"+height+"px;\" >"+images_list+"</div>";
var text = "<div editor_component=\"image_gallery\" class=\"editor_component_output\" width=\""+width+"\" gallery_style=\"+gallery_style+\" border_thickness=\""+border_thickness+"\" border_color=\""+border_color+"\" bg_color=\""+bg_color+"\" style=\"width:"+width+"px;\" >"+images_list+"</div>";
opener.editorFocus(opener.editorPrevSrl);
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
opener.editorReplaceHTML(iframe_obj, text);

View file

@ -0,0 +1,17 @@
<!--%import("image_gallery.js")-->
<!--%import("image_gallery.css")-->
<script type='text/javascript'>
// 이미지갤러리에 보여줄 이미지 등록
<!--@foreach($gallery_info->image_list as $image)-->
image_gallery_add_image({$gallery_info->srl},'{$image}','{$image}');
<!--@end-->
// window.onLoad 이벤트 후에 이미지갤러리 시작
xAddEventListener(window,'load',start_image_gallery);
</script>
<div id='zone_image_gallery_{$gallery_info->srl}' style="width:{$gallery_info->width}px;background-color:#{$gallery_info->bg_color};border:{$gallery_info->border_thickness}px solid #{$gallery_info->border_color}">
<div id="image_gallery_loading_text" class="image_gallery_loading_text">loading images...</div>
<img id="image_gallery_main_image_{$gallery_info->srl}" border="0" style="display:none" alt="image_gallery" />
</div>
<div id='zone_thumbnail_{$gallery_info->srl}' class="image_gallery_thumbnail_image_box" style="width:{$gallery_info->width}px;"></div>