Author: jmorliaguet
Date: Thu May 25 11:03:39 2006
New Revision: 3209

Removed:
   cpsskins/branches/paris-sprint-2006/ui/editing/
   
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/green-arrow-left.png
   
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/green-arrow-right.png
   cpsskins/branches/paris-sprint-2006/ui/screens/interactiondesigner/
Modified:
   cpsskins/branches/paris-sprint-2006/ui/configure.zcml
   cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml
   cpsskins/branches/paris-sprint-2006/ui/screens/common/views.py
   cpsskins/branches/paris-sprint-2006/ui/screens/configure.zcml
   cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/configure.zcml
   cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py

Log:

- cleanup



Modified: cpsskins/branches/paris-sprint-2006/ui/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/configure.zcml       (original)
+++ cpsskins/branches/paris-sprint-2006/ui/configure.zcml       Thu May 25 
11:03:39 2006
@@ -4,8 +4,6 @@
 
   <!-- Editing, authoring -->
 
-  <include package=".editing" />
-
   <include package=".authoring" />
 
 

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml        
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/common/configure.zcml        
Thu May 25 11:03:39 2006
@@ -52,4 +52,32 @@
 
   </pages>
 
+  <pages
+      for="cpsskins.elements.interfaces.IElement"
+      layer="cpsskins.browser.skin.cpsskins"
+      permission="zope.ManageContent"
+      class=".views.Editing">
+
+      <page
+          name="getId"
+          attribute="getId"
+      />
+
+      <page
+          name="getPath"
+          attribute="getPath"
+      />
+
+      <page
+          name="getParent"
+          attribute="getParent"
+      />
+
+      <page
+          name="getIcon"
+          attribute="getIcon"
+      />
+
+  </pages>
+
 </configure>

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      Thu May 
25 11:03:39 2006
@@ -17,14 +17,53 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.app.zapi import getMultiAdapter
+from zope.component import getMultiAdapter, queryMultiAdapter
 from zope.interface import implements, Interface
+from zope.location.traversing import LocationPhysicallyLocatable
+from zope.traversing.api import getParent
 
 from cpsskins.browser.negotiation.interfaces import INegotiation
 from cpsskins.browser.rendering.interfaces import IViewer
-from cpsskins.utils import getThemeManager
 
-class Rendering:
+class IEditing(Interface):
+
+    def getId():
+        """Return the element's id."""
+
+    def getPath():
+        """Return the element's path."""
+
+    def getParent():
+        """Return the element's parent."""
+
+    def getIcon():
+        """Return the element's icon path."""
+
+class Editing(object):
+
+    implements(IEditing)
+
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+
+    def getId(self):
+        return self.context.identifier
+
+    def getPath(self):
+        return LocationPhysicallyLocatable(self.context).getPath()
+
+    def getParent(self):
+        return getParent(self.context)
+
+    def getIcon(self):
+        icon_url = ''
+        icon = queryMultiAdapter((self.context, self.request), 
name=u'zmi_icon')
+        if icon:
+            icon_url = icon.url()
+        return icon_url
+
+class Rendering(object):
     """Page rendering view
     """
 

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/configure.zcml       
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/configure.zcml       Thu May 
25 11:03:39 2006
@@ -21,9 +21,6 @@
   <!-- page designer -->
   <include package=".pagedesigner" />
 
-  <!-- interaction designer -->
-  <include package=".interactiondesigner" />
-
   <!-- content author -->
   <include package=".contentauthor" />
 

Modified: 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/configure.zcml
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/configure.zcml 
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/configure.zcml 
Thu May 25 11:03:39 2006
@@ -9,18 +9,6 @@
       layer="cpsskins.browser.skin.cpsskins"
   />
 
-  <resource
-      name="green-arrow-left.png"
-      file="green-arrow-left.png"
-      layer="cpsskins.browser.skin.cpsskins"
-  />
-
-  <resource
-      name="green-arrow-right.png"
-      file="green-arrow-right.png"
-      layer="cpsskins.browser.skin.cpsskins"
-  />
-
   <pages
       for="*"
       layer="cpsskins.browser.skin.cpsskins"

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py 
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/sitemanager/views.py Thu May 
25 11:03:39 2006
@@ -17,10 +17,14 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.app import zapi
 from zope.component import getUtility
+from zope.location.pickling import locationCopy
+from zope.traversing.api import getParent
+from zope.security.proxy import removeSecurityProxy
 
 from cpsskins import minjson as json
+from cpsskins.elements.interfaces import IDisplay
+from cpsskins.storage.interfaces import IStorage
 from cpsskins.setup.interfaces import IType, IIdentifiable
 from cpsskins.setup.interfaces import IResourceManager, IResource
 from cpsskins.setup.io import importSite, exportSite
@@ -90,6 +94,41 @@
         """
         refreshSettings()
 
+    def createSetting(self, title=u'', uri=u''):
+        """Create a setting from the context.
+        """
+        context = self.context
+        resources = getUtility(IResourceManager)
+        element = resources.resolve(uri, context)
+        if element is None:
+            raise ValueError("no such element: %s" % uri)
+        container = getParent(element)
+        if not IStorage.providedBy(container):
+            raise TypeError("The element is not located in a storage.")
+
+        resource = locationCopy(removeSecurityProxy(element))
+        getThemeManager(context).registerElement(resource)
+
+        resources.register(title=title, resource=resource, context=context)
+
+    def useSettingAsFormat(self, uri=u''):
+        """Use a setting specified by its URI as a format
+
+        The context is the display
+
+        """
+        context = self.context
+        if not uri:
+            raise KeyError("Must specify a setting's URI.")
+
+        if not IDisplay.providedBy(context):
+            raise TypeError("The context must be a display.")
+
+        resources = getUtility(IResourceManager)
+        setting = resources.lookup(uri=uri, context=context)
+        if setting is None:
+            raise KeyError("No such setting: '%s'." % uri)
+
     ### Sites  #########################################################
 
     def importSite(self, file=None):
@@ -145,4 +184,3 @@
         snapshots = self.getSnapshotStorage()
         snapshots.add(Snapshot(data), file.filename)
 
-
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to