Author: jmorliaguet
Date: Sun Apr 23 15:27:16 2006
New Revision: 2947

Added:
   CPSSkins4Five/trunk/themes_manager.pt   (contents, props changed)
Removed:
   CPSSkins4Five/trunk/info.pt
Modified:
   CPSSkins4Five/trunk/CPSSkinsSiteInstaller.py
   CPSSkins4Five/trunk/configure.zcml
   CPSSkins4Five/trunk/views.py
   CPSSkins4Five/trunk/views.zcml
Log:

- added a themes manager

- removed the info screen



Modified: CPSSkins4Five/trunk/CPSSkinsSiteInstaller.py
==============================================================================
--- CPSSkins4Five/trunk/CPSSkinsSiteInstaller.py        (original)
+++ CPSSkins4Five/trunk/CPSSkinsSiteInstaller.py        Sun Apr 23 15:27:16 2006
@@ -58,8 +58,10 @@
     sm = site.getSiteManager()
     sm.registerUtility(IThemeManagementFolder, tmutil)
 
+    tmutil.__parent__ = sm
+
     if REQUEST is not None:
-        url = dispatcher.DestinationURL()
-        redirect_url = '%s/%s/++skin++cpsskins/@@site-info.html' % (url, id)
-        REQUEST.RESPONSE.redirect(redirect_url)
+        url = dispatcher.DestinationURL() + '/' + id
+        path = '/++skin++cpsskins/@@themes-manager.html'
+        REQUEST.RESPONSE.redirect(url + path)
 

Modified: CPSSkins4Five/trunk/configure.zcml
==============================================================================
--- CPSSkins4Five/trunk/configure.zcml  (original)
+++ CPSSkins4Five/trunk/configure.zcml  Sun Apr 23 15:27:16 2006
@@ -3,25 +3,18 @@
     xmlns:browser="http://namespaces.zope.org/browser";
     xmlns:five="http://namespaces.zope.org/five";>
 
-  <include file="permissions.zcml" />
+  <!-- zope3 -->
 
   <include file="browser.zcml" />
 
-  <include file="views.zcml" />
-
-  <!-- CPSSkins v3 site -->
-
-  <five:localsite class=".site.CPSSkinsSite" />
-
-
-  <!-- zope2 -->
-
-  <five:traversable class="OFS.Folder.Folder" />
+  <include file="permissions.zcml" />
 
   <include package="zope.app.keyreference" />
 
 
-  <!-- name choosers -->
+  <!-- cpsskins v3 zcml configuration -->
+
+  <include package="cpsskins" />
 
   <adapter
       provides="zope.app.container.interfaces.INameChooser"
@@ -42,8 +35,15 @@
   />
 
 
-  <!-- cpsskins v3 zcml configuration -->
+  <!-- CPSSkins4Five  -->
 
-  <include package="cpsskins" />
+  <five:localsite class="Products.CPSSkins4Five.site.CPSSkinsSite" />
+
+  <include file="views.zcml" />
+
+
+  <!-- zope2 -->
+
+  <five:traversable class="OFS.Folder.Folder" />
 
 </configure>

Added: CPSSkins4Five/trunk/themes_manager.pt
==============================================================================
--- (empty file)
+++ CPSSkins4Five/trunk/themes_manager.pt       Sun Apr 23 15:27:16 2006
@@ -0,0 +1,37 @@
+<html>
+<head>
+  <title>CPSSkins v3</title>
+
+  <style type="text/css">
+  body {
+    font: 11px Verdana, Arial, sans-serif;
+  }
+  h1 {
+    font-size: 1.5em;
+  }
+  h2 {
+    font-size: 1.3em;
+    border-bottom: 1px solid gray;
+  }
+  </style>
+</head>
+
+<body>
+
+<h1>CPSSkins v3</h1>
+
+<h2>Themes</h2>
+
+<ul tal:define="themes view/getThemes">
+  <li tal:repeat="theme themes">
+      <a tal:attributes="href string:@@editor.html?id=${theme/name}"
+         tal:content="theme/title" />
+  </li>
+</ul>
+
+<form action="addTheme.html" method="post">
+  <p>
+    <button type="submit">Add a theme</button>
+  </p>
+</form>
+

