Skip to content
Snippets Groups Projects
Commit 653d46d0 authored by Brandon Bergren's avatar Brandon Bergren
Browse files

The remainder of #392130, reported by gaele:

Rename permissions:
"show node map" -> "view node map"
"show user map" -> "view user map"
"user locations" -> "view user location details"
parent 3a207298
No related branches found
No related tags found
No related merge requests found
......@@ -18,10 +18,10 @@ gmap_views.module: GMap <-> Views.module interface. Provides a "GMap View" view
Installation
------------
* To install, follow the general directions available at:
* To install, follow the general directions available at:
http://drupal.org/getting-started/5/install-contrib/modules
* You will need a Google Maps API key for your website. You can get one at:
* You will need a Google Maps API key for your website. You can get one at:
http://www.google.com/apis/maps/signup.html
Enter your Google Maps API key in the GMap settings page (admin/settings/gmap).
......@@ -65,19 +65,19 @@ Macro
A GMap macro will look something like this (see API.txt for syntax details):
[gmap markers=blue::41.902277040963696,-87.6708984375 |zoom=5 |center=42.94033923363183,-88.857421875 |width=300px |height=200px |control=Small |type=Map]
The GMap Macro Builder is a GUI for creating GMap macros; you may use it to create a map with points, lines, polygons, and circles, and then copy and paste the resulting macro text. After you insert the macro into a node, you can edit it using raw values that you get from elsewhere to create a different set of points or lines on the map.
The GMap Macro Builder is a GUI for creating GMap macros; you may use it to create a map with points, lines, polygons, and circles, and then copy and paste the resulting macro text. After you insert the macro into a node, you can edit it using raw values that you get from elsewhere to create a different set of points or lines on the map.
If you've enabled the gmap_macro_builder.module, you can access the GMap macro builder at the 'map/macro' path (there will be "Build a GMap macro" link in your Navigation menu).
If you've enabled the gmap_macro_builder.module, you can access the GMap macro builder at the 'map/macro' path (there will be "Build a GMap macro" link in your Navigation menu).
Note that there are many more options you can set on your maps if you are willing to edit macros by hand. For example, you may add KML or GeoRSS overlays to GMaps, but this option isn't available through the macro builder. Again, see API.txt for syntax details.
User and node maps
------------------
User and node location maps are made available by gmap_location.module, and work in conjunction with location.module. Any user that has the 'show user map' or 'show node map' permission can see the user or node maps, respectively. These are maps with a marker for every user or node, and are located at the 'map/user' and 'map/node' paths (links to these maps are placed in the Navigation menu).
User and node location maps are made available by gmap_location.module, and work in conjunction with location.module. Any user that has the 'view user map' or 'view node map' permission can see the user or node maps, respectively. These are maps with a marker for every user or node, and are located at the 'map/user' and 'map/node' paths (links to these maps are placed in the Navigation menu).
Users with the 'user locations' permission can click markers on the User map to see information on individual users.
Users with the 'view user location details' permission can click markers on the User map to see information on individual users.
GMap Location also provides two map blocks that work with node locations: a "Location map" block that displays the location markers associated with the node being viewed, and an "Author map" block that displays a marker representing the node author's location.
......
......@@ -163,3 +163,21 @@ function gmap_location_update_5101() {
variable_del('gmap_geocode');
return $ret;
}
/**
* 5.x-1.1 update 1 (Still haven't diverged for 6.x.)
* #392130: Use better permission names.
*/
function gmap_location_update_5102() {
$ret = array();
$result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
while ($role = db_fetch_object($result)) {
$renamed_permission = preg_replace('/(?<=^|,\ )user\ locations(?=,|$)/', 'view user location details', $role->perm);
$renamed_permission = preg_replace('/(?<=^|,\ )show\ user\ map(?=,|$)/', 'view user map', $renamed_permission);
$renamed_permission = preg_replace('/(?<=^|,\ )show\ node\ map(?=,|$)/', 'view node map', $renamed_permission);
if ($renamed_permission != $role->perm) {
$ret[] = update_sql("UPDATE {permission} SET perm = '$renamed_permission' WHERE rid = $role->rid");
}
}
return $ret;
}
......@@ -28,7 +28,11 @@ function gmap_location_theme() {
* Implementation of hook_perm().
*/
function gmap_location_perm() {
return array('show user map', 'user locations', 'show node map');
return array(
'view node map',
'view user map',
'view user location details',
);
}
/**
......@@ -62,23 +66,23 @@ function gmap_location_menu() {
$items['map/user'] = array(
'type' => MENU_NORMAL_ITEM,
'title' => 'User locations',
'access arguments' => array('show user map'),
'access arguments' => array('view user map'),
'page callback' => 'gmap_location_user_page',
);
$items['map/user/load'] = array(
'type' => MENU_CALLBACK,
'access arguments' => array('show user map'),
'access arguments' => array('view user map'),
'page callback' => 'gmap_location_user_point',
);
$items['map/node'] = array(
'type' => MENU_NORMAL_ITEM,
'title' => 'Node locations',
'access arguments' => array('show node map'),
'access arguments' => array('view node map'),
'page callback' => 'gmap_location_node_page',
);
$items['map/node/load/%node/%'] = array(
'type' => MENU_CALLBACK,
'access arguments' => array('show node map'),
'access arguments' => array('view node map'),
'page callback' => 'gmap_location_node_point',
'page arguments' => array(3,4),
);
......@@ -141,9 +145,9 @@ function gmap_location_user_page() {
$marker = $markertypes[$row->role];
}
// Users with the 'user locations' permission are allowed to see who
// Users with the 'view user location details' permission are allowed to see who
// each marker represents.
if (user_access('user locations')) {
if (user_access('view user location details')) {
if ($mode == 1) {
$newmarker['rmt'] = $row->uid;
}
......@@ -165,7 +169,7 @@ function gmap_location_user_page() {
// @@@ Move to gmap_addons.
/*
if (user_access('user locations') && function_exists('buddylist_get_buddies') && count($locationbyuser)>0) {
if (user_access('view user location details') && function_exists('buddylist_get_buddies') && count($locationbyuser)>0) {
//create lines for buddies
if (!isset($thismap['shapes'])) {
$thismap['shapes']=array();
......@@ -303,7 +307,7 @@ function gmap_location_node_page($nid = NULL) {
if (is_numeric($nid) && $node = node_load($nid)) {
// Organic groups. Group nodes are displayed as a map of the users who belong to the group.
if (user_access('user locations') && function_exists('og_is_group_type') && og_is_group_type($node->type)) {
if (user_access('view user location details') && function_exists('og_is_group_type') && og_is_group_type($node->type)) {
$rolemarkers = variable_get('gmap_role_markers', array());
$map['markers'] = array(); // Reset markers.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment