Index: openacs-4/packages/acs-core-docs/www/tutorial-pages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-pages.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-core-docs/www/tutorial-pages.adp 8 Nov 2017 09:42:12 -0000 1.3 +++ openacs-4/packages/acs-core-docs/www/tutorial-pages.adp 25 Apr 2018 08:38:28 -0000 1.4 @@ -3,33 +3,33 @@ Creating Web Pages -
+ leftLink="tutorial-database" leftLabel="Prev" + title="Chapter 9. Development +Tutorial" + rightLink="tutorial-debug" rightLabel="Next"> +

Creating Web Pages

<authorblurb>

by Joel Aufrecht

</authorblurb>

-Install some API

As a workaround for missing content-repository functionality, +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 +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.

-

Figure 9.5. Page +

Figure 9.5. Page Map

Page Map

-Build the "Index" page

Each user-visible page in your package has, typically, three +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 @@ -41,8 +41,7 @@ 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 {
+

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)
@@ -56,19 +55,15 @@
 #    tcl-indent-level: 4
 #    indent-tabs-mode: nil
 # End:
-

Now index.adp:

-<master>
+

Now index.adp:

<master>
   <property name="doc(title)">\@page_title;literal\@</property>
   <property name="context">\@context;literal\@</property>
-<include src="/packages/myfirstpackage/lib/note-list">
-

The index page includes the list page, which we put in /lib +<include src="/packages/myfirstpackage/lib/note-list">

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
+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 \
+
template::list::create \
     -name notes \
     -multirow notes \
     -actions { "Add a Note" note-edit} \
@@ -111,18 +106,14 @@
 #    tcl-indent-level: 4
 #    indent-tabs-mode: nil
 # End:
-
-[$OPENACS_SERVICE_NAME lib]$ emacs note-list.adp
+
[$OPENACS_SERVICE_NAME lib]$ emacs note-list.adp
 
-<listtemplate name="notes"></listtemplate>
-

You can test your work by viewing the page /myfirstpackage on +<listtemplate name="notes"></listtemplate>

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
+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 {
+
ad_page_contract {
     This is the view-edit page for notes.
 
     \@author Your Name (you\@example.com)
@@ -168,24 +159,19 @@
 #    tcl-indent-level: 4
 #    indent-tabs-mode: nil
 # End:
-
-[$OPENACS_SERVICE_NAME www]$ emacs note-edit.adp
-
-<master>
+
[$OPENACS_SERVICE_NAME www]$ emacs note-edit.adp
+
<master>
   <property name="doc(title)">\@page_title;literal\@</property>
   <property name="context">\@context;literal\@</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 {
+<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: note-delete.tcl,v 1.4 2017/08/07 23:47:54 gustafn Exp $
+    \@cvs-id $‌Id: note-delete.tcl,v 1.5 2018/01/19 21:23:51 gustafn Exp $
  
     \@param item_id The item_id of the note to delete
 } {
@@ -198,7 +184,7 @@
 
 ad_returnredirect "."
 # stop running this code, since we're redirecting
-abort
+ad_script_abort
 
 # Local variables:
 #    mode: tcl
@@ -209,8 +195,8 @@
 
 
  
-		
\ No newline at end of file
+			leftLink="tutorial-database" leftLabel="Prev" leftTitle="Setting Up Database Objects"
+			rightLink="tutorial-debug" rightLabel="Next" rightTitle="Debugging and Automated Testing"
+			homeLink="index" homeLabel="Home" 
+			upLink="tutorial" upLabel="Up"> 
+		    
\ No newline at end of file