Index: openacs-4/packages/project-manager/project-manager.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/project-manager.info,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/project-manager/project-manager.info 30 Nov 2005 06:47:36 -0000 1.3.2.1 +++ openacs-4/packages/project-manager/project-manager.info 2 Dec 2005 20:02:40 -0000 1.3.2.2 @@ -30,6 +30,9 @@ + + + 100} { + ad_return_complaint 1 "The proc to show subprojects has looped 100 times. This probably indicates an error in the code." + return 0 + } + + # to avoid excessive use of db handles we release the handle + # immediately after use and store the results in a list of lists + # using then a foreach instead of db_foreach to loop + set proj_list [db_list_of_lists project_folders {}] + + db_release_unused_handles + + foreach proj $proj_list { + + # decode the list + set project_item_id [lindex $proj 0] + set project_id [lindex $proj 1] + set folder_id [lindex $proj 2] + set content_type [lindex $proj 3] + set project_name [lindex $proj 4] + set project_code [lindex $proj 5] + set planned_start_date [lindex $proj 6] + set planned_end_date [lindex $proj 7] + set ongoing_p [lindex $proj 8] + set category_id [lindex $proj 9] + set category_name [lindex $proj 10] + set days_to_earliest_finish [lindex $proj 11] + set days_to_latest_finish [lindex $proj 12] + set actual_hours_completed [lindex $proj 13] + set estimated_hours_total [lindex $proj 14] + set estimated_finish_date [lindex $proj 15] + set earliest_finish_date [lindex $proj 16] + set latest_finish_date [lindex $proj 17] + set customer_name [lindex $proj 18] + set customer_id [lindex $proj 19] + set indent [string repeat $indent_char [expr $indent_count * [expr $level - 1]]] + + +# at this time this code is intended to be temporary; Alex and I are both +# pretty sure we will need some other solution. So I'm not bothering to create +# a package parameter for the colon used as a task separator (janine, 12-2-05) +if { $show_tasks_p } { + set tasks "" + db_foreach get_tasks {} { + if { [string length $tasks] == 0 } { + set tasks $task_title + } else { + set tasks "$tasks : $task_title" + } + } +} else { + set tasks " " +} + + template::multirow append projects $project_item_id $project_id $folder_id $content_type $project_name $project_code $planned_start_date $planned_end_date $ongoing_p $category_id $category_name $days_to_earliest_finish $days_to_latest_finish $actual_hours_completed $estimated_hours_total $estimated_finish_date $earliest_finish_date $latest_finish_date $customer_name $customer_id $indent $tasks + + # call recursively + sort_subprojects \ + -root_folder $project_item_id \ + -level $level \ + -multirow multirow + } +} + Index: openacs-4/packages/project-manager/tcl/project-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/project-procs.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/project-manager/tcl/project-procs.xql 30 Nov 2005 06:47:37 -0000 1.1.2.1 +++ openacs-4/packages/project-manager/tcl/project-procs.xql 2 Dec 2005 20:02:41 -0000 1.1.2.2 @@ -296,4 +296,65 @@ + + + SELECT + p.item_id as project_item_id, + p.project_id, + p.parent_id as folder_id, + p.object_type as content_type, + p.title as project_name, + p.project_code, + to_char(p.planned_start_date, 'MM/DD/YY') as planned_start_date, + to_char(p.planned_end_date, 'MM/DD/YY') as planned_end_date, + p.ongoing_p, + c.category_id, + c.category_name, + p.earliest_finish_date - current_date as days_to_earliest_finish, p.latest_finish_date - current_date as days_to_latest_finish, + p.actual_hours_completed, + p.estimated_hours_total, + to_char(p.estimated_finish_date, 'MM/DD/YY') as estimated_finish_date, + to_char(p.earliest_finish_date, 'MM/DD/YY') as earliest_finish_date, + to_char(p.latest_finish_date, 'MM/DD/YY') 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 + FROM pm_projectsx p + LEFT JOIN pm_project_assignment pa + ON p.item_id = pa.project_id + LEFT JOIN organizations o ON p.customer_id = + o.organization_id + LEFT JOIN ( + select + om.category_id, + om.object_id, + t.name as category_name + from + category_object_map om, + category_translations t, + categories ctg + where + om.category_id = t.category_id and + ctg.category_id = t.category_id and + ctg.deprecated_p = 'f') + c ON p.item_id = c.object_id, + cr_items i, + pm_project_status s + WHERE + p.project_id = i.live_revision and + s.status_id = p.status_id + and p.parent_id = :root_folder + [template::list::filter_where_clauses -and -name projects] + [template::list::orderby_clause -orderby -name projects]" + + + + + + SELECT tr.title as task_title + FROM pm_tasks_revisionsx tr + WHERE tr.parent_id = :project_item_id + + + Index: openacs-4/packages/project-manager/tcl/task-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/tcl/task-procs.tcl,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/project-manager/tcl/task-procs.tcl 30 Nov 2005 06:47:37 -0000 1.2.2.1 +++ openacs-4/packages/project-manager/tcl/task-procs.tcl 2 Dec 2005 20:02:41 -0000 1.2.2.2 @@ -800,7 +800,7 @@ object_id } { - set package_id [db_string pm_package_id ""] + set package_id [db_string pm_package_id "" -default 0] set url "[ad_url]" append url [site_node::get_url_from_object_id -object_id $package_id] Index: openacs-4/packages/project-manager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/index.tcl,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/project-manager/www/index.tcl 30 Nov 2005 06:47:37 -0000 1.3.2.1 +++ openacs-4/packages/project-manager/www/index.tcl 2 Dec 2005 20:02:41 -0000 1.3.2.2 @@ -42,7 +42,22 @@ set task_term_lower [parameter::get -parameter "taskname" -default "task"] set project_term [parameter::get -parameter "ProjectName" -default "Project"] set project_term_lower [parameter::get -parameter "projectname" -default "project"] +set use_subprojects_p [parameter::get -parameter "UseSubprojectsP" -default "0"] +set show_tasks_p [parameter::get -parameter "ShowTasksP" -default "0"] +if { $show_tasks_p } { + set tasks_hide_p 0 +} else { + set tasks_hide_p 1 +} +if { $use_subprojects_p } { + set indent_char [parameter::get -parameter "IndentCharacter" -default ""] + set indent_count [parameter::get -parameter "IndentCount" -default "0"] +} else { + set indent_char "" + set indent_count 0 +} + set exporting_vars { status_id category_id assignee_id orderby_project format } set hidden_vars [export_vars -form $exporting_vars] @@ -127,9 +142,15 @@ -elements { project_name { label "Project name" - link_url_col item_url - link_html { title "View this project version" } + display_template " +@projects.indent;noquote@@projects.project_name@ + " } + tasks { + label "Tasks" + hide_p $tasks_hide_p + display_template "@projects.tasks@" + } customer_name { label "Customer" display_template " @@ -150,6 +171,7 @@ } category_id { display_template "" + hide_p 1 } } \ -actions [list "Add project" "add-edit" "Add project" "Customers" "[site_node::get_package_url -package_key organizations]" "View customers"] \ @@ -185,6 +207,9 @@ orderby_asc "upper(p.title) asc" default_direction asc } + tasks { + label "Tasks" + } customer_name { label "Customer Name" orderby_desc "upper(o.name) desc, earliest_finish_date desc" @@ -222,6 +247,7 @@ layout table row { project_name {} + tasks {} customer_name {} category_id {} earliest_finish_date {} @@ -251,13 +277,23 @@ # Note: On oracle it you get "ORA-03113: end-of-file on communication channel" # please drop the index cat_object_map_i. Unique indexes are not allowed in organization index tables -db_multirow -extend { item_url } projects project_folders { -} { - set item_url [export_vars -base "one" {project_item_id}] -} +if { $use_subprojects_p } { + multirow create projects project_item_id project_id folder_id content_type project_name project_code planned_start_date planned_end_date ongoing_p category_id category_name days_to_earliest_finish days_to_latest_finish actual_hours_completed estimated_hours_total estimated_finish_date earliest_finish_date latest_finish_date customer_name customer_id indent tasks + pm::project::sort_subprojects \ + -root_folder $root_folder \ + -level 0 \ + -multirow projects +} else { + db_multirow -extend { item_url } projects project_folders { + } { + set item_url [export_vars -base "one" {project_item_id}] + } +} + + list::write_output -name projects Index: openacs-4/packages/project-manager/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/Attic/index.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/project-manager/www/index.xql 30 Nov 2005 06:47:37 -0000 1.1.2.1 +++ openacs-4/packages/project-manager/www/index.xql 2 Dec 2005 20:02:41 -0000 1.1.2.2 @@ -24,7 +24,9 @@ to_char(p.latest_finish_date, 'MM/DD/YY') 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, + '' as indent, + '' as tasks FROM pm_projectsx p LEFT JOIN pm_project_assignment pa ON p.item_id = pa.project_id @@ -57,4 +59,13 @@ + + + SELECT title as task_title + FROM pm_tasks_revisionsx + WHERE parent_id = :project_item_id + ORDER BY earliest_start + + + Index: openacs-4/packages/project-manager/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/one.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/project-manager/www/one.adp 30 Apr 2005 06:59:33 -0000 1.2 +++ openacs-4/packages/project-manager/www/one.adp 2 Dec 2005 20:02:41 -0000 1.2.2.1 @@ -16,7 +16,7 @@
- +
@@ -229,25 +229,23 @@

