%myvars; ]> Creating Web Pages by Joel Aufrecht Install some API 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/tutorial/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". Page Map 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 separate file and include it on the index page.
Page Map
Build the "Index" page 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. example missing Now index.adp: example missing 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 example missing [$OPENACS_SERVICE_NAME lib]$ emacs note-list.adp example missing You can test your work by viewing the page /myfirstpackage on your installation. 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 example missing [$OPENACS_SERVICE_NAME www]$ emacs note-edit.adp example missing 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 example missing