Browse files

MDL-34960 drop deprecated Google Maps API V2

  • Loading branch information...
1 parent cec7d43 commit 704533fca7d695a71a46ac27ab9ae8f1de58d915 @skodak skodak committed Aug 19, 2012
Showing with 14 additions and 38 deletions.
  1. +0 −1 admin/settings/location.php
  2. +4 −14 iplookup/index.php
  3. +1 −20 iplookup/module.js
  4. +0 −2 lang/en/admin.php
  5. +7 −0 lib/db/upgrade.php
  6. +1 −0 lib/upgrade.txt
  7. +1 −1 version.php
View
1 admin/settings/location.php
@@ -14,7 +14,6 @@
$temp->add(new admin_setting_heading('iplookup', new lang_string('iplookup', 'admin'), new lang_string('iplookupinfo', 'admin')));
$temp->add(new admin_setting_configfile('geoipfile', new lang_string('geoipfile', 'admin'), new lang_string('configgeoipfile', 'admin', $CFG->dataroot.'/geoip/'), $CFG->dataroot.'/geoip/GeoLiteCity.dat'));
- $temp->add(new admin_setting_configtext('googlemapkey', new lang_string('googlemapkey', 'admin'), new lang_string('configgooglemapkey', 'admin', $CFG->wwwroot), '', PARAM_RAW, 60));
$temp->add(new admin_setting_configtext('googlemapkey3', new lang_string('googlemapkey3', 'admin'), new lang_string('googlemapkey3_help', 'admin'), '', PARAM_RAW, 60));
$temp->add(new admin_setting_configtext('allcountrycodes', new lang_string('allcountrycodes', 'admin'), new lang_string('configallcountrycodes', 'admin'), '', '/^(?:\w+(?:,\w+)*)?$/'));
View
18 iplookup/index.php
@@ -1,5 +1,4 @@
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -20,8 +19,7 @@
*
* This script is not compatible with IPv6.
*
- * @package core
- * @subpackage iplookup
+ * @package core_iplookup
* @copyright 2008 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -35,7 +33,7 @@
$user = optional_param('user', 0, PARAM_INT);
if (isset($CFG->iplookup)) {
- //clean up of old settings
+ // Clean up of old settings.
set_config('iplookup', NULL);
}
@@ -61,7 +59,7 @@
$info = iplookup_find_location($ip);
if ($info['error']) {
- // can not display
+ // Can not display.
notice($info['error']);
}
@@ -80,7 +78,7 @@
$PAGE->set_heading($title);
echo $OUTPUT->header();
-if (empty($CFG->googlemapkey) and empty($CFG->googlemapkey3)) {
+if (empty($CFG->googlemapkey3)) {
$imgwidth = 620;
$imgheight = 310;
$dotwidth = 18;
@@ -95,14 +93,6 @@
echo '</div>';
echo '<div id="note">'.$info['note'].'</div>';
-} else if (empty($CFG->googlemapkey3)) {
- $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($info['latitude'], $info['longitude']), true, $module);
-
- echo '<div id="map" style="width: 650px; height: 360px"></div>';
- echo '<div id="note">'.$info['note'].'</div>';
-
} else {
if (strpos($CFG->wwwroot, 'https:') === 0) {
$PAGE->requires->js(new moodle_url('https://maps.googleapis.com/maps/api/js', array('key'=>$CFG->googlemapkey3, 'sensor'=>'false')));
View
21 iplookup/module.js
@@ -16,32 +16,13 @@
/**
* Iplookup utility functions
*
- * @package core
- * @subpackage iplookup
+ * @package core_iplookup
* @copyright 2008 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
M.core_iplookup = {};
-M.core_iplookup.init = function(Y, 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);
-
- Y.on('unload', function() {
- if (GBrowserIsCompatible()) {
- GUnload();
- }
- }, document.body);
- }
-};
-
M.core_iplookup.init3 = function(Y, latitude, longitude, ip) {
var ipLatlng = new google.maps.LatLng(latitude, longitude);
View
2 lang/en/admin.php
@@ -219,7 +219,6 @@
$string['configgdversion'] = 'Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don\'t change this unless you really know what you\'re doing.';
$string['configgeoipfile'] = 'Location of GeoIP City binary data file. This file is not part of Moodle distribution and must be obtained separately from <a href="http://www.maxmind.com/">MaxMind</a>. You can either buy a commercial version or use the free version.<br />Simply download <a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" >http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz</a> and extract it into "{$a}" directory on your server.';
$string['configgetremoteaddrconf'] = 'If your server is behind a reverse proxy, you can use this setting to specify which HTTP headers can be trusted to contain the remote IP address. The headers are read in order, using the first one that is available.';
-$string['configgooglemapkey'] = 'You need to enter a special key to use Google Maps for IP address lookup visualization. You can obtain the key free of charge at <a href="https://developers.google.com/maps/documentation/javascript/v2/introduction#Obtaining_Key">https://developers.google.com/maps/documentation/javascript/v2/introduction#Obtaining_Key</a>.<br />Your web site URL is: {$a}';
$string['configgradebookroles'] = 'This setting allows you to control who appears on the gradebook. Users need to have at least one of these roles in a course to be shown in the gradebook for that course.';
$string['configgradeexport'] = 'Choose which gradebook export formats are your primary methods for exporting grades. Chosen plugins will then set and use a "last exported" field for every grade. For example, this might result in exported records being identified as being "new" or "updated". If you are not sure about this then leave everything unchecked.';
$string['confighiddenuserfields'] = 'Select which user information fields you wish to hide from other users other than course teachers/admins. This will increase student privacy. Hold CTRL key to select multiple fields.';
@@ -546,7 +545,6 @@
$string['globalswarning'] = '<p><strong>SECURITY WARNING!</strong></p><p> To operate properly, Moodle requires <br />that you make certain changes to your current PHP settings.</p><p>You <em>must</em> set <code>register_globals=off</code>.</p><p>This setting is controlled by editing your <code>php.ini</code>, Apache/IIS <br />configuration or <code>.htaccess</code> file.</p>';
$string['groupenrolmentkeypolicy'] = 'Group enrolment key policy';
$string['groupenrolmentkeypolicy_desc'] = 'Turning this on will make Moodle check group enrolment keys against a valid password policy.';
-$string['googlemapkey'] = 'Google Maps API V2 key';
$string['googlemapkey3'] = 'Google Maps API V3 key';
$string['googlemapkey3_help'] = 'You need to enter a special key to use Google Maps for IP address lookup visualization. You can obtain the key free of charge at <a href="https://developers.google.com/maps/documentation/javascript/tutorial#api_key" target="_blank">https://developers.google.com/maps/documentation/javascript/tutorial#api_key</a>';
$string['gotofirst'] = 'Go to first missing string';
View
7 lib/db/upgrade.php
@@ -1113,5 +1113,12 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012081400.01);
}
+ if ($oldversion < 2012081600.01) {
+ // Delete removed setting - Google Maps API V2 will not work in 2013.
+ unset_config('googlemapkey');
+ upgrade_main_savepoint(true, 2012081600.01);
+ }
+
+
return true;
}
View
1 lib/upgrade.txt
@@ -5,6 +5,7 @@ information provided here is intended especially for developers.
* Pagelib: Numerous deprecated functions were removed as classes page_base, page_course
and page_generic_activity.
+* use $CFG->googlemapkey3 instead of removed $CFG->googlemapkey and migrate to Google Maps API V3
YUI changes:
* moodle-enrol-notification has been renamed to moodle-core-notification
View
2 version.php
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2012081600.00; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2012081600.01; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit 704533f

Please sign in to comment.