development and customization of openacs. openacs package architecture functionality is divided into...

51
Development and Customization of OpenACS

Upload: kevin-morton

Post on 02-Jan-2016

234 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Development and Customization of OpenACS

Page 2: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

OpenACS Package Architecture

• Functionality is divided into packages

• One package contains

• Data Model

• Tcl Libraries

• User interface pages and templates

Page 3: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

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

Page 4: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Object Types

• Type hierarchy

• Attributes

• Type specific database table

Page 5: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Kernel Database Schema

Page 6: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

User Model and Authentication

• Parties

• Users

• Groups

• Relationship Types

• Relational Segments

• Privileges

• Permissions

Page 7: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries
Page 8: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Permissions Hierarchy

Admin

Read Create Write Delete

Page 9: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Reporting Bugs

• http://openacs.org/bugtracker/openacs/

Page 10: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Writing a bug report

• Steps to Reproduce

• 1. Browse to http://...

• 2. do ...

• Actual Results

• Expected Result

Page 11: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

More information

• http://openacs.org/bugtracker/openacs/bug-submission-instructions

Page 12: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Submitting Patchs

• http://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

Page 13: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Further Documentation

• http://openacs.org/doc/current/

• http://openacs.org/doc/current/acs-admin.html

• http://openacs.org/doc/current/tutorial.html

Page 14: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

More Documentation

• http://openacs.org/api-doc/

• http://tcl.tk/man/tcl8.4/TclCmd/contents.htm

• http://philip.greenspun.com/tcl/

• http://aolserver.com/docs/devel/tcl/api/

• http://www.postgresql.org/docs/7.4/static/index.html

Page 15: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Programming in Tcl

• Each line of Tcl is interpreted as a seperate command

procedure_name arg1 arg2 arg3

Page 16: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Programming in Tcl

• one command per line

• can continue a command on multiple lines with backslash

Page 17: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Strings

set foo bar

set foo “bar”

set foo {bar}

set foo [bar]

set foo $bar

set foo {$bar}

set foo {[bar]}

Page 18: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

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

Page 19: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

String Commands

• String commands are usually faster than regexp and regsub

• string match

• string map

• string equal

• append

Page 20: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

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

Page 21: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Lists

• lsearch

• lrange

Page 22: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

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

Page 23: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Procedures

• OpenACS ad_proc

• Named parameters

• Default values

• Documentation (@author @param @return @see)

Page 24: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

ad_proc

ad_proc –public note::new {

-note_id

-name:required

-content:required

{-creation_user “”}

{-creation_ip “”}

{-creation_date “”}

} {

… code goes here …

}

Page 25: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Tcl Documentation

• Tcl for Web Nerds (good overview, slightly out of date)

• Tcl Man pages

Page 26: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Creating a Tcl script

set my_var [ad_conn user_id]

Page 27: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Creating an ADP Template

<master>

@myvar@

Page 28: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Query the database

db_1row get_user \“select * from cc_users where user_id=:user_id” \-column_array user

Page 29: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Bind Vars

select * from cc_users where user_id=:user_id• Prevents SQL injection

Page 30: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Results in ADP

<master>

Name: @user.first_names@ @user.last_names@ <br />@user.email@

Page 31: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Multirow datasource

db_multirow users get_users \ “select * from cc_users limit 10”

Page 32: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Muliple Tag

<master>

<multiple name=”stuff”>@users.first_names@ @users.last_name@ <br /></multiple>

Page 33: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Retreiving Query Vars

ad_page_contract {

doc} {foo_id:integer,notnull{return_url “”}}

Page 34: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

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”

Page 35: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Granting permissions

permission::grant \

-party_id $party_id \

-object_id $object_id \

-privilege “admin”

Page 36: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

ad_form/formtemplate

• Form processing

• Double-click protection

• Input validation

• Allows in-form error messages

• Form style seperated from form processing

Page 37: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

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)”

}

Page 38: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

formtemplate

<formtemplate id=“form-name”></formtemplate>

Page 39: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

More on Forms

• http://openacs.org/api-doc/proc-view?proc=ad%5fform

• http://openacs.org/doc/acs-templating/developer-guide.html

Page 40: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Template List

• Manage lists of information

• Integrated with multirow datasource

• Sorting, bulk actions, filtering

Page 41: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries
Page 43: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries
Page 44: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Centralized Services

• Comments

• Notifications

• Search

• Clipboard (new)

• RSS Support

• Categories

Page 45: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

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

Page 46: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Notifications

• Sends email notifications

• Usually when an acs_object is created or modified

• Messages are specific for an object type

• Instant or batch email

• One page to manage all notifications

Page 47: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Forums Notifications Example

• Can receive notifications on entire forum, or just replies to one posting

Page 48: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Search

• Search can be enabled for any object type

• Each object type submits specific data to the indexer

Page 49: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Clipboard

• Reference to clipboard enabled objects are saved on clipboard

• Saved objects can be acted on, marked at related to other objects

Page 50: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

RSS Support

• Any object type can be enabled to output RSS information

• Weblog, News, File-storage

Page 51: Development and Customization of OpenACS. OpenACS Package Architecture Functionality is divided into packages One package contains Data Model Tcl Libraries

Categories

• Sitewide or package specific

• Objects can be assigned one or many categories