DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:google_maps

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:google_maps [2009-10-07 18:39] – tag cleanup layneeplugin:google_maps [2019-04-22 09:45] (current) – [Bugs and ToDo] hua
Line 6: Line 6:
 email      : dma_k@mail.ru email      : dma_k@mail.ru
 type       : syntax type       : syntax
-lastupdate : 2008-04-12 +lastupdate : 2010-10-18 
-compatible : 2008-05-05, 2006-11-06+compatible : 2009-12-25c, 2008-05-05, 2006-11-06, 2016-06-26a
 depends    :  depends    : 
 conflicts  conflicts 
 similar    : googlemaps similar    : googlemaps
 tags       : media, maps, google, embed tags       : media, maps, google, embed
 +
 +downloadurl: https://www.centurion.link/w/_media/plugin/google-2016-09-20.tar.bz2
 ---- ----
 +
  
 ===== Download and Installation ===== ===== Download and Installation =====
  
-Download and install the plugin using the [[plugin:plugin|Plugin Manager]] using the [[http://centurion.dynalias.com/w/_media/plugin/google_maps-2008-10-03.tar.bz2|following URL]]. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-The up-to-date version of the plugin and this description is [[http://centurion.dynalias.com/plugin/google_maps|here]].+[[https://www.centurion.link/w/plugin/google_maps|Up-to-date version of the plugin and this description]].
  
  
Line 29: Line 32:
 ===== Syntax ===== ===== Syntax =====
  
-Complete list:+Complete list of all possible options:
  
-''%%{{googlemaps>address[zoom=16,size=small,control=hierarchical,overviewmap=true,width=800,height=600,type=internal]|alternate text}}%%''+''%%{{googlemaps>address1;address2;address3[zoom=16,width=800,height=600,size=small,control=hierarchical,overviewmap=true,type=embedded]|alternative text}}%%''
  
-where:+Google maps plugin can generate google maps in embedded frame (when **type=embedded**) or as link to google maps (when **type** is not set //(default)//).
  
-| **zoom**,**size**,**control**,**overviewmap** | see in [[#default_parameters|section below]] | +Alternative text may include any other inline formatting supported by dokuwikiand is rendered only for **default type** (if one specify alternative text then this type is forcedas there is no opportunity to render it in **embedded** mode). If **alternative text** is skipped then **address** is used as a link text.
-**type** | **internal** -- show google maps in embedded frame \\ //(default)// -- generate link to google maps |+
  
-If **alternate text** is skipped then **address** is used.+**embedded type** supports several addresses to be marked on Google Maps (only first address will be used in **default type**). It is advised not to specify **zoom** in this case, which will be set automatically to optimal value to display all address markers on the map. 
 + 
 + 
 +==== Parameters ==== 
 + 
 +^  Parameter name ^  Possible valid values ^ 
 +**zoom** | number from 1 to 19 which specifies the initial zoom; if not defined, then it is set to optimal value | 
 +| **width** | size in px -- the width of embedded frame (overrides the default parameter value) | 
 +| **height** | size in px -- the height of embedded frame (overrides the default parameter value) | 
 +| **size** | **small** //(default)// -- generate small size window with limited set of controls \\ **large** -- generate large size window with all controls \\ The sizes for the frames are taken from **%%small_*%%** and **%%large_*%%** parameters below.
 +| **control** | **hierarchical** //(default)// -- show two buttons in top-right corner: "Map" and "Satellite" \\ **all** -- show three buttons: "Map", "Satellite" and "Hybrid" \\ **none** -- show no buttons | 
 +| **overviewmap** | **true** //(default)// -- show the link to overview map in right-bottom corner \\ **false** -- do not show overview map | 
 +| **type** | **unset** //(default)// -- render the link to google maps \\ **embedded** -- render embedded frame with google maps |
  
  
-==== Default parameters ====+==== Default options ====
  
 ^  Parameter name ^  Possible valid values ^ ^  Parameter name ^  Possible valid values ^
-| **google_api_key** | Valid Google API key for the current site. See [[#configuration|below]] for more details about how to generate it. +| **google_api_key** | Valid Google API key for the current site. See [[#configuration]] for more details about how to generate it.
-| **size** | **small** //(default)// -- generate small size window \\ **large** -- generate large size window \\ The sizes for the frames are taken from **%%small_*%%** and **%%large_*%%** parameters below. | +| **small_width** | //(default is **425**)// size in px -- the width of small frame, if **size=small** was specified
-| **control** | **hierarchical** //(default)// -- show two buttons in top-right corner: "Map" and "Satellite" \\ **default** -- show three buttons: "Map", "Satellite" and "Hybrid" \\ **none** -- show no buttons | +| **small_height** | //(default is **350**)// size in px -- the height of small frame, if **size=small** was specified
-| **overviewmap** | **true** //(default)// -- show the link to overview map in right-bottom corner \\ **false** -- do not show overview map +| **large_width** | //(default is **550**)// size in px -- the width of large frame, if **size=large** was specified
-| **small_width** | //(default is **425**)// size in px -- the width of small frame, if **size=small** was specified | +| **large_height** | //(default is **450**)// size in px -- the height of large frame, if **size=large** was specified |
-| **small_height** | //(default is **350**)// size in px -- the height of small frame, if **size=small** was specified | +
-| **large_width** | //(default is **550**)// size in px -- the width of large frame, if **size=large** was specified | +
-| **large_height** | //(default is **450**)// size in px -- the height of large frame, if **size=large** was specified +
-| **zoom** | //(default is **15**)// number from 1 to 19 which specifies the initial zoom |+
  
  
 ===== Demonstration ===== ===== Demonstration =====
  
-See [[http://centurion.dynalias.com/wiki/playground|here]].+[[https://www.centurion.link/w/wiki/playground|Try the plugin]].
  
  
Line 63: Line 73:
  
 Important is to register your site at Google to receive an access to Google services. Registration is free: Important is to register your site at Google to receive an access to Google services. Registration is free:
-  * Register your website [[http://code.google.com/apis/maps/signup.html|here]] and receive you unique Google API key.+  * [[http://code.google.com/apis/maps/signup.html|Register your website]] and receive you unique Google API key.
   * Modify the configuration file and put a newly generated key to **google_api_key**.   * Modify the configuration file and put a newly generated key to **google_api_key**.
  
Line 81: Line 91:
 ===== Source ===== ===== Source =====
  
- +==== syntax/maps.php ====
-==== syntax.php ====+
  
 <code php> <code php>
 <?php <?php
 /** /**
- * Plugin google_map: Generates external or internal link to Google Maps.+ * Plugin google_maps: Generates embedded Google Maps frame or link to Google Maps.
    
- * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)+ * @license    GPLv2 (http://www.gnu.org/licenses/gpl.html)
  * @author     Dmitry Katsubo <dma_k@mail.ru>  * @author     Dmitry Katsubo <dma_k@mail.ru>
  */  */
  
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');+if(!defined('DOKU_INC')) die();
 if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
 require_once(DOKU_PLUGIN.'syntax.php'); require_once(DOKU_PLUGIN.'syntax.php');
Line 103: Line 112:
 class syntax_plugin_google_maps extends DokuWiki_Syntax_Plugin class syntax_plugin_google_maps extends DokuWiki_Syntax_Plugin
 { {
-  private $config; +  private $RE_NON_SYNTAX_SEQ = '[^\[\]{}|]+'; 
-  private $re_non_syntax_seq = '[^\[\]{}|]+'; +  private $RE_PLUGIN_BODY
-  private $re_plugin_body+
-  +
   function syntax_plugin_google_maps()   function syntax_plugin_google_maps()
   {   {
-    $this->config confToHash(DOKU_PLUGIN . 'google_maps/syntax.conf'); +    $this->RE_PLUGIN_BODY = $this->RE_NON_SYNTAX_SEQ . '(?:\\[' . $this->RE_NON_SYNTAX_SEQ . '\\])?';
- +
-    $this->re_plugin_body = "{$this->re_non_syntax_seq}(?:\\[{$this->re_non_syntax_seq}\\])?";+
   }   }
  
Line 117: Line 123:
   {   {
     return array(     return array(
-      'author1 => 'Dmitry Katsubo', +      'author => 'Dmitry Katsubo', 
-      'email1 => 'dma_k@mail.ru', +      'email   => 'dma_k@mail.ru', 
-      'date'    => '2008-04-12',+      'date'    => '2016-09-20',
       'name'    => 'Google Maps Plugin',       'name'    => 'Google Maps Plugin',
       'desc'    => 'Adds a Google Maps frame        'desc'    => 'Adds a Google Maps frame 
-         syntax: {{googlemaps>address[zoom=16,size=small,control=hierarchical,overviewmap=true,width=800,height=600,type=internal]|alternate text}}',+         syntax: {{googlemaps>address1;address2;address3[zoom=16,size=small,control=hierarchical,overviewmap=true,width=800,height=600,type=embedded]|alternative text}}',
       'url'    => 'http://centurion.dynalias.com/wiki/plugin/google_maps',       'url'    => 'http://centurion.dynalias.com/wiki/plugin/google_maps',
     );     );
   }   }
  
-    function getAllowedTypes() +  function getAllowedTypes() 
-    +  
-      return array('formatting'); +    return array('formatting'); 
-    +  
-     + 
-    function getType() +  function getType() 
-    +  
-      return 'substition'; +    return 'substition'; 
-    +  
-    +
   function getSort()   function getSort()
   {   {
Line 144: Line 150:
   function connectTo($mode)   function connectTo($mode)
   {   {
-    $this->Lexer->addSpecialPattern("{{googlemaps>{$this->re_plugin_body}}}", $mode, 'plugin_google_maps');  +    $this->Lexer->addSpecialPattern('{{googlemaps>' . $this->RE_PLUGIN_BODY . '}}', $mode, 'plugin_google_maps');  
-    $this->Lexer->addEntryPattern("{{googlemaps>{$this->re_plugin_body}\|(?={$this->re_non_syntax_seq}}})", $mode, 'plugin_google_maps');+    $this->Lexer->addEntryPattern('{{googlemaps>' . $this->RE_PLUGIN_BODY . '\|(?=' . $this->RE_NON_SYNTAX_SEQ . '}})', $mode, 'plugin_google_maps');
   }   }
  
   function postConnect()   function postConnect()
   {   {
-    $this->Lexer->addExitPattern("}}", 'plugin_google_maps');+    $this->Lexer->addExitPattern('}}', 'plugin_google_maps');
   }   }
  
Line 158: Line 164:
     return(htmlspecialchars(     return(htmlspecialchars(
       isset($options[$option_name]) ?       isset($options[$option_name]) ?
-      $options[$option_name] : +        $options[$option_name] : 
-      $this->config[$config_prefix . $option_name]+        $this->getConf($config_prefix . $option_name)
     ));     ));
   }   }
  
-  function handle($match, $state, $pos, &$handler)+  function handle($match, $state, $pos, Doku_Handler $handler)
   {   {
     switch ($state)     switch ($state)
Line 171: Line 177:
         $matches = array();         $matches = array();
  
-        if (!preg_match("/{{googlemaps>({$this->re_non_syntax_seq})(?:\\[({$this->re_non_syntax_seq})\\])?/", $match, $matches))+        if (!preg_match('/{{googlemaps>(' . $this->RE_NON_SYNTAX_SEQ . ')(?:\\[(' . $this->RE_NON_SYNTAX_SEQ . ')\\])?/', $match, $matches))
         {         {
-          // syslog(LOG_DEBUG, "Input $match cannot be matched against /{{googlemaps>{$this->re_plugin_body}"); 
           return array('');  // this is an error           return array('');  // this is an error
         }         }
Line 181: Line 186:
         if (isset($matches[2]))         if (isset($matches[2]))
         {         {
-          preg_replace('/\s+/', '', $matches[2]); 
           $entries = explode(',', $matches[2]);           $entries = explode(',', $matches[2]);
  
Line 188: Line 192:
             $key_value = explode('=', $entry);             $key_value = explode('=', $entry);
  
-            $options[$key_value[0]] = $key_value[1];+            $options[trim($key_value[0])] = trim($key_value[1]);
           }           }
         }         }
Line 198: Line 202:
   }   }
  
-  function render($mode, &$renderer, $data)+  function render($mode, Doku_Renderer $renderer, $data)
   {   {
     if ($mode == 'xhtml')     if ($mode == 'xhtml')
Line 210: Line 214:
           list($text, $options) = $match;           list($text, $options) = $match;
  
-          $query htmlspecialchars(html_entity_decode(trim($text)));+          // All locations are in this array: 
 +          $locations array(); 
 +          $i = 0; 
 + 
 +          foreach (explode(";", $text) as $q) 
 +          { 
 +            $q = trim($q); 
 +            if (strlen($q)) 
 +            { 
 +              $locations[$i++] = htmlspecialchars(html_entity_decode($q)); 
 +            } 
 +          }
  
           // This type is available only in DOKU_LEXER_SPECIAL state:           // This type is available only in DOKU_LEXER_SPECIAL state:
-          if ($state == DOKU_LEXER_SPECIAL && $options['type'] == 'internal')+          if ($state == DOKU_LEXER_SPECIAL && $options['type'] == 'embedded')
           {           {
-            // Injection of this script causes FF to hangso we have to generate it for each map: +            // Dynamic injection of this script via JS causes FF to hangso we have to include it for each map: 
-            $renderer->doc .= "\n<script type='text/javascript' src='http://maps.google.com/maps?file=api&v=2.x&key=" . $this->config['google_api_key'. "'></script>";+            $renderer->doc .= "\n<script type='text/javascript' src='//maps.google.com/maps?file=api&v=2.x&key=" . $this->getConf('google_api_key'. "'></script>";
  
             // Default values:             // Default values:
Line 223: Line 238:
             $height     = $this->getConfigValue($options, 'height', $size . '_') . "px";             $height     = $this->getConfigValue($options, 'height', $size . '_') . "px";
  
-            // Internal div: +            // Embedded div: 
-            $renderer->doc .= "\n<div class='gmapsint' style='width: $width; height: $height' query='$query' ";+            $renderer->doc .= "\n<div class='gmaps_frame' style='width: $width; height: $height'"; 
 + 
 +            foreach ($locations as $i => $q) 
 +            { 
 +              $renderer->doc .= " location$i='$q'"; 
 +            }
  
             // Copy values into attributes:             // Copy values into attributes:
             foreach (array('size', 'control', 'overviewmap', 'zoom') as $attr_name)             foreach (array('size', 'control', 'overviewmap', 'zoom') as $attr_name)
             {             {
-              $renderer->doc ." $attr_name='"$this->getConfigValue($options, $attr_name) . "'";+              $attr_value = $this->getConfigValue($options, $attr_name)
 + 
 +              if (strlen($attr_value)) 
 +              { 
 +                $renderer->doc .= ' ' . $attr_name . '="' . $attr_value . '"'; 
 +              }
             }             }
  
             // Important to leave one hanging node inside <div>, otherwise maps start overlappig.             // Important to leave one hanging node inside <div>, otherwise maps start overlappig.
-            // That is done implicitly here. 
             $renderer->doc .= '></div>';             $renderer->doc .= '></div>';
  
Line 239: Line 263:
           }           }
  
-          if ($options['type'!= 'internal')+          // If we are here it means: 
 +          // * state == DOKU_LEXER_SPECIAL and type != embedded ==> we render a link with a text equal to address, as there is no alternative text in this state 
 +          // * state == DOKU_LEXER_ENTER   and type != embedded ==> we start rendering a link; the alternative text will be rendered by dokuwiki renderer and may include any formatting 
 +          // * state == DOKU_LEXER_ENTER   and type == embedded ==> the is unsupported combination, but we render a link the same as with type != embedded 
 + 
 +          // Concat params: 
 +          $params = '&'; 
 +          // If not defined, Google Maps engine will automatically select the best zoom: 
 +          if ($options['zoom'])
           {           {
-            // Concat params: +            $params .= "z=" . $options['zoom']; 
-            $params = '&'; +          }
-            // If not defined, Google Maps engine will automatically select the best zoom: +
-            if ($options['zoom']) +
-            { +
-              $params .= "z=" . $options['zoom']; +
-            }+
  
-            // Query is already escaped, params are taken from options: +          // Query is already escaped, params are taken from options: 
-            $url = "http://maps.google.com/maps?q=$query$params";+          $url = "//maps.google.com/maps?q=$locations[0]$params";
  
-            // External link: +          // External link: 
-            $renderer->doc .= "<a href='$url' class='gmapsext'>";+          $renderer->doc .= "<a href='$url' class='gmaps_link'>";
  
-            if ($state == DOKU_LEXER_SPECIAL) +          if ($state == DOKU_LEXER_SPECIAL) 
-            +          
-               $renderer->doc .= "$text</a>"+             $renderer->doc .= "$text</a>";
-            } +
- +
-            return true;+
           }           }
  
-          return false;+          return true;
  
         case DOKU_LEXER_UNMATCHED:         case DOKU_LEXER_UNMATCHED:
Line 288: Line 312:
  
 <code javascript> <code javascript>
-var max_geo_results = 5;+/** 
 + * Plugin google_maps: Generates embedded Google Maps frame or link to Google Maps. 
 + * 
 + * @license    GPLv2 (http://www.gnu.org/licenses/gpl.html) 
 + * @author     Dmitry Katsubo <dma_k@mail.ru> 
 + */
  
 +(function() {
 +// Globals:
 +var GMAPS_MAX_RETRY_COUNT = 5;
 +var GMAPS_RETRY_DELAY = 100;
 +var GMAPS_MAX_GEO_RESULTS = 1;
 +var GMAPS_GEOCODER = null;
 +
 +/*
 + * This function creates a new marker with a given HTML shown when a marker is clicked.
 + */
 function createMarker(point, desc) function createMarker(point, desc)
 { {
Line 295: Line 334:
  
   // Note: Without wrapping into a function, listeners are added to the same objects!   // Note: Without wrapping into a function, listeners are added to the same objects!
-  GEvent.addListener(marker, "click", function() {+  GEvent.addListener(marker, "click", function() 
 +  {
     marker.openInfoWindowHtml(desc);     marker.openInfoWindowHtml(desc);
   });   });
Line 302: Line 342:
 } }
  
-function queryGoogleGeo(map, query, zoom)+/* 
 + * This recursive function sends an ansynchronous query to Google GeoCoder and marks results on the map. 
 + */ 
 +function queryGoogleGeo(map, bounds, locations, index, zoom, retry)
 { {
-  var geocoder = new GClientGeocoder();+  if (GMAPS_GEOCODER == null) 
 +  { 
 +    // Can be initialized only at this point, as Google libraries should have been included: 
 +    GMAPS_GEOCODER = new GClientGeocoder(); 
 +  }
  
-  geocoder.getLocations(query,+  GMAPS_GEOCODER.getLocations(locations[index],
     function generateMarkersFromGoogleGeoResult(response)     function generateMarkersFromGoogleGeoResult(response)
     {     {
       // Was not able to locate any data:       // Was not able to locate any data:
-      if (response == null || response.Status.code != 200) { +      if (response == null
-        alert("Sorry, we were unable to locate " + query + " address");+      { 
 +        alert("No response from GeoCoder for location " + locations[index] + ". Giving up."); 
 +        return; 
 +      } 
 +      else if (response.Status.code == 602) 
 +      { 
 +        if (retry++ >= GMAPS_MAX_RETRY_COUNT) 
 +        { 
 +          alert("The maximum amount of retries (" + GMAPS_MAX_RETRY_COUNT + ") has been reached for location " + locations[index] + ". Giving up."); 
 +          return; 
 +        } 
 + 
 +        setTimeout(queryGoogleGeo, GMAPS_RETRY_DELAY, map, bounds, locations, index, zoom, retry); 
 +        return; 
 +      } 
 +      else if (response.Status.code != 200) 
 +      
 +        alert("Invalid response code (" + response.Status.code + ") from GeoCoder for location " + locations[index] + ". Giving up.");
         return;         return;
       }       }
Line 317: Line 381:
       var places = response.Placemark;       var places = response.Placemark;
  
-      for (var i = 0; i < places.length && i < max_geo_results; i++) {+      for (var i = 0; i < places.length && i < GMAPS_MAX_GEO_RESULTS; i++) 
 +      {
         var place = places[i];         var place = places[i];
         var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);         var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
  
-        if (i == 0) { +        bounds.extend(point);
-          map.setCenter(point, zoom); +
-        }+
  
-        map.addOverlay(createMarker(point, '<div class="gmapsmarker"><strong>' + place.address + '</strong><br/>'+        map.addOverlay(createMarker(point, '<div class="gmaps_marker"><strong>' + place.address + '</strong><br/>'
           + place.AddressDetails.Country.CountryNameCode           + place.AddressDetails.Country.CountryNameCode
         ));         ));
 +      }
 +
 +      if (index == locations.length - 1)
 +      {
 +        if (zoom == null)
 +        {
 +          if (!bounds.isEmpty())
 +          {
 +            // We select the best zoom for the boundary:
 +            zoom = map.getBoundsZoomLevel(bounds);
 +          }
 +        }
 +        else
 +        {
 +          // zoom is required to be an integer:
 +          zoom = parseInt(zoom);
 +        }
 +
 +        map.setCenter(bounds.getCenter(), zoom);
 +      }
 +      else
 +      {
 +        // Query recuresively other locations:
 +        queryGoogleGeo(map, bounds, locations, index + 1, zoom, retry);
       }       }
     });     });
Line 337: Line 424:
 function loadMaps() function loadMaps()
 { {
-  var headNode = document.getElementsByTagName("head").item(0); +  jQuery('div.gmaps_frame').each(function() { 
-  var divNodes document.body.getElementsByTagName('div');+    var attrs this.attributes;
  
-  for (var 0i < divNodes.length; i++) { +    // Create a map: 
-    if (divNodes[i].className.match(/\bgmapsint\b/)) +    var map new GMap2(this)
-      var attrs = divNodes[i].attributes;+    map.setCenter(new GLatLng(34, 0), 1); // default point
  
-      // Create a map: +    // left-top navigator and zoomer 
-      var map new GMap2(divNodes[i]); +    if (attrs.size.value == 'small') 
-      map.setCenter(new GLatLng(34, 0), 1); // default point+      map.addControl(new GSmallMapControl()); 
 +    else if (attrs.size.value == 'large') 
 +      map.addControl(new GLargeMapControl());
  
-      // left-top navigator and zoomer +    // right-top map type switch buttons 
-      if (attrs.size.value == 'small') +    if (attrs.control.value == 'hierarchical') 
-        map.addControl(new GSmallMapControl()); +      map.addControl(new GHierarchicalMapTypeControl()); 
-      else +    else if (attrs.control.value == 'all') 
-      if (attrs.size.value == 'large') +      map.addControl(new GMapTypeControl());
-        map.addControl(new GLargeMapControl());+
  
-      // right-top map type switch buttons +    // mini-map in the bottom-right corner 
-      if (attrs.control.value == 'hierarchical') +    if (attrs.overviewmap.value == 'true') 
-        map.addControl(new GHierarchicalMapTypeControl()); +    { 
-      else +      var overviewMap = new GOverviewMapControl(); 
-      if (attrs.control.value == 'default'+      map.addControl(overviewMap); 
-        map.addControl(new GMapTypeControl());+      overviewMap.hide(); 
 +    }
  
-      // mini-map in the bottom-right corner +    map.enableScrollWheelZoom();
-      if (attrs.overviewmap.value == 'true') { +
-        var overviewMap = new GOverviewMapControl(); +
-        map.addControl(overviewMap); +
-        overviewMap.hide(); +
-      }+
  
-      map.enableScrollWheelZoom();+    var locations = new Array();
  
-      var query attrs.query.value+    var 0; 
-      var zoom = parseInt(attrs.zoom.value);+    while (true) 
 +    { 
 +      if (attrs['location' + n] == null) 
 +      { 
 +        break; 
 +      }
  
-      //queryGeonames(map, query, zoom)+      locations[n] = attrs['location' + n].value
-      queryGoogleGeo(map, query, zoom);+      n++;
     }     }
-  }+ 
 +    queryGoogleGeo(map, new GLatLngBounds(), locations, 0, attrs.zoom == null ? null : attrs.zoom.value, 0); 
 +  });
 } }
  
 // A special Wiki-wide function, defined in lib/scripts/events.js: // A special Wiki-wide function, defined in lib/scripts/events.js:
-addInitEvent(loadMaps); +jQuery(loadMaps); 
-</code>+})();</code>
  
  
Line 388: Line 479:
  
 <code css> <code css>
-a.gmapsext +a.gmaps_link 
-  background: transparent url(gmaps_link.png) no-repeat left center;+  background: transparent url(gmaps_link.png) no-repeat left center; /* "top" does not look nicely in headers; "center" creates artifacts when link is split into several lines */
   padding: 1px 0px 1px 12px;   padding: 1px 0px 1px 12px;
 } }
  
-div.gmapsint {+div.gmaps_frame {
   border: 1px solid __border__;   border: 1px solid __border__;
 } }
  
-div.gmapsmarker {+div.gmaps_marker {
   font-size: 90%;   font-size: 90%;
 } }
 </code> </code>
 +
 +The latest source code can be taken from [[https://github.com/dmak/dokuwiki/tree/master/lib/plugins/google|Github]].
 +
 +
 +===== Release History =====
 +
 +  * 2008-03-17 (r05) --- Initial version.
 +  * [[https://www.centurion.link/w/_media/plugin/google_maps-2008-04-12.tar.bz2|2008-04-12]]
 +  * [[https://www.centurion.link/w/_media/plugin/google_maps-2008-10-03.tar.bz2|2008-10-03 (r47)]] --- Plugin was refactored to allow formatting in comment. Also aligned in compliance with common practices how to process the flow.
 +  * [[https://www.centurion.link/w/_media/plugin/google-2010-10-15.tar.bz2|2010-10-15 (r205)]] --- Three google-related plugins are merged into one bundle. Multiple addresses support was added.
 +  * [[https://www.centurion.link/w/_media/plugin/google-2016-09-20.tar.bz2|2016-09-20]] --- HTTPS fix. API adapted for "Elenor of Tsort" DokuWiki release.
 +
 +
 +===== Bugs and ToDo =====
 +
 +Tested with IE 6.0 SP1, FF 3.5.x. No bugs at the moment.
 +
 +There is nothing right now in my ToDo list. Please, add comment to this page.
 +
 +Question:\\
 +1. Google API key should be placed in \doku\lib\plugins\google_maps\conf\default.php ?\\
 +It doesn't work for me somehow
  
plugin/google_maps.1254933597.txt.gz · Last modified: 2009-10-07 18:39 by laynee

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki