0.00%
Search · Index

Weblog Page

Showing 1 - 10 of 230 Postings (summary)

Creating Web Pages

Created by Joel Aufrecht, last modified by Gustaf Neumann 02 May 2020, at 12:58 PM

As a workaround for missing content-repository functionality, copy a provided file into the directory for tcl files:
cp /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-core-docs/www/files/note-procs.tcl /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/tcl/

To make this file take effect, go to the APM and choose "Reload changed" for "MyFirstPackage".

Our package will have two visible pages. The first shows a list of all objects; the second shows a single object in view or edit mode, and can also be used to add an object. The index page will display the list, but since we might reuse the list later, we'll put it in a seperate file and include it on the index page.

Figure 9.5. Page Map

tutorial-page-map.png

Each user-visible page in your package has, typically, three parts. The tcl file holds the procedural logic for the page, including TCL and database-independent SQL code, and does things like check permissions, invoke the database queries, and modify variables, and the adp page holds html. The -postgres.xql and -oracle.xql files contains database-specific SQL. The default page in any directory is index, so we'll build that first, starting with the tcl file:

[$OPENACS_SERVICE_NAME postgresql]$ cd /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackages/www
[$OPENACS_SERVICE_NAME www]$ emacs index.tcl

Paste this into the file.

ad_page_contract {
    This is the main page for the package.  It displays all of the Notes and provides links to edit them and to create new Notes.

    @author Your Name (you@example.com)
    @cvs-id $Id: tutorial-pages.html,v 1.37 2006/07/17 05:38:32 torbenb Exp $
}

set page_title [ad_conn instance_name]
set context [list]

Now index.adp:

<master>
  <property name="title">@page_title;noquote@</property>
  <property name="context">@context;noquote@</property>
<include src="/packages/myfirstpackage/lib/note-list">

You can test your work by viewing the page /myfirstpackage on your installation.

The index page includes the list page, which we put in /lib instead of /www to designate that it's available for reuse by other packages.

[$OPENACS_SERVICE_NAME www]$ mkdir /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/lib
[$OPENACS_SERVICE_NAME www]$ cd /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/lib
[$OPENACS_SERVICE_NAME lib]$ emacs note-list.tcl
template::list::create \
    -name notes \
    -multirow notes \
    -actions { "Add a Note" note-edit} \
    -elements {
	edit {
	    link_url_col edit_url
	    display_template {
		<img src="/resources/acs-subsite/Edit16.gif" width="16" height="16" border="0">
	    }
	    sub_class narrow
	}
	title {
	    label "Title"
	}
	delete {
	    link_url_col delete_url 
	    display_template {
		<img src="/resources/acs-subsite/Delete16.gif" width="16" height="16" border="0">
	    }
	    sub_class narrow
	}
    }

db_multirow \
    -extend {
	edit_url
	delete_url
    } notes notes_select {
	select ci.item_id,
	       n.title
        from   cr_items ci,
               mfp_notesx n
        where  n.revision_id = ci.live_revision
    } {
	set edit_url [export_vars -base "note-edit" {item_id}]
	set delete_url [export_vars -base "note-delete" {item_id}]
    }
[$OPENACS_SERVICE_NAME lib]$ emacs note-list.adp
<listtemplate name="notes"></listtemplate>

Create the add/edit page. If note_id is passed in, it display that note, and can change to edit mode if appropriate. Otherwise, it presents a form for adding notes.

[$OPENACS_SERVICE_NAME lib]$ cd /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www
[$OPENACS_SERVICE_NAME www]$ emacs note-edit.tcl
ad_page_contract {
    This is the view-edit page for notes.

    @author Your Name (you@example.com)
    @cvs-id $Id: tutorial-pages.html,v 1.37 2006/07/17 05:38:32 torbenb Exp $
 
    @param item_id If present, assume we are editing that note.  Otherwise, we are creating a new note.
} {
    item_id:integer,optional
}

ad_form -name note -form {
    {item_id:key}
    {title:text {label Title}}
} -new_request {
    auth::require_login
    permission::require_permission -object_id [ad_conn package_id] -privilege create
    set page_title "Add a Note"
    set context [list $page_title]
} -edit_request {
    auth::require_login
    permission::require_write_permission -object_id $item_id
    mfp::note::get \
	-item_id $item_id \
	-array note_array 

    set title $note_array(title)

    set page_title "Edit a Note"
    set context [list $page_title]
} -new_data {
    mfp::note::add \
	-title $title
} -edit_data {
    mfp::note::edit \
	-item_id $item_id \
	-title $title
} -after_submit {
    ad_returnredirect "."
    ad_script_abort
}
[$OPENACS_SERVICE_NAME www]$ emacs note-edit.adp
<master>
  <property name="title">@page_title;noquote@</property>
  <property name="context">@context;noquote@</property>
  <property name="focus">note.title</property>
  
