Author: jmorliaguet
Date: Sat Apr  8 16:05:40 2006
New Revision: 2789

Added:
   cpsskins/branches/jmo-perspectives/standard/io/area.py   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/standard/io/area.xml   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/standard/io/area.zcml   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/standard/io/box.py   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/standard/io/box.xml   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/standard/io/box.zcml   (contents, props 
changed)
   cpsskins/branches/jmo-perspectives/standard/io/boxgroup.py   (contents, 
props changed)
   cpsskins/branches/jmo-perspectives/standard/io/boxgroup.xml   (contents, 
props changed)
   cpsskins/branches/jmo-perspectives/standard/io/boxgroup.zcml   (contents, 
props changed)
Modified:
   cpsskins/branches/jmo-perspectives/standard/io/configure.zcml
   cpsskins/branches/jmo-perspectives/ui/panels/io.pt
Log:

- added display exporters (box, area, boxgroup)



Added: cpsskins/branches/jmo-perspectives/standard/io/area.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/area.py      Sat Apr  8 
16:05:40 2006
@@ -0,0 +1,59 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from xml.dom.minidom import parseString
+
+from zope.app import pagetemplate
+from zope.component import adapts
+from zope.interface import implements
+
+from cpsskins.standard.displays.area import IArea
+from cpsskins.elements.interfaces import IIdentifiable
+from cpsskins.setup.interfaces import IDataExporter, IDataImporter
+
+class Exporter(object):
+    """Export areas
+    """
+    implements(IDataExporter)
+
+    template = pagetemplate.ViewPageTemplateFile('area.xml')
+
+    def __call__(self):
+        return self.template()
+
+    def getInfo(self):
+        return {
+            'uri': IIdentifiable(self.context).getURI(),
+        }
+
+class Importer(object):
+    """Import areas
+    """
+    adapts(IArea)
+    implements(IDataImporter)
+
+    def __init__(self, context):
+        self.context = context
+
+    def load(self, xml=u''):
+        context = self.context
+        dom = parseString(xml)
+        # TODO
+        print dom
+

Added: cpsskins/branches/jmo-perspectives/standard/io/area.xml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/area.xml     Sat Apr  8 
16:05:40 2006
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<area xmlns:tal="http://xml.zope.org/namespaces/tal";
+      tal:define="info view/getInfo"
+      tal:attributes="uri info/uri" />

Added: cpsskins/branches/jmo-perspectives/standard/io/area.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/area.zcml    Sat Apr  8 
16:05:40 2006
@@ -0,0 +1,18 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope";
+    xmlns:browser="http://namespaces.zope.org/browser";>
+
+  <!-- XML export -->
+  <browser:view
+      provides="cpsskins.setup.interfaces.IDataExporter"
+      for="cpsskins.standard.displays.area.IArea"
+      class=".area.Exporter"
+      permission="zope.ManageContent"
+  />
+
+  <!-- XML import -->
+  <adapter
+      factory=".area.Importer"
+  />
+
+</configure>

Added: cpsskins/branches/jmo-perspectives/standard/io/box.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/box.py       Sat Apr  8 
16:05:40 2006
@@ -0,0 +1,59 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from xml.dom.minidom import parseString
+
+from zope.app import pagetemplate
+from zope.component import adapts
+from zope.interface import implements
+
+from cpsskins.standard.displays.box import IBox
+from cpsskins.elements.interfaces import IIdentifiable
+from cpsskins.setup.interfaces import IDataExporter, IDataImporter
+
+class Exporter(object):
+    """Export boxes
+    """
+    implements(IDataExporter)
+
+    template = pagetemplate.ViewPageTemplateFile('box.xml')
+
+    def __call__(self):
+        return self.template()
+
+    def getInfo(self):
+        return {
+            'uri': IIdentifiable(self.context).getURI(),
+        }
+
+class Importer(object):
+    """Import boxes
+    """
+    adapts(IBox)
+    implements(IDataImporter)
+
+    def __init__(self, context):
+        self.context = context
+
+    def load(self, xml=u''):
+        context = self.context
+        dom = parseString(xml)
+        # TODO
+        print dom
+

Added: cpsskins/branches/jmo-perspectives/standard/io/box.xml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/box.xml      Sat Apr  8 
16:05:40 2006
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<box xmlns:tal="http://xml.zope.org/namespaces/tal";
+     tal:define="info view/getInfo"
+     tal:attributes="uri info/uri" />

