global todomgr_pool set db [ns_db gethandle $todomgr_pool] See Checking authuser set form [ns_conn form $conn] set task "" if {$form != ""} { set task [ns_set get $form task] } if {$task == ""} { set tags(title) "No task specified" set tags(body) "Task rejection requires a task identifier." return [todomgr_pageout $conn message.html] } |
set query "select * from task where id='[sql_safe_string $task]'" if {[catch {set row [ns_db select $db $query]} result] || ![ns_db getrow $db $row]} { set tags(title) "Task unknown" set tags(body) "The task you specified (<code>$task</code>) could not be found in the database." return [todomgr_pageout $conn message.html] } if [string compare $user [ns_set get $row owner]] { set tags(title) "Insufficient privilege" set tags(body) "You are not the owner of this task. Only the owner may reject a task." return [todomgr_pageout $conn message.html] } |
set process [ns_set get $row process] if {$process == ""} { set query "update task set status='rejected'" append query " where id='[sql_safe_string $task]'" ns_db dml $db $query if [string compare [ns_set get $form back] ""] { return [ns_returnredirect $conn [ns_set get $form back]] } set tags(title) "Task rejected" set tags(body) "The task has been marked as rejected" return [todomgr_pageout $conn message.html] } |
set query "select * from process where id='[sql_safe_string $process]'" set row [ns_db select $db $query] if ![ns_db getrow $db $row] { set query "update task set status='rejected'" append query " where id='[sql_safe_string $task]'" ns_db dml $db $query if [string compare [ns_set get $form back] ""] { return [ns_returnredirect $conn [ns_set get $form back]] } set tags(title) "Task rejected" set tags(body) "The task has been marked as rejected" return [todomgr_pageout $conn message.html] } |
If the process has a definition, then we need to hand things off to wftk. As the core engine hasn't been written yet, I'll punt and do absolutely nothing.
if [string compare "" [ns_set get $row definition]] { set tags(title) "wftk must handle rejection" set tags(body) "This task must be rejected by the wftk engine." return [todomgr_pageout $conn message.html] } |
set query "update task set status='rejected' where id='[sql_safe_string $task]'" ns_db dml $db $query if [string compare [ns_set get $form back] ""] { return [ns_returnredirect $conn [ns_set get $form back]] } set tags(title) "Task complete" set tags(body) "The task has been marked as complete" return [todomgr_pageout $conn message.html] |
This code and documentation are released under the terms of the GNU license. They are additionally copyright (c) 2000, Vivtek. All rights reserved except those explicitly granted under the terms of the GNU license. |