Index: /WAeUP_SRP/base/Widgets.py
===================================================================
--- /WAeUP_SRP/base/Widgets.py	(revision 3435)
+++ /WAeUP_SRP/base/Widgets.py	(revision 3436)
@@ -13,4 +13,5 @@
 from Products.CPSSchemas.BasicWidgets import renderHtmlTag,CPSSelectWidget, CPSStringWidget
 from Products.CPSSchemas.ExtendedWidgets import CPSDateTimeWidget
+from Products.CPSSchemas.Vocabulary import Vocabulary
 from Products.CPSSchemas.Widget import widgetRegistry
 from Products.CPSUtil.file import PersistableFileUpload
@@ -765,4 +766,115 @@
 
 widgetRegistry.register(StudyCourseWidget)
+###)
+
+class VocabularyOnTheFly: ###(
+    def __init__(self, tuples):
+        """a nonpersistent vocabulary (copy from CPSSchemas.Vocabulary.Vocabulary).
+        Allowed parameter syntaxes is:
+          - Vocabulary((('foo', "Foo", 'label_foo'), ('bar', "Bar", 'label_bar')))
+            Same as first with message ids (msgids) that can be used for i18n
+        """
+        l = []
+        d = {}
+        m = {}
+        # We suppose that initial vocabulary is sorted
+        # Vocabulary((('foo', "Foo", 'label_foo'), ('bar', "Bar", 'label_bar')))
+        for k, v, msgid in tuples:
+            l.append(k)
+            d[k] = v
+            m[k] = msgid
+        self._list = l
+        self._dict = d
+        self._msgids = m
+    
+    def __getitem__(self, key):
+        """Get a label for a key."""
+        return self._dict[key]
+
+    def get(self, key, default=None):
+        """Get a label for a key, default to None."""
+        try:
+            v = self._dict.get(key, default)
+        except TypeError:
+            # XXX temporary fix, don't know why sometime rendering try to do
+            # get([]) that returning a typeError
+            return ''
+        return v
+
+    def getMsgid(self, key, default=None):
+        """Get a msgid for a key, default to None."""
+        return self._msgids.get(key, default)
+
+    def has_key(self, key):
+        """Test if a key is present."""
+        return self._dict.has_key(key)
+
+    def keys(self):
+        """Get the ordered list of keys."""
+        return self._list[:]
+
+    def items(self):
+        """Get the ordered list of (key, value)."""
+        return [(key, self._dict.get(key)) for key in self._list]
+
+    def values(self):
+        """Get the ordered list of values."""
+        return [self._dict.get(key) for key in self._list]
+
+    def keysSortedBy(self, crit='id'):
+        """Return a keys list sorted on a criterium
+
+        Crit is one of 'id', 'label' or 'i18n'.
+        """
+
+        if crit == 'label':
+            l = [(x[1], x[0]) for x in self.items()]
+            l.sort()
+            return [x[1] for x in l]
+        elif crit == 'i18n':
+            portal = getToolByName(self, 'portal_url').getPortalObject()
+            cpsmcat = portal.translation_service
+            l = [(cpsmcat(self.getMsgid(key)).encode('ISO-8859-15', 'ignore'),
+                  key) for key in self.keys()]
+            l.sort()
+            return [x[1] for x in l]
+        else:
+            return self.keys()
+###)
+
+class ApplicationCourseWidget(CPSSelectWidget): ###(
+    """ ApplicationCourse Widget"""
+    meta_type = "Application Course Widget"
+
+    def _getVocabulary(self,datastructure=None):
+        if self.REQUEST.traverse_subpath:
+            screening_type = self.REQUEST.traverse_subpath[0].upper()
+        else:
+            screening_type = 'ALL'
+        if screening_type in ("ALL","CEST","SANDWICH"):
+            application_category = screening_type
+        else:
+            application_category = "BASIC"
+        if not hasattr(self,'_v_certificates_docs'):
+            res = self.portal_catalog_real.search({'meta_type': "Certificate"})
+            d = {}
+            for cert in res:
+                c = cert.getObject().getContent()
+                if getattr(c,'application_category',''):
+                    d[cert.getId] = c
+            self._v_certificates_docs = d
+        l  = []
+        for k,d in self._v_certificates_docs.items():
+            if application_category == "ALL":
+                l  += (k,self._v_certificates_docs[k].title,k),
+            else:
+                if getattr(d,'application_category','') == application_category:
+                    l  += (k,self._v_certificates_docs[k].title,k),
+        #import ipdb;ipdb.set_trace()
+        return VocabularyOnTheFly(l)
+                                        
+InitializeClass(ApplicationCourseWidget)
+
+widgetRegistry.register(ApplicationCourseWidget)
 ###)
 
