From: Ciro Scognamiglio Date: Tue, 4 Mar 2014 15:34:59 +0000 (+0100) Subject: added google map X-Git-Tag: myslice-1.1~239 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=710bcc979f65e80d9e25cd80035e0c42b112991c;p=unfold.git added google map --- diff --git a/portal/static/css/onelab.css b/portal/static/css/onelab.css index 300fa933..750af817 100644 --- a/portal/static/css/onelab.css +++ b/portal/static/css/onelab.css @@ -1,8 +1,11 @@ +html { height: 100% } + body { background-color:white; color:black; margin:0; padding:0; + height: 100%; } a, a:active, a:focus { outline: 0; diff --git a/portal/static/img/marker1.png b/portal/static/img/marker1.png new file mode 100644 index 00000000..5f29aea8 Binary files /dev/null and b/portal/static/img/marker1.png differ diff --git a/portal/static/img/marker2.png b/portal/static/img/marker2.png new file mode 100644 index 00000000..9dce718a Binary files /dev/null and b/portal/static/img/marker2.png differ diff --git a/portal/static/js/myslice-ui.js b/portal/static/js/myslice-ui.js index 44379411..1f62c47d 100644 --- a/portal/static/js/myslice-ui.js +++ b/portal/static/js/myslice-ui.js @@ -5,15 +5,7 @@ $(document).ready(function() { var platformParameters = {}; - $.get("/rest/platform", function(data) { - var list = '
Testbeds
'; - for(i=0; i'+data[i].platform_longname+'

'+data[i].platform+'

'; - } - $('#select-platform').html(list); - }).done(function() { - - }); + /* Testbeds list */ $("div#testbed-list").ready(function() { diff --git a/portal/static/js/onelab_slice-resource-view.js b/portal/static/js/onelab_slice-resource-view.js index c1722e73..f2bd93d1 100644 --- a/portal/static/js/onelab_slice-resource-view.js +++ b/portal/static/js/onelab_slice-resource-view.js @@ -5,4 +5,44 @@ $(document).ready(function() { $('div.panel').hide(); $('div#'+$(this).data('panel')).show(); }); + + $.get("/rest/platform", function(data) { + var list = '
Testbeds
'; + for(i=0; i'+data[i].platform_longname+'

'+data[i].platform+'

'; + } + $('#select-platform').html(list); + }).done(function() { + + }); + + $.get("/rest/resource/", {"fields" : ["hostname","latitude","longitude"] }, function(data) { + + var mapOptions = { + center: new google.maps.LatLng(48.8567, 2.3508), + zoom: 4, + scrollwheel: false + }; + var map = new google.maps.Map(document.getElementById("map"), mapOptions); + marker = new google.maps.Marker({ + position: new google.maps.LatLng(48.8567, 2.3508), + map: map, + icon: '/static/img/marker2.png' + }); + for (i = 0; i < data.length; i++) { + if (!data[i].longitude) continue; + marker = new google.maps.Marker({ + position: new google.maps.LatLng(data[i].latitude, data[i].longitude), + map: map + }); + + google.maps.event.addListener(marker, 'click', (function(marker, i) { + return function() { + infowindow.setContent(data[i].hostname); + infowindow.open(map, marker); + }; + })(marker, i)); + } + }); + //google.maps.event.addDomListener(window, 'load', initialize); }); \ No newline at end of file diff --git a/portal/templates/onelab/onelab_slice-resource-view.html b/portal/templates/onelab/onelab_slice-resource-view.html index c7acf6f5..895e2ed2 100644 --- a/portal/templates/onelab/onelab_slice-resource-view.html +++ b/portal/templates/onelab/onelab_slice-resource-view.html @@ -1,6 +1,7 @@ {% extends "layout_wide.html" %} {% block head %} + {% endblock %} @@ -18,7 +19,7 @@ -
+
{% include theme|add:"_widget-slice-sections.html" %}
@@ -40,11 +41,11 @@
  • -
    -
    -
    - {% endblock %} \ No newline at end of file