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

This commit is contained in:
zero 2007-03-22 01:57:08 +00:00
parent adf1fc2d71
commit c4f9f54d79
5 changed files with 157 additions and 87 deletions

View file

@ -5,11 +5,13 @@
* @brief 위지윅에디터(editor) 모듈 > 멀티미디어 링크 (naver_map) 컴포넌트의 언어팩
**/
$lang->navermap = "네이버 지도";
$lang->search_address = "주소 검색";
$lang->address_list = "주소 선택";
$lang->navermap_width = "가로크기";
$lang->navermap_height = "세로크기";
$lang->map_title = "네이버 지도 검색";
$lang->map_width = "가로크기";
$lang->map_height = "세로크기";
// 문구
$lang->about_address = "예) 분당 정자동, 역삼";
$lang->about_address_use = "검색창에서 원하는 주소를 검색하신후 출력된 결과물을 선택하시고 [추가] 버튼을 눌러주시면 글에 지도가 추가가 됩니다";
// 에러 메세지들
$lang->msg_not_exists_addr = "검색하려는 대상이 없습니다";

View file

@ -107,31 +107,45 @@
function displayMap() {
$id = "navermap".rand(11111111,99999999);
$width = Context::get('width');
$height = Context::get('height');
$x = Context::get('x');
$y = Context::get('y');
$html .=
sprintf(
$width = Context::get('width');
if(!$width) $width = 640;
$height = Context::get('height');
if(!$height) $height = 480;
$x = Context::get('x');
if(!$x) $x = 321198;
$y = Context::get('y');
if(!$y) $y = 529730;
$html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'.
'<html>'.
'<head>'.
'<title></title>'.
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'.
'<script type="text/javascript" src="./common/js/x.js"></script>'.
'<script type="text/javascript" src="http://maps.naver.com/js/naverMap.naver?key=%s"></script>'.
'<script type="text/javascript" src="http://maps.naver.com/js/naverMap.naver?key='.$this->open_api_key.'"></script>'.
'<script type="text/javascript">'.
'function moveMap(x,y,scale) {mapObj.setCenterAndZoom(new NPoint(x,y),scale);}'.
'</script>'.
'</head>'.
'<body style="margin:0px;">'.
'<div id="%s" style="width:%dpx;height:%dpx;"></div>'.
'<div id="'.$id.'" style="width:'.$width.'px;height:'.$height.'px;"></div>'.
'<script type="text/javascript">'.
'var mapObj = new NMap(document.getElementById("%s"));'.
'mapObj.addControl(new NSaveBtn());'.
'mapObj.setCenterAndZoom(new NPoint(%d,%d),3);'.
'mapObj.enableWheelZoom();'.
'</script>'.
'</body>'.
'</html>',
$this->open_api_key, $id, $width, $height, $id, $x, $y
);
'var mapObj = new NMap(document.getElementById("'.$id.'"));'.
'mapObj.addControl(new NSaveBtn());';
if($x&&$y) $html .= 'mapObj.setCenterAndZoom(new NPoint('.$x.','.$y.'),3);';
$html .= 'mapObj.enableWheelZoom();'.
'NEvent.addListener(mapObj, "click", function(pos) { if(typeof(top.mapClicked)!="undefined") top.mapClicked(pos); });'.
'NEvent.addListener(mapObj, "mouseup", function(pos) { if(typeof(top.mapClicked)!="undefined") top.mapClicked(pos); });'.
'</script>'.
'</body>'.
'</html>';
print $html;
exit();
}

View file

