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

This commit is contained in:
zero 2007-03-21 06:21:56 +00:00
parent 68541b7822
commit 3958be025e
8 changed files with 343 additions and 0 deletions

View file

@ -0,0 +1,13 @@
<?php
/**
* @file /modules/editor/components/naver_map/lang/ko.lang.php
* @author zero <zero@nzeo.com>
* @brief 위지윅에디터(editor) 모듈 > 멀티미디어 링크 (naver_map) 컴포넌트의 언어팩
**/
$lang->navermap = "네이비 지도";
$lang->navermap_address = "주소";
$lang->navermap_width = "가로크기";
$lang->navermap_height = "세로크기";
$lang->navermap_auto_start = "자동시작";
?>

View file

@ -0,0 +1,65 @@
<?php
/**
* @class naver_map
* @author zero (zero@nzeo.com)
* @brief 본문에 네이버의 지도 open api로 지도 삽입
**/
class naver_map extends EditorHandler {
// upload_target_srl 는 에디터에서 필수로 달고 다녀야 함....
var $upload_target_srl = 0;
var $component_path = '';
/**
* @brief upload_target_srl과 컴포넌트의 경로를 받음
**/
function naver_map($upload_target_srl, $component_path) {
$this->upload_target_srl = $upload_target_srl;
$this->component_path = $component_path;
}
/**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
**/
function getPopupContent() {
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
Context::set("tpl_path", $tpl_path);
require_once("./classes/template/TemplateHandler.class.php");
$oTemplate = new TemplateHandler();
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!="true") $auto_start = "false";
else $auto_start = "true";
$caption = $xml_obj->body;
$src = str_replace(array('&','"'), array('&amp;','&qout;'), $src);
return sprintf("<div><script type=\"text/javascript\">displayMultimedia(\"%s\", \"%s\",\"%s\",%s);</script>", $src, $width, $height, $auto_start);
*/
}
}
?>

View file

@ -0,0 +1,65 @@
.editor_window {
width:400px;
clear:both;
}
.editor_title {
font-size:10pt;
font-weight:bold;
clear:both;
height:20px;
background-color:#555555;
color:#EFEFEF;
vertical-align:middle;
padding-top:5px;
border-bottom:1px solid #000000;
text-align:center;
}
.header {
float:left;
width:100px;
clear:left;
text-align:left;
font-weight:bold;
margin:5px;
font-size:9pt;
font-size:9pt;
}
.body {
float:left;
width:250px;
text-align:left;
margin:5px;
font-size:9pt;
}
.body label {
cursor:pointer;
font-size:9pt;
}
.navermap_address {
width:80px;
border:1px solid #AAAAAA;
height:12px;
font-size:9pt;
}
.editor_button_area {
border-top:1px solid #AAAAAA;
text-align:center;
background-color:#EEEEEE;
padding:0px 0px 2px 0px;
clear:both;
}
.editor_button {
margin-top:4px;
background-color:#FFFFFF;
border:1px solid #AAAAAA;
height:16px;
font-size:9pt;
}

View file

@ -0,0 +1,23 @@
<!--%import("popup.js")-->
<!--%import("popup.css")-->
<!--%import("../lang")-->
<form action="./" method="get" onSubmit="return false" id="fo">
<div class="editor_window">
<div class="editor_title">{$lang->navermap}</div>
<div class="header">{$lang->navermap_address}</div>
<div class="body"><input type="text" class="navermap_address" id="address" value="{$manual_url}" /><input type="button" value="{$lang->cmd_search}" class="editor_button" onclick="search_address();return false;"/></div>
<div class="header">{$lang->navermap_width}</div>
<div class="body"><input type="text" class="navermap_size" id="navermap_width" value="640" />px</div>
<div class="header">{$lang->navermap_height}</div>
<div class="body"><input type="text" class="navermap_size" id="navermap_height" value="480" />px</div>
<div class="editor_button_area">
<input type="button" value="{$lang->cmd_insert}" class="editor_button" onclick="insertMultimedia()" />
<input type="button" value="{$lang->cmd_close}" class="editor_button" onclick="window.close();" />
</div>
</div>
</form>

