This blog has moved here: woorkup.com | FOLLOW ME ON TWITTER @woork
Thursday, October 25, 2007

## MyToDoList PHP: an open source to-do list written in PHP and AJAX

myToDoListPHP is a simple To-Do list that I am developing using PHP, MySQL and Ajax adding continuous improvements. You can add/delete tasks, and mark a task completed. You can also reuse the code in your projects to simplify your work.

Update history Update november 16, 2007

• scriptacuolus effects and notes added october 27, 2007
• ajax search engine added november 1, 2007
• update to version 0.3 november 11, 2007
• update to ver 0.3a: I have solved some issues and added a filter for completed task november 14, 2007
• update to version 0.4 november 15, 2007
• update to version 0.5, added set task prioriy and % of completion november 16, 2007

Code Update

Max Pozdeev MyTinyTodoList Website
MyTinyTodoList Demo

This is some application's screenshots:

The search engine, find task and user while you type:

Content
The package is composed from these files:
• 1. todolist.php (the application's page)
• 2. ajax_framework.js (javascript functions for Ajax functionalities)
• 3. dbconnection.php (contains mySQL parameters for the connection to database. You have to change the default values with your parameters.)
• 7. createDBtable.php (you can use this file to create automatically the database table)
• 8. Scriptaculous folder (enable scriptaculous effects) october 27, 2007
• 9. saveNote.php (you can add a note for each task) october 27, 2007
• 10. in-showTask.php (code optimization) november 1, 2007
• 11. insertUser.php (add a new user) november 11, 2007
• 12. in-userRow.php (code optimization) november 11, 2007
• 13. in-lineBar.php (code optimization) november 14, 2007
• 14. in-sqlProperties.php (enable filter for completed tasks using an SQL parameter) november 14, 2007
• 14. in-hideCompleteTask.php (save preference show/hide completed tasks into database) november 14, 2007

Step 1: create a new MySQL database using myAdminPhp
First step, you have to create a new MySQL database using myAdminPHP and modify the connection's parameters ($db_host,$db_name, $username,$password) into the file dbconnection.php in this way:

<?php
// REQUIRED! Parameters to connecto to your DB
// CHANGE ONLY $db_host,$db_name, $username,$password
$db_host="localhost";$db_name="woork";
$username="root";$password="root";

// DON'T CHANGE THE REST!
$db_con=mysql_connect($db_host,$username,$password);
$connection_string=mysql_select_db($db_name);
mysql_connect($db_host,$username,$password); mysql_select_db($db_name);
?>

Step 2: create the database table using createDBtable.php

Step 3: run the application!
Open todolist.php with you browser and try the application!

porjo said...

Thanks for the script, it's exactly what I've been looking for. I had tried more elaborate project management systems, but they are overkill - this is nice and simple. I love the drag-and-drop capability!

Jan said...

Hi! I find this script very useful!
I have a question though, on your list of update history you say the following: "sortable task with drag and drop added october 30, 2007"
but i can't seem to find how this works and at the bottom of the page it says "Powered by MyToDoListPHP V 0.3". Percentage and priorities are working though, so I must have 0.5. Any ideas?
Thanks again!

Anonymous said...

hi, i just try out your application. nice and actually u did great work of ajax!

But i getting trouble on how to insert image in this application. I mean, I just want to put an icon to replace the button but fail to view it. I'm just new in Ajax, may u assist me?

kotakasut@yahoo.com.my

Efrain said...

This is really cool!

I have a question... I see that when adding a new user it has an input field to assign a password to that particular user but what is that for? I don't see any login page.

bringsjord said...

I really like this tool. Excellent!

I get some browser errors, but it seems to work. I'm using IE7 and Firefox 2.0.0.12. I've emailed you the screenshot showing the errors.

Thanks!

cdb said...

I like this tool, however, I am getting errors as well.

Line: 142
Char: 2
Error: Unknown runtime error

Any ideas why this is? I am using IE 7, and Mozilla 2.0.0.12.

Thanks.

Anonymous said...

Thanks, that's neat!

How could I get the script work on iso-8859-1 charset instead of utf-8 charset?

Anonymous said...

PS:Got it work with ISO by leaving UTF-8 and changing special characters to for example ä .

I still get runtime error 142 on char 2 when adding a new task. What could cause this?

Anonymous said...

Found from another page: "innerHTML doesn't work with IE if you have hyperlink tag opened on the element you are filling html to."

Could that be the reason why it works in Firefox only?

Anonymous said...

Great work. Simple. Usefull. All I wanted. Thanks a lot.

Steven Van Ingelgem said...

Some weird stuff I noticed:
1) encodeURI doesn't escape the "#" character correctly. So if you use this inside a note or the title or whatever, it freaks out the PHP interpreter resulting in a "task failed" message (always).
Changing encodeURI to escape in the ajax framework worked like a charm.

