Index: openacs-4/contrib/packages/simulation/lib/sim-objects-grouped.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-objects-grouped.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/simulation/lib/sim-objects-grouped.tcl 11 Dec 2003 13:21:52 -0000 1.1
+++ openacs-4/contrib/packages/simulation/lib/sim-objects-grouped.tcl 12 Jan 2004 11:35:33 -0000 1.2
@@ -47,7 +47,6 @@
count {
label "Number"
orderby count
- link_url_col view_url
}
}
@@ -61,7 +60,7 @@
#---------------------------------------------------------------------
# database query
-db_multirow -extend { view_url } objects select_objects "
+db_multirow objects select_objects "
select ot.pretty_name,
count(*)
from cr_folders f,
@@ -72,6 +71,4 @@
and ot.object_type = i.content_type
group by ot.pretty_name
[template::list::orderby_clause -orderby -name "objects"]
-" {
- set view_url $base_url/citybuild/TODOfilter
-}
+"
Index: openacs-4/contrib/packages/simulation/www/citybuild/object-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/citybuild/Attic/object-edit.adp,v
diff -u -r1.7 -r1.8
--- openacs-4/contrib/packages/simulation/www/citybuild/object-edit.adp 9 Jan 2004 14:40:03 -0000 1.7
+++ openacs-4/contrib/packages/simulation/www/citybuild/object-edit.adp 12 Jan 2004 11:35:33 -0000 1.8
@@ -4,14 +4,15 @@
TODO: modify content field to allow uploading of non-text documents +
TODO: (2h) Lars, modify content field to allow uploading of non-text documents (word, etc), after which point content field should display as a hyperlink and a delete button (applies to all types) -
TODO: suppress HTML cut-paste text for stylesheets -
TODO: default Show in Directory to No -
TODO: "Associated with 1" should say "Associated With" -
TODO: OK button should say "Done" or "Finished" ? -
TODO: help text for any image: "To make this image appear when the -object is viewed, put the html snippet in the Content field." \ No newline at end of file +
TODO: (0.1h) suppress HTML cut-paste text for stylesheet field in other types +
TODO: (0.1h) default Show in Directory to No +
TODO: (0.1h) "Associated with 1" should say "Associated With" +
TODO: (0.1h) OK button should say "Done" or "Finished" ? +
TODO: (0.1h) help text for any image: "To make this image appear when the +object is viewed, put the html snippet in the Content field." +
TODO: (0.1h) if a URI is submitted, filter it the same way as implicit URI from title. ie, replace spaces with dashes. \ No newline at end of file Index: openacs-4/contrib/packages/simulation/www/citybuild/object-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/citybuild/Attic/object-edit.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/contrib/packages/simulation/www/citybuild/object-edit.tcl 12 Jan 2004 10:58:37 -0000 1.11 +++ openacs-4/contrib/packages/simulation/www/citybuild/object-edit.tcl 12 Jan 2004 11:35:33 -0000 1.12 @@ -37,7 +37,6 @@ # A form for editing and viewing sim objects # ###################################################################### -#TODO: content_type should be changable in new mode ad_form -name object -cancel_url "." -html {enctype multipart/form-data} -form { {item_id:key} @@ -649,14 +648,14 @@ -revision_id $revision_id \ -status "live" - # TODO B: The way we do this update is not very pretty: Delete all relations and re-add the new ones + # FIXME: 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 cr_item_rels where item_id = :item_id } foreach elm $rel_elements { - # TODO B: LARS HACK ALERT: This isn't a particularly pretty way to find all the related objects in the form + # FIXME: LARS HACK ALERT: This isn't a particularly pretty way to find all the related objects in the form regexp {__(.+)__} $elm match relation_tag regexp {__.+__(.+)$} $elm match order_n set related_object_id [set $elm] @@ -720,5 +719,3 @@ element set_properties object $elm -before_html $elm_before_html -after_html $elm_after_html } - -#TODO: if a URI is submitted, filter it the same way as implicit URI from title. ie, replace spaces with dashes. Index: openacs-4/contrib/packages/simulation/www/siminst/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/index.adp,v diff -u -r1.15 -r1.16 --- openacs-4/contrib/packages/simulation/www/siminst/index.adp 9 Jan 2004 14:40:03 -0000 1.15 +++ openacs-4/contrib/packages/simulation/www/siminst/index.adp 12 Jan 2004 11:35:33 -0000 1.16 @@ -10,7 +10,5 @@ Live Simulations -
TODO: page for the admin to see the groups that are created, and change them -
TODO: open enrollment UI for players
TODO: make sure dev_sims template shows all simulations, including
those from Simulations in casting list
\ No newline at end of file
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.8 -r1.9
--- openacs-4/contrib/packages/simulation/www/siminst/map-characters.adp 9 Jan 2004 14:40:03 -0000 1.8
+++ openacs-4/contrib/packages/simulation/www/siminst/map-characters.adp 12 Jan 2004 11:35:33 -0000 1.9
@@ -1,6 +1,6 @@
Select from existing characters or add a new character and refresh -this page. (TODO: make the link pre-set the form to character) +this page.
Template Description: @description;noquote@
Index: openacs-4/contrib/packages/simulation/www/siminst/map-characters.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/map-characters.tcl,v
diff -u -r1.12 -r1.13
--- openacs-4/contrib/packages/simulation/www/siminst/map-characters.tcl 12 Jan 2004 09:23:10 -0000 1.12
+++ openacs-4/contrib/packages/simulation/www/siminst/map-characters.tcl 12 Jan 2004 11:35:33 -0000 1.13
@@ -8,8 +8,7 @@
workflow_id:integer
}
-# TODO: Permission check
-# TODO: ability to add new character inline while mapping
+permission::require_write_permission -object_id $workflow_id
set page_title "Assign Characters to Roles"
set context [list [list "." "SimInst"] $page_title]
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.9 -r1.10
--- openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl 9 Jan 2004 14:40:03 -0000 1.9
+++ openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl 12 Jan 2004 11:35:33 -0000 1.10
@@ -6,6 +6,8 @@
workflow_id:integer
}
+permission::require_write_permission -object_id $workflow_id
+
set user_id [auth::require_login]
ad_form \
@@ -64,7 +66,7 @@
{label "Attachment $i"} \
{options $prop_options} \
{help_text "Select from existing attachments or add a new prop and refresh this page. TODO: make this tidier - instead of this text, should be a single button which saves this form, goes to object page, and returns here."}]]
+href=\"../citybuild/object-edit\">add a new prop and refresh this page."}]]
}
lappend actions $row(action_id)
@@ -107,7 +109,7 @@
-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
+ # FIXME: 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
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.11 -r1.12
--- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp 12 Jan 2004 09:23:10 -0000 1.11
+++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp 12 Jan 2004 11:35:33 -0000 1.12
@@ -1,6 +1,6 @@
TODO: Show total number of users per case +
TODO: (0.1h) Show total number of users per case
In Automatic casting, only @@ -44,9 +44,5 @@ -
TODO: if enroll-type is open, show all groups from the subsite in +
TODO: (0.5h) if enroll-type is open, show all groups from the subsite in each role -
TODO: Number of users should by greater than 0. -
TODO: auto-check all boxes by default - - Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting-3.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 9 Jan 2004 14:40:03 -0000 1.16 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.tcl 12 Jan 2004 11:35:33 -0000 1.17 @@ -1,5 +1,5 @@ ad_page_contract { - The page where actors are chosen for the different + The page where user groups are chosen for the different roles of a simulation. Part of the casting step in the instantiation process. @@ -8,8 +8,7 @@ workflow_id:integer } -# TODO: auto-check all boxes -# TODO: if enroll-type is open, show all groups from the subsite in each role +permission::require_write_permission -object_id $workflow_id set page_title "Set user casting rules" set context [list [list "." "SimInst"] $page_title] @@ -20,7 +19,7 @@ {label "Casting type"} {options {{"Participants are automatically assigned cases and roles" auto} {"Participants choose their own cases" group} {"Participants choose cases and roles" open}}} {section "Casting type"} - {help_text "If participants have not selected groups or roles by the simulation start time, they are automatically assigned. TODO: implement this"} + {help_text "If participants have not selected groups or roles by the simulation start time, they are automatically assigned."} } @@ -67,11 +66,21 @@ simulation::template::role_party_mappings -workflow_id $workflow_id -array roles - foreach role_id [array names roles] { - array set one_role $roles($role_id) + set all_group_ids [list] + foreach group_item $eligible_groups { + lappend all_group_ids [lindex $group_item 1] + } - element::set_values actors parties_${role_id} $one_role(parties) - element set_properties actors users_per_case_${role_id} -value $one_role(users_per_case) + foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + if { [info exists roles($role_id)] } { + # There are groups selected in the database + array set one_role $roles($role_id) + element::set_values actors parties_${role_id} $one_role(parties) + element set_properties actors users_per_case_${role_id} -value $one_role(users_per_case) + } else { + # There are no groups selected. Select all by default in the form. + element::set_values actors parties_${role_id} $all_group_ids + } } @@ -85,16 +94,24 @@ foreach role_id [workflow::get_roles -workflow_id $workflow_id] { set users_per_case [set users_per_case_$role_id] + if { $users_per_case == "0" } { + template::form::set_error actors users_per_case_$role_id "Number of users per case must be greater than zero" + set error_p 1 + } + if { [llength [set parties_$role_id]] > 0 } { set n_members 0 foreach party_id [set parties_$role_id] { set n_members [expr $n_members + [lindex $groups($party_id) 1]] } if { $users_per_case > $n_members } { - template::form::set_error actors users_per_case_$role_id "Number of users per case is larger than the number of users in the selected groups: $n_members" + template::form::set_error actors users_per_case_$role_id "Number of users per case must not be larger than the number of users in the selected groups: $n_members" set error_p 1 - } + } + } else { + template::form::set_error actors parties_$role_id "At least one group must be selected for each role" + set error_p 1 } } if { $error_p } { @@ -122,4 +139,3 @@ } wizard submit actors -buttons { back next finish } - Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-edit.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-edit.tcl 9 Jan 2004 14:40:03 -0000 1.6 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-edit.tcl 12 Jan 2004 11:35:33 -0000 1.7 @@ -4,8 +4,7 @@ workflow_id:integer } -# TODO: finish implementing description field (I cut-paste from template-edit.tcl and may have left out stuff) -# TODO: pre-populate the description with the template description +permission::require_write_permission -object_id $workflow_id simulation::template::get -workflow_id $workflow_id -array sim_template @@ -29,8 +28,6 @@ {help_text "This description is visible to users during enrollment."} } -} -edit_request { - set description [template::util::richtext::create $simulation(description) $simulation(description_mime_type)] } -on_request { foreach elm { @@ -42,18 +39,27 @@ set $elm $sim_template($elm) } + set description [template::util::richtext::create $sim_template(description) $sim_template(description_mime_type)] + # Default values - set one_month [expr 3600*24*31] + set one_week [expr 3600*24*7] - # TODO: B: provide more sensible default dates? 1 week, 2 weeks, start date + suggested duration + if { ![empty_string_p $sim_template(suggested_duration)] } { + # TODO: (0.5h) use suggested_duaration_seconds instead here. Need to edit template-procs.xql + #set default_duration $sim_template(suggested_duration_seconds) + set default_duration $one_week + } else { + set default_duration $one_week + } + if { [empty_string_p $send_start_note_date] } { - set send_start_note_date [clock format [expr [clock seconds] + 2*$one_month] -format "%Y-%m-%d"] + set send_start_note_date [clock format [expr [clock seconds] + 1*$one_week] -format "%Y-%m-%d"] } if { [empty_string_p $case_start] } { - set case_start [clock format [expr [clock seconds] + 3*$one_month] -format "%Y-%m-%d"] + set case_start [clock format [expr [clock seconds] + 2*$one_week] -format "%Y-%m-%d"] } if { [empty_string_p $case_end] } { - set case_end [clock format [expr [clock seconds] + 4*$one_month] -format "%Y-%m-%d"] + set case_end [clock format [expr [clock seconds] + 2*$one_week + $default_duration] -format "%Y-%m-%d"] } } -on_submit { set description_mime_type [template::util::richtext::get_property format $description] @@ -69,7 +75,7 @@ break } - foreach elm { send_start_note_date case_start case_end pretty_name } { + foreach elm { send_start_note_date case_start case_end pretty_name description description_mime_type } { set row($elm) [set $elm] } Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-participants.adp,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.adp 12 Jan 2004 09:23:10 -0000 1.5 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.adp 12 Jan 2004 11:35:33 -0000 1.6 @@ -1,7 +1,7 @@ -
TODO: implement the enrollment type and optional enrollment date +
TODO: (0.5h) implement the enrollment type and optional enrollment date fields from simulation-enrollment.tcl -
TODO: change invited/mandatory checkboxes to a single radio button -set per row: invited/mandatory/none +
TODO: (0.5h) change invited/mandatory checkboxes to a single radio button
+set per row: invited/mandatory/neither invited nor mandatory or preferably use Javascript with checkboxes
TODO: modify content field to allow uploading of non-text documents +
TODO: (2h) Lars, modify content field to allow uploading of non-text documents (word, etc), after which point content field should display as a hyperlink and a delete button (applies to all types) -
TODO: suppress HTML cut-paste text for stylesheets -
TODO: default Show in Directory to No -
TODO: "Associated with 1" should say "Associated With" -
TODO: OK button should say "Done" or "Finished" ? -
TODO: help text for any image: "To make this image appear when the -object is viewed, put the html snippet in the Content field." \ No newline at end of file +
TODO: (0.1h) suppress HTML cut-paste text for stylesheet field in other types +
TODO: (0.1h) default Show in Directory to No +
TODO: (0.1h) "Associated with 1" should say "Associated With" +
TODO: (0.1h) OK button should say "Done" or "Finished" ? +
TODO: (0.1h) help text for any image: "To make this image appear when the +object is viewed, put the html snippet in the Content field." +
TODO: (0.1h) if a URI is submitted, filter it the same way as implicit URI from title. ie, replace spaces with dashes. \ No newline at end of file Index: openacs-4/packages/simulation/www/citybuild/object-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/citybuild/object-edit.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/simulation/www/citybuild/object-edit.tcl 12 Jan 2004 10:58:37 -0000 1.11 +++ openacs-4/packages/simulation/www/citybuild/object-edit.tcl 12 Jan 2004 11:35:33 -0000 1.12 @@ -37,7 +37,6 @@ # A form for editing and viewing sim objects # ###################################################################### -#TODO: content_type should be changable in new mode ad_form -name object -cancel_url "." -html {enctype multipart/form-data} -form { {item_id:key} @@ -649,14 +648,14 @@ -revision_id $revision_id \ -status "live" - # TODO B: The way we do this update is not very pretty: Delete all relations and re-add the new ones + # FIXME: 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 cr_item_rels where item_id = :item_id } foreach elm $rel_elements { - # TODO B: LARS HACK ALERT: This isn't a particularly pretty way to find all the related objects in the form + # FIXME: LARS HACK ALERT: This isn't a particularly pretty way to find all the related objects in the form regexp {__(.+)__} $elm match relation_tag regexp {__.+__(.+)$} $elm match order_n set related_object_id [set $elm] @@ -720,5 +719,3 @@ element set_properties object $elm -before_html $elm_before_html -after_html $elm_after_html } - -#TODO: if a URI is submitted, filter it the same way as implicit URI from title. ie, replace spaces with dashes. Index: openacs-4/packages/simulation/www/siminst/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/index.adp,v diff -u -r1.15 -r1.16 --- openacs-4/packages/simulation/www/siminst/index.adp 9 Jan 2004 14:40:03 -0000 1.15 +++ openacs-4/packages/simulation/www/siminst/index.adp 12 Jan 2004 11:35:33 -0000 1.16 @@ -10,7 +10,5 @@ Live Simulations -
TODO: page for the admin to see the groups that are created, and change them -
TODO: open enrollment UI for players
TODO: make sure dev_sims template shows all simulations, including
those from Simulations in casting list
\ No newline at end of file
Index: openacs-4/packages/simulation/www/siminst/map-characters.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-characters.adp,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/simulation/www/siminst/map-characters.adp 9 Jan 2004 14:40:03 -0000 1.8
+++ openacs-4/packages/simulation/www/siminst/map-characters.adp 12 Jan 2004 11:35:33 -0000 1.9
@@ -1,6 +1,6 @@
Select from existing characters or add a new character and refresh -this page. (TODO: make the link pre-set the form to character) +this page.
Template Description: @description;noquote@
Index: openacs-4/packages/simulation/www/siminst/map-characters.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-characters.tcl,v
diff -u -r1.12 -r1.13
--- openacs-4/packages/simulation/www/siminst/map-characters.tcl 12 Jan 2004 09:23:10 -0000 1.12
+++ openacs-4/packages/simulation/www/siminst/map-characters.tcl 12 Jan 2004 11:35:33 -0000 1.13
@@ -8,8 +8,7 @@
workflow_id:integer
}
-# TODO: Permission check
-# TODO: ability to add new character inline while mapping
+permission::require_write_permission -object_id $workflow_id
set page_title "Assign Characters to Roles"
set context [list [list "." "SimInst"] $page_title]
Index: openacs-4/packages/simulation/www/siminst/map-tasks.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-tasks.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/simulation/www/siminst/map-tasks.tcl 9 Jan 2004 14:40:03 -0000 1.9
+++ openacs-4/packages/simulation/www/siminst/map-tasks.tcl 12 Jan 2004 11:35:33 -0000 1.10
@@ -6,6 +6,8 @@
workflow_id:integer
}
+permission::require_write_permission -object_id $workflow_id
+
set user_id [auth::require_login]
ad_form \
@@ -64,7 +66,7 @@
{label "Attachment $i"} \
{options $prop_options} \
{help_text "Select from existing attachments or add a new prop and refresh this page. TODO: make this tidier - instead of this text, should be a single button which saves this form, goes to object page, and returns here."}]]
+href=\"../citybuild/object-edit\">add a new prop and refresh this page."}]]
}
lappend actions $row(action_id)
@@ -107,7 +109,7 @@
-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
+ # FIXME: 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
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.11 -r1.12
--- openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 12 Jan 2004 09:23:10 -0000 1.11
+++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 12 Jan 2004 11:35:33 -0000 1.12
@@ -1,6 +1,6 @@
TODO: Show total number of users per case +
TODO: (0.1h) Show total number of users per case
In Automatic casting, only @@ -44,9 +44,5 @@ -
TODO: if enroll-type is open, show all groups from the subsite in +
TODO: (0.5h) if enroll-type is open, show all groups from the subsite in each role -
TODO: Number of users should by greater than 0. -
TODO: auto-check all boxes by default - - Index: openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 9 Jan 2004 14:40:03 -0000 1.16 +++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.tcl 12 Jan 2004 11:35:33 -0000 1.17 @@ -1,5 +1,5 @@ ad_page_contract { - The page where actors are chosen for the different + The page where user groups are chosen for the different roles of a simulation. Part of the casting step in the instantiation process. @@ -8,8 +8,7 @@ workflow_id:integer } -# TODO: auto-check all boxes -# TODO: if enroll-type is open, show all groups from the subsite in each role +permission::require_write_permission -object_id $workflow_id set page_title "Set user casting rules" set context [list [list "." "SimInst"] $page_title] @@ -20,7 +19,7 @@ {label "Casting type"} {options {{"Participants are automatically assigned cases and roles" auto} {"Participants choose their own cases" group} {"Participants choose cases and roles" open}}} {section "Casting type"} - {help_text "If participants have not selected groups or roles by the simulation start time, they are automatically assigned. TODO: implement this"} + {help_text "If participants have not selected groups or roles by the simulation start time, they are automatically assigned."} } @@ -67,11 +66,21 @@ simulation::template::role_party_mappings -workflow_id $workflow_id -array roles - foreach role_id [array names roles] { - array set one_role $roles($role_id) + set all_group_ids [list] + foreach group_item $eligible_groups { + lappend all_group_ids [lindex $group_item 1] + } - element::set_values actors parties_${role_id} $one_role(parties) - element set_properties actors users_per_case_${role_id} -value $one_role(users_per_case) + foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + if { [info exists roles($role_id)] } { + # There are groups selected in the database + array set one_role $roles($role_id) + element::set_values actors parties_${role_id} $one_role(parties) + element set_properties actors users_per_case_${role_id} -value $one_role(users_per_case) + } else { + # There are no groups selected. Select all by default in the form. + element::set_values actors parties_${role_id} $all_group_ids + } } @@ -85,16 +94,24 @@ foreach role_id [workflow::get_roles -workflow_id $workflow_id] { set users_per_case [set users_per_case_$role_id] + if { $users_per_case == "0" } { + template::form::set_error actors users_per_case_$role_id "Number of users per case must be greater than zero" + set error_p 1 + } + if { [llength [set parties_$role_id]] > 0 } { set n_members 0 foreach party_id [set parties_$role_id] { set n_members [expr $n_members + [lindex $groups($party_id) 1]] } if { $users_per_case > $n_members } { - template::form::set_error actors users_per_case_$role_id "Number of users per case is larger than the number of users in the selected groups: $n_members" + template::form::set_error actors users_per_case_$role_id "Number of users per case must not be larger than the number of users in the selected groups: $n_members" set error_p 1 - } + } + } else { + template::form::set_error actors parties_$role_id "At least one group must be selected for each role" + set error_p 1 } } if { $error_p } { @@ -122,4 +139,3 @@ } wizard submit actors -buttons { back next finish } - Index: openacs-4/packages/simulation/www/siminst/simulation-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-edit.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/simulation/www/siminst/simulation-edit.tcl 9 Jan 2004 14:40:03 -0000 1.6 +++ openacs-4/packages/simulation/www/siminst/simulation-edit.tcl 12 Jan 2004 11:35:33 -0000 1.7 @@ -4,8 +4,7 @@ workflow_id:integer } -# TODO: finish implementing description field (I cut-paste from template-edit.tcl and may have left out stuff) -# TODO: pre-populate the description with the template description +permission::require_write_permission -object_id $workflow_id simulation::template::get -workflow_id $workflow_id -array sim_template @@ -29,8 +28,6 @@ {help_text "This description is visible to users during enrollment."} } -} -edit_request { - set description [template::util::richtext::create $simulation(description) $simulation(description_mime_type)] } -on_request { foreach elm { @@ -42,18 +39,27 @@ set $elm $sim_template($elm) } + set description [template::util::richtext::create $sim_template(description) $sim_template(description_mime_type)] + # Default values - set one_month [expr 3600*24*31] + set one_week [expr 3600*24*7] - # TODO: B: provide more sensible default dates? 1 week, 2 weeks, start date + suggested duration + if { ![empty_string_p $sim_template(suggested_duration)] } { + # TODO: (0.5h) use suggested_duaration_seconds instead here. Need to edit template-procs.xql + #set default_duration $sim_template(suggested_duration_seconds) + set default_duration $one_week + } else { + set default_duration $one_week + } + if { [empty_string_p $send_start_note_date] } { - set send_start_note_date [clock format [expr [clock seconds] + 2*$one_month] -format "%Y-%m-%d"] + set send_start_note_date [clock format [expr [clock seconds] + 1*$one_week] -format "%Y-%m-%d"] } if { [empty_string_p $case_start] } { - set case_start [clock format [expr [clock seconds] + 3*$one_month] -format "%Y-%m-%d"] + set case_start [clock format [expr [clock seconds] + 2*$one_week] -format "%Y-%m-%d"] } if { [empty_string_p $case_end] } { - set case_end [clock format [expr [clock seconds] + 4*$one_month] -format "%Y-%m-%d"] + set case_end [clock format [expr [clock seconds] + 2*$one_week + $default_duration] -format "%Y-%m-%d"] } } -on_submit { set description_mime_type [template::util::richtext::get_property format $description] @@ -69,7 +75,7 @@ break } - foreach elm { send_start_note_date case_start case_end pretty_name } { + foreach elm { send_start_note_date case_start case_end pretty_name description description_mime_type } { set row($elm) [set $elm] } Index: openacs-4/packages/simulation/www/siminst/simulation-participants.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-participants.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/simulation/www/siminst/simulation-participants.adp 12 Jan 2004 09:23:10 -0000 1.5 +++ openacs-4/packages/simulation/www/siminst/simulation-participants.adp 12 Jan 2004 11:35:33 -0000 1.6 @@ -1,7 +1,7 @@ -
TODO: implement the enrollment type and optional enrollment date +
TODO: (0.5h) implement the enrollment type and optional enrollment date fields from simulation-enrollment.tcl -
TODO: change invited/mandatory checkboxes to a single radio button -set per row: invited/mandatory/none +
TODO: (0.5h) change invited/mandatory checkboxes to a single radio button
+set per row: invited/mandatory/neither invited nor mandatory or preferably use Javascript with checkboxes