Index: location.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/location.views.inc,v
retrieving revision 1.16
diff -u -r1.16 location.views.inc
--- location.views.inc	3 Dec 2008 22:51:23 -0000	1.16
+++ location.views.inc	23 Apr 2009 18:28:51 -0000
@@ -364,22 +364,81 @@
   );
 
 
-  // Tell the base tables about us.
-  $data['node']['table']['join']['location'] = array(
-    'left_table' => 'location_instance',
-    'left_field' => 'vid',
-    'field' => 'vid',
+  $data['location_instance']['nid'] = array(
+    'title' => t('Nodes'),
+    'help' => t('Relate a location to the nodes it is associated with.'),
+    'relationship' => array(
+      'base' => 'node',
+      'field' => 'nid',
+      'handler' => 'views_handler_relationship',
+      'label' => t('Location: User'), // @@@ Some sort of better name?
+      'extra' => array(
+        array(
+          'field' => 'nid',
+          'operator' => '!=',
+          'numeric' => TRUE,
+          'value' => 0,
+        ),
+      ),
+    ),
   );
-  $data['node_revisions']['table']['join']['location'] = array(
-    'left_table' => 'location_instance',
-    'left_field' => 'vid',
-    'field' => 'vid',
+
+  $data['location_instance']['vid'] = array(
+    'title' => t('Node Revisions'),
+    'help' => t('Relate a location to the node revisions it is associated with.'),
+    'relationship' => array(
+      'base' => 'node_revisions',
+      'field' => 'vid',
+      'handler' => 'views_handler_relationship',
+      'label' => t('Location: User'), // @@@ Some sort of better name?
+      'extra' => array(
+        array(
+          'field' => 'vid',
+          'operator' => '!=',
+          'numeric' => TRUE,
+          'value' => 0,
+        ),
+      ),
+    ),
   );
-  $data['users']['table']['join']['location'] = array(
-    'left_table' => 'location_instance',
-    'left_field' => 'uid',
-    'field' => 'uid',
+
+  $data['location_instance']['uid'] = array(
+    'title' => t('Users'),
+    'help' => t('Relate a location to the users it is associated with.'),
+    'relationship' => array(
+      'base' => 'users',
+      'field' => 'uid',
+      'handler' => 'views_handler_relationship',
+      'label' => t('Location: User'), // @@@ Some sort of better name?
+      'extra' => array(
+        array(
+          'field' => 'uid',
+          'operator' => '!=',
+          'numeric' => TRUE,
+          'value' => 0,
+        ),
+      ),
+    ),
   );
 
+  if (!variable_get('location_views_no_implicit_test', FALSE)) {
+    // Tell the base tables about us.
+    $data['node']['table']['join']['location'] = array(
+      'left_table' => 'location_instance',
+      'left_field' => 'vid',
+      'field' => 'vid',
+    );
+    $data['node_revisions']['table']['join']['location'] = array(
+      'left_table' => 'location_instance',
+      'left_field' => 'vid',
+      'field' => 'vid',
+    );
+    $data['users']['table']['join']['location'] = array(
+      'left_table' => 'location_instance',
+      'left_field' => 'uid',
+      'field' => 'uid',
+    );
+  }
+
   return $data;
 }