2) When you haven't created a user, it always fail... Maybe it'd be better to enforce the client to at least create 1 user before proceeding?

3) Why not use Smarty to seperate your logic from your html? Right now it's kinda messy ;)

Anyway nice script!!

Camilo said...

"You can also reuse the code in your projects to simplify your work."

Thanks for that, I have refactored a little and fixed some things.

I added '$getTask_Total = mysql_num_rows($getTask);' to the files

Also I wrapped the $task like this: addslashes($task) in insertTask.php because otherwise double quotes are not accepted into a new task, and the DHTML corrupts.

I also replaced the POC with estimate duration / elapsed time / remaining time and added a 'risk:high/med/low' flag.

I replaced the priority flag with a numerical priority.

I find the drag and drop only appears to work superficially, after most operations the effects 'wear off' - although it didn't seem an essential feature.

Thanks again for the code, I have learned so much about Ajax, mysql and php from tweaking this!

-Cam

Antonio said...

ndb said...

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ndb/domains/lukasiewicz.info/public_html/todolist/in-showTask.php on line 58

the db & tables are ok

Rusty said...

I get the same error as you ndb. Not sure what is up.

Anyone?

Anonymous said...

Wonderfull, just what I needed!

Some sugestions:
- Print button to go to printer friendly version.
- HTTP authentication through PHP with checking credentials against the database.

I don't have a lot of time otherwise i would impement these things myself.

phord2phord said...

To avoid the "fetch_array" error, you need to first create a user. Then when you go back to the main page, refresh the screen so the user appears in the drop-down next to the task.

David R. Hedges said...

Thanks for the script. I was going to write a really basic to-do list for myself this morning, but didn't really have time, so decided to give this a go instead.

The drag-and-drop re-rodering should be persistent ... e.g. it should use AJAX to send a command to the server to update the DB with the new position in the list. I see that the current implementation probably uses TODOLIST.id_task_pk INT(11) for ordering, so I'd imagine the least amount of effort would be something like the following pseudocode:

<javascript to get task's new position and ID, and send that to the server>

<?
{
temp = mysql_get_row()+1;
mysql_query("UPDATE TODOLIST SET id_task_pk='$temp' where id_task_pk='orig_taskID';"); for (i=orig_taskID-1; i>=new_taskID; i++) { mysql_query("UPDATE TODOLIST SET id_task_pk='$i+1' WHERE id_task_pk='$i';"); } mysql_query("UPDATE TODOLIST SET id_task_pk='$new_taskID' WHERE id_task_pk='$temp';"); } ?> Anonymous said... What is the purpose of the .DS_Store file? What is its format ? Eric Leung said... createDBtable.php should be fixed. hideCompletedTask() won't work, until we manually insert a record in 'properties' table. ze said... very nice! Anonymous said... Nice, very nice script. BUT, there is a probleme with french character. Wev'e got many strange character like Ã©. Could think there is something to do to repair this ? Lukas said... Hi, thanks for that. Very useful. Please, is it possible to add a "priority" option for each task? Thanks again Patrick said... Very nice script. But why the feld "password"?? It where usefull wenn a user can make her/his own username and nobody can change there personal project task. can you implement a usermanagment whit login etc? Dont forgett am Admin :) Sorry for my bad english :( It would give me great pleasure. thanks contact me @ post@kleist.info Patrick ez said... Thanks for the script, it's very nice. I tried to download it from the link that you provided, and I think I got the 0.3 version, like another person commented in here. How do I download the .0.5 version? Thanks, Ezra Anonymous said... Hello! Please, make this available for all of us. You read the messages but dont answer to noone. Please Camilo Mesias said... Hi, a quick note to anyone using this code, if you plan on implementing passwords with a recent php, the crypt value for a password could exceed the varchar 30 psw column size - 35 chars at least are needed for the latest crypt. Laurence said... Hello, i just implemented, translated in french your script and tested it. It works well. is it possible to add a due date for each task and to be able to sort them by due date ?. As somebody else said, it is difficult to manage some french characters, any idea to solve the problem ? thanks very much Laurence Camilo Mesias said... in-modifyTask.php has a line if($getTask_Total=1){

I think it should be '==' not '='

Great todo list!

One problem, when I reorder the tasks, then navigate to a new page, everything goes back to the old order.

Anyone else having this problem?

Thanks!

Max Pozdeev said...

I like it. But development stopped, so I decided to write new script based on design and idea of MyToDoListPHP. You can find it in my blog, here.

Anonymous said...