Skip to content

Commit

Permalink
Applied initial patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Apr 27, 2010
1 parent 7b8e6a8 commit a22527d
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 8 deletions.
Empty file modified LICENSE 100644 → 100755
Empty file.
Empty file modified README.markdown 100644 → 100755
Empty file.
Empty file modified config/dm/assets.yml 100644 → 100755
Empty file.
Empty file modified config/dm/services.yml 100644 → 100755
Empty file.
Empty file modified config/dm/widget_types.yml 100644 → 100755
Empty file.
Empty file modified lib/dmWidget/dmWidgetGoogleMapShowForm.php 100644 → 100755
Empty file.
4 changes: 3 additions & 1 deletion lib/dmWidget/dmWidgetGoogleMapShowView.php 100644 → 100755
Expand Up @@ -9,6 +9,7 @@ public function configure()

$this->addRequiredVar(array(
'address',
'json',
'mapTypeId',
'zoom',
'navigationControl',
Expand All @@ -24,6 +25,7 @@ protected function doRender()

$map = $this->getService('google_map_helper')->map()
->address($vars['address'])
->json($vars['json'])
->mapTypeId($vars['mapTypeId'])
->zoom($vars['zoom'])
->style(sprintf(
Expand All @@ -50,4 +52,4 @@ protected function doRenderForIndex()
return $vars['address'];
}

}
}
Empty file modified lib/helper/DmGoogleMapHelper.php 100644 → 100755
Empty file.
Empty file modified lib/view/dmGoogleMapHelper.php 100644 → 100755
Empty file.
12 changes: 9 additions & 3 deletions lib/view/html/dmGoogleMapTag.php 100644 → 100755
Expand Up @@ -41,8 +41,14 @@ public function address($location)
return $this->setOption('address', (string) $location);
}

public function coords($latitude, $longitude)
public function json($json_url)
{
return $this->setOption('json', (string) $json_url);
}

public function coords($latitude, $longitude, $showMarker = true)
{
$this->setOption('showMarker', $showMarker);
return $this->setOption('coords', array($latitude, $longitude));
}

Expand Down Expand Up @@ -109,7 +115,7 @@ protected function jsonifyAttributes(array $attributes)

protected function getJsonAttributes()
{
return array('address', 'coords', 'mapTypeId', 'zoom', 'navigationControl', 'mapTypeControl', 'scaleControl');
return array('address', 'coords', 'mapTypeId', 'zoom', 'navigationControl', 'mapTypeControl', 'scaleControl', 'json', 'showMarker');
}

public function getJavascripts()
Expand All @@ -124,4 +130,4 @@ public function getStylesheets()
{
return array();
}
}
}
Empty file modified modules/dmWidgetGoogleMap/templates/_showForm.php 100644 → 100755
Empty file.
46 changes: 42 additions & 4 deletions web/js/dmGoogleMap.js 100644 → 100755
@@ -1,6 +1,6 @@
(function($)
{
$.fn.dmGoogleMap = function(opt)
$.fn.dmGoogleMap = function(opt)
{
if(typeof google == "undefined" || typeof google.maps == "undefined")
{
Expand All @@ -15,9 +15,46 @@
mapTypeId: google.maps.MapTypeId.HYBRID
}, self.metadata(), opt || {}),
map,
marker;
marker,
Markers = new Array(),
Infos = new Array();

if(options.coords)
if(options.json) {
coords = new google.maps.LatLng(options.coords[0], options.coords[1]);

map = new google.maps.Map(self.get(0), $.extend(options, { center: coords }));
if (options.showMarker == true) {
marker = new google.maps.Marker({
position: coords,
map: map
});
};

var json = $.parseJSON(options.json);
$.each(json.markers, function(indice, marker) {
Markers[indice] = new google.maps.Marker({
position: new google.maps.LatLng(marker.lat, marker.lng),
map: map,
clickable: true,
visible: true,
title: marker.title
});

Infos[indice] = new google.maps.InfoWindow({
content: marker.html
});

if (marker.image != undefined) {
Markers[indice].icon = marker.image;
}

google.maps.event.addListener(Markers[indice], 'click', function() {
Infos[indice].open(map, Markers[indice]);
});
});
}

else if(options.coords)
{
coords = new google.maps.LatLng(options.coords[0], options.coords[1]);

Expand All @@ -27,6 +64,7 @@
map: map
});
}

else if(options.address)
{
geocoder = new google.maps.Geocoder();
Expand Down Expand Up @@ -58,4 +96,4 @@

return this;
}
})(jQuery);
})(jQuery);
Empty file modified web/js/launcher.js 100644 → 100755
Empty file.
Empty file modified web/js/widget/showForm.js 100644 → 100755
Empty file.

0 comments on commit a22527d

Please sign in to comment.