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 -N -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/lib/object-display.tcl 17 Oct 2003 09:22:55 -0000 1.3 +++ openacs-4/contrib/packages/simulation/lib/object-display.tcl 17 Oct 2003 09:55:53 -0000 1.4 @@ -62,6 +62,7 @@ if { [permission::write_permission_p -object_id $item(item_id)] } { set edit_url [export_vars -base [ad_conn package_url]object-edit { { item_id $item(item_id) } }] + set delete_url [export_vars -base [ad_conn package_url]object-delete { { item_id $item(item_id) } }] } 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 -N -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-create.sql 17 Oct 2003 09:22:55 -0000 1.2 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-content-types-create.sql 17 Oct 2003 09:55:53 -0000 1.3 @@ -15,6 +15,16 @@ null -- name_method ); +select content_type__create_attribute( + 'sim_character', -- content_type + 'stylesheet', -- attribute_name + 'text', -- datatype + 'Stylesheet', -- pretty_name + 'Stylesheets', -- pretty_plural + 1, -- sort_order + null, -- default_value + 'text' -- column_spec +); @@ -30,8 +40,20 @@ null -- name_method ); +select content_type__create_attribute( + 'sim_prop', -- content_type + 'stylesheet', -- attribute_name + 'text', -- datatype + 'Stylesheet', -- pretty_name + 'Stylesheets', -- pretty_plural + 1, -- sort_order + null, -- default_value + 'text' -- column_spec +); + + -- sim_home select content_type__create_type( @@ -83,13 +105,7 @@ 'text', -- datatype 'Stylesheet', -- pretty_name 'Stylesheets', -- pretty_plural - 5, -- sort_order + 4, -- sort_order null, -- default_value 'text' -- column_spec ); - - - - - - 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 -N -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/tcl/apm-callback-procs.tcl 17 Oct 2003 09:22:55 -0000 1.2 +++ openacs-4/contrib/packages/simulation/tcl/apm-callback-procs.tcl 17 Oct 2003 09:55:53 -0000 1.3 @@ -21,6 +21,7 @@ -folder_label "${instance_name} Root" \ -parent_id 0 \ -package_id $package_id \ + -context_id $package_id \ -content_types { sim_character sim_prop sim_home file_storage_object content_template }] } 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 -N -r1.5 -r1.6 --- openacs-4/contrib/packages/simulation/www/index.adp 17 Oct 2003 09:45:57 -0000 1.5 +++ openacs-4/contrib/packages/simulation/www/index.adp 17 Oct 2003 09:55:53 -0000 1.6 @@ -21,7 +21,7 @@
Index: openacs-4/contrib/packages/simulation/www/object-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/object-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/object-delete.adp 17 Oct 2003 09:55:53 -0000 1.1 @@ -0,0 +1,13 @@ + + @page_title;noquote@ + @context;noquote@ + +

Are you sure you want to delete this object?

+ +

+ » Yes, delete the object +

+ +

+ » No, cancel +

