OpenACS tips

Contents

Number of rows in a multiple

<if @sections:rowcount@ eq 0> add a section </if>

Adding privileges

begin acs_privilege.create_privilege('survsimp_create_section'); acs_privilege.create_privilege('survsimp_modify_section'); acs_privilege.create_privilege('survsimp_delete_section'); acs_privilege.add_child('admin','survsimp_create_section'); acs_privilege.add_child('admin','survsimp_modify_section'); acs_privilege.add_child('admin','survsimp_delete_section'); end; commit;

This creates "create","modify" and "delete" privileges for the simple survey module, and makes them child privileges of the "admin" privilege (site wide admin). Normally you'd have another layer of privileges called "survsimp_admin", etc. under the top level admin. Don't forget to commit!

To check for a privilege, put something like this at the top of the Tcl for your page:

# bounce the user if they don't have permission to create a section ad_require_permission $package_id survsimp_create_section

Using CVS

Checkout the entire OpenACS tree

It's quite big so will take some time.

cvs -z6 -d :pserver:anonymous@openacs.org:/cvsroot co -r oacs-5-1 openacs-4

Checkout just the OpenACS core

If you just want the core packages, use:

cvs -z6 -d :pserver:anonymous@openacs.org:/cvsroot co -r oacs-5-1 checkout acs-core

Checkout a package

Use the package key. There is a complete list of packages at the package repository, but for some reason this doesn't have the keys, so perhaps better to browse CVS. For example, to get calendar:

cvs -z6 -d :pserver:anonymous@openacs.org:/cvsroot co -r oacs-5-1 calendar

Note: all the above use the stable 5.1 branch. To get the latest (possibly unstable) version, leave out "-r oacs-5-1".

Checkout a package in contrib

There are lots of useful OpenACS packages in /contrib. You can look at the contents of this folder using the CVS browser. To grab the latest version (for example, of mailing-lists), use the following command:

cvs -z6 -d :pserver:anonymous@openacs.org:/cvsroot co openacs-4/contrib/packages/mailing-lists

Note that openacs-4 refers to a directory name and contains all the code for OpenACS version 4 upwards.