mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
페이지 모듈의 위젯 처리 부분 오류 없이 수정 & 컨텐츠 추가시 내용을 utf8 encode하도록 하여 문제 해결
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2962 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3501721233
commit
1b15ffbea6
8 changed files with 190 additions and 141 deletions
|
|
@ -56,12 +56,14 @@
|
||||||
$body = base64_decode($args->body);
|
$body = base64_decode($args->body);
|
||||||
if($include_info) {
|
if($include_info) {
|
||||||
$oPageAdminController = &getAdminController('page');
|
$oPageAdminController = &getAdminController('page');
|
||||||
return $oPageAdminController->transEditorContent($body, $style);
|
$tpl = $oPageAdminController->transEditorContent($body, $style);
|
||||||
} else {
|
} else {
|
||||||
return sprintf('<div style="%s">%s</div>', $style, $body);
|
$tpl = sprintf('<div style="overflow:hidden;%s">%s</div>', $style, $body);
|
||||||
}
|
}
|
||||||
|
return $tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 설치된 위젯들에 대한 처리
|
||||||
if(!is_dir(sprintf('./widgets/%s/',$widget))) return;
|
if(!is_dir(sprintf('./widgets/%s/',$widget))) return;
|
||||||
|
|
||||||
$cache_path = './files/cache/widget_cache/';
|
$cache_path = './files/cache/widget_cache/';
|
||||||
|
|
@ -75,33 +77,29 @@
|
||||||
$html = $oWidget->proc($args);
|
$html = $oWidget->proc($args);
|
||||||
|
|
||||||
// 위젯 output을 생성하기 위한 변수 설정
|
// 위젯 output을 생성하기 위한 변수 설정
|
||||||
$fix_width = $args->widget_fix_width=='Y'?'Y':'N';
|
|
||||||
$width_type = strtolower($args->widget_width_type)=='%'?'%':'px';
|
|
||||||
$widget_width = (int)$args->widget_width;
|
|
||||||
$margin_top = (int)$args->widget_margin_top;
|
$margin_top = (int)$args->widget_margin_top;
|
||||||
$margin_bottom = (int)$args->widget_margin_bottom;
|
$margin_bottom = (int)$args->widget_margin_bottom;
|
||||||
$margin_left = (int)$args->widget_margin_left;
|
$margin_left = (int)$args->widget_margin_left;
|
||||||
$margin_right = (int)$args->widget_margin_right;
|
$margin_right = (int)$args->widget_margin_right;
|
||||||
$widget_position = $args->widget_position;
|
|
||||||
|
$args->style .= ';';
|
||||||
|
|
||||||
preg_match("/height:([^;]*);/i",$args->style, $height_match);
|
preg_match("/height:([^;]*);/i",$args->style, $height_match);
|
||||||
if($height_match[0]) $height = $height_match[0];
|
if($height_match[0]) $height = $height_match[0];
|
||||||
|
|
||||||
$style = "overflow:hidden;padding:none !important; margin:none !important;float:left;".$height;
|
preg_match("/width:([^;]*);/i",$args->style, $width_match);
|
||||||
|
if($width_match[0]) $width = $width_match[0];
|
||||||
|
else $width = "";
|
||||||
|
|
||||||
|
$style = "overflow:hidden;padding:none !important; margin:none !important;float:left;".$height.$width;
|
||||||
$inner_style = sprintf("margin:%dpx %dpx %dpx %dpx !important; padding:none !important;", $margin_top, $margin_right, $margin_bottom, $margin_left);
|
$inner_style = sprintf("margin:%dpx %dpx %dpx %dpx !important; padding:none !important;", $margin_top, $margin_right, $margin_bottom, $margin_left);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 출력을 위해 위젯 내용을 div로 꾸밈
|
* 출력을 위해 위젯 내용을 div로 꾸밈
|
||||||
**/
|
**/
|
||||||
// 위젯의 크기가 고정일 경우
|
|
||||||
if($widget_width) {
|
|
||||||
$style .= sprintf('%s:%s%s;', 'width', $widget_width, $width_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 서비스에 사용하기 위해 위젯 정보를 포함하지 않을 경우
|
// 서비스에 사용하기 위해 위젯 정보를 포함하지 않을 경우
|
||||||
if(!$include_info) {
|
if(!$include_info) {
|
||||||
if(!$widget_position) $output = sprintf('<div class="clear"></div><div style="%s;float:left;"><div style="%s">%s</div></div>', $style, $inner_style, $html);
|
$output = sprintf('<div style="%s;"><div style="%s">%s</div></div>', $style, $inner_style, $html);
|
||||||
else $output = sprintf('<div style="%s;"><div style="%s">%s</div></div>', $style, $inner_style, $html);
|
|
||||||
|
|
||||||
// 위젯 sequence가 있고 위젯의 캐싱을 지정하였고 위젯정보를 담지 않도록 하였을 경우 캐시 파일을 저장
|
// 위젯 sequence가 있고 위젯의 캐싱을 지정하였고 위젯정보를 담지 않도록 하였을 경우 캐시 파일을 저장
|
||||||
if($args->widget_sequence && $args->widget_cache) WidgetHandler::writeCache($args->widget_sequence, $output);
|
if($args->widget_sequence && $args->widget_cache) WidgetHandler::writeCache($args->widget_sequence, $output);
|
||||||
|
|
@ -133,8 +131,8 @@
|
||||||
|
|
||||||
if(!$html) $html = ' ';
|
if(!$html) $html = ' ';
|
||||||
$output = sprintf(
|
$output = sprintf(
|
||||||
|
'<style type="text/css">%s</style>'.
|
||||||
'<div class="widgetOutput" style="%s" widget="%s" %s />'.
|
'<div class="widgetOutput" style="%s" widget="%s" %s />'.
|
||||||
'<style type="text/css">%s</style>'.
|
|
||||||
'<div class="widgetSetup"></div>'.
|
'<div class="widgetSetup"></div>'.
|
||||||
'<div class="widgetRemove"></div>'.
|
'<div class="widgetRemove"></div>'.
|
||||||
'<div class="widgetResize"></div>'.
|
'<div class="widgetResize"></div>'.
|
||||||
|
|
@ -144,8 +142,8 @@
|
||||||
'</div><div class="clear"></div>'.
|
'</div><div class="clear"></div>'.
|
||||||
'</div>'.
|
'</div>'.
|
||||||
'</div>',
|
'</div>',
|
||||||
$style, $widget, implode(' ',$attribute),
|
|
||||||
$css_header,
|
$css_header,
|
||||||
|
$style, $widget, implode(' ',$attribute),
|
||||||
$inner_style,
|
$inner_style,
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
|
|
@ -154,7 +152,6 @@
|
||||||
// 위젯 결과물 생성 시간을 debug 정보에 추가
|
// 위젯 결과물 생성 시간을 debug 정보에 추가
|
||||||
if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
|
if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
|
||||||
|
|
||||||
|
|
||||||
// 결과 return
|
// 결과 return
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -766,73 +766,145 @@ function doAddDocumentCart(obj) {
|
||||||
exec_xml("document","procDocumentAdminAddCart", params, null);
|
exec_xml("document","procDocumentAdminAddCart", params, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* base64 encoding/decoding
|
*
|
||||||
**/
|
* Base64 encode / decode
|
||||||
// This code was written by Tyler Akins and has been placed in the
|
* http://www.webtoolkit.info/
|
||||||
// public domain. It would be nice if you left this header intact.
|
*
|
||||||
// Base64 code from Tyler Akins -- http://rumkin.com
|
**/
|
||||||
|
|
||||||
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
var Base64 = {
|
||||||
|
|
||||||
function encode64(input) {
|
// private property
|
||||||
var output = "";
|
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||||
var chr1, chr2, chr3;
|
|
||||||
var enc1, enc2, enc3, enc4;
|
|
||||||
var i = 0;
|
|
||||||
|
|
||||||
do {
|
// public method for encoding
|
||||||
chr1 = input.charCodeAt(i++);
|
encode : function (input) {
|
||||||
chr2 = input.charCodeAt(i++);
|
var output = "";
|
||||||
chr3 = input.charCodeAt(i++);
|
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
enc1 = chr1 >> 2;
|
input = Base64._utf8_encode(input);
|
||||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
||||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
||||||
enc4 = chr3 & 63;
|
|
||||||
|
|
||||||
if (isNaN(chr2)) {
|
while (i < input.length) {
|
||||||
enc3 = enc4 = 64;
|
|
||||||
} else if (isNaN(chr3)) {
|
chr1 = input.charCodeAt(i++);
|
||||||
enc4 = 64;
|
chr2 = input.charCodeAt(i++);
|
||||||
}
|
chr3 = input.charCodeAt(i++);
|
||||||
|
|
||||||
|
enc1 = chr1 >> 2;
|
||||||
|
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||||
|
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||||
|
enc4 = chr3 & 63;
|
||||||
|
|
||||||
|
if (isNaN(chr2)) {
|
||||||
|
enc3 = enc4 = 64;
|
||||||
|
} else if (isNaN(chr3)) {
|
||||||
|
enc4 = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
output = output +
|
||||||
|
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
||||||
|
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
},
|
||||||
|
|
||||||
|
// public method for decoding
|
||||||
|
decode : function (input) {
|
||||||
|
var output = "";
|
||||||
|
var chr1, chr2, chr3;
|
||||||
|
var enc1, enc2, enc3, enc4;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||||
|
|
||||||
|
while (i < input.length) {
|
||||||
|
|
||||||
|
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||||
|
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||||
|
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||||
|
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||||
|
|
||||||
|
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||||
|
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||||
|
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||||
|
|
||||||
|
output = output + String.fromCharCode(chr1);
|
||||||
|
|
||||||
|
if (enc3 != 64) {
|
||||||
|
output = output + String.fromCharCode(chr2);
|
||||||
|
}
|
||||||
|
if (enc4 != 64) {
|
||||||
|
output = output + String.fromCharCode(chr3);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
output = Base64._utf8_decode(output);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// private method for UTF-8 encoding
|
||||||
|
_utf8_encode : function (string) {
|
||||||
|
string = string.replace(/\r\n/g,"\n");
|
||||||
|
var utftext = "";
|
||||||
|
|
||||||
|
for (var n = 0; n < string.length; n++) {
|
||||||
|
|
||||||
|
var c = string.charCodeAt(n);
|
||||||
|
|
||||||
|
if (c < 128) {
|
||||||
|
utftext += String.fromCharCode(c);
|
||||||
|
}
|
||||||
|
else if((c > 127) && (c < 2048)) {
|
||||||
|
utftext += String.fromCharCode((c >> 6) | 192);
|
||||||
|
utftext += String.fromCharCode((c & 63) | 128);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
utftext += String.fromCharCode((c >> 12) | 224);
|
||||||
|
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||||
|
utftext += String.fromCharCode((c & 63) | 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return utftext;
|
||||||
|
},
|
||||||
|
|
||||||
|
// private method for UTF-8 decoding
|
||||||
|
_utf8_decode : function (utftext) {
|
||||||
|
var string = "";
|
||||||
|
var i = 0;
|
||||||
|
var c = c1 = c2 = 0;
|
||||||
|
|
||||||
|
while ( i < utftext.length ) {
|
||||||
|
|
||||||
|
c = utftext.charCodeAt(i);
|
||||||
|
|
||||||
|
if (c < 128) {
|
||||||
|
string += String.fromCharCode(c);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else if((c > 191) && (c < 224)) {
|
||||||
|
c2 = utftext.charCodeAt(i+1);
|
||||||
|
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c2 = utftext.charCodeAt(i+1);
|
||||||
|
c3 = utftext.charCodeAt(i+2);
|
||||||
|
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||||
|
i += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
|
|
||||||
keyStr.charAt(enc3) + keyStr.charAt(enc4);
|
|
||||||
} while (i < input.length);
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
function decode64(input) {
|
|
||||||
var output = "";
|
|
||||||
var chr1, chr2, chr3;
|
|
||||||
var enc1, enc2, enc3, enc4;
|
|
||||||
var i = 0;
|
|
||||||
|
|
||||||
// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
|
|
||||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
|
||||||
|
|
||||||
do {
|
|
||||||
enc1 = keyStr.indexOf(input.charAt(i++));
|
|
||||||
enc2 = keyStr.indexOf(input.charAt(i++));
|
|
||||||
enc3 = keyStr.indexOf(input.charAt(i++));
|
|
||||||
enc4 = keyStr.indexOf(input.charAt(i++));
|
|
||||||
|
|
||||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
|
||||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
|
||||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
|
||||||
|
|
||||||
output = output + String.fromCharCode(chr1);
|
|
||||||
|
|
||||||
if (enc3 != 64) {
|
|
||||||
output = output + String.fromCharCode(chr2);
|
|
||||||
}
|
|
||||||
if (enc4 != 64) {
|
|
||||||
output = output + String.fromCharCode(chr3);
|
|
||||||
}
|
|
||||||
} while (i < input.length);
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,8 +197,9 @@
|
||||||
**/
|
**/
|
||||||
function procPageAdminAddContent() {
|
function procPageAdminAddContent() {
|
||||||
$content = Context::get('content');
|
$content = Context::get('content');
|
||||||
|
$style = Context::get('style');
|
||||||
|
|
||||||
$tpl = $this->transEditorContent($content);
|
$tpl = $this->transEditorContent($content, $style);
|
||||||
|
|
||||||
$this->add('tpl', $tpl);
|
$this->add('tpl', $tpl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,9 @@ function doSubmitPageContent(fo_obj) {
|
||||||
while(childObj) {
|
while(childObj) {
|
||||||
if(childObj.nodeName == "DIV" && childObj.getAttribute("widget")) {
|
if(childObj.nodeName == "DIV" && childObj.getAttribute("widget")) {
|
||||||
var widget = childObj.getAttribute("widget");
|
var widget = childObj.getAttribute("widget");
|
||||||
|
if(!widget) continue;
|
||||||
|
|
||||||
|
// 내장 위젯인 에디터 컨텐츠인 경우
|
||||||
if(widget == "widgetContent") {
|
if(widget == "widgetContent") {
|
||||||
var style = childObj.getAttribute("style");
|
var style = childObj.getAttribute("style");
|
||||||
if(typeof(style)=="object") style = style["cssText"];
|
if(typeof(style)=="object") style = style["cssText"];
|
||||||
|
|
@ -51,23 +54,29 @@ function doSubmitPageContent(fo_obj) {
|
||||||
var code = "";
|
var code = "";
|
||||||
while(cobj && cobj.className != "widgetContent") { cobj = cobj.nextSibling; }
|
while(cobj && cobj.className != "widgetContent") { cobj = cobj.nextSibling; }
|
||||||
if(cobj && cobj.className == "widgetContent") {
|
if(cobj && cobj.className == "widgetContent") {
|
||||||
var body = encode64(xInnerHtml(cobj));
|
var body = Base64.encode(xInnerHtml(cobj));
|
||||||
code = '<img src="./common/tpl/images/widget_bg.jpg" class="zbxe_widget_output" widget="widgetContent" style="'+style+'" body="'+body+'" />';
|
code = '<img src="./common/tpl/images/widget_bg.jpg" class="zbxe_widget_output" widget="widgetContent" style="'+style+'" body="'+body+'" />';
|
||||||
}
|
}
|
||||||
html += code;
|
html += code;
|
||||||
|
|
||||||
|
// 위젯의 경우
|
||||||
} else {
|
} else {
|
||||||
var attrs = "";
|
var attrs = "";
|
||||||
var code = "";
|
var code = "";
|
||||||
for(var i=0;i<childObj.attributes.length;i++) {
|
for(var i=0;i<childObj.attributes.length;i++) {
|
||||||
if(!childObj.attributes[i].nodeName || !childObj.attributes[i].nodeValue) continue;
|
if(!childObj.attributes[i].nodeName || !childObj.attributes[i].nodeValue) continue;
|
||||||
var name = childObj.attributes[i].nodeName.toLowerCase();
|
var name = childObj.attributes[i].nodeName.toLowerCase();
|
||||||
var value = childObj.attributes[i].nodeValue.replace(/\"/ig,'"');
|
if(name == "contenteditable" || name == "id" || name=="style" || name=="src" || name=="widget" || name == "body" || name == "class" || name == "widget_width" || name == "widget_width_type" || name == "xdpx" || name == "xdpy" || name == "height") continue;
|
||||||
|
|
||||||
|
var value = childObj.attributes[i].nodeValue;
|
||||||
if(!value) continue;
|
if(!value) continue;
|
||||||
if(name=="style" || name=="src" || name=="widget" || name == "body" || name == "class" || name == "height") continue;
|
|
||||||
|
if(value && typeof(value)=="string") value = value.replace(/\"/ig,'"');
|
||||||
|
|
||||||
attrs += name+'="'+value+'" ';
|
attrs += name+'="'+value+'" ';
|
||||||
}
|
}
|
||||||
var style = childObj.getAttribute("style");
|
var style = childObj.getAttribute("style");
|
||||||
if(typeof(style)=="object") style = style["cssText"];
|
if(typeof(style)=="object" && style["cssText"]) style = style["cssText"];
|
||||||
|
|
||||||
code = '<img class="zbxe_widget_output" style="'+style+'" widget="'+widget+'" '+attrs+' />';
|
code = '<img class="zbxe_widget_output" style="'+style+'" widget="'+widget+'" '+attrs+' />';
|
||||||
html += code;
|
html += code;
|
||||||
|
|
@ -166,6 +175,10 @@ function doAddContent(module_srl) {
|
||||||
|
|
||||||
function doSyncPageContent() {
|
function doSyncPageContent() {
|
||||||
if(opener && opener.selectedWidget) {
|
if(opener && opener.selectedWidget) {
|
||||||
|
var style = opener.selectedWidget.getAttribute("style");
|
||||||
|
if(typeof(style)=="object") style = style["cssText"];
|
||||||
|
xGetElementById("content_fo").style.value = style;
|
||||||
|
|
||||||
var obj = opener.selectedWidget.firstChild;
|
var obj = opener.selectedWidget.firstChild;
|
||||||
while(obj && obj.className != "widgetContent") obj = obj.nextSibling;
|
while(obj && obj.className != "widgetContent") obj = obj.nextSibling;
|
||||||
if(obj && obj.className == "widgetContent") {
|
if(obj && obj.className == "widgetContent") {
|
||||||
|
|
@ -189,6 +202,8 @@ function completeAddContent(ret_obj) {
|
||||||
var obj = opener.xGetElementById('zonePageContent');
|
var obj = opener.xGetElementById('zonePageContent');
|
||||||
xInnerHtml(obj, xInnerHtml(obj)+tpl);
|
xInnerHtml(obj, xInnerHtml(obj)+tpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(opener.doFitBorderSize) opener.doFitBorderSize();
|
||||||
window.close();
|
window.close();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -209,16 +224,20 @@ function doAddWidget(fo) {
|
||||||
/* 페이지 수정 시작 */
|
/* 페이지 수정 시작 */
|
||||||
function doStartPageModify() {
|
function doStartPageModify() {
|
||||||
|
|
||||||
// widgetBorder에 height를 widgetOutput와 맞춰줌
|
doFitBorderSize();
|
||||||
|
|
||||||
|
// 드래그와 리사이즈와 관련된 이벤트 리스너 생성
|
||||||
|
xAddEventListener(document,"click",doCheckWidget);
|
||||||
|
xAddEventListener(document,"mousedown",doCheckWidgetDrag);
|
||||||
|
}
|
||||||
|
|
||||||
|
// widgetBorder에 height를 widgetOutput와 맞춰줌
|
||||||
|
function doFitBorderSize() {
|
||||||
var obj_list = xGetElementsByClassName('widgetBorder', xGetElementById('zonePageContent'));
|
var obj_list = xGetElementsByClassName('widgetBorder', xGetElementById('zonePageContent'));
|
||||||
for(var i=0;i<obj_list.length;i++) {
|
for(var i=0;i<obj_list.length;i++) {
|
||||||
var obj = obj_list[i];
|
var obj = obj_list[i];
|
||||||
xHeight(obj, xHeight(obj.parentNode));
|
xHeight(obj, xHeight(obj.parentNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 드래그와 리사이즈와 관련된 이벤트 리스너 생성
|
|
||||||
xAddEventListener(document,"click",doCheckWidget);
|
|
||||||
xAddEventListener(document,"mousedown",doCheckWidgetDrag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var selectedWidget = null;
|
var selectedWidget = null;
|
||||||
|
|
@ -375,12 +394,13 @@ function widgetDrag(tobj, dx, dy) {
|
||||||
var sy = xPageY(tobj.parentNode);
|
var sy = xPageY(tobj.parentNode);
|
||||||
|
|
||||||
var new_width = tobj.xDPX - sx;
|
var new_width = tobj.xDPX - sx;
|
||||||
if(new_width < 20) new_width = 20;
|
if(new_width < 25) new_width = 25;
|
||||||
|
|
||||||
var new_height = tobj.xDPY - sy;
|
var new_height = tobj.xDPY - sy;
|
||||||
if(new_height < 20) new_height = 20;
|
if(new_height < 25) new_height = 25;
|
||||||
|
|
||||||
if(new_width > xWidth('zonePageContent')-2) new_width = xWidth('zonePageContent')-2;
|
if( xPageX('zonePageContent') + xWidth('zonePageContent') < xPageX(tobj.parentNode) + new_width) new_width = xPageX('zonePageContent') + xWidth('zonePageContent') - xPageX(tobj.parentNode);
|
||||||
|
//if(new_width > xWidth('zonePageContent')-2) new_width = xWidth('zonePageContent')-2;
|
||||||
|
|
||||||
// 위젯의 크기 조절
|
// 위젯의 크기 조절
|
||||||
xWidth(tobj.nextSibling, new_width);
|
xWidth(tobj.nextSibling, new_width);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<input type="hidden" name="content" value="" />
|
<input type="hidden" name="content" value="" />
|
||||||
<input type="hidden" name="mid" value="{$module_info->mid}" />
|
<input type="hidden" name="mid" value="{$module_info->mid}" />
|
||||||
<input type="hidden" name="module_srl" value="{$module_srl}" />
|
<input type="hidden" name="module_srl" value="{$module_srl}" />
|
||||||
|
<input type="hidden" name="style" value="float:left;padding:none;margin:none;width:100%;" />
|
||||||
|
|
||||||
<div class="editor">
|
<div class="editor">
|
||||||
{$editor}
|
{$editor}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ function completeGenerateCode(ret_obj) {
|
||||||
zone.value = widget_code;
|
zone.value = widget_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 생성된 코드를 에디터에 출력 */
|
/* 생성된 코드를 페이지 zone에 출력 */
|
||||||
function completeGenerateCodeInPage(ret_obj,response_tags,params,fo_obj) {
|
function completeGenerateCodeInPage(ret_obj,response_tags,params,fo_obj) {
|
||||||
var widget_code = ret_obj["widget_code"];
|
var widget_code = ret_obj["widget_code"];
|
||||||
if(!opener || !widget_code) {
|
if(!opener || !widget_code) {
|
||||||
|
|
@ -21,6 +21,7 @@ function completeGenerateCodeInPage(ret_obj,response_tags,params,fo_obj) {
|
||||||
}
|
}
|
||||||
if(selected_node && selected_node.getAttribute("widget")) {
|
if(selected_node && selected_node.getAttribute("widget")) {
|
||||||
selected_node = replaceOuterHTML(selected_node, widget_code);
|
selected_node = replaceOuterHTML(selected_node, widget_code);
|
||||||
|
if(opener.doFitBorderSize) opener.doFitBorderSize();
|
||||||
} else {
|
} else {
|
||||||
var obj = opener.xGetElementById('zonePageContent');
|
var obj = opener.xGetElementById('zonePageContent');
|
||||||
xInnerHtml(obj, xInnerHtml(obj)+widget_code);
|
xInnerHtml(obj, xInnerHtml(obj)+widget_code);
|
||||||
|
|
@ -83,6 +84,10 @@ function doFillWidgetVars() {
|
||||||
|
|
||||||
var fo_obj = xGetElementById("fo_widget");
|
var fo_obj = xGetElementById("fo_widget");
|
||||||
|
|
||||||
|
var style = selected_node.getAttribute("style");
|
||||||
|
if(typeof(style)=="object") style = style["cssText"];
|
||||||
|
fo_obj.style.value = style;
|
||||||
|
|
||||||
for(var name in fo_obj) {
|
for(var name in fo_obj) {
|
||||||
var node = fo_obj[name];
|
var node = fo_obj[name];
|
||||||
if(!node || typeof(node)=="undefined") continue;
|
if(!node || typeof(node)=="undefined") continue;
|
||||||
|
|
@ -139,22 +144,6 @@ function doFillWidgetVars() {
|
||||||
if(selected_node.style.border) border= parseInt(selected_node.style.boarder.replace(/px$/,''),10);
|
if(selected_node.style.border) border= parseInt(selected_node.style.boarder.replace(/px$/,''),10);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var width = selected_node.style.width;
|
|
||||||
if(width) {
|
|
||||||
var width_type = width.replace(/^([0-9]+)/, '');
|
|
||||||
if(!width_type) width_type = 'px';
|
|
||||||
|
|
||||||
var width_value = width.replace(/([%|px]+)/,'');
|
|
||||||
|
|
||||||
fo_obj.widget_width.value = width_value;
|
|
||||||
if(width_type == '%') fo_obj.widget_width_type.selectedIndex = 0;
|
|
||||||
else fo_obj.widget_width_type.selectedIndex = 1;
|
|
||||||
} else {
|
|
||||||
var width_type = "px";
|
|
||||||
if(selected_node.getAttribute("widget_width_type")=="%") width_type = "%";
|
|
||||||
else fo_obj.widget_width.value = xWidth(selected_node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 컬러셋 설정
|
// 컬러셋 설정
|
||||||
if(skin && xGetElementById("widget_colorset").options.length<1 && colorset) {
|
if(skin && xGetElementById("widget_colorset").options.length<1 && colorset) {
|
||||||
doDisplaySkinColorset(xGetElementById("widget_skin"), colorset);
|
doDisplaySkinColorset(xGetElementById("widget_skin"), colorset);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<input type="hidden" name="selected_widget" value="{$selected_widget}" />
|
<input type="hidden" name="selected_widget" value="{$selected_widget}" />
|
||||||
<input type="hidden" name="module_srl" value="{$module_srl}" />
|
<input type="hidden" name="module_srl" value="{$module_srl}" />
|
||||||
<input type="hidden" name="widget_sequence" value="" />
|
<input type="hidden" name="widget_sequence" value="" />
|
||||||
|
<input type="hidden" name="style" value="float:left;width:100%;margin:none;padding:none;" />
|
||||||
|
|
||||||
<div id="popHeadder">
|
<div id="popHeadder">
|
||||||
<h3>{$lang->cmd_generate_code}</h3>
|
<h3>{$lang->cmd_generate_code}</h3>
|
||||||
|
|
@ -22,35 +23,6 @@
|
||||||
<th scope="row">{$lang->widget}</th>
|
<th scope="row">{$lang->widget}</th>
|
||||||
<td>{$widget_info->title} ver {$widget_info->version}</td>
|
<td>{$widget_info->title} ver {$widget_info->version}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th scope="row">{$lang->widget_width}</th>
|
|
||||||
<td>
|
|
||||||
<input type="text" value="50" name="widget_width" size="3" class="inputTypeText" />
|
|
||||||
<select name="widget_width_type" onchange="checkFixType(this)">
|
|
||||||
<option value="%">%</option>
|
|
||||||
<option value="px">px</option>
|
|
||||||
</select>
|
|
||||||
<p>{$lang->about_widget_width}</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{$lang->widget_margin}</th>
|
|
||||||
<td>
|
|
||||||
<table cellspacing="1" class="adminTable">
|
|
||||||
<tr>
|
|
||||||
<td colspan="2" class="tCenter">{$lang->widget_margin_top} <input type="text" name="widget_margin_top" value="0" size="2" class="inputTypeText" />px</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="tCenter">{$lang->widget_margin_left} <input type="text" name="widget_margin_left" value="0" size="2" class="inputTypeText"/>px</td>
|
|
||||||
<td class="tCenter">{$lang->widget_margin_right} <input type="text" name="widget_margin_right" value="0" size="2" class="inputTypeText" />px</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2" class="tCenter">{$lang->widget_margin_bottom} <input type="text" name="widget_margin_bottom" value="0" size="2" class="inputTypeText" />px</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<p>{$lang->about_widget_margin}</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!--@if(count($skin_list))-->
|
<!--@if(count($skin_list))-->
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{$lang->skin}</th>
|
<th scope="row">{$lang->skin}</th>
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,7 @@
|
||||||
// args 정리
|
// args 정리
|
||||||
$attribute = array();
|
$attribute = array();
|
||||||
if($vars) {
|
if($vars) {
|
||||||
$vars->widget_position = "left";
|
|
||||||
$vars->widget_fix_width = "Y";
|
|
||||||
foreach($vars as $key => $val) {
|
foreach($vars as $key => $val) {
|
||||||
if($key == 'widget_position') continue;
|
|
||||||
if(strpos($val,'|@|')>0) {
|
if(strpos($val,'|@|')>0) {
|
||||||
$val = str_replace('|@|',',',$val);
|
$val = str_replace('|@|',',',$val);
|
||||||
$vars->{$key} = $val;
|
$vars->{$key} = $val;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue