dotProject Recipe: add a "Complete this task" checkbox to todo list
March 19, 2007
Dotproject | PHP | Snippets

completionCheckbox.jpg

To allow one-click completion of a task, we added a checkbox to each row of the task "to-do" lists in dotProject.

Usually I try to borrow functions from other places in the application and adapt them to the new location. In this case the completion function was borrowed from the "progress" drop-down menu, on the add-edit Task screen.

The check box submits the same values as if 100% were selected from the drop-down menu.


Ads by Google

Posted by ellen at March 19, 2007 11:44 AM


In modules/tasks/tasks.class.php, search for the first row of the task listing table

$s = "\n"\n\t<tr style='".$style."' id='taskRow'">"

This is the area where the HTML for the task list table is generated. Find the spot in the list of table cells where you want to insert the checkbox, and add:

$s .= "\n\t<td align=\"center\" width=\"15\">";



$s .= "<form name='taskCompleteForm".$a['task_id']."' action='?m=tasks&a=view' method='post'>";

$s .= "<input name='dosql' type='hidden' value='do_task_aed' />";

$s .= "<input type = 'hidden' name='task_id' value='".$a['task_id']."'>";

$s .= "<input type = 'hidden' name='task_percent_complete' value='100'>";

$s .= "<input type='checkbox' name='completeIt' onclick='document.taskCompleteForm".$a['task_id'].".submit();'>";

$s .= intval( $a["task_percent_complete"] ).'%';

$s .= "</form>";


Ads by Google


Ads by Google

 RSS   |   Contact Me


Ads by Google