Skip to content

Commit

Permalink
지도 저장 및 편집 기초 완성
Browse files Browse the repository at this point in the history
  • Loading branch information
misol committed Nov 1, 2014
1 parent 255c24f commit 21072ff
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 18 deletions.
14 changes: 13 additions & 1 deletion lang/lang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@
</item>
<item name="maps_module_maps_write">
<value xml:lang="ko"><![CDATA[지도 생성]]></value>
<value xml:lang="en"><![CDATA[Create Maps]]></value>
<value xml:lang="en"><![CDATA[Create Map]]></value>
</item>
<item name="maps_module_maps_edit">
<value xml:lang="ko"><![CDATA[지도 편집]]></value>
<value xml:lang="en"><![CDATA[Edit Map]]></value>
</item>
<item name="maps_module_maps_setting">
<value xml:lang="ko"><![CDATA[지도 모듈 설정]]></value>
<value xml:lang="en"><![CDATA[Maps Module Settings]]></value>
</item>
<item name="maps_module_maps_srl">
<value xml:lang="ko"><![CDATA[일련번호]]></value>
<value xml:lang="en"><![CDATA[Serial no.]]></value>
</item>
<item name="maps_module_maps_title">
<value xml:lang="ko"><![CDATA[제목]]></value>
<value xml:lang="en"><![CDATA[Title]]></value>
</item>
<item name="maps_module_untitled">
<value xml:lang="ko">제목 없는 지도</value>
<value xml:lang="en">Untitled map</value>
Expand Down
26 changes: 25 additions & 1 deletion maps.admin.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,28 @@ public function dispMapsAdminWrite()
$oMapsModel = getModel('maps');
$maps_config = $oMapsModel->getMapsConfig();

Context::get('maps_srl');
$args = new stdClass();
$args->maps_srl = intval(Context::get('maps_srl'));

// 정수형이고, 값이 존재할 경우 실제 존재하는 지도인지 확인(업데이트 날짜가 존재하는지 확인)
if($args->maps_srl > 0)
{
$output = executeQuery('maps.getMapUpdate', $args);
}

// 존재하는 지도일 경우, 지도 데이터 가져옴
if($output->data->update)
{
$output = executeQuery('maps.getMapbySrl', $args);

$maps_content = unserialize(base64_decode($output->data->maps_content));

Context::set('map_title',$output->data->title);
Context::set('map_content',$output->data->content);
Context::set('map_center',$maps_content->map_center);
Context::set('map_markers',$maps_content->map_markers);
Context::set('map_zoom',$maps_content->map_zoom);
}

// 다음과 네이버는 국내 지도만 사용가능. 구글은 세계지도.
if($maps_config->maps_api_type == 'daum')
Expand Down Expand Up @@ -122,6 +143,9 @@ public function dispMapsAdminWrite()

