[Zope-CVS] CVS: Packages/JobBoardEx/Views/Browser - ApproveJobs.pt:1.1 ApproveJobs.py:1.1 NewJob.pt:1.1 NewJob.py:1.1 Preview.pt:1.1 Waiting.pt:1.1 __init__.py:1.1

Barry Warsaw barry@wooz.org
Tue, 19 Mar 2002 18:08:59 -0500


Update of /cvs-repository/Packages/JobBoardEx/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv2357/Views/Browser

Added Files:
	ApproveJobs.pt ApproveJobs.py NewJob.pt NewJob.py Preview.pt 
	Waiting.pt __init__.py 
Log Message:
Initial checkins of views:

- ApproveJobs is the thing that a reviewer uses to approve or discard
  job submission.

- NewJob is the thing that a job submitter fills out

- Preview is where the job submitter lands after filling out their
  initial job submission

- Waiting is where the job submitter lands after submitting their
  previewed job submission


=== Added File Packages/JobBoardEx/Views/Browser/ApproveJobs.pt ===
<html>
<body>

    <form action="." method="post">
    <table border=0>
    <tr><th colspan=3>Action</th>
	<th rowspan=2>Summary</th>
    </tr>
    <tr><th>Defer</th><th>Approve</th><th>Discard</th>
    </tr>
    <tr tal:repeat="job python:here.query('waiting')"
	style="text-align:center">
	<td><input name="job_N" type="radio" value="defer" checked
		   tal:attributes="name python:'job_%s' % job.getId()"></td>
	<td><input name="job_N" type="radio" value="approve"
		   tal:attributes="name python:'job_%s' % job.getId()"></td>
	<td><input name="job_N" type="radio" value="discard"
		   tal:attributes="name python:'job_%s' % job.getId()"></td>
	</td>
	<td tal:content="job/getSummary">The best job on the Internet</td>
    </tr>
    <tr><td colspan="3">
	<input name="submit:method" type="submit" value="Submit">
	<input name="cancel:method" type="submit" value="Cancel">
    </td></tr>
    </table>
    </form>
	    
</html>
</body>


=== Added File Packages/JobBoardEx/Views/Browser/ApproveJobs.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

Revision information: $Id: ApproveJobs.py,v 1.1 2002/03/19 23:08:58 bwarsaw Exp $
"""

import os

from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
from Zope.ComponentArchitecture.ContextDependent import ContextDependent


class ApproveJobs(AttributePublisher, ContextDependent):
    index = PageTemplateFile('ApproveJobs.pt')

    def cancel(self, REQUEST):
        # XXX This redirect will change
        return REQUEST.RESPONSE.redirect('Hello.pt')

    def submit(self, REQUEST):
        """Approve a job."""
        joblist = self.getContext()
        for job in joblist.query('waiting'):
            jobid = 'job_%s' % job.getId()
            value = REQUEST.get(jobid, None)
            if value == 'defer':
                pass
            elif value == 'approve':
                job.approve()
            elif value == 'discard':
                # XXX This might change
                joblist.remove(job)
            else:
                # Malicious form poster!
                pass
        return self.index(REQUEST)


=== Added File Packages/JobBoardEx/Views/Browser/NewJob.pt ===
<html>
<body>

    <form action="." method="post">
    <table border=0>
    <tr><td>Submitter:</td>
	<td><input name="submitter" type="text" value=""
	           tal:attributes="value request/submitter|default" />
	</td>
    </tr>
    <tr><td>Summary:</td>
	<td><input name="summary" type="text" value=""
	           tal:attributes="value request/summary|default" />
	</td>
    </tr>
    <tr><td>Description:</td>
	<td><input name="description" type="text" value=""
	           tal:attributes="value request/description|default" />
	</td>
    </tr>
    <tr><td>Contact:</td>
	<td><input name="contact" type="text" value=""
	           tal:attributes="value request/contact|default" />
	</td>
    </tr>
    <tr><td colspan="2">
	<input name="preview:method" type="submit" value="Preview">
	<input name="cancel:method" type="submit" value="Cancel">
	<input name="reset" type="reset" value="Reset">
	</td>
    </tr>
    </table>
    </form>    

</body>
</html>

=== Added File Packages/JobBoardEx/Views/Browser/NewJob.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

Revision information: $Id: NewJob.py,v 1.1 2002/03/19 23:08:58 bwarsaw Exp $
"""

import os

from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
from Zope.ComponentArchitecture.ContextDependent import ContextDependent


class NewJob(AttributePublisher, ContextDependent):
    index = PageTemplateFile('NewJob.pt')

    preview = PageTemplateFile('Preview.pt')

    waiting = PageTemplateFile('Waiting.pt')

    def cancel(self, REQUEST):
        # XXX This redirect will change
        return REQUEST.RESPONSE.redirect('Hello.pt')

    home = cancel

    def submit(self, submitter, summary, description, contact, REQUEST):
        """Edits a job object."""
        joblist = self.getContext()
        # XXX: This method name may change
        joblist.addJob(submitter, summary, description, contact)
        return self.waiting(REQUEST)



=== Added File Packages/JobBoardEx/Views/Browser/Preview.pt ===
<html>
<body>

    <form action="." method="post">
    <input name="submitter" type="hidden" value=""
	       tal:attributes="value request/submitter" />
    
    <input name="summary" type="hidden" value=""
	       tal:attributes="value request/summary" />
    
    <input name="description" type="hidden" value=""
	       tal:attributes="value request/description" />
    
    <input name="contact" type="hidden" value=""
	       tal:attributes="value request/contact" />
    

    <table border=0>
    <tr><td>Submitter:</td>
	<td tal:content="request/submitter">aperson@dom.ain</td>
    </tr>
    <tr><td>Summary:</td>
	<td tal:content="request/summary">The best job on the Internet</td>
    </tr>
    <tr><td>Description:</td>
	<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="request/contact">bperson@dom.ain</td>
    </tr>
    <tr><td colspan="2">
	<input name="submit:method" type="submit" value="Submit">
	<input name="index:method" type="submit" value="Edit">
	<input name="cancel:method" type="submit" value="Cancel">
	</td>
    </tr>
    </table>
    </form>    

</body>
</html>

=== Added File Packages/JobBoardEx/Views/Browser/Waiting.pt ===
<html>
<body>
    <h3>Your job submission has been successfully completed, do you
	want to submit another one?
    </h3>
    <form action="." method="post">
    <input name="index:method" type="submit" value="Submit another job" />
    <input name="home:method" type="submit" value="Go back to home page" />

</body>
</html>

=== Added File Packages/JobBoardEx/Views/Browser/__init__.py ===