[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views/Browser - Adding.py:1.1 Edit.py:1.1 __init__.py:1.1 add.pt:1.1 configure.zcml:1.1 edit.pt:1.1
K.Narasimha Murthy
nmurthy@zeomega.com
Fri, 25 Oct 2002 03:39:51 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv13123
Added Files:
Adding.py Edit.py __init__.py add.pt configure.zcml edit.pt
Log Message:
Added Adding & Edit python & pt * configure files for adding SMTP Service TTW.
=== Added File Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views/Browser/Adding.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.
#
##############################################################################
"""
$Id: Adding.py,
"""
from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.OFS.Container.IAdding import IAdding
from Zope.App.OFS.Services.SmtpService.SmtpService \
import SmtpService
class Adding(BrowserView):
"""Adding component for service containers"""
menu_id = "add_smtp"
__used_for__ = IAdding
def action(self):
request = self.request
smtphost = request.get('smtphost')
smtpport = request.get('smtpport')
sh = SmtpService(smtphost, smtpport)
self.context.add(sh)
self.request.response.redirect(self.context.nextURL())
=== Added File Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views/Browser/Edit.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.
#
##############################################################################
"""
$Id: Adding.py,
"""
from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.OFS.Container.IAdding import IAdding
from Zope.App.OFS.Services.SmtpService.SmtpService \
import SmtpService
from Zope.Proxy.ProxyIntrospection import removeAllProxies
class Edit(BrowserView):
"""Editing smtp service container"""
def action(self):
request = self.request
smtphost = request.get('smtphost')
smtpport = request.get('smtpport')
smtpservice = removeAllProxies(self.context)
smtpservice.smtphost = smtphost
smtpservice.smtpport = smtpport
self.request.response.redirect('.')
def edit(self):
smtps = removeAllProxies(self.context)
smtphost = smtps.smtphost
smtpport = smtps.smtpport
return {
'smtphost': smtphost,
'smtpport': smtpport,
}
=== Added File Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views/Browser/__init__.py ===
##############################################################################
#
# Copyright (c) 2001, 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.
#
##############################################################################
"""Container package for TTW service-component implementations.
Each service should be in a subpackages. Each service subpackage
should have a Views subpackages with sub-packages for each view type
containing the views for the service.
"""
=== Added File Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views/Browser/add.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Add an SMTP Service</title></head>
<body>
<div metal:fill-slot="body">
<p>Enter the SmtpHost and SmtpPort</p>
<form action="action.html" method="post">
<table>
<tr>
<th>SMTP Host:</th>
<td><input name="smtphost" value="localhost"></td>
</tr>
<tr>
<th>SMTP Port:</th>
<td><input name="smtpport" size=4 value="25"></td>
</tr>
<tr>
<td colspan=2>
<input type="submit" value="Add"/>
</td>
</tr>
</table>
</form>
</div></body></html>
=== Added File Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views/Browser/configure.zcml ===
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
package="Zope.App.OFS.Services.SmtpService">
<browser:menu id="add_smtp"
title="Menu for adding new smtp." />
<browser:defaultView
for=".ISMTPService."
name="index.html" />
<browser:view
for="Zope.App.OFS.Container.IAdding."
name="SmtpService"
factory=".Views.Browser.Adding." >
<browser:page name="add.html" template="Views/Browser/add.pt" />
<browser:page name="action.html" attribute="action" />
</browser:view>
<browser:defaultView for=".ISMTPService." name="edit.html" />
<browser:view
for=".ISMTPService."
factory=".Views.Browser.Edit."
>
<browser:page name="edit.html" template="Views/Browser/edit.pt" />
<browser:page name="action.html" attribute="action" />
</browser:view>
<browser:menuItem menu="add_component" for="Zope.App.OFS.Container.IAdding."
action="SmtpService" title="SMTP Service"
/>
</zopeConfigure>
=== Added File Zope3/lib/python/Zope/App/OFS/Services/SmtpService/Views/Browser/edit.pt ===
<html metal:use-macro="views/standard_macros/page">
<head><title>Edit an SMTP Service</title></head>
<body>
<div metal:fill-slot="body">
<p>Enter the SmtpHost and SmtpPort</p>
<form action="action.html" method=post
tal:define = "data view/edit"
>
<table>
<tr>
<th>SMTP Host:</th>
<td><input type=text name=smtphost tal:attributes="value data/smtphost">
</td>
</tr>
<tr>
<th>SMTP Port:</th>
<td><input type=text name=smtpport size=4 tal:attributes="value data/smtpport">
</td>
</tr>
<tr>
<td colspan=2>
<input type="submit" value="Edit"/>
</td>
</tr>
</table>
</form>
</div></body></html>