aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--root/html/pages/report/index.tt43
1 files changed, 40 insertions, 3 deletions
diff --git a/root/html/pages/report/index.tt b/root/html/pages/report/index.tt
index 5fac7ab..b52a1a8 100644
--- a/root/html/pages/report/index.tt
+++ b/root/html/pages/report/index.tt
@@ -2,6 +2,10 @@
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false">
</script>
+<style>
+div.infow { margin: 0; font-size: 70%; font-family: Helvetica, Arial, sans-serif; }
+div.infow p { margin: 0; }
+</style>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(20,0);
@@ -12,6 +16,32 @@
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
+
+ /**
+ * Get colour for link to mirror.
+ * Tier1 mirrors are linked in red. Others are linked in blue.
+ *
+ * @param string source
+ * @return string (colour code)
+ */
+ function getStrokeColor(source) {
+ return (source == "rsync.mageia.org") ? "#FF0000" : "#0000FF";
+ }
+
+ /**
+ * Return a stroke weight after bandwidth provided.
+ * The bigger the bandwidth, their larger the stroke.
+ *
+ * @param string bw
+ * @return integer
+ */
+ function getStrokeWeight(bw) {
+ var bws = { "1Mbits": 1, "10Mbits": 2, "100Mbits": 3,
+ "1Gbits": 4, "2Gbits": 5
+ };
+ return (bw in bws) ? bws[bw] : 1;
+ }
+
[% FOREACH m = c.model('Mirrors').find_mirrors %]
[% IF m.latitude %]
var myLatlng = new google.maps.LatLng([% m.latitude %],[% m.longitude %]);
@@ -21,9 +51,12 @@
title:"[% m.hostname %]"
});
var infowindow[% loop.count %] = new google.maps.InfoWindow({
- content: '<div style="font-size: 75%">' +
+ content: '<div class="infow">' +
'<p><a href="[% c.uri_for('/mirrors', m.hostname) %]">[% m.hostname %]</a></p>' +
[% IF m.syncfrom %]
+ [% IF m.syncfrom == 'rsync.mageia.org' %]
+ '<p>Tier1 mirror.</p>' +
+ [% END %]
'<p>Sync from [% m.syncfrom %]</p>' +
[% END %]
'</div>'
@@ -37,10 +70,11 @@
var fLatLng = new google.maps.LatLng([% mf.0.latitude %], [% mf.0.longitude %]);
var flightPath = new google.maps.Polyline({
path: [ fLatLng, myLatlng ],
- strokeColor: "#FF0000",
+ strokeColor: getStrokeColor("[% m.syncfrom %]"),
strokeOpacity: 1.0,
- strokeWeight: 2
+ strokeWeight: getStrokeWeight("[% m.bandwidth %]")
});
+
flightPath.setMap(map);
[% END %]
[% END %]
@@ -51,6 +85,9 @@
</script>
<div id="map_canvas" style="width:75%; height:500px"></div>
+<p>Red links from source to Tier1 mirrors. Blue links from Tier1 mirrors
+to Tier2 mirrors.</p>
+
<script type="text/javascript">
initialize();
</script>