extended by Nima Mazloumi
OpenACS docs are written by the named authors, and may be edited
by OpenACS documentation staff.
You can associate any ACS Object with one or more categories.
@@ -38,7 +38,7 @@
/var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www/admin/index.adp
file:
- <a href="@category_map_url@"<#categories.Site_wide_Categories#</a>
+ <a href="@category_map_url@">#categories.Site_wide_Categories#</a>
The link created by the above code (category_map_url
)
will take the admin to the generic
admin UI where he can pick category trees that make sense for this
@@ -62,8 +62,8 @@
To achieve this we'll need to use the -extend
switch to the ad_form
command. Here's the "meat" of the
note-edit.tcl
page:
- #extend the form to support categories
- set package_id [ad_conn package_id]
+ # extend the form to support categories
+ set package_id [ad_conn package_id]
category::ad_form::add_widgets -form_name note -container_object_id $package_id -categorized_object_id [value_if_exists item_id]
@@ -113,7 +113,8 @@
select samplenote__name(:note_id)
</querytext>
</fullquery>
-</queryset>
And the adp page:
[$OPENACS_SERVICE_NAME@yourserver www]$ emacs note-delete.adp
<master>
+</queryset>
And the adp page:
[$OPENACS_SERVICE_NAME@yourserver www]$ emacs note-delete.adp
+<master>
<property name="title">@title@</property>
<property name="context">{@title@}</property>
<h2>@title@</h2>
@@ -132,7 +133,7 @@
Change your to this:
<a href=configure?<%=[export_vars -url {return_url}]%>>Configure</a>
<if @use_categories_p@>
- <a href="@category_map_url@"<#categories.Site_wide_Categories#</a>
+ <a href="@category_map_url@">#categories.Site_wide_Categories#</a>
</if>
Now create a configure page
ad_page_contract {
@@ -260,11 +261,10 @@
<a href="@package_url@view?@YOURPARAMS@">All Items</if>
Finally you need a an index.vuh
in your
www folder to rewrite the URLs correctly, the section called “Using .vuh files for pretty urls”:
- set url /[ad_conn extra_url]
+ set url /[ad_conn extra_url]
- if {[regexp {^/+cat/+([^/]+)/*} $url \
- ignore_whole category_id]} {
- rp_form_put category_id $category_id
- }
- rp_internal_redirect "/packages/YOURPACKAGE/www/index"
-
Now when ever the user select a category only notes that belong to this category are displayed.