Index: openacs-4/contrib/packages/simulation/lib/sim-template-roles.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-template-roles.tcl,v
diff -u -r1.11.2.1 -r1.11.2.2
--- openacs-4/contrib/packages/simulation/lib/sim-template-roles.tcl 1 Jun 2004 14:18:08 -0000 1.11.2.1
+++ openacs-4/contrib/packages/simulation/lib/sim-template-roles.tcl 1 Jun 2004 15:03:31 -0000 1.11.2.2
@@ -41,6 +41,22 @@
}
}
+ down {
+ sub_class narrow
+ display_template {
+
+
+
+ }
+ }
+ up {
+ sub_class narrow
+ display_template {
+
+
+
+ }
+ }
name {
label "Name"
display_col pretty_name
@@ -58,15 +74,23 @@
#-------------------------------------------------------------
# roles db_multirow
#-------------------------------------------------------------
-set return_url "[ad_conn url]?[ad_conn query]"
-db_multirow -extend { edit_url char_url delete_url } roles select_roles "
+set counter 0
+db_multirow -extend { edit_url char_url delete_url up_url down_url } roles select_roles "
select wr.role_id,
wr.pretty_name,
wr.sort_order
from workflow_roles wr
where wr.workflow_id = :workflow_id
order by wr.sort_order
" {
+ incr counter
set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { role_id }]
- set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-delete" { role_id return_url }]
+ set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-delete" { role_id { return_url [ad_return_url] } }]
+ if { $counter > 1 } {
+ set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type role } role_id { direction up } { return_url [ad_return_url] } }]
+ }
+ set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type role } role_id { direction down } { return_url [ad_return_url] } }]
}
+
+# Get rid of the last down_url
+set roles:${counter}(down_url) {}
Index: openacs-4/contrib/packages/simulation/tcl/sim-role-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/sim-role-procs.tcl,v
diff -u -r1.9 -r1.9.2.1
--- openacs-4/contrib/packages/simulation/tcl/sim-role-procs.tcl 27 Jan 2004 10:33:16 -0000 1.9
+++ openacs-4/contrib/packages/simulation/tcl/sim-role-procs.tcl 1 Jun 2004 15:03:31 -0000 1.9.2.1
@@ -172,10 +172,15 @@
}
db_1row select_sim_role {
- select character_id,
- users_per_case
- from sim_roles
- where role_id = :role_id
+ select sr.character_id,
+ sr.users_per_case,
+ scx.name as character_name,
+ scx.title as character_title,
+ scx.item_id as character_item_id
+ from sim_roles sr left outer join
+ sim_charactersx scx on (scx.item_id = sr.character_id) left outer join
+ cr_items ci on (ci.item_id = scx.item_id and ci.live_revision = scx.object_id)
+ where sr.role_id = :role_id
} -column_array local_row
array set row [array get local_row]
Index: openacs-4/contrib/packages/simulation/www/simbuild/template-object-reorder.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simbuild/Attic/template-object-reorder.tcl,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/contrib/packages/simulation/www/simbuild/template-object-reorder.tcl 12 Jan 2004 12:12:56 -0000 1.2
+++ openacs-4/contrib/packages/simulation/www/simbuild/template-object-reorder.tcl 1 Jun 2004 15:03:31 -0000 1.2.2.1
@@ -19,13 +19,18 @@
set workflow_id [workflow::state::fsm::get_element -state_id $state_id -element workflow_id]
set all_ids [workflow::state::fsm::get_ids -workflow_id $workflow_id]
}
+ role {
+ set object_id $role_id
+ set workflow_id [workflow::role::get_element -role_id $role_id -element workflow_id]
+ set all_ids [workflow::role::get_ids -workflow_id $workflow_id]
+ }
action {
set object_id $action_id
set workflow_id [workflow::action::get_element -action_id $action_id -element workflow_id]
set all_ids [workflow::action::get_ids -workflow_id $workflow_id]
}
default {
- error "Invalid type, $type, only implemented for 'state' and 'action'."
+ error "Invalid type, $type, only implemented for 'state', 'role', and 'action'."
}
}
@@ -38,13 +43,19 @@
down {
set new_index [expr $cur_index + 1]
}
+ default {
+ error "Invalid direction. Valid directions are 'up', 'down'"
+ }
}
if { $new_index >= 0 && $new_index < [llength $all_ids] } {
switch $type {
state {
set new_sort_order [workflow::state::fsm::get_element -state_id [lindex $all_ids $new_index] -element sort_order]
}
+ role {
+ set new_sort_order [workflow::role::get_element -role_id [lindex $all_ids $new_index] -element sort_order]
+ }
action {
set new_sort_order [workflow::action::get_element -action_id [lindex $all_ids $new_index] -element sort_order]
}
@@ -63,6 +74,12 @@
-workflow_id $workflow_id \
-array row
}
+ role {
+ workflow::role::edit \
+ -role_id $role_id \
+ -workflow_id $workflow_id \
+ -array row
+ }
action {
workflow::action::edit \
-action_id $action_id \
Index: openacs-4/packages/simulation/lib/sim-template-roles.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-roles.tcl,v
diff -u -r1.11.2.1 -r1.11.2.2
--- openacs-4/packages/simulation/lib/sim-template-roles.tcl 1 Jun 2004 14:18:08 -0000 1.11.2.1
+++ openacs-4/packages/simulation/lib/sim-template-roles.tcl 1 Jun 2004 15:03:31 -0000 1.11.2.2
@@ -41,6 +41,22 @@
}
}
+ down {
+ sub_class narrow
+ display_template {
+
+
+
+ }
+ }
+ up {
+ sub_class narrow
+ display_template {
+
+
+
+ }
+ }
name {
label "Name"
display_col pretty_name
@@ -58,15 +74,23 @@
#-------------------------------------------------------------
# roles db_multirow
#-------------------------------------------------------------
-set return_url "[ad_conn url]?[ad_conn query]"
-db_multirow -extend { edit_url char_url delete_url } roles select_roles "
+set counter 0
+db_multirow -extend { edit_url char_url delete_url up_url down_url } roles select_roles "
select wr.role_id,
wr.pretty_name,
wr.sort_order
from workflow_roles wr
where wr.workflow_id = :workflow_id
order by wr.sort_order
" {
+ incr counter
set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { role_id }]
- set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-delete" { role_id return_url }]
+ set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-delete" { role_id { return_url [ad_return_url] } }]
+ if { $counter > 1 } {
+ set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type role } role_id { direction up } { return_url [ad_return_url] } }]
+ }
+ set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type role } role_id { direction down } { return_url [ad_return_url] } }]
}
+
+# Get rid of the last down_url
+set roles:${counter}(down_url) {}
Index: openacs-4/packages/simulation/tcl/sim-role-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/sim-role-procs.tcl,v
diff -u -r1.9 -r1.9.2.1
--- openacs-4/packages/simulation/tcl/sim-role-procs.tcl 27 Jan 2004 10:33:16 -0000 1.9
+++ openacs-4/packages/simulation/tcl/sim-role-procs.tcl 1 Jun 2004 15:03:31 -0000 1.9.2.1
@@ -172,10 +172,15 @@
}
db_1row select_sim_role {
- select character_id,
- users_per_case
- from sim_roles
- where role_id = :role_id
+ select sr.character_id,
+ sr.users_per_case,
+ scx.name as character_name,
+ scx.title as character_title,
+ scx.item_id as character_item_id
+ from sim_roles sr left outer join
+ sim_charactersx scx on (scx.item_id = sr.character_id) left outer join
+ cr_items ci on (ci.item_id = scx.item_id and ci.live_revision = scx.object_id)
+ where sr.role_id = :role_id
} -column_array local_row
array set row [array get local_row]
Index: openacs-4/packages/simulation/www/simbuild/template-object-reorder.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-object-reorder.tcl,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/packages/simulation/www/simbuild/template-object-reorder.tcl 12 Jan 2004 12:12:56 -0000 1.2
+++ openacs-4/packages/simulation/www/simbuild/template-object-reorder.tcl 1 Jun 2004 15:03:31 -0000 1.2.2.1
@@ -19,13 +19,18 @@
set workflow_id [workflow::state::fsm::get_element -state_id $state_id -element workflow_id]
set all_ids [workflow::state::fsm::get_ids -workflow_id $workflow_id]
}
+ role {
+ set object_id $role_id
+ set workflow_id [workflow::role::get_element -role_id $role_id -element workflow_id]
+ set all_ids [workflow::role::get_ids -workflow_id $workflow_id]
+ }
action {
set object_id $action_id
set workflow_id [workflow::action::get_element -action_id $action_id -element workflow_id]
set all_ids [workflow::action::get_ids -workflow_id $workflow_id]
}
default {
- error "Invalid type, $type, only implemented for 'state' and 'action'."
+ error "Invalid type, $type, only implemented for 'state', 'role', and 'action'."
}
}
@@ -38,13 +43,19 @@
down {
set new_index [expr $cur_index + 1]
}
+ default {
+ error "Invalid direction. Valid directions are 'up', 'down'"
+ }
}
if { $new_index >= 0 && $new_index < [llength $all_ids] } {
switch $type {
state {
set new_sort_order [workflow::state::fsm::get_element -state_id [lindex $all_ids $new_index] -element sort_order]
}
+ role {
+ set new_sort_order [workflow::role::get_element -role_id [lindex $all_ids $new_index] -element sort_order]
+ }
action {
set new_sort_order [workflow::action::get_element -action_id [lindex $all_ids $new_index] -element sort_order]
}
@@ -63,6 +74,12 @@
-workflow_id $workflow_id \
-array row
}
+ role {
+ workflow::role::edit \
+ -role_id $role_id \
+ -workflow_id $workflow_id \
+ -array row
+ }
action {
workflow::action::edit \
-action_id $action_id \