In both Safari 2 and Firefox 2 I get a 404 error for /todolist/create_task. When I manually go to that URL I get a blank screen even with display_errors = On in my php.ini.

Any ideas? I'd love to get this going. This is on a stock Drupal 5.1 installation with no other contrib modules enabled (except JQuery Update and Interface, of course).

Comments

ms2011’s picture

Version: » 5.x-1.x-dev

I just set up a new Drupal 5.1 installation w/ todolist, jquery_update, jquery_interface installed--and it is working for me with Firefox 2.0 and Windows XP. Could the problem you are experiencing could be a configuration or browser issue?

Suggestions:

  • Are clean URLs enabled/disabled? I assume they are enabled since you got the blank screen instead of 'Page not found'.
  • Did you copy the jQuery.js file to the /misc directory when you installed jquery_update? I assume you did, because otherwise you wouldn't be able to click on the collapsible fieldset for "Add new task".

The blank screen is by design, if you have not provided all the parameters the /todolist/create_task callback is looking for. Try this, instead:

/todolist/create_task?nid=1&order=1&task=one

You should get a response similar to the following:

TodoList.add_incomplete_list();
$('.todolist.incomplete').append('<li class="task" id="task-5"><input type="checkbox" name="task-5" /></li>');
$('#task-5').each(TodoList.add_nub);
$('#task-5').each(TodoList.bind_task);
$('#task-5').Highlight(1000, '#ff0');
$('.todolist.incomplete').SortableAddItem($('#task-5').get(0));

And this would indicate that the module is working correctly under normal circumstances.

Questions:

  • When and where do you see the 404 error? I use the Firebug extension for Firefox to show me the AJAX activity going on behind the scenes. If you don't have this installed, I don't think you'd normally be able to see an error like that. UNLESS it is redirecting the browser to a 404 page when you click the "Add this task" button; in which case, that'd definitely be a problem I can fix.

    The strange part about your experience is that you get 404 when you click on "Add this task" but not when you visit the URL directly in your browser--the blank screen means HTTP Status code 200 OK and no further data (which is the correct response to the wrong parameters)

  • Which OS are you using? I am assuming since you have Safari that you're running Mac OS X. Admittedly, I have not tested the code in Safari, and I know it doesn't work in IE7 currently, but Firefox 2.0 should work regardless of the OS...
stborchert’s picture

Status: Active » Needs review
StatusFileSize
new2.07 KB

Hi.
First to say: very nice little module.
The error is located in todolist.js. All urls begin with a slash! This did not work on most installations (for example on sub-dirs or on IIS).
I've created a patch that fixes this by replacing the slash with index.php?q=.

hth,

Stefan

ms2011’s picture

@Stefan: Thanks for the patch! I tested it and it works. There is only one thing I wish we could do to improve it. Currently, with your patch, the XMLHTTPRequest object will try to POST to different paths depending on where you are, like:

http://domain.tld/node/index.php?q=todolist/create_task
http://domain.tld/taxonomy/term/index.php?q=todolist/create_task

...and that works, but the path is not exactly where the file should be found. Technically, if there were a directory that existed in that location, it would fail because mod_rewrite wouldn't redirect to /index.php when the file appears to exist. Ideally, you would always have something like this:

http://domain.tld/index.php?q=todolist/create_task

Except in cases where your Drupal installation resides in a sub-directory. That does indeed throw in a monkey wrench unless we can utilize a Drupal function like url()...

I have tried renaming the .js file to .js.php and bootstrapping drupal when the file is called directly, but then Drupal thinks the base_path() is the module directory, and generates url() incorrectly. So, for now, I'll commit this patch to HEAD because it does work, but hopefully down the road we'll find a way to accomplish the ideal solution I described above.

Patch committed to HEAD. Thanks for your contribution! :)

@christefano: Does this solve your problem?

Christefano-oldaccount’s picture

The above patch breaks Todolist for me when the site is in the web root. I get 404 and too many recursion errors.

I'm not sure what you mean about HEAD. The only release I see is 5.x-dev.

Regarding my earlier post, I was getting the 404 error with Todolist when my test site was in a subdirectory. Todolist works wonderfully when I test on a site installed in the web root. Cool!

Christefano-oldaccount’s picture

Status: Needs review » Needs work
stborchert’s picture

Status: Needs work » Needs review
StatusFileSize
new2.75 KB

Well, here's another try.
You don't need to get the base url via drupal, you can do it all with jQuery :-)

Tested with and without sub-dirs and it works fine.
The patch applies to 5.x-1.x-dev.

greetings,

Stefan

Christefano-oldaccount’s picture

Status: Needs review » Needs work

Thanks for the patch. I just got to testing it.

patching file /www/drupal/sites/all/modules/todolist/todolist.js
Hunk #1 FAILED at 23.
Hunk #2 FAILED at 64.
Hunk #3 FAILED at 77.
Hunk #4 FAILED at 90.
Hunk #5 FAILED at 104.
Hunk #6 FAILED at 114.
6 out of 7 hunks FAILED -- saving rejects to file /www/drupal/sites/all/modules/todolist/todolist.js.rej
ms2011’s picture

Status: Needs work » Fixed

Works for me! Committed to CVS.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

kulfi’s picture

Status: Closed (fixed) » Active

Still getting this error.

asak’s picture

I'm getting a white screen too.

found this code, but seems there is some other problem.

marvil07’s picture

Version: 5.x-1.x-dev » 6.x-1.0-beta1
Status: Active » Fixed

5.x in no more maintained, so, like on 6.x it's solved I'm closing this

Status: Fixed » Closed (fixed)

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