[Zope-Checkins] CVS: Zope2 - TutorialTopic.py:1.8 glossary.stx:1.3 tutorial.stx:1.4

Amos Latteier amos@digicool.com
Thu, 21 Jun 2001 19:14:54 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/Products/ZopeTutorial
In directory korak.digicool.com:/tmp/cvs-serv10110

Modified Files:
	TutorialTopic.py glossary.stx tutorial.stx 
Log Message:
Some long overdue maintence on the Zope tutorial.

* Replaced references to the deprecated Guides with references to the Zope Book.
* Added links to the DTML reference section of the online help.
* Replaced ZopeTime examples with DateTime.
* Added a new lesson which show how to insert data into a database.



--- Updated File TutorialTopic.py in package Zope2 --
--- TutorialTopic.py	2001/05/02 14:41:05	1.7
+++ TutorialTopic.py	2001/06/21 23:14:54	1.8
@@ -158,6 +158,13 @@
                 names[0], names[1], names[2])
         return '<a href="%s">API Documentation</a>' % url
 
+    def dtmlLink(self, tag, REQUEST):
+        """
+        Returns the URL to a DTML Reference page for a given tag.
+        """
+        url="%s/Control_Panel/Products/OFSP/Help/dtml-%s.stx" % (REQUEST['SCRIPT_NAME'], tag)
+        return '<a href="%s">DTML Reference</a>' % url
+
     tutorialNavigation=DTMLFile('dtml/tutorialNav', globals())
 
 

--- Updated File glossary.stx in package Zope2 --
--- glossary.stx	2000/06/30 01:27:47	1.2
+++ glossary.stx	2001/06/21 23:14:54	1.3
@@ -7,20 +7,25 @@
   Documentation Project</a> site and the <a
   href="http://www.zope.org/Documentation" target="_blank">documentation area</a> on Zope.org.
 
+  [DateTime] -- A DTML function to get the current time or to create a
+  date time object given a string.
+
+    <dtml-var "dtmlLink('funcs', REQUEST)">
+
   [DTML] -- A tag-based reporting language, like ASP
   or PHP. It allows you to perform operations on Zope objects and insert the
   results in web pages.
 
     For more information on DTML see the <a
-    href="http://www.zope.org/Documentation/Guides/DTML" target="_blank">DTML
-    Reference</a>.
+    href="http://www.zope.org/Members/michel/ZB/DTML.dtml" target="_blank">DTML
+    chapter</a> of The Zope Book.
 
   [DTML Document] -- A Zope object for a web page.
   You can use DTML tags in a DTML document.
   
     For more information on DTML Documents see the <a
-    href="http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.7.2.html"
-    target="_blank">Zope Content Manager's Guide</a>.
+    href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
+    target="_blank">Basic Objects chapter</a> of The Zope Book.
 
     <dtml-var "apiLink('OFSP'+'.DTMLDocument.DTMLDocument', REQUEST)">
 
@@ -28,8 +33,8 @@
   be inserted into a web page. You can use DTML tags in a DTML Method.
   
     For more information on DTML Methods see the <a
-    href="http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.7.1.html"
-    target="_blank">Zope Content Manager's Guide</a>.
+    href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
+    target="_blank">Basic Objects chapter</a> of The Zope Book.
 
     <dtml-var "apiLink('OFSP'+'.DTMLMethod.DTMLMethod', REQUEST)">
     
@@ -45,50 +50,62 @@
   database.
     
     For more information on Database Connections see the <a
-    href="http://www.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.1.3.html"
-    target="_blank">SQL Method User's Guide</a>.
+    href="http://www.zope.org/Members/michel/ZB/RelationalDatabases.dtml"
+    target="_blank">Relational Database chapter</a> of The Zope Book.
 
   [<dtml-call>] -- A DTML tag that allows your to perform an
   action without inserting anything into a web page.
   
     For more information on &lt;dtml-call&gt; tag see the <a
-    href="http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.10.html"
-    target="_blank">DTML Reference</a>.
+    href="http://www.zope.org/Members/michel/ZB/AdvDTML.dtml"
+    target="_blank">Advanced DTML chapter</a> of The Zope Book.
+
+    <dtml-var "dtmlLink('call', REQUEST)">
   
   [<dtml-if>] -- A DTML tag that allows you to conditionally insert
   objects into a DTML Document or DTML Method.
 
     For more information on &lt;dtml-if&gt; tag see the <a
-    href="http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.6.html"
-    target="_blank">DTML Reference</a>.  
+    href="http://www.zope.org/Members/michel/ZB/DTML.dtml"
+    target="_blank">DTML chapter</a> of The Zope Book.  
 
