Author: ornicar2
Date: 2010-02-12 01:13:27 +0100 (Fri, 12 Feb 2010)
New Revision: 27933

Modified:
   plugins/dmGoogleMapPlugin/lib/view/html/dmGoogleMapTag.php
   plugins/dmGoogleMapPlugin/web/js/dmGoogleMap.js
   plugins/dmGoogleMapPlugin/web/js/launcher.js
Log:
[Diem][dmGoogleMapPlugin]
- now accepts decimal coords with ->coords() method
- fixed issue with launcher in admin application

Modified: plugins/dmGoogleMapPlugin/lib/view/html/dmGoogleMapTag.php
===================================================================
--- plugins/dmGoogleMapPlugin/lib/view/html/dmGoogleMapTag.php  2010-02-11 
23:07:28 UTC (rev 27932)
+++ plugins/dmGoogleMapPlugin/lib/view/html/dmGoogleMapTag.php  2010-02-12 
00:13:27 UTC (rev 27933)
@@ -23,7 +23,8 @@
   public function getDefaultOptions()
   {
     return array_merge(parent::getDefaultOptions(), array(
-      'address' => null
+      'address' => null,
+      'coords'  => null
     ));
   }
 
@@ -40,6 +41,11 @@
     return $this->setOption('address', (string) $location);
   }
 
+  public function coords($latitude, $longitude)
+  {
+    return $this->setOption('coords', array($latitude, $longitude));
+  }
+
   public function mapTypeId($mapType)
   {
     return $this->setOption('mapTypeId', (string) $mapType);
@@ -103,7 +109,7 @@
 
   protected function getJsonAttributes()
   {
-    return array('address', 'mapTypeId', 'zoom', 'navigationControl', 
'mapTypeControl', 'scaleControl');
+    return array('address', 'coords', 'mapTypeId', 'zoom', 
'navigationControl', 'mapTypeControl', 'scaleControl');
   }
 
   public function getJavascripts()

Modified: plugins/dmGoogleMapPlugin/web/js/dmGoogleMap.js
===================================================================
--- plugins/dmGoogleMapPlugin/web/js/dmGoogleMap.js     2010-02-11 23:07:28 UTC 
(rev 27932)
+++ plugins/dmGoogleMapPlugin/web/js/dmGoogleMap.js     2010-02-12 00:13:27 UTC 
(rev 27933)
@@ -15,32 +15,46 @@
       mapTypeId: google.maps.MapTypeId.HYBRID
     }, self.metadata(), opt || {}),
     map,
-    geocoder = new google.maps.Geocoder();
+    marker;
 
-    geocoder.geocode({ address: options.address }, function(results, status)
+    if(options.coords)
     {
-      found = false;
+      coords = new google.maps.LatLng(options.coords[0], options.coords[1]);
       
-      if (status == google.maps.GeocoderStatus.OK && results.length)
+      map = new google.maps.Map(self.get(0), $.extend(options, { center: 
coords }));
+      marker = new google.maps.Marker({
+        position: coords,
+        map: map
+      });
+    }
+    else if(options.address)
+    {
+      geocoder = new google.maps.Geocoder();
+      geocoder.geocode({ address: options.address }, function(results, status)
       {
-        if (status != google.maps.GeocoderStatus.ZERO_RESULTS)
+        found = false;
+
+        if (status == google.maps.GeocoderStatus.OK && results.length)
         {
-          var map = new google.maps.Map(self.get(0), $.extend(options, { 
center: results[0].geometry.location }));
+          if (status != google.maps.GeocoderStatus.ZERO_RESULTS)
+          {
+            map = new google.maps.Map(self.get(0), $.extend(options, { center: 
results[0].geometry.location }));
 
-          var marker = new google.maps.Marker({
-            position: results[0].geometry.location,
-            map: map
-          });
+            marker = new google.maps.Marker({
+              position: results[0].geometry.location,
+              map: map
+            });
 
-          found = true;
+            found = true;
+          }
         }
-      }
 
-      if(!found)
-      {
-        self.text('Sorry, the address "'+options.address+'" can not be found');
-      }
-    });
+        if(!found)
+        {
+          self.text('Sorry, the address "'+options.address+'" can not be 
found');
+        }
+      });
+    }
 
     return this;
   }

Modified: plugins/dmGoogleMapPlugin/web/js/launcher.js
===================================================================
--- plugins/dmGoogleMapPlugin/web/js/launcher.js        2010-02-11 23:07:28 UTC 
(rev 27932)
+++ plugins/dmGoogleMapPlugin/web/js/launcher.js        2010-02-12 00:13:27 UTC 
(rev 27933)
@@ -12,8 +12,10 @@
   });
 
   // admin
-  $('#dm_admin_content .dm_google_map').each(function() {
-    $(this).dmGoogleMap();
+  $(function() {
+    $('#dm_admin_content .dm_google_map').each(function() {
+      $(this).dmGoogleMap();
+    });
   });
   
 })(jQuery);
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to