Index: tasks.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tasks/tasks.css,v
retrieving revision 1.2
diff -U3 -r1.2 tasks.css
--- tasks.css	5 Apr 2006 16:20:27 -0000	1.2
+++ tasks.css	19 Jan 2007 16:25:47 -0000
@@ -24,12 +24,14 @@
 	font-size:10px;
 }

-#tasks-filter .form-item {
-	display:inline;
+#tasks-view-filter-form label {
+	margin-bottom:-1.6em;
 }

-#tasks-filter label {
+#tasks-view-filter-form .form-item, #tasks-view-filter-form input {
 	display:inline;
+	margin-bottom:0;
+	vertical-align:bottom;
 }

 #tasks-filter div {
Index: tasks.info
===================================================================
RCS file: tasks.info
diff -N tasks.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tasks.info	19 Jan 2007 16:47:15 -0000
@@ -0,0 +1,4 @@
+; $Id$
+name = Tasklist
+description = A module to make task nodes.
+version = 1.0.x-dev
Index: tasks.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tasks/tasks.install,v
retrieving revision 1.3
diff -U3 -r1.3 tasks.install
--- tasks.install	5 Apr 2006 16:48:42 -0000	1.3
+++ tasks.install	19 Jan 2007 16:25:47 -0000
@@ -14,4 +14,8 @@
       PRIMARY KEY (nid)
     ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
   }
+}
+
+function tasks_uninstall() {
+  db_query('DROP TABLE {tasks}');
 }
\ No newline at end of file
Index: tasks.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tasks/tasks.module,v
retrieving revision 1.9
diff -U3 -r1.9 tasks.module
--- tasks.module	8 Aug 2006 12:19:34 -0000	1.9
+++ tasks.module	19 Jan 2007 16:25:47 -0000
@@ -4,17 +4,19 @@
 // Implementation of hook_help()
 function tasks_help($section) {
   switch ($section) {
-    case 'admin/modules#description':
-      return t('A module to make task nodes.');
     case 'node/add#tasks':
-      return t('This is an task type with a few fields.');
+      return t('This is a task type with a few fields.');
   }
 }

 // Implementation of hook_info
 function tasks_node_info() {
   return array(
-    'tasks' => array('name' => t('task'), 'base' => 'tasks'),
+    'tasks' => array(
+      'name'        => t('Task'),
+      'module'      => 'tasks',
+      'description' => t('A task to keep track of.'),
+    ),
   );
 }

