Index: openacs-4/packages/project-manager/lib/project-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/project-portlet.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/project-manager/lib/project-portlet.tcl 30 Oct 2006 08:31:08 -0000 1.18 +++ openacs-4/packages/project-manager/lib/project-portlet.tcl 25 Jun 2007 07:25:06 -0000 1.19 @@ -15,11 +15,18 @@ set return_url "rate-project?project_id=$project_id&project_item_id=$project_item_id" set vars { project_item_id return_url } set close_url "bulk-close?[export_vars $vars]" -set contacts_installed_p [apm_package_installed_p contacts] set default_layout_url [parameter::get -parameter DefaultPortletLayoutP] +if {![exists_and_not_null package_id]} { + set package_id [ad_conn package_id] +} + # Check if contacts is installed -set contacts_installed_p [apm_package_installed_p contacts] +set contacts_package_id [application_link::get_linked -from_package_id $package_id -to_package_key "contacts"] +if {$contacts_package_id ne ""} { + set contacts_installed_p 1 + set contacts_url [apm_package_url_from_id $contacts_package_id] +} #URL to rate this project set rate_url "rate-project?project_id=$project_id&project_item_id=$project_item_id" @@ -48,7 +55,6 @@ set variables(customer_id) $project(customer_id) set project(status_pretty) [pm::project::get_status_description -project_item_id $project_item_id] -set contacts_url [apm_package_url_from_key contacts] if {![empty_string_p contacts_url] && $contacts_installed_p} { set project(customer_name) [contact::name -party_id $project(customer_id)] } else { Index: openacs-4/packages/project-manager/lib/projects.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/projects.adp,v diff -u -r1.11 -r1.12 --- openacs-4/packages/project-manager/lib/projects.adp 25 Oct 2005 23:08:36 -0000 1.11 +++ openacs-4/packages/project-manager/lib/projects.adp 25 Jun 2007 07:25:06 -0000 1.12 @@ -1,4 +1,4 @@ - +
#project-manager.Search# Index: openacs-4/packages/project-manager/lib/projects.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/projects.tcl,v diff -u -r1.40 -r1.41 --- openacs-4/packages/project-manager/lib/projects.tcl 19 Feb 2007 15:56:54 -0000 1.40 +++ openacs-4/packages/project-manager/lib/projects.tcl 25 Jun 2007 07:25:06 -0000 1.41 @@ -13,9 +13,9 @@ # orderby To sort the list using this orderby value # # package_id The package_id which to limit the query to. +# package_ids List of package_ids to limit the query to # subprojects_p Should subprojects be displayed as well? -set required_param_list "package_id" set optional_param_list [list projects_orderby pm_status_id searchterm bulk_p actions_p page_num page_size\ filter_p base_url end_date_f user_space_p hidden_vars] set optional_unset_list [list assignee_id date_range is_observer_p previous_status_f current_package_f subprojects_p] @@ -24,11 +24,6 @@ set contacts_installed_p [apm_package_installed_p contacts] set user_id [ad_conn user_id] -foreach required_param $required_param_list { - if {![info exists $required_param]} { - return -code error "$required_param is a required parameter." - } -} if ![exists_and_not_null page_size] { set page_size 25 @@ -41,8 +36,12 @@ set fmt "%x" } -set package_ids [join $package_id ","] +if {![exists_and_not_null package_ids]} { + set package_ids $package_id +} +set package_ids [join $package_ids ","] + foreach optional_param $optional_param_list { if {![info exists $optional_param]} { set $optional_param {} @@ -128,21 +127,18 @@ set subprojects_from_clause "" set subprojects_where_clause "" -if {[exists_and_not_null subprojects_p]} { - if {[string eq "f" $subprojects_p]} { - set subprojects_from_clause ", acs_objects ao" - set subprojects_where_clause "ao.object_type = 'content_folder' and ao.object_id = p.parent_id" - } else { - set subprojects_p "" - } -} else { - set subprojects_p "" +# Do not show subprojects by default +if {![exists_and_not_null subprojects_p]} { + set subprojects_p "f" } -if {$subprojects_p eq ""} { +if {[string eq "f" $subprojects_p]} { + set subprojects_from_clause ", acs_objects ao" + set subprojects_where_clause "ao.object_type = 'content_folder' and ao.object_id = p.parent_id" +} else { unset subprojects_p } - + # We want to set up a filter for each category tree. set export_vars [export_vars -form {pm_status_id projects_orderby}] @@ -214,6 +210,12 @@ set row_list "project_name {}\n" + +# Deal with the elements +if {![exists_and_not_null elements]} { + set elements "planned_end_date" +} + foreach element $elements { append row_list "$element {}\n" } Index: openacs-4/packages/project-manager/lib/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/tasks.tcl,v diff -u -r1.64 -r1.65 --- openacs-4/packages/project-manager/lib/tasks.tcl 19 Feb 2007 15:56:54 -0000 1.64 +++ openacs-4/packages/project-manager/lib/tasks.tcl 25 Jun 2007 07:25:06 -0000 1.65 @@ -18,7 +18,7 @@ # page The page to show on the paginate. # page_size The number of rows to display in the list # orderby_p Set it to 1 if you want to show the order by menu. -# orderby To sort the list using this orderby value +# tasks_orderby To sort the list using this orderby value # # For Project Manager Task Portlet: # --------------------------------- @@ -60,14 +60,34 @@ } } + +# Deal with the include variable user_id and package_ids + +if {[exists_and_not_null package_ids]} { + set filter_package_id $package_ids + set package_id [lindex $package_ids 0] +} + +if {[exists_and_not_null user_id]} { + set filter_party_id $user_id +} + if {![exists_and_not_null page_size]} { set page_size 10000 } +# Deal with the orderbys. +if {[exists_and_not_null tasks_orderby]} { + set orderby_p 1 +} + if {![info exists orderby_p]} { set orderby_p 0 } +# Make the end_date the default orderby +set default_orderby "end_date,asc" + if { ![exists_and_not_null tasks_portlet_p] } { set tasks_portlet_p f } else { @@ -82,9 +102,9 @@ # set page_size "" } - +# The default display mode should be a list if {![info exists display_mode]} { - set display_mode "all" + set display_mode "list" } if {![info exists format]} { @@ -154,28 +174,16 @@ set search_where_clause "" } -set default_orderby [pm::task::default_orderby] - -if {[exists_and_not_null orderby]} { - pm::task::default_orderby \ - -set $orderby -} - # Get the elements to display in the list if {![exists_and_not_null elements]} { set elements [list \ + project_item_id \ task_item_id \ title \ - slack_time \ - role \ - latest_start \ + priority \ + hours_remaining \ end_date \ - status_type \ - remaining \ - worked \ - project_item_id \ - percent_complete \ - edit_url] + last_name] } if { [exists_and_not_null subproject_tasks] && [exists_and_not_null pid_filter]} { @@ -218,17 +226,26 @@ append priority_clause "and priority <= :max_priority" } +# Filter by party_id. Only the tasks of this party will be shown set party_id_clause "" if {[exists_and_not_null filter_party_id]} { set observer_from_clause " pm_task_assignment ta, pm_roles r," set party_id_clause "and t.item_id = ta.task_id and ta.role_id = r.role_id and ta.party_id = :filter_party_id" } +# Filter by group_id. As of now still untested if {[exists_and_not_null filter_group_id]} { set observer_from_clause " pm_task_assignment ta, pm_roles r," set party_id_clause "and t.item_id = ta.task_id and ta.role_id = r.role_id and ta.party_id in (select member_id from group_member_map where group_id = :filter_group_id)" } +# Filter by package_id +if {[exists_and_not_null filter_package_id]} { + set filter_package_where_clause "op.package_id in ([template::util::tcl_to_sql_list $filter_package_id])" +} else { + set filter_package_where_clause "" +} + set filters [list \ searchterm [list \ label "[_ project-manager.Search_1]" \ @@ -258,7 +275,7 @@ values { {"[_ project-manager.Player]" f} { "[_ project-manager.Watcher]" t} } \ ] \ filter_package_id [list \ - where_clause "op.package_id = :filter_package_id" + where_clause "$filter_package_where_clause" ] \ ] @@ -357,7 +374,14 @@ } \ ] } else { - set order_by_list [list] + set order_by_list [list \ + default_value $default_orderby \ + end_date { + orderby_asc "end_date, priority desc, task_item_id asc" + orderby_desc "end_date desc, priority desc, task_item_id desc" + default_direction asc + } + ] }