Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py	(revision 6247)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py	(revision 6248)
@@ -27,7 +27,9 @@
 from grokcore.content.interfaces import IContainer
 from zc.sourcefactory.basic import BasicSourceFactory
+from zc.sourcefactory.contextual import BasicContextualSourceFactory
 from zope import schema
 from zope.component import getUtility, getUtilitiesFor
 from zope.interface import Interface, Attribute
+from zope.catalog.interfaces import ICatalog
 from zope.pluggableauth.interfaces import IPrincipalInfo
 from zope.security.interfaces import IGroupClosureAwarePrincipal as IPrincipal
@@ -72,4 +74,34 @@
     *[(u"%s (%s)" % (x[2],x[0]),x[2]) for x in APPLICATION_TYPES])
 
+class CertificateSource(BasicContextualSourceFactory):
+    """A certificate source delivers all certificates provided
+    in the portal.
+    """
+    def getValues(self, context):
+        catalog = getUtility(ICatalog, name='certificates_catalog')
+        return sorted(list(
+                catalog.searchResults(
+                    code=('', 'z*'))),
+                    key=lambda value: value.code)
+
+    def getToken(self, context, value):
+        return value.code
+
+    def getTitle(self, context, value):
+        return "%s - %s" % (value.code, value.title[:64])
+
+class AppCatCertificateSource(CertificateSource):
+    """An application certificate source delivers all courses which belong to
+    a certain application_category.
+    """
+    def getValues(self, context):
+        appcat = context.__parent__.application_category
+        catalog = getUtility(ICatalog, name='certificates_catalog')
+        return sorted(list(
+                catalog.searchResults(
+                    code=('', 'z*'),
+                    application_category=(appcat,appcat))),
+                    key=lambda value: value.code)
+
 def year_range():
     curr_year = datetime.now().year
@@ -325,12 +357,12 @@
         readonly = True,
         )
-    course1 = schema.TextLine(
-        # XXX: should be choice
+    course1 = schema.Choice(
         title = u'1st Choice Course of Study',
-        required = False,
-        )
-    course2 = schema.TextLine(
-        # XXX: should be choice
+        source = AppCatCertificateSource(),
+        required = False,
+        )
+    course2 = schema.Choice(
         title = u'2nd Choice Course of Study',
+        source = AppCatCertificateSource(),
         required = False,
         )
@@ -403,7 +435,8 @@
         required = False,
         )
-    course_admitted = schema.TextLine(
+    course_admitted = schema.Choice(
         # XXX: should be choice
         title = u'Admitted Course of Study',
+        source = CertificateSource(),
         required = False,
         )
@@ -422,5 +455,4 @@
         readonly = True,
         )
-
 
 class IApplicant(IApplicantBaseData):
