Index: openacs-4/contrib/obsolete-packages/acs-workflow/www/task.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/acs-workflow/www/task.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/obsolete-packages/acs-workflow/www/task.tcl 18 May 2001 00:35:44 -0000 1.3 +++ openacs-4/contrib/obsolete-packages/acs-workflow/www/task.tcl 19 Nov 2001 18:27:40 -0000 1.4 @@ -20,6 +20,7 @@ user_id return_url export_form_vars + extreme_p } set user_id [ad_get_user_id] @@ -60,14 +61,7 @@ array set task [wf_task_info $task_id] -ns_log Notice "task array = [join [array get task] ","]" -# if the user is assigned, they can always view the task. -# if they aren't assigned and there is an access_privilege, we check it -if { ! $task(this_user_is_assigned_p) && ![empty_string_p $task(access_privilege)]} { - ad_require_permission $task(object_id) $task(access_privilege) -} - set task(add_assignee_url) "assignee-add?[export_url_vars task_id]" set task(assign_yourself_url) "assign-yourself?[export_vars -url {task_id return_url}]" set task(manage_assignments_url) "task-assignees?[export_vars -url {task_id return_url}]" @@ -79,44 +73,85 @@ template::multirow create panels header template_url bgcolor +set this_user_is_assigned_p $task(this_user_is_assigned_p) + db_multirow panels panels { select tp.header, tp.template_url, '' as bgcolor - from wf_context_task_panels tp, + from wf_context_task_panels tp, wf_cases c, wf_tasks t - where t.task_id = :task_id - and c.case_id = t.case_id - and tp.context_key = c.context_key - and tp.workflow_key = c.workflow_key - and tp.transition_key = t.transition_key - order by sort_key + where t.task_id = :task_id + and c.case_id = t.case_id + and tp.context_key = c.context_key + and tp.workflow_key = c.workflow_key + and tp.transition_key = t.transition_key + and (tp.only_display_when_started_p = 'f' or (t.state = 'started' and :this_user_is_assigned_p = 1)) + and tp.overrides_action_p = 'f' + order by tp.sort_order } { set bgcolor $panel_color } +# Only display the default-info-panel when we have nothing better if { ${panels:rowcount} == 0 } { template::multirow append panels "Case" "task-default-info" $panel_color } -template::multirow append panels "Action" "task-action" "#ffffff" +# Display instructions, if any +if { [db_string instruction_check " + select count(*) + from wf_transition_info ti, wf_tasks t + where t.task_id = :task_id + and t.transition_key = ti.transition_key + and t.workflow_key = ti.workflow_key + and instructions is not null +"] } { + template::multirow append panels "Instructions" "task-instructions" $panel_color +} -set panel_width [expr {100/(${panels:rowcount})}] +# Now for action panels -- these are always displayed at the far right -set case_id $task(case_id) +set override_action 0 +db_foreach action_panels { + select tp.header, + tp.template_url + from wf_context_task_panels tp, + wf_cases c, + wf_tasks t + where t.task_id = :task_id + and c.case_id = t.case_id + and tp.context_key = c.context_key + and tp.workflow_key = c.workflow_key + and tp.transition_key = t.transition_key + and (tp.only_display_when_started_p = 'f' or (t.state = 'started' and :this_user_is_assigned_p = 1)) + and tp.overrides_action_p = 't' + order by tp.sort_order +} { + set override_action 1 + template::multirow append panels $header $template_url "#ffffff" +} -set case_finished_p [db_string case_finished "select count(*) from wf_cases where case_id = (select distinct case_id from wf_tasks where task_id = :task_id) and state = 'finished'"] +if { $override_action == 0 } { + template::multirow append panels "Action" "task-action" "#ffffff" +} -template::multirow create extreme_actions url title -template::multirow append extreme_actions "case-state-change?[export_url_vars case_id]&action=suspend" "suspend case" -template::multirow append extreme_actions "case-state-change?[export_url_vars case_id]&action=cancel" "cancel case" +set panel_width [expr {100/(${panels:rowcount})}] -set export_form_vars [export_vars -form {task_id return_url}] +set case_id $task(case_id) -ad_return_template +set case_state [db_string case_state "select state from wf_cases where case_id = :case_id"] +set extreme_p 0 +if {[string compare $case_state "active"] == 0} { + set extreme_p 1 + template::multirow create extreme_actions url title + template::multirow append extreme_actions "case-state-change?[export_url_vars case_id]&action=suspend" "suspend case" + template::multirow append extreme_actions "case-state-change?[export_url_vars case_id]&action=cancel" "cancel case" +} +set export_form_vars [export_vars -form {task_id return_url}] - +ad_return_template