페이지 모듈의 위젯 처리 부분 오류 없이 수정 & 컨텐츠 추가시 내용을 utf8 encode하도록 하여 문제 해결

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2962 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-11-13 03:23:55 +00:00
parent 3501721233
commit 1b15ffbea6
8 changed files with 190 additions and 141 deletions

View file

@ -197,8 +197,9 @@
**/
function procPageAdminAddContent() {
$content = Context::get('content');
$style = Context::get('style');
$tpl = $this->transEditorContent($content);
$tpl = $this->transEditorContent($content, $style);
$this->add('tpl', $tpl);
}

View file

@ -44,6 +44,9 @@ function doSubmitPageContent(fo_obj) {
while(childObj) {
if(childObj.nodeName == "DIV" && childObj.getAttribute("widget")) {
var widget = childObj.getAttribute("widget");
if(!widget) continue;
// 내장 위젯인 에디터 컨텐츠인 경우
if(widget == "widgetContent") {
var style = childObj.getAttribute("style");
if(typeof(style)=="object") style = style["cssText"];
@ -51,23 +54,29 @@ function doSubmitPageContent(fo_obj) {
var code = "";
while(cobj && cobj.className != "widgetContent") { cobj = cobj.nextSibling; }
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+'" />';
}
html += code;
// 위젯의 경우
} else {
var attrs = "";
var code = "";
for(var i=0;i<childObj.attributes.length;i++) {
if(!childObj.attributes[i].nodeName || !childObj.attributes[i].nodeValue) continue;
var name = childObj.attributes[i].nodeName.toLowerCase();
var value = childObj.attributes[i].nodeValue.replace(/\"/ig,'&quot;');
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(name=="style" || name=="src" || name=="widget" || name == "body" || name == "class" || name == "height") continue;
if(value && typeof(value)=="string") value = value.replace(/\"/ig,'&quot;');
attrs += name+'="'+value+'" ';
}
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+' />';
html += code;
@ -166,6 +175,10 @@ function doAddContent(module_srl) {
function doSyncPageContent() {
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;
while(obj && obj.className != "widgetContent") obj = obj.nextSibling;
if(obj && obj.className == "widgetContent") {
@ -189,6 +202,8 @@ function completeAddContent(ret_obj) {
var obj = opener.xGetElementById('zonePageContent');
xInnerHtml(obj, xInnerHtml(obj)+tpl);
}
if(opener.doFitBorderSize) opener.doFitBorderSize();
window.close();
return false;
@ -209,16 +224,20 @@ function doAddWidget(fo) {
/* 페이지 수정 시작 */
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'));
for(var i=0;i<obj_list.length;i++) {
var obj = obj_list[i];
xHeight(obj, xHeight(obj.parentNode));
}
// 드래그와 리사이즈와 관련된 이벤트 리스너 생성
xAddEventListener(document,"click",doCheckWidget);
xAddEventListener(document,"mousedown",doCheckWidgetDrag);
}
var selectedWidget = null;
@ -375,12 +394,13 @@ function widgetDrag(tobj, dx, dy) {
var sy = xPageY(tobj.parentNode);
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;
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);

View file

@ -7,6 +7,7 @@
<input type="hidden" name="content" value="" />
<input type="hidden" name="mid" value="{$module_info->mid}" />
<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">
{$editor}

View file

@ -12,7 +12,7 @@ function completeGenerateCode(ret_obj) {
zone.value = widget_code;
}
/* 생성된 코드를 에디터에 출력 */
/* 생성된 코드를 페이지 zone에 출력 */
function completeGenerateCodeInPage(ret_obj,response_tags,params,fo_obj) {
var widget_code = ret_obj["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")) {
selected_node = replaceOuterHTML(selected_node, widget_code);
if(opener.doFitBorderSize) opener.doFitBorderSize();
} else {
var obj = opener.xGetElementById('zonePageContent');
xInnerHtml(obj, xInnerHtml(obj)+widget_code);
@ -83,6 +84,10 @@ function doFillWidgetVars() {
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) {
var node = fo_obj[name];
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);
*/
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) {
doDisplaySkinColorset(xGetElementById("widget_skin"), colorset);

View file

@ -7,6 +7,7 @@
<input type="hidden" name="selected_widget" value="{$selected_widget}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<input type="hidden" name="widget_sequence" value="" />
<input type="hidden" name="style" value="float:left;width:100%;margin:none;padding:none;" />
<div id="popHeadder">
<h3>{$lang->cmd_generate_code}</h3>
@ -22,35 +23,6 @@
<th scope="row">{$lang->widget}</th>
<td>{$widget_info->title} ver {$widget_info->version}</td>
</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))-->
<tr>
<th scope="row">{$lang->skin}</th>

View file

@ -86,10 +86,7 @@
// args 정리
$attribute = array();
if($vars) {
$vars->widget_position = "left";
$vars->widget_fix_width = "Y";
foreach($vars as $key => $val) {
if($key == 'widget_position') continue;
if(strpos($val,'|@|')>0) {
$val = str_replace('|@|',',',$val);
$vars->{$key} = $val;