+    <dtml-var "dtmlLink('if', REQUEST)">
+
   [<dtml-in>] -- A DTML tag that allows you to loop over a sequence
   of objects.
 
     For more information on &lt;dtml-in&gt; tag see the <a
-    href="http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.7.html"
-    target="_blank">DTML Reference</a>.  
+    href="http://www.zope.org/Members/michel/ZB/DTML.dtml"
+    target="_blank">DTML chapter</a> of The Zope Book.  
+
+    <dtml-var "dtmlLink('in', REQUEST)">
 
   [<dtml-var>] -- A DTML tag that allows you to insert objects
   into a DTML Document or DTML Method.
   
     For more information on &lt;dtml-var&gt; tag see the <a
-    href="http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.5.html"
-    target="_blank">DTML Reference</a>.
+    href="http://www.zope.org/Members/michel/ZB/DTML.dtml"
+    target="_blank">DTML chapter</a> of The Zope Book.  
+
+    <dtml-var "dtmlLink('var', REQUEST)">
     
   [<dtml-sendmail>] -- A DTML tag that sends email.
 
     For more information on &lt;dtml-sendmail&gt; tag see the <a
-    href="http://www.zope.org/Documentation/Guides/DTML-HTML/DTML.16.html"
-    target="_blank">DTML Reference</a>.
+    href="http://www.zope.org/Members/michel/ZB/AdvDTML.dtml"
+    target="_blank">Advanced DTML chapter</a> of The Zope Book.
+
+    <dtml-var "dtmlLink('sendmail', REQUEST)">
     
   [Folder] -- A Zope object that contains other Zope objects. You can
   move objects between Folders by cutting and pasting them. You can
   add new objects to Folders with the product add list.
 
     For more information on Folders see the <a
-    href="http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.6.2.html"
-    target="_blank">Zope Content Manager's Guide</a>.
+    href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
+    target="_blank">Basic Objects chapter</a> of The Zope Book.
+
+    <dtml-var "apiLink('OFSP'+'.Folder.Folder', REQUEST)">
 
   [HTTP Cookies] -- Cookies allow you to record information in a visitor's
   browser. This is commonly used to provide personalization for a web site. 
@@ -101,8 +118,8 @@
   [Image] -- A Zope object for a picture.
     
     For more information on Images see the <a
-    href="http://www.zope.org/Documentation/Guides/ZCMG-HTML/ZCMG.6.4.html"
-    target="_blank">Zope Content Manager's Guide</a>.
+    href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
+    target="_blank">Basic Objects chapter</a> of The Zope Book.
     
     <dtml-var "apiLink('OFSP'+'.Image.Image', REQUEST)"> 
    
@@ -123,7 +140,13 @@
   Folder.
   
   [Properties] -- Properties contain small pieces of content. 
-  
+
+    For more information on Properties see the <a
+    href="http://www.zope.org/Members/michel/ZB/BasicObject.dtml"
+    target="_blank">Basic Objects chapter</a> of The Zope Book.
+
+      <dtml-var "apiLink('OFSP'+'.PropertyManager.PropertyManager', REQUEST)">
+
   [standard_html_header] -- The standard Zope header object. By
   convention this object displays an HTML header.
   
@@ -140,8 +163,8 @@
   database.
   
     For more information on ZSQL Methods see the <a
-    href="http://www.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.1.4.html"
-    target="_blank">SQL Method User's Guide</a>.  
+    href="http://www.zope.org/Members/michel/ZB/RelationalDatabases.dtml"
+    target="_blank">Relational Database chapter</a> of The Zope Book.
 
     <dtml-var "apiLink('ZSQLMethods'+'.ZSQLMethod.ZSQLMethod', REQUEST)">
 

--- Updated File tutorial.stx in package Zope2 --
--- tutorial.stx	2000/06/30 01:55:48	1.3
+++ tutorial.stx	2001/06/21 23:14:54	1.4
@@ -74,7 +74,7 @@
 
       <dtml-var standard_html_footer>
       
-    2. Click the 'Change' button.
+    2. Click the 'Save Changes' button.
     
   The contents of the document are a mixture of HTML and special
   tags called [DTML].
@@ -160,7 +160,7 @@
 
       <dtml-var standard_html_footer>
       
-    6. Click the 'Change' button.
+    6. Click the 'Save Changes' button.
   
   This adds a link the the 'graceland' folder. Now let's test
   out the link.
