Index: openacs-4/packages/tasks/lib/tasks.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/tasks.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/tasks/lib/tasks.tcl	28 Sep 2005 19:21:08 -0000	1.2
+++ openacs-4/packages/tasks/lib/tasks.tcl	29 Sep 2005 13:17:53 -0000	1.3
@@ -1,12 +1,13 @@
-set user_id [ad_conn user_id]
 set tasks_url "/tasks/"
 
-if { ![info exist contact_id] } {
-    set contact_id $party_id
-}
-
-if { ![contact::exists_p -party_id $contact_id] } {
+# If we are not viewing the tasks of a party, view the tasks of the user
+if {![exists_and_not_null party_id]} {
+    set user_id [ad_conn user_id]
     set contact_id $user_id
+    set user_id2 $user_id
+} else {
+    set contact_id $party_id 
+    set user_id2 ""
 }
 
 if { ![exists_and_not_null orderby] } {
@@ -84,7 +85,12 @@
         narrow
     } \
     -filters {
-	party_id {}
+	party_id {
+	    where_clause {t.party_id = :party_id}
+	}
+	user_id {
+	    where_clause {ao.creation_user = :user_id}
+	}
     } -orderby {
         default_value "priority,desc"
         date {
@@ -119,7 +125,6 @@
 	}
     }
 
-
 db_multirow -extend {creation_user_url contact_url complete_url done_p task_plus_url task_minus_url description_html task_url} -unclobber tasks get_tasks " " {
     set creation_user_url [contact::url -party_id $creation_user]
     regsub -all "/tasks/" $creation_user_url "/contacts/" creation_user_url