[Zope-CVS] CVS: Packages/JobBoardEx - ApproveJobs.pt:1.5.2.3 ApproveJobs.py:1.6.2.1 JobCreateView.pt:1.1.2.2 JobList.zcml:1.13.2.3 JobPreviewView.pt:1.3.2.2 JobView.py:1.8.2.2

Gary Poster garyposter@earthlink.net
Wed, 3 Apr 2002 13:59:00 -0500


Update of /cvs-repository/Packages/JobBoardEx
In directory cvs.zope.org:/tmp/cvs-serv24356

Modified Files:
      Tag: gary-pre_create_views_example-branch
	ApproveJobs.pt ApproveJobs.py JobCreateView.pt JobList.zcml 
	JobPreviewView.pt JobView.py 
Log Message:
added preview, fixed a few things: in particular, used absolute URLs for form actions, rather than all the implicit stuff (that was not working for me)



=== Packages/JobBoardEx/ApproveJobs.pt 1.5.2.2 => 1.5.2.3 ===
 <body>
 
-    <form action="." method="post">
+    <form action="." method="post" tal:attributes="action request/URL/-1">
     <table border=0>
     <tr><th colspan=3>Action</th>
         <th rowspan=2>Summary</th>


=== Packages/JobBoardEx/ApproveJobs.py 1.6 => 1.6.2.1 ===
 
     def back(self, REQUEST):
-        return REQUEST.getResponse().redirect('..')
+        return REQUEST.getResponse().redirect(REQUEST.URL[-2])
 
     def submit(self, REQUEST):
         """Approve a job."""


=== Packages/JobBoardEx/JobCreateView.pt 1.1.2.1 => 1.1.2.2 ===
 <body>
 <h1>Enter new job data</h1>
-    <form action="action" method="post">
+    <form action="." method="post" tal:attributes="action request/URL/-1">
     <table border=0>
     <tr><td>Submitter:</td>
-	<td><input name="submitter" type="text" value="" size="72"
+	<td><input name="submitter" type="text" value="" size="72" 
+	tal:attributes="value request/submitter|default"
 	            />
 	</td>
     </tr>
     <tr><td>Summary:</td>
 	<td><input name="summary" type="text" value="" size="72"
+	tal:attributes="value request/summary|default"
 	            />
 	</td>
     </tr>
     <tr><td>Description:</td>
 	<td><textarea cols=72 rows=20 name="description" type="text"
+	tal:content="request/description|default"
 	     ></textarea>
 	</td>
     </tr>
     <tr><td>Contact:</td>
 	<td><input name="contact" type="text" value="" size="72"
+	tal:attributes="value request/contact|default"
 	           />
 	</td>
     </tr>
     <tr><td colspan="2">
-	<!-- input name="preview:method" type="submit" value="Preview" -->
-	<input name="submit" type="submit" value="Create">
+	<input name="preview:method" type="submit" value="Preview">
+	<input name="action:method" type="submit" value="Create">
 	<input name="reset" type="reset" value="Reset">
 	</td>
     </tr>


=== Packages/JobBoardEx/JobList.zcml 1.13.2.2 => 1.13.2.3 ===
         name=".JobView.CreateJobView"
         permission_id="Zope.Public"
-        methods="index, action"
+        methods="index, action, preview"
 />
 
 <!-- JobListTraverser -->


=== Packages/JobBoardEx/JobPreviewView.pt 1.3.2.1 => 1.3.2.2 ===
-<head></head>
+<head>
+<title>Preview job data</title></head>
 <body>
 
-    <form action="." method="post">
+    <form action="." method="post" tal:attributes="action
+    request/URL/-1">
 
         <table border=0>
         <tr><td>Submitter:</td>
-            <td tal:content="view/getSubmitter">aperson@dom.ain</td>
+            <td tal:content="request/submitter">aperson@dom.ain</td>
         </tr>
         <tr><td>Summary:</td>
-            <td tal:content="view/getSummary">The best job on the net</td>
+            <td tal:content="request/summary">The best job on the net</td>
         </tr>
         <tr><td>Description:</td>
-            <td tal:content="view/getDescription">This is really really
+            <td tal:content="request/description">This is really really
                     really the best job on the Internet</td>
         </tr>
         <tr><td>Contact:</td>
-            <td tal:content="view/getContact">bperson@dom.ain</td>
+            <td tal:content="request/contact">bperson@dom.ain</td>
         </tr>
         </table>
 
     <table border=0>
         <tr><td>
-        <input name="submit:method" type="submit" value="Submit">
-        <input name="edit:method" type="submit" value="Edit">
+        <input name="action:method" type="submit" value="Submit">
+        <input name="index:method" type="submit" value="Edit">
         <input name="cancel:method" type="submit" value="Cancel">
         </td></tr>
     </table>
         <input name="submitter" type="hidden" value="Submitter" size="72"
-                   tal:attributes="value view/getSubmitter" />
+                   tal:attributes="value request/submitter" />
         <input name="summary" type="hidden" value="Summary" size="72"
-                   tal:attributes="value view/getSummary" />
+                   tal:attributes="value request/summary" />
         <input name="description" type="hidden" value=""
-                   tal:attributes="value view/getDescription" />
+                   tal:attributes="value request/description" />
         <input name="contact" type="hidden" value="" size="72"
-                   tal:attributes="value view/getContact" />
+                   tal:attributes="value request/contact" />
     </form>    
 
 </body>


=== Packages/JobBoardEx/JobView.py 1.8.2.1 => 1.8.2.2 ===
 
     confirmed = PageTemplateFile('add_confirmed.pt')
-    
\ No newline at end of file
+    preview = PageTemplateFile('JobPreviewView.pt')
+    def _preview(self, submitter, summary, description, contact, REQUEST=None):
+        """Preview the job"""
+	self._submitter=submitter
+	self._summary=summary
+	self._description=description
+	self._contact=contact
+
+