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

This commit is contained in:
zero 2007-03-19 03:42:44 +00:00
parent 9d2d89c569
commit e9bf219b7c
5 changed files with 195 additions and 0 deletions

View file

@ -0,0 +1,15 @@
<?php
/**
* @file /modules/editor/components/image_link/lang/ko.lang.php
* @author zero <zero@nzeo.com>
* @brief 위지윅에디터(editor) 모듈 > 이미지링크(image_link) 컴포넌트의 언어팩
**/
$lang->image_url = "이미지 경로";
$lang->image_alt = "설명";
$lang->image_align = "정렬";
$lang->image_align_normal = "한 문단을 차지";
$lang->image_align_left = "글의 왼쪽으로";
$lang->image_align_middle = "가운데";
$lang->image_align_right = "글의 우측으로";
?>

View file

@ -0,0 +1,57 @@
<?php
/**
* @class multimedia_link
* @author zero (zero@nzeo.com)
* @brief 에디터에서 url링크하는 기능 제공. 단순 팝업.
**/
class multimedia_link extends EditorHandler {
// upload_target_srl 는 에디터에서 필수로 달고 다녀야 함....
var $upload_target_srl = 0;
var $component_path = '';
/**
* @brief upload_target_srl과 컴포넌트의 경로를 받음
**/
function multimedia_link($upload_target_srl, $component_path) {
$this->upload_target_srl = $upload_target_srl;
$this->component_path = $component_path;
}
/**
* @brief 에디터에서 처음 요청을 받을 경우 실행이 되는 부분이다.
* execute의 경우 2가지 경우가 생긴다.
* 직접 에디터 아래의 component area로 삽입할 html 코드를 만드는 것과 popup 윈도우를 띄우는 것인데
* popup윈도우를 띄울 경우는 getPopupContent() 이라는 method가 실행이 되니 구현하여 놓아야 한다
**/
function execute() {
$url = sprintf('./?module=editor&act=dispPopup&target_srl=%s&component=multimedia_link', $this->upload_target_srl);
$this->add('tpl', '');
$this->add('open_window', 'Y');
$this->add('popup_url', $url);
}
/**
* @brief popup window요청시 다시 call이 method. popup window에 출력할 내용을 추가하면 된다
**/
function getPopupContent() {
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
Context::set("tpl_path", $tpl_path);
// 이모티콘을 모두 가져옴
$multimedia_link_list = FileHandler::readDir($tpl_path.'/images');
Context::set('multimedia_link_list', $multimedia_link_list);
require_once("./classes/template/TemplateHandler.class.php");
$oTemplate = new TemplateHandler();
return $oTemplate->compile($tpl_path, $tpl_file);
}
}
?>

View file

@ -0,0 +1,46 @@
.editor_window {
width:400px;
text-align:center;
}
.header {
float:left;
width:100px;
clear:left;
text-align:left;
font-weight:bold;
margin:5px;
}
.body {
float:left;
width:250px;
text-align:left;
margin:5px;
font-size:9pt;
}
.body label {
cursor:pointer;
}
.image_align {
margin:0px 0px 5px 0px;
}
.image_url {
width:240px;
border:1px solid #AAAAAA;
}
.editor_button_area {
clear:both;
text-align:center;
margin:5px;
}
.editor_button {
margin-top:4px;
background-color:#FFFFFF;
border:1px solid #AAAAAA;
}

View file

@ -0,0 +1,47 @@
<!--%import("popup.js")-->
<!--%import("popup.css")-->
<!--%import("../lang")-->
<div class="editor_window">
<form action="./" method="get" onSubmit="return false" id="fo">
<div class="header">{$lang->image_url}</div>
<div class="body"><input type="text" class="image_url" id="image_url" value="" /></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="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();" />
</div>
</form>
</div>

View file

@ -0,0 +1,30 @@
function insertImage(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";
if(!url) {
window.close();
return;
}
var text = "<img src=\""+url+"\" border=\"0\"";
if(alt) text+= " alt=\""+alt+"\"";
if(align) text+= " align=\""+align+"\" ";
text+= " />";
opener.editorFocus(opener.editorPrevSrl);
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
opener.editorReplaceHTML(iframe_obj, text);
opener.editorFocus(opener.editorPrevSrl);
window.close();
}