Index: openacs-4/packages/tasks/tcl/tasks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tasks/tcl/tasks-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/tasks/tcl/tasks-procs.tcl 7 Nov 2005 17:44:04 -0000 1.7 +++ openacs-4/packages/tasks/tcl/tasks-procs.tcl 17 Nov 2005 16:04:39 -0000 1.8 @@ -14,107 +14,6 @@ namespace eval tasks::process::task {} namespace eval tasks::process::instance {} - -ad_proc -public tasks::new { - -party_id:required - {-object_id ""} - {-process_id ""} - -title:required - {-description ""} - {-mime_type "text/plain"} - {-comment ""} - -due_date:required - {-priority 0} - {-status "o"} - {-user_id ""} - {-ip_addr ""} - {-package_id ""} -} { - insert new task -} { - if {[empty_string_p $package_id]} { - set package_id [ad_conn package_id] - } - if {[empty_string_p $user_id]} { - set user_id [ad_conn user_id] - } - if {[empty_string_p $ip_addr]} { - set ip_addr [ad_conn peeraddr] - } - - set task_id [db_exec_plsql create_task {}] - - return $task_id -} - -ad_proc -public tasks::edit { - -task_id:required - -title:required - {-description ""} - {-mime_type "text/plain"} - {-comment ""} - -due_date:required - {-priority 0} - {-status "o"} - {-user_id ""} - {-ip_addr ""} -} { - update task -} { - if {[empty_string_p $user_id]} { - set user_id [ad_conn user_id] - } - if {[empty_string_p $ip_addr]} { - set ip_addr [ad_conn peeraddr] - } - - db_dml update_task {} - db_dml update_object {} -} - - -ad_proc -public tasks::project_id { - {-package_id ""} -} { - Returns this tasks instance project_id -} { - if { [string is false [exists_and_not_null package_id]] } { - set package_id [ad_conn package_id] - } - set project_id [db_string get_project_id { - select pm_projectsx.item_id - from pm_projectsx, - cr_folders cf - where pm_projectsx.parent_id = cf.folder_id - and cf.package_id = :package_id - } -default {}] - if { [string is false [exists_and_not_null project_id]] } { - tasks::initialize -package_id $package_id - set project_id [tasks::project_id -package_id $package_id] - } - return $project_id -} - -ad_proc -public tasks::initialize { - {-package_id ""} -} { - Returns this tasks instance project_id -} { - if { [string is false [exists_and_not_null package_id]] } { - set package_id [ad_conn package_id] - } - if { [string is false [db_0or1row project_exists_p { select 1 from cr_folders where package_id = :package_id and label = 'Projects' }]] } { - pm::project::new -project_name "[_ tasks.Tasks_Instance]" \ - -status_id "1" \ - -organization_id "" \ - -creation_user [ad_conn user_id] \ - -creation_ip [ad_conn peeraddr] \ - -ongoing_p "t" \ - -package_id $package_id - } -} - - ad_proc -public tasks::task::new { {-task_id ""} {-process_instance_id ""} @@ -298,3 +197,105 @@ return $task_id } + + + +ad_proc -public tasks::new { + -party_id:required + {-object_id ""} + {-process_id ""} + -title:required + {-description ""} + {-mime_type "text/plain"} + {-comment ""} + -due_date:required + {-priority 0} + {-status "o"} + {-user_id ""} + {-ip_addr ""} + {-package_id ""} +} { + insert new task +} { + if {[empty_string_p $package_id]} { + set package_id [ad_conn package_id] + } + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + if {[empty_string_p $ip_addr]} { + set ip_addr [ad_conn peeraddr] + } + + set task_id [db_exec_plsql create_task {}] + + return $task_id +} + +ad_proc -public tasks::edit { + -task_id:required + -title:required + {-description ""} + {-mime_type "text/plain"} + {-comment ""} + -due_date:required + {-priority 0} + {-status "o"} + {-user_id ""} + {-ip_addr ""} +} { + update task +} { + if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] + } + if {[empty_string_p $ip_addr]} { + set ip_addr [ad_conn peeraddr] + } + + db_dml update_task {} + db_dml update_object {} +} + + +ad_proc -public tasks::project_id { + {-package_id ""} +} { + Returns this tasks instance project_id +} { + if { [string is false [exists_and_not_null package_id]] } { + set package_id [ad_conn package_id] + } + set project_id [db_string get_project_id { + select pm_projectsx.item_id + from pm_projectsx, + cr_folders cf + where pm_projectsx.parent_id = cf.folder_id + and cf.package_id = :package_id + } -default {}] + if { [string is false [exists_and_not_null project_id]] } { + tasks::initialize -package_id $package_id + set project_id [tasks::project_id -package_id $package_id] + } + return $project_id +} + +ad_proc -public tasks::initialize { + {-package_id ""} +} { + Returns this tasks instance project_id +} { + if { [string is false [exists_and_not_null package_id]] } { + set package_id [ad_conn package_id] + } + if { [string is false [db_0or1row project_exists_p { select 1 from cr_folders where package_id = :package_id and label = 'Projects' }]] } { + pm::project::new -project_name "[_ tasks.Tasks_Instance]" \ + -status_id "1" \ + -organization_id "" \ + -creation_user [ad_conn user_id] \ + -creation_ip [ad_conn peeraddr] \ + -ongoing_p "t" \ + -package_id $package_id + } +} +