Index: /WAeUP_SRP/base/skins/waeup_utilities/fillApplicationCategory.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_utilities/fillApplicationCategory.py	(revision 3436)
+++ /WAeUP_SRP/base/skins/waeup_utilities/fillApplicationCategory.py	(revision 3436)
@@ -0,0 +1,65 @@
+## Script (Python) "ti_507_resolve"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+if str(member) not in ('admin','joachim'):
+    return
+
+import logging
+import DateTime
+logger = logging.getLogger('Skins.fillApplicationCategory')
+from Products.AdvancedQuery import Eq, Between, Le,In
+#aq_students = context.students_catalog.evalAdvancedQuery
+aq_portal = context.portal_catalog_real.evalAdvancedQuery
+#students_folder = context.portal_url.getPortalObject().campus.students
+
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+logger.info('start')
+count = 0
+found = 0
+commit_after = 1000
+#certificates = context.getCertificatesDict()
+certificates = context.portal_catalog.search({'meta_type': "Certificate"})
+logger.info("found %d certificates" % len(certificates))
+cat = {'cos': 'BASIC',
+       'cos_cest': 'CEST',
+       'cos_sandwich': 'SANDWICH',
+       }
+to_change = {}
+for cert in certificates:
+    found = []
+    for v in ('cos','cos_cest','cos_sandwich'):
+        voc = getattr(context.portal_vocabularies,v)
+        if cert.id in voc.keys():
+            found += v,
+    if found:
+        d = {}
+        d['application_category'] = cat[found[0]]
+        d['cert_doc'] = cert.getObject().getContent()
+        to_change[cert.id] = d
+        logger.info("%s in %s" % (cert.id,','.join(found)))
+        count += 1
+for cert,d in to_change.items():
+    d['cert_doc'].edit(mapping = d)
+    logger.info("set application_category of %s to %s" % 
+               (cert,d['application_category']))
+logger.info("found %d not in vocabularies" % count)
Index: /WAeUP_SRP/uniben/profiles/default/layouts/application_cest.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/layouts/application_cest.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/layouts/application_cest.xml	(revision 3436)
@@ -457,5 +457,5 @@
   <property name="vocabulary">application_status</property>
  </widget>
-  <widget name="course1" meta_type="Select Widget">
+  <widget name="course1" meta_type="Application Course Widget">
     <property name="title">1st Choice Course of Study</property>
     <property name="fields">
@@ -478,5 +478,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course2" meta_type="Select Widget">
+  <widget name="course2" meta_type="Application Course Widget">
     <property name="title">2nd Choice Course of Study</property>
     <property name="fields">
@@ -499,5 +499,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course3" meta_type="Select Widget">
+  <widget name="course3" meta_type="Application Course Widget">
     <property name="title">3rd Choice Course of Study</property>
     <property name="fields">
@@ -520,5 +520,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course_admitted" meta_type="Select Widget">
+  <widget name="course_admitted" meta_type="Application Course Widget">
     <property name="title">Admitted Course of Study</property>
     <property name="fields">
Index: /WAeUP_SRP/uniben/profiles/default/layouts/application_manage.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/layouts/application_manage.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/layouts/application_manage.xml	(revision 3436)
@@ -629,5 +629,5 @@
   <property name="vocabulary">application_status</property>
  </widget>
-  <widget name="course1" meta_type="Select Widget">
+  <widget name="course1" meta_type="Application Course Widget">
     <property name="title">1st Choice Course of Study</property>
     <property name="fields">
@@ -649,5 +649,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course2" meta_type="Select Widget">
+  <widget name="course2" meta_type="Application Course Widget">
     <property name="title">2nd Choice Course of Study</property>
     <property name="fields">
@@ -670,5 +670,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course3" meta_type="Select Widget">
+  <widget name="course3" meta_type="Application Course Widget">
     <property name="title">3rd Choice Course of Study</property>
     <property name="fields">
@@ -692,5 +692,5 @@
   </widget>
 
-  <widget name="course_admitted" meta_type="Select Widget">
+  <widget name="course_admitted" meta_type="Application Course Widget">
     <property name="title">Admitted Course of Study</property>
     <property name="fields">
