Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chrissearle’s picture

Thought I'd have a look at this (would like to use it myself). I've got the install using the schema module, got file upload working (although I've temporarily lost the check that the filename is gpx right now - need to check the validators functionality for file_save_upload).

But - I am having a JS issue:

On node display - the javascript added to the footer is added OK - but - its not triggering an add of the drupal.js and jquery.js links to the head - so you get the error that $ is not defined

I've stepped thru the drupal_add_js function - they are being added to the js variables - so I suspect that its happening too late.

I've never run track on drupal 4 or 5 so I've not got a working copy to test against.

The code I'm hacking on is on http://dev.chrissearle.net/git/track.git

I'll keep digging on this - but be warned - its going to be a low priority - too much other stuff is going on both at work and at home right now.

gadzuk’s picture

Awesome! I'm working 6.x also, you're ahead of me so I'll jump in.

<?php
function track_validate_file(&$node) {
  $validators = array(
    'file_validate_extensions' => array('gpx'),
  );

  if ($file = file_save_upload('file', $validators)) {
...
?>

I posted a 5.x version last year that is still working fine for me
http://drupal.org/node/123909#comment-707510

5.x sample:
http://www.quadsquad.ca/?q=track

chrissearle’s picture

Excellent - I'll grab that later today ;)

I'll have to check your 5.x against HEAD (the last head comment from Gaby was "Drupal 5.x support"). But that will have to wait until this evening ;)

chrissearle’s picture

Well - while waiting for a meeting to start I just discovered something new. In the file_validate_extensions function there is this code here:

  // Bypass validation for uid  = 1.
  if ($user->uid != 1) {

Now that will teach me to test on a vanilla install with only one user.

I suspect at a later date we should also have a validator that tests for GPX complience.

However - meeting is about to start so I'll have to shelve this until this evening.

gadzuk’s picture

There's still a few NULL reference bugs in the 5.x HEAD that gaby didn't commit from my Jan 2008 5.x patch.

I've posted diff patch files between my 5.x and the HEAD
http://drupal.org/node/123909#comment-1260790

I'll do a compare of your tip revision to my working copy and post the diff.

gadzuk’s picture

Status: Active » Needs work
FileSize
20.9 KB
11.45 KB
51.96 KB

Getting very close now on Drupal 6.x.

Not thoroughly tested, not even alpha or dev quality but starting to converge and all seems to work except the GMAP.

Work-in-progress attached with two relative diff patches (wrt this project's head, and wrt Chris' tip revision)

gadzuk’s picture

Status: Needs work » Needs review
FileSize
52.58 KB
12.61 KB

Got it! GMAPs working, menus fixed, divide by zeros and null references fixed, missing pushpin added.

Ready for review and testing.

To do:
- still too much settings overlap with GMAP
- review for security and robustness with 6.x
- optimization (lots of callbacks)
- externalize theme and language
- add in the waypoint / markers enhancement #135725: Track vs. this patch

chrissearle’s picture

Excellent - will check that last patch today ;)

Gaby’s picture

First, sorry to not be active on this module...

Please administrators, create a cvs account for gadzuk. I will then give him cvs access to track module.
Thanks a lot.

chrissearle’s picture

I grabbed track6x.tar_.gz

I'm still getting the error in firebug:

$ is not defined
$(document).ready(function() {

drupal-6?q=node/3... (line 106)

This is the javascript in the footer. There is no include of drupal.js or jquery.js in the head section. This is drupal 6.9 with two custom modules only - gmap and track.

I may just scratch the whole install and start again ;)

AjK’s picture

@Gaby, CVS account created.

gadzuk’s picture

Hold up on the reinstall, I'm having no trouble reproducing today.

Wonder what was different last night? I tried the obligatory cache->clear.

Oh. If I uncheck the track module, submit, re-check and submit it starts working.... strange.

Now I can't make the problem happen again. Can you please confirm that install / uninstall makes it work?

gadzuk’s picture

FileSize
52.59 KB

Fixed one problem with a missing leading slash for the flash graphs callbacks, but am back to not being able to reproduce the GMAP failure. Did a fresh install, still not failing. I'm suspecting a cache problem despite doing a clear cache but if you're willing could you please check this minor revision?

If the GMAP doesn't work can you please do a view / source and let me know if you're seeing this in the header?

<script src="http://maps.google.com/maps?file=api&amp;v=2.115&amp;key=ABQIAAAAGiw...

If the flash graphs aren't working please post back with the lines invoking the SWF

I now have CVS access, thanks gaby! The HEAD version is now 6.x development (I hope)

chrissearle’s picture

FileSize
8.2 KB

Hmm.

Reinstalled - and edited an existing node. It had lost its gpx file connection - so I re-uploaded the file (this could well be due to using devel reinstall module or similar - so I'm not too bothered).

Still not seeing a map - but I am seeing much much more in the head.

I have to run to work right now - but attached - the HTML source (just in case its interesting). Could well be that I'm missing something obvious (not having run this at 4.x or with the 5.x trunk I've never seen it actually work so I could have missed a step somewhere).

Congrats on CVS access btw ;)

gadzuk’s picture

The HTML looks good. Are you seeing the flash graphs?

Please try this URL and let me know what you see (should be XML formatted coords for the GMAP)
/~chris/drupal/drupal-6/track/ajax/detail/38/

chrissearle’s picture

Getting

<?xml version="1.0" encoding="UTF-8"?>
<xmldata>
</xmldata>

I really do think I want to scratch this install ;) Its had so much strange stuff on it I'd rather not slow this issue with non-related issues.

I'll install a scratch clean 6.9 and then gmap and track from CVS head - then we'll see.

BTW - no - i see nothing other than title and body - no map - no flash - no nothing.

gadzuk’s picture

I did a fresh install yesterday a couple of directories down from my sites's wwwroot. The map worked fine with the latest release above. From what you're getting it looks like the callback menu / URL is well constructed but the system isn't finding the GPX.

But the flash charts said loading and then froze. The "dataURL" argument to the track/profile and track/repartition was valid. But to get the charts to work I had to put 1/2 dozen "../../../.." in front of the url to make it work. Have to think more about the context and how to use relative URLs for arguments.

chrissearle’s picture

Well - d.o is back up now - so I can grab a new 6.9 and stick the CVS head on.

My first wish is to get the same behaviour as you so that we can at least get consistency in debugging ;)

chrissearle’s picture

gadzuk’s picture

Perfect, I'm having the same (reproducable) problem with the charts ;-`)

Note that I'm having a bit of trouble getting my head around Drupal / CVS / releases. I'm checking into head but the automatic builds aren't working yet.

The link generated by the latest module for charts (from view / source)
http://demo.chrissearle.net/track_test/sites/all/modules/custom/track/mi...

Only works if t's changed to:
http://demo.chrissearle.net/track_test/sites/all/modules/custom/track/mi...

So the relative url handling of the dataURL argument by the chart component itself is a bit of a mystery when a site is installed under a directory folder below wwwroot. Works fine for a site installed at wwwroot. I suppose that sort of makes sense because the base URL for FC2Line.swf is deep.

Thought this might be a bug so looked for an update. But the latest free version of these flash charts no longer includes the 3D area chart that's used for the profile.

chrissearle’s picture

Regards builds - http://drupal.org/handbook/cvs/quickstart - especially the bit about branches/tags - goes into generating builds/dev builds etc.

Those charts - hmm - the following also works:

http://demo.chrissearle.net/track_test/sites/all/modules/custom/track/mi...

Isn't that just dataUrl=$base_path/track/profile/id

?

chrissearle’s picture

Oh - watch out for base_path = / - we don't want a double //

chrissearle’s picture

Hmm.

Well - http://demo.chrissearle.net/track_test/sites/all/modules/custom/track/mi... works

But - when I apply the attached patch file the embedded view on the node display still fails.

Patch inline since the attach button is not working and it says to use Preview to attach files (which is failing too).

Index: track.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/track/track.module,v
retrieving revision 1.8
diff -u -p -r1.8 track.module
--- track.module        18 Feb 2009 04:16:36 -0000      1.8
+++ track.module        19 Feb 2009 17:19:40 -0000
@@ -510,6 +510,8 @@ function track_access($op, $node) {
 }
 
 function track_flash_chart($width, $height, $nid, $type) {
+  global $base_path;
+
   $swf = "FC2Line.swf";
   if ($type == "repartition")
    $swf = "FC2Column.swf";
@@ -517,7 +519,7 @@ function track_flash_chart($width, $heig
   $output .= '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
   $output .= 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
   $output .= 'WIDTH="'.$width.'" HEIGHT="'.$height.'" id="FC2Area3D" ALIGN="">';
-  $output .= '<PARAM NAME=movie VALUE="/'.TRACK_PATH.'/misc/'.$swf.'?dataUrl=/track/'.$type.'/'.$nid.'">';
+  $output .= '<PARAM NAME=movie VALUE="/'.TRACK_PATH.'/misc/'.$swf.'?dataUrl='. $base_path . 'track/'.$type.'/'.$nid.'">';
   $output .= '<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF>';
   $output .= '<EMBED src="/'.TRACK_PATH.'/misc/'.$swf.'?dataUrl=/track/'.$type.'/'.$nid.'" quality=high ';
   $output .= 'bgcolor=#FFFFFF WIDTH="'.$width.'" HEIGHT="'.$height.'" NAME="FC2Area3D" ';
gadzuk’s picture

After re-reading the W3 spec on relative URLs and parameters I think that code should work.

FusionCharts help file is here: http://www.fusioncharts.com/free/docs/

Couple of tips to follow up on under "Debugging Charts"

- If you've to pass parameters to your dataURL data provider page from FusionCharts, make sure they're URLEncoded in the dataURL, when providing to FusionCharts. e.g., if your dataURL needs to be Data.asp?id=43&subId=454, you'll need to URL Encode it so that it becomes Data%2Easp%3Fid%3D43%26subId%3D454. Only then FusionCharts will invoke the URL with proper parameters appended to it.

- Since parameter query string passed to the server side script contains characters like ?, & etc. , you need to URL Encode the entire dataURL. For example, if you want to provide data URL as Data.asp?id=1&subId=2, it should be provided as Data%2Easp%3Fid%3D1%26subId%3D2. In JavaScript you can use escape(dataURL) function. In ASP and ASP.NET pages you can use Server.URLEncode(dataURL) function. In PHP pages you can use urlencode(dataURL) function.

- When using dataURL method, make sure that the SWF File and data provider page are on the same sub-domain. Due to Flash's sandbox security model, it cannot access data from external domains, unless otherwise configured

The Javascript approach might be something to try, do a view/source on this sample:
http://www.fusioncharts.com/free/docs/Gallery/Column3D.html.

Note the relative URLs.

<script type="text/javascript">
		   var chart = new FusionCharts("../Charts/FCF_Column3D.swf", "ChartId", "600", "350");
		   chart.setDataURL("Data/Column3D.xml");		   
		   chart.render("chartdiv");
		</script> 
chrissearle’s picture

FileSize
1.64 KB

I may just have spotted it - hang on

Yay!

Check http://demo.chrissearle.net/track_test/node/1

Tips:

1) Remember that both OBJECT and EMBED need changes - not just one
2) Remember that the $base_path is needed both in the dataaUrl AND the path to the SWF file.

Patch attached I hope (they're still having issues it seems)

gadzuk’s picture

Status: Needs review » Reviewed & tested by the community

That's awesome, working great for me too!

Committed to HEAD.

chrissearle’s picture

Have we reached the stage of wanting a 6.x-1.x-dev build to help others test?

If so - we'll need a 6.x branch in CVS and a project release node for the dev build to trigger the build of nightlies.

gadzuk’s picture

Status: Reviewed & tested by the community » Fixed

Definitely ready for a dev release, we should probably close this issue and start new ones for defects as found.

The 6.x branch is there in CVS but dev releases are automated and happen only every 12 hrs so should kick out in the next couple if the recent site upgrade didn't break anything.

Status: Fixed » Closed (fixed)

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