Index: openacs-4/contrib/packages/simulation/www/object-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/object-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/simulation/www/object-delete.tcl 17 Oct 2003 09:55:53 -0000 1.1 @@ -0,0 +1,20 @@ +ad_page_contract { + Delete an object. +} { + {confirm_p:boolean "f"} + item_id:integer + {return_url "object-list"} +} + +permission::require_permission -object_id $item_id -privilege write + +if { [template::util::is_true $confirm_p] } { + bcms::item::delete_item -item_id $item_id + ad_returnredirect $return_url +} + +set page_title "Delete Object" +set context [list [list "object-list" "Objects"] $page_title] + +set delete_url [export_vars -base [ad_conn url] { item_id return_url { confirm_p 1 } }] +set cancel_url $return_url 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 -N -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/object-edit.tcl 17 Oct 2003 09:22:55 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/object-edit.tcl 17 Oct 2003 09:55:53 -0000 1.4 @@ -164,7 +164,8 @@ set elm_decl "attr__${content_type}__${attribute_name}:$form_datatype($datatype)($form_widget($datatype))" set optional_p [expr ![empty_string_p $default_value] || $min_n_values == 0] - if { $optional_p } { + # LARS hack: Make extra attributes optional + if { 1 || $optional_p } { append elm_decl ",optional" } @@ -184,6 +185,8 @@ } -new_data { + permission::require_permission -privilege create -object_id [ad_conn package_id] + set existing_items [db_list select_items { select name from cr_items where parent_id = :parent_id }] if { [empty_string_p $name] } { @@ -218,6 +221,8 @@ } -edit_request { + permission::require_write_permission -object_id $item_id + foreach elm { title name description } { set $elm $content($elm) } 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 -N -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/object-list.tcl 17 Oct 2003 09:22:55 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/object-list.tcl 17 Oct 2003 09:55:54 -0000 1.4 @@ -20,8 +20,9 @@ -elements { edit { sub_class narrow + link_url_col edit_url display_template { - Edit + Edit } } object_type_pretty { @@ -37,12 +38,19 @@ label "Description" orderby r.description } + delete { + sub_class narrow + link_url_col delete_url + display_template { + Edit + } + } } set package_id [ad_conn package_id] -db_multirow -extend { edit_url view_url } objects select_objects " +db_multirow -extend { edit_url view_url delete_url } objects select_objects " select i.item_id, i.name, r.title, @@ -62,6 +70,7 @@ 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 } 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 -N -r1.3 -r1.4 --- openacs-4/packages/simulation/lib/object-display.tcl 17 Oct 2003 09:22:55 -0000 1.3 +++ openacs-4/packages/simulation/lib/object-display.tcl 17 Oct 2003 09:55:53 -0000 1.4 @@ -62,6 +62,7 @@ if { [permission::write_permission_p -object_id $item(item_id)] } { set edit_url [export_vars -base [ad_conn package_url]object-edit { { item_id $item(item_id) } }] + set delete_url [export_vars -base [ad_conn package_url]object-delete { { item_id $item(item_id) } }] } 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 -N -r1.2 -r1.3 --- openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql 17 Oct 2003 09:22:55 -0000 1.2 +++ openacs-4/packages/simulation/sql/postgresql/simulation-content-types-create.sql 17 Oct 2003 09:55:53 -0000 1.3 @@ -15,6 +15,16 @@ null -- name_method ); +select content_type__create_attribute( + 'sim_character', -- content_type + 'stylesheet', -- attribute_name + 'text', -- datatype + 'Stylesheet', -- pretty_name + 'Stylesheets', -- pretty_plural + 1, -- sort_order + null, -- default_value + 'text' -- column_spec +); @@ -30,8 +40,20 @@ null -- name_method ); +select content_type__create_attribute( + 'sim_prop', -- content_type + 'stylesheet', -- attribute_name + 'text', -- datatype + 'Stylesheet', -- pretty_name + 'Stylesheets', -- pretty_plural + 1, -- sort_order + null, -- default_value + 'text' -- column_spec +); + + -- sim_home select content_type__create_type( @@ -83,13 +105,7 @@ 'text', -- datatype 'Stylesheet', -- pretty_name 'Stylesheets', -- pretty_plural - 5, -- sort_order + 4, -- sort_order null, -- default_value 'text' -- column_spec ); - - - - - - 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 -N -r1.2 -r1.3 --- openacs-4/packages/simulation/tcl/apm-callback-procs.tcl 17 Oct 2003 09:22:55 -0000 1.2 +++ openacs-4/packages/simulation/tcl/apm-callback-procs.tcl 17 Oct 2003 09:55:53 -0000 1.3 @@ -21,6 +21,7 @@ -folder_label "${instance_name} Root" \ -parent_id 0 \ -package_id $package_id \ + -context_id $package_id \ -content_types { sim_character sim_prop sim_home file_storage_object content_template }] } Index: openacs-4/packages/simulation/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/index.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/simulation/www/index.adp 17 Oct 2003 09:45:57 -0000 1.5 +++ openacs-4/packages/simulation/www/index.adp 17 Oct 2003 09:55:53 -0000 1.6 @@ -21,7 +21,7 @@
Index: openacs-4/packages/simulation/www/object-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/object-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/object-delete.adp 17 Oct 2003 09:55:53 -0000 1.1 @@ -0,0 +1,13 @@ + + @page_title;noquote@ + @context;noquote@ + +

Are you sure you want to delete this object?

+ +

+ » Yes, delete the object +

+ +

+ » No, cancel +

Index: openacs-4/packages/simulation/www/object-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/object-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/simulation/www/object-delete.tcl 17 Oct 2003 09:55:53 -0000 1.1 @@ -0,0 +1,20 @@ +ad_page_contract { + Delete an object. +} { + {confirm_p:boolean "f"} + item_id:integer + {return_url "object-list"} +} + +permission::require_permission -object_id $item_id -privilege write + +if { [template::util::is_true $confirm_p] } { + bcms::item::delete_item -item_id $item_id + ad_returnredirect $return_url +} + +set page_title "Delete Object" +set context [list [list "object-list" "Objects"] $page_title] + +set delete_url [export_vars -base [ad_conn url] { item_id return_url { confirm_p 1 } }] +set cancel_url $return_url 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 -N -r1.3 -r1.4 --- openacs-4/packages/simulation/www/object-edit.tcl 17 Oct 2003 09:22:55 -0000 1.3 +++ openacs-4/packages/simulation/www/object-edit.tcl 17 Oct 2003 09:55:53 -0000 1.4 @@ -164,7 +164,8 @@ set elm_decl "attr__${content_type}__${attribute_name}:$form_datatype($datatype)($form_widget($datatype))" set optional_p [expr ![empty_string_p $default_value] || $min_n_values == 0] - if { $optional_p } { + # LARS hack: Make extra attributes optional + if { 1 || $optional_p } { append elm_decl ",optional" } @@ -184,6 +185,8 @@ } -new_data { + permission::require_permission -privilege create -object_id [ad_conn package_id] + set existing_items [db_list select_items { select name from cr_items where parent_id = :parent_id }] if { [empty_string_p $name] } { @@ -218,6 +221,8 @@ } -edit_request { + permission::require_write_permission -object_id $item_id + foreach elm { title name description } { set $elm $content($elm) } 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 -N -r1.3 -r1.4 --- openacs-4/packages/simulation/www/object-list.tcl 17 Oct 2003 09:22:55 -0000 1.3 +++ openacs-4/packages/simulation/www/object-list.tcl 17 Oct 2003 09:55:54 -0000 1.4 @@ -20,8 +20,9 @@ -elements { edit { sub_class narrow + link_url_col edit_url display_template { - Edit + Edit } } object_type_pretty { @@ -37,12 +38,19 @@ label "Description" orderby r.description } + delete { + sub_class narrow + link_url_col delete_url + display_template { + Edit + } + } } set package_id [ad_conn package_id] -db_multirow -extend { edit_url view_url } objects select_objects " +db_multirow -extend { edit_url view_url delete_url } objects select_objects " select i.item_id, i.name, r.title, @@ -62,6 +70,7 @@ 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 }