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

This commit is contained in:
zero 2007-03-22 09:41:33 +00:00
parent 526fd1ad4d
commit 3c14b0936d
6 changed files with 47 additions and 173 deletions

View file

@ -35,22 +35,14 @@
font-size:9pt;
}
.body label {
cursor:pointer;
font-size:9pt;
.image_list {
width:380px;
}
.image_align {
margin:0px 0px 5px 0px;
float:left;
width:150px;
}
.image_url {
width:350px;
height:13px;
.about_image_list {
margin-top:10px;
font-size:9pt;
border:1px solid #AAAAAA;
color:#AAAAAA;
}
.editor_input {

View file

@ -3,59 +3,26 @@
<!--%import("../lang")-->
<form action="./" method="get" onSubmit="return false" id="fo">
<input type="hidden" name="upload_target_srl" value="{$upload_target_srl}" />
<div class="editor_window">
<div class="editor_title">{$lang->imagelink}</div>
<div class="editor_title">{$lang->slide_show}</div>
<div class="header">{$lang->image_url}</div>
<div class="body"><input type="text" class="image_url" id="image_url" value="{$manual_url}" onblur="getImageScale();" /></div>
<div class="header">{$lang->width}</div>
<div class="body"><input type="text" class="editor_input" name="width" />px</div>
<div class="header">{$lang->image_scale}</div>
<div class="header">{$lang->height}</div>
<div class="body"><input type="text" class="editor_input" name="height" />px</div>
<div class="header">{$lang->image_list}</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>
<select id="image_list" size="10" class="image_list" multiple="true">
</select>
</div>
<div class="about_image_list">{$lang->about_image_list}</div>
</div>
<div class="header">{$lang->image_alt}</div>
<div class="body"><input type="text" class="image_url" id="image_alt" value="" /></div>
<div class="header">{$lang->image_align}</div>
<div class="body">
<div class="image_align">
<input type="radio" name="align" value="" id="align_normal" checked="true"/>
<label for="align_normal">
<img src="./images/align_normal.gif" alt="{$lang->image_align_normal}" />
{$lang->image_align_normal}
</label>
</div>
<div class="image_align">
<input type="radio" name="align" value="left" id="align_left" />
<label for="align_left">
<img src="./images/align_left.gif" alt="{$lang->image_align_left}" />
{$lang->image_align_left}
</label>
</div>
<div class="image_align">
<input type="radio" name="align" value="middle" id="align_middle" />
<label for="align_middle">
<img src="./images/align_middle.gif" alt="{$lang->image_align_middle}" />
{$lang->image_align_middle}
</label>
</div>
<div class="image_align">
<input type="radio" name="align" value="right" id="align_right" />
<label for="align_right">
<img src="./images/align_right.gif" alt="{$lang->image_align_right}" />
{$lang->image_align_right}
</label>
</div>
</div>
<div class="header">{$lang->image_border}</div>
<div class="body"><input type="text" class="editor_input" id="image_border" value="0" />px</div>
<div class="editor_button_area">
<input type="button" value="{$lang->cmd_insert}" class="editor_button" onclick="insertImage()" />
<input type="button" value="{$lang->cmd_close}" class="editor_button" onclick="window.close();" />

View file

@ -1,92 +1,32 @@
/**
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 이미지가 있는지 체크하여
* 있으면 가져와서 원하는 곳에 삽입
**/
function getImage() {
// 부모 위지윅 에디터에서 선택된 영역이 있는지 확인
var selected_node = null;
function getSlideShow() {
// 부모창이 있는지 체크
if(typeof(opener)=="undefined") return;
// url이 미리 입력되어 있을 경우 scale구해줌
if(xGetElementById("image_url").value) {
setTimeout(function() { getImageScale(); }, 500);
return;
// 부모창의 업로드 이미지 목록을 모두 가져와서 세팅
var fo = xGetElementById("fo");
var upload_target_srl = fo.upload_target_srl.value;
var parent_list_obj = opener.xGetElementById("uploaded_file_list_"+upload_target_srl);
var list_obj = xGetElementById("image_list");
var length = parent_list_obj.length;
for(var i=0;i<length;i++) {
var opt = new Option(parent_list_obj[i].text, parent_list_obj[i].value, false, false);
list_obj.options.add(opt);
}
// 부모 위지윅 에디터에서 선택된 영역이 있으면 처리
var node = opener.editorPrevNode;
if(!node || node.nodeName != "IMG") {
if(!node || node.nodeName != "DIV") {
return;
}
var src = node.getAttribute("src");
var border = node.getAttribute("border");
var align = node.getAttribute("align");
var alt = node.getAttribute("alt");
var width = node.getAttribute("width");
var height = node.getAttribute("height");
xGetElementById("image_url").value = src;
xGetElementById("image_alt").value = alt;
switch(align) {
case 'left' : xGetElementById("align_left").checked = true; break;
case 'middle' : xGetElementById("align_middle").checked = true; break;
case 'right' : xGetElementById("align_right").checked = true; break;
default : xGetElementById("align_normal").checked = true; break;
}
xGetElementById("image_border").value = border;
xGetElementById("width").value = width;
xGetElementById("height").value = height;
selected_node = node;
}
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) {
function insertSlideShow(obj) {
if(typeof(opener)=="undefined") return;
var url = xGetElementById("image_url").value;
var alt = xGetElementById("image_alt").value;
var align = "";
if(xGetElementById("align_normal").checked==true) align = "";
else if(xGetElementById("align_left").checked==true) align = "left";
else if(xGetElementById("align_middle").checked==true) align = "middle";
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 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);
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
opener.editorReplaceHTML(iframe_obj, text);
opener.editorFocus(opener.editorPrevSrl);
window.close();
}
xAddEventListener(window, "load", getImage);
xAddEventListener(window, "load", getSlideShow);