mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-21400 converted iplookup to YUI3, removed in_head()
This commit is contained in:
parent
c6f5f39ad5
commit
789ff38c47
@ -153,10 +153,9 @@ if (empty($CFG->googlemapkey)) {
|
||||
$info = implode(' - ', $info);
|
||||
$note = implode('<br />', $note);
|
||||
|
||||
$PAGE->requires->js("http://maps.google.com/maps?file=api&v=2&key=$CFG->googlemapkey", true)->in_head();
|
||||
$PAGE->requires->js('/iplookup/functions.js')->in_head();
|
||||
$PAGE->requires->yui2_lib('event');
|
||||
$PAGE->requires->js_function_call('iplookup_load', array($latitude, $longitude));
|
||||
$PAGE->requires->js(new moodle_url("http://maps.google.com/maps?file=api&v=2&key=$CFG->googlemapkey"));
|
||||
$module = array('name'=>'core_iplookup', 'fullpath'=>'/iplookup/module.js');
|
||||
$PAGE->requires->js_init_call('M.core_iplookup.init', array($latitude, $longitude), true, $module);
|
||||
|
||||
$PAGE->set_title(get_string('iplookup', 'admin').': '.$info);
|
||||
$PAGE->set_heading($info);
|
||||
|
@ -22,7 +22,9 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
function iplookup_load(latitude, longitude) {
|
||||
M.core_iplookup = {};
|
||||
|
||||
M.core_iplookup.init = function(Y, latitude, longitude) {
|
||||
if (GBrowserIsCompatible()) {
|
||||
var map = new GMap2(document.getElementById("map"));
|
||||
map.addControl(new GSmallMapControl());
|
||||
@ -32,12 +34,10 @@ function iplookup_load(latitude, longitude) {
|
||||
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();
|
||||
}
|
||||
Y.on('unload', function() {
|
||||
if (GBrowserIsCompatible()) {
|
||||
GUnload();
|
||||
}
|
||||
}, document.body);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user