<formtemplate id="note"></formtemplate>

And the delete page. Since it has no UI, there is only a tcl page, and no adp page.

[$OPENACS_SERVICE_NAME www]$ emacs note-delete.tcl
ad_page_contract {
    This deletes a note

    @author Your Name (you@example.com)
    @cvs-id $Id: tutorial-pages.html,v 1.37 2006/07/17 05:38:32 torbenb Exp $
 
    @param item_id The item_id of the note to delete
} {
    item_id:integer
}

permission::require_write_permission -object_id $item_id
set title [item::get_title $item_id]
mfp::note::delete -item_id $item_id

ad_returnredirect "."
# stop running this code, since we're redirecting
abort

How Do I?

Created by Malte Sussdorff, last modified by Gustaf Neumann 02 May 2020, at 12:57 PM

The easiest way is to install the Edit-This-Page package.

  1. Log in to the web site as an administrator.

  2. Click on Admin > Install Software > Install from OpenACS Repository / Install new application

  3. Choose Edit This Page and install

  4. Follow the instructions within Edit This Page (the link will only work after Edit This Page is installed).

Go to /admin/permissions and grant Create to Registered Users

Suppose you install a new site and install Weblogger, and you want all visitors to see weblogger automatically.

  1. On the front page, click the Admin button.

  2. On the administration page, click Parameters link.

  3. Change the parameter IndexRedirectUrl to be the URI of the desired application. For a default weblogger installation, this would be weblogger/. Note the trailing slash.

Every page within an OpenACS site is part of a subsiteMore information). The home page of the entire site is the front page is a special, default instance of a subsite, served from /var/lib/aolserver/$OPENACS_SERVICE_NAME/www. If an index page is not found there, the default index page for all subsites is used. To customize the code on the front page, copy the default index page from the Subsite package to the Main site and edit it:

  1. cp /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-subsite/www/index*/var/lib/aolserver/$OPENACS_SERVICE_NAME/www
    
  2. Edit the new index.adp to change the text; you shouldn't need to edit index.tcl unless you are adding new functionality.

Almost all pages on an OpenACS site use ACS Templating, and so their appearance is driven by a layer of different files. Let's examine how this works:

  • A templated page uses an ADP/TCL pair. The first line in the ADP file is usually:

    <master>

    If it appears exactly like this, without any arguments, the template processer uses default-master for that subsite. For pages in /var/lib/aolserver/$OPENACS_SERVICE_NAME/www, this is /var/lib/aolserver/$OPENACS_SERVICE_NAME/www/default-master.adp and the associated .tcl file.

  • The default-master is itself a normal ADP page. It draws the subsite navigation elements and invokes site-master (/var/lib/aolserver/$OPENACS_SERVICE_NAME/www/site-master.adp and .tcl)

  • The site-master draws site-wide navigation elements and invokes blank-master (/var/lib/aolserver/$OPENACS_SERVICE_NAME/www/blank-master.adp and .tcl).

  • Blank-master does HTML housekeeping and provides a framework for special sitewide navigation "meta" elements such as Translator widgets and Admin widgets.

Figure4.1.Site Templates

Site Templates

  • Steps to Reproduce.The events package does not allow users to register for new events.

    1. Go to the http://yourserver.net/events as a visitor (ie, log out and, if necessary, clear cookies). This in on a 4.6.3 site with events version 0.1d3.

    2. Select an available event

    3. A link such as Registration: Deadline is 03/15/2004 10:00am. » Login or sign up to register for this event. is visible. Click on "Login or sign up"

    4. Complete a new registration. Afterwards, you should be redirected back to the same page.

    Actual Results: The page says "You do not have permission to register for this event."

    Expected results: A link or form to sign up for the event is shown.

  • Finding the problem.We start with the page that has the error. In the URL it's http://myserver.net/events/event-info.tcl, so open the file /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/events/www/event-info.tcl. It contains this line:

    set can_register_p [events::security::can_register_for_event_p -event_id $event_id]

    We need to know what that procedure does, so go to /api-doc, paste events::security::can_register_for_event_p into the ACS Tcl API Search box, and click Feeling Lucky. The next pages shows the proc, and we click "show source" to see more information. The body of the proc is simply

    return [permission::permission_p -party_id $user_id -object_id $event_id -privilege write]

    This means that a given user must have the write privilige on the event in order to register. Let's assume that the priviliges inherit, so that if a user has the write privilige on the whole package, they will have the write privilege on the event.

  • Setting Permissions.A permission has three parts: the privilige, the object of the privilige, and the subject being granted the privilige. In this case the privilige is "write," the object is the Events package, and the subject is all Registered Users.

    1. To grant permissions on a package, start at the site map. Find the event package and click "Set permissions".

    2. Click "Grant Permission"

    3. Grant the write permission to Registered Users.

      Figure4.2.Granting Permissions

      Granting Permissions

    OpenACS 5.0 offers a prettier version at /admin/applications.

    Figure4.3.Granting Permissions in 5.0

    Granting Permissions in 5.0