View file

@ -0,0 +1,80 @@
/**
* popup으로 열렸을 경우 부모창의 위지윅에디터에 select된 멀티미디어 컴포넌트 코드를 체크하여
* 있으면 가져와서 원하는 곳에 삽입
**/
function getNaverMap() {
return;
// 부모 위지윅 에디터에서 선택된 영역이 있는지 확인
if(typeof(opener)=="undefined") return;
var node = opener.editorPrevNode;
if(!node || node.nodeName != "DIV") return;
var url = node.getAttribute("src");
var caption = xInnerHtml(node);
var width = node.getAttribute("width");
if(width!=xWidth(node)) width = xWidth(node);
var height = node.getAttribute("height");
if(height!=xHeight(node)) height = xHeight(node);
var auto_start = node.getAttribute("auto_start");
xGetElementById("multimedia_url").value = url;
xGetElementById("multimedia_caption").value = caption;
xGetElementById("multimedia_width").value = width;
xGetElementById("multimedia_height").value = height;
if(auto_start=="true") xGetElementById("multimedia_auto_start").checked = true;
}
function insertNaverMap(obj) {
if(typeof(opener)=="undefined") return;
return;
var url = xGetElementById("multimedia_url").value;
var caption = xGetElementById("multimedia_caption").value;
var width = xGetElementById("multimedia_width").value;
if(!width) width = 640;
var height = xGetElementById("multimedia_height").value;
if(!height) height= 480;
var auto_start = "false";
if(xGetElementById("multimedia_auto_start").checked) auto_start = "true";
if(!url) {
window.close();
return;
}
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);
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
opener.editorReplaceHTML(iframe_obj, text);
opener.editorFocus(opener.editorPrevSrl);
window.close();
}
xAddEventListener(window, "load", getNaverMap);
/* 네이버의 map openapi로 주소에 따른 좌표를 요청 */
function search_address() {
var address = xGetElementById("adress");
if(!address) return;
var params = new Array();
params['address'] = address;
var response_tags = new Array('error','message','address_list');
exec_xml('editor', 'procCall', params, complete_search_address);
}
function complete_search_address(ret_obj) {
var address_list = ret_obj['address_list'];
alert(address_list);
}

View file

@ -3,5 +3,6 @@
<grants />
<actions>
<action name="dispPopup" type="view" standalone="true" />
<action name="procCall" type="controller" standalone="true" />
</actions>
</module>

View file

@ -0,0 +1,48 @@
<?php
/**
* @class editor
* @author zero (zero@nzeo.com)
* @brief editor 모듈의 high class
**/
class editor extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
**/
function moduleIsInstalled() {
return new Object();
}
/**
* @brief 업데이트 실행
**/
function moduleUpdate() {
return new Object();
}
/**
* @brief component의 객체 생성
**/
function getComponentObject($component, $upload_target_srl) {
// 해당 컴포넌트의 객체를 생성해서 실행
$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
$class_file = sprintf('%s%s.class.php', $class_path, $component);
if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
require_once($class_file);
$eval_str = sprintf('$oComponent = new %s("%s","%s");', $component, $upload_target_srl, $class_path);
@eval($eval_str);
if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
return $oComponent;
}
}
?>

View file

@ -0,0 +1,48 @@
<?php
/**
* @class editor
* @author zero (zero@nzeo.com)
* @brief editor 모듈의 high class
**/
class editor extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
**/
function moduleIsInstalled() {
return new Object();
}
/**
* @brief 업데이트 실행
**/
function moduleUpdate() {
return new Object();
}
/**
* @brief component의 객체 생성
**/
function getComponentObject($component, $upload_target_srl) {
// 해당 컴포넌트의 객체를 생성해서 실행
$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
$class_file = sprintf('%s%s.class.php', $class_path, $component);
if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
require_once($class_file);
$eval_str = sprintf('$oComponent = new %s("%s","%s");', $component, $upload_target_srl, $class_path);
@eval($eval_str);
if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
return $oComponent;
}
}
?>