[Zope-CVS] SVN: ldapauth/trunk/ Added own contents view without add and edit function instead of inherited IContainer contents view.

Roger Ineichen roger at projekt01.ch
Tue Jul 6 17:00:38 EDT 2004


Log message for revision 26144:
Added own contents view without add and edit function instead of inherited IContainer contents view.
Added initial connection test view for to check the LDAP server via Zope view.
Added Changes.txt for to report changes
Move view configuration to own browser subpackage


-=-
Added: ldapauth/trunk/CHANGES.txt
===================================================================
--- ldapauth/trunk/CHANGES.txt	2004-07-06 21:00:02 UTC (rev 26143)
+++ ldapauth/trunk/CHANGES.txt	2004-07-06 21:00:37 UTC (rev 26144)
@@ -0,0 +1,12 @@
+CHANGES
+
+
+  Principal/Contents and initial connection test view, roger.ineichen, 06.07.2004
+
+    - Added browser package
+
+    - Added contents view class and contents view 
+
+    - Split configure.zcml, and move view related stuff to .browser/configure.zcml  
+
+    - Added initial test page for to test the given connection


Property changes on: ldapauth/trunk/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: ldapauth/trunk/browser/__init__.py
===================================================================
--- ldapauth/trunk/browser/__init__.py	2004-07-06 21:00:02 UTC (rev 26143)
+++ ldapauth/trunk/browser/__init__.py	2004-07-06 21:00:37 UTC (rev 26144)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# 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.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.
+#
+##############################################################################
+"""A plugable authentication module for LDAP.
+
+$Id:
+"""

Added: ldapauth/trunk/browser/checkconnection.pt
===================================================================
--- ldapauth/trunk/browser/checkconnection.pt	2004-07-06 21:00:02 UTC (rev 26143)
+++ ldapauth/trunk/browser/checkconnection.pt	2004-07-06 21:00:37 UTC (rev 26144)
@@ -0,0 +1,26 @@
+<html metal:use-macro="views/standard_macros/view">
+<body>
+<div metal:fill-slot="body">
+  <div metal:define-macro="contents">
+
+    Here should be the form for to set the test data!
+
+    <table id="sortable" class="listing" summary="Principal listing"
+           i18n:attributes="summary">
+      <thead>
+        <tr>
+          <th i18n:translate="">Test report</th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr tal:repeat="entry view/checkConnection" >
+          <td>
+					<span tal:content="entry">login</span>
+          </td>
+        </tr>
+      </tbody>
+    </table>
+  </div>
+</div>
+</body>
+</html>


Property changes on: ldapauth/trunk/browser/checkconnection.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: ldapauth/trunk/browser/checkconnection.py
===================================================================
--- ldapauth/trunk/browser/checkconnection.py	2004-07-06 21:00:02 UTC (rev 26143)
+++ ldapauth/trunk/browser/checkconnection.py	2004-07-06 21:00:37 UTC (rev 26144)
@@ -0,0 +1,54 @@
+##############################################################################
+#
+# 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.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.
+#
+##############################################################################
+"""View Class for the Container's Contents view.
+
+$Id: contents.py 25177 2004-06-02 13:17:31Z jim $
+"""
+
+from zope.exceptions import NotFoundError
+
+from zope.app import zapi
+from zope.app.size.interfaces import ISized
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.publisher.browser import BrowserView
+from zope.app.i18n import ZopeMessageIDFactory as _
+
+from ldapauth.interfaces import ILDAPBasedPrincipalSource
+
+
+
+class CheckConnectionView(BrowserView):
+
+    __used_for__ = ILDAPBasedPrincipalSource
+
+
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+        self.__parent__ = context
+        self.report = []
+
+    def checkConnection(self):
+        """Check connetction to the given LDAP server."""
+        report = []
+
+        self._addInfo("Report traceback")
+
+        return self.report
+
+    def _addInfo(self, res):
+        """Add traceback info to the report list"""
+        self.report.append(res)
+
+    check = ViewPageTemplateFile('checkconnection.pt')