Quick Install of OpenACS

Created by Malte Sussdorff, last modified by Gustaf Neumann 29 Sep 2019, at 10:19 AM

Setup user

Especially for incoming e-mail, each webserver should run with it's own user. We are going to use the service name "service0" throughout this script to denote a couple of things needed to run your webserver "www.service0.com": 

  • username to run the service
  • username in the database
  • database name in postgresql
  • service name for aolserver

First add the unix user:

export SERVICE0=service0
sudo useradd $SERVICE0
sudo mkdir /var/lib/aolserver/$SERVICE0/
sudo chown -R $SERVICE0.web /var/lib/aolserver/$SERVICE0
sudo usermod -g web $SERVICE0
sudo usermod -d /var/lib/aolserver/$SERVICE0 $SERVICE0

Now it is time to prepare the database for the OpenACS System:

PostgreSQL 

Make sure to have PostgreSQL installed 

/usr/local/pgsql/bin/createuser -s $SERVICE0 -U postgres
/usr/local/pgsql/bin/createdb -E UNICODE -U $SERVICE0 $SERVICE0

Oracle

Make sure to have Oracle installed 

sqlplus system@XE
SQL> create tablespace $SERVICE0
datafile '/usr/lib/oracle/xe/oradata/XE/$SERVICE0.dbf'
size 50M
autoextend on;

SQL> create user $OPENACS_SERVICE_NAME identified by password default tablespace $OPENACS_SERVICE_NAME
SQL> grant connect, resource, ctxapp, javasyspriv, query rewrite to questaims;
SQL> revoke unlimited tablespace from questaims;
SQL> alter user questaims quota unlimited on questaims;
SQL> exit;

After the user is setup, login as this user and get the source files. Furthermore configure the config file.

 sudo su - $SERVICE0 

If you do this directly from OpenACS you can run:

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

mv openacs-4/* . 

If you want to use SVN you can run

svn co https://svn.cognovis.de/openacs/branches/oacs-5-3 .

If you are working within cognovis and start a new client project do the following

export REPOS=https://svn.cognovis.de/
svn mkdir $REPOS/$SERVICE0 $REPOS/$SERVICE0 $REPOS/$SERVICE0/branches $REPOS/$SERVICE0/tags -m "Creating clientname directory structure"
svn copy $REPOS/openacs/branches/oacs-5-3 $REPOS/$SERVICE0/trunk
svn co $REPOS/$SERVICE0/trunk .
Now you have your checkout, time to configure

cp etc/config.tcl etc/`whoami`.tcl perl -pi*.bak -e "s/service0/`whoami`/g" etc/`whoami`.tcl perl -pi*.bak -e "s/service0/`whoami`/g" etc/daemontools/run perl -pi*.bak -e "s/config/`whoami`/g" etc/daemontools/run

This will get the latest openacs from the current release branch into your service name. If you need certain packages to come from HEAD you can still update them later.

As root make sure the system is under daemontools control:

# Logout to become root again exit sudo ln -s /var/lib/aolserver/$SERVICE0/etc/daemontools /service/$SERVICE0 sudo svgroup web /service/*


You are now configured to start your OpenACS installation on http://127.0.0.1:8000 unless some other server has been running there.

If you want to install .LRN issue the following command:

su - $SERVICE0
cp packages/dotlrn/install.xml .
svc -du /service/`whoami`

You can verify that your server is running by looking at /var/lib/aolserver/$SERVICE0/log/error.log

If you want to edit your config files, here is their location

  • /var/lib/aolserver/SERVICE0/etc/SERVICE0.tcl
    This contains the configuration parameters and is usually referred to as "config" file.
  • /var/lib/aolserver/SERVICE0/etc/daemontools/run
    If you made changes to the IP Address and the port you will need to edit this file:
    • add the "-b" switch to match your ip address and port right after "nsd-postgres", before the "-it ..." part


Last but not least make sure incoming E-Mail will work (for a full installation overview look at incoming_email. First add your domain to the virtual_domains in /etc/postfix/main.cf then execute the following commands:


echo "@www.$SERVICE0.com $SERVICE0" >>/etc/postfix/virtual
mkdir /web/$SERVICE0/mail
chown $SERVICE0.web /web/$SERVICE0/mail
postmap /etc/postfix/virtual
/etc/init.d/postfix restart

Now it is time to setup the backup and keepalive correctly. First edit /var/lib/aolserver/$SERVICE0/etc/keepalive/keepalive-config.tcl to include your server.

Then copy /var/lib/aolserver/$SERVICE0/etc/backup.sh to /var/lib/aolserver/$SERVICE0/etc/backup-$SERVICE0.sh and edit it to reflect your environment.

Last but not least login as $SERVICE0 and edit the crontab

su - $SERVICE0
export EDITOR=emacs
crontab -e

File in the following data, replaceing service0 where occuring.

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=<youremail>
HOME=/var/lib/aolserver/service0

# m h  dom mon dow   command
02 4 * * *           /var/lib/aolserver/service0/etc/backup-service0.sh
*/7 * * * *          /var/lib/aolserver/service0/etc/keepalive/keepalive-cron.sh

