Author: jmorliaguet
Date: Wed Mar 22 12:33:01 2006
New Revision: 2683

Modified:
   cpsskins/branches/jmo-perspectives/browser/manager/configure.zcml
   cpsskins/branches/jmo-perspectives/browser/manager/themes_manager.pt
   cpsskins/branches/jmo-perspectives/browser/manager/views.py
   cpsskins/branches/jmo-perspectives/elements/interfaces.py
Log:

- fixed the redirection to the theme editor



Modified: cpsskins/branches/jmo-perspectives/browser/manager/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/manager/configure.zcml   
(original)
+++ cpsskins/branches/jmo-perspectives/browser/manager/configure.zcml   Wed Mar 
22 12:33:01 2006
@@ -22,6 +22,11 @@
           attribute="addTheme"
       />
 
+      <page
+          name="editTheme.html"
+          attribute="editTheme"
+      />
+
   </pages>
 
   <pages

Modified: cpsskins/branches/jmo-perspectives/browser/manager/themes_manager.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/manager/themes_manager.pt        
(original)
+++ cpsskins/branches/jmo-perspectives/browser/manager/themes_manager.pt        
Wed Mar 22 12:33:01 2006
@@ -5,12 +5,10 @@
       <tal:block define="themes view/listThemeInfo">
         <ul>
           <li tal:repeat="theme themes">
-            <tal:block define="theme_url theme/url">
-              <a href=""
-               tal:content="theme/id"
-               tal:attributes="href 
string:/++skin++cpsskins$theme_url/@@editor.html" />
-              (<span tal:content="theme/title" />)
-            </tal:block>
+            <a href=""
+             tal:content="theme/id"
+             tal:attributes="href theme/edit_url" />
+            (<span tal:content="theme/title" />)
           </li>
         </ul>
         <p tal:condition="not:themes">No themes</p>

Modified: cpsskins/branches/jmo-perspectives/browser/manager/views.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/browser/manager/views.py (original)
+++ cpsskins/branches/jmo-perspectives/browser/manager/views.py Wed Mar 22 
12:33:01 2006
@@ -23,6 +23,7 @@
 from zope.app.publisher.browser import BrowserView
 from zope.interface import implements
 
+from cpsskins.browser.negociation.interfaces import INegociation
 from cpsskins.elements.interfaces import IDisplayable, IFormattable
 from cpsskins.elements.theme import Theme
 from cpsskins.elements.themepage import ThemePage
@@ -45,15 +46,27 @@
 
     def listThemeInfo(self):
         info = []
+        edit_url = '/++skin++cpsskins%s/editTheme.html' % \
+                   zapi.getPath(self.context)
         for theme in self.getThemes():
             path = zapi.getPath(theme)
             info.append({
                 'id': zapi.name(theme),
                 'title': theme.title,
-                'url': urllib.quote(path),
+                'edit_url': '%s?name=%s' % (edit_url, theme.name)
                 })
         return info
 
+    def editTheme(self, name=u''):
+        """Enter the theme editor
+        """
+        context = self.context
+        request = self.request
+        negociation = zapi.getMultiAdapter((context, request), INegociation,
+                                            'negociation')
+        negociation.setWorkTheme(name)
+        request.response.redirect('./@@editor.html')
+
     def addTheme(self):
         """Creates a theme skeleton (mostly for demo purposes until some theme
         export / import functionality is available).

Modified: cpsskins/branches/jmo-perspectives/elements/interfaces.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/elements/interfaces.py   (original)
+++ cpsskins/branches/jmo-perspectives/elements/interfaces.py   Wed Mar 22 
12:33:01 2006
@@ -264,6 +264,11 @@
         """Set the theme as the default theme.
         """
 
+    def name():
+        """Return the theme's name (used when registering the theme as a
+        utility.)
+        """
+
 ITheme.setTaggedValue('name', u'theme')
 
 # theme objects
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to