aboutsummaryrefslogtreecommitdiffstats
path: root/root/html
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mageia.org>2010-10-03 15:36:00 +0000
committerOlivier Thauvin <nanardon@mageia.org>2010-10-03 15:36:00 +0000
commitddcf19029c7b58b2ea236bd14e6c1456949f0fc0 (patch)
tree725f066cac991b43163f1e08a5954b6071634f3d /root/html
parent114b46067622cc0c68d007711cf58f74e25411b8 (diff)
downloadmgamirrors-ddcf19029c7b58b2ea236bd14e6c1456949f0fc0.tar
mgamirrors-ddcf19029c7b58b2ea236bd14e6c1456949f0fc0.tar.gz
mgamirrors-ddcf19029c7b58b2ea236bd14e6c1456949f0fc0.tar.bz2
mgamirrors-ddcf19029c7b58b2ea236bd14e6c1456949f0fc0.tar.xz
mgamirrors-ddcf19029c7b58b2ea236bd14e6c1456949f0fc0.zip
- use google maps for location, improve messages
Diffstat (limited to 'root/html')
-rw-r--r--root/html/includes/distrib/distrib.tt11
-rw-r--r--root/html/includes/header.tt10
-rw-r--r--root/html/includes/host_information.tt48
-rw-r--r--root/html/includes/new/confirm.tt8
-rw-r--r--root/html/includes/new/invalid_mirror.tt2
-rw-r--r--root/html/includes/new/invalid_uri.tt2
-rw-r--r--root/html/includes/new/mirror_exists.tt4
-rw-r--r--root/html/includes/new/new_host.tt9
-rw-r--r--root/html/includes/new/overlap_hosts.tt9
-rw-r--r--root/html/includes/new/url_form.tt3
-rw-r--r--root/html/pages/mirrors/mirror.tt19
-rw-r--r--root/html/pages/new/confirm.tt24
-rw-r--r--root/html/pages/new/index.tt13
-rw-r--r--root/html/pages/new/new_host.tt14
-rw-r--r--root/html/pages/report/index.tt35
15 files changed, 184 insertions, 27 deletions
diff --git a/root/html/includes/distrib/distrib.tt b/root/html/includes/distrib/distrib.tt
new file mode 100644
index 0000000..60e5090
--- /dev/null
+++ b/root/html/includes/distrib/distrib.tt
@@ -0,0 +1,11 @@
+[% IF c.req.param('version') AND c.req.param('arch') %]
+[% list = c.model('Mirrors').find_distributions({
+ version => c.req.param('version'),
+ arch => c.req.param('arch'),
+ protocol => c.req.param('protocol'),
+}) %]
+
+[% FOREACH l = list %]
+[% l.url %]<br>
+[% END %]
+[% END %]
diff --git a/root/html/includes/header.tt b/root/html/includes/header.tt
index 7f8b1d5..76bace4 100644
--- a/root/html/includes/header.tt
+++ b/root/html/includes/header.tt
@@ -5,9 +5,15 @@
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
[% c.prototype.define_javascript_functions %]
+
</head>
<body>
-<p>Mageia mirrors database</p>
+<h1>Mageia mirrors database</h1>
-<p>Mirror not found ? <a href="[% c.uri_for('/new') %]">register it</a></p>
+<p id="menu">
+<span><a href="[% c.uri_for('/') %]">Mirror list</a></span>
+<span><a href="[% c.uri_for('/distrib') %]">Distribution list</a></span>
+<span><a href="[% c.uri_for('/report') %]">Mirrors map</a></span>
+<span><a href="[% c.uri_for('/new') %]">register a mirror url</a></span>
+</p>
diff --git a/root/html/includes/host_information.tt b/root/html/includes/host_information.tt
index c0cb7cb..2c9b574 100644
--- a/root/html/includes/host_information.tt
+++ b/root/html/includes/host_information.tt
@@ -1,4 +1,5 @@
<!-- $Id$ -->
+<div style="float: left">
<form action="[% action || c.uri_for() %]" method="POST">
<input type="hidden" name="hostinfo" value="1">
<table border=0>
@@ -18,6 +19,16 @@
<input type="text" name="city" value="[% host.city | html %]">
</td>
</tr>
+<tr><th>Latitude</th>
+<td>
+<input type="text" id="latitude" name="latitude" value="[% host.latitude | html %]">
+</td>
+</tr>
+<tr><th>Longitude</th>
+<td>
+<input type="text" id="longitude" name="longitude" value="[% host.longitude | html %]">
+</td>
+</tr>
[% FOREACH mirror = c.model('Mirrors').find_mirrors %]
[% IF loop.first %]
@@ -48,3 +59,40 @@
</table>
<input type="submit">
</form>
+</div>
+
+<script type="text/javascript"
+ src="http://maps.google.com/maps/api/js?sensor=false">
+</script>
+<script type="text/javascript">
+ function initialize() {
+ var latlng = new google.maps.LatLng(
+ [% host.latitude || 0 %],
+ [% host.longitude || 0 %]
+ );
+ var myOptions = {
+ zoom: 4,
+ center: latlng,
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+ };
+ var map = new google.maps.Map(document.getElementById("map_canvas"),
+ myOptions);
+
+ google.maps.event.addListener(map, 'click', function(event) {
+ recordposition(event.latLng);
+ });
+
+ function recordposition(location) {
+ document.getElementById("latitude").value = location.lat();
+ document.getElementById("longitude").value = location.lng();
+ }
+ }
+
+</script>
+
+<div id="map_canvas" style="float: left; width:40%; height:300px"></div>
+<div style="clear: both"></div>
+
+<script type="text/javascript">
+ initialize();
+</script>
diff --git a/root/html/includes/new/confirm.tt b/root/html/includes/new/confirm.tt
deleted file mode 100644
index e0bb7d4..0000000
--- a/root/html/includes/new/confirm.tt
+++ /dev/null
@@ -1,8 +0,0 @@
-<div id="foo">
-<p>Really adding [% c.session.new_uri | html %] ?</p>
-
-[% c.prototype.form_remote_tag({ url => c.uri_for('confirm'), update => 'foo' } ) %]
-<input type="hidden" name="confirm" value="1">
-<input type="submit">
-</form>
-</div>
diff --git a/root/html/includes/new/invalid_mirror.tt b/root/html/includes/new/invalid_mirror.tt
index f22d0f3..bef66c8 100644
--- a/root/html/includes/new/invalid_mirror.tt
+++ b/root/html/includes/new/invalid_mirror.tt
@@ -1 +1 @@
-This url seems to not contain a valid mirror.
+<p>This url seems to not point a valid mirror.</p>
diff --git a/root/html/includes/new/invalid_uri.tt b/root/html/includes/new/invalid_uri.tt
index 87ced3c..4d9390e 100644
--- a/root/html/includes/new/invalid_uri.tt
+++ b/root/html/includes/new/invalid_uri.tt
@@ -1 +1 @@
-[% uri %] is not a valid url.
+<p>[% uri %] is not a valid url.</p>
diff --git a/root/html/includes/new/mirror_exists.tt b/root/html/includes/new/mirror_exists.tt
index f891993..3345cd2 100644
--- a/root/html/includes/new/mirror_exists.tt
+++ b/root/html/includes/new/mirror_exists.tt
@@ -1 +1,3 @@
-<p>The url [% uri | html %] has same server and same protocol than [% exists_url.0.url %].</p>
+<p>The mirror [% uri.host | html %] is already registered serving the distribution via [% uri.scheme | html %]
+at url <a href="[% uri %]">[% uri | html %]</a></p>
+<p>The URL [% exists_url.url %] cannot be added.</p>
diff --git a/root/html/includes/new/new_host.tt b/root/html/includes/new/new_host.tt
deleted file mode 100644
index a4296d2..0000000
--- a/root/html/includes/new/new_host.tt
+++ /dev/null
@@ -1,9 +0,0 @@
-Enter Info for [% uri.host %]
-
-<form action="[% c.uri_for() %]" method="POST">
-<input type="hidden" name="url" value="[% uri | html %]">
-<input type="hidden" name="hostinfo" value="1">
-
-[% location.name %] / [% location.continent %]<br>
-
-[% INCLUDE 'host_information.tt' %]
diff --git a/root/html/includes/new/overlap_hosts.tt b/root/html/includes/new/overlap_hosts.tt
index 3d60603..77b4991 100644
--- a/root/html/includes/new/overlap_hosts.tt
+++ b/root/html/includes/new/overlap_hosts.tt
@@ -1 +1,8 @@
-This server seems to be the same than [% overlap_hosts.join(', ') | html %].
+<p>According IP address, host [% uri.host %] is the same than already registered
+[% overlap_hosts.join(', ') | html %].</p>
+
+<p>This URL cannot be added.</p>
+
+[% IF urlmaybe %]
+<p>You can try to add the following URL instead:</p>
+[% END %]
diff --git a/root/html/includes/new/url_form.tt b/root/html/includes/new/url_form.tt
index 169fe73..49a7d66 100644
--- a/root/html/includes/new/url_form.tt
+++ b/root/html/includes/new/url_form.tt
@@ -1,7 +1,4 @@
<form action="[% c.uri_for() %]" method="POST">
-Enter the url to the top level mirror tree, supported protocol are
-[% c.model('Mirrors').protocol_list.join(', ') | html %].<br>
-
<input type="text" name="url" size=40 value="[% c.req.param('url') | html %]">
<input type=submit>
</form>
diff --git a/root/html/pages/mirrors/mirror.tt b/root/html/pages/mirrors/mirror.tt
new file mode 100644
index 0000000..dad43c2
--- /dev/null
+++ b/root/html/pages/mirrors/mirror.tt
@@ -0,0 +1,19 @@
+<h1>Mirror: [% hostname %]<h1>
+
+<h2>Host information</h2>
+
+[% INCLUDE 'host_information.tt'
+ action = c.uri_for(hostname)
+%]
+
+<h2>URLs to the distribution</h2>
+
+[% FOREACH u = c.model('Mirrors').find_urls({ hostname => hostname }) %]
+[% IF loop.first %]
+<ul>
+[% END %]
+<li><a href="[% u.url %]">[% u.url | html %]</a></li>
+[% IF loop.last %]
+</ul>
+[% END %]
+[% END %]
diff --git a/root/html/pages/new/confirm.tt b/root/html/pages/new/confirm.tt
new file mode 100644
index 0000000..2dde830
--- /dev/null
+++ b/root/html/pages/new/confirm.tt
@@ -0,0 +1,24 @@
+<div id="foo">
+<h2>Confirmation</h2>
+
+<p>The URL [% c.session.new_uri | html %] has been succefully validated.</p>
+
+<p>Please confirm the addition into the database.</p>
+
+[% IF c.session.hostinfo %]
+<p>This URL refer to new mirror [% new_uri.host %]
+[% IF c.session.hostinfo.country %]
+[% cinfo = c.model('Mirrors').country_info(c.session.hostinfo.country) %]
+located in [% cinfo.name | html %] ([% cinfo.continent | html %])
+[%- END -%].</p>
+[% ELSE %]
+[% END %]
+
+[% IF exists_url %]
+<p>This url will replace the currently invalid url [% exists_url.url | html %].</p>
+[% END %]
+
+[% c.prototype.form_remote_tag({ url => c.uri_for('confirm'), update => 'foo' } ) %]
+<input type="submit" name="confirm" value="Yes, add it">
+</form>
+</div>
diff --git a/root/html/pages/new/index.tt b/root/html/pages/new/index.tt
index 0ef4cfd..c20344c 100644
--- a/root/html/pages/new/index.tt
+++ b/root/html/pages/new/index.tt
@@ -1,5 +1,16 @@
-[% INCLUDE 'new/url_form.tt' %]
[% IF subtemplate %]
[% INCLUDE $subtemplate %]
+[% ELSE %]
+<p>Enter the url to the top level mirror tree. The URL must be in form
+<pre>PROTOCOL://SERVER/PATH</pre></p>
+<p>Supported protocol are
+[%- FOREACH proto = c.model('Mirrors').protocol_list -%]
+[%- IF NOT loop.first -%]
+[%- IF loop.last %] or [% ELSE %], [% END %]
+[%- END -%]
+[%- proto | html -%]
+[%- END -%].</p>
[% END %]
+
+[% INCLUDE 'new/url_form.tt' %]
diff --git a/root/html/pages/new/new_host.tt b/root/html/pages/new/new_host.tt
new file mode 100644
index 0000000..d73600c
--- /dev/null
+++ b/root/html/pages/new/new_host.tt
@@ -0,0 +1,14 @@
+<h2>Unknown mirror [% uri.host %]</h2>
+
+<p>This server is still unknown in our database, please complete information about this mirror.</p>
+
+[% IF location %]
+<p>According the IP address this host is located in
+[% location.name | html %] ([% location.continent | html %]).</p>
+[% END %]
+
+<form action="[% c.uri_for() %]" method="POST">
+<input type="hidden" name="url" value="[% uri | html %]">
+<input type="hidden" name="hostinfo" value="1">
+
+[% INCLUDE 'host_information.tt' %]
diff --git a/root/html/pages/report/index.tt b/root/html/pages/report/index.tt
new file mode 100644
index 0000000..b360813
--- /dev/null
+++ b/root/html/pages/report/index.tt
@@ -0,0 +1,35 @@
+<!-- $Id$ -->
+<script type="text/javascript"
+ src="http://maps.google.com/maps/api/js?sensor=false">
+</script>
+<script type="text/javascript">
+ function initialize() {
+ var latlng = new google.maps.LatLng(20,0);
+ var myOptions = {
+ zoom: 2,
+ center: latlng,
+ mapTypeId: google.maps.MapTypeId.ROADMAP
+ };
+ var map = new google.maps.Map(document.getElementById("map_canvas"),
+ myOptions);
+[% FOREACH m = c.model('Mirrors').find_mirrors %]
+[% IF m.latitude %]
+ var myLatlng = new google.maps.LatLng([% m.latitude %],[% m.longitude %]);
+ var marker = new google.maps.Marker({
+ position: myLatlng,
+ map: map,
+ title:"[% m.hostname %]"
+ });
+[% END %]
+[% END %]
+ }
+
+</script>
+<div id="map_canvas" style="width:75%; height:500px"></div>
+
+<script type="text/javascript">
+ initialize();
+</script>
+
+<h2>Synchronisation tree</h2>
+<img src="[% c.uri_for('/graph') %]">