- +
- + - +
SubprojectsSubprojects
Add subproject - + + @add_subproject_link;noquote@ -  
Index: openacs-4/packages/project-manager/www/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/one.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/project-manager/www/one.tcl 30 Apr 2005 07:17:46 -0000 1.3 +++ openacs-4/packages/project-manager/www/one.tcl 2 Dec 2005 20:02:41 -0000 1.3.2.1 @@ -172,7 +172,11 @@ set comments_link "Add comment" +if {$use_subprojects_p} { + set add_subproject_link "Add subproject" +} + # we can also get the link to the logger instance. set logger_url [pm::util::logger_url] set logger_project_url "$logger_url?project_id=$project(logger_project)" @@ -215,10 +219,10 @@ set day_widget "Last Days" -set my_title "$project_term \#$project_item_id: $project(project_name)" +set my_title "$project(project_name)" -set edit_url "[ad_conn package_url]add-edit?[export_url_vars project_item_id]" +set edit_url "[ad_conn package_url]add-edit?[export_url_vars project_id project_item_id]" # set up context bar, needs parent_id if {[string equal $project(parent_id) $project_root]} { @@ -416,8 +420,7 @@ -elements { project_name { label "Subject" - link_url_col item_url - link_html { title "View this subproject" } + display_template { @subproject.project_name@ } } actual_hours_completed { label "Hours completed" @@ -431,11 +434,6 @@ orderby_tasks {} orderby_people {} } \ - -orderby { - project_name {orderby project_name} - default_value project_name,desc - } \ - -orderby_name orderby_subproject \ -html { width 100% } @@ -444,7 +442,7 @@ db_multirow -extend { item_url } subproject project_subproject_query { } { - set item_url [export_vars -base "one" -override {{project_item_id $item_id}} {project_item_id}] + set item_url [export_vars -base "one" {project_item_id $item_id}] } } @@ -487,7 +485,7 @@ } -db_multirow -extend { item_url } subproject project_people_query { +db_multirow -extend { item_url } people project_people_query { } { } @@ -504,5 +502,6 @@ # end of customizations + ad_return_template # ------------------------- END OF FILE ------------------------- # Index: openacs-4/packages/project-manager/www/task-one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/www/task-one.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/project-manager/www/task-one.adp 30 Apr 2005 06:59:34 -0000 1.2 +++ openacs-4/packages/project-manager/www/task-one.adp 2 Dec 2005 20:02:41 -0000 1.2.2.1 @@ -1,6 +1,6 @@ - @task_term@ #@task_id@: + @task_info.task_title;noquote@ @closed_message@ @context;noquote@ @project_item_id@