Author: jmorliaguet
Date: Mon Jun 19 22:35:54 2006
New Revision: 3464

Modified:
   cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py
   cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py
   cpsskins/branches/paris-sprint-2006/thememanager.py
   cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css
   cpsskins/branches/paris-sprint-2006/ui/screens/common/location_selector.pt
   cpsskins/branches/paris-sprint-2006/ui/screens/common/perspective_selector.pt
   cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py
   cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py
   cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt
   cpsskins/branches/paris-sprint-2006/utils.py

Log:

- move the location selector at the top right of the screen



Modified: cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py    
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/negotiation/page.py    Mon Jun 
19 22:35:54 2006
@@ -17,8 +17,9 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.interface import implements
 from zope.component import queryUtility
+from zope.interface import implements
+from zope.traversing.api import getPath
 
 from cpsskins.browser.negotiation.scheme import NegotiationScheme
 from cpsskins.elements.interfaces import IThemePage
@@ -86,8 +87,10 @@
 
     def __call__(self):
         context = self.context
-        tmutil = getThemeManager(context)
-        location = tmutil.getLocation(context, root=u'pages')
+        path = self.request.cookies.get('cpsskins_location')
+        if path is None:
+            path = getPath(context)
+        location = getThemeManager(context).getLocation(path, root=u'pages')
         if location is not None:
             page_name = location()
             return tmutil.getPageByName(page_name)

Modified: 
cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py     
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/negotiation/perspective.py     
Mon Jun 19 22:35:54 2006
@@ -19,6 +19,7 @@
 
 from zope.app.session.interfaces import ISession
 from zope.interface import implements
+from zope.traversing.api import getPath
 
 from cpsskins.browser.negotiation.scheme import NegotiationScheme
 from cpsskins.standard.negotiation import ISessionNegotiationScheme
@@ -33,7 +34,12 @@
     def __call__(self):
         context = self.context
         tmutil = getThemeManager(context)
-        return tmutil.getLocation(context, root=u'perspectives')
+        path = self.request.cookies.get('cpsskins_location')
+        if path is None:
+            path = getPath(context)
+        location = tmutil.getLocation(path, root=u'perspectives')
+        if location is not None:
+            return location()
 
 class Session(NegotiationScheme):
     """Look for a perspective in the session.

Modified: cpsskins/branches/paris-sprint-2006/thememanager.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/thememanager.py (original)
+++ cpsskins/branches/paris-sprint-2006/thememanager.py Mon Jun 19 22:35:54 2006
@@ -350,11 +350,7 @@
     # Locations
     ###################################################################
 
-    def getLocation(self, context, root=u''):
-        site = IPhysicallyLocatable(context).getNearestSite()
-        if site is None:
-            return None
+    def getLocation(self, path, root=u''):
         locations = self.getLocationStorage()
-        path = getPath(context)
         return locations.find(path, root)
 

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css 
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/common/authoring.css Mon Jun 
19 22:35:54 2006
@@ -368,12 +368,11 @@
   background: url(++resource++r-button-sel.png) top right no-repeat;
 }
 
-.perspective {
+.selector {
   position: absolute;
   right: 13px;
   top: 8px;
   font-size: 11px;
-  background-image: url(++resource++perspective-12.png);
   background-repeat: no-repeat;
   background-position: 5% 50%;
   background-color: #fff;
@@ -383,6 +382,12 @@
   -moz-border-radius: 5px;
 }
 
+.perspective {
+  background-image: url(++resource++perspective-12.png);
+}
+
+.location {
+}
 
 /* inline editing of portlets and of canvas elements  */
 

Modified: 
cpsskins/branches/paris-sprint-2006/ui/screens/common/location_selector.pt
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/common/location_selector.pt  
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/common/location_selector.pt  
Mon Jun 19 22:35:54 2006
@@ -1,11 +1,13 @@
-<div class="locationSelector"
-  tal:define="paths view/getLocationPaths"
+<form action="@@setLocation" class="selector location" method="post"
+      tal:define="paths view/getLocationPaths;
+                  current_path request/cookies/cpsskins_location|nothing"
   tal:condition="paths">
-  <span style="float:left">Current location:</span>
-  <form action="@@setLocation" onchange="submit()">
     <select name="location">
-      <option>(choose a location)</option>
-      <option tal:repeat="path paths" tal:content="path" />
+      <option value="_" i18n:translate="">(choose a location)</option>
+      <option tal:repeat="path paths" tal:content="path"
+              tal:attributes="value path;
+                              selected python: path == current_path
+                              and 'selected' or nothing" />
     </select>
-  </form>
-</div>
+  <button type="submit">OK</button>
+</form>

Modified: 
cpsskins/branches/paris-sprint-2006/ui/screens/common/perspective_selector.pt
==============================================================================
--- 
cpsskins/branches/paris-sprint-2006/ui/screens/common/perspective_selector.pt   
    (original)
+++ 
cpsskins/branches/paris-sprint-2006/ui/screens/common/perspective_selector.pt   
    Mon Jun 19 22:35:54 2006
@@ -1,4 +1,5 @@
-<form class="perspective" title="Perspective selector" i18n:attributes="title"
+<form class="selector perspective"
+      title="Perspective selector" i18n:attributes="title"
       action="@@setPerspective" method="post"
       tal:define="tmutil context/@@getThemeManager;
                   perspectives tmutil/listPerspectives;

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py      
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py      Mon Jun 
19 22:35:54 2006
@@ -250,9 +250,12 @@
         response.setCookie('cpsskins_page', name)
         response.redirect('.')
 
-    def setLocation(self, path):
+    def setLocation(self, location=u''):
         """Set the current location
         """
+        response = self.request.response
+        response.setCookie('cpsskins_location', location)
+        response.redirect('.')
 
     def addTheme(self):
         """Add a theme.
