Author: jmorliaguet
Date: Fri Nov 18 18:31:21 2005
New Revision: 1883

Modified:
   cpsskins/branches/jmo-perspectives/engines/authoring/authoring.py
   cpsskins/branches/jmo-perspectives/engines/authoring/configure.zcml
   
cpsskins/branches/jmo-perspectives/engines/authoring/icons/site-structure-48.png
   cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py
   cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.css
   cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.pt
Log:

- added persistent navigation between sections (stored in the session)



Modified: cpsskins/branches/jmo-perspectives/engines/authoring/authoring.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/authoring/authoring.py   
(original)
+++ cpsskins/branches/jmo-perspectives/engines/authoring/authoring.py   Fri Nov 
18 18:31:21 2005
@@ -35,6 +35,12 @@
     def draw():
         """ """
 
+    def setSelection(selected):
+        """ """
+
+    def getSelection():
+        """ """
+
     def setPerspective(perspective):
         """ """
 
@@ -57,6 +63,11 @@
     adapts(IElement)
     implements(IAuthoring)
 
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+        self.session_info = ISession(request)['cpsskins']
+
     def _redirect(self):
         request = self.request
         target = request.get('HTTP_REFERER', '.')
@@ -68,21 +79,28 @@
         viewer = getMultiAdapter((self.context, self.request), IViewer)
         return viewer(**kw)
 
+    def setSelection(self, **kw):
+        """Set the selection.
+        """
+        kw.update(self.request.form)
+        self.session_info['selection'] = kw
+        self._redirect()
+
+    def getSelection(self):
+        return self.session_info.get('selection', {})
+
     def setPerspective(self, perspective=u''):
         """Set the perspective
         """
-        pkg_id = 'cpsskins'
-        session = ISession(self.request)[pkg_id]
-
         if not perspective:
-            del session['perspective']
+            del self.session_info['perspective']
         else:
             perspectives = getUtility(IResourceManager, 'perspectives')
             perspective = perspectives.lookup(perspective, 
context=self.context)
 
             # remove the security proxy before storing the object in the 
session
             perspective = removeSecurityProxy(perspective)
-            session['perspective'] = perspective
+            self.session_info['perspective'] = perspective
         self._redirect()
 
     def clonePresentation(self, perspective=None):

Modified: cpsskins/branches/jmo-perspectives/engines/authoring/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/authoring/configure.zcml 
(original)
+++ cpsskins/branches/jmo-perspectives/engines/authoring/configure.zcml Fri Nov 
18 18:31:21 2005
@@ -37,6 +37,16 @@
       class=".authoring.Authoring">
 
       <browser:page
+          name="setSelection"
+          attribute="setSelection"
+      />
+
+      <browser:page
+          name="getSelection"
+          attribute="getSelection"
+      />
+
+      <browser:page
           name="setPerspective"
           attribute="setPerspective"
       />

Modified: 
cpsskins/branches/jmo-perspectives/engines/authoring/icons/site-structure-48.png
==============================================================================
Binary files. No diff available.

Modified: cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py  
(original)
+++ cpsskins/branches/jmo-perspectives/engines/sitedesigner/browser.py  Fri Nov 
18 18:31:21 2005
@@ -36,4 +36,3 @@
 
     def customize(self, name=u''):
         """ """
-        

Modified: 
cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.css
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.css   
(original)
+++ cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.css   
Fri Nov 18 18:31:21 2005
@@ -18,7 +18,7 @@
   font-size: 145%;
   font-weight: normal;
   color: #000;
-  padding: 1px 2px 1px 8px;
+  padding: 1px 2px 1px 15px;
   margin: 0.8em 8px 1em 0;
   border-bottom: 1px solid #eee;
   background-color: #efc;
@@ -40,8 +40,8 @@
 }
 
 .icon {
-  padding-right: 1em;
-  padding-left: 0.5em;
+  padding-right: 1.5em;
+  padding-left: 1em;
   float: left;
 }
 
@@ -71,10 +71,10 @@
   vertical-align:top;
 }
 
-table.panel td.first {
+table.panel td.section {
   width: 25%;
 }
 
-table.panel td.second {
+table.panel td.subsection {
   width: 75%;
 }

Modified: 
cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.pt    
(original)
+++ cpsskins/branches/jmo-perspectives/engines/sitedesigner/site_designer.pt    
Fri Nov 18 18:31:21 2005
@@ -1,6 +1,9 @@
 <tal:block define="engine string:site-designer;
                    current_section context/@@getCurrentSection|nothing;
-                   current_type context/@@getSettingType|string:IPerspective">
+                   selection 
context/@@getSelection|python:{'section':'settings', 'subsection': 
'IPerspective', 'selected': ''};
+                   section selection/section|nothing;
+                   subsection selection/subsection|nothing;
+                   selected selection/selected|nothing">
 
 <metal:block use-macro="context/@@authoring_macros/editor">
 
@@ -30,29 +33,22 @@
               <img class="icon"
                    src="/++skin++cpsskins/@@/++resource++settings-48.png" />
               <ul>
-                <li>
-                  <a class="section" href="@@setSettingType?type=IPerspective"
-                     tal:content="string:Perspectives" i18n:translate="" />
-                </li>
-                <li>
-                  <a class="section" href="@@setSettingType?type=IStyle"
-                     tal:content="string:Styles" i18n:translate="" />
-                </li>
-                <li>
-                  <a class="section" href="@@setSettingType?type=IAccessKey"
-                     tal:content="string:Access keys" i18n:translate="" />
+                <li tal:repeat="subsection python:['IPerspective', 'IStyle', 
'IAccessKey']">
+                  <a class="section"
+                     tal:attributes="href 
string:@@setSelection?subsection=$subsection"
+                     tal:content="subsection" i18n:translate="" />
                 </li>
               </ul>
               <br style="clear:both"/>
             </div>
 
           </td>
-          <td class="second">
+          <td class="subsection" tal:condition="subsection">
 
-            <h2 tal:content="current_type" />
+            <h2 tal:content="subsection" i18n:translate="" />
 
             <ul tal:define="setting_info context/@@getSettingInfo">
-              <li tal:repeat="info setting_info/?current_type">
+              <li tal:repeat="info setting_info/?subsection|nothing">
                 <tal:block content="info/title" />
                 <a href="" tal:condition="info/readonly">[customize]</a>
               </li>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to