Index: openacs-4/contrib/packages/simulation/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/apm-callback-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/contrib/packages/simulation/tcl/apm-callback-procs.tcl 10 Nov 2003 16:56:56 -0000 1.7 +++ openacs-4/contrib/packages/simulation/tcl/apm-callback-procs.tcl 28 Nov 2003 16:55:52 -0000 1.8 @@ -19,7 +19,7 @@ ad_proc -private simulation::apm::after_instantiate { {-package_id:required} } { - Create the package root folder. + Create data associated with a simulation package instance. } { set instance_name [apm_instance_name_from_id $package_id] @@ -30,4 +30,20 @@ -package_id $package_id \ -context_id $package_id \ -content_types { sim_character sim_prop sim_location sim_stylesheet image }] + + application_group::new \ + -group_name "Simulation Test Class" \ + -package_id $package_id } + +ad_proc -private simulation::apm::before_uninstantiate { + {-package_id:required} +} { + Tear down data associated with a package instance. +} { + set folder_id [bcms::folder::get_id_by_package_id -parent_id 0] + bcms::folder::delete_folder -folder_id $folder_id + + set group_id [application_group::group_id_from_package_id -package_id $package_id] + group::delete $group_id +} Index: openacs-4/contrib/packages/simulation/tcl/object-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/object-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/simulation/tcl/object-procs.tcl 18 Nov 2003 13:31:32 -0000 1.5 +++ openacs-4/contrib/packages/simulation/tcl/object-procs.tcl 28 Nov 2003 16:55:52 -0000 1.6 @@ -9,6 +9,12 @@ namespace eval simulation::object {} namespace eval simulation::object::xml {} +############################### +# +# simulation::object namespace +# +############################### + ad_proc -private simulation::object::url { {-package_id ""} {-name:required} @@ -43,6 +49,12 @@ return "${package_url}object-content/${name}" } +############################### +# +# simulation::object::xml namespace +# +############################### + ad_proc -private simulation::object::xml::file_sweeper {} { Loop over all simulation package instances and re-generate XML map files for them. Index: openacs-4/contrib/packages/simulation/tcl/role-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/role-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/simulation/tcl/role-procs.tcl 18 Nov 2003 12:19:39 -0000 1.4 +++ openacs-4/contrib/packages/simulation/tcl/role-procs.tcl 28 Nov 2003 16:55:52 -0000 1.5 @@ -20,17 +20,39 @@ @author Peter Marklund } { db_transaction { - # create the role + set role_short_name [util_text_to_url -replacement "_" $role_short_name] set role_id [workflow::role::new \ -workflow_id $template_id \ -short_name $role_short_name \ -pretty_name $role_pretty_name] + db_dml insert_sim_role { + insert into sim_roles (role_id) values (:role_id) + } } } ad_proc -public simulation::role::delete { {-role_id:required} } { - workflow::role::delete -role_id $role_id + db_transaction { + workflow::role::delete -role_id $role_id + + db_dml delete_sim_role { + delete from sim_roles where role_id = :role_id + } + } } + +ad_proc -public simulation::role::edit { + {-role_id:required} + {-character_id:required} +} { + Edit a simulation role. +} { + db_dml edit_sim_role { + update sim_roles + set character_id = :character_id + where role_id = :role_id + } +} Index: openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/simulation-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl 14 Nov 2003 11:40:35 -0000 1.12 +++ openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl 28 Nov 2003 16:55:52 -0000 1.13 @@ -108,6 +108,124 @@ } } +ad_proc simulation::get_object_options { + {-content_type:required} +} { + Returns a list of cr_revision.title, cr_item.item_id pairs + for all cr_items of the given content_type in the root + folder of the current package. Suitable for ad_form options for + select boxes. + + @return [list [list cr_revision.title1 cr_item.item_id1] [list cr_revision.title2 cr_item.item_id2] ....] + + @author Peter Marklund +} { + set package_id [ad_conn package_id] + set parent_id [bcms::folder::get_id_by_package_id -package_id $package_id] + + return [db_list_of_lists character_options { + select cr.title, + ci.item_id + from cr_items ci, + cr_revisions cr + where ci.live_revision = cr.revision_id + and ci.parent_id = :parent_id + and ci.content_type = :content_type + }] +} + +ad_proc -public simulation::cast { + {-workflow_id:required} + {-pretty_name:required} + {-actors:required} + {-groupings:required} +} { + Takes a mapped simulation template and creates a casted simulation + with simulation cases. It does this by cloning the simulation + template. + + TODO: agent support + + TODO: taking actor type into account + + @param actors An array list with the actors of the simulation. The keys + of the list are role_ids and the values ids of the actor to play the role. + @param groups An array list with the groupings of the simulation. The keys + of the list are role_ids and the values are integers indicaing + a number of users to play that role. + + @return workflow_id of the simulation created. + + @author Peter Marklund +} { + array set actors_array $actors + array set groupings_array $groupings + + # TODO: make sure this is a proper clone also after mapping (tasks and characters...) + set workflow_id [simulation::template::clone \ + -pretty_name $pretty_name \ + -workflow_id $workflow_id] + + set user_list [db_list select_users { + select member_id + from party_approved_member_map + where party_id in (select + party_id from sim_party_sim_map + where simulation_id = :workflow_id + ) + }] + set total_n_users [llength $user_list] + + set n_users_per_case 0 + foreach role_id [array names groupings_array] { + set n_users_per_case [expr $n_users_per_case + $groupings_array($role_id)] + } + + set mod_n_users [expr $total_n_users % $n_users_per_case] + set n_cases [expr ($total_n_users - $mod_n_users) / $n_users_per_case] + + + if { $mod_n_users == "0" } { + # No rest in dividing, the cases add up nicely + + } else { + # We are missing mod_n_users to fill up the simulation. Create a new simulation + # for those students. + set n_cases [expr $n_cases + 1] + } + + # Create the cases and for each case assign roles to parties + set users_start_index 0 + for { set case_counter 0 } { $case_counter < $n_cases } { incr case_counter } { + # TODO: what should object_id be here? + set object_id [ad_conn package_id] + set case_id [workflow::case::new \ + -workflow_id $workflow_id \ + -object_id $object_id] + + # Assign a group of users to each role in the case + set party_array_list [list] + foreach role_id [array names actors] { + set role_short_name [workflow::role::get_element -role_id $role_id -element short_name] + + set users_end_index [expr $users_start_index + $groupings_array($role_id) - 1] + + set parties_list [lrange $user_list $users_start_index $users_end_index] + + lappend parties_array_list $role_short_name $users_list + + set users_start_index [expr $users_end_index + 1] + } + + workflow::case::role::assign \ + -case_id $case_id \ + -array $party_array_list \ + -replace + } + + return $workflow_id +} + template_tag relation { params } { publish::process_tag relation $params } Index: openacs-4/contrib/packages/simulation/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/template-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 28 Nov 2003 11:12:39 -0000 1.4 +++ openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 28 Nov 2003 16:55:52 -0000 1.5 @@ -26,6 +26,8 @@ set ready_p "f" } db_transaction { + set short_name [util_text_to_url -replacement "_" $short_name] + set workflow_id [workflow::new \ -short_name $short_name \ -pretty_name $pretty_name \ @@ -42,24 +44,40 @@ -short_name "dummy action" \ -pretty_name "dummy action" - set suggested_duration [string trim $suggested_duration] - if { [empty_string_p $suggested_duration] } { - db_dml new_sim { - insert into sim_simulations - (simulation_id, ready_p) - values (:workflow_id, :ready_p) - } - } else { - db_dml new_sim " - insert into sim_simulations - (simulation_id, ready_p, suggested_duration) - values ('$workflow_id', '$ready_p', interval '$suggested_duration')" - } + insert_sim \ + -workflow_id $workflow_id \ + -ready_p $ready_p \ + -suggested_duration $suggested_duration } return $workflow_id } +ad_proc -private simulation::template::insert_sim { + {-workflow_id:required} + {-ready_p:required} + {-suggested_duration:required} +} { + Internal proc for inserting values into the sim_simulations + table that are set prior to a template being mapped. + + @author Peter Marklund +} { + set suggested_duration [string trim $suggested_duration] + if { [empty_string_p $suggested_duration] } { + db_dml new_sim { + insert into sim_simulations + (simulation_id, ready_p) + values (:workflow_id, :ready_p) + } + } else { + db_dml new_sim " + insert into sim_simulations + (simulation_id, ready_p, suggested_duration) + values ('$workflow_id', '$ready_p', interval '$suggested_duration')" + } +} + ad_proc -public simulation::template::edit { {-workflow_id:required} {-short_name:required} @@ -106,6 +124,98 @@ } } +ad_proc -public simulation::template::instantiate_edit { + {-workflow_id:required} + {-enroll_start:required} + {-enroll_end:required} + {-notification_date:required} + {-case_start:required} + {-case_end:required} + {-enroll_type:required} + {-casting_type:required} + {-parties:required} +} { + Edit properties of a simulation set during instantiation. + + TODO: merge this proc with ::edit? + + @author Peter Marklund +} { + db_dml update_instantiate_template { + update sim_simulations + set enroll_start = to_date(:enroll_start, 'YYYY-MM-DD'), + enroll_end = to_date(:enroll_end, 'YYYY-MM-DD'), + send_start_note_date = to_date(:notification_date, 'YYYY-MM-DD'), + case_start = to_date(:case_start, 'YYYY-MM-DD'), + case_end = to_date(:case_end, 'YYYY-MM-DD'), + enroll_type = :enroll_type, + casting_type = :casting_type + where simulation_id = :workflow_id + } + + # Clear out old mappings first + db_dml clear_old_mappings { + delete from sim_party_sim_map + where simulation_id = :workflow_id + } + + foreach party_id $parties { + db_dml map_party_to_template { + insert into sim_party_sim_map + (simulation_id, party_id) + values (:workflow_id, :party_id) + } + } +} +ad_proc -public simulation::template::clone { + {-workflow_id:required} + {-pretty_name:required} +} { + Create a new simulation template which is a clone of the template with + given id. The clone will be mapped to the package of the current request. + + @param workflow_id The id of the template that you wish to clone. + @param pretty_name The pretty name of the clone you are creating. + + @return The id of the clone. + + @author Peter Marklund +} { + # If we set object_id here and leave short_name unchanged we + # get a unique constraint violation + set clone_workflow_id [workflow::fsm::clone \ + -workflow_id $workflow_id] + + # Set names of clones workflow and update the object_id + # TODO: create workflow::edit proc + set clone_short_name [util_text_to_url -replacement "_" $pretty_name] + set object_id [ad_conn package_id] + db_dml update_short_name { + update workflows + set short_name = :clone_short_name, + pretty_name = :pretty_name, + object_id = :object_id + where workflow_id = :clone_workflow_id + } + + # Add the role_id:s to the sim_roles table + set role_id_list [workflow::get_roles -workflow_id $clone_workflow_id] + foreach role_id $role_id_list { + db_dml insert_sim_role { + insert into sim_roles (role_id) values (:role_id) + } + } + + # Clone the values in the simulation table + get -workflow_id $workflow_id -array workflow + insert_sim \ + -workflow_id $clone_workflow_id \ + -ready_p $workflow(ready_p) \ + -suggested_duration $workflow(suggested_duration) + + return $clone_workflow_id +} + ad_proc -public simulation::template::get { {-workflow_id:required} {-array:required} Index: openacs-4/contrib/packages/simulation/test/crawl-links.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/test/Attic/crawl-links.test,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/test/crawl-links.test 19 Nov 2003 10:05:07 -0000 1.2 +++ openacs-4/contrib/packages/simulation/test/crawl-links.test 28 Nov 2003 16:55:52 -0000 1.3 @@ -9,7 +9,7 @@ ::twt::log_section "Login the site wide admin" ::twt::user::login_site_wide_admin - ::twt::set_crawler_exclude_links {delete} + ::twt::set_crawler_exclude_links {delete remove} # NOTE: The crawler needs the trailing slash when first invoked set simulation_uri /simulation/ Index: openacs-4/contrib/packages/simulation/test/demo-data-setup.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/test/Attic/demo-data-setup.test,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/simulation/test/demo-data-setup.test 19 Nov 2003 07:40:46 -0000 1.6 +++ openacs-4/contrib/packages/simulation/test/demo-data-setup.test 28 Nov 2003 16:55:52 -0000 1.7 @@ -75,6 +75,8 @@ do_request /simulation/simbuild/template-edit set template_name "Elementary Private Law" field fill $template_name ~n name + field find ~n ready_p + field fill t form submit ::twt::log_section "Create roles for template" Index: openacs-4/contrib/packages/simulation/www/doc/admin.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/admin.html,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/www/doc/admin.html 14 Nov 2003 14:03:11 -0000 1.2 +++ openacs-4/contrib/packages/simulation/www/doc/admin.html 28 Nov 2003 16:55:52 -0000 1.3 @@ -1 +1,2 @@ -Admin Guide