@@ -200,10 +200,7 @@
     
     3. Type 'Elvis and Food' for the folder title.
     
-    4. Uncheck the 'Create public interface' and 'Create user folder'
-    check boxes.
-
-    5. Click the 'Add' button.
+    4. Click the 'Add' button.
     
   Now we've got some place to put our food related resources. Let's
   move some objects into this folder.
@@ -234,7 +231,7 @@
       <a href="food/meatloaf">meatloaf</a>.
       </p>
       
-    3. Click the 'Change' button.
+    3. Click the 'Save Changes' button.
     
     4. Click the 'View' tab at the top of the screen.
   
@@ -276,8 +273,8 @@
     
     4. Click the 'Add' button.
     
-    Now you've created a property that defines your email address. Now
-    let's put a link to this address in the web page footer.
+  Now you've created a property that defines your email address. Now
+  let's put a link to this address in the web page footer.
   
     1. Click the 'Contents' tab to return to the list of items in the
        folder, then click the 'standard_html_footer' [DTML Method] to edit it.
@@ -290,16 +287,16 @@
       </body>
       </html>
    
-    3. Click the 'Change' button.
+    3. Click the 'Save Changes' button.
 
   We've change the standard Zope footer. Now let's verify that this
   change is reflected in our web pages.
     
-    4. Navigate to the 'home.html' document in the 'lesson4' folder
+    1. Navigate to the 'home.html' document in the 'lesson4' folder
     by clicking on the 'lesson4' location link and then clicking 
     on the 'home.html' document.
     
-    5. Now click the 'View' tab to view the web site.
+    2. Now click the 'View' tab to view the web site.
     
   Notice that there is now an email link at the bottom of every web
   page. The email link uses the property you defined and includes the
@@ -411,7 +408,7 @@
       
       <dtml-var standard_html_footer>
       
-    3. Click the 'Change' button.
+    3. Click the 'Save Changes' button.
     
     4. Click the 'View' tab.
     
@@ -475,7 +472,7 @@
       
       <dtml-var standard_html_footer>
      
-    3. Click the 'Change' button.
+    3. Click the 'Save Changes' button.
     
     4. Click the 'View' tab.
     
@@ -539,15 +536,16 @@
       
       <dtml-var standard_html_footer>
   
-    3. Click the 'Change' button.
+    3. Click the 'Save Changes' button.
     
   This document collects data needed to create an Image. It calls the
   'photoAction' document with that data. The 'photoAction' document
-  actually creates the Image.
+  actually creates the Image. Now let's customize the 'photoAction'
+  document to handle the image title.
     
-    4. Click the 'photoAction' document to edit it. 
+    1. Click the 'photoAction' document to edit it. 
    
-    5. Change the contents of the document to::
+    2. Change the contents of the document to::
     
       <dtml-var standard_html_header>
       
@@ -619,7 +617,7 @@
       <p>Elvis spotted spare changing on Broadway.
       He denied being the King.</p>
     
-    9. Click the 'Change' button.
+    9. Click the 'Save Changes' button.
     
   Now you've created a new sighting. Let's see if it is marked as new
   by the sightings page.
@@ -638,17 +636,18 @@
   Let's look at the DTML for the 'sightings' page to see how this is
   done.
   
-    1. Click the 'sightings' document to edit it.
+    1. Click the 'sightings' document to view its contents.
     
   The document sets a cookie with this code::
   
-    <dtml-call expr="RESPONSE.setCookie('lastVisited', ZopeTime())">
+    <dtml-call expr="RESPONSE.setCookie('lastVisited',
+      _.DateTime())">
  
   The document checks each sighting when displaying it to see if it is
   newer than the 'lastVisited' cookie::
   
     <dtml-if expr="bobobase_modification_time() >
-      ZopeTime(lastVisited)">
+      _.DateTime(lastVisited)">
   
   Summary
   
@@ -659,6 +658,8 @@
     
     * The [<dtml-if>] tag allows you to test conditions.
     
+    * The [DateTime] function allows you to get the current time.
+
     * The 'bobobase_modification_time' method returns the last
     modification time of an object.
  
@@ -672,7 +673,7 @@
   "Elvis Lives" web site! Let's enhance our site to allow visitors to
   report their Elvis sightings.
   
-    1. Click 'mailhost' [Mail Host] object to edit it.
+    1. Click the 'mailhost' [Mail Host] object to edit it.
     
     2. Type the name of your mail server in the 'SMTP Host' field.
     
@@ -681,7 +682,7 @@
   server, ask your system administrator, or check the configuration of
   your mail client.
   