Index: /WAeUP_SRP/uniben/profiles/default/layouts/application_pce.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/layouts/application_pce.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/layouts/application_pce.xml	(revision 3436)
@@ -45,5 +45,5 @@
   <property name="time_setting">False</property>
  </widget>
- <widget name="course1" meta_type="Select Widget">
+ <widget name="course1" meta_type="Application Course Widget">
   <property name="title">1st Choice Course of Study</property>
   <property name="fields">
@@ -62,5 +62,5 @@
   <property name="vocabulary">cos</property>
  </widget>
- <widget name="course2" meta_type="Select Widget">
+ <widget name="course2" meta_type="Application Course Widget">
   <property name="title">2nd Choice Course of Study</property>
   <property name="fields">
@@ -77,5 +77,5 @@
   <property name="vocabulary">cos</property>
  </widget>
- <widget name="course3" meta_type="Select Widget">
+ <widget name="course3" meta_type="Application Course Widget">
   <property name="title">3rd Choice Course of Study</property>
   <property name="fields">
@@ -93,5 +93,5 @@
   <property name="sorted">True</property>
  </widget>
- <widget name="course_admitted" meta_type="Select Widget">
+ <widget name="course_admitted" meta_type="Application Course Widget">
   <property name="title">Admitted Course of Study</property>
   <property name="fields">
Index: /WAeUP_SRP/uniben/profiles/default/layouts/application_pde.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/layouts/application_pde.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/layouts/application_pde.xml	(revision 3436)
@@ -630,5 +630,5 @@
   <property name="vocabulary">application_status</property>
  </widget>
-  <widget name="course1" meta_type="Select Widget">
+  <widget name="course1" meta_type="Application Course Widget">
     <property name="title">1st Choice Course of Study</property>
     <property name="fields">
@@ -652,5 +652,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course2" meta_type="Select Widget">
+  <widget name="course2" meta_type="Application Course Widget">
     <property name="title">2nd Choice Course of Study</property>
     <property name="fields">
@@ -673,5 +673,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course3" meta_type="Select Widget">
+  <widget name="course3" meta_type="Application Course Widget">
     <property name="title">3rd Choice Course of Study</property>
     <property name="fields">
@@ -694,5 +694,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course_admitted" meta_type="Select Widget">
+  <widget name="course_admitted" meta_type="Application Course Widget">
     <property name="title">Admitted Course of Study</property>
     <property name="fields">
Index: /WAeUP_SRP/uniben/profiles/default/layouts/application_prence.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/layouts/application_prence.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/layouts/application_prence.xml	(revision 3436)
@@ -578,5 +578,5 @@
   <property name="vocabulary">application_status</property>
  </widget>
-  <widget name="course1" meta_type="Select Widget">
+  <widget name="course1" meta_type="Application Course Widget">
     <property name="title">1st Choice Course of Study</property>
     <property name="fields">
@@ -599,5 +599,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course2" meta_type="Select Widget">
+  <widget name="course2" meta_type="Application Course Widget">
     <property name="title">2nd Choice Course of Study</property>
     <property name="fields">
@@ -620,5 +620,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course3" meta_type="Select Widget">
+  <widget name="course3" meta_type="Application Course Widget">
     <property name="title">3rd Choice Course of Study</property>
     <property name="fields">
@@ -641,5 +641,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course_admitted" meta_type="Select Widget">
+  <widget name="course_admitted" meta_type="Application Course Widget">
     <property name="title">Admitted Course of Study</property>
     <property name="fields">
Index: /WAeUP_SRP/uniben/profiles/default/layouts/application_pume.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/layouts/application_pume.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/layouts/application_pume.xml	(revision 3436)
@@ -549,5 +549,5 @@
   <property name="vocabulary">application_status</property>
  </widget>
-  <widget name="course1" meta_type="Select Widget">
+  <widget name="course1" meta_type="Application Course Widget">
     <property name="title">1st Choice Course of Study</property>
     <property name="fields">
@@ -570,5 +570,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course2" meta_type="Select Widget">
+  <widget name="course2" meta_type="Application Course Widget">
     <property name="title">2nd Choice Course of Study</property>
     <property name="fields">
@@ -591,5 +591,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course3" meta_type="Select Widget">
+  <widget name="course3" meta_type="Application Course Widget">
     <property name="title">3rd Choice Course of Study</property>
     <property name="fields">
