Development and Customization of OpenACS
OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries User interface pages and templates
acs_objects universally unique id any interesting “item” is an object anything that has its own URL is an object can assign permissions on objects allows general services such as search, comments, notifications Extensible data models
Object Types Type hierarchy Attributes Type specific database table
Kernel Database Schema
User Model and Authentication Parties Users Groups Relationship Types Relational Segments Privileges Permissions
Permissions Hierarchy Admin ReadCreateWriteDelete
Reporting Bugs
Writing a bug report Steps to Reproduce 1. Browse to 2. do... Actual Results Expected Result
More information submission-instructions
Submitting Patchs submission-instructions.htmlhttp://openacs.org/bugtracker/openacs/patch- submission-instructions.html Best CVS diff from checkout cvs diff -Nu package-directory > patch-file diff -u package-dir/.../old-file package-dir/.../new- file > patch-file CVS diffs are easier to apply back to OpenACS
Further Documentation admin.htmlhttp://openacs.org/doc/current/acs- admin.html
More Documentation dex.htmlhttp:// dex.html
Programming in Tcl Each line of Tcl is interpreted as a seperate command procedure_name arg1 arg2 arg3
Programming in Tcl one command per line can continue a command on multiple lines with backslash
Strings set foo bar set foo “bar” set foo {bar} set foo [bar] set foo $bar set foo {$bar} set foo {[bar]}
Strings strings without whitespace don't require quotes strings with whitespace require quotes or curly braces contents of strings defines with quotes are evaluated contents of strings defined with curly braces are not evaluated
String Commands String commands are usually faster than regexp and regsub string match string map string equal append
Lists a list holds a sequence of elements elements can be a number, string, or another list set foo [list one two three] lappend foo “four” lindex $foo 1 llength $foo
Lists lsearch lrange
Arrays array set foo [list key1 value1 key2 value2] keys can be any string set bar $foo(key1) set baz “key2” set bar $foo($key2) array get foo
Procedures OpenACS ad_proc Named parameters Default @see)
ad_proc ad_proc –public note::new { -note_id -name:required -content:required {-creation_user “”} {-creation_ip “”} {-creation_date “”} } { … code goes here … }
Tcl Documentation Tcl for Web Nerds (good overview, slightly out of date) Tcl Man pages
Creating a Tcl script set my_var [ad_conn user_id]
Creating an ADP Template
Query the database db_1row get_user \ “select * from cc_users where user_id=:user_id” \ -column_array user
Bind Vars select * from cc_users where user_id=:user_id Prevents SQL injection
Results in ADP Name:
Multirow datasource db_multirow users get_users \ “select * from cc_users limit 10”
Muliple Tag
Retreiving Query Vars ad_page_contract { doc } { foo_id:integer,notnull {return_url “”} }
Users and permissions set user_id [ad_conn user_id] set package_id [ad_conn package_id] permission::require_permission \ - party_id $user_id \ -object_id $package_id \ -privilege “read”
Granting permissions permission::grant \ -party_id $party_id \ -object_id $object_id \ -privilege “admin”
ad_form/formtemplate Form processing Double-click protection Input validation Allows in-form error messages Form style seperated from form processing
ad_form ad_form \ form-name -form { object_id:key name:text(text) { label “Enter Name” } } –on_sumbit { db_dml add_name “insert into names (name) values (:name)” }
formtemplate
More on Forms view?proc=ad%5fformhttp://openacs.org/api-doc/proc- view?proc=ad%5fform templating/developer-guide.htmlhttp://openacs.org/doc/acs- templating/developer-guide.html
Template List Manage lists of information Integrated with multirow datasource Sorting, bulk actions, filtering
External Authentication ns_ldap AOLserver module nsldaphttp://home.galileo.edu/~obonilla/software/ nsldap acs-authentication package auth-ldap package authentication/ authentication/
Centralized Services Comments Notifications Search Clipboard (new) RSS Support Categories
General Comments Allows comments to be attached to any acs_object Optionally allows files to be uploaded with a comment Centralized user interface to approve or reject comments sitewide
Notifications Sends notifications Usually when an acs_object is created or modified Messages are specific for an object type Instant or batch One page to manage all notifications
Forums Notifications Example Can receive notifications on entire forum, or just replies to one posting
Search Search can be enabled for any object type Each object type submits specific data to the indexer
Clipboard Reference to clipboard enabled objects are saved on clipboard Saved objects can be acted on, marked at related to other objects
RSS Support Any object type can be enabled to output RSS information Weblog, News, File-storage
Categories Sitewide or package specific Objects can be assigned one or many categories