@ -1,5 +1,5 @@
.editor_window {
width:600px;
width:700px;
clear:both;
}
@ -16,45 +16,91 @@
text-align:center;
}
.header {
.address_box {
float:left;
width:100px;
clear:left;
text-align:left;
font-weight:bold;
width:250px;
border:1px solid #EEEEEE;
padding:5px;
margin:5px;
font-size:9pt;
font-size:9pt;
}
.body {
float:left;
width:400px;
text-align:left;
margin:5px;
font-size:9pt;
}
.body label {
cursor:pointer;
font-size:9pt;
}
.navermap_address {
width:80px;
.input_address {
width:200px;
border:1px solid #AAAAAA;
height:12px;
font-size:9pt;
}
.navermap_size {
width:40px;
border:1px solid #AAAAAA;
.address_button {
margin-top:4px;
background-color:#AAAAAA;
border:1px solid #333333;
color:#FFFFFF;
height:16px;
font-size:9pt;
}
.about_address {
font-size:8pt;
color:#AAAAAA;
margin-top:3px;
}
.address_list_box {
border:1px solid #DDDDDD;
padding:5px;
float:left;
width:250px;
height:288px;
margin:5px;
font-size:9pt;
color:#AAAAAA;
overflow:auto;
}
.address_list_box A {
color:#888888;
line-height:15px;
}
.map_scale_box {
float:left;
width:250px;
border:1px solid #EEEEEE;
padding:5px;
margin:5px;
}
.map_scale_header {
float:left;
font-size:9pt;
width:60px;
}
.map_scale_body {
width:180px;
float:left;
margin-left:5px;
font-size:9pt;
}
.input_map_size {
width:30px;
border:1px solid #EEEEEE;
height:12px;
font-size:9pt;
}
.map_display {
float:right;
width:410px;
height:410px;
margin:5px 5px 0px 6px;
}
.editor_button_area {
width:100%;
border-top:1px solid #AAAAAA;
text-align:center;
background-color:#EEEEEE;

View file

@ -2,21 +2,28 @@
<!--%import("popup.css")-->
<!--%import("../lang")-->
<form action="./" method="get" onSubmit="return false" id="fo">
<form action="./" method="get" onSubmit="search_address(); return false;" id="fo">
<input type="hidden" id="map_x" name="x" value="" />
<input type="hidden" id="map_y" name="x" value="" />
<div class="editor_window">
<div class="editor_title">{$lang->navermap}</div>
<div class="editor_title">{$lang->map_title}</div>
<div class="header">{$lang->search_address}</div>
<div class="body"><input type="text" class="navermap_address" id="address" value="" /><input type="button" value="{$lang->cmd_search}" class="editor_button" onclick="search_address();return false;"/></div>
<div class="map_display"><iframe name="display_map" id="display_map" frameBorder="0" style="width:400px;height:400px;border:0px;margin:5px;" src="./?module=editor&amp;component=naver_map&amp;act=procCall&amp;method=displayMap&amp;width=400&amp;height=400"></iframe></div>
<div class="header">{$lang->address_list}</div>
<div class="body"><select id="address_list"></select></div>
<div class="address_box">
<input type="text" class="input_address" id="address" value="" /><input type="submit" value="{$lang->cmd_search}" class="address_button" onclick="search_address();return false;"/>
<div class="about_address">{$lang->about_address}</div>
</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="address_list_box" id="address_list">{$lang->about_address_use}</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="map_scale_box">
<div class="map_scale_header">{$lang->map_width}</div>
<div class="map_scale_body"><input type="text" class="input_map_size" id="map_width" value="640" />px</div>
<div class="map_scale_header">{$lang->map_height}</div>
<div class="map_scale_body"><input type="text" class="input_map_size" id="map_height" value="480" />px</div>
</div>
<div class="editor_button_area">
<input type="button" value="{$lang->cmd_insert}" class="editor_button" onclick="insertNaverMap()" />

View file

@ -14,39 +14,35 @@ function getNaverMap() {
var width = xWidth(node);
var height = xHeight(node);
var address = node.getAttribute("address");
var selected_address = node.getAttribute("selected_address");
if(!address || !x || !y) return;
xGetElementById("address").value = address;
search_address(selected_address);
if(x&&y) {
xGetElementById("map_x").value = x;
xGetElementById("map_y").value = y;
moveMap(x,y,3);
}
if(address) {
xGetElementById("address").value = address;
search_address(address);
}
xGetElementById("navermap_width").value = width-6;
xGetElementById("navermap_height").value = height-6;
xGetElementById("map_width").value = width-6;
xGetElementById("map_height").value = height-6;
}
function insertNaverMap(obj) {
if(typeof(opener)=="undefined") return;
var listup_obj = xGetElementById("address_list");
var idx = listup_obj.options[listup_obj.selectedIndex].value;
if(!idx) {
window.close();
return;
}
var item = naver_address_list[idx];
var x = item[0];
var y = item[1];
var selected_address = item[2];
var x = xGetElementById("map_x").value;
var y = xGetElementById("map_y").value;
var address = xGetElementById("address").value;
var width = xGetElementById("navermap_width").value;
var width = xGetElementById("map_width").value;
if(!width) width = 640;
var height = xGetElementById("navermap_height").value;
var height = xGetElementById("map_height").value;
if(!height) height= 480;
var text = "<div editor_component=\"naver_map\" class=\"editor_component_output\" address=\""+address+"\" selected_address=\""+selected_address+"\" x=\""+x+"\" y=\""+y+"\" width=\""+width+"\" height=\""+height+"\" style=\"width:"+width+"px;height:"+height+"px;\"></div>";
var text = "<div editor_component=\"naver_map\" class=\"editor_component_output\" address=\""+address+"\" x=\""+x+"\" y=\""+y+"\" width=\""+width+"\" height=\""+height+"\" style=\"width:"+width+"px;height:"+height+"px;\"></div>";
opener.editorFocus(opener.editorPrevSrl);
@ -74,6 +70,16 @@ function search_address(selected_address) {
exec_xml('editor', 'procCall', params, complete_search_address, response_tags, selected_address);
}
function moveMap(x,y,scale) {
if(typeof(scale)=="undefined") scale = 3;
display_map.moveMap(x,y,scale);
}
function mapClicked(pos) {
xGetElementById("map_x").value = pos.x;
xGetElementById("map_y").value = pos.y;
}
var naver_address_list = new Array();
function complete_search_address(ret_obj, response_tags, selected_address) {
var address_list = ret_obj['address_list'];
@ -81,20 +87,15 @@ function complete_search_address(ret_obj, response_tags, selected_address) {
naver_address_list = new Array();
var listup_obj = xGetElementById("address_list");
var length = listup_obj.options.length;
for(var i=0;i<length;i++) listup_obj.remove(0);
var html = "";
var address_list = address_list.split("\n");
for(var i=0;i<address_list.length;i++) {
var item = address_list[i].split(",");
naver_address_list[naver_address_list.length] = item;
var selected = false;
if(selected_address && selected_address == item[2]) selected = true;
var opt = new Option(item[2], naver_address_list.length-1, false, selected);
listup_obj.options[listup_obj.length] = opt;
html += "<a href='#' onclick=\"moveMap('"+item[0]+"','"+item[1]+"');return false;\">"+item[2]+"</a><br />";
}
var list_zone = xGetElementById("address_list");
xInnerHtml(list_zone, html);
}