Author: jmorliaguet
Date: Fri Apr 14 22:19:17 2006
New Revision: 2849

Modified:
   cpsskins/branches/jmo-perspectives/elements/interfaces.py
   cpsskins/branches/jmo-perspectives/elements/themepage.py
   cpsskins/branches/jmo-perspectives/standard/negotiation/page.py
   cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py
   cpsskins/branches/jmo-perspectives/ui/authoring/views.py
   cpsskins/branches/jmo-perspectives/ui/panels/page_tabs.pt
Log:

- added a page switcher



Modified: cpsskins/branches/jmo-perspectives/elements/interfaces.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/interfaces.py   (original)
+++ cpsskins/branches/jmo-perspectives/elements/interfaces.py   Fri Apr 14 
22:19:17 2006
@@ -249,6 +249,11 @@
         """Return true if the page is the default one.
         """
 
+    def name():
+        """Return the page's name (used when registering the page as a
+        utility.)
+        """
+
 IThemePage.setTaggedValue('name', u'themepage')
 
 class ITheme(ICanvas, IInnerNode):

Modified: cpsskins/branches/jmo-perspectives/elements/themepage.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/themepage.py    (original)
+++ cpsskins/branches/jmo-perspectives/elements/themepage.py    Fri Apr 14 
22:19:17 2006
@@ -18,6 +18,7 @@
 __docformat__ = "reStructuredText"
 
 from zope.interface import implements
+from zope.component import getUtilitiesFor
 
 from cpsskins.elements import InnerNode
 from cpsskins.elements.interfaces import IThemePage
@@ -44,3 +45,11 @@
         tmutil = getThemeManager()
         return tmutil.isDefault(self)
 
+    def getPageName(self):
+        for k, v in getUtilitiesFor(IThemePage, self):
+            if v == self:
+                return k
+        return None
+
+    name = property(getPageName)
+

Modified: cpsskins/branches/jmo-perspectives/standard/negotiation/page.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/negotiation/page.py     
(original)
+++ cpsskins/branches/jmo-perspectives/standard/negotiation/page.py     Fri Apr 
14 22:19:17 2006
@@ -46,7 +46,7 @@
     implements(ICookieNegotiationScheme)
 
     def __call__(self):
-        name = self.request.cookies.get('cpsskins_work_page')
+        name = self.request.cookies.get('cpsskins_page')
         if not name:
             return None
         return self.manager.getPageByName(name)

Modified: cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py      
(original)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/definitions.py      Fri Apr 
14 22:19:17 2006
@@ -193,7 +193,7 @@
         },
         'model': 'page-tabs',
         'perspectives': ['page-designer', 'layout-designer'],
-        'controllers': ['main-editor-perspectives'],
+        'controllers': ['main-editor-perspectives', 'theme-switcher'],
     },
 
     'location-selector': {

Modified: cpsskins/branches/jmo-perspectives/ui/authoring/views.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/authoring/views.py    (original)
+++ cpsskins/branches/jmo-perspectives/ui/authoring/views.py    Fri Apr 14 
22:19:17 2006
@@ -89,6 +89,13 @@
         response.setCookie('cpsskins_theme', name)
         response.redirect('.')
 
+    def setWorkPage(self, name=u''):
+        """Set the work page.
+        """
+        response = self.request.response
+        response.setCookie('cpsskins_page', name)
+        response.redirect('.')
+
     ###################################################################
     # Presentation
     ###################################################################

Modified: cpsskins/branches/jmo-perspectives/ui/panels/page_tabs.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/panels/page_tabs.pt   (original)
+++ cpsskins/branches/jmo-perspectives/ui/panels/page_tabs.pt   Fri Apr 14 
22:19:17 2006
@@ -7,8 +7,8 @@
   <tal:block repeat="page pages">
     <li tal:define="selected python: page == effective_page"
         tal:attributes="class python: selected and 'selected' or None">
-      <a href=""
-         tal:content="page/title"
-         tal:attributes="href 
string:${page/@@absolute_url}/@@${view/__name__}" /></li>
+      <a tal:content="page/title"
+         tal:attributes="href string:@@setWorkPage?name=${page/name}" />
+    </li>
   </tal:block>
 </ul>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to