From f4953b1b9211f1c939fd370b678377d39ccee728 Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 22 Jun 2007 08:54:34 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@1743 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/widget/WidgetHandler.class.php | 5 + modules/widget/tpl/js/widget_admin.js | 25 ++-- .../tpl/widget_generate_code_in_page.html | 114 ++++++++++++------ modules/widget/widget.controller.php | 16 ++- widgets/archive_list/archive_list.class.php | 2 - widgets/calendar/calendar.class.php | 2 - .../counter_status/counter_status.class.php | 3 - widgets/login_info/login_info.class.php | 3 - .../newest_comment/newest_comment.class.php | 2 - .../newest_document/newest_document.class.php | 2 - .../newest_document/skins/default/list.html | 2 +- widgets/styx_clock/conf/info.xml | 2 +- widgets/styx_clock/skins/default/clock.html | 2 +- widgets/styx_clock/styx_clock.class.php | 7 +- widgets/tag_list/tag_list.class.php | 2 - 15 files changed, 110 insertions(+), 79 deletions(-) diff --git a/classes/widget/WidgetHandler.class.php b/classes/widget/WidgetHandler.class.php index 35f7ab2e3..03fb5e8ee 100644 --- a/classes/widget/WidgetHandler.class.php +++ b/classes/widget/WidgetHandler.class.php @@ -25,6 +25,11 @@ $output = $oWidget->proc($args); } + if($args->style) { + $args->style = preg_replace("/height([^;]*);/i","",$args->style); + $output = sprintf("
%s
", $args->style, $output); + } + if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; return $output; diff --git a/modules/widget/tpl/js/widget_admin.js b/modules/widget/tpl/js/widget_admin.js index e64d3df4a..16f77171c 100644 --- a/modules/widget/tpl/js/widget_admin.js +++ b/modules/widget/tpl/js/widget_admin.js @@ -22,17 +22,6 @@ function completeGenerateCodeInPage(ret_obj,response_tags,params,fo_obj) { return; } - var orig_width = 0; - var orig_height = 0; - var node = opener.editorPrevNode; - if(node) { - orig_width = parseInt(xWidth(node),10)-6; - orig_height = parseInt(xHeight(node),10)-6; - - widget_code = widget_code.replace(/width([^p]+)px/ig,'width:'+orig_width+'px'); - widget_code = widget_code.replace(/height([^p]+)px/ig,'height:'+orig_height+'px'); - } - // 부모창에 에디터가 있으면 에디터에 추가 if(opener.editorGetIFrame) { var iframe_obj = opener.editorGetIFrame(module_srl); @@ -42,7 +31,7 @@ function completeGenerateCodeInPage(ret_obj,response_tags,params,fo_obj) { opener.editorFocus(module_srl); } } - //window.close(); + window.close(); } /* 위젯 코드 생성시 스킨을 고르면 컬러셋의 정보를 표시 */ @@ -116,9 +105,13 @@ function doFillWidgetVars() { break; case "checkbox" : var val = selected_node.getAttribute(name); - for(var i=0;i{$widget_info->title} ver {$widget_info->version} -
{$lang->about_widget_code_in_page}
+
-
{$lang->description}
-
{nl2br($widget_info->author->description)}
+
{$lang->about_widget_code_in_page}
-
{$lang->skin}
-
- -
+
{$lang->description}
+
{nl2br($widget_info->author->description)}
- - -
{$var->name}
+ -
- - + +
{$var->name}
- - +
+ + - - + + - -
- -
- - + + + + +
+ +
+ + +
+
-
+
+
{$var->description}
+ +
+ +
+
가로 크기 고정
+
+ 선택하시면 가로크기가 고정됩니다. +
+ +
가로 크기
+
+ px + 가로 크기를 선택해주세요. +
+ +
위치
+
+ + 한 줄에 여러개의 위젯을 나열하고 싶을때에는 위치를 선택해주세요. +
+ +
여백
+
+ 위 + 오른쪽 + 아래 + 왼쪽 +
+ 한 줄에 여러개의 위젯을 나열하고 싶을때에는 위치를 선택해주세요. +
-
{$var->description}
-
-
diff --git a/modules/widget/widget.controller.php b/modules/widget/widget.controller.php index 9201ce54c..9b1a6451f 100644 --- a/modules/widget/widget.controller.php +++ b/modules/widget/widget.controller.php @@ -21,6 +21,8 @@ $vars = Context::getRequestVars(); $widget = $vars->selected_widget; + $blank_img_path = "./common/tpl/images/blank.gif"; + unset($vars->module); unset($vars->act); unset($vars->selected_widget); @@ -33,8 +35,18 @@ } } - $blank_img_path = "./common/tpl/images/blank.gif"; - $widget_code = sprintf('', $blank_img_path, $widget, implode(' ',$attribute)); + if($vars->widget_fix_width == 'Y') { + $style = ""; + + $vars->widget_width = $vars->widget_width - $vars->widget_margin_left - $vars->widget_margin_right; + $style .= sprintf("%s:%spx;", "width", trim($vars->widget_width)); + $style .= sprintf("margin:%dpx %dpx %dpx %dpx;", $vars->widget_margin_top, $vars->widget_margin_right,$vars->widget_margin_bottom,$vars->widget_margin_left); + if($vars->widget_position) $style .= sprintf("%s:%s;", "float", trim($vars->widget_position)); + $widget_code = sprintf('', $blank_img_path, $widget, implode(' ',$attribute), $style); + } else { + $widget_code = sprintf('', $blank_img_path, $widget, implode(' ',$attribute)); + } + debugPrint($widget_code); // 코드 출력 $this->add('widget_code', $widget_code); diff --git a/widgets/archive_list/archive_list.class.php b/widgets/archive_list/archive_list.class.php index e927f773a..542073b49 100644 --- a/widgets/archive_list/archive_list.class.php +++ b/widgets/archive_list/archive_list.class.php @@ -32,8 +32,6 @@ $widget_info->title = $title; $widget_info->archive_list = $output->data; - preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$args->style,$matches); - $widget_info->width = trim($matches[3][0]); Context::set('widget_info', $widget_info); // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정) diff --git a/widgets/calendar/calendar.class.php b/widgets/calendar/calendar.class.php index 0b3c640aa..a3e5ce25b 100644 --- a/widgets/calendar/calendar.class.php +++ b/widgets/calendar/calendar.class.php @@ -48,8 +48,6 @@ foreach($output->data as $key => $val) $widget_info->calendar[$val->month] = $val->count; } - preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$args->style,$matches); - $widget_info->width = trim($matches[3][0]); Context::set('widget_info', $widget_info); // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정) diff --git a/widgets/counter_status/counter_status.class.php b/widgets/counter_status/counter_status.class.php index 09bc4fc53..9e64645ff 100644 --- a/widgets/counter_status/counter_status.class.php +++ b/widgets/counter_status/counter_status.class.php @@ -24,9 +24,6 @@ else Context::set('yesterday_counter', $val); } - // 변수 설정 - Context::set('style', $args->style); - // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정) $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin); Context::set('colorset', $args->colorset); diff --git a/widgets/login_info/login_info.class.php b/widgets/login_info/login_info.class.php index 8351b52a8..8fe336b34 100644 --- a/widgets/login_info/login_info.class.php +++ b/widgets/login_info/login_info.class.php @@ -16,9 +16,6 @@ * 결과를 만든후 print가 아니라 return 해주어야 한다 **/ function proc($args) { - // 변수 설정 - Context::set('style', $args->style); - // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정) $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin); Context::set('colorset', $args->colorset); diff --git a/widgets/newest_comment/newest_comment.class.php b/widgets/newest_comment/newest_comment.class.php index fcedbf6c3..76ee87be7 100644 --- a/widgets/newest_comment/newest_comment.class.php +++ b/widgets/newest_comment/newest_comment.class.php @@ -38,8 +38,6 @@ $widget_info->title = $title; $widget_info->comment_list = $output->data; - preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$args->style,$matches); - $widget_info->width = trim($matches[3][0]); Context::set('widget_info', $widget_info); // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정) diff --git a/widgets/newest_document/newest_document.class.php b/widgets/newest_document/newest_document.class.php index 64efafe5e..3b8fca46b 100644 --- a/widgets/newest_document/newest_document.class.php +++ b/widgets/newest_document/newest_document.class.php @@ -38,8 +38,6 @@ $widget_info->title = $title; $widget_info->document_list = $output->data; - preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$args->style,$matches); - $widget_info->width = trim($matches[3][0]); Context::set('widget_info', $widget_info); // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정) diff --git a/widgets/newest_document/skins/default/list.html b/widgets/newest_document/skins/default/list.html index c82d6a550..8343ad336 100644 --- a/widgets/newest_document/skins/default/list.html +++ b/widgets/newest_document/skins/default/list.html @@ -8,7 +8,7 @@ -
+
{$widget_info->title}
diff --git a/widgets/styx_clock/conf/info.xml b/widgets/styx_clock/conf/info.xml index 33f246913..9d9c04b2c 100644 --- a/widgets/styx_clock/conf/info.xml +++ b/widgets/styx_clock/conf/info.xml @@ -6,7 +6,7 @@ 플래쉬로 된 시계를 출력합니다. - + 가로길이 text 가로길이를 지정하실 수 있습니다. (기본 200) diff --git a/widgets/styx_clock/skins/default/clock.html b/widgets/styx_clock/skins/default/clock.html index 56d08bb2f..45fa900ca 100644 --- a/widgets/styx_clock/skins/default/clock.html +++ b/widgets/styx_clock/skins/default/clock.html @@ -1,3 +1,3 @@ diff --git a/widgets/styx_clock/styx_clock.class.php b/widgets/styx_clock/styx_clock.class.php index 3df8f4d35..084df2d84 100644 --- a/widgets/styx_clock/styx_clock.class.php +++ b/widgets/styx_clock/styx_clock.class.php @@ -28,10 +28,9 @@ $day = $args->day; if($day != "false") $day = "true"; - $width = $args->width; - if(!$width) $width = 200; - $widget_info->width = $width; - + $clock_width = $args->clock_width; + if(!$clock_width) $clock_width = 200; + $widget_info->clock_width = $clock_width; $widget_info->src = sprintf("%s%s/%s/clock.swf?theme=%s&day=%s", Context::getRequestUri(), $tpl_path, $colorset, $theme, $day); Context::set('widget_info', $widget_info); diff --git a/widgets/tag_list/tag_list.class.php b/widgets/tag_list/tag_list.class.php index 2c2114c63..8712fc2a2 100644 --- a/widgets/tag_list/tag_list.class.php +++ b/widgets/tag_list/tag_list.class.php @@ -35,8 +35,6 @@ $widget_info->title = $title; $widget_info->tag_list = $output->data; - preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$args->style,$matches); - $widget_info->width = trim($matches[3][0]); Context::set('widget_info', $widget_info); // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)