Author: jmorliaguet
Date: Mon Jun  5 00:20:55 2006
New Revision: 3305

Modified:
   cpsskins/branches/paris-sprint-2006/elements/display.py
   cpsskins/branches/paris-sprint-2006/elements/slot.py
   cpsskins/branches/paris-sprint-2006/standard/displays/configure.zcml
   
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt

Log:

- added support for displaying slot items that are visible in the current
  perspective only or to ignore perspectives.

  this is a property of the display element associated to the slot
  (not a property of the slot itself).



Modified: cpsskins/branches/paris-sprint-2006/elements/display.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/elements/display.py     (original)
+++ cpsskins/branches/paris-sprint-2006/elements/display.py     Mon Jun  5 
00:20:55 2006
@@ -34,6 +34,9 @@
 from cpsskins.storage.displays import IDisplayStorage
 from cpsskins.utils import getThemeManager
 
+USE_CURRENT_PERSPECTIVE = 1
+IGNORE_PERSPECTIVES = 2
+
 class Display(Element):
 
     implements(IDisplay)

Modified: cpsskins/branches/paris-sprint-2006/elements/slot.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/elements/slot.py        (original)
+++ cpsskins/branches/paris-sprint-2006/elements/slot.py        Mon Jun  5 
00:20:55 2006
@@ -21,6 +21,8 @@
 from zope.component import adapts, getUtility
 from zope.component.factory import Factory
 
+from cpsskins.elements.display import IGNORE_PERSPECTIVES
+from cpsskins.elements.display import USE_CURRENT_PERSPECTIVE
 from cpsskins.elements.element import InnerNode
 from cpsskins.elements.interfaces import ISlot, INodeTraverser
 from cpsskins.ontology import hasPortlet, hasPortletFromPerspective
@@ -104,15 +106,11 @@
         node = self.node
         reltool = IRelationTool(node)
 
-        if perspective is None:
-            portlets = reltool.getSeconds(
-                predicate=hasPortlet,
-                first=node)
-        else:
-            portlets = reltool.getSeconds(
-                predicate=hasPortletFromPerspective,
-                first=node,
-                third=perspective)
+        if perspective is None or display.mode == IGNORE_PERSPECTIVES:
+            portlets = reltool.getSeconds(predicate=hasPortlet, first=node)
+        elif display.mode == USE_CURRENT_PERSPECTIVE:
+            portlets = reltool.getSeconds(predicate=hasPortletFromPerspective,
+                                          first=node, third=perspective)
 
         # the portlet order is obtained from the display, if the display is
         # iterable otherwise the portlets are sorted by their identifier.

Modified: cpsskins/branches/paris-sprint-2006/standard/displays/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/displays/configure.zcml        
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/displays/configure.zcml        
Mon Jun  5 00:20:55 2006
@@ -1,4 +1,5 @@
 <configure
+    xmlns="http://namespaces.zope.org/zope";
     xmlns:cpsskins="http://namespaces.zope.org/cpsskins";
     xmlns:i18n="http://namespaces.zope.org/i18n";
     i18n_domain="cpsskins"
@@ -28,4 +29,10 @@
       class=".boxgroup.BoxGroup"
   />
 
+  <utility 
+     provides="zope.schema.interfaces.IVocabularyFactory"
+     component=".boxgroup.DisplayModes"
+     name="Display Modes"
+  />
+
 </configure>

Modified: 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt
==============================================================================
--- 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt  
    (original)
+++ 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt  
    Mon Jun  5 00:20:55 2006
@@ -26,8 +26,8 @@
       <a i18n:translate="" tal:content="info/element/name" tal:attributes="
          href 
string:javascript:CPSSkins.getModelById('element-editor').updateData({form: 
{id: '$id', mode: 'edit'}})" /></li>
     <li>
-      <a i18n:translate="" tal:content="display/type:name" tal:attributes="
-         href 
string:javascript:CPSSkins.getModelById('element-editor').updateData({form: 
{id: $id, tab: '${display/type:name}'}})" /></li>
+      <a i18n:translate="" tal:attributes="
+         href 
string:javascript:CPSSkins.getModelById('element-editor').updateData({form: 
{id: $id, tab: '${display/type:name}'}})">Display</a></li>
     <li tal:repeat="format info/formats">
       <a i18n:translate="" tal:attributes="
          href 
string:javascript:CPSSkins.getModelById('element-editor').updateData({form: 
{id: $id, display: $display_id, format: ${format/id}, uri: '${format/uri}', 
tab: '${format/name}'}})"
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to