Webservices Support (TWiST)

To support webservices there exists the tool called "TWiST". To download and install it onto your server the following steps need to be taken:

cd /var/lib/aolserver/service0/tcl
svn checkout http://twsdl.googlecode.com/svn/tags/twist-0.9.9 twist-0.9.9
mv twist-0.9.9 twsdl

Then you need to edit your config file at /var/lib/aolserver/SERVICE0/etc/SERVICE0.tcl by adding the following in the modules section:

ns_section ns/server/${server}/modules
ns_param twsdl tcl

Index

Created by Gustaf Neumann, last modified by Gustaf Neumann 02 Feb 2018, at 09:27 AM

Symbols

$OPENACS_SERVICE_NAME, Paths and Users

A

AOLserver
configuration, Installation Option 2: Install from tarball
Automated tests, Write automated tests

C

computeroutput
code, Code
cvs
initializing, Initialize CVS (OPTIONAL)
setup, Using CVS with an OpenACS Site

D

daemontools
installation, Install Daemontools (OPTIONAL)
docbook
installation, Install Red Hat 8/9
DocBook
DTD, OpenACS Documentation Strategy: Why DocBook?
emacs configuration for, Add PSGML commands to emacs init file (OPTIONAL)
Document structure, Document Structure

E

emacs
installation, Install Red Hat 8/9
emphasis
bold, italics, Emphasis

G

Graphics
Images, Graphics

I

informaltable
table, Tables

L

language
installation, Install Red Hat 8/9
Linking, Links
lists, Lists

O

OpenACS Package, What a Package Looks Like

P

photo-album
installation (see ImageMagick)
Postgres
Vacuuming, Installation Option 2: Install from tarball

Q

qmail
installation, Install qmail (OPTIONAL)
Maildir, Install qmail (OPTIONAL)
rcpthosts error message, Install qmail (OPTIONAL)

S

sect1, Headlines, Sections
sect2, Headlines, Sections
Sections
Headlines, Headlines, Sections
security
definition, Install Red Hat 8/9
firewall, Install Red Hat 8/9
sendmail
removing, Install qmail (OPTIONAL)
ssh, Install Red Hat 8/9

T

The publish point for new packages should be fixed., Prepare the package for distribution.

U

ulink, Links
upgrade
OpenACS 4.5 to 4.6.x
Linux/Unix, Upgrading 4.5 or higher to 4.6.3

X

XML guidelines, OpenACS Documentation Strategy: Why DocBook?
xref
linkend, Links
xreflabel, Headlines, Sections

Categories

Created by , last modified by Gustaf Neumann 20 Oct 2017, at 05:29 AM

#

OpenACS Core Documentation

Created by Gustaf Neumann, last modified by Gustaf Neumann 11 Oct 2017, at 08:45 AM

Table of Contents

