페이지 위젯에 박스 위젯 추가. 각 위젯마다 배경을 지정할 수 있도록 하고 IE에서 메모리 누수 현상이 발생하던 부분을 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2983 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-11-16 10:47:50 +00:00
parent 23ac5b8f54
commit 9124d18a91
31 changed files with 1397 additions and 1001 deletions

View file

@ -836,7 +836,8 @@
**/
function transContent($content) {
// 위젯 코드 변경
$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content);
$oWidgetController = &getController('widget');
$content = $oWidgetController->transWidgetCode($content, false);
// 메타 파일 변경
$content = preg_replace_callback('!<\!\-\-Meta:([^\-]*?)\-\->!is', array($this,'transMeta'), $content);
@ -902,7 +903,7 @@
$buff = preg_replace_callback('/([^=^"^ ]*)=([^ ^>]*)/i', array($this, _fixQuotation), $buff);
$buff = str_replace("&","&amp;",$buff);
// 위젯에서 생성된 코드 (img, div태그내에 editor_widget코드 존재)의 parameter를 추출
// 에디터 컴포넌트에서 생성된 코드
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse($buff);
if($xml_doc->div) $xml_doc = $xml_doc->div;
@ -921,38 +922,6 @@
return $oComponent->transHTML($xml_doc);
}
/**
* @brief 위젯 코드를 실제 php코드로 변경
**/
function transWidget($matches, $include_info = false) {
// IE에서는 태그의 특성중에서 " 를 빼어 버리는 경우가 있기에 정규표현식으로 추가해줌
$buff = $matches[0];
$buff = preg_replace_callback('/([^=^"^ ]*)=([^ ^>]*)/i', array($this, _fixQuotation), $buff);
$buff = str_replace("&","&amp;",$buff);
$oXmlParser = new XmlParser();
$xml_doc = $oXmlParser->parse(trim($buff));
if($xml_doc->img) $vars = $xml_doc->img->attrs;
else $vars = $xml_doc->attrs;
if(!$vars->widget) return "";
// 캐시 체크
$widget_sequence = $vars->widget_sequence;
$widget_cache = $vars->widget_cache;
if($widget_cache && $widget_sequence && !$include_info) {
$output = WidgetHandler::getCache($widget_sequence, $widget_cache);
if($output) return $output;
}
// 위젯의 이름을 구함
$widget = $vars->widget;
unset($vars->widget);
return WidgetHandler::execute($widget, $vars, $include_info);
}
/**
* @brief gzip encoding 여부 체크
**/

View file

@ -59,12 +59,25 @@
$widget_margin_top = $args->widget_margin_top;
$widget_margin_bottom = $args->widget_margin_bottom;
if($include_info) {
$oPageAdminController = &getAdminController('page');
$tpl = $oPageAdminController->transEditorContent($body, $args);
$oWidgetController = &getController('widget');
$tpl = $oWidgetController->transEditorContent($body, $args);
} else {
$tpl = sprintf('<div style="overflow:hidden;%s"><div style="margin:%s %s %s %s;">%s</div></div>', $style, $widget_margin_top, $widget_margin_right, $widget_margin_bottom, $widget_margin_left, $body);
}
return $tpl;
// widget Box일 경우 간단히 변경만 시도함
} else if($widget == 'widgetBox') {
$style = $args->style;
$widget_margin_left = $args->widget_margin_left;
$widget_margin_right = $args->widget_margin_right;
$widget_margin_top = $args->widget_margin_top;
$widget_margin_bottom = $args->widget_margin_bottom;
if($include_info) {
$tpl = sprintf('<div class="widgetOutput" widget="widgetBox" style="%s;" widget_margin_top="%s" widget_margin_right="%s" widget_margin_bottom="%s" widget_margin_left="%s"><div class="widgetCopy"></div><div class="widgetSize"></div><div class="widgetRemove"></div><div class="widgetResize"></div><div class="widgetResizeLeft"></div><div class="widgetBorder"><div class="nullWidget" style="margin:%s %s %s %s;">', $style, $widget_margin_top, $widget_margin_right, $widget_margin_bottom, $widget_margin_left, $widget_margin_top, $widget_margin_right, $widget_margin_bottom, $widget_margin_left);
} else {
$tpl = sprintf('<div style="overflow:hidden;%s;"><div style="margin:%s %s %s %s;"><div>%s', $style, $widget_margin_top, $widget_margin_right, $widget_margin_bottom, $widget_margin_left, $body);
}
return $tpl;
}
// 설치된 위젯들에 대한 처리
@ -77,9 +90,6 @@
$oWidget = WidgetHandler::getObject($widget);
if(!$oWidget) return;
// 위젯 실행
$html = $oWidget->proc($args);
// 위젯 output을 생성하기 위한 변수 설정
$margin_top = $args->widget_margin_top;
$margin_bottom = $args->widget_margin_bottom;
@ -93,6 +103,9 @@
**/
// 서비스에 사용하기 위해 위젯 정보를 포함하지 않을 경우
if(!$include_info) {
// 위젯 실행
$html = $oWidget->proc($args);
$output = sprintf('<div style="overflow:hidden;%s;"><div style="%s">%s</div></div>', $args->style, $inner_style, $html);
// 위젯 sequence가 있고 위젯의 캐싱을 지정하였고 위젯정보를 담지 않도록 하였을 경우 캐시 파일을 저장
@ -100,6 +113,11 @@
// 에디팅등에 사용하기 위한 목적으로 위젯 정보를 포함할 경우
} else {
// 위젯 실행
//if($args->widget_sequence && $args->widget_cache) $html = WidgetHandler::getCache($args->widget_sequence, $args->widget_cache);
//if(!$html) $html = $oWidget->proc($args);
$html = $oWidget->proc($args);
// args 정리
$attribute = array();
if($args) {
@ -126,8 +144,9 @@
if(!$html) $html = '&nbsp;';
$output = sprintf(
'<style type="text/css">%s</style>'.
'<div class="widgetOutput" style="%s" widget="%s" %s >'.
'<div class="widgetOutput" style="%s" widget_margin_top="%s" widget_margin_right="%s" widget_margin_bottom="%s" widget_margin_left="%s" widget="%s" %s >'.
'<div class="widgetSetup"></div>'.
'<div class="widgetCopy"></div>'.
'<div class="widgetSize"></div>'.
'<div class="widgetRemove"></div>'.
'<div class="widgetResize"></div>'.
@ -139,7 +158,9 @@
'</div>'.
'</div>',
$css_header,
$args->style, $widget, implode(' ',$attribute),
$args->style,
$widget_margin_top, $widget_margin_right, $widget_margin_bottom, $widget_margin_left,
$widget, implode(' ',$attribute),
$inner_style,
$html
);