Index: openacs-4/packages/simulation/www/sim-template-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/sim-template-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/sim-template-edit.tcl 24 Oct 2003 09:46:13 -0000 1.1 +++ openacs-4/packages/simulation/www/sim-template-edit.tcl 27 Oct 2003 07:31:55 -0000 1.2 @@ -69,177 +69,15 @@ set mode "edit" } -###################################################################### -# -# sim_template -# -# a form showing fields for a sim template, handling view mode and -# edit mode, and handling form submission -# -###################################################################### - switch $mode { add { set page_title "New Simulation Template" } edit { set page_title "Editing $name" - - #------------------------------------------------------------- - # in display mode, show lists of subordinate things - #------------------------------------------------------------- - - ############################################################## - # - # sim_objects - # - # A list of all objects associated with the Simulation Template - # - ############################################################## - - # maybe replace this chunk of copied text with an includable template - # which passes in a filter for the workflow_id? - - - #------------------------------------------------------------- - # sim_objects list - #------------------------------------------------------------- - - template::list::create \ - -name sim_objects \ - -multirow sim_objects \ - -elements { - edit { - sub_class narrow - link_url_col edit_url - display_template { - Edit - } - } - object_type_pretty { - label "Type" - orderby upper(ot.pretty_name) - } - title { - label "Title" - orderby r.title - link_url_col view_url - } - description { - label "Description" - orderby r.description - } - } - - db_multirow -extend { edit_url view_url delete_url } sim_objects select_sim_objects " - select i.item_id, - i.name, - r.title, - r.description, - i.content_type, - ot.pretty_name as object_type_pretty - from cr_folders f, - cr_items i, - cr_revisions r, - acs_object_types ot, - sim_workflow_object_map swom - where f.package_id = :package_id - and i.parent_id = f.folder_id - and r.revision_id = i.live_revision - and ot.object_type = i.content_type - and swom.workflow_id = :workflow_id - and swom.object_id = i.item_id - - [template::list::orderby_clause -orderby -name "sim_objects"] -" { - set description [string_truncate -len 200 $description] - set edit_url [export_vars -base "object-edit" { item_id }] - set view_url [export_vars -base "object/$name"] - set delete_url [export_vars -base "object-delete" { item_id }] -} - - set sim_types { sim_character sim_prop sim_home } - - db_multirow -extend { create_url label } object_types select_object_types " - select ot.object_type as content_type, - ot.pretty_name - from acs_object_types ot - where ot.object_type in ('[join $sim_types "','"]') -" { - set create_url [export_vars -base object-edit { content_type parent_id }] - set label "Create new $pretty_name" -} - - ############################################################## - # - # roles - # - # A list of all roles associated with the Simulation Template - # - ############################################################## - - # maybe replace this chunk of copied text with an includable template - # which passes in a filter for the workflow_id? - - - #------------------------------------------------------------- - # roles list - #------------------------------------------------------------- - - template::list::create \ - -name roles \ - -multirow roles \ - -elements { - edit { - sub_class narrow - link_url_col edit_url - display_template { - Edit - } - } - title { - label "Name" - } - character { - label "Character" - link_url_col char_url - } - delete { - sub_class narrow - link_url_col delete_url - display_template { - Edit - } - } - } - -# TODO: fix this so it returns rows when it should - db_multirow -extend { edit_url char_url delete_url } roles select_roles " - select wr.role_id, - wr.pretty_name as name, - wr.sort_order, - cr.title as character, - i.name as char_name - from workflow_roles wr, - sim_roles sr, - cr_revisions cr, - cr_items i - where wr.workflow_id = :workflow_id - and sr.role_id = wr.role_id - and cr.item_id = sr.character_id - and i.item_id = sr.character_id - [template::list::orderby_clause -orderby -name "roles"] -" { - set edit_url [export_vars -base "role-edit" { role_id }] - set char_url [export_vars -base "object/$char_name"] - set delete_url [export_vars -base "role-delete" { role_id }] -} } } set context [list [list "sim-template-list" "Sim Templates"] $page_title] -# maybe replace this chunk of copied text with an includable template -# which passes in a filter for the workflow_id? -