Skip to content

Commit

Permalink
MDL-19875 tested patch and added some more echos, thanks Tim!
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jul 21, 2009
1 parent a1a6cf1 commit 4aa31a6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
26 changes: 14 additions & 12 deletions iplookup/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@
*/

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();
}
}
17 changes: 10 additions & 7 deletions iplookup/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,31 +137,34 @@
$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);
$note = implode('<br />', $note);

$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();
}

0 comments on commit 4aa31a6

Please sign in to comment.