Index: openacs-4/contrib/packages/simulation/www/siminst/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/index.tcl,v
diff -u -r1.24 -r1.25
--- openacs-4/contrib/packages/simulation/www/siminst/index.tcl 5 Jan 2004 10:42:35 -0000 1.24
+++ openacs-4/contrib/packages/simulation/www/siminst/index.tcl 6 Jan 2004 14:56:42 -0000 1.25
@@ -9,7 +9,6 @@
permission::require_permission -object_id $package_id -privilege sim_inst
set admin_p [permission::permission_p -object_id $package_id -privilege admin]
set base_url [apm_package_url_from_id $package_id]
-set add_url "${base_url}/siminst/simulation-new"
#---------------------------------------------------------------------
# dev_sims: simulations in development
@@ -18,14 +17,14 @@
template::list::create \
-name dev_sims \
-multirow dev_sims \
- -actions "{New Simulation From Template} $add_url" \
+ -actions "{New Simulation From Template} simulation-new" \
-no_data "No Simulations are in Development" \
-sub_class "narrow" \
-elements {
pretty_name {
- link_url_col edit_url
label "Simulation"
orderby upper(w.pretty_name)
+ link_url_eval {[export_vars -base wizard { workflow_id }]}
}
description {
label "Description"
@@ -138,9 +137,9 @@
-no_data "No Simulations are in Casting" \
-elements {
pretty_name {
- link_url_col edit_url
label "Simulation"
orderby upper(w.pretty_name)
+ link_url_col edit_url
}
groups {
label {Groups}
Index: openacs-4/contrib/packages/simulation/www/siminst/map-characters.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/map-characters.adp,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/packages/simulation/www/siminst/map-characters.adp 18 Dec 2003 09:58:28 -0000 1.5
+++ openacs-4/contrib/packages/simulation/www/siminst/map-characters.adp 6 Jan 2004 14:56:42 -0000 1.6
@@ -1,9 +1,5 @@
- TODO: "perhaps it would help if there was a description describing
-the roles of giver and receiver ... either better rolenames ... or what the roles do in the simulation template"
TODO: an "attach new prop" button next to each attachment dropdown +that lets the user create a new prop and then return to this page, +where the new prop is already set as the attachment.
- - -Back to simulation list -TODO: don't show initial task on this list - +
+ TODO: (low priority) allow props to be embedded within description + body so that they will be displayed as links in simplay when user + looks at task description +
Index: openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/map-tasks.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl 5 Jan 2004 10:31:41 -0000 1.5 +++ openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl 6 Jan 2004 14:56:42 -0000 1.6 @@ -6,50 +6,124 @@ workflow_id:integer } -workflow::get -workflow_id $workflow_id -array workflow_array -set page_title "Tasks for $workflow_array(pretty_name)" -set context [list [list "." "SimInst" ] $page_title] +set user_id [auth::require_login] -db_multirow -extend { description_html prop_missing_count } tasks select_taks { +ad_form \ + -name tasks \ + -form { + {workflow_id:integer(hidden) {value $workflow_id}} + } + +set prop_options [simulation::object::get_object_type_options -object_type "sim_prop"] + +set actions [list] + +db_foreach tasks { select a.action_id, - a.short_name, a.pretty_name, a.description, a.description_mime_type, st.attachment_num, - (select count(*) - from sim_task_object_map stom - where stom.task_id = st.task_id) as prop_not_empty_count + (select pretty_name from workflow_roles where role_id = a.assigned_role) as assigned_role_pretty, + (select pretty_name from workflow_roles where role_id = st.recipient) as recipient_role_pretty, + (select count(*) from workflow_initial_action where action_id = a.action_id) as initial_p from workflow_actions a, sim_tasks st where a.workflow_id = :workflow_id and st.task_id = a.action_id order by a.sort_order -} { - set description_html [ad_html_text_convert -maxlen 100 -from $description_mime_type -- $description] - set prop_missing_count [expr $attachment_num - $prop_not_empty_count] +} -column_array row { + if { !$row(initial_p) } { + set section_name "Task $row(pretty_name)" + if { ![empty_string_p $row(assigned_role_pretty)] || ![empty_string_p $row(recipient_role_pretty)] } { + append section_name " (" + if { ![empty_string_p $row(assigned_role_pretty)] } { + append section_name $row(assigned_role_pretty) + } + if { ![empty_string_p $row(recipient_role_pretty)] } { + append section_name "-> $row(recipient_role_pretty))" + } + } + + ad_form -extend -name tasks -form \ + [list [list description_$row(action_id):richtext,optional \ + {label "Task Description"} \ + {html {cols 60 rows 4}} \ + {section $section_name}]] + + set description_$row(action_id) [template::util::richtext::create $row(description) $row(description_mime_type)] + + # Save attachment_num for later + ad_form -extend -name tasks -form \ + [list [list attachment_num_$row(action_id):integer(hidden),optional \ + {value $row(attachment_num)}]] + + for { set i 1 } { $i <= $row(attachment_num) } { incr i } { + ad_form -extend -name tasks -form \ + [list [list attachment_$row(action_id)_$i:integer(select),optional \ + {label "Attachment $i"} \ + {options $prop_options}]] + } + + lappend actions $row(action_id) + } } -template::list::create \ - -name "tasks" \ - -elements { - pretty_name { - label "Name" - link_url_eval {[export_vars -base task-edit { action_id }]} +wizard submit tasks -buttons { back next } + +ad_form \ + -extend \ + -name tasks \ + -form { + {actions:text(hidden) {value $actions}} + } \ + -on_request { + db_foreach attachments { + select a.action_id, + m.object_id, + m.order_n + from workflow_actions a, + sim_task_object_map m + where a.workflow_id = :workflow_id + and m.task_id = a.action_id + and m.relation_tag = 'attachment' + } { + set attachment_${action_id}_${order_n} $object_id } - description { - label "Description" - display_template {@tasks.description_html;noquote@} + } -on_submit { + + db_transaction { + + foreach action_id $actions { + + array unset row + set row(description_mime_type) [template::util::richtext::get_property format [set description_${action_id}]] + set row(description) [template::util::richtext::get_property contents [set description_${action_id}]] + + simulation::action::edit \ + -action_id $action_id \ + -workflow_id $workflow_id \ + -array row + + # TODO B: The way we do this update is not very pretty: Delete all relations and re-add the new ones + db_dml delete_all_relations { + delete from sim_task_object_map + where task_id = :action_id + } + + for { set i 1 } { $i <= [set attachment_num_${action_id}] } { incr i } { + set elm "attachment_${action_id}_$i" + set related_object_id [set $elm] + + if { ![empty_string_p $related_object_id] } { + db_dml insert_rel { + insert into sim_task_object_map (task_id, object_id, order_n, relation_tag) + values (:action_id, :related_object_id, :i, 'attachment') + } + } + } + } } - attachment_num { - label "Number of attachments" - display_template {TODO: implement invitations.
TODO: When switching from open enrollment to "by invitation only" and back, the dates are lost -- see if we can avoid that.
Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting-2.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-2.tcl 5 Jan 2004 10:42:35 -0000 1.15
+++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-2.tcl 6 Jan 2004 14:56:42 -0000 1.16
@@ -125,6 +125,7 @@
-workflow_id $workflow_id \
-array row
- ad_returnredirect .
- ad_script_abort
+ wizard forward
}
+
+wizard submit simulation -buttons { back next }
Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting-3.adp,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp 5 Jan 2004 10:42:35 -0000 1.5
+++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp 6 Jan 2004 14:56:42 -0000 1.6
@@ -1,7 +1,3 @@
-
You haven't picked any groups yet.
Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-new.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/simulation/www/siminst/simulation-new.tcl 11 Dec 2003 13:21:53 -0000 1.2
+++ openacs-4/contrib/packages/simulation/www/siminst/simulation-new.tcl 6 Jan 2004 14:56:42 -0000 1.3
@@ -35,12 +35,15 @@
number_of_roles {
label "Roles"
orderby number_of_roles
+ html { align center }
}
min_number_of_human_roles {
label "Min \# of players"
orderby min_number_of_human_roles
+ html { align center }
}
map {
+ label "Begin"
link_url_col map_url
display_template {
Begin Development
Index: openacs-4/contrib/packages/simulation/www/siminst/wizard.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/wizard.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/simulation/www/siminst/wizard.adp 6 Jan 2004 14:56:42 -0000 1.1
@@ -0,0 +1,42 @@
+ TODO: "perhaps it would help if there was a description describing
-the roles of giver and receiver ... either better rolenames ... or what the roles do in the simulation template" TODO: an "attach new prop" button next to each attachment dropdown
+that lets the user create a new prop and then return to this page,
+where the new prop is already set as the attachment. TODO: don't show initial task on this list
-
+
+ TODO: (low priority) allow props to be embedded within description
+ body so that they will be displayed as links in simplay when user
+ looks at task description
+ TODO: implement invitations.
TODO: When switching from open enrollment to "by invitation only" and back, the dates are lost -- see if we can avoid that.
Index: openacs-4/packages/simulation/www/siminst/simulation-casting-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/Attic/simulation-casting-2.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/simulation/www/siminst/simulation-casting-2.tcl 5 Jan 2004 10:42:35 -0000 1.15
+++ openacs-4/packages/simulation/www/siminst/simulation-casting-2.tcl 6 Jan 2004 14:56:42 -0000 1.16
@@ -125,6 +125,7 @@
-workflow_id $workflow_id \
-array row
- ad_returnredirect .
- ad_script_abort
+ wizard forward
}
+
+wizard submit simulation -buttons { back next }
Index: openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 5 Jan 2004 10:42:35 -0000 1.5
+++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 6 Jan 2004 14:56:42 -0000 1.6
@@ -1,7 +1,3 @@
-
You haven't picked any groups yet.
Index: openacs-4/packages/simulation/www/siminst/simulation-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-new.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/simulation/www/siminst/simulation-new.tcl 11 Dec 2003 13:21:53 -0000 1.2
+++ openacs-4/packages/simulation/www/siminst/simulation-new.tcl 6 Jan 2004 14:56:42 -0000 1.3
@@ -35,12 +35,15 @@
number_of_roles {
label "Roles"
orderby number_of_roles
+ html { align center }
}
min_number_of_human_roles {
label "Min \# of players"
orderby min_number_of_human_roles
+ html { align center }
}
map {
+ label "Begin"
link_url_col map_url
display_template {
Begin Development
Index: openacs-4/packages/simulation/www/siminst/wizard.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/wizard.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/simulation/www/siminst/wizard.adp 6 Jan 2004 14:56:42 -0000 1.1
@@ -0,0 +1,42 @@
+@sub_title@
+
+ @sub_title@
+
+