-    3. Click the 'Change' button.
+    3. Click the 'Save Changes' button.
     
   Now Zope can send mail. Next let's edit the template for the Elvis
   sighting report mail message.
@@ -789,7 +790,7 @@
       
       <dtml-var standard_html_footer>
       
-    3. Click the 'Change' button.
+    3. Click the 'Save Changes' button.
     
     4. Click the 'View' tab to view the document.
     
@@ -803,6 +804,82 @@
     * [ZSQL Method]s get information out of or into a relational
     database.
 
+Lesson 12. The Elvis Files, cont.
+
+  <dtml-var "tutorialShowLesson(12, REQUEST)"> In the last lesson you
+  created an Elvis sightings database. Now let's adapt the this
+  database to allow site visitors to submit their own sightings.
+
+  This lesson builds on your experience from the last two lessons. To
+  allow folks to report sightings you'll need a report form just like
+  you used in lesson 10. 
+
+    1. Click on the 'reportForm' DTML Document to view its contents.
+
+  This document is almost exactly like the report form used in Lesson
+  10. It collects data and calls the 'reportAction' document to
+  process the data.
+
+    2. Click on the 'reportAction' DTML Document to view its contents.
+
+  This document its simplier than the 'reportAction' document in
+  Lesson 10. All it does is 
+  thank the user and call the 'insertSighting' ZSQL Method with this
+  code::
+
+    <dtml-call insertSighting>
+
+  The real work is done by the 'insertSighting' ZSQL Method. Let's see
+  how.
+
+    3. Click on the 'insertSighting' ZSQL Method to view its contents.
+
+  The query template contains the following SQL code::
+
+    insert into elvis_sightings
+      values(
+    <dtml-sqlvar location type="string">,
+    <dtml-sqlvar date type="string">,
+    <dtml-sqlvar name type="string">,
+    <dtml-sqlvar description type="string"> 
+    )
+  
+  This code inserts a row into the 'elvis_sightings' table. Notice how
+  the arguments of this ZSQL Method correspond to the form elements in
+  the 'reportSighting' document.
+
+  You can test this SQL code to make sure it
+  works correctly.
+
+    1. Click on the 'Test' tab.
+
+    2. Enter some sample data into the automatically generated form.
+
+    3. Click the 'Submit Query' button.
+
+  Zope will send the SQL code to the database and will tell you the
+  SQL code that was sent, and the results that the database
+  returned. In this case the database will not return anything, since
+  the SQL 'INSERT' command produces no results.
+
+  Now return to the 'sightings' document to see if the sample data was
+  added to the list of sightings. Play with the system a little bit
+  and see how the links between the 'sightings', 'reportForm', and
+  'reportAction' documents allow a visitor to navigate the site.
+
+  Summary
+
+    You can easily change data in a relational database with Zope. The
+    process for inserting data is very similar to the process for
+    querying a database; you use a ZSQL Method in both cases.
+
+    * [ZSQL Method]s can change information in a relational
+    database.
+
+    * You can pass arguments to ZSQL Methods from DTML. 
+
+    * Many ZSQL Methods can use the same [Database Connection].
+
 Congratulations
 
   Well done! You've finished the Zope Tutorial.
@@ -812,14 +889,19 @@
   changing them.
   
   To find out more about Zope visit
-  <a href="http://www.zope.org">Zope.org</a>.
+  <a href="http://www.zope.org" target="_blank">Zope.org</a>.
   
-  You may be especially interested in the Zope
-  <a href="http://www.zope.org/Documentation/How-To">How-Tos</a>, 
-  <a href="http://www.zope.org/Resources/MailingLists">mailing lists</a>,
-  Guides and the <a href="http://zdp.zope.org">Zope Documentation Project</a>.
-  
-  Please <a href="mailto:docs@digicool.com">let us know</a> what you liked and disliked
-  about the Zope Tutorial. Telling us what you think helps us
-  improve it.
+  You may be especially interested in the Zope <a
+  href="http://www.zope.org/Members/michel/ZB"
+  target="_blank">Book</a>, <a
+  href="http://www.zope.org/Documentation/How-To"
+  target="_blank">How-Tos</a>, <a
+  href="http://www.zope.org/Resources/MailingLists"
+  target="_blank">mailing lists</a>, Guides and the <a
+  href="http://zdp.zope.org" target="_blank">Zope Documentation
+  Project</a>.
+  
+  Please <a href="mailto:docs@digicool.com">let us know</a> what you
+  liked and disliked about the Zope Tutorial. Telling us what you
+  think helps us improve it.