Index: openacs-4/packages/tasks/lib/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/lib/tasks.tcl,v diff -u -r1.26 -r1.27 --- openacs-4/packages/tasks/lib/tasks.tcl 13 Mar 2006 07:38:41 -0000 1.26 +++ openacs-4/packages/tasks/lib/tasks.tcl 12 Apr 2006 08:26:27 -0000 1.27 @@ -128,31 +128,7 @@ append limitations_clause "\n and t.object_id in ( $object_query )" -# you may specify a list of assignees as well if you like, they are similar to the object -# queries and ids this is not required. You may only specify one of the following, assignee_query, assignee_ids, assignee_id -if { [info exists assignee_query] || [info exists assignee_ids] || [info exists assignee_id] } { - if { - ( [info exists assignee_query] && ![info exists assignee_ids] && ![info exists assignee_id] ) || - ( ![info exists assignee_query] && [info exists assignee_ids] && ![info exists assignee_id] ) || - ( ![info exists assignee_query] && [info exists assignee_ids] && ![info exists assignee_id] ) - } { - # we only have one provided object_id list, this is correct set up - } else { - error "packages/tasks/lib/tasks - invalid include you must specify one (and only one) of the following: assignee_query, assignee_ids, assignee_id" - } - - if { [info exists assignee_ids] } { - set assignee_query [template::util::tcl_to_sql_list $object_ids] - } elseif { [info exists object_id] } { - set assignee_query '$object_id' - } - - if { [exists_and_not_null assignee_query] } { - append limitations_clause "\n and t.assignee_id in ( $assignee_query )" - } -} - append limitations_clause "\n and ao.package_id = [ad_conn package_id]" if { $start_date ne "" } { @@ -294,12 +270,56 @@ +# you may specify a list of assignees as well if you like, they are similar to the object +# queries and ids this is not required. You may only specify one of the following, assignee_query, assignee_ids, assignee_id +if { [info exists assignee_query] || [info exists assignee_ids] || [info exists assignee_id] } { + if { + ( [info exists assignee_query] && ![info exists assignee_ids] && ![info exists assignee_id] ) || + ( ![info exists assignee_query] && [info exists assignee_ids] && ![info exists assignee_id] ) || + ( ![info exists assignee_query] && [info exists assignee_ids] && ![info exists assignee_id] ) + } { + # we only have one provided object_id list, this is correct set up + } else { + error "packages/tasks/lib/tasks - invalid include you must specify one (and only one) of the following: assignee_query, assignee_ids, assignee_id" + } + if { [info exists assignee_query] || [info exists assignee_ids] } { + # the users should be able to select from a list of assignees + if { ![info exists assignee_query] } { + set assignee_query [template::util::tcl_to_sql_list $assignee_ids] + } + set package_id [ad_conn package_id] + set selected_assignee_id [ns_queryget selected_assignee_id] + set assignees [db_list_of_lists get_them " select contact__name( party_id ), + party_id + from parties + where party_id in ( $assignee_query ) + and party_id in ( + select t_tasks.assignee_id + from t_tasks + where t_tasks.object_id in ( $object_query ))"] + set filters_list [list selected_assignee_id [list label [_ tasks.Assignee] values [concat [list [list "- - - -" ""]] $assignees]]] + } + if { [exists_and_not_null selected_assignee_id] } { + set assignee_query '${selected_assignee_id}' + } else { + if { [info exists assignee_ids] } { + set assignee_query [template::util::tcl_to_sql_list $assignee_ids] + } elseif { [info exists assignee_id] } { + set assignee_query '$assignee_id' + } + } + if { [exists_and_not_null assignee_query] } { + append limitations_clause "\n and t.assignee_id in ( $assignee_query )" + } +} + + set row_list [list] foreach element [list checkbox deleted_p priority title process_title object_name date assignee] { if { $single_object_p && $element == "object_name" } { @@ -314,7 +334,7 @@ # by default we only show pending tasks lappend filters_list status_id [list label [_ tasks.Status] values $status_options where_clause { t.status_id = :status_id } default_value "1"] - +#lappend filters_list if { [lsearch $hide_elements checkbox] >= 0 } { set bulk_actions [list] } else {