[Checkins] SVN: zopeorg.theme/trunk/zopeorg/theme/ - added new default view for Feature content type

Denis Mishunov spliter at is.lg.ua
Sun Feb 3 12:45:57 EST 2008


Log message for revision 83456:
  - added new default view for Feature content type
  - created new viewletManager that will contain all Feature-related stuff above the title, description and body

Changed:
  U   zopeorg.theme/trunk/zopeorg/theme/browser/configure.zcml
  A   zopeorg.theme/trunk/zopeorg/theme/browser/feature.pt
  A   zopeorg.theme/trunk/zopeorg/theme/browser/feature.py
  U   zopeorg.theme/trunk/zopeorg/theme/browser/interfaces.py
  U   zopeorg.theme/trunk/zopeorg/theme/content/feature.py
  U   zopeorg.theme/trunk/zopeorg/theme/profiles/default/types/Feature.xml
  U   zopeorg.theme/trunk/zopeorg/theme/profiles/default/viewlets.xml

-=-
Modified: zopeorg.theme/trunk/zopeorg/theme/browser/configure.zcml
===================================================================
--- zopeorg.theme/trunk/zopeorg/theme/browser/configure.zcml	2008-02-03 17:21:45 UTC (rev 83455)
+++ zopeorg.theme/trunk/zopeorg/theme/browser/configure.zcml	2008-02-03 17:45:56 UTC (rev 83456)
@@ -2,6 +2,8 @@
     xmlns="http://namespaces.zope.org/zope"
     xmlns:browser="http://namespaces.zope.org/browser"
     i18n_domain="zopeorg.theme">
+    
+    <include package="plone.app.contentmenu" />
 
     <!-- 'Zope.org Theme' Zope 3 skin layer -->
     <interface
@@ -19,13 +21,13 @@
         />        
 
     <!-- Feature viewlet -->
-    <browser:viewlet  
+    <!-- <browser:viewlet  
         name="zopeorg.feature"
         manager="plone.app.layout.viewlets.interfaces.IPortalTop"
         class=".viewlets.FeatureViewlet"
         layer=".interfaces.IThemeSpecific"
         permission="zope2.View" 
-        />
+        /> -->
         
     <!-- The customized search box -->
     <browser:viewlet
@@ -55,13 +57,13 @@
         />        
         
     <!-- The anonymous personal bar -->
-    <browser:viewlet
+    <!-- <browser:viewlet
         name="zopeorg.header.divider"
         manager="plone.app.layout.viewlets.interfaces.IPortalTop"
         class=".viewlets.ZopeorgHeaderDividerViewlet"
         layer=".interfaces.IThemeSpecific"
         permission="zope2.View" 
-        />     
+        /> -->     
         
     <!-- Content views (tabs) -->
     <browser:viewlet
@@ -97,7 +99,32 @@
         template="templates/zopeorg_copyright.pt"
         layer=".interfaces.IThemeSpecific"
         permission="zope2.View" 
-        />                         
+        />    
         
+    <!-- Default view for Feature content type -->
+    <browser:page
+        for=".interfaces.IFeature"
+        name="view"
+        class=".feature.FeatureView"
+        template="feature.pt"
+        permission="zope2.View"
+        />
+        
+    <browser:menuItem
+        for=".interfaces.IFeature"
+        menu="plone_displayviews"
+        title="Feature view"
+        action="@@view"
+        description="Default view for Feature object"
+        />
+        
+    <!-- New viewlet manager for Feature default view -->
+    <browser:viewletManager
+        name="zopeorg.featureview"
+        provides=".interfaces.IFeatureView"
+        permission="zope2.View"
+        class="plone.app.viewletmanager.manager.OrderedViewletManager"
+        />
+        
 
 </configure>

Added: zopeorg.theme/trunk/zopeorg/theme/browser/feature.pt
===================================================================
--- zopeorg.theme/trunk/zopeorg/theme/browser/feature.pt	                        (rev 0)
+++ zopeorg.theme/trunk/zopeorg/theme/browser/feature.pt	2008-02-03 17:45:56 UTC (rev 83456)
@@ -0,0 +1,57 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
+      xmlns:tal="http://xml.zope.org/namespaces/tal"
+      xmlns:metal="http://xml.zope.org/namespaces/metal"
+      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+      lang="en"
+      metal:use-macro="context/main_template/macros/master"
+      i18n:domain="plone">
+
+<body>
+    
+<metal:main fill-slot="main">
+    
+    <tal:main-macro metal:define-macro="main"
+        tal:define="kssClassesView context/@@kss_field_decorator_view;
+                    getKssClasses nocall:kssClassesView/getKssClassesInlineEditable;
+                    templateId template/getId;
+                    text here/getText;">
+        
+        <div tal:replace="structure provider:plone.abovecontenttitle" />
+
+        <h1 class="documentFirstHeading"> 
+            <metal:field use-macro="python:here.widget('title', mode='view')">
+            Title
+            </metal:field>
+        </h1>
+
+        <div tal:replace="structure provider:plone.belowcontenttitle" />
+
+        <p class="documentDescription">
+            <metal:field use-macro="python:here.widget('description', mode='view')">
+            Description
+            </metal:field>
+        </p>      
+
+        <div tal:replace="structure provider:plone.abovecontentbody" />
+
+        <p tal:condition="python: not text and is_editable"
+           i18n:translate="no_body_text"
+           class="discreet">
+            This item does not have any body text, click the edit tab to change it.
+        </p>
+        
+        <div tal:condition="text"
+             metal:use-macro="python:context.widget('text', mode='view')" />  
+             
+        <div metal:use-macro="here/document_relateditems/macros/relatedItems">
+            show related items if they exist
+        </div>
+        
+        <div tal:replace="structure provider:plone.belowcontentbody" />    
+        
+    </tal:main-macro>           
+        
+</metal:main>
+
+</body>
+</html>