public function dispMapsAdminConfig()
{
$oMapsModel = getModel('maps');
$maps_config = $oMapsModel->getMapsConfig();

// Specify a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('maps_config');
Expand Down
18 changes: 18 additions & 0 deletions queries/getMapbySrl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<query id="getMapbySrl" action="select">
<tables>
<table name="maps_contents" />
</tables>
<columns>
<column name="maps_srl" />
<column name="member_srl" />
<column name="maps_content" />
<column name="title" />
<column name="content" />
<column name="ipaddress" />
<column name="regdate" />
<column name="update" />
</columns>
<conditions>
<condition operation="equal" column="maps_srl" var="maps_srl" filter="number" notnull="notnull" />
</conditions>
</query>
6 changes: 3 additions & 3 deletions tpl/common/header_tabs.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ul class="x_nav x_nav-tabs">
<li class="x_active"|cond="$act == 'dispMapsAdminList'" ><a href="{getUrl('act', 'dispMapsAdminList')}">{$lang->maps_module_maps_list}</a></li>
<li class="x_active"|cond="$act == 'dispMapsAdminWrite' && !intval($maps_srl)" ><a href="{getUrl('act', 'dispMapsAdminWrite')}">{$lang->maps_module_maps_write}</a></li>
<li class="x_active"|cond="$act == 'dispMapsAdminConfig'" ><a href="{getUrl('act', 'dispMapsAdminConfig')}">{$lang->maps_module_maps_setting}</a></li>
<li class="x_active"|cond="$act == 'dispMapsAdminList'" ><a href="{getUrl('act', 'dispMapsAdminList', 'maps_srl', '', 'page', '')}">{$lang->maps_module_maps_list}</a></li>
<li class="x_active"|cond="$act == 'dispMapsAdminWrite' && !intval($maps_srl)" ><a href="{getUrl('act', 'dispMapsAdminWrite', 'maps_srl', '', 'page', '')}">{$lang->maps_module_maps_write}</a></li>
<li class="x_active"|cond="$act == 'dispMapsAdminConfig'" ><a href="{getUrl('act', 'dispMapsAdminConfig', 'maps_srl', '', 'page', '')}">{$lang->maps_module_maps_setting}</a></li>
</ul>
17 changes: 16 additions & 1 deletion tpl/js/google_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,22 @@ function getMaps() {
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOption);

center = new google.maps.LatLng(defaultlat, defaultlng);
if(saved_maps_srl > 0)
{
var center_split = saved_map_center.split(',');
center = new google.maps.LatLng(center_split[0], center_split[1]);

var markers_split = saved_map_markers.split(';');
map_marker_positions = saved_map_markers.trim();
marker = addMarker(0);

map_zoom = parseInt(saved_map_zoom,10);
}
else
{
center = new google.maps.LatLng(defaultlat, defaultlng);

}
map.setCenter(center);
var center = map.getCenter();

Expand Down
26 changes: 18 additions & 8 deletions tpl/maps_list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
<include target="./common/header.html" />
<include target="./common/header_tabs.html" />
<!--// load target="./common/css/css.css" / -->
<ol class="maps_list">
<li loop="$maps_list => $no, $map_item">
<ul>
<li class="maps_no">{$no}</li>
<li class="maps_title"><!--@if(trim($map_item->title))-->{htmlspecialchars($map_item->title)}<!--@else--><em>{$lang->maps_module_untitled}</em><!--@end-->"</li>
</ul>
</li>
</ol>
<table class="maps_list x_table x_table-striped x_table-hover">
<thead>
<tr class="maps_list_header">
<th scope="col" class="nowr">{$lang->maps_module_maps_srl}</th>
<th scope="col" class="title">{$lang->maps_module_maps_title}</th>
<th scope="col" class="nowr">{$lang->cmd_setup}</th>
</tr>
</thead>
<tbody>
<tr class="maps_list_items" loop="$maps_list => $no, $map_item">
<td scope="row" class="maps_no nowr">{$map_item->maps_srl}</td>
<td class="maps_title title"><a href="{getUrl('act','dispMapsAdminWrite','maps_srl',$map_item->maps_srl)}"><!--@if(trim($map_item->title))-->{htmlspecialchars($map_item->title)}<!--@else--><em>{$lang->maps_module_untitled}</em><!--@end--></a></td>
<td class="nowr"><a href="{getUrl('act','dispMapsAdminWrite','maps_srl',$map_item->maps_srl)}">{$lang->cmd_edit}</a> | {$lang->cmd_delete}</td>
</tr>
</tbody>
</table>


<ul class="maps_pagination">
<li class="x_disabled"|cond="!$page || $page == 1"><a href="{getUrl('page', '')}">&laquo; {$lang->first_page}</a></li>
<!--@while($page_no = $page_navigation->getNextPage())-->
Expand Down
14 changes: 10 additions & 4 deletions tpl/maps_write.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
<!--@else-->
<load target="./js/google_map.js" />
<!--@end-->
{@Context::addHtmlHeader('<script>var no_result="'.$lang->msg_no_result.'", maps_saved="'.$lang->maps_saved.'";</script>');}
{@Context::addHtmlHeader('<script>var no_result="'.$lang->msg_no_result.
'", maps_saved="'.$lang->maps_saved.
'", saved_maps_srl="'.$maps_srl.
'", saved_map_center="'.$map_center.
'", saved_map_markers="'.$map_markers.
'", saved_map_zoom="'.$map_zoom.
'";</script>');}
<div id="bodyDiv">
<h1 id="maps_title">{$lang->maps_module_maps_write}</h1>
<h1 id="maps_title"><!--@if(!$maps_srl)-->{$lang->maps_module_maps_write}<!--@else-->{$lang->maps_module_maps_edit}<!--@end--></h1>
<div id="controlArea">
<div id="searchArea">
<ul>
Expand All @@ -29,8 +35,8 @@ <h1 id="maps_title">{$lang->maps_module_maps_write}</h1>
<div id="map_canvas"></div>
<input type="hidden" id="maps_srl" value="" />
<div id="text_writing">
<input type="text" name="map_title" placeholder="{$lang->maps_module_untitled}" id="map_title" value="" style="font-size:14px;width:95%!important" />
<textarea id="map_description" name="map_description" placeholder="{$lang->maps_module_no_description}" style="font-size:14px;width:95%!important;height:57px;"></textarea>
<input type="text" name="map_title" placeholder="{$lang->maps_module_untitled}" id="map_title" value="{htmlspecialchars($map_title)}" style="font-size:14px;width:95%!important" />
<textarea id="map_description" name="map_description" placeholder="{$lang->maps_module_no_description}" style="font-size:14px;width:95%!important;height:57px;">{htmlspecialchars($map_content)}</textarea>
<div>
<a id="insertAction" href="#" onclick="saveMap();return false;"><span>{$lang->maps_module_cmd_save_map}</span></a>
</div>
Expand Down

0 comments on commit 21072ff

Please sign in to comment.