Index: main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py	(revision 15867)
+++ main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py	(revision 15948)
@@ -28,5 +28,6 @@
 from waeup.kofa.utils.helpers import string_from_bytes, file_size
 from waeup.kofa.applicants.browser import (
-    ApplicantCheckStatusPage, ApplicantBaseDisplayFormPage)
+    ApplicantCheckStatusPage, ApplicantBaseDisplayFormPage,
+    AdditionalFile)
 from waeup.kofa.applicants.workflow import STARTED, PAID
 from waeup.kofa.applicants.viewlets import PDFActionButton
@@ -228,45 +229,7 @@
 MAX_FILE_UPLOAD_SIZE = 1024 * 500
 
-def handle_file_upload(upload, context, view, attr=None):
-    """Handle upload of applicant files.
-
-    Returns `True` in case of success or `False`.
-
-    Please note that file pointer passed in (`upload`) most probably
-    points to end of file when leaving this function.
-    """
-    size = file_size(upload)
-    if size > MAX_FILE_UPLOAD_SIZE:
-        view.flash(_('Uploaded file is too big!'))
-        return False
-    dummy, ext = os.path.splitext(upload.filename)
-    ext.lower()
-    if ext != '.pdf':
-        view.flash(_('pdf file extension expected.'))
-        return False
-    upload.seek(0) # file pointer moved when determining size
-    store = getUtility(IExtFileStore)
-    file_id = IFileStoreNameChooser(context).chooseName(attr=attr)
-    store.createFile(file_id, upload)
-    return True
-
 class CustomApplicantDisplayFormPage(NigeriaApplicantDisplayFormPage):
     """A display view for applicant data.
     """
-
-    @property
-    def file_links(self):
-        html = ''
-        pdf = getUtility(IExtFileStore).getFileByContext(
-            self.context, attr='stateresult.pdf')
-        if pdf:
-            html += '<a href="%s">Statement of Result</a>' % self.url(
-                self.context, 'stateresult.pdf')
-        pdf = getUtility(IExtFileStore).getFileByContext(
-            self.context, attr='verificationdoc.pdf')
-        if pdf:
-            html += '<a href="%s">Result/Certificate Document</a>' % self.url(
-                self.context, 'verificationdoc.pdf')
-        return html
 
     @property
@@ -335,9 +298,4 @@
             return '<a href="%s">%s - %s</a>' %(url,code,title)
         return ''
-
-    #def update(self):
-    #    super(CustomApplicantDisplayFormPage, self).update()
-    #    #self.extraform_url = self.url(self.context, 'stateresult.pdf')
-    #    return
 
 class CustomPDFActionButton(PDFActionButton):