I. OpenACS For Everyone
1. High level information: What is OpenACS?
Overview
OpenACS Release Notes
II. Administrator's Guide
2. Installation Overview
Basic Steps
Prerequisite Software
3. Complete Installation
Install a Unix-like system and supporting software
Install Oracle 8.1.7
Install PostgreSQL
Install AOLserver 4
Install OpenACS 5.2.3rc1
OpenACS Installation Guide for Windows2000
OpenACS Installation Guide for Mac OS X
4. Configuring a new OpenACS Site
Installing OpenACS packages
Mounting OpenACS packages
Configuring an OpenACS package
Setting Permissions on an OpenACS package
How Do I?
5. Upgrading
Overview
Upgrading 4.5 or higher to 4.6.3
Upgrading OpenACS 4.6.3 to 5.0
Upgrading an OpenACS 5.0.0 or greater installation
Upgrading the OpenACS files
Upgrading Platform components
6. Production Environments
Starting and Stopping an OpenACS instance.
AOLserver keepalive with inittab
Running multiple services on one machine
High Availability/High Performance Configurations
Staged Deployment for Production Networks
Installing SSL Support for an OpenACS service
Set up Log Analysis Reports
External uptime validation
Diagnosing Performance Problems
7. Database Management
Running a PostgreSQL database on another server
Deleting a tablespace
Vacuum Postgres nightly
8. Backup and Recovery
Backup Strategy
Manual backup and recovery
Automated Backup
Using CVS for backup-recovery
A. Install Red Hat 8/9
B. Install additional supporting software
Unpack the OpenACS tarball
Initialize CVS (OPTIONAL)
Add PSGML commands to emacs init file (OPTIONAL)
Install Daemontools (OPTIONAL)
Install qmail (OPTIONAL)
Install Analog web file analyzer
Install nspam
Install Full Text Search using Tsearch2
Install Full Text Search using OpenFTS (deprecated see tsearch2)
Install nsopenssl
Install tclwebtest.
Install PHP for use in AOLserver
Install Squirrelmail for use as a webmail system for OpenACS
Install PAM Radius for use as external authentication
Install LDAP for use as external authentication
Install AOLserver 3.3oacs1
C. Credits
Where did this document come from?
Linux Install Guides
Security Information
Resources
III. For OpenACS Package Developers
9. Development Tutorial
Creating an Application Package
Setting Up Database Objects
Creating Web Pages
Debugging and Automated Testing
10. Advanced Topics
Write the Requirements and Design Specs
Add the new package to CVS
OpenACS Edit This Page Templates
Adding Comments
Admin Pages
Categories
Profile your code
Prepare the package for distribution.
Distributing upgrades of your package
Notifications
Hierarchical data
Using .vuh files for pretty urls
Laying out a page with CSS instead of tables
Sending HTML email from your application
Basic Caching
Scheduled Procedures
Enabling WYSIWYG
Adding in parameters for your package
Writing upgrade scripts
Connect to a second database
Future Topics
11. Development Reference
OpenACS Packages
OpenACS Data Models and the Object System
The Request Processor
The OpenACS Database Access API
Using Templates in OpenACS
Groups, Context, Permissions
Writing OpenACS Application Pages
Parties in OpenACS
OpenACS Permissions Tediously Explained
Object Identity
Programming with AOLserver
Using Form Builder: building html forms dynamically
12. Engineering Standards
OpenACS Style Guide
CVS Guidelines
Release Version Numbering
Constraint naming standard
ACS File Naming and Formatting Standards
PL/SQL Standards
Variables
Automated Testing
13. Documentation Standards
OpenACS Documentation Guide
Using PSGML mode in Emacs
Using nXML mode in Emacs
Detailed Design Documentation Template
System/Application Requirements Template
14. Internationalization
Internationalization and Localization Overview
How Internationalization/Localization works in OpenACS
How to Internationalize a Package
Design Notes
Translator's Guide
D. Using CVS with an OpenACS Site
IV. For OpenACS Platform Developers
15. Kernel Documentation
Overview
Object Model Requirements
Object Model Design
Permissions Requirements
Permissions Design
Groups Requirements
Groups Design
Subsites Requirements
Subsites Design Document
Package Manager Requirements
Package Manager Design
Database Access API
OpenACS Internationalization Requirements
Security Requirements
Security Design
Security Notes
Request Processor Requirements
Request Processor Design
Documenting Tcl Files: Page Contracts and Libraries
Bootstrapping OpenACS
External Authentication Requirements
16. Releasing OpenACS
OpenACS Core and .LRN
How to Update the OpenACS.org repository
How to package and release an OpenACS Package
How to Update the translations
Index

Request Processor Design

Created by Gustaf Neumann, last modified by Gustaf Neumann 12 Aug 2017, at 10:46 AM

By Rafael H. Schloming

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