@@ -613,5 +613,5 @@
   </widget>
 
-  <widget name="course_admitted" meta_type="Select Widget">
+  <widget name="course_admitted" meta_type="Application Course Widget">
     <property name="title">Admitted Course of Study</property>
     <property name="fields">
Index: /WAeUP_SRP/uniben/profiles/default/layouts/application_sandwich.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/layouts/application_sandwich.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/layouts/application_sandwich.xml	(revision 3436)
@@ -457,5 +457,5 @@
   <property name="vocabulary">application_status</property>
  </widget>
-  <widget name="course1" meta_type="Select Widget">
+  <widget name="course1" meta_type="Application Course Widget">
     <property name="title">1st Choice Course of Study</property>
     <property name="fields">
@@ -478,5 +478,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course2" meta_type="Select Widget">
+  <widget name="course2" meta_type="Application Course Widget">
     <property name="title">2nd Choice Course of Study</property>
     <property name="fields">
@@ -499,5 +499,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course3" meta_type="Select Widget">
+  <widget name="course3" meta_type="Application Course Widget">
     <property name="title">3rd Choice Course of Study</property>
     <property name="fields">
@@ -520,5 +520,5 @@
     <property name="css_class_expr">string:row</property>
   </widget>
-  <widget name="course_admitted" meta_type="Select Widget">
+  <widget name="course_admitted" meta_type="Application Course Widget">
     <property name="title">Admitted Course of Study</property>
     <property name="fields">
Index: /WAeUP_SRP/uniben/profiles/default/layouts/certificate.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/layouts/certificate.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/layouts/certificate.xml	(revision 3436)
@@ -66,4 +66,16 @@
   <property name="hidden_readonly_layout_modes"/>
  </widget>
+ <widget name="application_category" meta_type="Select Widget">
+  <property name="title">Application Category</property>
+  <property name="fields">
+   <element value="application_category"/>
+  </property>
+  <property name="label">Application Category</property>
+  <property name="label_edit">Application Category</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="vocabulary">application_categories</property>
+ </widget>
  <widget name="end_level" meta_type="Select Widget">
   <property name="title">End Level</property>
@@ -256,4 +268,7 @@
   </row>
   <row>
+   <cell name="application_category"/>
+  </row>
+  <row>
    <cell name="study_mode"/>
   </row>  
Index: /WAeUP_SRP/uniben/profiles/default/schemas/certificate.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/schemas/certificate.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/schemas/certificate.xml	(revision 3436)
@@ -5,4 +5,5 @@
  <field name="admin_status" meta_type="CPS String Field"/>
  <field name="category" meta_type="CPS String Field"/>
+ <field name="application_category" meta_type="CPS String Field"/>
  <field name="code" meta_type="CPS String Field">
   <property name="is_searchabletext">False</property>
Index: /WAeUP_SRP/uniben/profiles/default/vocabularies.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/vocabularies.xml	(revision 3435)
+++ /WAeUP_SRP/uniben/profiles/default/vocabularies.xml	(revision 3436)
@@ -5,4 +5,5 @@
  <object name="acco_hall_beds" meta_type="CPS Method Vocabulary"/>
  <object name="acco_hall_reserved_rooms" meta_type="CPS Method Vocabulary"/>
+ <object name="application_categories" meta_type="CPS Vocabulary"/>
  <object name="levels" meta_type="CPS Vocabulary"/>
  <object name="student_levels" meta_type="CPS Method Vocabulary"/>
Index: /WAeUP_SRP/uniben/profiles/default/vocabularies/application_categories.xml
===================================================================
--- /WAeUP_SRP/uniben/profiles/default/vocabularies/application_categories.xml	(revision 3436)
+++ /WAeUP_SRP/uniben/profiles/default/vocabularies/application_categories.xml	(revision 3436)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="vocabulary.xsl"?>
+<object name="cos_cest" meta_type="CPS Vocabulary">
+    <property name="title"></property>
+    <property name="title_msgid"></property>
+    <property name="description"></property>
+    <property name="acl_write_roles">Manager</property>
+
+    <item key="" msgid="">--</item>
+    <item key="BASIC" msgid="">PCE,PDE,PRENCE,PUME</item>
+    <item key="CEST" msgid="">CEST</item>
+    <item key="SANDWICH" msgid="">Sandwich</item>
+
+</object>
