Advanced Topics

Important

This section is a work in progress.

by Joel Aufrecht
OpenACS docs are written by the named authors, but may be edited by OpenACS documentation staff.

Overview

This tutorial covers topics which are not essential to creating a minimal working package. Each section can be used independently of all of the others; all sections assume that you've completed the basic tutorial.

  • How to enforce security so that users can't change other users records

  • How to use the content management tables so that ... what?

  • How to make your package searchable with OpenFTS/Oracle

  • How to make your package send email notifications

  • How to prepare pagelets for inclusion in other pages

  • How and when to put procedures in a tcl procedure library

  • How to add general_comments to your pages

  • More on ad_form - data validation, other stuff. (plan to draw from Jon Griffin's doc)

  • How and when to implement caching

  • partialquery in xql

  • How to use the html/text entry widget to get the "does this look right" confirm page

  • APM package dependencies

General_comments

You can track comments for any ACS Object. Here we'll track comments for notes. On the notes.tcl/adp pair, which is used to display individual notes, we want to put a link to add comments at the bottom of the screen. If there are any comments, we want to show them.

First, we need to generate a url for adding comments. In notes.tcl:

set comment_add_url "[general_comments_package_url]comment-add?[export_vars {
 { object_id $note_id } 
 { object_name $title } 
 { return_url "[ad_conn url]?[ad_conn query]"} 
}]"

This calls a global, public tcl function that the general_comments package registered, to get its url. You then embed in that url the id of the note and its title, and set the return_url to the current url so that the user can return after adding a comment.

Now we need to create html that shows any existing comments. We do this with another general_comments function:

set comments_html [general_comments_get_comments
    -print_content_p 1 $note_id]

First, we pass in an optional parameter that that says to actually show the contents of the comments, instead of just the fact that there are comments. Then you pass the note id, which is also the acs_object id.

Now we put our two new variables in the notes.adp page.

<a href="@comment_add_url@">Add a comment</a>
@comments_html@

Prepare the package for distribution.

Browse to the package manager. Click on tutorialapp.

Click on Generate a distribution file for this package from the filesystem.

Click on the file size (37.1KB) after the label Distribution File: and save the file to /tmp.

View comments on this page at openacs.org