]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19875 tested patch and added some more echos, thanks Tim!
authorskodak <skodak>
Tue, 21 Jul 2009 08:19:02 +0000 (08:19 +0000)
committerskodak <skodak>
Tue, 21 Jul 2009 08:19:02 +0000 (08:19 +0000)
iplookup/functions.js
iplookup/index.php

index 2ee5802a236fc4653d004628345a3bcf980c9d33..529e01070ecabe9d0f8261d9a61364d4ccc42e3e 100644 (file)
  */
 
 function iplookup_load(latitude, longitude) {
-  if (GBrowserIsCompatible()) {
-    var map = new GMap2(document.getElementById("map"));
-    map.addControl(new GSmallMapControl());
-    map.addControl(new GMapTypeControl());
-    var point = new GLatLng(latitude, longitude);
-    map.setCenter(point, 4);
-    map.addOverlay(new GMarker(point));
-    map.setMapType(G_HYBRID_MAP);
-  }
+    if (GBrowserIsCompatible()) {
+        var map = new GMap2(document.getElementById("map"));
+        map.addControl(new GSmallMapControl());
+        map.addControl(new GMapTypeControl());
+        var point = new GLatLng(latitude, longitude);
+        map.setCenter(point, 4);
+        map.addOverlay(new GMarker(point));
+        map.setMapType(G_HYBRID_MAP);
+
+        YAHOO.utils.Event.addListener(document.body, 'unload', iplookup_unload);
+    }
 }
 
 function iplookup_unload() {
-  if (GBrowserIsCompatible()) {
-       GUnload();
-  }
+    if (GBrowserIsCompatible()) {
+        GUnload();
+    }
 }
index dfa6b88a6ae4532d50c4c7078883dff8efca9809..1cc15aed113f1bd3c79e195d8e740a52bec4d880 100644 (file)
@@ -137,14 +137,17 @@ if (empty($CFG->googlemapkey)) {
     $dx = round((($longitude + 180) * ($imgwidth / 360)) - $imgwidth - $dotwidth/2);
     $dy = round((($latitude + 90) * ($imgheight / 180)));
 
-    print_header(get_string('iplookup', 'admin').': '.$info, $info);
+    $PAGE->set_title(get_string('iplookup', 'admin').': '.$info);
+    $PAGE->set_heading($info);
+    echo $OUTPUT->header();
 
     echo '<div id="map" style="width:'.($imgwidth+$dotwidth).'px; height:'.$imgheight.'px;">';
     echo '<img src="earth.jpeg" style="width:'.$imgwidth.'px; height:'.$imgheight.'px" alt="" />';
     echo '<img src="marker.gif" style="width:'.$dotwidth.'px; height:'.$dotheight.'px; margin-left:'.$dx.'px; margin-bottom:'.$dy.'px;" alt="" />';
     echo '</div>';
     echo '<div id="note">'.$note.'</div>';
-    print_footer('empty');
+
+    echo $OUTPUT->footer();
 
 } else {
     $info = implode(' - ', $info);
@@ -152,16 +155,16 @@ if (empty($CFG->googlemapkey)) {
 
     $PAGE->requires->js("http://maps.google.com/maps?file=api&amp;v=2&amp;key=$CFG->googlemapkey", true)->in_head();
     $PAGE->requires->js('/iplookup/functions.js')->in_head();
+    $PAGE->requires->yui_lib('event');
+    $PAGE->requires->js_function_call('iplookup_load', array($latitude, $longitude));
 
-    print_header(get_string('iplookup', 'admin').': '.$info, $info);
+    $PAGE->set_title(get_string('iplookup', 'admin').': '.$info);
+    $PAGE->set_heading($info);
+    echo $OUTPUT->header();
 
     echo '<div id="map" style="width: 650px; height: 360px"></div>';
     echo '<div id="note">'.$note.'</div>';
 
-    $PAGE->requires->js_function_call('iplookup_load', array($latitude, $longitude));
-
-    //TODO: MDL-19875 - call uplookup_unload() js function when page unloads, previously in meta parameter
-
     echo $OUTPUT->footer();
 }