[Zope3-checkins] SVN: Zope3/branches/roger-bostonskin/src/zope/app/boston/ Added adding info viewlet

Roger Ineichen roger at projekt01.ch
Sat Oct 8 06:27:45 EDT 2005


Log message for revision 38931:
  Added adding info viewlet
  Register adding info viewlet for Boston skin

Changed:
  U   Zope3/branches/roger-bostonskin/src/zope/app/boston/browser/template.pt
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/__init__.py
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/__init__.py
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/addinginfo.pt
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/configure.zcml
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/views.py
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/configure.zcml
  A   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/interfaces.py
  U   Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/configure.zcml

-=-
Modified: Zope3/branches/roger-bostonskin/src/zope/app/boston/browser/template.pt
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/browser/template.pt	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/browser/template.pt	2005-10-08 10:27:45 UTC (rev 38931)
@@ -39,11 +39,9 @@
     <tr class="menu">
       <td colspan="2">
         <!-- toolbar region (zmi_action) -->
-<!--
         <metal:block tal:repeat="provider providers:zope.app.boston.regions.IToolBar">
           <tal:block replace="structure provider" />
         </metal:block>
--->
         <div id="userdetails">
           <metal:block define-macro="logged_user">
             <span tal:omit-tag="" i18n:translate="">User:</span>

Added: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/__init__.py
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/__init__.py	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/__init__.py	2005-10-08 10:27:45 UTC (rev 38931)
@@ -0,0 +1,18 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Boston skin
+
+$Id:$
+"""
+    


Property changes on: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/__init__.py
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/__init__.py	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/__init__.py	2005-10-08 10:27:45 UTC (rev 38931)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Boston skin
+
+$Id:$
+"""


Property changes on: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/addinginfo.pt
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/addinginfo.pt	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/addinginfo.pt	2005-10-08 10:27:45 UTC (rev 38931)
@@ -0,0 +1,48 @@
+<html i18n:domain="tiks" tal:omit-tag="">
+<body tal:omit-tag="">
+	<div class="slotbox" id="addinginfobox">
+		<div class="header">
+			<div class="title" i18n:translate=""
+						tal:content="viewlet/getTitle">Adding info</div>
+		</div>
+		<div class="body"
+					tal:define="addingInfo viewlet/addingInfo;
+											nameAllowed viewlet/nameAllowed;
+											baseurl python:request.getURL(1)">
+		<tal:block condition="addingInfo">
+			<tal:block repeat="info addingInfo">
+				<div tal:define="oddrow repeat/info/odd;
+						 						has_custom_add_view python:'has_custom_add_view' in info"
+						 tal:attributes="class python:oddrow and 'content even' or 'content odd'"
+						 class="even">
+					<a href="#"
+						tal:condition="python: not info['action'].startswith('../')
+																	 and nameAllowed and not has_custom_add_view"
+						tal:attributes="href string:${baseurl}/@@contents.html?type_name=${info/action};
+							class info/selected"
+						tal:content="info/title" i18n:translate="">Folder
+					</a>
+					
+					<a href="#"
+						tal:condition="python: not info['action'].startswith('../') 
+											 and (has_custom_add_view or not nameAllowed)"
+						tal:attributes="
+							href string:${baseurl}/@@+/action.html?type_name=${info/action};
+							class info/selected"
+						tal:content="info/title" i18n:translate="">Folder
+					</a>
+		
+					<a href="#"
+						tal:condition="python: info['action'].startswith('../')"
+						tal:attributes="
+							href python: info['action'][3:];
+							class info/selected"
+						tal:content="info/title" i18n:translate="">Folder
+					</a>
+				</div>
+      </tal:block>
+		</tal:block>
+		</div>
+	</div>
+</body>
+</html>