Admin Guide


Table of Contents

Map XML
View comments on this page at openacs.org
+ +Admin Guide

Admin Guide


Table of Contents

Map XML
View comments on this page at openacs.org
Index: openacs-4/contrib/packages/simulation/www/doc/design.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/design.html,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/simulation/www/doc/design.html 14 Nov 2003 14:03:11 -0000 1.6 +++ openacs-4/contrib/packages/simulation/www/doc/design.html 28 Nov 2003 16:55:52 -0000 1.7 @@ -1 +1,2 @@ -Design

Design


Table of Contents

Interfaces
Internal Design
Permissions
Notes on an object-oriented simulated space
View comments on this page at openacs.org
+ +Design

Design


Table of Contents

Interfaces
Internal Design
Permissions
Notes on an object-oriented simulated space
View comments on this page at openacs.org
Index: openacs-4/contrib/packages/simulation/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/index.html,v diff -u -r1.8 -r1.9 --- openacs-4/contrib/packages/simulation/www/doc/index.html 26 Nov 2003 16:44:50 -0000 1.8 +++ openacs-4/contrib/packages/simulation/www/doc/index.html 28 Nov 2003 16:55:52 -0000 1.9 @@ -1 +1,2 @@ -Simulation

Simulation


Table of Contents

Installation
Package installation
Admin Guide
Map XML
Design
Interfaces
Internal Design
Permissions
Notes on an object-oriented simulated space
A. Licencing
View comments on this page at openacs.org
+ +Simulation

