[Zope3-checkins] SVN: ldapauth/trunk/browser/ Added Manager view for to edit principals

Roger Ineichen roger at projekt01.ch
Wed Jul 21 18:20:42 EDT 2004


Log message for revision 26664:
  Added Manager view for to edit principals
  Added url and icon to the Contents and Managerview
  Added icon for principals


Changed:
  A   ldapauth/trunk/browser/manager.pt
  A   ldapauth/trunk/browser/principal.gif
  A   ldapauth/trunk/browser/principal.pt
  U   ldapauth/trunk/browser/principal.zcml
  U   ldapauth/trunk/browser/source.pt
  U   ldapauth/trunk/browser/source.py
  U   ldapauth/trunk/browser/source.zcml


-=-
Added: ldapauth/trunk/browser/manager.pt
===================================================================
--- ldapauth/trunk/browser/manager.pt	2004-07-21 21:45:32 UTC (rev 26663)
+++ ldapauth/trunk/browser/manager.pt	2004-07-21 22:20:42 UTC (rev 26664)
@@ -0,0 +1,50 @@
+<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><span i18n:translate="">Login Attribute: </span>
+						(<span tal:content="view/getLoginAttribute" tal:omit-tag="">cn</span>=*)</th>
+          <th i18n:translate="">Title</th>
+          <th i18n:translate="">Description</th>
+        </tr>
+      </thead>
+      <tbody>
+        <metal:block tal:repeat="info python:view.getUserInfos()">
+					<tr tal:define="oddrow repeat/info/odd; url info/url"
+              tal:attributes="class python:oddrow and 'even' or 'odd'" >
+						<td><a href="#"
+									 tal:attributes="href
+																	 string:${url}/@@SelectedManagementView.html"
+									 tal:content="structure info/icon|default">
+									</a>
+                  <a href="#"
+                     tal:attributes="href
+                                 string:${url}/@@SelectedManagementView.html"
+                     tal:content="python:info['login']"
+                     >login</a>
+						</td>
+						<td>
+							<span tal:content="python:info['title']">title</span>
+						</td>
+						<td>
+							<span tal:content="python:info['description']">description</span>
+						</td>
+					</tr>
+        </metal:block>
+      </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/manager.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: ldapauth/trunk/browser/principal.gif
===================================================================
(Binary files differ)


Property changes on: ldapauth/trunk/browser/principal.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: ldapauth/trunk/browser/principal.pt
===================================================================
--- ldapauth/trunk/browser/principal.pt	2004-07-21 21:45:32 UTC (rev 26663)
+++ ldapauth/trunk/browser/principal.pt	2004-07-21 22:20:42 UTC (rev 26664)
@@ -0,0 +1,39 @@
+<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><span i18n:translate="">Login Attribute: </span>
+						(<span tal:content="view/getLoginAttribute" tal:omit-tag="">cn</span>=*)</th>
+          <th i18n:translate="">Title</th>
+          <th i18n:translate="">Description</th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr tal:repeat="info python:view.getUserInfos()" >
+          <td>
+					  <span tal:content="python:info['login']">login</span>
+          </td>
+          <td>
+					  <span tal:content="python:info['title']">title</span>
+          </td>
+          <td>
+					  <span tal:content="python:info['description']">description</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/principal.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: ldapauth/trunk/browser/principal.zcml
===================================================================
--- ldapauth/trunk/browser/principal.zcml	2004-07-21 21:45:32 UTC (rev 26663)
+++ ldapauth/trunk/browser/principal.zcml	2004-07-21 22:20:42 UTC (rev 26664)
@@ -3,6 +3,11 @@
     xmlns="http://namespaces.zope.org/browser">
 
     <!-- LDAP principal manager -->
+    <icon
+        name="zmi_icon"
+        for="zope.app.pluggableauth.interfaces.IPrincipal"
+        file="principal.gif"
+        />
 
 
 </configure>

Modified: ldapauth/trunk/browser/source.pt
===================================================================
--- ldapauth/trunk/browser/source.pt	2004-07-21 21:45:32 UTC (rev 26663)
+++ ldapauth/trunk/browser/source.pt	2004-07-21 22:20:42 UTC (rev 26664)
@@ -13,17 +13,21 @@
         </tr>
       </thead>
       <tbody>
