Index: openacs-4/packages/acs-core-docs/www/tutorial-pages.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-pages.html,v diff -u -r1.28 -r1.29 --- openacs-4/packages/acs-core-docs/www/tutorial-pages.html 5 May 2004 12:36:08 -0000 1.28 +++ openacs-4/packages/acs-core-docs/www/tutorial-pages.html 11 Jun 2004 10:17:39 -0000 1.29 @@ -1,8 +1,8 @@ -
As a workaround for missing content-repository functionality, copy a provided file into the directory for tcl files:
- cp /var/lib/aolserver/service0/packages/acs-core-docs/www/files/note-procs.tcl /var/lib/aolserver/service0/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.
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.
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 @@ -12,8 +12,8 @@ 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:
[service0 postgresql]$ cd /var/lib/aolserver/service0/packages/myfirstpackages/www
-[service0 www]$ emacs index.tcl
Paste this into the file.
ad_page_contract { + 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) @@ -24,9 +24,9 @@ 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.
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.
[service0 www]$ mkdir /var/lib/aolserver/service0/packages/myfirstpackage/lib -[service0 www]$ cd /var/lib/aolserver/service0/packages/myfirstpackage/lib -[service0 lib]$ emacs note-list.tcltemplate::list::create \ +<include src="/packages/myfirstpackage/lib/note-list">You can test your work by viewing the page.
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.tcltemplate::list::create \ -name notes \ -multirow notes \ -actions { "Add a Note" note-edit} \ @@ -63,9 +63,9 @@ } { set edit_url [export_vars -base "note-edit" {item_id}] set delete_url [export_vars -base "note-delete" {item_id}] - }[service0 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.
[service0 lib]$ cd /var/lib/aolserver/service0/packages/myfirstpackage/www -[service0 www]$ emacs note-edit.tcl
ad_page_contract { + }[$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) @@ -105,13 +105,13 @@ } -after_submit { ad_returnredirect "." ad_script_abort -}[service0 www]$ emacs note-edit.adp<master> +}[$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.
[service0 www]$ emacs note-delete.tclad_page_contract { + tcl page, and no adp page.[$OPENACS_SERVICE_NAME www]$ emacs note-delete.tclad_page_contract { This deletes a note @author Your Name (you@example.com)