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.10 -r1.11 --- openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl 13 Nov 2003 12:19:49 -0000 1.10 +++ openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl 13 Nov 2003 13:44:36 -0000 1.11 @@ -7,10 +7,6 @@ } namespace eval simulation {} -namespace eval simulation::action {} -namespace eval simulation::object_type {} -namespace eval simulation::character {} -namespace eval simulation::role {} ad_proc -public simulation::package_key {} { return simulation @@ -111,152 +107,6 @@ } } -ad_proc -public simulation::object_type::get_options { -} { - Generate a list of object types formatted as an option list for form-builder's widgets. foo. -} { - set sim_types { sim_character sim_prop sim_location sim_stylesheet image } - - return [db_list_of_lists object_types " - select ot.pretty_name, - ot.object_type - from acs_object_types ot - where ot.object_type in ('[join $sim_types "','"]') - "] -} - -ad_proc -public simulation::action::edit { - {-action_id:required} - {-sort_order {}} - {-short_name:required} - {-pretty_name:required} - {-pretty_past_tense {}} - {-edit_fields {}} - {-allowed_roles {}} - {-assigned_role {}} - {-privileges {}} - {-enabled_states {}} - {-assigned_states {}} - {-new_state {}} - {-callbacks {}} - {-always_enabled_p f} - {-initial_action_p f} - {-recipient_role:required {}} - {-description {}} - {-description_mime_type {}} -} { - Edit an action. Mostly a wrapper for fsm, plus some simulation-specific stuff. -} { - - # should call API, but API doesn't exist yet - # deferring at the moment since we're only changing two fields in this - # prototype UI anyway. But it would look like this: - - # workflow::action::fsm::edit \ - # -workflow_id $workflow_id - # -short_name $name \ - # -pretty_name $name \ - # -assigned_role $assigned_role - - set workflow_id [workflow::action::get_workflow_id -action_id $action_id] - - db_transaction { - db_dml edit_workflow_action { - update workflow_actions - set short_name = :short_name, - pretty_name = :pretty_name, - assigned_role = :assigned_role, - description = :description, - description_mime_type = :description_mime_type - where action_id = :action_id - } - - db_dml edit_sim_role { - update sim_tasks - set recipient = :recipient_role - where task_id = :action_id - } - } - - workflow::action::flush_cache -workflow_id $workflow_id -} - template_tag relation { params } { publish::process_tag relation $params } - -################################ -# -# simulation::character namespace -# -################################ - -ad_proc -public simulation::character::get { - {-character_id:required} - {-array:required} -} { - Get basic information about a character. Gets the following attributes: uri, title. - - @param array The name of an array into which you want the information put. - - @author Peter Marklund -} { - upvar $array row - - db_1row select_character_info {} -column_array row -} - -ad_proc -public simulation::character::get_element { - {-character_id:required} - {-element:required} -} { - Get a particular attribute from a character object. - - @param element Name of the attribute you want to retrieve - - @see simulation::character::get - - @author Peter Marklund -} { - get -character_id $character_id -array character - - return $character($element) -} - -################################ -# -# simulation::role namespace -# -################################ - -ad_proc -public simulation::role::new { - {-template_id:required} - {-role_short_name:required} - {-role_pretty_name:required} -} { - Create a new simulation role for a given simulation template. - Will map the character to the template if this - is not already done. - - @author Peter Marklund -} { - db_transaction { - # create the role - set role_id [workflow::role::new \ - -workflow_id $template_id \ - -short_name $role_short_name \ - -pretty_name $role_pretty_name] - - # and then add extra data for simulation - db_dml set_role_character { - 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 -}