Index: openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-manager-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl 10 Jun 2004 20:23:11 -0000 1.6 +++ openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl 11 Jun 2004 20:58:13 -0000 1.7 @@ -402,3 +402,95 @@ -body "$nice_text" } + + +ad_proc -public pm::util::category_selects { + {-export_vars ""} + {-category_id ""} + {-package_id ""} +} { + Returns an HTML fragment of forms, one for each + category tree, suitable for use on a page. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param export_vars Variables already exported with export_vars -form + + @param category_id If set, the currently selected category + + @return + + @error +} { + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + + # caches results for 5 minutes. + return [util_memoize [list pm::util::category_selects_helper -export_vars $export_vars -category_id $category_id -package_id $package_id] 300] +} + + + +ad_proc -public pm::util::category_selects_helper { + {-export_vars ""} + {-category_id ""} + -package_id:required +} { + Returns an HTML fragment of forms, one for each + category tree, suitable for use on a page. This proc + is used so that pm::util::category_selects can cache + the categories + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param export_vars Variables already exported with export_vars -form + + @param category_id If set, the currently selected category + + @return + + @error +} { + # Categories are arranged into category trees. + # Set up an array for each tree. The array contains the category for each tree + + db_foreach get_categories { } { + lappend category_choices($tree_id) [list $cat_name $cat_id] + } + + + set category_select "" + + foreach tree_list [db_list_of_lists get_category_trees { }] { + + set tree_name [lindex $tree_list 0] + set tree_id [lindex $tree_list 1] + + if {![exists_and_not_null category_choices($tree_id)]} { + set category_choices($tree_id) [list] + } + + + append category_select "
" + + return $category_select +} Index: openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 4 Jun 2004 16:19:45 -0000 1.12 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 11 Jun 2004 20:58:14 -0000 1.13 @@ -1462,3 +1462,145 @@ return $return_val } + + +ad_proc -public pm::project::assign { + {-project_item_id:required} + {-role_id:required} + {-party_id:required} +} { + Assigns a user to a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param project_item_id + + @param role_id + + @param party_id + + @return + + @error +} { + + db_dml insert_assignment { + insert into pm_project_assignment + (project_id, role_id, party_id) + VALUES + (:project_item_id, :role_id, :party_id) + } + + return +} + + +ad_proc -public pm::project::unassign { + {-project_item_id:required} + {-party_id:required} +} { + Removes a user from a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param project_item_id + + @param party_id + + @return + + @error +} { + + db_dml remove_assignment { + DELETE FROM + pm_project_assignment + WHERE + project_id = :project_item_id and + party_id = :party_id + } + + return +} + + +ad_proc -public pm::project::assign_remove_everyone { + {-project_item_id:required} +} { + Removes all users from a project + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param project_item_id + + @return + + @error +} { + + db_dml remove_assignment { + DELETE FROM + pm_project_assignment + WHERE + project_id = :project_item_id + } + + return +} + + +ad_proc -public pm::project::assignee_filter_select { + {-status_id:required} +} { + Returns a list of lists, people who are assigned to projects with a + status of status_id. Used in the list-builder filters for + the projects list page. Cached 5 minutes. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param status_id + + @return + + @error +} { + return [util_memoize [list pm::project::assignee_filter_select_helper -status_id $status_id] 3] +} + + +ad_proc -private pm::project::assignee_filter_select_helper { + {-status_id:required} +} { + Returns a list of lists, people who are assigned projects with a + status of status_id. Used in the list-builder filters for + the projects list page. Cached 5 minutes. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param status_id + + @return + + @error +} { + return [db_list_of_lists get_people { + SELECT + distinct(first_names || ' ' || last_name) as fullname, + u.person_id + FROM + persons u, + pm_project_assignment a, + pm_projects p + WHERE + u.person_id = a.party_id and + p.project_id = a.project_id and + p.status_id = :status_id + ORDER BY + fullname + }] +} Index: openacs-4/contrib/packages/project-manager/tcl/role-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/role-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/tcl/role-procs.tcl 27 Apr 2004 00:49:28 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/tcl/role-procs.tcl 11 Jun 2004 20:58:14 -0000 1.2 @@ -28,3 +28,66 @@ set returnval [db_string get_default "select role_id from pm_roles limit 1" -default "-1"] return $returnval } + + +ad_proc -public pm::role::select_list_filter {} { + Returns a select list. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @return + + @error +} { + return [util_memoize [list pm::role::select_list_filter_helper] 300] +} + + +ad_proc -private pm::role::select_list_filter_helper {} { + Returns a select list. Used so pm::role::select_list can be cached. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @return + + @error +} { + return [db_list_of_lists get_roles " + SELECT + one_line, + role_id + FROM + pm_roles + ORDER BY + role_id"] +} + + +ad_proc -public pm::role::select_list { + {-select_name:required} +} { + Returns a select list, suitable for use in an HTML form. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @return + + @error +} { + set select_list "" + + return $select_list +} Index: openacs-4/contrib/packages/project-manager/tcl/status-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/status-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/project-manager/tcl/status-procs.tcl 3 Jun 2004 21:32:02 -0000 1.1 +++ openacs-4/contrib/packages/project-manager/tcl/status-procs.tcl 11 Jun 2004 20:58:14 -0000 1.2 @@ -38,3 +38,33 @@ return $return_val } + + +ad_proc -public pm::status::project_status_select { +} { + Returns a list of project status codes, suitable for list-builder filters + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @return + + @error +} { + return [util_memoize [list pm::status::project_status_select_helper] 300] +} + + +ad_proc -private pm::status::project_status_select_helper { +} { + Returns a list of project status codes, suitable for list-builder filters + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @return + + @error +} { + return [db_list_of_lists get_status "select description, status_id from pm_project_status order by status_type desc, description"] +} Index: openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/task-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 10 Jun 2004 20:23:11 -0000 1.10 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 11 Jun 2004 20:58:14 -0000 1.11 @@ -1671,3 +1671,56 @@ }] } + + +ad_proc -public pm::task::assignee_filter_select { + {-status_id:required} +} { + Returns a list of lists, people who are assigned tasks with a + status of status_id. Used in the list-builder filters for + the tasks list page. Cached 5 minutes. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param status_id + + @return + + @error +} { + return [util_memoize [list pm::task::assignee_filter_select_helper -status_id $status_id] 1] +} + + +ad_proc -private pm::task::assignee_filter_select_helper { + {-status_id:required} +} { + Returns a list of lists, people who are assigned tasks with a + status of status_id. Used in the list-builder filters for + the tasks list page. Cached 5 minutes. + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-06-11 + + @param status_id + + @return + + @error +} { + return [db_list_of_lists get_people " + SELECT + distinct(first_names || ' ' || last_name) as fullname, + u.person_id + FROM + persons u, + pm_task_assignment a, + pm_tasks ts + WHERE + u.person_id = a.party_id and + ts.task_id = a.task_id and + ts.status = :status_id + ORDER BY + fullname"] +} Index: openacs-4/contrib/packages/project-manager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/index.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/contrib/packages/project-manager/www/index.tcl 27 Apr 2004 00:49:29 -0000 1.14 +++ openacs-4/contrib/packages/project-manager/www/index.tcl 11 Jun 2004 20:58:19 -0000 1.15 @@ -65,75 +65,19 @@ set status_id [pm::project::default_status_open] } -# Categories are arranges into category trees. -# Set up an array for each tree. The array contains the category for each tree -db_foreach get_choices { - select - t.name as cat_name, - t.category_id as cat_id, - tm.tree_id - from - category_tree_map tm, - categories c, - category_translations t - where - c.tree_id = tm.tree_id and - c.category_id = t.category_id and - tm.object_id = :package_id and - c.deprecated_p = 'f' - order - by t.name -} { - lappend category_choices($tree_id) [list $cat_name $cat_id] -} - # We want to set up a filter for each category tree. set export_vars [export_vars -form {status_id orderby}] -set category_select "" +set category_select [pm::util::category_selects \ + -export_vars $export_vars \ + -category_id [template::util::nvl category_id ""] \ + -package_id $package_id \ + ] -foreach tree_list [db_list_of_lists get_category_trees { - select - tt.name as tree_name, - tt.tree_id - from - category_tree_map tm, - category_tree_translations tt - where - tm.object_id = :package_id and - tm.tree_id = tt.tree_id -}] { - - set tree_name [lindex $tree_list 0] - set tree_id [lindex $tree_list 1] +# set assignees_filter [pm::project::assignee_filter_select -status_id $status_id] - if {![exists_and_not_null category_choices($tree_id)]} { - set category_choices($tree_id) [list] - } - - - - append category_select "" -} - - template::list::create \ -name projects \ -multirow projects \ @@ -174,7 +118,7 @@ -filters { status_id { label "Status" - values {[db_list_of_lists get_status "select description, status_id from pm_project_status order by status_type desc, description"]} + values {[pm::status::project_status_select]} where_clause {s.status_id = :status_id} } category_id { @@ -263,23 +207,9 @@ # This spits out the CSV if we happen to be in CSV layout if {[string equal $format csv]} { - #set csv [list::write_output -name pan] - #set outputheaders [ns_conn outputheaders] - #ns_set cput $outputheaders "Content-Disposition" "attachment; filename=pan.csv" - #doc_return 200 "application/text" "$csv" - # set csv [list::write_output -name projects] - - set outputheaders [ns_conn outputheaders] - ns_set cput $outputheaders "Content-Disposition" "attachment; filename=projects.xls" - - # ns_log Notice "csv: $csv" - list::write_output -name projects - # doc_return 200 application/vnd.ms-excel $csv - # ns_return 200 application/vnd.ms-excel $csv - } Index: openacs-4/contrib/packages/project-manager/www/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one-postgresql.xql,v diff -u -r1.25 -r1.26 --- openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 3 Jun 2004 21:32:05 -0000 1.25 +++ openacs-4/contrib/packages/project-manager/www/one-postgresql.xql 11 Jun 2004 20:58:19 -0000 1.26 @@ -111,12 +111,20 @@Assignees | +
---|
+ |
+
+
|
+