@@ -273,7 +276,6 @@
         response.redirect('.')
 
 
-
     ### Presentation  #################################################
 
     def clonePresentation(self, perspective=None):

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py       
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/definitions.py       Mon Jun 
19 22:35:54 2006
@@ -284,8 +284,7 @@
         },
         'subviews': ['page-designer'],
         'model': 'perspective-selector',
-        'perspectives': ['page-designer', 'content-author',
-                         'element-editor'],
+        'perspectives': ['page-designer', 'element-editor'],
         'controllers': ['main-editor-perspectives', 'main-editor-actions'],
     },
 
@@ -346,7 +345,7 @@
         'show_effect': {
             'transition': 'fadein',
         },
-        'controllers': ['main-editor-perspectives'],
+        'controllers': ['main-editor-perspectives', 'main-editor-actions'],
     },
 
     # rendered pages

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt    (original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/editor.pt    Mon Jun 19 
22:35:54 2006
@@ -27,6 +27,8 @@
       <ins class="view" tal:content="python: view('action-pad')" />
       <ins class="model" tal:content="python: model('perspective-selector')" />
       <ins class="view" tal:content="python: view('perspective-selector')" />
+      <ins class="model" tal:content="python: model('location-selector')" />
+      <ins class="view" tal:content="python: view('location-selector')" />
     </div>
 
     <ins class="controller"
@@ -51,9 +53,6 @@
       <ins class="model" tal:content="python: model('page-tabs')" />
       <ins class="view" tal:content="python: view('page-tabs')" />
 
-      <ins class="model" tal:content="python: model('location-selector')" />
-      <ins class="view" tal:content="python: view('location-selector')" />
-
 
       <ins class="model" tal:content="python: model('panels')" />
 

Modified: cpsskins/branches/paris-sprint-2006/utils.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/utils.py        (original)
+++ cpsskins/branches/paris-sprint-2006/utils.py        Mon Jun 19 22:35:54 2006
@@ -81,6 +81,12 @@
     name = context.addTheme(theme)
     theme.title = name.replace('-', ' ')
     page = addPageSkeleton(context, theme)
+
+    # testing
+    from cpsskins.locations import Location
+    l1 = Location(title=u'First section', path=(u'section',))
+    locations = context.getLocationStorage()
+    locations.add(l1)
     return theme
 
 def addPageSkeleton(context, theme):
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to