Added: zopeorg.theme/trunk/zopeorg/theme/browser/feature.py
===================================================================
--- zopeorg.theme/trunk/zopeorg/theme/browser/feature.py	                        (rev 0)
+++ zopeorg.theme/trunk/zopeorg/theme/browser/feature.py	2008-02-03 17:45:56 UTC (rev 83456)
@@ -0,0 +1,11 @@
+from Products.Five.browser import BrowserView
+
+from Acquisition import aq_inner
+from Products.CMFCore.utils import getToolByName
+from plone.memoize.instance import memoize
+
+class FeatureView(BrowserView):
+    """ Default view for chain. This class contains all python that we need for
+        Feature objects.
+    """
+    pass
\ No newline at end of file

Modified: zopeorg.theme/trunk/zopeorg/theme/browser/interfaces.py
===================================================================
--- zopeorg.theme/trunk/zopeorg/theme/browser/interfaces.py	2008-02-03 17:21:45 UTC (rev 83455)
+++ zopeorg.theme/trunk/zopeorg/theme/browser/interfaces.py	2008-02-03 17:45:56 UTC (rev 83456)
@@ -1,4 +1,5 @@
 from zope.viewlet.interfaces import IViewletManager
+from zope.interface import Interface
 
 from plone.theme.interfaces import IDefaultPloneLayer
 
@@ -10,3 +11,13 @@
     """A viewlet manager that sits in the portal footer
        of zope.org site. Contains siteactions and copyright
     """
+    
+class IFeature(Interface):
+    """ Marker interface for Feature content type
+    """
+    
+class IFeatureView(IViewletManager):
+    """ A viewlet manager is used for Feature view. Contains Blurb, feature's
+        icon, featre's divider and so on
+    """
+    

Modified: zopeorg.theme/trunk/zopeorg/theme/content/feature.py
===================================================================
--- zopeorg.theme/trunk/zopeorg/theme/content/feature.py	2008-02-03 17:21:45 UTC (rev 83455)
+++ zopeorg.theme/trunk/zopeorg/theme/content/feature.py	2008-02-03 17:45:56 UTC (rev 83456)
@@ -12,6 +12,9 @@
 from zopeorg.theme import MessageFactory as _
 from zopeorg.theme.config import PROJECTNAME
 
+from zope.interface import implements
+from zopeorg.theme.browser.interfaces import IFeature
+
 FeatureSchema = ATDocumentSchema.copy() + Schema((
     TextField("blurb",
               required=True,
@@ -74,6 +77,8 @@
 
 class Feature(ATDocument):
     schema = FeatureSchema
+    
+    implements(IFeature)
 
     def __bobo_traverse__(self, REQUEST, name):
         """Transparent access to image scales. Copied from ATNewsItem.

Modified: zopeorg.theme/trunk/zopeorg/theme/profiles/default/types/Feature.xml
===================================================================
--- zopeorg.theme/trunk/zopeorg/theme/profiles/default/types/Feature.xml	2008-02-03 17:21:45 UTC (rev 83455)
+++ zopeorg.theme/trunk/zopeorg/theme/profiles/default/types/Feature.xml	2008-02-03 17:45:56 UTC (rev 83456)
@@ -14,9 +14,9 @@
  <property name="filter_content_types">True</property>
  <property name="allowed_content_types"/>
  <property name="allow_discussion">False</property>
- <property name="default_view">document_view</property>
+ <property name="default_view">view</property>
  <property name="view_methods">
-  <element value="document_view"/>
+  <element value="view"/>
  </property>
  <alias from="(Default)" to="(dynamic view)"/>
  <alias from="edit" to="atct_edit"/>

Modified: zopeorg.theme/trunk/zopeorg/theme/profiles/default/viewlets.xml
===================================================================
--- zopeorg.theme/trunk/zopeorg/theme/profiles/default/viewlets.xml	2008-02-03 17:21:45 UTC (rev 83455)
+++ zopeorg.theme/trunk/zopeorg/theme/profiles/default/viewlets.xml	2008-02-03 17:45:56 UTC (rev 83456)
@@ -2,10 +2,10 @@
 <object>
     <order manager="plone.portaltop" skinname="Zope.org Theme"    
            based-on="Plone Default">
-      <viewlet name="zopeorg.feature" 
+      <!-- <viewlet name="zopeorg.feature" 
                insert-after="plone.app.i18n.locales.languageselector" />
       <viewlet name="zopeorg.header.divider" 
-               insert-after="zopeorg.feature" />               
+               insert-after="zopeorg.feature" />      -->          
       <viewlet name="plone.contentviews" 
                insert-after="*" />               
     </order>    



More information about the Checkins mailing list