diff -urpN trackhead/INSTALL.txt track/INSTALL.txt
--- trackhead/INSTALL.txt 2009-02-16 06:39:47.000000000 -0600
+++ track/INSTALL.txt 2009-02-16 10:02:57.000000000 -0600
@@ -1,5 +1,11 @@
-// $Id: INSTALL.txt,v 1.3 2006/10/24 17:15:06 gaby Exp $
+// $Id: INSTALL.txt,v 1.4 2008/01/29 13:47:30 gaby Exp $
- Install the GMAP module
- Put all files inside your module directory
- Activate the module and change create tracks auth.
+
+Note:
+- Does not work correctly with Drupal caching for the
+ main track list. For now be sure to disable caching until
+ somebody figures out a better way to turn off caching of links
+ under http://mysite/track/...
Binary files trackhead/.INSTALL.txt.swp and track/.INSTALL.txt.swp differ
diff -urpN trackhead/misc/map.inc.js track/misc/map.inc.js
--- trackhead/misc/map.inc.js 2009-02-16 06:42:14.000000000 -0600
+++ track/misc/map.inc.js 2009-02-16 10:00:26.000000000 -0600
@@ -1,4 +1,4 @@
-// $Id: map.inc.js,v 1.4 2006/11/10 22:04:55 gaby Exp $
+// $Id: map.inc.js,v 1.5 2008/01/29 13:47:30 gaby Exp $
function MapClass()
{
@@ -71,7 +71,7 @@ function MapClass()
function processXMLnode(marker) {
if (marker.getAttribute("type") == "alert") {
- alert(marker.getAttribute("alert"));
+ // alert(marker.getAttribute("alert"));
}
if (marker.getAttribute("type") == "point") {
addMarker(marker);
@@ -94,8 +94,9 @@ function MapClass()
map.clearOverlays();
}
if (marker.getAttribute("type") == "clearlasttrace") {
-// FIXME Causes NULL reference
-// map.removeOverlay(lasttrace);
+ if (lasttrace != null) {
+ map.removeOverlay(lasttrace);
+ }
}
if (marker.getAttribute("type") == "move") {
map.setCenter(new GLatLng(parseFloat(marker.getAttribute("y")), parseFloat(marker.getAttribute("x"))), 17 - parseFloat(marker.getAttribute("zl")));
@@ -106,11 +107,15 @@ function MapClass()
}
function processxmlDoc(xmlDoc) {
- var markers = xmlDoc.documentElement.getElementsByTagName("data");
- markerstoadd = [];
-
- for (var i = 0; i < markers.length; i++) { // er"<"erg<>
- processXMLnode(markers[i]);
+ if (xmlDoc.documentElement != null) {
+ var markers = xmlDoc.documentElement.getElementsByTagName("data");
+ markerstoadd = [];
+
+ //alert("ok!");
+
+ for (var i = 0; i < markers.length; i++) { // er"<"erg<>
+ processXMLnode(markers[i]);
+ }
}
}
diff -urpN trackhead/track.gpx.inc track/track.gpx.inc
--- trackhead/track.gpx.inc 2009-02-16 06:44:25.000000000 -0600
+++ track/track.gpx.inc 2009-02-16 09:55:48.000000000 -0600
@@ -331,31 +331,31 @@ class GPX_file {
for ($i=0; $i<10; $i++) {
$tot += $datay[$i];
}
- echo ""; //<-10%
+ echo ""; //<-10%
$tot = 0;
for ($i=10; $i<19; $i++) {
$tot += $datay[$i];
}
- echo ""; //(entre -10% et -2%)
+ echo ""; //(entre -10% et -2%)
$tot = 0;
for ($i=19; $i<22; $i++) {
$tot += $datay[$i];
}
- echo ""; // (entre -2% et 2%)
+ echo ""; // (entre -2% et 2%)
$tot = 0;
for ($i=22; $i<31; $i++) {
$tot += $datay[$i];
}
- echo ""; //(entre 2% et 10%)
+ echo ""; //(entre 2% et 10%)
$tot = 0;
for ($i=31; $i<41; $i++) {
$tot += $datay[$i];
}
- echo ""; //(>10%)
+ echo ""; //(>10%)
echo "";
}
@@ -555,7 +555,7 @@ H LATITUDE LONGITUDE DATE TI
xml_set_element_handler($xml_parser, array(&$this,"debutElement"), array(&$this,"finElement"));
xml_set_character_data_handler($xml_parser, array(&$this,"characterData"));
if (!($fp = fopen($filename, "r"))) {
- die("Impossible d'ouvrir le fichier.");
+ die("Can't open file: ".$filename);
}
while ($data = fread($fp, 4096)) {
diff -urpN trackhead/track.info track/track.info
--- trackhead/track.info 2009-02-16 06:44:54.000000000 -0600
+++ track/track.info 2009-02-16 09:58:03.000000000 -0600
@@ -1,5 +1,7 @@
-; $Id$
+; $Id: track.info,v 1.1 2008/01/29 13:47:30 gaby Exp $
name = Track
description = The track module can display GPS tracklogs inside a node. Users submit tracklogs in GPX format, the system renders those tracklogs on Google Maps and dynamically generates elevation profiles
-dependencies = gmap
+dependencies[] = gmap
package = "Location"
+
+core = 6.x
\ No newline at end of file
diff -urpN trackhead/track.install track/track.install
--- trackhead/track.install 2006-11-10 16:04:55.000000000 -0600
+++ track/track.install 2009-02-16 09:52:23.000000000 -0600
@@ -1,41 +1,41 @@
-
+ array(
+ 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'disp-width' => '10'),
+ 'filename' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE),
+ 'filepath' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE),
+ 'latstart' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'lonstart' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'latmin' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'latmax' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'lonmin' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'lonmax' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'length' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'dzminu' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'dzplus' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'zmin' => array('type' => 'float', 'not null' => TRUE, 'default' => '0'),
+ 'zmax' => array('type' => 'float', 'not null' => TRUE, 'default' => '0')),
+ );
+
+ return $schema;
+}
diff -urpN trackhead/track.module track/track.module
--- trackhead/track.module 2009-02-16 06:46:11.000000000 -0600
+++ track/track.module 2009-02-16 17:36:59.000000000 -0600
@@ -1,13 +1,14 @@
-// $Id: track.module,v 1.6 2006/11/10 22:04:55 gaby Exp $
+// $Id: track.module,v 1.7 2008/01/29 13:47:30 gaby Exp $
/**
* @file
* GPX-handling and displaying.
*/
-include_once("modules/track/track.gpx.inc");
-include_once("modules/track/track.tile.inc");
+include_once(drupal_get_path('module', 'track') ."/track.gpx.inc");
+include_once(drupal_get_path('module', 'track') ."/track.tile.inc");
+include_once(drupal_get_path('module', 'track') ."/track.google.map.inc");
$phptrackback = "";
@@ -22,64 +23,67 @@ function track_add() {
}
/**
- * Implementation of hook_menu.
+ * Implementation of hook_menu().
*/
-function track_menu($may_cache) {
+function track_menu() {
$items = array();
- if ($may_cache) {
- $items[] = array('path' => 'track', 'callback' => 'list_trk', 'title' => t('Track list'), 'access' => true);
- $items[] = array('path' => 'track/add', 'callback' => 'track_add', 'title' => t('Track upload'), 'access' => user_access('Create tracks'));
- }
- $items[] = array(
- 'path' => 'track/trk',
- 'callback' => 'download_trk',
- 'access' => true,
+ $items['track'] = array(
+ 'title' => 'Track list',
+ 'page callback' => 'list_trk',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
- $items[] = array(
- 'path' => 'track/kml',
- 'callback' => 'download_kml',
- 'access' => true,
+// $items['track/add'] = array(
+// 'title' => 'Track upload',
+// 'page callback' => 'track_add',
+// 'access' => user_access('Create tracks'),
+// 'type' => MENU_CALLBACK);
+ $items['track/trk'] = array(
+ 'page callback' => 'download_trk',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
- $items[] = array(
- 'path' => 'track/gpx',
- 'callback' => 'download_gpx',
- 'access' => true,
+ $items['track/kml'] = array(
+ 'page callback' => 'download_kml',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
-
- $items[] = array(
- 'path' => 'track/icon',
- 'callback' => 'get_icon',
- 'access' => true,
+ $items['track/gpx'] = array(
+// 'title' => 'Track GPX',
+ 'page callback' => 'download_gpx',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
-
- $items[] = array(
- 'path' => 'track/ajax/all',
- 'callback' => 'trackback_all',
- 'access' => true,
+ $items['track/icon'] = array(
+ 'page callback' => 'get_icon',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
-
- $items[] = array(
- 'path' => 'track/ajax/detail',
- 'callback' => 'trackback_detail',
- 'access' => true,
+ $items['track/ajax/all'] = array(
+ 'page callback' => 'trackback_all',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
-
- $items[] = array(
- 'path' => 'track/profile',
- 'callback' => 'trackback_profile',
- 'access' => true,
+ $items['track/ajax/detail'] = array(
+ 'page callback' => 'trackback_detail',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
- $items[] = array(
- 'path' => 'track/repartition',
- 'callback' => 'trackback_repartition',
- 'access' => true,
+ $items['track/profile'] = array(
+ 'page callback' => 'trackback_profile',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
-
- $items[] = array(
- 'path' => 'track/boundslist',
- 'callback' => 'track_boundslist',
- 'access' => true,
+ $items['track/repartition'] = array(
+ 'page callback' => 'trackback_repartition',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK);
+ $items['track/boundslist'] = array(
+ 'page callback' => 'track_boundslist',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
return $items;
@@ -110,13 +114,13 @@ function get_icon($diff) {
header("Content-type: image/png");
if ($diff == "S") {
- $image_name = "modules/track/misc/pushpins/058.png";
+ $image_name = drupal_get_path('module', 'track') ."/misc/pushpins/058.png";
} elseif ($diff == "M") {
- $image_name = "modules/track/misc/pushpins/150.png";
+ $image_name = drupal_get_path('module', 'track') ."/misc/pushpins/150.png";
} elseif ($diff == "L") {
- $image_name = "modules/track/misc/pushpins/011.png";
+ $image_name = drupal_get_path('module', 'track') ."/misc/pushpins/011.png";
} else {
- $image_name = "modules/track/misc/pushpins/007.png";
+ $image_name = drupal_get_path('module', 'track') ."/misc/pushpins/007.png";
}
$im = imagecreatefrompng($image_name);
@@ -145,7 +149,6 @@ function get_icon($diff) {
}
function trackback_detail($nid) {
- include_once("modules/track/track.google.map.inc");
// create interface object with map
$aMap = new GoogleMap();
// init all values
@@ -170,8 +173,8 @@ function trackback_detail($nid) {
$zoomlevellon = 17;
while ($angle>$varlon)
{
- $angle = $angle / 2;
- $zoomlevellon--;
+ $angle = $angle / 2;
+ $zoomlevellon--;
}
$varlat = max(1e-5, $latmax - $latmin);
@@ -179,8 +182,8 @@ function trackback_detail($nid) {
$zoomlevellat = 17;
while ($angle>$varlat)
{
- $angle = $angle / 2;
- $zoomlevellat--;
+ $angle = $angle / 2;
+ $zoomlevellat--;
}
$zoomlevel = max(0, max($zoomlevellat, $zoomlevellon));
@@ -200,10 +203,10 @@ function trackback_detail($nid) {
$track = node_load($nid);
$desc = theme('info_window_html', $track);
$aMap->AddTrace($points, "#ff0000", 3, 0.8);
-
+
$intensite = $track->file->dzplus / ($track->file->length / 4);
$intensite = ($intensite - 30) * (100 / 40);
-
+
if ($intensite < 30) {
$mapicon = base_path()."track/icon/S";
}
@@ -226,7 +229,6 @@ function trackback_detail($nid) {
}
function trackback_all() {
- include_once("modules/track/track.google.map.inc");
// create interface object with map
$aMap = new GoogleMap();
// init all values
@@ -253,8 +255,8 @@ function trackback_all() {
$zoomlevellon = 17;
while ($angle>$varlon)
{
- $angle = $angle / 2;
- $zoomlevellon--;
+ $angle = $angle / 2;
+ $zoomlevellon--;
}
$varlat = max(1e-5, $latmax - $latmin);
@@ -262,8 +264,8 @@ function trackback_all() {
$zoomlevellat = 17;
while ($angle>$varlat)
{
- $angle = $angle / 2;
- $zoomlevellat--;
+ $angle = $angle / 2;
+ $zoomlevellat--;
}
$zoomlevel = max(0, max($zoomlevellat, $zoomlevellon));
@@ -281,7 +283,7 @@ function trackback_all() {
if ($result) {
while ($track = db_fetch_object($result)) {
$desc = theme('info_window_html', $track);
-
+
$intensite = $track->dzplus / ($track->length / 4);
$intensite = ($intensite - 30) * (100 / 40);
@@ -336,7 +338,7 @@ function theme_info_details($track) {
function prepare_google_maps() {
$key = variable_get('googlemap_api_key', 'AAAAAAAAAAA');
$basepath = $GLOBALS['base_path'];
- drupal_add_js('modules/track/misc/map.inc.js');
+ drupal_add_js(drupal_get_path('module', 'track') .'/misc/map.inc.js');
$GLOBALS['base_path'] = "";
drupal_set_html_head('');
$GLOBALS['base_path'] = $basepath;
@@ -387,9 +389,13 @@ function track_page_last() {
$row[] = sprintf('%2.2f', $track->file->dzplus)." m";
$row[] = sprintf('%2.2f', $track->file->dzminu)." m";
- $intensite = $track->file->dzplus / ($track->file->length / 4);
- $intensite = ($intensite - 30) * (100 / 40);
-
+ if ($track->file->length != 0) {
+ $intensite = $track->file->dzplus / ($track->file->length / 4);
+ $intensite = ($intensite - 30) * (100 / 40);
+ } else {
+ $intensite = 0.0;
+ }
+
if ($intensite < 30) {
$sint = "S";
}
@@ -430,7 +436,7 @@ function list_trk() {
$content .= '
| ';
$content .= ' '.t("Loading").'...'.' ';
$content .= ' |
';
-
+
$content .= track_page_last();
return $content;
@@ -461,10 +467,10 @@ function track_perm() {
}
/**
- * Implementation of hook_help.
+ * Implementation of hook_help().
*/
-function track_help($section) {
- switch ($section) {
+function track_help($path, $arg) {
+ switch ($path) {
case 'node/add#track':
return t('Upload new track.');
}
@@ -505,9 +511,9 @@ function track_flash_chart($width, $heig
$output .= '