Modified: CPSSkins4Five/trunk/views.py
==============================================================================
--- CPSSkins4Five/trunk/views.py        (original)
+++ CPSSkins4Five/trunk/views.py        Sun Apr 23 15:27:16 2006
@@ -22,64 +22,23 @@
 
 from cpsskins.thememanager import IThemeManagementFolder
 
-class InfoView:
-    """Info view.
+class ThemesManagerView:
+    """Themes manager view.
     """
 
     def __init__(self, context, request):
         self.context = context
         self.request = request
 
-    def getSiteManager(self):
-        return getSiteManager(self.context)
-
-    def getThemeManagementFolder(self):
-        return self.getSiteManager().queryUtility(IThemeManagementFolder)
-
-    def getIdRegistry(self):
-        return self.getThemeManagementFolder().getIdRegistry()
-
-    def getImageCache(self):
-        return self.getThemeManagementFolder().getImageCache()
-
-    def getRelationStorage(self):
-        return self.getThemeManagementFolder().getRelationStorage()
-
-    def getDisplayStorage(self):
-        return self.getThemeManagementFolder().getDisplayStorage()
-
-    def getFormatStorage(self):
-        return self.getThemeManagementFolder().getFormatStorage()
-
-    def getPortletStorage(self):
-        return self.getThemeManagementFolder().getPortletStorage()
-
-    def getSnapshotStorage(self):
-        return self.getThemeManagementFolder().getSnapshotStorage()
-
-    def getSettings(self):
-        return self.getThemeManagementFolder().getSettings()
+        self.sm = getSiteManager(context)
+        self.tmutil = self.sm.queryUtility(IThemeManagementFolder)
 
     def getThemes(self):
-        return self.getThemeManagementFolder().getThemes()
-
-    def listPerspectives(self):
-        return self.getThemeManagementFolder().listPerspectives()
+        return self.tmutil.getThemes()
 
     def createTheme(self):
-        from cpsskins.tests.setup import addThemeSkeleton
-        addThemeSkeleton(self.getThemeManagementFolder())
-
-        self.request.response.redirect('./@@site-info.html')
-
-    def getViewer(self):
-        themes = self.getThemeManagementFolder().getThemes()
-        if not themes:
-            return None
-        theme = themes[0]
-
-        from zope.app import zapi
-        from cpsskins.browser.rendering.interfaces import IViewer
+        from cpsskins.utils import addThemeSkeleton
+        addThemeSkeleton(self.tmutil)
 
-        return zapi.getMultiAdapter((theme, self.request), IViewer)
+        self.request.response.redirect('@@themes-manager.html')
 

Modified: CPSSkins4Five/trunk/views.zcml
==============================================================================
--- CPSSkins4Five/trunk/views.zcml      (original)
+++ CPSSkins4Five/trunk/views.zcml      Sun Apr 23 15:27:16 2006
@@ -2,17 +2,17 @@
     xmlns:browser="http://namespaces.zope.org/browser";>
 
   <browser:page
-      for="*"
-      name="site-info.html"
-      template="info.pt"
-      class=".views.InfoView"
+      for="Products.CPSSkins4Five.site.ICPSSkinsSite"
+      name="themes-manager.html"
+      template="themes_manager.pt"
+      class=".views.ThemesManagerView"
       permission="zope.ManageContent"
   />
 
   <browser:pages
-      for="*"
+      for="Products.CPSSkins4Five.site.ICPSSkinsSite"
       permission="zope.ManageContent"
-      class=".views.InfoView">
+      class=".views.ThemesManagerView">
 
     <page
         name="addTheme.html"
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to