Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/__init__.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/__init__.py	(revision 7340)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/__init__.py	(revision 7341)
@@ -10,6 +10,4 @@
     ApplicantsRoot, get_applicant_data, application_exists,
     )
-from waeup.sirp.applicants.dynamicroles import (
-    ApplicantPrincipalRoleManager,)
 
 __all__ = [
@@ -18,5 +16,4 @@
     'ApplicantImageNameChooser',
     'ApplicantImageStoreHandler',
-    'ApplicantPrincipalRoleManager',
     'ApplicantsContainer',
     'ApplicantsRoot',
Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicant.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicant.py	(revision 7340)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicant.py	(revision 7341)
@@ -20,5 +20,6 @@
 from grok import index
 from zope.component.interfaces import IFactory
-from zope.component import createObject
+from zope.component import createObject, getUtility
+from zope.catalog.interfaces import ICatalog
 from zope.securitypolicy.interfaces import IPrincipalRoleManager
 from zope.interface import implementedBy
@@ -31,6 +32,7 @@
 from waeup.sirp.utils.helpers import attrs_to_fields, get_current_principal
 from waeup.sirp.applicants.interfaces import (
-    IApplicant, IApplicantEdit,
+    IApplicant, IApplicantEdit, IApplicantBaseData,
     )
+from waeup.sirp.students.vocabularies import RegNumNotInSource
 
 class Applicant(grok.Container):
@@ -78,13 +80,40 @@
 
     def createStudent(self):
-        """Create a student object from applicatnt data
+        """Create a student object based on the applicant base data
         and copy applicant object.
         """
         student = createObject(u'waeup.Student')
+        # Check first if registration number exists
+        try:
+            student.reg_number = self.reg_number
+        except RegNumNotInSource:
+            return False, 'Registration Number exists.'
+        catalog = getUtility(ICatalog, name='certificates_catalog')
+        #import pdb; pdb.set_trace()
+        code = self.course_admitted['code']
+        if code:
+            cert = [i for i in catalog.searchResults(code=(code,code))][0]
+        else:
+            return False, 'No course admitted provided.'
         site = grok.getSite()
-
         site['students'].addStudent(student)
+        # TODO: Split fullname in students package and copy first,
+        # middle and lastaname
+        
         student.fullname = self.fullname
-        return student.student_id
+        student.sex = self.sex
+        student.date_of_birth = self.date_of_birth
+        student.email = self.email
+        student.phone = self.phone
+        student['studycourse'].certificate = cert
+        form_fields = grok.AutoFields(IApplicantBaseData)
+        field_names = [i.__name__ for i in form_fields]
+        application = createObject(u'waeup.StudentApplication')
+        for name in field_names:
+            value = getattr(self,name,None)
+            if value:
+                setattr(application,name,value)
+        site['students'][student.student_id]['application'] = application
+        return True, 'Student with Id %s created' % student.student_id
 
 # Set all attributes of Applicant required in IApplicant as field
Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py	(revision 7340)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py	(revision 7341)
@@ -438,5 +438,6 @@
     grok.template('applicantdisplaypage')
     form_fields = grok.AutoFields(IApplicant).omit(
-        'locked', 'course_admitted', 'password')
+        'locked',
+        'password')
     form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
     label = 'Applicant'
@@ -468,15 +469,13 @@
             container_title, self.context.application_number)
 
-    def getCourseAdmitted(self):
-        """Return link, title and code in html format to the certificate
-           admitted.
-        """
-        course_admitted = self.context.course_admitted
-        if ICertificate.providedBy(course_admitted):
-            url = self.url(course_admitted)
-            title = course_admitted.title
-            code = course_admitted.code
-            return '<a href="%s">%s - %s</a>' %(url,code,title)
-        return ''
+    def getDepartmentAdmitted(self):
+        course_admitted = getattr(self.context,'course_admitted',None)
+        if course_admitted:
+            return course_admitted['dep']
+
+    def getFacultyAdmitted(self):
+        course_admitted = getattr(self.context,'course_admitted',None)
+        if course_admitted:
+            return course_admitted['fac']
 
 class ApplicantBaseDisplayFormPage(ApplicantDisplayFormPage):
@@ -485,4 +484,21 @@
     form_fields = grok.AutoFields(IApplicant).select(
         'applicant_id', 'firstname', 'lastname','email', 'course1')
+
+class CreateStudentPage(grok.View):
+    """Create a student object from applicatnt data
+    and copy applicant object.
+    """
+    grok.context(IApplicant)
+    grok.name('createstudent')
+    grok.require('waeup.manageStudent')
+
+    def update(self):
+        msg = self.context.createStudent()[1]
+        self.flash(msg)
+        self.redirect(self.url(self.context))
+        return
+
+    def render(self):
+        return
 
 class AcceptanceFeePaymentAddPage(grok.View):
@@ -656,5 +672,6 @@
     grok.require('waeup.viewApplication')
     form_fields = grok.AutoFields(IApplicant).omit(
-        'locked', 'course_admitted')
+        'locked',
+        )
     form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le')
     prefix = 'form'
@@ -666,14 +683,14 @@
             container_title, self.context.application_number)
 
-    def getCourseAdmitted(self):
-        """Return title and code in html format to the certificate
-           admitted.
-        """
-        course_admitted = self.context.course_admitted
-        if ICertificate.providedBy(course_admitted):
-            title = course_admitted.title
-            code = course_admitted.code
-            return '%s - %s' %(code,title)
-        return ''
+    def getDepartmentAdmitted(self):
+        course_admitted = getattr(self.context,'course_admitted',None)
+        if course_admitted:
+            return course_admitted['dep']
+
+    def getFacultyAdmitted(self):
+        course_admitted = getattr(self.context,'course_admitted',None)
+        if course_admitted:
+            return course_admitted['fac']
+
 
     def setUpWidgets(self, ignore_request=False):
@@ -738,9 +755,22 @@
             f_text = Paragraph(f_text, style["Normal"])
             data.append([f_label,f_text])
-        f_label = '<font size=12>Admitted Course of Study:</font>'
-        f_text = '<font size=12>%s</font>' % self.getCourseAdmitted()
+        #f_label = '<font size=12>Admitted Course of Study:</font>'
+        #f_text = '<font size=12>%s</font>' % self.getCourseAdmitted()
+        #f_label = Paragraph(f_label, style["Normal"])
+        #f_text = Paragraph(f_text, style["Normal"])
+        #data.append([f_label,f_text])
+
+        f_label = '<font size=12>Department:</font>'
+        f_text = '<font size=12>%s</font>' % self.getDepartmentAdmitted()
         f_label = Paragraph(f_label, style["Normal"])
         f_text = Paragraph(f_text, style["Normal"])
         data.append([f_label,f_text])
+
+        f_label = '<font size=12>Faculty:</font>'
+        f_text = '<font size=12>%s</font>' % self.getFacultyAdmitted()
+        f_label = Paragraph(f_label, style["Normal"])
+        f_text = Paragraph(f_text, style["Normal"])
+        data.append([f_label,f_text])
+
         # Create table
         table = Table(data,style=SLIP_STYLE)
Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantdisplaypage.pt
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantdisplaypage.pt	(revision 7340)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantdisplaypage.pt	(revision 7341)
@@ -27,8 +27,16 @@
     <tr>
       <td class="fieldname">
-          Admitted Course of Study:
+          Department:
       </td>
       <td>
-        <span tal:replace="structure view/getCourseAdmitted" />
+        <span tal:replace="view/getDepartmentAdmitted" />
+      </td>
+    </tr>
+    <tr>
+      <td class="fieldname">
+          Faculty:
+      </td>
+      <td>
+        <span tal:replace="view/getFacultyAdmitted" />
       </td>
     </tr>
Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py	(revision 7340)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py	(revision 7341)
@@ -32,10 +32,8 @@
     ISIRPObject, year_range, validate_email, academic_sessions_vocab)
 from waeup.sirp.university.vocabularies import application_categories
-from waeup.sirp.students.vocabularies import (
-  lgas_vocab, CertificateSource, GenderSource,
-  )
+from waeup.sirp.students.vocabularies import lgas_vocab, GenderSource
 from waeup.sirp.applicants.vocabularies import (
   application_types_vocab, application_pins_vocab,
-  AppCatCertificateSource,
+  AppCatCertificateTitleSource, CertificateTitleSource
   )
 from waeup.sirp.payments.interfaces import IOnlinePayment
@@ -345,10 +343,10 @@
     course1 = schema.Choice(
         title = u'1st Choice Course of Study',
-        source = CertificateSource(),
+        source = CertificateTitleSource(),
         required = True,
         )
     course2 = schema.Choice(
         title = u'2nd Choice Course of Study',
-        source = CertificateSource(),
+        source = CertificateTitleSource(),
         required = False,
         )
@@ -365,12 +363,12 @@
         required = False,
         )
+    notice = schema.Text(
+        title = u'Notice',
+        required = False,
+        )
     course_admitted = schema.Choice(
         title = u'Admitted Course of Study',
-        source = CertificateSource(),
-        default = None,
-        required = False,
-        )
-    notice = schema.Text(
-        title = u'Notice',
+        source = CertificateTitleSource(),
+        default = None,
         required = False,
         )
@@ -425,10 +423,10 @@
     course1 = schema.Choice(
         title = u'1st Choice Course of Study',
-        source = AppCatCertificateSource(),
+        source = AppCatCertificateTitleSource(),
         required = True,
         )
     course2 = schema.Choice(
         title = u'2nd Choice Course of Study',
-        source = AppCatCertificateSource(),
+        source = AppCatCertificateTitleSource(),
         required = False,
         )
@@ -445,5 +443,5 @@
     course_admitted = schema.Choice(
         title = u'Admitted Course of Study',
-        source = CertificateSource(),
+        source = CertificateTitleSource(),
         default = None,
         required = False,
Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/vocabularies.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/vocabularies.py	(revision 7340)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/vocabularies.py	(revision 7341)
@@ -21,5 +21,5 @@
 from zope.catalog.interfaces import ICatalog
 from waeup.sirp.interfaces import SimpleSIRPVocabulary
-from waeup.sirp.students.vocabularies import CertificateSource
+from zc.sourcefactory.contextual import BasicContextualSourceFactory
 
 #: Types of applications we support.
@@ -44,7 +44,27 @@
     *[(u"%s (%s)" % (x[2],x[0]),x[2]) for x in APPLICATION_TYPES])
 
+class CertificateTitleSource(BasicContextualSourceFactory):
+    """A certificate title source delivers all certificates titles provided
+    in the portal.
+    """
+    def getValues(self, context):
+        catalog = getUtility(ICatalog, name='certificates_catalog')
+        certs = list(catalog.searchResults(code=('', 'z*')))
+        certs = [dict(
+            code = i.code,
+            title = i.title,
+            dep = i.__parent__.__parent__.longtitle(),
+            fac = i.__parent__.__parent__.__parent__.longtitle()
+            ) for i in certs]
+        return sorted(certs, key=lambda value: value['code'])
 
-class AppCatCertificateSource(CertificateSource):
-    """An application certificate source delivers all courses which belong to
+    def getToken(self, context, value):
+        return value['code']
+
+    def getTitle(self, context, value):
+        return "%s - %s" % (value['code'], value['title'][:64])
+
+class AppCatCertificateTitleSource(CertificateTitleSource):
+    """An application certificate source delivers all course titles which belong to
     a certain application_category.
     """
@@ -52,7 +72,13 @@
         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)
+        certs = list(catalog.searchResults(code=('', 'z*'),
+            application_category=(appcat,appcat)))
+        certs = [dict(
+            code = i.code,
+            title = i.title,
+            dep = i.__parent__.__parent__.longtitle(),
+            fac = i.__parent__.__parent__.__parent__.longtitle()
+            ) for i in certs]
+        return sorted(certs, key=lambda value: value['code'])
+
+