Property changes on: ldapauth/trunk/browser/checkconnection.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: ldapauth/trunk/browser/configure.zcml
===================================================================
--- ldapauth/trunk/browser/configure.zcml	2004-07-06 21:00:02 UTC (rev 26143)
+++ ldapauth/trunk/browser/configure.zcml	2004-07-06 21:00:37 UTC (rev 26144)
@@ -0,0 +1,44 @@
+<zope:configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser">
+
+    <!-- LDAPPrincipalSource -->
+    <addMenuItem
+        title="Add LDAP Principal Source"
+        class="ldapauth.LDAPPrincipalSource"
+        permission="zope.ManageServices" />
+
+    <addform
+        schema="ldapauth.interfaces.ILDAPBasedPrincipalSource" 
+        label="Add LDAP-based Principal Source" 
+        name="AddLDAPPrincipalSourceForm" 
+        permission="zope.ManageContent" />
+
+    <!-- provide a own Contents view without add and delete functions -->
+    <page
+        for="ldapauth.interfaces.ILDAPBasedPrincipalSource"
+        name="principals.html"
+        attribute="principals"
+        class=".principals.Principals"
+        menu="zmi_views" title="Contents"
+        permission="zope.ManageContent"/>
+
+    <editform 
+        schema="ldapauth.interfaces.ILDAPBasedPrincipalSource" 
+        label="Edit LDAP-based Principal Source" 
+        name="edit.html"        
+        menu="zmi_views" title="Edit" 
+        permission="zope.ManageContent" />
+
+    <!-- connetion test view -->
+    <page
+        for="ldapauth.interfaces.ILDAPBasedPrincipalSource"
+        name="checkconnection.html"
+        attribute="check"
+        class=".checkconnection.CheckConnectionView"
+        menu="zmi_views" title="Test"
+        permission="zope.ManageServices"/>
+
+
+
+</zope:configure>

Added: ldapauth/trunk/browser/principals.pt
===================================================================
--- ldapauth/trunk/browser/principals.pt	2004-07-06 21:00:02 UTC (rev 26143)
+++ ldapauth/trunk/browser/principals.pt	2004-07-06 21:00:37 UTC (rev 26144)
@@ -0,0 +1,30 @@
+<html metal:use-macro="views/standard_macros/view">
+<body>
+<div metal:fill-slot="body">
+  <div metal:define-macro="contents">
+    <table id="sortable" class="listing" summary="Principal listing"
+           i18n:attributes="summary">
+      <thead>
+        <tr>
+          <th i18n:translate="">Login</th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr tal:repeat="principal view/getPrincipals" >
+          <td>
+					  <span tal:content="python:principal.getLogin()">login</span>
+          </td>
+        </tr>
+      </tbody>
+    </table>
+  </div>
+  <!-- show the error message -->
+  <div class="page_error"
+       tal:condition="view/error"
+       tal:content="view/error"
+       i18n:translate="">
+    Error message
+  </div>
+</div>
+</body>
+</html>


Property changes on: ldapauth/trunk/browser/principals.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: ldapauth/trunk/browser/principals.py
===================================================================
--- ldapauth/trunk/browser/principals.py	2004-07-06 21:00:02 UTC (rev 26143)
+++ ldapauth/trunk/browser/principals.py	2004-07-06 21:00:37 UTC (rev 26144)
@@ -0,0 +1,47 @@
+##############################################################################
+#
+# 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.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.
+#
+##############################################################################
+"""View Class for the Container's Contents view.
+
+$Id: contents.py 25177 2004-06-02 13:17:31Z jim $
+"""
+
+from zope.exceptions import NotFoundError
+
+from zope.app import zapi
+from zope.app.size.interfaces import ISized
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.app.publisher.browser import BrowserView
+from zope.app.i18n import ZopeMessageIDFactory as _
+
+from ldapauth.interfaces import ILDAPBasedPrincipalSource
+
+
+class Principals(BrowserView):
+
+    __used_for__ = ILDAPBasedPrincipalSource
+
+    error = ""
+
+    def getPrincipals(self):
+        context = self.context
+        request = self.request
+        try:
+            principals = self.context.getPrincipals()
+        except :
+            principals = []
+            self.error = _("Error, No LDAP server or connection found")
+        
+        return principals
+
+    principals = ViewPageTemplateFile('principals.pt')


Property changes on: ldapauth/trunk/browser/principals.py
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: ldapauth/trunk/configure.zcml
===================================================================
--- ldapauth/trunk/configure.zcml	2004-07-06 21:00:02 UTC (rev 26143)
+++ ldapauth/trunk/configure.zcml	2004-07-06 21:00:37 UTC (rev 26144)
@@ -14,28 +14,14 @@
             set_schema=".interfaces.ILDAPBasedPrincipalSource"/>
     </content>
 
-    <browser:addMenuItem
-        title="Add LDAP Principal Source"
-        class=".LDAPPrincipalSource"
-        permission="zope.ManageServices" />
+    <!-- add browser views -->
+    <include package=".browser" />
 
-    <browser:addform
-        schema=".interfaces.ILDAPBasedPrincipalSource" 
-        label="Add LDAP-based Principal Source" 
-        name="AddLDAPPrincipalSourceForm" 
-        permission="zope.ManageContent" /> 
-
-    <browser:editform 
-        schema=".interfaces.ILDAPBasedPrincipalSource" 
-        label="Edit LDAP-based Principal Source" 
-        name="edit.html"        
-        menu="zmi_views" title="Edit" 
-        permission="zope.ManageContent" /> 
-
     <!-- add onlinehelp text -->
     <help:register
         id="ldapauth"
         title="LDAP Auth"
         doc_path="./help/ldapauth.stx" />
 
+
 </configure>



More information about the Zope-CVS mailing list