Index: /main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py	(revision 5954)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py	(revision 5955)
@@ -9,9 +9,74 @@
     # BBB
     from zope.app.catalog.interfaces import ICatalog
-from zope.interface import Interface, Attribute
+from zope.interface import Interface, Attribute, implements
 from zope import schema
 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
 from waeup.sirp.permissions import RoleSource
 
+class IThemeProvider(Interface):
+    """A component that delivers all themes defined.
+
+    We normally do not deal with browser-related stuff in `waeup.sirp`
+    but leave that to the `browser` subpackage. With themes (aka
+    skins) we cannot follow that path because we need a theme as an
+    attribute of each `University` instance.
+
+    Therefore we must tell the browser subpackage how we expect themes
+    to be announced code-wise.
+
+    What we tell here is that we might ask for a utility providing
+    IThemeProvider and that this component then should be callable to
+    give us a list of themes and their respective internal names.
+    """
+    def __call__():
+        """Get a list of all themes available.
+
+        Returns a list of ``(<NAME>, <THEME>)`` tuples where
+        ``<NAME>`` is the internal name under which a theme was
+        registered and ``<THEME>`` is the real theme.
+        """
+
+class ThemeSource(BasicSourceFactory):
+    """A source for themes.
+    """
+    def getValues(self):
+        """Get names of themes.
+        """
+        theme_provider = getUtility(IThemeProvider, name="default")
+        return [x for x, y in theme_provider()]
+    
+    def getTitle(self, value):
+        """Get a user-presentable description for a theme.
+        """
+        theme_provider = getUtility(IThemeProvider, name="default")
+        for name, theme in theme_provider():
+            if name == value:
+                return theme.description
+        return u'unnamed'
+
+class ThemeSourceBinder(object):
+    """A source binder for the `ThemeSource`.
+
+    Normally, we can pass instances of a source (like `ThemeSource`)
+    directly to fields in interfaces (writing something like ``source
+    = ThemeSource()``. With `ThemeSource` we cannot do this, because
+    the set of available themes is not available before the whole
+    `waeup.sirp` package was grokked (and parsed).
+
+    We bypass that problem by defining this trivial source-binder,
+    which is asked for themes only when the values of the source are
+    really needed and after the process of grokking and parsing
+    everything on startup.
+
+    So, although this binder binds to some context (`IUniversity` is
+    currently the only interface making use of this source, so
+    `University` instances are the only context used), the context
+    does not really matter.
+    """
+    implements(schema.interfaces.IContextSourceBinder)
+
+    def __call__(self, context):
+        return ThemeSource()
+
 class FatalCSVError(Exception):
     """Some row could not be processed.
@@ -26,4 +91,5 @@
             SimpleTerm(value, value, title) for title, value in terms])
 
+
 class IWAeUPObject(Interface):
     """A WAeUP object.
@@ -40,11 +106,10 @@
         required = True,
         )
-    
+
+        
     skin = schema.Choice(
         title = u'Skin',
         default = u'waeuptheme-gray1.css',
-        #values = ['waeuptheme-gray1.css', 'waeuptheme-red1.css'],
-        vocabulary = SimpleWAeUPVocabulary(
-            ('Henrik\'s Gray Theme', 'waeuptheme-gray1.css'), ('Uli\'s Red Theme', 'waeuptheme-red1.css')),
+        source = ThemeSourceBinder(),
         required = True,
         )
