Index: openacs-4/contrib/packages/simulation/simulation.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/Attic/simulation.info,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/simulation.info 14 Oct 2003 13:58:03 -0000 1.3 +++ openacs-4/contrib/packages/simulation/simulation.info 27 Oct 2003 07:31:54 -0000 1.4 @@ -8,7 +8,7 @@ f simulation - + Joel Aufrecht Workflow-based task simulator. 2003-10-13 Index: openacs-4/contrib/packages/simulation/lib/object-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/object-display.adp,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/lib/object-display.adp 24 Oct 2003 12:27:01 -0000 1.3 +++ openacs-4/contrib/packages/simulation/lib/object-display.adp 27 Oct 2003 07:31:55 -0000 1.4 @@ -2,12 +2,9 @@ @page_title;noquote@ @context;noquote@ - - - @content_html;noquote@ Edit Index: openacs-4/contrib/packages/simulation/lib/object-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/object-display.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/simulation/lib/object-display.tcl 24 Oct 2003 12:27:01 -0000 1.5 +++ openacs-4/contrib/packages/simulation/lib/object-display.tcl 27 Oct 2003 07:31:55 -0000 1.6 @@ -28,7 +28,12 @@ -revision_id $item(revision_id) \ -array content +if { [info exists content(text)] } { set content_html [ad_html_text_convert -from $content(mime_type) -to "text/html" -- $content(text)] +} else { + set content(text) "" + set content(html) "" +} ###### Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-content-types-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-create.sql 24 Oct 2003 09:46:13 -0000 1.4 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-create.sql 27 Oct 2003 07:31:55 -0000 1.5 @@ -35,7 +35,7 @@ 'Stylesheets', -- pretty_plural 1, -- sort_order null, -- default_value - 'integer constraint sim_char_stylesheet_fk references sim_stylesheets(stylesheet_id)' -- column_spec + 'integer constraint sim_char_stylesheet_fk references cr_items' -- column_spec ); -- sim_prop @@ -58,7 +58,7 @@ 'Stylesheets', -- pretty_plural 1, -- sort_order null, -- default_value - 'integer constraint sim_char_stylesheet_fk references sim_stylesheets(stylesheet_id)' -- column_spec + 'integer constraint sim_prop_stylesheet_fk references cr_items' -- column_spec ); @@ -116,5 +116,5 @@ 'Stylesheets', -- pretty_plural 4, -- sort_order null, -- default_value - 'integer constraint sim_char_stylesheet_fk references sim_stylesheets(stylesheet_id)' -- column_spec + 'integer constraint sim_home_stylesheet_fk references cr_items' -- column_spec ); Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-drop.sql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-drop.sql 14 Oct 2003 13:58:03 -0000 1.3 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-drop.sql 27 Oct 2003 07:31:55 -0000 1.4 @@ -16,14 +16,13 @@ -- return 0; --end;' language 'plpgsql'; ---drop tables +--drop independent tables drop table sim_party_sim_map; drop table sim_simulations; drop table sim_tasks; drop table sim_roles; drop table sim_workflow_object_map; - --drop types select acs_object_type__drop_type( 'sim_object', @@ -35,3 +34,52 @@ 't' ); +--drop objects +--declare +-- object_rec record; +--begin +-- for object_rec in select object_id from acs_objects where object_type=''sim_object'' +-- loop +-- perform acs_object__delete( object_rec.object_id ); +-- end loop; +-- return 0; +--end;' language 'plpgsql'; + +-- drop content_types +create function inline_0 () +returns integer as ' +declare + rec record; +begin + for rec in (select folder_id + from cr_folders + where package_id in (select package_id + from apm_packages + where package_key = ''simulation'')) + loop + perform content_folder__unregister_content_type(rec.folder_id, ''sim_characters'',''t''); + end loop; + return 0; +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0 (); + +select content_type__drop_type( + 'sim_homes', + 't', + 't' + ); + +select content_type__drop_type( + 'sim_props', + 't', + 't' + ); + +select content_type__drop_type( + 'sim_stylesheets', + 't', + 't' + ); + + Index: openacs-4/contrib/packages/simulation/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/index.adp,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/www/index.adp 24 Oct 2003 09:46:13 -0000 1.10 +++ openacs-4/contrib/packages/simulation/www/index.adp 27 Oct 2003 07:31:55 -0000 1.11 @@ -36,4 +36,3 @@ - Index: openacs-4/contrib/packages/simulation/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/index.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/index.tcl 24 Oct 2003 09:46:13 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/index.tcl 27 Oct 2003 07:31:55 -0000 1.4 @@ -6,6 +6,8 @@ } -properties { } +set package_id [ad_conn package_id] + ###################################################################### # # active_cases @@ -36,7 +38,7 @@ #--------------------------------------------------------------------- # active_cases database query #--------------------------------------------------------------------- -# this is currently a dummy query. For Phase 2, it should get all cases +# this is currently a dummy query. It should get all cases # for which the logged-in user has a role, and a count of active tasks # for that role. @@ -75,13 +77,16 @@ #--------------------------------------------------------------------- # object_count database query #--------------------------------------------------------------------- +# this query should be package-sensitive. Not sure how to do that - +# should it return only items in folders associated with the package id? +# if so, how do we also count items in child folders? db_multirow -extend { view_url } object_count object_count_select " - select object_type as type, - count(object_type) as count - from acs_objects - where object_type like 'sim_%' - group by object_type + select content_type as type, + count(content_type) as count + from cr_items + where content_type like 'sim_%' + group by content_type " { set view_url [export_vars -base "object-list" { type }] } Index: openacs-4/contrib/packages/simulation/www/object-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/object-edit.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/contrib/packages/simulation/www/object-edit.tcl 24 Oct 2003 12:39:18 -0000 1.7 +++ openacs-4/contrib/packages/simulation/www/object-edit.tcl 27 Oct 2003 07:31:55 -0000 1.8 @@ -9,7 +9,7 @@ {content_type {sim_prop}} } -#TODO: object type should be non-editable for non-new things +#TODO: object type should be changable in new mode #--------------------------------------------------------------------- # Determine if we are in edit mode or display mode @@ -30,6 +30,9 @@ # Get data for existing object array set item_info [bcms::item::get_item -item_id $item_id -revision live] item::get_revision_content $item_info(revision_id) + if {! [info exists content(text)] } { + set content(text) "" + } set content_type $item_info(content_type) set page_title "Edit Sim Object" } else { @@ -59,9 +62,9 @@ {html {size 50}} } {name:text,optional - {label "URL name"} + {label "URI"} {html {size 50}} - {help_text {[ad_decode [ad_form_new_p -key item_id] 1 "This will become part of the URL for the object." ""]}} + {help_text {[ad_decode [ad_form_new_p -key item_id] 1 "Leave blank to default to Title. This will become part of the URL for the object." ""]}} {mode {[ad_decode [ad_form_new_p -key item_id] 1 "edit" "display"]}} } {description:text(textarea),optional @@ -71,13 +74,13 @@ } -##### +###################################################################### # # Content edit/upload method # # Add a form widget appropriate for the content attribute of the object type # -##### +###################################################################### array set content_method { sim_character richtext Index: openacs-4/contrib/packages/simulation/www/object-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/object-list.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/contrib/packages/simulation/www/object-list.tcl 24 Oct 2003 10:28:27 -0000 1.6 +++ openacs-4/contrib/packages/simulation/www/object-list.tcl 27 Oct 2003 07:31:55 -0000 1.7 @@ -8,7 +8,7 @@ {type:optional} } -set page_title "Objects" +set page_title "Sim Objects" set context [list $page_title] if { ![exists_and_not_null parent_id] } { @@ -31,7 +31,7 @@ orderby upper(ot.pretty_name) } title { - label "Title" + label "Name" orderby r.title link_url_col view_url } Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/object.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/www/object.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/simulation/www/role-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/role-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/role-edit.tcl 24 Oct 2003 09:46:13 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/role-edit.tcl 27 Oct 2003 07:31:55 -0000 1.2 @@ -37,12 +37,10 @@ set char_options [db_list_of_lists character_option_list " select ci.name, - a.object_id + cr.item_id from cr_revisions cr, - cr_items ci, - acs_objects a - where a.object_type = 'sim_character' - and cr.revision_id = a.object_id + cr_items ci + where ci.content_type = 'sim_character' and ci.item_id = cr.item_id "] Index: openacs-4/contrib/packages/simulation/www/sim-template-add-objects.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/sim-template-add-objects.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/sim-template-add-objects.tcl 24 Oct 2003 09:46:13 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/sim-template-add-objects.tcl 27 Oct 2003 07:31:55 -0000 1.2 @@ -25,7 +25,7 @@ # # A list of objects to add to a chosen workflow # At the moment, this is all objects -# TODO: add checkbox to allow adding multiple objects in one go +# TODO: add checkbox to allow adding multiple objects in one pass # ###################################################################### @@ -45,7 +45,6 @@ title { label "Title" orderby r.title - link_url_col view_url } description { label "Description" @@ -55,7 +54,7 @@ sub_class narrow link_url_col add_to_sim_template_url display_template { - Add to Template + Add to Template Add to $workflow(pretty_name) } } } Index: openacs-4/contrib/packages/simulation/www/sim-template-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/sim-template-edit.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/sim-template-edit.adp 24 Oct 2003 09:46:13 -0000 1.1 +++ openacs-4/contrib/packages/simulation/www/sim-template-edit.adp 27 Oct 2003 07:31:55 -0000 1.2 @@ -5,13 +5,10 @@ - +

