Index: openacs-4/packages/acs-core-docs/www/tutorial-advanced.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-advanced.html,v diff -u -r1.1.2.6 -r1.1.2.7 --- openacs-4/packages/acs-core-docs/www/tutorial-advanced.html 4 May 2003 06:30:03 -0000 1.1.2.6 +++ openacs-4/packages/acs-core-docs/www/tutorial-advanced.html 7 May 2003 17:40:59 -0000 1.1.2.7 @@ -1,18 +1,18 @@ -
This section is a work in progress.
+
This section is a work in progress.
by Joel Aufrecht
OpenACS docs are written by the named authors, and may be edited
by OpenACS documentation staff.
-
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 change the default stylesheets for Form Builder HTML forms.
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
We need a way to delete records. We'll create a - recursive confirmation page.
Add this column to the table_def in index.tcl
{delete "" {} {<td><a href="note-delete?note_id=$note_id">Delete</a></td>}}
Create the delete confirmation/execution page.
[service0@yourserver www]$ emacs note-delete.tcl
ad_page_contract { + "does this look right" confirm page
APM package dependencies
We need a way to delete records. We'll create a + recursive confirmation page.
Add this column to the table_def in index.tcl
{delete "" {} {<td><a href="note-delete?note_id=$note_id">Delete</a></td>}}
Create the delete confirmation/execution page.
[service0@yourserver www]$ emacs note-delete.tcl
ad_page_contract { A page that gets confirmation and then delete notes. @author joel@aufrecht.org @@ -41,18 +41,18 @@ ad_returnredirect "index" ad_script_abort }
This page requires a -note_id to determine which record +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 allow the user to confirm the deletion. Note that in -entry-edit.tcl we used ad_form to access the Form Template +entry-edit.tcl we used ad_form to access the Form Template commands; here, we call them directly because we don't need the extra features of ad_form. The form calls itself, but with hidden variables carrying both -note_id and -confirm_p. If confirm_p is present, +note_id and +confirm_p. If confirm_p is present, we delete the record, set redirection back to the index, and abort -script execution.
The database commands:
[service0@yourserver www]$ emacs note-delete.xql
<?xml version="1.0"?> +script execution.The database commands:
[service0@yourserver www]$ emacs note-delete.xql<?xml version="1.0"?> <queryset> <fullquery name="do_delete"> <querytext> @@ -64,14 +64,14 @@ select samplenote__name(:note_id) </querytext> </fullquery> -</queryset>And the adp page:
[service0@yourserver www]$ emacs note-delete.adp<master> +</queryset>And the adp page:
[service0@yourserver www]$ emacs note-delete.adp<master> <property name="title">@title@</property> <property name="context">{@title@}</property> <h2>@title@</h2> <formtemplate id="note-del-confirm"></formtemplate> </form>The ADP is very simple. The -formtemplate tag outputs the HTML -form generated by the ad_form command with the matching name. Test it by adding the new files in the APM and then deleting a few samplenotes.
You can track comments for any ACS Object. Here we'll track +formtemplate tag outputs the HTML +form generated by the ad_form command with the matching name. Test it by adding the new files in the APM and then deleting a few samplenotes.
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 @@ -92,13 +92,13 @@ there are comments. Then you pass the note id, which is also the acs_object id.
We put our two new variables in the notes.adp page.
<a href="@comment_add_url@">Add a comment</a> -@comments_html@
Browse to the package manager. Click on - tutorialapp.
Click on Generate a distribution file +@comments_html@
Browse to the package manager. Click on + tutorialapp.
Click on Generate a distribution file for this package from the - filesystem. + filesystem.
Click on the file size - (37.1KB) - after the label Distribution - File: and save the file to - /tmp.
+ (37.1KB) + after the label Distribution + File: and save the file to + /tmp.