Index: openacs-4/packages/project-manager/lib/projects-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/lib/projects-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/project-manager/lib/projects-postgresql.xql 23 Aug 2005 16:37:50 -0000 1.5 +++ openacs-4/packages/project-manager/lib/projects-postgresql.xql 26 Aug 2005 17:10:28 -0000 1.6 @@ -26,7 +26,10 @@ to_char(p.latest_finish_date, 'YYYY-MM-DD HH24:MI:SS') as latest_finish_date, case when o.name is null then '--no customer--' else o.name end as customer_name, - o.organization_id as customer_id + o.organization_id as customer_id, + f.package_id, + to_char(p.creation_date, 'YYYY-MM_DD HH24:MI:SS') as creation_date, + to_char(p.planned_start_date, 'YYYY-MM_DD HH24:MI:SS') as start_date FROM pm_projectsx p LEFT JOIN pm_project_assignment pa ON p.item_id = pa.project_id @@ -52,12 +55,13 @@ WHERE p.project_id = i.live_revision and i.parent_id = f.folder_id + and f.package_id in ($package_ids) and exists (select 1 from acs_object_party_privilege_map ppm where ppm.object_id = p.project_id and ppm.privilege = 'read' and ppm.party_id = :user_id) - [template::list::filter_where_clauses -and -name "projects_${package_id}"] - [template::list::orderby_clause -orderby -name "projects_${package_id}"] + [template::list::filter_where_clauses -and -name projects] + [template::list::orderby_clause -orderby -name projects] 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.6 -r1.7 --- openacs-4/packages/project-manager/lib/projects.adp 23 Aug 2005 16:37:50 -0000 1.6 +++ openacs-4/packages/project-manager/lib/projects.adp 26 Aug 2005 17:10:28 -0000 1.7 @@ -1,4 +1,3 @@ -
#project-manager.Search#
@@ -14,10 +13,11 @@ [YYYY-MM-DD]
- @category_select;noquote@ - + + @projects.category_select;noquote@ + +
- -
+ 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.15 -r1.16 --- openacs-4/packages/project-manager/lib/projects.tcl 23 Aug 2005 16:37:50 -0000 1.15 +++ openacs-4/packages/project-manager/lib/projects.tcl 26 Aug 2005 17:10:28 -0000 1.16 @@ -6,7 +6,8 @@ # @cvs-id $Id$ set required_param_list [list package_id] -set optional_param_list [list orderby status_id searchterm bulk_p action_p filter_p base_url end_date_f user_space_p] +set optional_param_list [list orderby status_id searchterm bulk_p action_p \ + filter_p base_url end_date_f user_space_p hidden_vars] set optional_unset_list [list assignee_id date_range is_observer_p] set user_id [ad_conn user_id] @@ -16,6 +17,8 @@ } } +set package_ids [join $package_id ","] + foreach optional_param $optional_param_list { if {![info exists $optional_param]} { set $optional_param {} @@ -42,63 +45,11 @@ # to show the projects. -# --------------------------------------------------------------- # - -set _package_id $package_id -template::multirow create pm_packages "list_id" "contact_column" "community_name" -set c_row 0 - - - -foreach package_id $_package_id { - - -set _base_url [site_node::get_url_from_object_id -object_id $package_id] - -if {![empty_string_p $_base_url]} { - - set base_url $_base_url -} - -set community_id [dotlrn_community::get_community_id_from_url \ - -url $base_url \ - ] - -if {![empty_string_p $community_id]} { - - set community_name [dotlrn_community::get_community_name $community_id] - - set portal_info_name "Project: $community_name" - set portal_info_url "$base_url" - -} - - - - -set exporting_vars { status_id category_id assignee_id orderby format } -set hidden_vars [export_vars -form $exporting_vars] - -# set up context bar -set context [list] - -# the unique identifier for this package -set user_id [ad_maybe_redirect_for_registration] - - -# root CR folder -set root_folder [pm::util::get_root_folder -package_id $package_id] - -# Projects, using list-builder --------------------------------- - # Set status -if {![exists_and_not_null status_id]} { - set status_where_clause "" - set status_id "" -} else { - set status_where_clause {p.status_id = :status_id} -} - +if { ![exists_and_not_null status_id]} { + set status_id [pm::status::default_open] +} + # We want to set up a filter for each category tree. set export_vars [export_vars -form {status_id orderby}] @@ -112,47 +63,41 @@ unset category_id } } + +set assignees_filter [pm::project::assignee_filter_select -status_id 2] -set category_select [pm::util::category_selects \ - -export_vars $export_vars \ - -category_id $temp_category_id \ - -package_id $package_id \ - ] - -set assignees_filter [pm::project::assignee_filter_select -status_id $status_id] - if {![empty_string_p $searchterm]} { - + if {[regexp {([0-9]+)} $searchterm match query_digits]} { - set search_term_where " (upper(p.title) like upper('%$searchterm%') + set search_term_where " (upper(p.title) like upper('%$searchterm%') or p.item_id = :query_digits) " } else { - set search_term_where " upper(p.title) like upper('%$searchterm%')" - } + set search_term_where " upper(p.title) like upper('%$searchterm%')" + } } else { set search_term_where "" -} + } ############################################## # Filter for planned_end_date -if {[exists_and_not_null date_range] } { - set start_range_f [lindex [split $date_range "/"] 0] - set end_range_f [lindex [split $date_range "/"] 1] - if {![empty_string_p $start_range_f] && ![empty_string_p $end_range_f]} { - set p_range_where "to_char(p.planned_end_date,'YYYY-MM-DD') >= :start_range_f and + if {[exists_and_not_null date_range] } { + set start_range_f [lindex [split $date_range "/"] 0] + set end_range_f [lindex [split $date_range "/"] 1] + if {![empty_string_p $start_range_f] && ![empty_string_p $end_range_f]} { + set p_range_where "to_char(p.planned_end_date,'YYYY-MM-DD') >= :start_range_f and to_char(p.planned_end_date,'YYYY-MM-DD') <= :end_range_f" - } else { - if {![empty_string_p $start_range_f] } { - set p_range_where "to_char(p.planned_end_date,'YYYY-MM-DD') >= :start_range_f" - } elseif { ![empty_string_p $end_range_f] } { - set p_range_where "to_char(p.planned_end_date,'YYYY-MM-DD') <= :end_range_f" } else { - set p_range_where "" + if {![empty_string_p $start_range_f] } { + set p_range_where "to_char(p.planned_end_date,'YYYY-MM-DD') >= :start_range_f" + } elseif { ![empty_string_p $end_range_f] } { + set p_range_where "to_char(p.planned_end_date,'YYYY-MM-DD') <= :end_range_f" + } else { + set p_range_where "" + } } + } else { + set p_range_where "" } -} else { - set p_range_where "" -} ############################################## @@ -166,42 +111,38 @@ # Get url of the contacts package if it has been mounted for the links on the index page. set contacts_url [util_memoize [list site_node::get_package_url -package_key contacts]] if {[empty_string_p $contacts_url]} { - set contact_column "@projects_${package_id}.customer_name@" + set contact_column "@projects_${package_id}.customer_name@" } else { set contact_column "@projects_${package_id}.customer_name@" } # Store project names and all other project individuel data set contact_coloum "fff" -template::multirow append pm_packages "projects_${package_id}" "$contact_column" -ns_log notice "projects = projects_${package_id} c_row=$c_row\n [template::multirow get pm_packages 1 list_id] , [template::multirow columns pm_packages] , [template::multirow size pm_packages]" -incr c_row -# Get the rows to display - set row_list "checkbox {}\nproject_name {}\n" foreach element $elements { append row_list "$element {}\n" } + if {$bulk_p == 1} { set bulk_actions [list "[_ project-manager.Close]" "@{base_url}/bulk-close" "[_ project-manager.Close_project]" ] } else { set bulk_actions [list] } if {$actions_p == 1} { - + if {[info exists portal_info_name]} { set actions [list "$portal_info_name" "$portal_info_url" "$portal_info_name" "[_ project-manager.Add_project]" "[export_vars -base "${base_url}add-edit" -url {customer_id}]" "[_ project-manager.Add_project]" "[_ project-manager.Customers]" "[site_node::get_package_url -package_key contacts]" "[_ project-manager.View_customers]" ] - + } else { - + set actions [list "[_ project-manager.Add_project]" "[export_vars -base "${base_url}add-edit" -url {customer_id}]" "[_ project-manager.Add_project]" "[_ project-manager.Customers]" "[site_node::get_package_url -package_key contacts]" "[_ project-manager.View_customers]" ] - + } } else { @@ -222,14 +163,16 @@ date_range [list \ label "[_ project-manager.Planned_end_date]" \ where_clause {$p_range_where} - ] \ + ] \ status_id [list \ label "[_ project-manager.Status_1]" \ + default_value [pm::status::default_open] \ values {[pm::status::project_status_select]} \ - where_clause {$status_where_clause} \ + where_clause {p.status_id = :status_id} \ ] \ assignee_id [list \ label "[_ project-manager.Assignee]" \ + default_value $user_id \ values {$assignees_filter} \ where_clause {pa.party_id = :assignee_id} ] \ @@ -246,49 +189,52 @@ ] - + template::list::create \ - -name "projects_${package_id}" \ - -multirow projects_${package_id} \ + -name projects \ + -multirow projects \ -selected_format $format \ -key project_item_id \ -elements { - project_name { - label "[_ project-manager.Project_name]" - link_url_col item_url - link_html { title "[_ project-manager.lt_View_this_project_ver]" } - } - customer_name { - label "[_ project-manager.Customer]" - display_template " -$contact_column@projects_${package_id}.customer_name@ + project_name { + label "[_ project-manager.Project_name]" + link_url_col item_url + link_html { title "[_ project-manager.lt_View_this_project_ver]" } + } + customer_name { + label "[_ project-manager.Customer]" + display_template " +$contact_column@projects.customer_name@ " - } - earliest_finish_date { + } + creation_date { + label "[_ project-manager.Creation_date]" + } + start_date { + label "[_ project-manager.Start_date]" + } + earliest_finish_date { label "[_ project-manager.Earliest_finish]" - display_template "@projects_${package_id}.earliest_finish_date@@projects_${package_id}.earliest_finish_date@" + display_template "@projects.earliest_finish_date@@projects.earliest_finish_date@" } latest_finish_date { label "[_ project-manager.Latest_Finish]" - display_template "@projects_${package_id}.latest_finish_date@@projects_${package_id}.latest_finish_date@" + display_template "@projects.latest_finish_date@@projects.latest_finish_date@" } - planned_end_date { - label "[_ project-manager.Latest_Finish]" - } - actual_hours_completed { + planned_end_date { + label "[_ project-manager.Latest_Finish]" + } + actual_hours_completed { label "[_ project-manager.Hours_completed]" - display_template "@projects_${package_id}.actual_hours_completed@/@projects_${package_id}.estimated_hours_total@" - } - category_id { - display_template "" - } + display_template "@projects.actual_hours_completed@/@projects.estimated_hours_total@" + } + category_id { + display_template "" + } status_id { label "[_ project-manager.Status_1]" - display_template "#project-manager.Closed##project-manager.Open#" + display_template "#project-manager.Closed##project-manager.Open#" } - planned_end_date { - label "[_ project-manager.Planned_end_date]" - } } \ -actions $actions \ -bulk_actions $bulk_actions \ @@ -297,73 +243,98 @@ } \ -filters $filters \ -orderby { - default_value $default_orderby - project_name { - label "[_ project-manager.Project_name]" - orderby_desc "upper(p.title) desc" - orderby_asc "upper(p.title) asc" - default_direction asc - } - customer_name { - label "[_ project-manager.Customer_Name]" - orderby_desc "upper(o.name) desc, earliest_finish_date desc" - orderby_asc "upper(o.name) asc, earliest_finish_date asc" - default_direction asc - } - category_id { - label "[_ project-manager.Categories]" - orderby_desc "c.category_name desc" - orderby_asc "c.category_name asc" - default_direction asc - } - earliest_finish_date { - label "[_ project-manager.Earliest_finish]" - orderby_desc "p.earliest_finish_date desc" - orderby_asc "p.earliest_finish_date asc" - default_direction asc - } - latest_finish_date { - label "[_ project-manager.Latest_finish]" - orderby_desc "p.latest_finish_date desc" - orderby_asc "p.latest_finish_date asc" - default_direction asc - } - actual_hours_completed { - label "[_ project-manager.Hours_completed]" - orderby_desc "p.actual_hours_completed desc" - orderby_asc "p.actual_hours_completed asc" - default_direction asc - } + default_value $default_orderby + project_name { + label "[_ project-manager.Project_name]" + orderby_desc "upper(p.title) desc" + orderby_asc "upper(p.title) asc" + default_direction asc + } + customer_name { + label "[_ project-manager.Customer_Name]" + orderby_desc "upper(o.name) desc, earliest_finish_date desc" + orderby_asc "upper(o.name) asc, earliest_finish_date asc" + default_direction asc + } + category_id { + label "[_ project-manager.Categories]" + orderby_desc "c.category_name desc" + orderby_asc "c.category_name asc" + default_direction asc + } + creation_date { + label "[_ project-manager.Creation_date]" + orderby_desc "p.creation_date desc" + orderby_asc "p.creation_date asc" + default_direction asc + } + start_date { + label "[_ project-manager.Start_date]" + orderby_desc "p.planned_start_date desc" + orderby_asc "p.planned_start_date asc" + default_direction asc + } + latest_finish_date { + label "[_ project-manager.Latest_finish]" + orderby_desc "p.latest_finish_date desc" + orderby_asc "p.latest_finish_date asc" + default_direction asc + } + actual_hours_completed { + label "[_ project-manager.Hours_completed]" + orderby_desc "p.actual_hours_completed desc" + orderby_asc "p.actual_hours_completed asc" + default_direction asc + } } \ -formats { normal { label "[_ project-manager.Table]" layout table row $row_list } - csv { - label "[_ project-manager.CSV]" - output csv - page_size 0 - row $row_list - } + csv { + label "[_ project-manager.CSV]" + output csv + page_size 0 + row $row_list + } } \ -orderby_name orderby \ -html { - width 100% + width 100% } -db_multirow -extend { item_url } "projects_${package_id}" project_folders " " { +db_multirow -extend { item_url customer_url category_select } projects project_folders " " { set earliest_finish_date [lc_time_fmt $earliest_finish_date $fmt] set latest_finish_date [lc_time_fmt $latest_finish_date $fmt] + + set _base_url [site_node::get_url_from_object_id -object_id $package_id] + if {![empty_string_p $_base_url]} { + set base_url $_base_url + } + set item_url [export_vars -base "${base_url}one" {project_item_id}] + + set community_id [dotlrn_community::get_community_id_from_url -url $base_url] + + if { ![empty_string_p $community_id] } { + set community_name [dotlrn_community::get_community_name $community_id] + set portal_info_name "Project: $community_name" + set portal_info_url "$base_url" + } + + # root CR folder + set root_folder [pm::util::get_root_folder -package_id $package_id] + + set category_select [pm::util::category_selects \ + -export_vars $export_vars \ + -category_id $temp_category_id \ + -package_id $package_id \ + ] } - - -} - - - ad_return_template # ------------------------- END OF FILE ------------------------- # + +