Associated Sim Objects

-

-

Add Sim -Objects to this Workflow +

Roles

-

-

Add a role +

Tasks

\ No newline at end of file Index: openacs-4/contrib/packages/simulation/www/sim-template-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/sim-template-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/www/sim-template-edit.tcl 24 Oct 2003 09:46:13 -0000 1.1 +++ openacs-4/contrib/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? - Index: openacs-4/contrib/packages/simulation/www/sim-template-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/sim-template-list.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/www/sim-template-list.tcl 24 Oct 2003 09:46:13 -0000 1.2 +++ openacs-4/contrib/packages/simulation/www/sim-template-list.tcl 27 Oct 2003 07:31:55 -0000 1.3 @@ -1,9 +1,19 @@ ad_page_contract { List workflows designated as templates (but not simulations or cases) on this system. } -set page_title "Templates" + +set page_title "Simulation Templates" set context [list $page_title] +set package_id [ad_conn package_id] +###################################################################### +# +# sim_templates +# +# a list of templates +# +###################################################################### + template::list::create \ -name sim_templates \ -multirow sim_templates \ @@ -46,8 +56,6 @@ } } -set package_id [ad_conn package_id] - db_multirow -extend { edit_url view_url delete_url } sim_templates select_sim_templates " select w.workflow_id, w.pretty_name as name, Index: openacs-4/packages/simulation/simulation.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/simulation.info,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/simulation.info 14 Oct 2003 13:58:03 -0000 1.3 +++ openacs-4/packages/simulation/simulation.info 27 Oct 2003 07:31:54 -0000 1.4 @@ -8,7 +8,7 @@ f simulation - + Joel Aufrecht Workflow-based task simulator. 2003-10-13 Index: openacs-4/packages/simulation/lib/object-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/object-display.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/lib/object-display.adp 24 Oct 2003 12:27:01 -0000 1.3 +++ openacs-4/packages/simulation/lib/object-display.adp 27 Oct 2003 07:31:55 -0000 1.4 @@ -2,12 +2,9 @@ @page_title;noquote@ @context;noquote@ - - - @content_html;noquote@ Edit Index: openacs-4/packages/simulation/lib/object-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/object-display.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/simulation/lib/object-display.tcl 24 Oct 2003 12:27:01 -0000 1.5 +++ openacs-4/packages/simulation/lib/object-display.tcl 27 Oct 2003 07:31:55 -0000 1.6 @@ -28,7 +28,12 @@ -revision_id $item(revision_id) \ -array content +if { [info exists content(text)] } { set content_html [ad_html_text_convert -from $content(mime_type) -to "text/html" -- $content(text)] +} else { + set content(text) "" + set content(html) "" +} ###### Index: openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql 24 Oct 2003 09:46:13 -0000 1.4 +++ openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql 27 Oct 2003 07:31:55 -0000 1.5 @@ -35,7 +35,7 @@ 'Stylesheets', -- pretty_plural 1, -- sort_order null, -- default_value - 'integer constraint sim_char_stylesheet_fk references sim_stylesheets(stylesheet_id)' -- column_spec + 'integer constraint sim_char_stylesheet_fk references cr_items' -- column_spec ); -- sim_prop @@ -58,7 +58,7 @@ 'Stylesheets', -- pretty_plural 1, -- sort_order null, -- default_value - 'integer constraint sim_char_stylesheet_fk references sim_stylesheets(stylesheet_id)' -- column_spec + 'integer constraint sim_prop_stylesheet_fk references cr_items' -- column_spec ); @@ -116,5 +116,5 @@ 'Stylesheets', -- pretty_plural 4, -- sort_order null, -- default_value - 'integer constraint sim_char_stylesheet_fk references sim_stylesheets(stylesheet_id)' -- column_spec + 'integer constraint sim_home_stylesheet_fk references cr_items' -- column_spec ); Index: openacs-4/packages/simulation/sql/postgresql/simulation-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-drop.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/sql/postgresql/simulation-drop.sql 14 Oct 2003 13:58:03 -0000 1.3 +++ openacs-4/packages/simulation/sql/postgresql/simulation-drop.sql 27 Oct 2003 07:31:55 -0000 1.4 @@ -16,14 +16,13 @@ -- return 0; --end;' language 'plpgsql'; ---drop tables +--drop independent tables drop table sim_party_sim_map; drop table sim_simulations; drop table sim_tasks; drop table sim_roles; drop table sim_workflow_object_map; - --drop types select acs_object_type__drop_type( 'sim_object', @@ -35,3 +34,52 @@ 't' ); +--drop objects +--declare +-- object_rec record; +--begin +-- for object_rec in select object_id from acs_objects where object_type=''sim_object'' +-- loop +-- perform acs_object__delete( object_rec.object_id ); +-- end loop; +-- return 0; +--end;' language 'plpgsql'; + +-- drop content_types +create function inline_0 () +returns integer as ' +declare + rec record; +begin + for rec in (select folder_id + from cr_folders + where package_id in (select package_id + from apm_packages + where package_key = ''simulation'')) + loop + perform content_folder__unregister_content_type(rec.folder_id, ''sim_characters'',''t''); + end loop; + return 0; +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0 (); + +select content_type__drop_type( + 'sim_homes', + 't', + 't' + ); + +select content_type__drop_type( + 'sim_props', + 't', + 't' + ); + +select content_type__drop_type( + 'sim_stylesheets', + 't', + 't' + ); + + Index: openacs-4/packages/simulation/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/index.adp,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/www/index.adp 24 Oct 2003 09:46:13 -0000 1.10 +++ openacs-4/packages/simulation/www/index.adp 27 Oct 2003 07:31:55 -0000 1.11 @@ -36,4 +36,3 @@ - Index: openacs-4/packages/simulation/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/index.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/www/index.tcl 24 Oct 2003 09:46:13 -0000 1.3 +++ openacs-4/packages/simulation/www/index.tcl 27 Oct 2003 07:31:55 -0000 1.4 @@ -6,6 +6,8 @@ } -properties { } +set package_id [ad_conn package_id] + ###################################################################### # # active_cases @@ -36,7 +38,7 @@ #--------------------------------------------------------------------- # active_cases database query #--------------------------------------------------------------------- -# this is currently a dummy query. For Phase 2, it should get all cases +# this is currently a dummy query. It should get all cases # for which the logged-in user has a role, and a count of active tasks # for that role. @@ -75,13 +77,16 @@ #--------------------------------------------------------------------- # object_count database query #--------------------------------------------------------------------- +# this query should be package-sensitive. Not sure how to do that - +# should it return only items in folders associated with the package id? +# if so, how do we also count items in child folders? db_multirow -extend { view_url } object_count object_count_select " - select object_type as type, - count(object_type) as count - from acs_objects - where object_type like 'sim_%' - group by object_type + select content_type as type, + count(content_type) as count + from cr_items + where content_type like 'sim_%' + group by content_type " { set view_url [export_vars -base "object-list" { type }] } Index: openacs-4/packages/simulation/www/object-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/object-edit.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/simulation/www/object-edit.tcl 24 Oct 2003 12:39:18 -0000 1.7 +++ openacs-4/packages/simulation/www/object-edit.tcl 27 Oct 2003 07:31:55 -0000 1.8 @@ -9,7 +9,7 @@ {content_type {sim_prop}} } -#TODO: object type should be non-editable for non-new things +#TODO: object type should be changable in new mode #--------------------------------------------------------------------- # Determine if we are in edit mode or display mode @@ -30,6 +30,9 @@ # Get data for existing object array set item_info [bcms::item::get_item -item_id $item_id -revision live] item::get_revision_content $item_info(revision_id) + if {! [info exists content(text)] } { + set content(text) "" + } set content_type $item_info(content_type) set page_title "Edit Sim Object" } else { @@ -59,9 +62,9 @@ {html {size 50}} } {name:text,optional - {label "URL name"} + {label "URI"} {html {size 50}} - {help_text {[ad_decode [ad_form_new_p -key item_id] 1 "This will become part of the URL for the object." ""]}} + {help_text {[ad_decode [ad_form_new_p -key item_id] 1 "Leave blank to default to Title. This will become part of the URL for the object." ""]}} {mode {[ad_decode [ad_form_new_p -key item_id] 1 "edit" "display"]}} } {description:text(textarea),optional @@ -71,13 +74,13 @@ } -##### +###################################################################### # # Content edit/upload method # # Add a form widget appropriate for the content attribute of the object type # -##### +###################################################################### array set content_method { sim_character richtext Index: openacs-4/packages/simulation/www/object-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/object-list.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/simulation/www/object-list.tcl 24 Oct 2003 10:28:27 -0000 1.6 +++ openacs-4/packages/simulation/www/object-list.tcl 27 Oct 2003 07:31:55 -0000 1.7 @@ -8,7 +8,7 @@ {type:optional} } -set page_title "Objects" +set page_title "Sim Objects" set context [list $page_title] if { ![exists_and_not_null parent_id] } { @@ -31,7 +31,7 @@ orderby upper(ot.pretty_name) } title { - label "Title" + label "Name" orderby r.title link_url_col view_url } Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/object.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/object.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/simulation/www/role-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/role-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/role-edit.tcl 24 Oct 2003 09:46:13 -0000 1.1 +++ openacs-4/packages/simulation/www/role-edit.tcl 27 Oct 2003 07:31:55 -0000 1.2 @@ -37,12 +37,10 @@ set char_options [db_list_of_lists character_option_list " select ci.name, - a.object_id + cr.item_id from cr_revisions cr, - cr_items ci, - acs_objects a - where a.object_type = 'sim_character' - and cr.revision_id = a.object_id + cr_items ci + where ci.content_type = 'sim_character' and ci.item_id = cr.item_id "] Index: openacs-4/packages/simulation/www/sim-template-add-objects.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/sim-template-add-objects.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/sim-template-add-objects.tcl 24 Oct 2003 09:46:13 -0000 1.1 +++ openacs-4/packages/simulation/www/sim-template-add-objects.tcl 27 Oct 2003 07:31:55 -0000 1.2 @@ -25,7 +25,7 @@ # # A list of objects to add to a chosen workflow # At the moment, this is all objects -# TODO: add checkbox to allow adding multiple objects in one go +# TODO: add checkbox to allow adding multiple objects in one pass # ###################################################################### @@ -45,7 +45,6 @@ title { label "Title" orderby r.title - link_url_col view_url } description { label "Description" @@ -55,7 +54,7 @@ sub_class narrow link_url_col add_to_sim_template_url display_template { - Add to Template + Add to Template Add to $workflow(pretty_name) } } } Index: openacs-4/packages/simulation/www/sim-template-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/sim-template-edit.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/www/sim-template-edit.adp 24 Oct 2003 09:46:13 -0000 1.1 +++ openacs-4/packages/simulation/www/sim-template-edit.adp 27 Oct 2003 07:31:55 -0000 1.2 @@ -5,13 +5,10 @@ - +

Associated Sim Objects

-

-

Add Sim -Objects to this Workflow +

Roles

-

-

Add a role +

Tasks

\ No newline at end of file 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? - Index: openacs-4/packages/simulation/www/sim-template-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/sim-template-list.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/www/sim-template-list.tcl 24 Oct 2003 09:46:13 -0000 1.2 +++ openacs-4/packages/simulation/www/sim-template-list.tcl 27 Oct 2003 07:31:55 -0000 1.3 @@ -1,9 +1,19 @@ ad_page_contract { List workflows designated as templates (but not simulations or cases) on this system. } -set page_title "Templates" + +set page_title "Simulation Templates" set context [list $page_title] +set package_id [ad_conn package_id] +###################################################################### +# +# sim_templates +# +# a list of templates +# +###################################################################### + template::list::create \ -name sim_templates \ -multirow sim_templates \ @@ -46,8 +56,6 @@ } } -set package_id [ad_conn package_id] - db_multirow -extend { edit_url view_url delete_url } sim_templates select_sim_templates " select w.workflow_id, w.pretty_name as name,