Simulation


Table of Contents

Installation
Package installation
Admin Guide
Map XML
Design
Interfaces
Internal Design
Permissions
Notes on an object-oriented simulated space
A. Licencing
View comments on this page at openacs.org
Index: openacs-4/contrib/packages/simulation/www/doc/install.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/install.html,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/simulation/www/doc/install.html 14 Nov 2003 14:03:11 -0000 1.4 +++ openacs-4/contrib/packages/simulation/www/doc/install.html 28 Nov 2003 16:55:52 -0000 1.5 @@ -1 +1,2 @@ -Installation

Installation


Table of Contents

Package installation
View comments on this page at openacs.org
+ +Installation

Installation


Table of Contents

Package installation
View comments on this page at openacs.org
Index: openacs-4/contrib/packages/simulation/www/doc/interfaces.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/interfaces.html,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/www/doc/interfaces.html 14 Nov 2003 11:30:37 -0000 1.2 +++ openacs-4/contrib/packages/simulation/www/doc/interfaces.html 28 Nov 2003 16:55:52 -0000 1.3 @@ -1,2 +1,3 @@ -Interfaces

Interfaces

Page Map

TCL API

TCL API

Each TCL API item should include inputs, outputs, and a - comment block describing any non-obvious internal issues.

SQL API

None yet.

View comments on this page at openacs.org
+ +Interfaces

Interfaces

Page Map

TCL API

TCL API

Each TCL API item should include inputs, outputs, and a + comment block describing any non-obvious internal issues.

SQL API

None yet.

View comments on this page at openacs.org
Index: openacs-4/contrib/packages/simulation/www/doc/internals.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/internals.html,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/doc/internals.html 14 Nov 2003 14:03:11 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/doc/internals.html 28 Nov 2003 16:55:52 -0000 1.4 @@ -1 +1,2 @@ -Internal Design

Internal Design

Data Model

View comments on this page at openacs.org
+ +Internal Design

Internal Design

Data Model

View comments on this page at openacs.org
Index: openacs-4/contrib/packages/simulation/www/doc/licensing.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/licensing.html,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/doc/licensing.html 14 Nov 2003 14:03:11 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/doc/licensing.html 28 Nov 2003 16:55:52 -0000 1.2 @@ -1 +1,2 @@ -Appendix�A.�Licencing

Appendix�A.�Licencing

TODO

View comments on this page at openacs.org
+ +Appendix A. Licencing

Appendix A. Licencing

TODO

View comments on this page at openacs.org
Index: openacs-4/contrib/packages/simulation/www/doc/map_xml.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/map_xml.html,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/doc/map_xml.html 12 Nov 2003 11:17:28 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/doc/map_xml.html 28 Nov 2003 16:55:52 -0000 1.2 @@ -1,4 +1,5 @@ -Map XML

Map XML

+ +Map XML

Map XML

The simulation package will nightly generate an XML file with information needed for the SIMBUILD flash map. The objects in the XML file will be those that are supposed to appear on the map, i.e. those that have the on_map_p attribute set to true. The file Index: openacs-4/contrib/packages/simulation/www/doc/object-orientation-notes.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/object-orientation-notes.html,v diff -u -r1.8 -r1.9 --- openacs-4/contrib/packages/simulation/www/doc/object-orientation-notes.html 26 Nov 2003 16:44:50 -0000 1.8 +++ openacs-4/contrib/packages/simulation/www/doc/object-orientation-notes.html 28 Nov 2003 16:55:52 -0000 1.9 @@ -1,4 +1,5 @@ -Notes on an object-oriented simulated space

Notes on an object-oriented simulated space

An OpenACS simulation is a collection of interactive + +Notes on an object-oriented simulated space

Notes on an object-oriented simulated space

An OpenACS simulation is a collection of interactive objects, plus a set of roles and tasks. In the first part, it is conceptually similar to a MOO (Multiple-User Dungeon, Object-Oriented). This is a technology dating to 1990, in which @@ -10,7 +11,7 @@ Games), which are essentially MOOs with graphical instead of textual interfaces. Given their lineage and success, it makes sense to draw on MOO technology when designing our simulation - object model.

Objects

Basic MOO objects

+      object model.

Objects

Basic MOO objects

 Root Class
   Room
   Thing
@@ -27,13 +28,13 @@
     Exit
     Container
       Openable Container
-

Object Attributes

