X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fgooglemap%2Fgooglemap.js;h=2b0b88acd2cdaac5444c1e60e2cdf097967f4666;hb=c0c7175e6883ad9bc746692e7c71202e64ec2351;hp=7b43ebb2031bad5b8d4feeca3737fb8e22034b51;hpb=b53d7587bc9a18afc11d1f750be179df6a9b88e9;p=myslice.git diff --git a/plugins/googlemap/googlemap.js b/plugins/googlemap/googlemap.js index 7b43ebb2..2b0b88ac 100644 --- a/plugins/googlemap/googlemap.js +++ b/plugins/googlemap/googlemap.js @@ -1,8 +1,5 @@ /** - * MySlice GoogleMap plugin - * URL: http://trac.myslice.info * Description: display a query result in a googlemap - * Author: The MySlice Team * Copyright (c) 2012 UPMC Sorbonne Universite - INRIA * License: GPLv3 */ @@ -32,9 +29,9 @@ $this.data('markerCluster', null); $this.data('markers', []); - var myLatlng = new google.maps.LatLng(34.397, 150.644); + var myLatlng = new google.maps.LatLng(options.latitude, options.longitude); var myOptions = { - zoom: 2, + zoom: options.zoom, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } @@ -52,6 +49,10 @@ GoogleMap : GoogleMap }); + /* Events */ + $this.on('show.GoogleMaps', methods.show); + + /* Subscribe to query updates */ jQuery.subscribe('/results/' + options.query_uuid + '/changed', {instance: $this}, update_map); jQuery.subscribe('/update-set/' + options.query_uuid, {instance: $this}, on_resource_changed); @@ -138,8 +139,8 @@ instance_.closest('.need-spin').spin(false); - if (!rows) { - alert('error'); + if (rows === undefined || !rows || rows.length==0) { + messages.warning ("Empty result in googlemap.update_map - nothing to show"); return; }