Ignore:
Timestamp:
14 Sep 2020, 06:28:19 (4 years ago)
Author:
Henrik Bettermann
Message:

Improve transcript application record listing.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/browser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r16234 r16235  
    398398                # Redirect some officers after login
    399399                local_roles = get_user_account(self.request).getLocalRoles()
     400                site_roles = get_user_account(self.request).roles
    400401                if local_roles.has_key('waeup.local.Lecturer'):
    401402                    self.redirect(self.application_url() + '/my_courses')
    402403                    return
    403                 if local_roles.has_key('waeup.local.TranscriptOfficer'):
     404                if local_roles.has_key('waeup.local.TranscriptOfficer') \
     405                    or 'waeup.TranscriptOfficer' in site_roles:
    404406                    self.redirect(self.application_url() + '/my_transcript_requests')
    405407                    return
     
    11131115            state=(SUBMITTED, SUBMITTED))
    11141116        local_roles = self.local_roles.get('waeup.local.TranscriptOfficer', [])
     1117        submission_date = ''
     1118        for applicant in results:
     1119            if 'submitted' in applicant.history.messages[-1]:
     1120                submission_date = applicant.history.messages[-1][0:10]
     1121            applicants.append((applicant, submission_date))
     1122        # Filter applicants with repect to officer's local role in faculties.
    11151123        if not local_roles:
    1116             return results
     1124            return applicants
     1125        filtered_applicants = []
    11171126        for item in local_roles:
    11181127            if isinstance(item, Faculty):
     
    11201129            else:
    11211130                continue
    1122             for applicant in results:
    1123                 course = getattr(applicant, 'course_studied', None)
    1124                 if not course:
     1131            for applicant in applicants:
     1132                course = getattr(applicant[0], 'course_studied', None)
     1133                if course is None:
     1134                    filtered_applicants.append(applicant)
    11251135                    continue
    11261136                try:
    11271137                    if course.__parent__.__parent__.__parent__.code == faccode:
    1128                         applicants.append(applicant)
     1138                        filtered_applicants.append(applicant)
    11291139                except AttributeError:
    11301140                    continue
    1131         return applicants
     1141        return filtered_applicants
    11321142
    11331143class TranscriptSigneeLandingPage(KofaPage):
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/mytranscriptrequests.pt

    r16234 r16235  
    88    <th i18n:translate="">Applicant Id</th>
    99    <th i18n:translate="">Full Name</th>
     10    <th i18n:translate="">Course Studied</th>
     11    <th i18n:translate="">Submission Date</th>
    1012  </tr>
    1113  </thead>
    1214  <tbody>
    1315  <tr tal:repeat="item view/getApplicants">
    14     <td> <a tal:attributes="href python:view.url(item)">
    15       <span tal:content="item/applicant_id">XXXX_1234</span></a>
     16    <td> <a tal:attributes="href python:view.url(item[0])">
     17      <span tal:content="python:item[0].applicant_id">XXXX_1234</span></a>
    1618    </td>
    17     <td tal:content="item/display_fullname">Bob</td>
     19    <td tal:content="python:item[0].display_fullname">Bob</td>
     20    <td tal:content="python:getattr(item[0].course_studied,'title',None)">Bob</td>
     21    <td tal:content="python:item[1]">Bob</td>
    1822  </tr>
    1923  </tbody>
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/viewlets.py

    r15998 r16235  
    379379        if user_account:
    380380            local_roles = user_account.getLocalRoles()
    381             if local_roles.has_key('waeup.local.TranscriptOfficer'):
     381            site_roles = user_account.roles
     382            if local_roles.has_key('waeup.local.TranscriptOfficer') \
     383                or 'waeup.TranscriptOfficer' in site_roles:
    382384                url = self.view.url(grok.getSite(), self.link)
    383385                text = translate(self.text, context=self.request)
Note: See TracChangeset for help on using the changeset viewer.