[Zope-Checkins] CVS: Zope/lib/python/Products/ZopeTutorial - TutorialTopic.py:1.8.6.1 __init__.py:1.8.8.1 glossary.stx:1.3.6.1 tutorial.stx:1.4.6.1

Shane Hathaway shane@digicool.com
Thu, 9 Aug 2001 13:34:11 -0400


Update of /cvs-repository/Zope/lib/python/Products/ZopeTutorial
In directory cvs.zope.org:/tmp/cvs-serv29115/lib/python/Products/ZopeTutorial

Modified Files:
      Tag: NR-branch
	TutorialTopic.py __init__.py glossary.stx tutorial.stx 
Log Message:
Sync NR-branch with trunk.  Sorry about so many checkin messages...


=== Zope/lib/python/Products/ZopeTutorial/TutorialTopic.py 1.8 => 1.8.6.1 ===
         
     index_html=DTMLFile('dtml/lessonView', globals())
+
+    def checkInstallation(self, REQUEST):
+        """
+        Returns false if the tutorial examples are not correctly
+        installed. Also sets the 'hide_next' variable in the request
+        if the examples are not installed.
+        """
+        ok=0
+        if REQUEST.has_key('tutorialExamplesURL'):
+            url=REQUEST['tutorialExamplesURL']
+            base=REQUEST['BASE1']
+            if string.index(url, base) == 0:
+                url=url[len(base):]
+                try:
+                    self.getPhysicalRoot().unrestrictedTraverse(url)
+                    ok=1
+                except:
+                    pass
+
+        if not ok:
+            REQUEST.set('hide_next', 1)
+        return ok
             
     def lessonURL(self, id, REQUEST):
         """
@@ -121,7 +143,8 @@
         Navigate management frame to a given lesson's screen.
         """
         url=self.lessonURL(id, REQUEST)
-        if not url:
+        if not url or not self.checkInstallation(REQUEST):
+            REQUEST.set('hide_next', 0)
             return """\
 <p class="warning">
 Zope cannot find the tutorial examples.
@@ -149,6 +172,31 @@
 >Show lesson examples</a> in another window.
 </p>""" % (url, url, url)
 
+
+    tutorialNavigation=DTMLFile('dtml/tutorialNav', globals())
+
+
+class GlossaryTopic(TutorialTopic):
+    """
+    A Tutorial Glossary Help Topic
+    """
+
+    def __init__(self, id, title, text):
+        self.id=id
+        self.title=title
+        self.obj=HTML(text)
+
+    index_html=DTMLFile('dtml/glossaryView', globals())
+        
+    def formatted_content(self, REQUEST):
+        """
+        Custom stx formatting for tutorial topics
+        """
+        text=self.obj(self, REQUEST)
+        text=str(StructuredText.HTML(text))
+        pre_pat.sub(clean_pre, text)
+        return text
+
     def apiLink(self, klass, REQUEST):
         """
         Returns the URL to a API documentation for a given class.
@@ -164,8 +212,6 @@
         """
         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())
 
 
 addTutorialForm=DTMLFile('dtml/tutorialAdd', globals())


=== Zope/lib/python/Products/ZopeTutorial/__init__.py 1.8 => 1.8.8.1 ===
     text=term_pat.sub(defineTerm, text)
     
-    glossary=TutorialTopic.TutorialTopic('tutorialGlossary', 'Zope Tutorial Glossary', text)
+    glossary=TutorialTopic.GlossaryTopic('tutorialGlossary',
+                                         'Zope Tutorial Glossary', text)
     context.registerHelpTopic('tutorialGlossary', glossary)
 
     # create lessons


=== Zope/lib/python/Products/ZopeTutorial/glossary.stx 1.3 => 1.3.6.1 ===
 
   For general information about Zope <a
-  href="http://www.zope.org/SiteIndex/searchForm" target="_blank">search</a> Zope.org.
+  href="http://www.zope.org/SiteIndex/searchForm"
+  target="_blank">search</a> Zope.org.
 
-  For Zope documentation try the <a href="http://zdp.zope.org" target="_blank">Zope
-  Documentation Project</a> site and the <a
-  href="http://www.zope.org/Documentation" target="_blank">documentation area</a> on Zope.org.
+  For Zope documentation try the <a href="http://zdp.zope.org"
+  target="_blank">Zope 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.
@@ -17,8 +19,8 @@
   results in web pages.
 
     For more information on DTML see the <a
-    href="http://www.zope.org/Members/michel/ZB/DTML.dtml" target="_blank">DTML
-    chapter</a> of The Zope Book.
+    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.
@@ -27,7 +29,7 @@
     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)">
+    <dtml-var "apiLink('OFSP.DTMLDocument.DTMLDocument', REQUEST)">
 
   [DTML Method] -- A Zope object that holds a piece of content that can
   be inserted into a web page. You can use DTML tags in a DTML Method.
@@ -36,7 +38,7 @@
     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)">
+    <dtml-var "apiLink('OFSP.DTMLMethod.DTMLMethod', REQUEST)">
     
   [Delete] -- Remove an object from the current Folder. Unlike Cut, this
   does not place a copy of the object in the clipboard.
@@ -105,7 +107,7 @@
     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)">
+    <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. 
@@ -121,7 +123,7 @@
     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)"> 
+    <dtml-var "apiLink('OFSP.Image.Image', REQUEST)"> 
    
   [index_html] -- The name of the default Zope object in a Folder.
   When you view a Folder the index_html object will be displayed
@@ -131,7 +133,7 @@
   [Mail Host] -- A Zope object that allows you to send email.
   Use the &lt;dtml-sendmail&gt; tag to send email.
 
-    <dtml-var "apiLink('MailHost'+'.MailHost.MailHost', REQUEST)">
+    <dtml-var "apiLink('MailHost.MailHost.MailHost', REQUEST)">
   
   [Paste] -- Insert the objects from the clipboard into the current Folder.
   
@@ -145,7 +147,7 @@
     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)">
+    <dtml-var "apiLink('OFSP.PropertyManager.PropertyManager', REQUEST)">
 
   [standard_html_header] -- The standard Zope header object. By
   convention this object displays an HTML header.
@@ -166,5 +168,5 @@
     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)">
+    <dtml-var "apiLink('ZSQLMethods.ZSQLMethod.ZSQLMethod', REQUEST)">
 


=== Zope/lib/python/Products/ZopeTutorial/tutorial.stx 1.4 => 1.4.6.1 ===
   its "README" document.
   
-  <dtml-unless tutorialExamplesURL>
-  <dtml-call "REQUEST.set('hide_'+'next', 1)">
+  <dtml-unless expr="checkInstallation(REQUEST)">
   
   Install Tutorial Examples