The request processor is the set of procs that responds to every HTTP request made to the OpenACS. The request processor must authenticate the connecting user, and make sure that he is authorized to perform the given request. If these steps succeed, then the request processor must locate the file that is associated with the specified URL, and serve the content it provides to the browser.

  • pageroot -- Any directory that contains scripts and/or static files intended to be served in response to HTTP requests. A typical OpenACS installation is required to serve files from multiple pageroots.

  • global pageroot (/var/lib/aolserver/servicename/www) -- Files appearing under this pageroot will be served directly off the base url http://www.servicename.com/

  • package root (/var/lib/aolserver/servicename/packages) -- Each subdirectory of the package root is a package. A typical OpenACS installation will have several packages.

  • package pageroot (/var/lib/aolserver/servicename/packages/package_key/www) -- This is the pageroot for the package_key package.

  • request environment (ad_conn) -- This is a global namespace containing variables associated with the current request.

  • abstract URL -- A URL with no extension that doesn't directly correspond to a file in the filesystem.

  • abstract file or abstract path -- A URL that has been translated into a file system path (probably by prepending the appropriate pageroot), but still doesn't have any extension and so does not directly correspond to a file in the filesystem.

  • concrete file or concrete path -- A file or path that actually references something in the filesystem.

Package Lookup

One of the first things the request processor must do is to determine which package instance a given request references, and based on this information, which pageroot to use when searching for a file to serve. During this process the request processor divides the URL into two pieces. The first portion identifies the package instance. The rest identifies the path into the package pageroot. For example if the news package is mounted on /offices/boston/announcements/, then a request for /offices/boston/announcements/index would be split into the package_url (/offices/boston/announcements/), and the abstract (no extension info) file path (index). The request processor must be able to figure out which package_id is associated with a given package_url, and package mountings must be persistent across server restarts and users must be able to manipulate the mountings on a live site, therefore this mapping is stored in the database.

Authentication and Authorization

Once the request processor has located both the package_id and concrete file associated with the request, authentication is performed by the session security system. After authentication has been performed the user is authorized to have read access for the given package by the OpenACS 4 Permissions Design. If authorization succeeds then the request is served, otherwise it is aborted.

Concrete File Search

To actually serve a file, the request processor generates an ordered list of abstract paths and searches each path for a concrete file. The first path searched is composed of the package pageroot with the extra portion of the URL appended. The second abstract path consists of the global pageroot with the full URL appended. This means that if an instance of the news package is mounted on /offices/boston/announcements/, then any requests that are not matched by something in the news package pageroot could be matched by something under the global pageroot in the /offices/boston/announcements/ directory. Files take precedence over directory listings, so an index file in the global pageroot will be served instead of a directory listing in the package pageroot, even though the global pageroot is searched later. If a file is found at any of the searched locations then it is served.

Virtual URL Handlers

If no file is found during the concrete file search, then the request processor searches the filesystem for a virtual url handler (.vuh) file. This file contains normal tcl code, and is in fact handled by the same extension handling procedure that handles .tcl files. The only way this file is treated differently is in how the request processor searches for it. When a lookup fails, the request processor generates each valid prefix of all the abstract paths considered in the concrete file search, and searches these prefixes in order from most specific to least specific for a matching .vuh file. If a file is found then the ad_conn variable path_info is set to the portion of the url not matched by the .vuh script, and the script is sourced. This facility is intended to replace the concept of registered procs, since no special distinction is required between sitewide procs and package specific procs when using this facility. It is also much less prone to overlap and confusion than the use of registered procs, especially in an environment with many packages installed.

The request processor manages the mappings from URL patterns to package instances with the site_nodes data model. Every row in the site_nodes table represents a fully qualified URL. A package can be mounted on any node in this data model. When the request processor performs a URL lookup, it determines which node matches the longest possible prefix of the request URI. In order to make this lookup operation as fast as possible, the rows in the site_nodes table are pulled out of the database at server startup, and stored in memory.

The memory structure used to store the site_nodes mapping is a hash table that maps from the fully qualified URL of the node, to the package_id and package_key of the package instance mounted on the node. A lookup is performed by starting with the full request URI and successively stripping off the rightmost path components until a match is reached. This way the time required to lookup a URL is proportional to the length of the URL, not to the number of entries in the mapping.

The request environment is managed by the procedure ad_conn. Variables can be set and retrieved through use of the ad_conn procedure. The following variables are available for public use. If the ad_conn procedure doesn't recognize a variable being passed to it for a lookup, it tries to get a value using ns_conn. This guarantees that ad_conn subsumes the functionality of ns_conn.