Property changes on: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/addinginfo.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/configure.zcml
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/configure.zcml	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/configure.zcml	2005-10-08 10:27:45 UTC (rev 38931)
@@ -0,0 +1,17 @@
+<configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    xmlns="http://namespaces.zope.org/browser"
+    i18n_domain="zope">
+
+  <viewlet
+      name="addinginfo"
+      for="zope.app.container.interfaces.IWriteContainer"
+      region="zope.app.boston.regions.ILeft"
+      permission="zope.ManageContent"
+      class=".views.AddingInfoViewlet"
+      template="addinginfo.pt"
+      layer="zope.app.boston.boston"
+      weight="3"
+      />
+
+</configure>
\ No newline at end of file


Property changes on: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/views.py
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/views.py	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/views.py	2005-10-08 10:27:45 UTC (rev 38931)
@@ -0,0 +1,61 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Boston skin
+
+$Id:$
+"""
+
+from zope.interface import implements
+from zope.viewlet.viewlet import SimpleViewlet
+
+from zope.app.container.interfaces import IAdding
+from zope.app.zapi import queryMultiAdapter
+
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.boston.viewlets.addinginfo.interfaces import IAddingInfoViewlet
+
+
+
+class AddingInfoViewlet(SimpleViewlet):
+    """I18n info viewlet."""
+
+    implements(IAddingInfoViewlet)
+
+    def __init__(self, context, request, view):
+        super(AddingInfoViewlet, self).__init__(context, request, view)
+        self.__setUp()
+
+    def getTitle(self):
+        """Get title of viewlet"""
+        return _("Adding info")
+
+    def addingInfo(self):
+        """Get adding info from IAdding view."""
+        if self.__addingView is not None:
+            return self.__addingView.addingInfo()
+        else:
+            return {}
+
+    def nameAllowed(self):
+        """Return whether names can be input by the user."""
+        if self.__addingView is not None:
+            return self.__addingView.nameAllowed()
+        else:
+            return False
+
+    # helper method
+    def __setUp(self):
+        """Setup here, so we don't call something twice."""
+        objs = (self.context, self.request)
+        self.__addingView = queryMultiAdapter(objs, name='+')


Property changes on: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/browser/views.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/configure.zcml
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/configure.zcml	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/configure.zcml	2005-10-08 10:27:45 UTC (rev 38931)
@@ -0,0 +1,7 @@
+<configure
+    xmlns:zope="http://namespaces.zope.org/zope"
+    i18n_domain="zope">
+
+  <include package=".browser" />
+
+</configure>
\ No newline at end of file


Property changes on: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/interfaces.py
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/interfaces.py	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/interfaces.py	2005-10-08 10:27:45 UTC (rev 38931)
@@ -0,0 +1,38 @@
+##############################################################################
+#
+# Copyright (c) 2005 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.
+#
+##############################################################################
+"""Boston skin
+
+$Id:$
+"""
+
+__docformat__ = "reStructuredText"
+
+from zope.viewlet.interfaces import IViewlet
+
+
+
+class IAddingInfoViewlet(IViewlet):
+    """Adding info API for the adapted context."""
+
+    def getTitle():
+        """Get title of viewlet"""
+
+    def addingInfo():
+        """Get adding info from IAdding view. Return menu data.
+
+        This is sorted by title.
+        """
+
+    def nameAllowed(self):
+        """Return whether names can be input by the user."""
\ No newline at end of file


Property changes on: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/addinginfo/interfaces.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/configure.zcml
===================================================================
--- Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/configure.zcml	2005-10-08 10:23:16 UTC (rev 38930)
+++ Zope3/branches/roger-bostonskin/src/zope/app/boston/viewlets/configure.zcml	2005-10-08 10:27:45 UTC (rev 38931)
@@ -18,6 +18,7 @@
 -->
 
   <!-- ILeft slot pagelets -->
+  <include package=".addinginfo" />
 <!--
   <include file="zmicookietreebox.zcml" />
   <include file="addbox.zcml" />



More information about the Zope3-Checkins mailing list