Changeset 7699

Show
Ignore:
Timestamp:
07/05/09 04:13:45 (8 months ago)
Author:
daybreaker
Message:

refs #1291: UI 정리, Geolocation 정보 가져오는 부분까지 구현

Location:
branches/1.8/plugins/GoogleMap
Files:
3 added
1 removed
4 modified
1 moved

Legend:

Unmodified
Added
Removed
  • branches/1.8/plugins/GoogleMap/common.css

    r6953 r7699  
    2828    color: #999; 
    2929} 
     30 
     31dl#toolbox-googlemap { 
     32    display: inline-block; 
     33    height: 22px; 
     34} 
     35 
     36dl#toolbox-googlemap dd.command-box { 
     37    float: left; 
     38    margin: 0; 
     39    padding: 0; 
     40    border-top: 1px solid #bbb; 
     41    border-bottom: 1px solid #bbb; 
     42    background: -webkit-gradient(linear, left 10, left bottom, from(#fff), to(#eee)); 
     43} 
     44dl#toolbox-googlemap dd.command-box:hover { 
     45    background: -webkit-gradient(linear, left 10, left bottom, from(#f2f2f2), to(#ddd)); 
     46} 
     47dl#toolbox-googlemap dd.command-box:active { 
     48    background: -webkit-gradient(linear, left 10, left bottom, to(#f2f2f2), from(#ddd)); 
     49} 
     50 
     51dl#toolbox-googlemap dd.command-box a.button { 
     52    display: block; 
     53    border-right: 1px solid #bbb; 
     54    padding: 0 6px 0 24px; 
     55    line-height: 22px; 
     56    background: transparent; 
     57    background-repeat: no-repeat !important; 
     58    background-position: 3px center !important; 
     59    color: black; 
     60    text-decoration: none; 
     61} 
     62 
     63dl#toolbox-googlemap dd.command-box:first-child a.button { 
     64    border-left: 1px solid #bbb; 
     65} 
     66 
     67dl#toolbox-googlemap dd.command-box a.button:hover { 
     68    text-decoration: none; 
     69} 
     70 
     71dl#toolbox-googlemap dd.command-box #gmap-insertMap { 
     72    background-image: url(./images/toolbox-map.png); 
     73} 
     74 
     75dl#toolbox-googlemap dd.command-box #gmap-getLocation { 
     76    background-image: url(./images/toolbox-location.png); 
     77} 
  • branches/1.8/plugins/GoogleMap/index.php

    r7617 r7699  
    4343function GoogleMap_AddToolbox($target) { 
    4444    global $pluginURL; 
    45     $target .= "<img src=\"$pluginURL/images/gmap_toolbar.gif\" border=\"0\" alt=\"구글맵 추가하기\" onclick=\"GMapTool_Insert();\" style=\"cursor:pointer\" />\n"; 
     45    $target .= "<dl id=\"toolbox-googlemap\">"; 
     46    $target .= "<dd class=\"command-box\"><a class=\"button\" id=\"gmap-insertMap\" href=\"#insertGoogleMap\" onclick=\"GMapTool_insertMap(); return false;\">구글맵 추가하기</a></dd>"; 
     47    $target .= "<dd class=\"command-box\"><a class=\"button\" href=\"#getLocation\" id=\"gmap-getLocation\" onclick=\"GMapTool_getLocation(); return false;\">현재 위치 알아내기</a></dd>"; 
     48    $target .= "</dl>"; 
    4649    return $target; 
    4750} 
     
    269272} 
    270273 
    271 function GoogleMapUI_Insert() { 
     274function GoogleMapUI_InsertMap() { 
    272275    global $configVal, $pluginURL; 
    273276    requireComponent('Textcube.Function.Misc'); 
     
    319322} 
    320323 
     324function GoogleMapUI_GetLocation() { 
     325    global $configVal, $pluginURL; 
     326    requireComponent('Textcube.Function.Misc'); 
     327    $config = Setting::fetchConfigVal($configVal); 
     328    $lat = $config['latitude']; 
     329    $lng = $config['longitude']; 
     330    $default_type = 'G_HYBRID_MAP'; 
     331    $default_width = 500; 
     332    $default_height = 400; 
     333    $zoom = 10; 
     334    _GMap_printHeaderForUI('현재 위치 알아내기', $config['apiKey']); 
     335?> 
     336    <h2>이용 안내</h2> 
     337    <p>웹브라우저가 제공하는 Geolocation 서비스를 이용하여 현재 위치 정보를 가져옵니다. 정확도는 사용하고 계신 기기나 지역에 따라 다를 수 있습니다. <a href="#help">(자세히 알아보기)</a></p> 
     338    <p><span id="availability"></span><span id="status"></span></p> 
     339    <h2>미리보기</h2> 
     340    <div style="text-align:center;"> 
     341        <div id="GoogleMapPreview" style="width:<?php echo $default_width;?>px; height:<?php echo $default_height;?>px; margin:0 auto;"></div> 
     342    </div> 
     343    <script type="text/javascript"> 
     344    //<![CDATA[ 
     345    function initializeMap() { 
     346        map = new GMap2($('#GoogleMapPreview')[0]); 
     347        map.addMapType(G_PHYSICAL_MAP); 
     348        map.setMapType(<?php echo $default_type;?>); 
     349        map.addControl(new GHierarchicalMapTypeControl()); 
     350        map.addControl(new GLargeMapControl()); 
     351        map.addControl(new GScaleControl()); 
     352        map.enableScrollWheelZoom(); 
     353        map.enableContinuousZoom(); 
     354        map.setCenter(new GLatLng(<?php echo $lat;?>, <?php echo $lng;?>), <?php echo $zoom;?>); 
     355    } 
     356    //]]> 
     357    </script> 
     358    <script type="text/javascript"> 
     359    //<![CDATA[ 
     360    $(document).ready(function() { 
     361        if (navigator.geolocation) { 
     362            $('#availability').html('현재 웹브라우저는 Geolocation 기능을 지원합니다. <button id="getLocation">위치 가져오기</button>') 
     363            $('#getLocation').click(function() { 
     364                $('#status').html('<img src="<?php echo $pluginURL; ?>/images/icon_loading.gif" style="vertical-align:middle" width="16" height="16" alt="가져오는 중..." />'); 
     365                navigator.geolocation.getCurrentPosition(function(pos) { 
     366                    map.setCenter(new GLatLng(pos.coords.latitude, pos.coords.longitude), 10); 
     367                    $('#status').html('가져오기 완료.'); 
     368                }, function(error) { 
     369                    alert('위치 정보를 가져오는 데 실패하였습니다. ('+error.code+', '+error.message+')'); 
     370                    $('#status').html('가져오기 실패.'); 
     371                }); 
     372            }); 
     373        } else { 
     374            $('#availability').html('현재 웹브라우저는 Geolocation 기능을 지원하지 않습니다.') 
     375        } 
     376    }); 
     377    //]]> 
     378    </script> 
     379<?php 
     380    _GMap_printFooterForUI(); 
     381} 
     382 
    321383function _GMap_printHeaderForUI($title, $api_key) { 
    322384    global $pluginURL, $blogURL, $service, $adminSkinSetting; 
     
    326388    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    327389    <title>Google Map Plugin: <?php echo $title;?></title> 
    328     <link rel="stylesheet" type="text/css" href="<?php echo $pluginURL;?>/insert.css" /> 
     390    <link rel="stylesheet" type="text/css" href="<?php echo $pluginURL;?>/popup.css" /> 
    329391    <script type="text/javascript" src="<?php echo $pluginURL;?>/scripts/jquery-1.2.6.min.js"></script> 
    330392    <script type="text/javascript" src="<?php echo $pluginURL;?>/scripts/jquery-ui-1.6rc2.js"></script> 
  • branches/1.8/plugins/GoogleMap/index.xml

    r7342 r7699  
    1515  </requirements> 
    1616  <binding> 
    17     <listener event="/plugin/GMapCustomInsert/">GoogleMapUI_Insert</listener> 
     17    <listener event="/plugin/GMapCustomInsert/">GoogleMapUI_InsertMap</listener> 
     18    <listener event="/plugin/GMapGetLocation/">GoogleMapUI_GetLocation</listener> 
    1819    <listener event="/plugin/GMapCache/">GoogleMap_Cache</listener> 
    1920    <listener event="ViewPostContent">GoogleMap_View</listener> 
  • branches/1.8/plugins/GoogleMap/popup.css

    r7617 r7699  
    3838    display: inline-block; 
    3939    margin: 2px; 
    40     padding: 1px 3px 2px 3px; 
     40    padding: 0 6px; 
     41    line-height: 20px; 
    4142    background: #f2f2f2; 
    42     border: 1px solid #69c; 
     43    background: -webkit-gradient(linear, left top, left bottom, from(#fafafa), to(#e4e4e4)); 
     44    border: 1px solid #bbb; 
    4345    border-radius: 3px; 
    4446    -moz-border-radius: 3px; 
     
    4749} 
    4850button:hover { 
    49     background-color: #cce8ff; 
     51    border-color: #999; 
     52    background: #D7E0EE; 
     53    background: -webkit-gradient(linear, left top, left bottom, from(#EFF2FB), to(#B5D5EC)); 
     54} 
     55button:active { 
     56    background: -webkit-gradient(linear, left top, left bottom, to(#C7DDF4), from(#A9C9F0)); 
    5057} 
    5158button.toggled { 
     59    border-color: #222; 
    5260    background-color: #555; 
     61    background: -webkit-gradient(linear, left top, left bottom, from(#444), to(#666)); 
    5362    color: white; 
    5463} 
    5564button.toggled:hover { 
    5665    background-color: #666; 
     66    background: -webkit-gradient(linear, left top, left bottom, from(#555), to(#777)); 
    5767} 
    5868 
     
    7282input, textarea { 
    7383    border: 1px solid #ccc; 
     84    padding: 1px; 
     85    line-height: 17px; 
     86    background: -webkit-gradient(linear, left top, 0 10, from(#eee), to(#fff)); 
     87    -webkit-background-origin: padding-box; 
     88    -webkit-background-clip: content-box; 
    7489    font-size: 0.9em; 
    7590} 
     
    107122    text-align: left; 
    108123} 
     124#status { 
     125    font-size: 8pt; 
     126    color: #555; 
     127} 
  • branches/1.8/plugins/GoogleMap/scripts/editor.js

    r7617 r7699  
    66} 
    77 
    8 function GMapTool_Insert() { 
     8function GMapTool_insertMap() { 
    99    window.open(blogURL + '/plugin/GMapCustomInsert/', 'GMapTool_Insert', 'menubar=no,toolbar=no,width=550,height=650,scrollbars=yes'); 
    1010} 
    1111 
     12function GMapTool_getLocation() { 
     13    window.open(blogURL + '/plugin/GMapGetLocation/', 'GMapTool_GetLocation', 'menubar=no,toolbar=no,width=550,height=650,scrollbars=no'); 
     14} 
     15 
    1216STD.addUnloadEventListener(function() { GUnload(); });