Request processor
[ad_conn urlv] A list containing each element of the URL
[ad_conn url] The URL associated with the request.
[ad_conn query] The portion of the URL from the ? on (i.e. GET variables) associated with the request.
[ad_conn file] The filepath including filename of the file being served
[ad_conn request] The number of requests since the server was last started
[ad_conn start_clicks] The system time when the RP starts handling the request

Session System Variables: set in sec_handler, check security with ad_validate_security_info
[ad_conn session_id] The unique session_id coming from the sequence sec_id_seq
[ad_conn user_id] User_id of a person if the person is logged in. Otherwise, it is blank
[ad_conn sec_validated] This becomes "secure" when the connection uses SSL

Database API
[ad_conn db,handles] What are the list of handles available to AOL?
[ad_conn db,n_handles_used] How many database handles are currently used?
[ad_conn db,last_used] Which database handle did we use last?
[ad_conn db,transaction_level,$db] Specifies what transaction level we are in
[ad_conn db,db_abort_p,$dbh] Whether the transaction is aborted

APM
[ad_conn xml_loaded_p] Checks whether the XML parser is loaded so that it only gets loaded once. Set in apm_load_xml_packages

Packages
[ad_conn package_id] The package_id of the package associated with the URL.
[ad_conn package_url] The URL on which the package is mounted.

Miscellaneous
[ad_conn system_p] If true then the request has been made to one of the special directories specified in the config file (somewhere), and no authentication or authorization has been performed.

Documentation
[ad_conn api_page_documentation_mode_p]

Upgrading 4.5 or higher to 4.6.3

Created by Gustaf Neumann, last modified by Gustaf Neumann 05 Aug 2017, at 10:42 AM

The required platform for OpenACS 4.6 is the same as 4.5, with the exception of OpenFTS. OpenACS 4.6 and later require OpenFTS 0.3.2 for full text search on PostGreSQL. If you have OpenFTS 0.2, you'll need to upgrade.

If upgrading from 4.4, you need to manually run acs-kernel/sql/postgres/upgrade-4.4-4.5.sql. See Bug #632

  1. Make a Backup.Back up the database and file system (see the section called "€œManual backup and recovery").

  2. OPTIONAL: Upgrade OpenFTS. the section called "Upgrading OpenFTS from 0.2 to 0.3.2"€

  3. Stop the server

    [root root]# svc -d /service/$OPENACS_SERVICE_NAME
    
    
  4. Upgrade the file system.the section called "Upgrading the OpenACS files"€

  5. Start the server

    [root root]# svc -u /service/$OPENACS_SERVICE_NAME
    
    
  6. Use APM to upgrade the database.

    1. Browse to the package manager, http://yourserver/acs-admin/apm.

    2. Click Install packages.

    3. Select the packages you want to install. This should be everything that says upgrade, plus any new packages you want. It's safest to upgrade the kernel by itself, and then come back and upgrade the rest of the desired packages in a second pass.

    4. On the next screen, click Install Packages

    5. When prompted, restart the server:

      [root root]# restart-aolserver $OPENACS_SERVICE_NAME
      
      
    6. Wait a minute, then browse to the package manager, http://yourserver/acs-admin/apm.

    7. Check that the kernel upgrade worked by clicking All and making sure that acs-kernel version is 5.2.3rc1.

  7. Rollback.If anything goes wrong, roll back to the backup snapshot.

Upgrading OpenACS 4.6.3 to 5.0

