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

This commit is contained in:
zero 2007-03-29 09:59:26 +00:00
parent 0cf1c7996f
commit 6116703a71
3 changed files with 48 additions and 4 deletions

View file

@ -100,10 +100,12 @@
function transHTML($xml_obj) {
$x = $xml_obj->attrs->x;
$y = $xml_obj->attrs->y;
$marker_1 = $xml_obj->attrs->marker_1;
$marker_2 = $xml_obj->attrs->marker_2;
$marker_3 = $xml_obj->attrs->marker_3;
$width = $xml_obj->attrs->width;
$height = $xml_obj->attrs->height;
$body_code = sprintf('<div style="width:%dpx;height:%dpx;"><iframe src="%s?module=editor&amp;act=procCall&amp;method=displayMap&amp;component=naver_map&amp;width=%s&amp;height=%s&amp;x=%s&amp;y=%s" frameBorder="0" style="padding:1px; border:1px solid #AAAAAA;width:%dpx;height:%dpx;margin:0px;"></iframe></div>', $width, $height, Context::getRequestUri(), $width, $height, $x, $y, $width, $height);
$body_code = sprintf('<div style="width:%dpx;height:%dpx;margin-bottom:5px;"><iframe src="%s?module=editor&amp;act=procCall&amp;method=displayMap&amp;component=naver_map&amp;width=%s&amp;height=%s&amp;x=%s&amp;y=%s&amp;marker_1=%s&amp;marker_2=%s&amp;marker_3=%s" frameBorder="0" style="padding:1px; border:1px solid #AAAAAA;width:%dpx;height:%dpx;margin:0px;"></iframe></div>', $width, $height, Context::getRequestUri(), $width, $height, $x, $y, $marker_1, $marker_2, $marker_3, $width, $height);
return $body_code;
}
@ -122,6 +124,10 @@
$y = Context::get('y');
if(!$y) $y = 529730;
$marker_1 = Context::get('marker_1');
$marker_2 = Context::get('marker_2');
$marker_3 = Context::get('marker_3');
$html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'.
'<html>'.
'<head>'.
@ -131,16 +137,39 @@
'<script type="text/javascript" src="http://maps.naver.com/js/naverMap.naver?key='.$this->api_key.'"></script>'.
'<script type="text/javascript">'.
'function moveMap(x,y,scale) {mapObj.setCenterAndZoom(new NPoint(x,y),scale);}'.
'function createMarker(pos) { if(typeof(top.addMarker)=="function") { if(!top.addMarker(pos)) return; var iconUrl = "http://static.naver.com/local/map_img/set/icos_free_"+String.fromCharCode(96+top.marker_count-1)+".gif"; var marker = new NMark(pos,new NIcon(iconUrl,new NSize(15,14))); mapObj.addOverlay(marker); } }'.
'</script>'.
'</head>'.
'<body style="margin:0px;">'.
'<div id="'.$id.'" style="width:'.$width.'px;height:'.$height.'px;"></div>'.
'<script type="text/javascript">'.
'var mapObj = new NMap(document.getElementById("'.$id.'"));'.
'mapObj.addControl(new NSaveBtn());';
'mapObj.addControl(new NSaveBtn());'.
'var zoom = new NZoomControl();'.
'zoom.setValign("bottom");'.
'mapObj.addControl(zoom);'.
'var infowin = new NInfoWindow();'.
'mapObj.addOverlay(infowin);'.
'NEvent.addListener(mapObj,"click",createMarker);'.
'';
if($x&&$y) $html .= 'mapObj.setCenterAndZoom(new NPoint('.$x.','.$y.'),3);';
if($marker_1) {
$icon_url = 'http://static.naver.com/local/map_img/set/icos_free_a.gif';
$html .= 'mapObj.addOverlay( new NMark(new NPoint('.$marker_1.'),new NIcon("'.$icon_url.'",new NSize(15,14))) );';
}
if($marker_2) {
$icon_url = 'http://static.naver.com/local/map_img/set/icos_free_b.gif';
$html .= 'mapObj.addOverlay( new NMark(new NPoint('.$marker_2.'),new NIcon("'.$icon_url.'",new NSize(15,14))) );';
}
if($marker_3) {
$icon_url = 'http://static.naver.com/local/map_img/set/icos_free_c.gif';
$html .= 'mapObj.addOverlay( new NMark(new NPoint('.$marker_3.'),new NIcon("'.$icon_url.'",new NSize(15,14))) );';
}
$html .= ''.
//'mapObj.enableWheelZoom();'.
'NEvent.addListener(mapObj, "click", function(pos) { if(typeof(top.mapClicked)!="undefined") top.mapClicked(pos); });'.

View file

@ -5,6 +5,9 @@
<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="" />
<input type="hidden" id="marker_1" name="marker_1" value="" />
<input type="hidden" id="marker_2" name="marker_2" value="" />
<input type="hidden" id="marker_3" name="marker_3" value="" />
<div class="editor_window">
<div class="editor_title">{$component_info->title} ver. {$component_info->version} <a href="#" onclick="winopen('./?module=editor&amp;act=viewComponentInfo&amp;component_name={$component_info->component_name}','ComponentInfo','left=10,top=10,width=10,height=10,resizable=no,scrollbars=no,toolbars=no');return false;"><img src="../../../tpl/images/about_component.gif" title="{$lang->about_component}" alt="{$lang->about_component}" class="about_component_icon" border="0" /></a></div>

View file

@ -34,6 +34,9 @@ function insertNaverMap(obj) {
var x = xGetElementById("map_x").value;
var y = xGetElementById("map_y").value;
var marker_1 = xGetElementById("marker_1").value;
var marker_2 = xGetElementById("marker_2").value;
var marker_3 = xGetElementById("marker_3").value;
var address = xGetElementById("address").value;
var width = xGetElementById("map_width").value;
@ -42,7 +45,7 @@ function insertNaverMap(obj) {
var height = xGetElementById("map_height").value;
if(!height) height= 480;
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>";
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;\" marker_1=\""+marker_1+"\" marker_2=\""+marker_2+"\" marker_3=\""+marker_3+"\"></div>";
opener.editorFocus(opener.editorPrevSrl);
@ -99,3 +102,12 @@ function complete_search_address(ret_obj, response_tags, selected_address) {
var list_zone = xGetElementById("address_list");
xInnerHtml(list_zone, html);
}
/* 마커 표시 */
var marker_count = 1;
function addMarker(pos) {
if(marker_count>4) return;
xGetElementById("marker_"+marker_count).value = pos;
marker_count++;
return true;
}