@@ -430,4 +388,13 @@
     """
 
+    def display_fileupload(self, filename):
+        if filename[1] == 'stateresult.pdf':
+            if self.target in ('trans', 'cert'):
+                return True
+        if filename[1] == 'verificationdoc.pdf':
+            if self.target in ('ver', 'send'):
+                return True
+        return False
+
     @property
     def form_fields(self):
@@ -466,30 +433,16 @@
         return form_fields
 
-    def update(self):
-        super(CustomApplicantManageFormPage, self).update()
-        upload_stateresult = self.request.form.get('form.stateresult', None)
-        upload_verificationdoc = self.request.form.get('form.verificationdoc', None)
-        if upload_stateresult:
-            # We got a fresh stateresult upload
-            success = handle_file_upload(
-                upload_stateresult, self.context, self, attr='stateresult.pdf')
-            if success:
-                self.context.writeLogMessage(self, 'saved: stateresult')
-            else:
-                self.upload_success = False
-        if upload_verificationdoc:
-            # We got a fresh verificationdoc upload
-            success = handle_file_upload(
-                upload_verificationdoc, self.context, self, attr='verificationdoc.pdf')
-            if success:
-                self.context.writeLogMessage(self, 'saved: verificationdoc')
-            else:
-                self.upload_success = False
-        self.max_file_upload_size = string_from_bytes(MAX_FILE_UPLOAD_SIZE)
-        return
-
 class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage):
     """An applicant-centered edit view for applicant data.
     """
+
+    def display_fileupload(self, filename):
+        if filename[1] == 'stateresult.pdf':
+            if self.target in ('trans', 'cert'):
+                return True
+        if filename[1] == 'verificationdoc.pdf':
+            if self.target in ('ver', 'send'):
+                return True
+        return False
 
     def unremovable(self, ticket):
@@ -625,19 +578,4 @@
             return
         super(CustomApplicantEditFormPage, self).update()
-        upload_stateresult = self.request.form.get('form.stateresult', None)
-        upload_verificationdoc = self.request.form.get('form.verificationdoc', None)
-        if upload_stateresult:
-            # We got a fresh stateresult upload
-            success = handle_file_upload(
-                upload_stateresult, self.context, self, attr='stateresult.pdf')
-            if not success:
-                self.upload_success = False
-        if upload_verificationdoc:
-            # We got a fresh verificationdoc upload
-            success = handle_file_upload(
-                upload_verificationdoc, self.context, self, attr='verificationdoc.pdf')
-            if not success:
-                self.upload_success = False
-        self.max_file_upload_size = string_from_bytes(MAX_FILE_UPLOAD_SIZE)
         return
 
@@ -769,27 +707,11 @@
             self.context, applicantview, note=self.note)
 
-class StateResult(grok.View):
+class StateResult(AdditionalFile):
     """Renders the pdf form extension for applicants.
     """
     grok.name('stateresult.pdf')
-    grok.context(ICustomApplicant)
-    grok.require('waeup.viewApplication')
-
-    def render(self):
-        pdf = getUtility(IExtFileStore).getFileByContext(
-            self.context, attr='stateresult.pdf')
-        self.response.setHeader('Content-Type', 'application/pdf')
-        return pdf
-
-class VerificationDoc(grok.View):
+
+class VerificationDoc(AdditionalFile):
     """Renders the pdf form extension for applicants.
     """
     grok.name('verificationdoc.pdf')
-    grok.context(ICustomApplicant)
-    grok.require('waeup.viewApplication')
-
-    def render(self):
-        pdf = getUtility(IExtFileStore).getFileByContext(
-            self.context, attr='verificationdoc.pdf')
-        self.response.setHeader('Content-Type', 'application/pdf')
-        return pdf
Index: main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicantdisplaypage.pt
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicantdisplaypage.pt	(revision 15867)
+++ 	(revision )
@@ -1,80 +1,0 @@
-<h2 i18n:domain="waeup.kofa">
-  ...
-  <span tal:replace="context/translated_state">APPLICATIONSTATE
-  </span>
-  <span tal:omit-tag=""
-    i18n:translate="" tal:condition="context/suspended">(account suspended)
-  </span>
-  ...
-</h2>
-
-<div class="workflow">
-  <div tal:repeat="msg context/history/messages">
-    <span tal:replace="msg">MESSAGE</span><br />
-  </div>
-</div>
-
-<img tal:condition="python: context.__parent__.with_picture"
-     src="" height="180px" tal:attributes="src view/passport_url" />
-
-<table i18n:domain="waeup.kofa" class="form-table">
-  <tbody>
-    <tal:files tal:condition="python: view.target in ('trans', 'cert', 'ver', 'send')">
-      <tr>
-        <td class="separator" colspan=2>
-          Files
-        </td>
-      </tr>
-      <tr>
-        <td colspan=2>
-          <span tal:replace="structure view/file_links" />
-        </td>
-      </tr>
-    </tal:files>
-    <tal:widgets content="structure provider:widgets" />
-    <tr tal:condition="view/getCourseAdmitted">
-      <td class="fieldname" i18n:translate="">
-          Admitted Course of Study:
-      </td>
-      <td>
-        <span tal:replace="structure view/getCourseAdmitted" />
-      </td>
-    </tr>
-    <tr>
-      <td class="fieldname" i18n:translate="">
-          Password:
-      </td>
-      <td>
-          <tal:password replace="view/hasPassword" />
-      </td>
-    <tr>
-  </tbody>
-</table>
-<tal:payments condition="view/display_payments">
-  <h3 i18n:domain="waeup.kofa" i18n:translate="">
-      Payment Tickets
-  </h3>
-  <table i18n:domain="waeup.kofa" class="table table-condensed">
-    <thead>
-      <tr>
-        <th i18n:translate="">Payment Id</th>
-        <th i18n:translate="">Creation Date</th>
-        <th i18n:translate="">Payment Date</th>
-        <th i18n:translate="">Category</th>
-        <th i18n:translate="">Item</th>
-        <th i18n:translate="">State</th>
-      </tr>
-    </thead>
-    <tbody>
-      <tr tal:repeat="value context/payments">
-        <td> <a tal:attributes="href python:view.url(value)">
-        <span tal:content="value/p_id">PID</span></a></td>
-        <td tal:content="python: layout.formatDatetime(value.creation_date)">CREATION DATE</td>
-        <td tal:content="python: layout.formatDatetime(value.payment_date)">PAYMENT DATE</td>
-        <td tal:content ="value/category">CATEGORY</td>
-        <td tal:content ="value/display_item">ITEM</td>
-        <td tal:content ="value/p_state_title">STATE</td>
-      </tr>
-    </tbody>
-  </table>
-</tal:payments>
Index: main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicanteditpage.pt
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicanteditpage.pt	(revision 15867)
+++ main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser_templates/applicanteditpage.pt	(revision 15948)
@@ -3,5 +3,5 @@
       autocomplete="off">
 
-  <h2 i18n:domain="waeup.kofa">
+  <h2 i18n:domain="waeup.kofa" tal:condition="context/translated_state">
     ...
     <span tal:replace="context/translated_state">APPLICATIONSTATE
@@ -13,5 +13,5 @@
   </h2>
 
-  <div class="workflow">
+  <div class="workflow" tal:condition="context/history">
     <div tal:repeat="msg context/history/messages">
       <span tal:replace="msg">MESSAGE</span><br />
@@ -43,54 +43,35 @@
           <span tal:replace="view/max_upload_size">10 KB</span>
       </tr>
-      <tr tal:condition="python: view.target in ('trans', 'cert')">
-        <td class="fieldname" i18n:translate="">
-          Statement of Result:
-        </td>
-        <td>
-          <p tal:condition="python: view.file_exists('stateresult.pdf')">
-            <a href="stateresult.pdf"
-               i18n:translate="">
-              Download pdf file
-            </a>
-          </p>
-          <div class="input-group half">
-            <div class="input-group-btn">
-              <div class="btn btn-default btn-file">
-                Select&hellip;
-              <input type="file" name="form.stateresult" />
+
+      <tal:files>
+        <tr tal:repeat="filename view/additional_files">
+          <tal:cond tal:condition="python:view.display_fileupload(filename)">
+            <td class="fieldname">
+              <span tal:replace="python:filename[0]">FILENAME</span>:
+            </td>
+            <td>
+              <p tal:condition="python:view.file_exists(filename[1])">
+                <a tal:attributes="href python:filename[1]"i18n:translate="">
+                  Download pdf file
+                </a>
+              </p>
+              <div class="input-group half">
+                <div class="input-group-btn">
+                  <div class="btn btn-default btn-file">
+                    Select&hellip;
+                  <input type="file" tal:attributes="name python:filename[1]" />
+                  </div>
+                </div>
+                <input type="text" class="form-control" readonly>
               </div>
-            </div>
-            <input type="text" class="form-control" readonly>
-          </div>
-          <span i18n:translate="">
-            PDF files only. Max. file size:
-          </span>
-          <span tal:replace="view/max_file_upload_size">10 KB</span>
-      </tr>
-      <tr tal:condition="python: view.target in ('ver', 'send')">
-        <td class="fieldname" i18n:translate="">
-          Scanned Document:
-        </td>
-        <td>
-          <p tal:condition="python: view.file_exists('verificationdoc.pdf')">
-            <a href="verificationdoc.pdf"
-               i18n:translate="">
-              Download pdf file
-            </a>
-          </p>
-          <div class="input-group half">
-            <div class="input-group-btn">
-              <div class="btn btn-default btn-file">
-                Select&hellip;
-              <input type="file" name="form.verificationdoc" />
-              </div>
-            </div>
-            <input type="text" class="form-control" readonly>
-          </div>
-          <span i18n:translate="">
-            PDF files only. Max. file size:
-          </span>
-          <span tal:replace="view/max_file_upload_size">10 KB</span>
-      </tr>
+              <span i18n:translate="">
+                PDF files only. Max. file size:
+              </span>
+              <span tal:replace="view/max_file_upload_size">10 KB</span>
+            </td>
+          </tal:cond>
+        </tr>
+      </tal:files>
+
       <tr tal:condition="view/manage_applications">
         <td class="fieldname" i18n:translate="">Password:</td>
@@ -141,5 +122,5 @@
     <span i18n:translate="">
      I hereby confirm that the Passport Photograph uploaded on this form is a
-     true picture of me. 
+     true picture of me.
     </span>
   </div>
@@ -153,4 +134,30 @@
     </span>
   </div>
+
+  <tal:refereereports condition="view/display_refereereports">
+    <br /><br />
+    <h3 i18n:translate="">
+        Referee Reports
+    </h3>
+    <table i18n:domain="waeup.kofa" class="table table-condensed">
+      <thead>
+      <tr>
+        <th i18n:translate="">Report Id</th>
+        <th i18n:translate="">Creation Date</th>
+        <th i18n:translate="">Referee</th>
+        <th i18n:translate="">Email Address</th>
+      </tr>
+      </thead>
+      <tbody>
+        <tr tal:repeat="cl context/refereereports">
+          <td> <a tal:attributes="href python:view.url(cl)">
+            <span tal:content="cl/r_id">RID</span></a></td>
+          <td tal:content="python: layout.formatDatetime(cl.creation_date)">CREATION DATE</td>
+          <td tal:content="cl/name">REFEREE</td>
+          <td tal:content="cl/email">EMAIL</td>
+        </tr>
+      </tbody>
+    </table>
+  </tal:refereereports>
 
   <tal:payments condition="view/display_payments">
@@ -175,6 +182,6 @@
         <tr tal:repeat="cl context/payments">
           <td>
-           <input type="checkbox" name="val_id"
-      		 tal:attributes="value cl/__name__"
+           <input type="checkbox"  name="val_id"
+           tal:attributes="value cl/__name__"
            tal:condition="python: not view.unremovable(cl)" />
           </td>
Index: main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py	(revision 15867)
+++ main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py	(revision 15948)
@@ -346,5 +346,5 @@
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
         pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.stateresult')
+        ctrl = self.browser.getControl(name='stateresult.pdf')
         file_ctrl = ctrl.mech_control
         file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
@@ -418,5 +418,5 @@
         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
         pseudo_pdf = StringIO(pdf_content)
-        ctrl = self.browser.getControl(name='form.verificationdoc')
+        ctrl = self.browser.getControl(name='verificationdoc.pdf')
         file_ctrl = ctrl.mech_control
         file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
Index: main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py	(revision 15867)
+++ main/waeup.aaue/trunk/src/waeup/aaue/applicants/utils.py	(revision 15948)
@@ -27,4 +27,7 @@
     """A collection of parameters and methods subject to customization.
     """
+
+    ADDITIONAL_FILES = (('Statement of Result','stateresult.pdf'),
+                 ('Result/Certificate Document','verificationdoc.pdf'))
 
     APP_TYPES_DICT = {