-        <tr tal:repeat="info python:view.getUserInfos()" >
-          <td>
-					  <span tal:content="python:info['login']">login</span>
-          </td>
-          <td>
-					  <span tal:content="python:info['title']">title</span>
-          </td>
-          <td>
-					  <span tal:content="python:info['description']">description</span>
-          </td>
-        </tr>
+        <metal:block tal:repeat="info python:view.getUserInfos()">
+					<tr tal:define="oddrow repeat/info/odd"
+              tal:attributes="class python:oddrow and 'even' or 'odd'" >
+						<td>
+							<span tal:content="structure info/icon|default"></span>
+              <span tal:content="python:info['login']">login</span>
+						</td>
+						<td>
+							<span tal:content="python:info['title']">title</span>
+						</td>
+						<td>
+							<span tal:content="python:info['description']">description</span>
+						</td>
+					</tr>
+        </metal:block>
       </tbody>
     </table>
   </div>

Modified: ldapauth/trunk/browser/source.py
===================================================================
--- ldapauth/trunk/browser/source.py	2004-07-21 21:45:32 UTC (rev 26663)
+++ ldapauth/trunk/browser/source.py	2004-07-21 22:20:42 UTC (rev 26664)
@@ -46,7 +46,12 @@
         
         for principal in principals:
             info = trustedRemoveSecurityProxy(principal)
+            zmi_icon = zapi.queryView(info, 'zmi_icon', request)
             entry = {}
+            if zmi_icon is None:
+                entry['icon'] = None
+            else:
+                entry['icon'] = zmi_icon()
             entry['login'] = info.getLogin()
             entry['title'] = info.title
             entry['description'] = info.description
@@ -64,3 +69,40 @@
 
 
     contents = ViewPageTemplateFile('source.pt')
+
+
+
+class PrincipalSourceManager(PrincipalSource):
+
+    __used_for__ = ILDAPBasedPrincipalSource
+
+    error = ""
+
+    def getUserInfos(self):
+        context = self.context
+        request = self.request
+        infoList = []
+        try:
+            principals = self.context.getPrincipals(name='')
+        except :
+            principals = []
+            self.error = _("Error, No LDAP server or connection found")
+        
+        for principal in principals:
+            info = trustedRemoveSecurityProxy(principal)
+            zmi_icon = zapi.queryView(info, 'zmi_icon', request)
+            entry = {}
+            if zmi_icon is None:
+                entry['icon'] = None
+            else:
+                entry['icon'] = zmi_icon()
+            entry['url'] = info.id
+            entry['login'] = info.getLogin()
+            entry['title'] = info.title
+            entry['description'] = info.description
+            infoList.append(entry)
+        
+        return infoList
+
+
+    manager = ViewPageTemplateFile('manager.pt')

Modified: ldapauth/trunk/browser/source.zcml
===================================================================
--- ldapauth/trunk/browser/source.zcml	2004-07-21 21:45:32 UTC (rev 26663)
+++ ldapauth/trunk/browser/source.zcml	2004-07-21 22:20:42 UTC (rev 26664)
@@ -15,7 +15,7 @@
         permission="zope.ManageContent" />
 
     <!-- provide a own Contents view without add and delete functions 
-         Perhaps we enhance this view later. At this time we use thos view
+         Perhaps we enhance this view later. At this time we use this view
          instead of the inherited Contents view from the ocntainer. -->
     <page
         for="ldapauth.interfaces.ILDAPBasedPrincipalSource"
@@ -25,6 +25,15 @@
         menu="zmi_views" title="Contents"
         permission="zope.ManageContent"/>
 
+    <!-- provide a own Contents view with add and delete functions. -->
+    <page
+        for="ldapauth.interfaces.ILDAPBasedPrincipalSource"
+        name="manager.html"
+        attribute="manager"
+        class=".source.PrincipalSourceManager"
+        menu="zmi_views" title="Manager"
+        permission="zope.ManageContent"/>
+
     <editform 
         schema="ldapauth.interfaces.ILDAPBasedPrincipalSource" 
         label="Edit LDAP-based Principal Source" 



More information about the Zope3-Checkins mailing list