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

This commit is contained in:
zero 2007-03-19 06:26:49 +00:00
parent cc0b017bcc
commit 5d59f2b8f9
13 changed files with 197 additions and 153 deletions

View file

@ -53,5 +53,32 @@
return $oTemplate->compile($tpl_path, $tpl_file);
}
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 코드를 html로 변경하여 주는 method
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
**/
function transHTML($xml_obj) {
$src = $xml_obj->attrs->src;
$alt = $xml_obj->attrs->alt;
$width = $xml_obj->attrs->width;
$height = $xml_obj->attrs->height;
$align = $xml_obj->attrs->align;
$border = $xml_obj->attrs->border;
$src = str_replace(array('&','"'), array('&','&qout;'), $src);
if(!$alt) $alt = $src;
$output = array();
$output = array("src=\"".$src."\"");
if($alt) $output[] = "alt=\"".$alt."\"";
if($width) $output[] = "width=\"".$width."\"";
if($height) $output[] = "height=\"".$height."\"";
if($align) $output[] = "align=\"".$align."\"";
if($border) $output[] = "border=\"".$border."\"";
return "<img ".implode(" ", $output)." />";
}
}
?>

View file

@ -1,56 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>add Image</title>
<link rel='stylesheet' href='../css/editor.css' type='text/css' />
<script type='text/javascript' src='../../common/js/x.js'></script>
<script type='text/javascript' src='../../common/js/common.js'></script>
<script type='text/javascript' src='../js/editor.js'></script>
<script type='text/javascript'>
function insertImage() {
if(typeof(opener)=='undefined') return;
var fo_obj = xGetElementById("fo");
var url = fo_obj.url.value;
var align = fo_obj.align.options[fo_obj.align.selectedIndex].value;
if(url) {
opener.editorInsertImage(url, align);
opener.editorFocus(opener.editorPrevSrl);
}
self.close();
}
xAddEventListener(window, 'load', setFixedPopupSize);
</script>
</head>
<body class="editor_pop_body">
<form action='./' method='post' id="fo" onSubmit="return false" style="display:inline">
<div id='zone_AddUrl' class="editor_window">
<table width="380" border="0" cellspacing="1" cellpadding="0">
<col width="50" />
<col width="*" />
<tr>
<td class="editor_field">url</td>
<td><input type='text' name='url' class="editor_input" value='<?=$_GET['file_url']?>'/></td>
</tr>
<tr>
<td class="editor_field">type</td>
<td>
<select name='align'>
<option value=''>normal</option>
<option value='left'>left</option>
<option value='right'>right</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" height="40">
<input type='button' class="editor_submit" value='Insert' onClick='insertImage()' />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

View file

@ -7,10 +7,13 @@
$lang->image_url = "이미지 경로";
$lang->image_alt = "설명 입력";
$lang->image_scale = "이미지크기";
$lang->image_align = "정렬 방법 ";
$lang->image_align_normal = "한 문단을 차지";
$lang->image_align_left = "글의 왼쪽으로";
$lang->image_align_middle = "가운데";
$lang->image_align_right = "글의 우측으로";
$lang->image_border = "경계선 두께";
$lang->cmd_get_scale = "크기 구하기";
?>

View file

@ -5,7 +5,15 @@
<form action="./" method="get" onSubmit="return false" id="fo">
<div class="editor_window">
<div class="header">{$lang->image_url}</div>
<div class="body"><input type="text" class="image_url" id="image_url" value="" /></div>
<div class="body"><input type="text" class="image_url" id="image_url" value="" onblur="getImageScale();" /></div>
<div class="header">{$lang->image_scale}</div>
<div class="body">
<input type="text" class="editor_input" id="width" value="0" />px
<input type="text" class="editor_input" id="height" value="0" />px
<input type="button" value="{$lang->cmd_get_scale}" class="editor_button" onclick="getImageScale();return false;" />
</div>
<div class="header">{$lang->image_alt}</div>
<div class="body"><input type="text" class="image_url" id="image_alt" value="" /></div>

View file

@ -1,3 +1,14 @@
function getImageScale() {
var url = xGetElementById("image_url").value;
if(!url) return;
var img = new Image();
img.src = url;
xGetElementById("width").value = img.width;
xGetElementById("height").value = img.height;
}
function insertImage(obj) {
if(typeof(opener)=="undefined") return;
@ -10,14 +21,19 @@ function insertImage(obj) {
else if(xGetElementById("align_right").checked==true) align = "right";
var border = parseInt(xGetElementById("image_border").value,10);
var width = xGetElementById("width").value;
var height = xGetElementById("height").value;
if(!url) {
window.close();
return;
}
var text = "<img src=\""+url+"\" border=\""+border+"\" plugin=\"image_link\" ";
var text = "<img editor_component=\"image_link\" src=\""+url+"\" border=\""+border+"\" ";
if(alt) text+= " alt=\""+alt+"\"";
if(align) text+= " align=\""+align+"\" ";
if(width) text+= " width=\""+width+"\" ";
if(height) text+= " height=\""+height+"\" ";
text+= " />";
opener.editorFocus(opener.editorPrevSrl);

View file

@ -53,5 +53,30 @@
return $oTemplate->compile($tpl_path, $tpl_file);
}
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 코드를 html로 변경하여 주는 method
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
**/
function transHTML($xml_obj) {
$src = $xml_obj->attrs->src;
$width = $xml_obj->attrs->width;
if(!$width) $width = 640;
$height = $xml_obj->attrs->height;
if(!$height) $height = 480;
$auto_start = $xml_obj->attrs->auto_start;
if(!$auto_start) $auto_start = "false";
else $auto_start = "true";
$caption = $xml_obj->body;
$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
return sprintf("<script type=\"text/javascript\">displayMultimedia(\"%s\", \"%s\",\"%s\",%s);</script>", $src, $width, $height, $auto_start);
}
}
?>

View file

@ -19,7 +19,7 @@ function insertMultimedia(obj) {
return;
}
var text = "<div class=\"editor_multimedia\" plugin=\"multimedia_link\" src=\""+url+"\" width=\""+width+"\" height=\""+height+"\" style=\"width:"+width+"px;height:"+height+"px;\" auto_start=\""+auto_start+"\">"+caption+"</div>";
var text = "<div editor_component=\"multimedia_link\" class=\"editor_multimedia\" src=\""+url+"\" width=\""+width+"\" height=\""+height+"\" style=\"width:"+width+"px;height:"+height+"px;\" auto_start=\""+auto_start+"\">"+caption+"</div>";
opener.editorFocus(opener.editorPrevSrl);