Index: openacs-4/packages/acs-core-docs/www/tutorial-categories.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-categories.html,v diff -u -r1.17.2.2 -r1.17.2.3 --- openacs-4/packages/acs-core-docs/www/tutorial-categories.html 29 Nov 2019 14:28:48 -0000 1.17.2.2 +++ openacs-4/packages/acs-core-docs/www/tutorial-categories.html 8 Apr 2021 15:44:06 -0000 1.17.2.3 @@ -72,24 +72,16 @@ } -new_data { .... category::map_object -remove_old -object_id $item_id $category_ids - db_dml insert_asc_named_object "insert into acs_named_objects (object_id, object_name, package_id) values ( :item_id, :title, :package_id)" } -edit_data { .... - db_dml update_asc_named_object "update acs_named_objects set object_name = :title, package_id = :package_id where object_id = :item_id" category::map_object -remove_old -object_id $item_id $category_ids } -after_submit { ad_returnredirect "." ad_script_abort }
While the category::ad_form::add_widgets
proc is taking
care to extend your form with associated categories you need to ensure that your items are mapped
- to the corresponding category object yourself. Also since the categories package knows nothing from
- your objects you have to keep the acs_named_objects
table updated with
- any changes taking place. We use the items title so that they are listed in the categories browser by
- title.
Make sure that you also delete these entries if your item is delete. Add this to - your corresponding delete page:
- db_dml delete_named_object "delete from acs_named_objects where object_id = :item_id" -
note-edit.tcl
requires a
+ to the corresponding category object yourself.
note-edit.tcl
requires a
note_id
to determine which record
should be deleted. It also looks for a confirmation variable, which
should initially be absert. If it is absent, we create a form to
@@ -199,11 +191,8 @@
if { $use_categories_p == 1 && $category_id ne "" } {
- set from_clause "category_object_map com, acs_named_objects ano"
- set_where_clause "com.object_id = qa.entry_id and
- ano.package_id = :package_id and
- com.object_id = ano.object_id and
- com.category_id = :category_id"
+ set from_clause "category_object_map com"
+ set_where_clause "com.object_id = qa.entry_id and category_id = :category_id"
...