root / templates / edumanage / welcome.html @ b778f19c
History | View | Annotate | Download (4.2 kB)
1 |
{% extends "base.html"%} |
---|---|
2 |
{% block extrahead %} <script type="text/javascript" src="/static/js/jquery.min.js"></script> |
3 |
<script type="text/javascript" src="/static/js/markerclusterer.js"></script> |
4 |
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> |
5 |
<script type="text/javascript"> |
6 |
var lat = 36.97;
|
7 |
var lng = 23.71;
|
8 |
var zoomLevel = 6;
|
9 |
var latlng = new google.maps.LatLng(lat,lng);
|
10 |
var map = '';
|
11 |
var bounds = '';
|
12 |
var image = '';
|
13 |
|
14 |
var styles = [{
|
15 |
url: '/static/img/edugroup.png',
|
16 |
height: 54,
|
17 |
width: 63,
|
18 |
textColor: '#ffffff',
|
19 |
textSize: 11
|
20 |
},
|
21 |
{
|
22 |
url: '/static/img/edugroup.png',
|
23 |
height: 54,
|
24 |
width: 63,
|
25 |
textColor: '#ffffff',
|
26 |
textSize: 11
|
27 |
},
|
28 |
{
|
29 |
url: '/static/img/edugroup.png',
|
30 |
height: 54,
|
31 |
width: 63,
|
32 |
textColor: '#ffffff',
|
33 |
textSize: 11
|
34 |
}];
|
35 |
|
36 |
function initialize() {
|
37 |
image = new google.maps.MarkerImage('/static/img/edupin.png',
|
38 |
// This marker is 29 pixels wide by 40 pixels tall.
|
39 |
new google.maps.Size(29, 40),
|
40 |
// The origin for this image is 0,0.
|
41 |
new google.maps.Point(0,0),
|
42 |
// The anchor for this image is the base of the flagpole at 18,42.
|
43 |
new google.maps.Point(14, 40)
|
44 |
);
|
45 |
var styleArray = [
|
46 |
{
|
47 |
featureType: "all",
|
48 |
stylers: [
|
49 |
{ saturation: -60 },
|
50 |
{gamma: 1.00 }
|
51 |
]
|
52 |
},{
|
53 |
featureType: "poi.business",
|
54 |
elementType: "labels",
|
55 |
stylers: [
|
56 |
{ visibility: "off" }
|
57 |
]
|
58 |
},
|
59 |
{ "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] },
|
60 |
{ "featureType": "poi", "elementType": "all", "stylers": [ { "visibility": "off" } ] },
|
61 |
{'featureType': "administrative.country",
|
62 |
'elementType': "labels",
|
63 |
'stylers': [
|
64 |
{ 'visibility': "off" }
|
65 |
]}
|
66 |
|
67 |
];
|
68 |
var mapOptions = {
|
69 |
center : latlng,
|
70 |
zoom : zoomLevel,
|
71 |
mapTypeId : google.maps.MapTypeId.ROADMAP,
|
72 |
styles: styleArray,
|
73 |
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
74 |
mapTypeControlOptions: {
|
75 |
style: google.maps.MapTypeControlStyle.DEFAULT
|
76 |
},
|
77 |
navigationControl: true,
|
78 |
mapTypeControl: false,
|
79 |
};
|
80 |
map = new google.maps.Map(document.getElementById("map_canvas"),
|
81 |
mapOptions);
|
82 |
bounds = new google.maps.LatLngBounds();
|
83 |
|
84 |
}
|
85 |
|
86 |
function placeMarkers(){
|
87 |
var markers = new Array();
|
88 |
$.get("{% url get-service-points %}", function(data){
|
89 |
$.each(data, function(index, jsonMarker) {
|
90 |
var marker = createMarker(jsonMarker);
|
91 |
if (marker){
|
92 |
bounds.extend(marker.position);
|
93 |
markers.push(marker)
|
94 |
}
|
95 |
});
|
96 |
var mcOptions = {gridSize: 50, maxZoom: 15, styles: styles};
|
97 |
|
98 |
var markerCluster = new MarkerClusterer(map, markers, mcOptions);
|
99 |
map.fitBounds(bounds)
|
100 |
});
|
101 |
}
|
102 |
|
103 |
function createMarker(markerObj){
|
104 |
var title = markerObj.name;
|
105 |
var latLng = new google.maps.LatLng(markerObj.lat, markerObj.lng);
|
106 |
var marker = new google.maps.Marker({
|
107 |
'position' : latLng,
|
108 |
'map' : map,
|
109 |
'title': title,
|
110 |
'icon': image,
|
111 |
});
|
112 |
return marker
|
113 |
}
|
114 |
|
115 |
function clusterMarkers(markers){
|
116 |
var markerCluster = new MarkerClusterer(map, markers);
|
117 |
}
|
118 |
|
119 |
$(document).ready(function() {
|
120 |
{% if services %}
|
121 |
initialize();
|
122 |
marks = placeMarkers();
|
123 |
console.log(marks);
|
124 |
clusterMarkers(marks);
|
125 |
|
126 |
{% endif %}});</script> |
127 |
{% endblock %} |
128 |
|
129 |
{% block content %} |
130 |
<div class="container-fluid"> |
131 |
<div class="row-fluid"> |
132 |
<div class="span2"> |
133 |
<div class="sidebar-nav"> |
134 |
<ul class="nav nav-list nav-stacked side-menu"> |
135 |
<li {% block %}class="active"{% endblock %}> |
136 |
<a href="{% url manage %}">Home</a> |
137 |
</li>
|
138 |
<li {% block %}{% endblock %}> |
139 |
<a href="{% url institutions %}">My Institution</a> |
140 |
</li>
|
141 |
<li {% block %}{% endblock %}> |
142 |
<a href="{% url services %}">My Services</a> |
143 |
</li>
|
144 |
<li {% block %}{% endblock %}> |
145 |
<a href="{% url servers %}">My Servers</a> |
146 |
</li>
|
147 |
</ul>
|
148 |
</div><!--/.well --> |
149 |
</div><!--/span--> |
150 |
<div class="span10"> |
151 |
<div class="row-fluid"> |
152 |
<!--/span-->
|
153 |
<div class="span10"> |
154 |
{% block subcontent %} <h4>My Services</h4> |
155 |
{% if services %} <div id="map_canvas" style="width:100%; height:450px;"></div> |
156 |
{% else %} |
157 |
<p>
|
158 |
No services defined! |
159 |
</p>
|
160 |
{% endif %} |
161 |
{% endblock %} |
162 |
</div><!--/span--> |
163 |
<!--/span-->
|
164 |
</div><!--/row--> |
165 |
</div><!--/span--> |
166 |
</div><!--/row--> |
167 |
<hr>
|
168 |
<footer>
|
169 |
<p>
|
170 |
© leopoul - GRNET NOC - GRNET S.A - 2012
|
171 |
</p>
|
172 |
</footer>
|
173 |
</div><!--/.fluid-container--> |
174 |
{% endblock %} |