Index: openacs-4/contrib/packages/project-manager/tcl/project-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs-oracle.xql,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/contrib/packages/project-manager/tcl/project-procs-oracle.xql 18 Dec 2004 00:15:13 -0000 1.1.2.3 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs-oracle.xql 20 Dec 2004 19:47:39 -0000 1.1.2.4 @@ -170,7 +170,7 @@ WHERE task_revision_id = (select live_revision from cr_items where item_id = :task_item) - + SELECT @@ -179,7 +179,7 @@ pm_project_assignment WHERE project_id = :project_item_id and - party_id = :present_user_id + party_id = :party_id LIMIT 1 Index: openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-procs-postgresql.xql,v diff -u -r1.4.2.6 -r1.4.2.7 --- openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql 18 Dec 2004 00:13:40 -0000 1.4.2.6 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs-postgresql.xql 20 Dec 2004 19:47:39 -0000 1.4.2.7 @@ -231,7 +231,7 @@ lower(p.title), lower(o.name) - + SELECT @@ -240,7 +240,7 @@ pm_project_assignment WHERE project_id = :project_item_id and - party_id = :present_user_id + party_id = :party_id LIMIT 1 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.6.2.16 -r1.6.2.17 --- openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 18 Dec 2004 00:14:21 -0000 1.6.2.16 +++ openacs-4/contrib/packages/project-manager/tcl/project-procs.tcl 20 Dec 2004 19:47:39 -0000 1.6.2.17 @@ -1736,14 +1736,17 @@ } { db_dml insert_assignment { - insert into pm_project_assignment + insert into pm_project_assignment (project_id, role_id, party_id) VALUES (:project_item_id, :role_id, :party_id) - } + } + + # Flush the cache that remembers which roles to offer the current user in the 'assign role to myself' listbox + util_memoize_flush [list pm::role::project_select_list_filter_not_cached -project_item_id $project_item_id -party_id $party_id] if {[string is true $send_email_p]} { - + set project_name [pm::project::name \ -project_item_id $project_item_id] @@ -1797,6 +1800,11 @@ party_id = :party_id } + # Flush the cache that remembers which roles to offer the current user in the 'assign role to myself' listbox + if {[ad_conn user_id == $party_id]} { + util_memoize_flush [list pm::role::project_select_list_filter_not_cached -project_item_id $project_item_id -party_id $party_id] + } + return } @@ -1832,6 +1840,8 @@ project_id = :project_item_id } + # Flush the cache that remembers which roles to offer the current user in the 'assign role to myself' listbox + util_memoize_flush [list pm::role::project_select_list_filter_not_cached -project_item_id $project_item_id -party_id [ad_conn user_id]] return $current_assignees } @@ -1923,29 +1933,30 @@ ad_proc -public pm::project::assigned_p { -project_item_id:required + -party_id:required } { - Returns true if user has been assigned to a project + Returns 1 if user has been assigned to a project @author Richard Hamilton (ricky.hamilton@btopenworld.com) @creation-date 2004-12-17 @param project_item_id + + @param party_id @return @error } { - set present_user_id [ad_conn user_id] - return [db_0or1row assigned_p { SELECT party_id FROM pm_project_assignment WHERE project_id = :project_item_id and - party_id = :present_user_id + party_id = :party_id LIMIT 1 }] @@ -2067,3 +2078,4 @@ } } + 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.2.2.4 -r1.2.2.5 --- openacs-4/contrib/packages/project-manager/tcl/role-procs.tcl 26 Oct 2004 01:22:27 -0000 1.2.2.4 +++ openacs-4/contrib/packages/project-manager/tcl/role-procs.tcl 20 Dec 2004 19:47:39 -0000 1.2.2.5 @@ -1,4 +1,4 @@ -# +# ad_library { @@ -36,8 +36,8 @@ @author Jade Rubick (jader@bread.com) @creation-date 2004-06-11 - @return - + @return + @error } { return [util_memoize [list pm::role::select_list_filter_not_cached] 300] @@ -46,13 +46,13 @@ ad_proc -private pm::role::select_list_filter_not_cached {} { 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 + + @error } { return [db_list_of_lists get_roles " SELECT @@ -69,13 +69,13 @@ {-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 + + @return + + @error } { set select_list "" + + set select_list_options [pm::role::project_select_list_filter -project_item_id $project_item_id -party_id $party_id] + + foreach option $select_list_options { + set description [lindex $option 0] + set value [lindex $option 1] + append select_list "" + } + + append select_list "" + + return $select_list +} + + +ad_proc -public pm::role::task_select_list_filter { + -task_item_id:required + -party_id:required +} { + Returns a select list. + + @author Richard Hamilton (ricky.hamilton@btopenworld.com) + @creation-date 2004-12-18 + + @param task_item_id + + @param party_id + + @return + + @error +} { + return [util_memoize [list pm::role::task_select_list_filter_not_cached -task_item_id $task_item_id -party_id $party_id] 300] +} + + +ad_proc -private pm::role::task_select_list_filter_not_cached { + -task_item_id:required + -party_id:required +} { + Returns a select list. Used so pm::role::task_select_list can be cached. + + @author Richard Hamilton (ricky.hamilton@btopenworld.com) + @creation-date 2004-12-18 + + @param task_item_id + + @param party_id + + @return + + @error +} { + return [db_list_of_lists get_roles " + SELECT + one_line || ' (' || substring(one_line from 1 for 1) || ')' as one_line, + role_id + FROM + pm_roles as r + WHERE NOT EXISTS + (SELECT 1 + FROM + pm_task_assignment as ta + WHERE + r.role_id = ta.role_id and + ta.task_id = :task_item_id and + ta.party_id = :party_id) + ORDER BY + role_id"] +} + + +ad_proc -public pm::role::task_select_list { + {-select_name:required} + {-task_item_id:required} + {-party_id: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 +} + + ad_proc -public pm::role::name { -role_id:required } { Returns the one_line for the role from the role_id - + @author Jade Rubick (jader@bread.com) @creation-date 2004-09-08 - + @param role_id @return one_line @@ -115,14 +289,14 @@ -role_id:required } { Returns the one_line for the role from the role_id - + @author Jade Rubick (jader@bread.com) @creation-date 2004-09-08 @param role_id @return one_line - + @error } { return [db_string get_one_line { Index: openacs-4/contrib/packages/project-manager/tcl/task-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/task-procs-oracle.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/tcl/task-procs-oracle.xql 22 Oct 2004 04:28:35 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs-oracle.xql 20 Dec 2004 19:47:39 -0000 1.1.2.2 @@ -122,4 +122,5 @@ end; + 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.4.2.35 -r1.4.2.36 --- openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 15 Dec 2004 21:34:36 -0000 1.4.2.35 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs.tcl 20 Dec 2004 19:47:39 -0000 1.4.2.36 @@ -978,7 +978,11 @@ @error } { + db_dml remove_assignment { } + + # Flush the cache that remembers which roles to offer the current user in the 'assign role to myself' listbox + util_memoize_flush [list pm::role::task_select_list_filter_not_cached -task_item_id $task_item_id -party_id [ad_conn user_id]] } @@ -1000,6 +1004,11 @@ @error } { db_dml remove_assignment { } + + # Flush the cache that remembers which roles to offer the current user in the 'assign role to myself' listbox + if {[ad_conn user_id] == $party_id} { + util_memoize_flush [list pm::role::task_select_list_filter_not_cached -task_item_id $task_item_id -party_id $party_id] + } } @@ -1019,7 +1028,7 @@ @param role_id the role under which the person is assigned - @return + @return @error } { @@ -1049,6 +1058,11 @@ :party_id) } } + + # Flush the cache that remembers which roles to offer the current user in the 'assign role to myself' listbox + if {[ad_conn user_id] == $party_id} { + util_memoize_flush [list pm::role::task_select_list_filter_not_cached -task_item_id $task_item_id -party_id $party_id] + } } Index: openacs-4/contrib/packages/project-manager/tcl/task-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/task-procs.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/contrib/packages/project-manager/tcl/task-procs.xql 18 Nov 2004 21:04:21 -0000 1.1.2.1 +++ openacs-4/contrib/packages/project-manager/tcl/task-procs.xql 20 Dec 2004 19:47:39 -0000 1.1.2.2 @@ -28,11 +28,14 @@ - SELECT 1 FROM + SELECT + party_id + FROM pm_task_assignment - WHERE + WHERE task_id = :task_item_id and party_id = :party_id + LIMIT 1 Index: openacs-4/contrib/packages/project-manager/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/one.adp,v diff -u -r1.31.2.13 -r1.31.2.14 --- openacs-4/contrib/packages/project-manager/www/one.adp 17 Dec 2004 22:58:44 -0000 1.31.2.13 +++ openacs-4/contrib/packages/project-manager/www/one.adp 20 Dec 2004 19:48:30 -0000 1.31.2.14 @@ -149,7 +149,9 @@