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.8 -r1.9 --- openacs-4/contrib/packages/simulation/www/object-edit.tcl 27 Oct 2003 07:31:55 -0000 1.8 +++ openacs-4/contrib/packages/simulation/www/object-edit.tcl 27 Oct 2003 12:22:58 -0000 1.9 @@ -9,8 +9,6 @@ {content_type {sim_prop}} } -#TODO: object type should be changable in new mode - #--------------------------------------------------------------------- # Determine if we are in edit mode or display mode #--------------------------------------------------------------------- @@ -48,6 +46,7 @@ # A form for editing and viewing sim objects # ###################################################################### +#TODO: content_type should be changable in new mode ad_form -name object -cancel_url object-list -form { {item_id:key} @@ -73,14 +72,11 @@ } } - -###################################################################### -# +#--------------------------------------------------------------------- # Content edit/upload method # # Add a form widget appropriate for the content attribute of the object type -# -###################################################################### +#--------------------------------------------------------------------- array set content_method { sim_character richtext @@ -114,19 +110,14 @@ } } - - -##### -# +#--------------------------------------------------------------------- # Dynamic attributes for the content type # # Look up the other attributes for this content type and put them on the form -# -##### +#--------------------------------------------------------------------- +# LARS: I'm doing this as a proof-of-concept type thing. If it works well +# enough for us, we'll want to generalize and move into acs-content-repository -# LARS: I'm doing this as a proof-of-concept type thing. If it works well enough for us, -# we'll want to generalize and move into acs-content-repository - array set form_datatype { string text boolean text @@ -191,6 +182,11 @@ set attr_names [list] + +#--------------------------------------------------------------------- +# database access for attributes +#--------------------------------------------------------------------- + db_foreach select_attributes { select attribute_name, pretty_name, datatype, default_value, min_n_values from acs_attributes @@ -226,7 +222,7 @@ if { $content_type_p } { set options [db_list_of_lists select_options { select r.title, - i.item_id + i.item_id from cr_items i, cr_revisions r where i.content_type = :elm_ref_type and r.revision_id = i.live_revision @@ -235,7 +231,7 @@ } else { set options [db_list_of_lists select_options { select acs_object__name(object_id), - object_id + object_id from acs_objects where object_type = :elm_ref_type order by acs_object__name(object_id) @@ -252,7 +248,7 @@ } ad_form -extend -name object -form \ - [list [concat [list $elm_decl [list label \$pretty_name]] $extra]] + [list [concat [list $elm_decl [list label \$pretty_name]] $extra]] } @@ -296,6 +292,11 @@ } } + if { $content_type == "sim_stylesheet" } { + set mime_type "text/css" + } + + set revision_id [bcms::revision::add_revision \ -item_id $item_id \ -title $title \ 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.8 -r1.9 --- openacs-4/packages/simulation/www/object-edit.tcl 27 Oct 2003 07:31:55 -0000 1.8 +++ openacs-4/packages/simulation/www/object-edit.tcl 27 Oct 2003 12:22:58 -0000 1.9 @@ -9,8 +9,6 @@ {content_type {sim_prop}} } -#TODO: object type should be changable in new mode - #--------------------------------------------------------------------- # Determine if we are in edit mode or display mode #--------------------------------------------------------------------- @@ -48,6 +46,7 @@ # A form for editing and viewing sim objects # ###################################################################### +#TODO: content_type should be changable in new mode ad_form -name object -cancel_url object-list -form { {item_id:key} @@ -73,14 +72,11 @@ } } - -###################################################################### -# +#--------------------------------------------------------------------- # Content edit/upload method # # Add a form widget appropriate for the content attribute of the object type -# -###################################################################### +#--------------------------------------------------------------------- array set content_method { sim_character richtext @@ -114,19 +110,14 @@ } } - - -##### -# +#--------------------------------------------------------------------- # Dynamic attributes for the content type # # Look up the other attributes for this content type and put them on the form -# -##### +#--------------------------------------------------------------------- +# LARS: I'm doing this as a proof-of-concept type thing. If it works well +# enough for us, we'll want to generalize and move into acs-content-repository -# LARS: I'm doing this as a proof-of-concept type thing. If it works well enough for us, -# we'll want to generalize and move into acs-content-repository - array set form_datatype { string text boolean text @@ -191,6 +182,11 @@ set attr_names [list] + +#--------------------------------------------------------------------- +# database access for attributes +#--------------------------------------------------------------------- + db_foreach select_attributes { select attribute_name, pretty_name, datatype, default_value, min_n_values from acs_attributes @@ -226,7 +222,7 @@ if { $content_type_p } { set options [db_list_of_lists select_options { select r.title, - i.item_id + i.item_id from cr_items i, cr_revisions r where i.content_type = :elm_ref_type and r.revision_id = i.live_revision @@ -235,7 +231,7 @@ } else { set options [db_list_of_lists select_options { select acs_object__name(object_id), - object_id + object_id from acs_objects where object_type = :elm_ref_type order by acs_object__name(object_id) @@ -252,7 +248,7 @@ } ad_form -extend -name object -form \ - [list [concat [list $elm_decl [list label \$pretty_name]] $extra]] + [list [concat [list $elm_decl [list label \$pretty_name]] $extra]] } @@ -296,6 +292,11 @@ } } + if { $content_type == "sim_stylesheet" } { + set mime_type "text/css" + } + + set revision_id [bcms::revision::add_revision \ -item_id $item_id \ -title $title \