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 -N -r1.14.2.4 -r1.14.2.5 --- openacs-4/packages/acs-core-docs/www/tutorial-categories.html 9 Jun 2016 08:44:50 -0000 1.14.2.4 +++ openacs-4/packages/acs-core-docs/www/tutorial-categories.html 10 Jun 2016 07:35:08 -0000 1.14.2.5 @@ -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" 	  
+	  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.

View comments on this page at openacs.org