diff -urpN trackchris/INSTALL.txt track/INSTALL.txt
--- trackchris/INSTALL.txt 2009-02-16 02:26:53.000000000 -0600
+++ track/INSTALL.txt 2009-02-16 10:02:57.000000000 -0600
@@ -3,3 +3,9 @@
- 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 trackchris/.INSTALL.txt.swp and track/.INSTALL.txt.swp differ
diff -urpN trackchris/misc/map.inc.js track/misc/map.inc.js
--- trackchris/misc/map.inc.js 2009-02-16 02:26:53.000000000 -0600
+++ track/misc/map.inc.js 2009-02-16 10:00:26.000000000 -0600
@@ -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]);
+ }
}
}
Binary files trackchris/misc/.map.inc.js.swp and track/misc/.map.inc.js.swp differ
diff -urpN trackchris/track.gpx.inc track/track.gpx.inc
--- trackchris/track.gpx.inc 2009-02-16 02:26:53.000000000 -0600
+++ track/track.gpx.inc 2009-02-16 09:55:48.000000000 -0600
@@ -1,5 +1,5 @@
-// $Id: track.gpx.inc,v 1.5 2008/01/29 13:47:30 gaby Exp $
+// $Id: track.gpx.inc,v 1.4 2006/11/10 22:04:55 gaby Exp $
class GPX_file {
var $coordonnees = array();
@@ -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 trackchris/track.module track/track.module
--- trackchris/track.module 2009-02-16 02:26:53.000000000 -0600
+++ track/track.module 2009-02-16 17:36:59.000000000 -0600
@@ -8,6 +8,7 @@
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 = "";
@@ -27,41 +28,62 @@ function track_add() {
function track_menu() {
$items = array();
+ $items['track'] = array(
+ 'title' => 'Track list',
+ 'page callback' => 'list_trk',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK);
+// $items['track/add'] = array(
+// 'title' => 'Track upload',
+// 'page callback' => 'track_add',
+// 'access' => user_access('Create tracks'),
+// 'type' => MENU_CALLBACK);
$items['track/trk'] = array(
- 'callback' => 'download_trk',
- 'access' => true,
+ 'page callback' => 'download_trk',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
$items['track/kml'] = array(
- 'callback' => 'download_kml',
- 'access' => true,
+ 'page callback' => 'download_kml',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
$items['track/gpx'] = array(
- 'callback' => 'download_gpx',
- 'access' => true,
+// 'title' => 'Track GPX',
+ 'page callback' => 'download_gpx',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
$items['track/icon'] = array(
- 'callback' => 'get_icon',
- 'access' => true,
+ 'page callback' => 'get_icon',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
$items['track/ajax/all'] = array(
- 'callback' => 'trackback_all',
- 'access' => true,
+ 'page callback' => 'trackback_all',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
$items['track/ajax/detail'] = array(
- 'callback' => 'trackback_detail',
- 'access' => true,
+ 'page callback' => 'trackback_detail',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
$items['track/profile'] = array(
- 'callback' => 'trackback_profile',
- 'access' => true,
+ 'page callback' => 'trackback_profile',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
$items['track/repartition'] = array(
- 'callback' => 'trackback_repartition',
- 'access' => true,
+ 'page callback' => 'trackback_repartition',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
$items['track/boundslist'] = array(
- 'callback' => 'track_boundslist',
- 'access' => true,
+ 'page callback' => 'track_boundslist',
+ 'access callback' => 'user_access',
+ 'access arguments' => array('access content'),
'type' => MENU_CALLBACK);
return $items;
@@ -92,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);
@@ -127,7 +149,6 @@ function get_icon($diff) {
}
function trackback_detail($nid) {
- include_once(drupal_get_path('module', 'track') ."/track.google.map.inc");
// create interface object with map
$aMap = new GoogleMap();
// init all values
@@ -208,7 +229,6 @@ function trackback_detail($nid) {
}
function trackback_all() {
- include_once(drupal_get_path('module', 'track') ."/track.google.map.inc");
// create interface object with map
$aMap = new GoogleMap();
// init all values
@@ -369,8 +389,12 @@ 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";
@@ -487,9 +511,9 @@ function track_flash_chart($width, $heig
$output .= '