Author: jmorliaguet
Date: Tue Nov  1 22:00:52 2005
New Revision: 28872

Added:
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/__init__.py   
(contents, props changed)
   z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/meta.zcml  
 (contents, props changed)
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metaconfigure.py
   (contents, props changed)
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metadirectives.py
   (contents, props changed)
Log:

- added access key registry



Added: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/__init__.py
==============================================================================
--- (empty file)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/__init__.py   
    Tue Nov  1 22:00:52 2005
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2005 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 zope.component import provideUtility
+from zope.interface import implements
+
+from cpsskins.configuration import ConfigurationRegistry
+from cpsskins.configuration.interfaces import IRegistry
+
+provideUtility(ConfigurationRegistry(), IRegistry, 'accesskeys')
+

Added: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/meta.zcml
==============================================================================
--- (empty file)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/meta.zcml 
Tue Nov  1 22:00:52 2005
@@ -0,0 +1,20 @@
+
+<configure xmlns="http://namespaces.zope.org/meta";>
+
+  <directives namespace="http://namespaces.zope.org/cpsskins";>
+
+    <complexDirective
+        name="accesskeys"
+        schema=".metadirectives.IAccessKeysDirective"
+        handler=".metaconfigure.AccessKeys">
+
+      <subdirective
+          name="accesskey"
+          schema=".metadirectives.IAccessKeyDirective" 
+      />
+
+    </complexDirective>
+
+  </directives>
+
+</configure>

Added: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metaconfigure.py
==============================================================================
--- (empty file)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metaconfigure.py
  Tue Nov  1 22:00:52 2005
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2005 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 zope.component import getUtility
+from zope.configuration.exceptions import ConfigurationError
+from zope.i18nmessageid import MessageFactory
+
+from cpsskins.configuration.interfaces import IRegistry
+
+accesskey_registry = getUtility(IRegistry, 'accesskeys')
+registered = []
+
+class AccessKeys(object):
+
+    def __init__(self, _context, name):
+        self._context = _context
+        self.name = name
+        self.accesskeys = []
+
+    def accesskey(self, _context, key, url):
+        if not key:
+            raise ConfigurationError("Must specify a key.")
+
+        if not url:
+            raise ConfigurationError("Must specify a url.")
+
+        self.accesskeys.append({'key': key, 'url': url})
+
+    def __call__(self):
+        accesskey_registry.register(self.name, self.accesskeys)

Added: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metadirectives.py
==============================================================================
--- (empty file)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/accesskeys/metadirectives.py
 Tue Nov  1 22:00:52 2005
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2005 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 zope.interface import Interface
+from zope.i18nmessageid import MessageFactory
+from zope.schema import TextLine
+
+_ = MessageFactory("cpsskins")
+
+class IAccessKeysDirective(Interface):
+
+    name = TextLine(
+        title=_("Name"),
+        description=_("The name of the access key set."),
+        required=False,
+        )
+
+class IAccessKeyDirective(Interface):
+
+    key = TextLine(
+        title=_("Key"),
+        description=_("The access key."),
+        required=False,
+        )
+
+    url = TextLine(
+        title=_("URL"),
+        description=_("The url."),
+        required=False,
+        )
+
+
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to