Delete the mapMarker when clearing the Location text field
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 13 Feb 2010 15:24:13 +0000 (10:24 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 13 Feb 2010 15:24:13 +0000 (10:24 -0500)
kronolith/js/kronolith.js

index 191988a..c94a94e 100644 (file)
@@ -2511,6 +2511,7 @@ KronolithCore = {
                 $('kronolithEventMapLink').show();
             } else if (Kronolith.conf.maps.driver) {
                 $('kronolithEventMapLink').hide();
+                this.removeMapMarker();
             }
             return;
         }
@@ -3781,6 +3782,19 @@ KronolithCore = {
         }
     },
 
+    /**
+     * Remove the event marker from the map. Called after clearing the location
+     * field.
+     */
+    removeMapMarker: function()
+    {
+        if (this.mapMarker) {
+            this.map.removeMarker(this.mapMarker);
+            $('kronolithEventLocationLon').value = null;
+            $('kronolithEventLocationLat').value = null;
+        }
+    },
+
     ensureMap: function()
     {
         if (!this.mapInitialized) {