It would be great if you could add more options to control when this module is invoked. Thank you for adding the role-based restrictions, but I'd also like to restrict this module to specific pages. The problem is, whenever this module is invoked, the browser presents a warning message which appears on every page until you check "remember for this site":

Firefox: "whatever.com wants to know your location - share location - don't share"
Safari: "The website “http://whatever.com” would like to use your current location"

I'm currently working on a website where the geolocation information will only be required on the "node/x/edit" page. This is the only page in which we want the Smart IP module to be invoked. We'd also like to collect fresh data every time this page loads, because agents will be inputting data on the job site, via their mobile devices.

Thanks!

Comments

arpeggio’s picture

I see the issue in http://drupal.org/node/1061264 is experienced when the "remember for this site" is not checked.

Or as the suggestion at issue http://drupal.org/node/1061264 we can make the warning message popped only once or have it checked every 24hours.

jhm’s picture

I thought this would be a great feature as well, until I realized that this is only relevant for the sub-module device_geolocation.

An easy way to realize this would be to move the javascript form hook_init into the block content function device_geolocation_contents and possibly add a flag to that block that would allow hiding of the output, thus only loading the javascript on pages the block is visible on.

The location would still be determined by IP address on all pages, but that does not generate a popup.

arpeggio’s picture

Thank you for the suggestion jhm. However, not all users are turning the device_geolocation block on. Some are using the device_geolocation just to make their visitor's geolocation info more detailed. The clean way to do this is to add internal url checker function, here's my concept of the code:

function device_geolocation_init() {
  if (_device_geolocation_check_allowed_page($_GET['q']) && !isset($_SESSION['device_geolocation'])) {
    drupal_add_js('http://maps.google.com/maps/api/js?sensor=true');
    device_geolocation_get_coordinates();
    drupal_add_js('http://code.google.com/apis/gears/gears_init.js');
    drupal_add_js(drupal_get_path('module', 'device_geolocation') . '/js/device_geolocation.js');
  }
}

function _device_geolocation_check_allowed_page($url) {
  // TODO: code for checking the list of allowed pages 
}

And add a nice form at Smart IP admin page for adding the URL of allowed pages.

arpeggio’s picture

Status: Active » Fixed

I have implemented this feature (both D6 and D7) - geolocation on specific Drupal native pages. Please use the dev version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mastoll’s picture

Issue summary: View changes

@argeggio, you've made it possible to invoke geolocating by IP only on specified pages? I can't find where you specify the page? Or how, on a page, you turn geolocating on/off? Can you please point me in the right direction? Thanks!