wftk_interpret
function takes a list of lines returned from the wftk core engine,
and does the task creation and notification specified.
proc wftk_interpret {db process workflow} { while {[llength $workflow] > 0} { set cmd [lindex $workflow 0] set workflow [lrange $workflow 1 end] switch [string range $cmd 0 0] { A { See Starting tasks } L { See Handling notifications } F { See Completing the process } } } } |
set p [split [string range $cmd 2 end] -] set fields [list id status created] set values [list '[lindex $p 0]' 'active' '[now]'] lappend fields process lappend values "'$process'" lappend fields owner set owner [lindex $p 1] if ![string compare $owner "!user"] { upvar user user set owner $user } lappend values '[sql_safe_string $owner]' lappend fields description lappend values '[sql_safe_string [join [lrange $p 2 end] -]]' set query "insert into task (" append query [join $fields ", "] append query ") values (" append query [join $values ", "] append query ")" ns_db dml $db $query |
set query "update process set status='complete' where id='$process'" ns_db dml $db $query |
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. |