Added: cpsskins/branches/jmo-perspectives/standard/io/box.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/box.zcml     Sat Apr  8 
16:05:40 2006
@@ -0,0 +1,18 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope";
+    xmlns:browser="http://namespaces.zope.org/browser";>
+
+  <!-- XML export -->
+  <browser:view
+      provides="cpsskins.setup.interfaces.IDataExporter"
+      for="cpsskins.standard.displays.box.IBox"
+      class=".box.Exporter"
+      permission="zope.ManageContent"
+  />
+
+  <!-- XML import -->
+  <adapter
+      factory=".box.Importer"
+  />
+
+</configure>

Added: cpsskins/branches/jmo-perspectives/standard/io/boxgroup.py
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/boxgroup.py  Sat Apr  8 
16:05:40 2006
@@ -0,0 +1,66 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 Nuxeo and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+from xml.dom.minidom import parseString
+
+from zope.app import pagetemplate
+from zope.component import adapts, getMultiAdapter
+from zope.interface import implements
+
+from cpsskins.standard.displays.boxgroup import IBoxGroup
+from cpsskins.elements.interfaces import IIdentifiable
+from cpsskins.setup.interfaces import IDataExporter, IDataImporter
+
+class Exporter(object):
+    """Export box groups
+    """
+    implements(IDataExporter)
+
+    template = pagetemplate.ViewPageTemplateFile('boxgroup.xml')
+
+    def __call__(self):
+        return self.template()
+
+    def getInfo(self):
+        xml = u''
+        context = self.context
+        for item in context:
+            exporter = getMultiAdapter((context[item], request), IDataExporter)
+            xml += exporter().replace('<?xml version="1.0"?>', '')
+
+        return {
+            'uri': IIdentifiable(self.context).getURI(),
+            'content': xml,
+        }
+
+class Importer(object):
+    """Import box groups
+    """
+    adapts(IBoxGroup)
+    implements(IDataImporter)
+
+    def __init__(self, context):
+        self.context = context
+
+    def load(self, xml=u''):
+        context = self.context
+        dom = parseString(xml)
+        # TODO
+        print dom
+

Added: cpsskins/branches/jmo-perspectives/standard/io/boxgroup.xml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/boxgroup.xml Sat Apr  8 
16:05:40 2006
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<boxgroup xmlns:tal="http://xml.zope.org/namespaces/tal";
+          tal:define="info view/getInfo"
+          tal:attributes="uri info/uri"
+          tal:content="structure info/content">
+</boxgroup>

Added: cpsskins/branches/jmo-perspectives/standard/io/boxgroup.zcml
==============================================================================
--- (empty file)
+++ cpsskins/branches/jmo-perspectives/standard/io/boxgroup.zcml        Sat Apr 
 8 16:05:40 2006
@@ -0,0 +1,18 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope";
+    xmlns:browser="http://namespaces.zope.org/browser";>
+
+  <!-- XML export -->
+  <browser:view
+      provides="cpsskins.setup.interfaces.IDataExporter"
+      for="cpsskins.standard.displays.boxgroup.IBoxGroup"
+      class=".boxgroup.Exporter"
+      permission="zope.ManageContent"
+  />
+
+  <!-- XML import -->
+  <adapter
+      factory=".boxgroup.Importer"
+  />
+
+</configure>

Modified: cpsskins/branches/jmo-perspectives/standard/io/configure.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/io/configure.zcml       
(original)
+++ cpsskins/branches/jmo-perspectives/standard/io/configure.zcml       Sat Apr 
 8 16:05:40 2006
@@ -1,6 +1,12 @@
 <configure
     xmlns="http://namespaces.zope.org/zope";>
 
+  <include file="area.zcml" />
+
+  <include file="box.zcml" />
+
+  <include file="boxgroup.zcml" />
+
   <include file="effect.zcml" />
 
   <include file="layout.zcml" />

Modified: cpsskins/branches/jmo-perspectives/ui/panels/io.pt
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/panels/io.pt  (original)
+++ cpsskins/branches/jmo-perspectives/ui/panels/io.pt  Sat Apr  8 16:05:40 2006
@@ -8,6 +8,7 @@
     <li><a href="@@exportStorage?name=relations">Export relations</a></li>
     <li><a href="@@exportStorage?name=portlets">Export portlets</a></li>
     <li><a href="@@exportStorage?name=formats">Export formats</a></li>
+    <li><a href="@@exportStorage?name=displays">Export displays</a></li>
   </ul>
 
   <br style="clear:both"/>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to