Created by Gustaf Neumann, last modified by Gustaf Neumann 05 Aug 2017, at 10:40 AM

  • Oracle.This forum posting documents how to upgrade an Oracle installation from OpenACS 4.6.3 to 5 .

  • PostGreSQL.You must use PostGreSQL 7.3.x or newer to upgrade OpenACS beyond 4.6.3. See Upgrade PostGreSQL to 7.3; Table2.2, Version Compatibility Matrix€

    1. Back up the database and file system.

    2. Upgrade the file system for packages/acs-kernel.the section called "Upgrading the OpenACS files"€

    3. Upgrade the kernel manually. (There is a script to do most of the rest: /contrib/misc/upgrade_4.6_to_5.0.sh on HEAD). You'll still have to do a lot of stuff manually, but automated trial and error is much more fun.)

      [root root]# su - $OPENACS_SERVICE_NAME
      
      [$OPENACS_SERVICE_NAME aolserver]$ cd /var/lib/aolserver/ $OPENACS_SERVICE_NAME/packages/acs-kernel/sql/postgresql/upgrade
      

      Manually execute each of the upgrade scripts in sequence, either from within psql or from the command line with commands such as psql -f upgrade-4.6.3-4.6.4.sql $OPENACS_SERVICE_NAME . Run the scripts in this order (order is tentative, not verified):

      psql -f upgrade-4.6.3-4.6.4.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-4.6.4-4.6.5.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-4.6.5-4.6.6.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-4.7d-4.7.2d.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-4.7.2d-5.0d.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0d-5.0d2.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0d2-5.0d3.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0d6-5.0d7.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0d7-5.0d9.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0d11-5.0d12.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0.0a4-5.0.0a5.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0.0b1-5.0.0b2.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0.0b2-5.0.0b3.sql $OPENACS_SERVICE_NAME
      psql -f upgrade-5.0.0b3-5.0.0b4.sql $OPENACS_SERVICE_NAME
      
    4. Upgrade ACS Service Contracts manually:

      [$OPENACS_SERVICE_NAME aolserver]$ cd /var/lib/aolserver/ $OPENACS_SERVICE_NAME/packages/acs-service-contracts/sql/postgresql/upgrade
      psql -f upgrade-4.7d2-4.7d3.sql $OPENACS_SERVICE_NAME
      
    5. Load acs-authentication data model.

      psql -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/openacs-5/packages/acs-authentication/sql/postgresql/acs-authentication-create.sql $OPENACS_SERVICE_NAME
      
    6. Load acs-lang data model.

      psql -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-lang/sql/postgresql/acs-lang-create.sql $OPENACS_SERVICE_NAME
      
    7. (This step may overlap with the two previous steps, but I think it's harmless?) Create a file which will be executed on startup which takes care of a few issues with authentication and internationalization: create $OPENACS_SERVICE_NAME/tcl/zzz-postload.tcl containing:

      if {![apm_package_installed_p acs-lang]} {
      apm_package_install -enable -mount_path acs-lang [acs_root_dir]/packages/acs-lang/acs-lang.info
      lang::catalog::import -locales [list "en_US"]
      }
      
      if {![apm_package_installed_p acs-authentication]} {
      apm_package_install -enable [acs_root_dir]/packages/acs-authentication/acs-authentication.info
      apm_parameter_register "UsePasswordWidgetForUsername"  "Should we hide what the user types in the username
      field, the way we do with the password field? Set
      this to 1 if you are using sensitive information
      such as social security number for username."  acs-kernel 0 number  security 1 1
      parameter::set_value -package_id [ad_acs_kernel_id] -parameter UsePasswordWidgetForUsername -value 0
      }
    8. If you can login, visit /acs-admin/apm and upgrade acs-kernel and acs-service-contract and uncheck the data model scripts. Restart. If everything is still working, make another backup of the database.

    9. Upgrade other packages via the APM (4.5 to 4.6)

    See also these forum posts: Forum OpenACS Development: 4.6.3 upgrade to 5-HEAD: final results, OpenACS 5.0 Upgrade Experiences.

    There are a few things you might want to do once you've upgraded. First, the acs-kernel parameters need to be set to allow HREF and IMG tags, if you want users who can edit HTML to be able to insert HREF and IMG tags. Also, you might need to set the default language for your site. See the above link on OpenACS 5.0 Upgrade Experiences for details.

Laying out a page with CSS instead of tables

Created by Gustaf Neumann, last modified by Gustaf Neumann 05 Jun 2017, at 08:21 AM

A sample of the HTML code (full source)

<table border="0" width="100%">
  <tr>
    <td valign="top" width="50%">
      <table class="element" border=0 cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td colspan=3 class="element-header-text">
            <bold>Groups</bold>
         </td>
       </tr>
       <tr>
         <td colspan=3 class="dark-line" height="0"><img src="/resources/acs-subsite/spacer.gif"></td></tr>
          <tr>
            <td class="light-line" width="1">
              <img src="/resources/acs-subsite/spacer.gif" width="1">
            </td>
            <td class="element-text" width="100%">
            <table cellspacing="0" cellpadding="0" class="element-content" width="100%">
              <tr>
                <td>
                  <table border="0" bgcolor="white" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                      <td class=element-text>
                        MBA 101

A sample of the HTML code (full source)

<div class="left">
  <div class="portlet-wrap-shadow">
    <div class="portlet-wrap-bl">
      <div class="portlet-wrap-tr">
        <div class="portlet">
          <h2>Groups</h2>
          <ul>
            <li>
              <a href="#">Class MBA 101</a>

If the CSS is removed from the file, it looks somewhat different:

Next Page