[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Service - ServiceManagerContents.py:1.1.2.1 main.pt:1.1.2.1
Nick Garcia
ngarcia@codeit.com
Sat, 9 Feb 2002 11:34:31 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Service
In directory cvs.zope.org:/tmp/cvs-serv17958/lib/python/Zope/App/Service
Added Files:
Tag: Zope-3x-branch
ServiceManagerContents.py main.pt
Log Message:
Created Contents view for Service Manager.
Create test for Contents view for Service Manager.
Create Page Template for Contents view for Service Manager.
=== Added File Zope3/lib/python/Zope/App/Service/ServiceManagerContents.py ===
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (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.
"""
Define view component for service manager contents.
"""
from Zope.App.OFS.Folder.FolderContents import FolderContents
from Interface.Util import flattenInterfaces, objectImplements
class ServiceManagerContents( FolderContents ):
def _extractContentInfo( self, item ):
info = FolderContents._extractContentInfo(self, item)
implements = objectImplements(info['object'])
interfaces = flattenInterfaces(implements)
interface_names = [ x.getName() for x in interfaces if x.getName() != 'Interface' ]
info['interfaces'] = interface_names
return info
=== Added File Zope3/lib/python/Zope/App/Service/main.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
<style metal:fill-slot="headers" type="text/css">
<!--
.ContentListing {
width: 100%;
}
.ContentIcon {
width: 20px;
}
.ContentTitle {
text-align: left;
}
.ContentInterface {
text-align: left;
}
-->
</style>
</head>
<body>
<div metal:fill-slot="body">
<form action="contents;view" method="get">
<table class="ContentListing">
<caption>Service Manager Contents <a href="adder;view"> Add... </a> </caption>
<tbody>
<tr>
<td> </td>
<td class="ContentIcon"><br /> </td>
<th class="ContentTitle">Title</th>
<th class="ContentInterface">Interfaces</th>
</tr>
<!--
** listContentInfo returns a sequence of mappings, containing:
** 'id' : the ID of the contained within the container
** 'url' : the absolute URL of the contained object
** 'title' : the title of the contained object
** 'icon' : the absolute URL of the icon, for the contained object
(may be None)
** 'interfaces' : the interfaces that this service implements
-->
<tr tal:repeat="info container/listContentInfo">
<td class="ContentSelect" valign="top">
<input type="checkbox" name="ids:list" value="id"
tal:attributes="value info/id" />
</td>
<td class="ContentIcon" valign="top">
<img alt="Service A Icon" src="../../ZMI/www/folder_icon.gif"
tal:condition="info/url"
tal:attributes="src info/url" />
</td>
<td class="ContentTitle" valign="top">
<a href="service_a_id"
tal:attributes="href info/url"
tal:content="info/title"
>Service A Title or ID here</a>
</td>
<td class="ContentInterface">
<div tal:repeat="interface info/interfaces">
<span tal:replace="interface">Interface Name</span><br/>
</div>
</td>
</tr>
<tr tal:condition="nothing">
<td class="ContentSelect" valign="top">
<input type="checkbox" name="ids:list" value="id">
</td>
<td class="ContentIcon" valign="top">
<img alt="Service B Icon" src="../../ZMI/www/document_icon.gif" />
</td>
<td class="ContentTitle" valign="top">
<a href="service_b_id">Service B Title or ID here</a>
</td>
<td class="ContentInterface">
Interface A<br/>
Interface B<br/>
</td>
</tr>
</tbody>
</table>
<br />
<input type="submit" name="removeObjects:method" value="Delete"
i18n:attributes="value string:menu_delete_button">
</form>
</div>
</body>
</html>