(From the LambdaMOO Programmer's Manual

+

Object Attributes

(From the LambdaMOO Programmer's Manual

 There are three fundamental attributes to every object:
 
    1. A flag (either true or false) specifying whether or not the object represents a player,
    2. The object that is its parent, and
    3. A list of the objects that are its children; that is, those
-   objects for which this object is their parent. 

"Every object has eight built-in properties whose values are constrained to be of particular types. "

+   objects for which this object is their parent. 

"Every object has eight built-in properties whose values are constrained to be of particular types. "

 name         a string, the usual name for this object
 owner        an object, the player who controls access to it
 location     an object, where the object is in virtual reality
@@ -43,4 +44,4 @@
 r            a bit, is the object publicly readable?
 w            a bit, is the object publicly writable?
 f            a bit, is the object fertile?
-

Verbs

Minimal MOO verbs:

  • put

    take

    get

    drop

View comments on this page at openacs.org
+

Verbs

Minimal MOO verbs:

  • put

    take

    get

    drop

View comments on this page at openacs.org
Index: openacs-4/contrib/packages/simulation/www/doc/package-install.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/package-install.html,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/doc/package-install.html 14 Nov 2003 14:03:11 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/doc/package-install.html 28 Nov 2003 16:55:52 -0000 1.2 @@ -1,4 +1,5 @@ -Package installation

Package installation

Requires workflow and bcms and their prerequisites.

  • Option 1: use a custom tarball which includes those modules. In + +Package installation

    Package installation

    Requires workflow and bcms and their prerequisites.

    • Option 1: use a custom tarball which includes those modules. In that case, the custom tarball will have a file install.xml in its root directory, so that installing OpenACS normally will produce a simulation server.

      Notes on custom tarball creation:

      Index: openacs-4/contrib/packages/simulation/www/doc/permissions.html
      ===================================================================
      RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/Attic/permissions.html,v
      diff -u -r1.2 -r1.3
      --- openacs-4/contrib/packages/simulation/www/doc/permissions.html	26 Nov 2003 16:44:50 -0000	1.2
      +++ openacs-4/contrib/packages/simulation/www/doc/permissions.html	28 Nov 2003 16:55:52 -0000	1.3
      @@ -1 +1,2 @@
      -Permissions
      View comments on this page at openacs.org
      + +Permissions
      View comments on this page at openacs.org
      Index: openacs-4/contrib/packages/simulation/www/doc/xml/Makefile =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/doc/xml/Attic/Makefile,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/simulation/www/doc/xml/Makefile 26 Nov 2003 16:44:50 -0000 1.4 +++ openacs-4/contrib/packages/simulation/www/doc/xml/Makefile 28 Nov 2003 16:55:52 -0000 1.5 @@ -18,4 +18,4 @@ all: - cd .. ; $(XSLTPROC) --nonet --novalid --xinclude ../../../../packages/acs-core-docs/www/xml/openacs.xsl xml/index.xml \ No newline at end of file + cd .. ; $(XSLTPROC) --nonet --novalid --xinclude ../../../acs-core-docs/www/xml/openacs.xsl xml/index.xml \ No newline at end of file Index: openacs-4/contrib/packages/simulation/www/siminst/cast-actors.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/cast-actors.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/siminst/cast-actors.adp 27 Nov 2003 16:43:36 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/siminst/cast-actors.adp 28 Nov 2003 16:55:52 -0000 1.2 @@ -2,17 +2,17 @@ @page_title;noquote@ @context;noquote@ + + +

      +TODO: get desired layout, see below: +

      +
      (this is just a mockup) - - + + - + - +
      RoleCharacterActor(s)In groups of
      Plaintiff - -
      RoleActor(s)In groups of
      Plaintiff
      Defendent - -
      Defendent
      Judge - -
      Judge - - - - - - - - - - - - - -
      RoleCharacterActor(s)In groups of
      Plaintiff - - - - -
      Defendent - - - -
      Judge - - - -
      - + +

      - Map to tasks +TODO: get desired layout, see below:

      + +
      + (this is just a mockup) + + + + + + + + + + + + + +
      RoleCharacter
      Plaintiff + +
      Defendent + +
      Judge + +
      +
      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.2 -r1.3 --- openacs-4/contrib/packages/simulation/www/siminst/map-characters.tcl 28 Nov 2003 09:32:26 -0000 1.2 +++ openacs-4/contrib/packages/simulation/www/siminst/map-characters.tcl 28 Nov 2003 16:55:52 -0000 1.3 @@ -12,13 +12,35 @@ set context [list [list "." "SimInst"] $page_title] # Loop over all workflow roles and add a character select widget for each -# set form [list] -# set character_options [simulation::get_object_options -content_type sim_character] -# foreach role_id [workflow::get_roles -workflow_id $workflow_id] { -# lappend form [list role_${role_id}:text(select) \ -# [list label [workflow::get_element -role_id $role_id -element pretty_name]] \ -# [list options $character_options] -# ] -# } +set form [list] +set character_options [simulation::get_object_options -content_type sim_character] +foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + set role_short_name [workflow::role::get_element -role_id $role_id -element short_name] + set role_pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name] + lappend form [list role_${role_short_name}:text(select) \ + [list label $role_pretty_name] \ + [list options $character_options] + ] +} -# ad_form -name characters -form $form +ad_form \ + -name characters \ + -export { workflow_id } \ + -form $form \ + -on_submit { + + db_transaction { + # Create a new template that is clone of the existing one + set workflow_id [simulation::template::clone -workflow_id $workflow_id] + + # Map each role to chosen character + foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + set role_short_name [workflow::role::get_element -role_id $role_id -element short_name] + simulation::role::edit -role_id $role_id -character_id [set role_${role_short_name}] + } + } + + # Proceed to the task page + ad_returnredirect [export_vars -base map-tasks {workflow_id}] + ad_script_abort + } Index: openacs-4/contrib/packages/simulation/www/siminst/map-create.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/map-create.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/siminst/map-create.adp 28 Nov 2003 16:55:52 -0000 1.1 @@ -0,0 +1,6 @@ + + @page_title;noquote@ + @context;noquote@ + template.pretty_name + + Index: openacs-4/contrib/packages/simulation/www/siminst/map-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/map-create.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/siminst/map-create.tcl 28 Nov 2003 16:55:52 -0000 1.1 @@ -0,0 +1,35 @@ +ad_page_contract { + A page that creates a mapped template by cloning a ready template. + This is the first step in the mapping process. + + @author Peter Marklund +} { + workflow_id:integer +} + +set page_title "Create mapped template" +set context [list [list "." "SimInst"] $page_title] + +set old_name [workflow::get_element -workflow_id $workflow_id -element pretty_name] +set name_default "$old_name Mapped" + +ad_form \ + -name template \ + -export { workflow_id } \ + -form { + {pretty_name:text + {label "Template name"} + {value $name_default} + {html {size 50}} + } + } -on_submit { + # Create a new template that is clone of the existing one + set workflow_id [simulation::template::clone \ + -workflow_id $workflow_id \ + -pretty_name $pretty_name] + + # Proceed to the task page + ad_returnredirect [export_vars -base map-tasks {workflow_id}] + ad_script_abort + + } 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.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl 27 Nov 2003 16:43:36 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/siminst/map-tasks.tcl 28 Nov 2003 16:55:52 -0000 1.2 @@ -8,3 +8,4 @@ set page_title "Map to Tasks" set context [list [list "." "SimInst" ] $page_title] + Index: openacs-4/packages/simulation/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/apm-callback-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/simulation/tcl/apm-callback-procs.tcl 10 Nov 2003 16:56:56 -0000 1.7 +++ openacs-4/packages/simulation/tcl/apm-callback-procs.tcl 28 Nov 2003 16:55:52 -0000 1.8 @@ -19,7 +19,7 @@ ad_proc -private simulation::apm::after_instantiate { {-package_id:required} } { - Create the package root folder. + Create data associated with a simulation package instance. } { set instance_name [apm_instance_name_from_id $package_id] @@ -30,4 +30,20 @@ -package_id $package_id \ -context_id $package_id \ -content_types { sim_character sim_prop sim_location sim_stylesheet image }] + + application_group::new \ + -group_name "Simulation Test Class" \ + -package_id $package_id } + +ad_proc -private simulation::apm::before_uninstantiate { + {-package_id:required} +} { + Tear down data associated with a package instance. +} { + set folder_id [bcms::folder::get_id_by_package_id -parent_id 0] + bcms::folder::delete_folder -folder_id $folder_id + + set group_id [application_group::group_id_from_package_id -package_id $package_id] + group::delete $group_id +} Index: openacs-4/packages/simulation/tcl/object-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/object-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/simulation/tcl/object-procs.tcl 18 Nov 2003 13:31:32 -0000 1.5 +++ openacs-4/packages/simulation/tcl/object-procs.tcl 28 Nov 2003 16:55:52 -0000 1.6 @@ -9,6 +9,12 @@ namespace eval simulation::object {} namespace eval simulation::object::xml {} +############################### +# +# simulation::object namespace +# +############################### + ad_proc -private simulation::object::url { {-package_id ""} {-name:required} @@ -43,6 +49,12 @@ return "${package_url}object-content/${name}" } +############################### +# +# simulation::object::xml namespace +# +############################### + ad_proc -private simulation::object::xml::file_sweeper {} { Loop over all simulation package instances and re-generate XML map files for them. Index: openacs-4/packages/simulation/tcl/role-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/Attic/role-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/simulation/tcl/role-procs.tcl 18 Nov 2003 12:19:39 -0000 1.4 +++ openacs-4/packages/simulation/tcl/role-procs.tcl 28 Nov 2003 16:55:52 -0000 1.5 @@ -20,17 +20,39 @@ @author Peter Marklund } { db_transaction { - # create the role + set role_short_name [util_text_to_url -replacement "_" $role_short_name] set role_id [workflow::role::new \ -workflow_id $template_id \ -short_name $role_short_name \ -pretty_name $role_pretty_name] + db_dml insert_sim_role { + insert into sim_roles (role_id) values (:role_id) + } } } ad_proc -public simulation::role::delete { {-role_id:required} } { - workflow::role::delete -role_id $role_id + db_transaction { + workflow::role::delete -role_id $role_id + + db_dml delete_sim_role { + delete from sim_roles where role_id = :role_id + } + } } + +ad_proc -public simulation::role::edit { + {-role_id:required} + {-character_id:required} +} { + Edit a simulation role. +} { + db_dml edit_sim_role { + update sim_roles + set character_id = :character_id + where role_id = :role_id + } +} Index: openacs-4/packages/simulation/tcl/simulation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/simulation-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/simulation/tcl/simulation-procs.tcl 14 Nov 2003 11:40:35 -0000 1.12 +++ openacs-4/packages/simulation/tcl/simulation-procs.tcl 28 Nov 2003 16:55:52 -0000 1.13 @@ -108,6 +108,124 @@ } } +ad_proc simulation::get_object_options { + {-content_type:required} +} { + Returns a list of cr_revision.title, cr_item.item_id pairs + for all cr_items of the given content_type in the root + folder of the current package. Suitable for ad_form options for + select boxes. + + @return [list [list cr_revision.title1 cr_item.item_id1] [list cr_revision.title2 cr_item.item_id2] ....] + + @author Peter Marklund +} { + set package_id [ad_conn package_id] + set parent_id [bcms::folder::get_id_by_package_id -package_id $package_id] + + return [db_list_of_lists character_options { + select cr.title, + ci.item_id + from cr_items ci, + cr_revisions cr + where ci.live_revision = cr.revision_id + and ci.parent_id = :parent_id + and ci.content_type = :content_type + }] +} + +ad_proc -public simulation::cast { + {-workflow_id:required} + {-pretty_name:required} + {-actors:required} + {-groupings:required} +} { + Takes a mapped simulation template and creates a casted simulation + with simulation cases. It does this by cloning the simulation + template. + + TODO: agent support + + TODO: taking actor type into account + + @param actors An array list with the actors of the simulation. The keys + of the list are role_ids and the values ids of the actor to play the role. + @param groups An array list with the groupings of the simulation. The keys + of the list are role_ids and the values are integers indicaing + a number of users to play that role. + + @return workflow_id of the simulation created. + + @author Peter Marklund +} { + array set actors_array $actors + array set groupings_array $groupings + + # TODO: make sure this is a proper clone also after mapping (tasks and characters...) + set workflow_id [simulation::template::clone \ + -pretty_name $pretty_name \ + -workflow_id $workflow_id] + + set user_list [db_list select_users { + select member_id + from party_approved_member_map + where party_id in (select + party_id from sim_party_sim_map + where simulation_id = :workflow_id + ) + }] + set total_n_users [llength $user_list] + + set n_users_per_case 0 + foreach role_id [array names groupings_array] { + set n_users_per_case [expr $n_users_per_case + $groupings_array($role_id)] + } + + set mod_n_users [expr $total_n_users % $n_users_per_case] + set n_cases [expr ($total_n_users - $mod_n_users) / $n_users_per_case] + + + if { $mod_n_users == "0" } { + # No rest in dividing, the cases add up nicely + + } else { + # We are missing mod_n_users to fill up the simulation. Create a new simulation + # for those students. + set n_cases [expr $n_cases + 1] + } + + # Create the cases and for each case assign roles to parties + set users_start_index 0 + for { set case_counter 0 } { $case_counter < $n_cases } { incr case_counter } { + # TODO: what should object_id be here? + set object_id [ad_conn package_id] + set case_id [workflow::case::new \ + -workflow_id $workflow_id \ + -object_id $object_id] + + # Assign a group of users to each role in the case + set party_array_list [list] + foreach role_id [array names actors] { + set role_short_name [workflow::role::get_element -role_id $role_id -element short_name] + + set users_end_index [expr $users_start_index + $groupings_array($role_id) - 1] + + set parties_list [lrange $user_list $users_start_index $users_end_index] + + lappend parties_array_list $role_short_name $users_list + + set users_start_index [expr $users_end_index + 1] + } + + workflow::case::role::assign \ + -case_id $case_id \ + -array $party_array_list \ + -replace + } + + return $workflow_id +} + template_tag relation { params } { publish::process_tag relation $params } Index: openacs-4/packages/simulation/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/template-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/simulation/tcl/template-procs.tcl 28 Nov 2003 11:12:39 -0000 1.4 +++ openacs-4/packages/simulation/tcl/template-procs.tcl 28 Nov 2003 16:55:52 -0000 1.5 @@ -26,6 +26,8 @@ set ready_p "f" } db_transaction { + set short_name [util_text_to_url -replacement "_" $short_name] + set workflow_id [workflow::new \ -short_name $short_name \ -pretty_name $pretty_name \ @@ -42,24 +44,40 @@ -short_name "dummy action" \ -pretty_name "dummy action" - set suggested_duration [string trim $suggested_duration] - if { [empty_string_p $suggested_duration] } { - db_dml new_sim { - insert into sim_simulations - (simulation_id, ready_p) - values (:workflow_id, :ready_p) - } - } else { - db_dml new_sim " - insert into sim_simulations - (simulation_id, ready_p, suggested_duration) - values ('$workflow_id', '$ready_p', interval '$suggested_duration')" - } + insert_sim \ + -workflow_id $workflow_id \ + -ready_p $ready_p \ + -suggested_duration $suggested_duration } return $workflow_id } +ad_proc -private simulation::template::insert_sim { + {-workflow_id:required} + {-ready_p:required} + {-suggested_duration:required} +} { + Internal proc for inserting values into the sim_simulations + table that are set prior to a template being mapped. + + @author Peter Marklund +} { + set suggested_duration [string trim $suggested_duration] + if { [empty_string_p $suggested_duration] } { + db_dml new_sim { + insert into sim_simulations + (simulation_id, ready_p) + values (:workflow_id, :ready_p) + } + } else { + db_dml new_sim " + insert into sim_simulations + (simulation_id, ready_p, suggested_duration) + values ('$workflow_id', '$ready_p', interval '$suggested_duration')" + } +} + ad_proc -public simulation::template::edit { {-workflow_id:required} {-short_name:required} @@ -106,6 +124,98 @@ } } +ad_proc -public simulation::template::instantiate_edit { + {-workflow_id:required} + {-enroll_start:required} + {-enroll_end:required} + {-notification_date:required} + {-case_start:required} + {-case_end:required} + {-enroll_type:required} + {-casting_type:required} + {-parties:required} +} { + Edit properties of a simulation set during instantiation. + + TODO: merge this proc with ::edit? + + @author Peter Marklund +} { + db_dml update_instantiate_template { + update sim_simulations + set enroll_start = to_date(:enroll_start, 'YYYY-MM-DD'), + enroll_end = to_date(:enroll_end, 'YYYY-MM-DD'), + send_start_note_date = to_date(:notification_date, 'YYYY-MM-DD'), + case_start = to_date(:case_start, 'YYYY-MM-DD'), + case_end = to_date(:case_end, 'YYYY-MM-DD'), + enroll_type = :enroll_type, + casting_type = :casting_type + where simulation_id = :workflow_id + } + + # Clear out old mappings first + db_dml clear_old_mappings { + delete from sim_party_sim_map + where simulation_id = :workflow_id + } + + foreach party_id $parties { + db_dml map_party_to_template { + insert into sim_party_sim_map + (simulation_id, party_id) + values (:workflow_id, :party_id) + } + } +} +ad_proc -public simulation::template::clone { + {-workflow_id:required} + {-pretty_name:required} +} { + Create a new simulation template which is a clone of the template with + given id. The clone will be mapped to the package of the current request. + + @param workflow_id The id of the template that you wish to clone. + @param pretty_name The pretty name of the clone you are creating. + + @return The id of the clone. + + @author Peter Marklund +} { + # If we set object_id here and leave short_name unchanged we + # get a unique constraint violation + set clone_workflow_id [workflow::fsm::clone \ + -workflow_id $workflow_id] + + # Set names of clones workflow and update the object_id + # TODO: create workflow::edit proc + set clone_short_name [util_text_to_url -replacement "_" $pretty_name] + set object_id [ad_conn package_id] + db_dml update_short_name { + update workflows + set short_name = :clone_short_name, + pretty_name = :pretty_name, + object_id = :object_id + where workflow_id = :clone_workflow_id + } + + # Add the role_id:s to the sim_roles table + set role_id_list [workflow::get_roles -workflow_id $clone_workflow_id] + foreach role_id $role_id_list { + db_dml insert_sim_role { + insert into sim_roles (role_id) values (:role_id) + } + } + + # Clone the values in the simulation table + get -workflow_id $workflow_id -array workflow + insert_sim \ + -workflow_id $clone_workflow_id \ + -ready_p $workflow(ready_p) \ + -suggested_duration $workflow(suggested_duration) + + return $clone_workflow_id +} + ad_proc -public simulation::template::get { {-workflow_id:required} {-array:required} Index: openacs-4/packages/simulation/test/crawl-links.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/test/Attic/crawl-links.test,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/test/crawl-links.test 19 Nov 2003 10:05:07 -0000 1.2 +++ openacs-4/packages/simulation/test/crawl-links.test 28 Nov 2003 16:55:52 -0000 1.3 @@ -9,7 +9,7 @@ ::twt::log_section "Login the site wide admin" ::twt::user::login_site_wide_admin - ::twt::set_crawler_exclude_links {delete} + ::twt::set_crawler_exclude_links {delete remove} # NOTE: The crawler needs the trailing slash when first invoked set simulation_uri /simulation/ Index: openacs-4/packages/simulation/test/demo-data-setup.test =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/test/demo-data-setup.test,v diff -u -r1.6 -r1.7 --- openacs-4/packages/simulation/test/demo-data-setup.test 19 Nov 2003 07:40:46 -0000 1.6 +++ openacs-4/packages/simulation/test/demo-data-setup.test 28 Nov 2003 16:55:52 -0000 1.7 @@ -75,6 +75,8 @@ do_request /simulation/simbuild/template-edit set template_name "Elementary Private Law" field fill $template_name ~n name + field find ~n ready_p + field fill t form submit ::twt::log_section "Create roles for template" Index: openacs-4/packages/simulation/www/doc/admin.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/admin.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/www/doc/admin.html 14 Nov 2003 14:03:11 -0000 1.2 +++ openacs-4/packages/simulation/www/doc/admin.html 28 Nov 2003 16:55:52 -0000 1.3 @@ -1 +1,2 @@ -Admin Guide

      Admin Guide


      Table of Contents

      Map XML
      View comments on this page at openacs.org
      + +Admin Guide

      Admin Guide


      Table of Contents

      Map XML
      View comments on this page at openacs.org
      Index: openacs-4/packages/simulation/www/doc/design.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/design.html,v diff -u -r1.6 -r1.7 --- openacs-4/packages/simulation/www/doc/design.html 14 Nov 2003 14:03:11 -0000 1.6 +++ openacs-4/packages/simulation/www/doc/design.html 28 Nov 2003 16:55:52 -0000 1.7 @@ -1 +1,2 @@ -Design

      Design


      View comments on this page at openacs.org
      + +Design

      Design


      View comments on this page at openacs.org
      Index: openacs-4/packages/simulation/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/index.html,v diff -u -r1.8 -r1.9 --- openacs-4/packages/simulation/www/doc/index.html 26 Nov 2003 16:44:50 -0000 1.8 +++ openacs-4/packages/simulation/www/doc/index.html 28 Nov 2003 16:55:52 -0000 1.9 @@ -1 +1,2 @@ -Simulation
      View comments on this page at openacs.org
      + +Simulation
      View comments on this page at openacs.org
      Index: openacs-4/packages/simulation/www/doc/install.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/install.html,v diff -u -r1.4 -r1.5 --- openacs-4/packages/simulation/www/doc/install.html 14 Nov 2003 14:03:11 -0000 1.4 +++ openacs-4/packages/simulation/www/doc/install.html 28 Nov 2003 16:55:52 -0000 1.5 @@ -1 +1,2 @@ -Installation

      Installation


      Table of Contents

      Package installation
      View comments on this page at openacs.org
      + +Installation

      Installation


      Table of Contents

      Package installation
      View comments on this page at openacs.org
      Index: openacs-4/packages/simulation/www/doc/interfaces.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/interfaces.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/www/doc/interfaces.html 14 Nov 2003 11:30:37 -0000 1.2 +++ openacs-4/packages/simulation/www/doc/interfaces.html 28 Nov 2003 16:55:52 -0000 1.3 @@ -1,2 +1,3 @@ -Interfaces

      Interfaces

      Page Map

      TCL API

      TCL API

      Each TCL API item should include inputs, outputs, and a - comment block describing any non-obvious internal issues.

      SQL API

      None yet.

      View comments on this page at openacs.org
      + +Interfaces

      Interfaces

      Page Map

      TCL API

      TCL API

      Each TCL API item should include inputs, outputs, and a + comment block describing any non-obvious internal issues.

      SQL API

      None yet.

      View comments on this page at openacs.org
      Index: openacs-4/packages/simulation/www/doc/internals.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/internals.html,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/www/doc/internals.html 14 Nov 2003 14:03:11 -0000 1.3 +++ openacs-4/packages/simulation/www/doc/internals.html 28 Nov 2003 16:55:52 -0000 1.4 @@ -1 +1,2 @@ -Internal Design

      Internal Design

      Data Model

      View comments on this page at openacs.org
      + +Internal Design

      Internal Design

      Data Model

      View comments on this page at openacs.org
      Index: openacs-4/packages/simulation/www/doc/licensing.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/licensing.html,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/doc/licensing.html 14 Nov 2003 14:03:11 -0000 1.1 +++ openacs-4/packages/simulation/www/doc/licensing.html 28 Nov 2003 16:55:52 -0000 1.2 @@ -1 +1,2 @@ -Appendix�A.�Licencing

      Appendix�A.�Licencing

      TODO

      View comments on this page at openacs.org
      + +Appendix A. Licencing

      Appendix A. Licencing

      TODO

      View comments on this page at openacs.org
      Index: openacs-4/packages/simulation/www/doc/map_xml.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/map_xml.html,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/doc/map_xml.html 12 Nov 2003 11:17:28 -0000 1.1 +++ openacs-4/packages/simulation/www/doc/map_xml.html 28 Nov 2003 16:55:52 -0000 1.2 @@ -1,4 +1,5 @@ -Map XML

      Map XML

      + +Map XML

      Map XML

      The simulation package will nightly generate an XML file with information needed for the SIMBUILD flash map. The objects in the XML file will be those that are supposed to appear on the map, i.e. those that have the on_map_p attribute set to true. The file Index: openacs-4/packages/simulation/www/doc/object-orientation-notes.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/object-orientation-notes.html,v diff -u -r1.8 -r1.9 --- openacs-4/packages/simulation/www/doc/object-orientation-notes.html 26 Nov 2003 16:44:50 -0000 1.8 +++ openacs-4/packages/simulation/www/doc/object-orientation-notes.html 28 Nov 2003 16:55:52 -0000 1.9 @@ -1,4 +1,5 @@ -Notes on an object-oriented simulated space

      Notes on an object-oriented simulated space

      An OpenACS simulation is a collection of interactive + +Notes on an object-oriented simulated space

      Notes on an object-oriented simulated space

      An OpenACS simulation is a collection of interactive objects, plus a set of roles and tasks. In the first part, it is conceptually similar to a MOO (Multiple-User Dungeon, Object-Oriented). This is a technology dating to 1990, in which @@ -10,7 +11,7 @@ Games), which are essentially MOOs with graphical instead of textual interfaces. Given their lineage and success, it makes sense to draw on MOO technology when designing our simulation - object model.

      Objects

      Basic MOO objects

      +      object model.

      Objects

      Basic MOO objects

       Root Class
         Room
         Thing
      @@ -27,13 +28,13 @@
           Exit
           Container
             Openable Container
      -

      Object Attributes

      (From the LambdaMOO Programmer's Manual

      +

      Object Attributes

      (From the LambdaMOO Programmer's Manual

       There are three fundamental attributes to every object:
       
          1. A flag (either true or false) specifying whether or not the object represents a player,
          2. The object that is its parent, and
          3. A list of the objects that are its children; that is, those
      -   objects for which this object is their parent. 

      "Every object has eight built-in properties whose values are constrained to be of particular types. "

      +   objects for which this object is their parent. 

      "Every object has eight built-in properties whose values are constrained to be of particular types. "

       name         a string, the usual name for this object
       owner        an object, the player who controls access to it
       location     an object, where the object is in virtual reality
      @@ -43,4 +44,4 @@
       r            a bit, is the object publicly readable?
       w            a bit, is the object publicly writable?
       f            a bit, is the object fertile?
      -

      Verbs

      Minimal MOO verbs:

      • put

        take

        get

        drop

      View comments on this page at openacs.org
      +

      Verbs

      Minimal MOO verbs:

      • put

        take

        get

        drop

      View comments on this page at openacs.org
      Index: openacs-4/packages/simulation/www/doc/package-install.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/package-install.html,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/doc/package-install.html 14 Nov 2003 14:03:11 -0000 1.1 +++ openacs-4/packages/simulation/www/doc/package-install.html 28 Nov 2003 16:55:52 -0000 1.2 @@ -1,4 +1,5 @@ -Package installation

      Package installation

      Requires workflow and bcms and their prerequisites.

      • Option 1: use a custom tarball which includes those modules. In + +Package installation

        Package installation

        Requires workflow and bcms and their prerequisites.

        • Option 1: use a custom tarball which includes those modules. In that case, the custom tarball will have a file install.xml in its root directory, so that installing OpenACS normally will produce a simulation server.

          Notes on custom tarball creation:

          Index: openacs-4/packages/simulation/www/doc/permissions.html
          ===================================================================
          RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/permissions.html,v
          diff -u -r1.2 -r1.3
          --- openacs-4/packages/simulation/www/doc/permissions.html	26 Nov 2003 16:44:50 -0000	1.2
          +++ openacs-4/packages/simulation/www/doc/permissions.html	28 Nov 2003 16:55:52 -0000	1.3
          @@ -1 +1,2 @@
          -Permissions
          View comments on this page at openacs.org
          + +Permissions
          View comments on this page at openacs.org
          Index: openacs-4/packages/simulation/www/doc/xml/Makefile =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/doc/xml/Makefile,v diff -u -r1.4 -r1.5 --- openacs-4/packages/simulation/www/doc/xml/Makefile 26 Nov 2003 16:44:50 -0000 1.4 +++ openacs-4/packages/simulation/www/doc/xml/Makefile 28 Nov 2003 16:55:52 -0000 1.5 @@ -18,4 +18,4 @@ all: - cd .. ; $(XSLTPROC) --nonet --novalid --xinclude ../../../../packages/acs-core-docs/www/xml/openacs.xsl xml/index.xml \ No newline at end of file + cd .. ; $(XSLTPROC) --nonet --novalid --xinclude ../../../acs-core-docs/www/xml/openacs.xsl xml/index.xml \ No newline at end of file Index: openacs-4/packages/simulation/www/siminst/cast-actors.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/Attic/cast-actors.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/siminst/cast-actors.adp 27 Nov 2003 16:43:36 -0000 1.1 +++ openacs-4/packages/simulation/www/siminst/cast-actors.adp 28 Nov 2003 16:55:52 -0000 1.2 @@ -2,17 +2,17 @@ @page_title;noquote@ @context;noquote@ + + +

          +TODO: get desired layout, see below: +

          +
          (this is just a mockup) - - + + - + - +
          RoleCharacterActor(s)In groups of
          Plaintiff - -
          RoleActor(s)In groups of
          Plaintiff
          Defendent - -
          Defendent
          Judge - -
          Judge - - - - - - - - - - - - - -
          RoleCharacterActor(s)In groups of
          Plaintiff - - - - -
          Defendent - - - -
          Judge - - - -
          - + +

          - Map to tasks +TODO: get desired layout, see below:

          + +
          + (this is just a mockup) + + + + + + + + + + + + + +
          RoleCharacter
          Plaintiff + +
          Defendent + +
          Judge + +
          +
          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.2 -r1.3 --- openacs-4/packages/simulation/www/siminst/map-characters.tcl 28 Nov 2003 09:32:26 -0000 1.2 +++ openacs-4/packages/simulation/www/siminst/map-characters.tcl 28 Nov 2003 16:55:52 -0000 1.3 @@ -12,13 +12,35 @@ set context [list [list "." "SimInst"] $page_title] # Loop over all workflow roles and add a character select widget for each -# set form [list] -# set character_options [simulation::get_object_options -content_type sim_character] -# foreach role_id [workflow::get_roles -workflow_id $workflow_id] { -# lappend form [list role_${role_id}:text(select) \ -# [list label [workflow::get_element -role_id $role_id -element pretty_name]] \ -# [list options $character_options] -# ] -# } +set form [list] +set character_options [simulation::get_object_options -content_type sim_character] +foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + set role_short_name [workflow::role::get_element -role_id $role_id -element short_name] + set role_pretty_name [workflow::role::get_element -role_id $role_id -element pretty_name] + lappend form [list role_${role_short_name}:text(select) \ + [list label $role_pretty_name] \ + [list options $character_options] + ] +} -# ad_form -name characters -form $form +ad_form \ + -name characters \ + -export { workflow_id } \ + -form $form \ + -on_submit { + + db_transaction { + # Create a new template that is clone of the existing one + set workflow_id [simulation::template::clone -workflow_id $workflow_id] + + # Map each role to chosen character + foreach role_id [workflow::get_roles -workflow_id $workflow_id] { + set role_short_name [workflow::role::get_element -role_id $role_id -element short_name] + simulation::role::edit -role_id $role_id -character_id [set role_${role_short_name}] + } + } + + # Proceed to the task page + ad_returnredirect [export_vars -base map-tasks {workflow_id}] + ad_script_abort + } Index: openacs-4/packages/simulation/www/siminst/map-create.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-create.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/map-create.adp 28 Nov 2003 16:55:52 -0000 1.1 @@ -0,0 +1,6 @@ + + @page_title;noquote@ + @context;noquote@ + template.pretty_name + + Index: openacs-4/packages/simulation/www/siminst/map-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-create.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/siminst/map-create.tcl 28 Nov 2003 16:55:52 -0000 1.1 @@ -0,0 +1,35 @@ +ad_page_contract { + A page that creates a mapped template by cloning a ready template. + This is the first step in the mapping process. + + @author Peter Marklund +} { + workflow_id:integer +} + +set page_title "Create mapped template" +set context [list [list "." "SimInst"] $page_title] + +set old_name [workflow::get_element -workflow_id $workflow_id -element pretty_name] +set name_default "$old_name Mapped" + +ad_form \ + -name template \ + -export { workflow_id } \ + -form { + {pretty_name:text + {label "Template name"} + {value $name_default} + {html {size 50}} + } + } -on_submit { + # Create a new template that is clone of the existing one + set workflow_id [simulation::template::clone \ + -workflow_id $workflow_id \ + -pretty_name $pretty_name] + + # Proceed to the task page + ad_returnredirect [export_vars -base map-tasks {workflow_id}] + ad_script_abort + + } 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.1 -r1.2 --- openacs-4/packages/simulation/www/siminst/map-tasks.tcl 27 Nov 2003 16:43:36 -0000 1.1 +++ openacs-4/packages/simulation/www/siminst/map-tasks.tcl 28 Nov 2003 16:55:52 -0000 1.2 @@ -8,3 +8,4 @@ set page_title "Map to Tasks" set context [list [list "." "SimInst" ] $page_title] +