@@ -45,7 +47,7 @@
   if ($may_cache) {
     $items[] = array(
       'path' => 'node/add/tasks',
-      'title' => t('task'),
+      'title' => t('Task'),
       'access' => user_access('create task')
     );
     $items[] = array(
@@ -83,7 +85,7 @@
 // Implementation of hook_form().
 function tasks_form(&$node) {
   drupal_add_js(drupal_get_path('module', 'tasks').'/tasks.js');
-  theme_add_style(drupal_get_path('module', 'tasks').'/tasks.css');
+  drupal_add_css(drupal_get_path('module', 'tasks').'/tasks.css');

   $bc = drupal_get_breadcrumb();
   $bc[] = l(t('Tasks'), 'tasks');
@@ -226,10 +228,13 @@
 function tasks_link($type, $node = NULL, $teaser = FALSE) {
   $links = array();

-  if ($type == 'node' && $node->type == 'tasks') {
+  if ($type == 'node' && $node->type == 'tasks' && user_access('create task')) {
     if (!$teaser) {
-      $links[] = l(t('add new sub-task'), "node/add/tasks",
-        array('title' => t('Add a new task to this task list')), "edit[parent]=$node->nid");
+      $links['tasks_add_subtask'] = array(
+        'title'      => t('Add new sub-task'),
+        'href'       => 'node/add/tasks',
+        'attributes' => array('title' => t('Add a new task to this task list')),
+      );
     }
   }

@@ -295,8 +300,8 @@
   We want to view the task, and list any sub tasks
 */
 function tasks_view(&$node, $teaser = FALSE, $page = FALSE) {
-  theme_add_style(drupal_get_path('module', 'tasks').'/tasks.css');
   drupal_add_js(drupal_get_path('module', 'tasks').'/tasks_view.js');
+  drupal_add_css(drupal_get_path('module', 'tasks').'/tasks.css');

   if ($page) {
     // The page should show the task and any subtasks
@@ -321,18 +326,16 @@

     $node = node_prepare($node, $teaser);

-    $output = '';
-

     // Now show subtasks if there are any

     // Filter the tasks shown
-    if ($_POST['edit']['filter'] == 0) {
+    if ($_POST['filter'] == 0) {
       // incomplete tasks
       $complete = 'AND t.completed = 0';
       $order_by = 't.order_by';
     }
-    elseif ($_POST['edit']['filter'] == 1) {
+    elseif ($_POST['filter'] == 1) {
       // complete tasks
       $complete = 'AND t.completed > 0';
       $order_by = 't.completed DESC';
@@ -346,23 +349,15 @@
     //$result = db_query("SELECT n.*, t.*, u.name AS assigned_name, u.data FROM {node} n INNER JOIN {tasks} t ON t.nid = n.nid LEFT JOIN {users} u ON u.uid = t.assigned_to WHERE n.status = 1 AND n.type='tasks' AND t.parent = %d %s ORDER BY %s", $node->nid, $complete, $order_by);
     $result = db_query("SELECT n.nid, u.name AS assigned_name, u.data FROM {node} n INNER JOIN {tasks} t ON t.nid = n.nid LEFT JOIN {users} u ON u.uid = t.assigned_to WHERE n.status = 1 AND n.type='tasks' AND t.parent = %d %s ORDER BY %s", $node->nid, $complete, $order_by);

-    if ($num_rows = db_num_rows($result)) {
+    $num_rows = db_num_rows($result);

-      // Enable the list of tasks to be filtered
-      $form['filter'] = array(
-        '#type' => 'select',
-        '#title' => t('Showing %num_rows tasks. Filter',array('%num_rows'=>$num_rows)),
-        '#default_value' => 0,
-        '#options' => array(0=>t('Incomplete Tasks'),1=>t('Complete Tasks'),-1=>t('All Tasks'))
-      );
-      $form['submit'] = array(
-        '#type' => 'submit',
-        '#value' => t('Filter')
-      );
-      $form['#action'] = "node/$node->nid";
-      $form['#attributes'] = array('id'=>'tasks-filter');
-      $output .= drupal_get_form('task_filter',$form);
+    // Add filtering to the the tasklist
+    $node->content['tasks_filter'] = array(
+      '#value'  => drupal_get_form('tasks_view_filter_form', $num_rows, $node->nid),
+      '#weight' => 1,
+    );

+    if ($num_rows) {
       while ($task = db_fetch_object($result)) {
         $assigned_name = $task->assigned_name;
         //$tasks_colour = drupal_unpack($task)->tasks_colour;
@@ -386,14 +381,35 @@
         );
       }
       $header = array(t('Assigned'),t('Task'), t('Complete?'), t('Edit'));
-      $output .= theme('table', $header, $rows, array("id"=>"task-list"));
+      $node->content['tasks_table'] = array(
+        '#value'  => theme('table', $header, $rows, array("id"=>"task-list")),
+        '#weight' => 2,
+      );
     }
-
-    $node->body .= $output;
   }
+
+  return $node;
 }

+/**
+ * Filtering for tasklist
+ */
+function tasks_view_filter_form($num_rows, $nid) {
+  // Enable the list of tasks to be filtered
+  $form['filter'] = array(
+    '#type'          => 'select',
+    '#title'         => t('Showing %num_rows tasks. Filter', array('%num_rows' => $num_rows)),
+    '#default_value' => 0,
+    '#options'       => array(0 => t('Incomplete Tasks'), 1 => t('Complete Tasks'), -1 => t('All Tasks')),
+  );
+  $form['submit'] = array(
+    '#type'  => 'submit',
+    '#value' => t('Filter')
+  );
+  $form['#redirect'] = FALSE;

+  return $form;
+}



