Ignore:
Timestamp:
20 Sep 2018, 07:04:17 (6 years ago)
Author:
Henrik Bettermann
Message:

Reorganise interfaces.

Transcript processing views and viewlets are now in the context of studycourses. Officers can now validate, sign and release transcripts directly on the transcript page.

Location:
main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/browser/pages.py

    r15154 r15155  
    10391039    grok.context(IUniversity)
    10401040    grok.template('mytranscriptrequests')
    1041     label =_('My Transcript Requests')
     1041    label =_('My ToDoList')
    10421042
    10431043    @property
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/browser/tests/test_browser.py

    r15143 r15155  
    439439            'nationality,officer_comment,perm_address,personal_updated,'
    440440            'phone,reg_number,sex,student_id,suspended,suspended_comment,'
    441             'transcript_comment,transcript_signees,'
    442441            'password,state,history,certcode,is_postgrad,current_level,'
    443442            'current_session\r\n')
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/browser/viewlets.py

    r14286 r15155  
    365365        return ''
    366366
     367class TranscriptOfficerStudents(ManageLink):
     368    """A link to transcript requests.
     369    """
     370    grok.order(6)
     371    grok.require('waeup.Authenticated')
     372
     373    link = u'my_transcript_requests'
     374    text = _(u'My ToDoList')
     375
     376    def render(self):
     377        user_account = get_user_account(self.request)
     378        if user_account:
     379            local_roles = user_account.getLocalRoles()
     380            if local_roles.has_key('waeup.local.TranscriptOfficer'):
     381                url = self.view.url(grok.getSite(), self.link)
     382                text = translate(self.text, context=self.request)
     383                return u'<li><a href="%s">%s</a></li>' % (url, text)
     384        return ''
     385
    367386class MyPreferences(ManageLink):
    368387    """A link to personal preferences, placed in upper left box.
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/permissions.py

    r15153 r15155  
    393393    """The LocalTranscriptOfficer role can be assigned at faculty
    394394    level. The role allows to view, to validate and to
    395     release student transcripts.
     395    release student transcripts at faculty level.
     396    Local Transcript Officers get the TranscriptOfficer role
     397    for this subset of students.
    396398    """
    397399    grok.name('waeup.local.TranscriptOfficer')
    398400    grok.title(u'Transcript Officer')
    399     grok.permissions('waeup.viewAcademics',
    400                      'waeup.viewTranscript',
    401                      'waeup.processTranscript',
    402                      'waeup.viewStudent',
    403                      )
     401    grok.permissions('waeup.viewAcademics',)
    404402
    405403
    406404class LocalTranscriptSignee(grok.Role):
    407405    """The LocalTranscriptSignee role can be assigned at faculty
    408     level. The role allows to view and to sign student transcripts.
     406    level. The role allows to view and to sign student transcripts
     407    at faculty level. Local Transcript Signees  get the TranscriptSignee role
     408    for this subset of students.
    409409    """
    410410    grok.name('waeup.local.TranscriptSignee')
    411411    grok.title(u'Transcript Signee')
    412     grok.permissions('waeup.viewAcademics',
    413                      'waeup.viewTranscript',
    414                      'waeup.signTranscript',
    415                      'waeup.viewStudent',
    416                      'waeup.viewStudentsContainer',
    417                      )
     412    grok.permissions('waeup.viewAcademics',)
    418413
    419414
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/browser.py

    r15150 r15155  
    6868    IStudentsContainer, IStudent, IUGStudentClearance, IPGStudentClearance,
    6969    IStudentPersonal, IStudentPersonalEdit, IStudentBase, IStudentStudyCourse,
    70     IStudentStudyCourseTransfer, IStudentStudyCourseTranscript,
     70    IStudentStudyCourseTransfer,
    7171    IStudentAccommodation, IStudentStudyLevel, ICourseTicket, ICourseTicketAdd,
    7272    IStudentPaymentsContainer, IStudentOnlinePayment, IStudentPreviousPayment,
     
    10741074    """ Page to request transcript by student
    10751075    """
    1076     grok.context(IStudentTranscript)
     1076    grok.context(IStudent)
    10771077    grok.name('request_transcript')
    10781078    grok.require('waeup.handleStudent')
     
    10941094            self.ac_series = self.request.form.get('ac_series', None)
    10951095            self.ac_number = self.request.form.get('ac_number', None)
    1096         if self.context.transcript_comment is not None:
    1097             self.correspondence = self.context.transcript_comment.replace(
    1098                 '\n', '<br>')
     1096        if getattr(
     1097            self.context['studycourse'], 'transcript_comment', None) is not None:
     1098            self.correspondence = self.context[
     1099                'studycourse'].transcript_comment.replace(
     1100                    '\n', '<br>')
    10991101        else:
    11001102            self.correspondence = ''
     
    11261128        tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc)
    11271129        today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z')
    1128         old_transcript_comment = self.context.transcript_comment
     1130        old_transcript_comment = getattr(
     1131            self.context['studycourse'], 'transcript_comment', None)
    11291132        if old_transcript_comment == None:
    11301133            old_transcript_comment = ''
    1131         self.context.transcript_comment = '''On %s %s wrote:
     1134        self.context['studycourse'].transcript_comment = '''On %s %s wrote:
    11321135
    11331136%s
     
    11471150    """ View to validate transcript
    11481151    """
    1149     grok.context(IStudentTranscript)
     1152    grok.context(IStudentStudyCourse)
    11501153    grok.name('validate_transcript')
    11511154    grok.require('waeup.processTranscript')
     
    11571160            return
    11581161        # Fire transition
    1159         IWorkflowInfo(self.context).fireTransition('validate_transcript')
     1162        IWorkflowInfo(self.context.student).fireTransition(
     1163            'validate_transcript')
    11601164        self.flash(_('Transcript validated.'))
    11611165        self.redirect(self.url(self.context))
     
    11851189        tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc)
    11861190        today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z')
    1187         prev_transcript_signees = self.context.student.transcript_signees
     1191        prev_transcript_signees = getattr(
     1192            self.context, 'transcript_signees', None)
    11881193        if prev_transcript_signees == None:
    11891194            prev_transcript_signees = ''
    1190         self.context.student.transcript_signees = (
     1195        self.context.transcript_signees = (
    11911196            u"Electronically signed by %s (%s) on %s\n%s"
    11921197            % (self.request.principal.title, self.request.principal.id, today,
     
    12011206    """ Page to release transcript
    12021207    """
    1203     grok.context(IStudentTranscript)
     1208    grok.context(IStudentStudyCourse)
    12041209    grok.name('release_transcript')
    12051210    grok.require('waeup.processTranscript')
    12061211    grok.template('transcriptrelease')
    1207     form_fields = grok.AutoFields(IStudentTranscript)
    12081212    label = _('Release transcript')
    12091213    buttonname = _('Save comment and release transcript')
     
    12121216    def update(self, SUBMIT=None):
    12131217        super(StudentTranscriptReleaseFormPage, self).update()
    1214         if self.context.state != TRANSVAL:
     1218        if self.context.student.state != TRANSVAL:
    12151219            self.flash(_('Student is in wrong state.'), type="warning")
    12161220            self.redirect(self.url(self.context))
    12171221            return
    1218         if self.context.transcript_comment is not None:
     1222        if getattr(self.context, 'transcript_comment', None) is not None:
    12191223            self.correspondence = self.context.transcript_comment.replace(
    12201224                '\n', '<br>')
    12211225        else:
    12221226            self.correspondence = ''
    1223         if self.context.transcript_signees is not None:
     1227        if getattr(self.context, 'transcript_signees', None) is not None:
    12241228            self.signees = self.context.transcript_signees.replace(
    12251229                '\n', '<br><br>')
     
    12291233            return
    12301234        # Fire transition
    1231         IWorkflowInfo(self.context).fireTransition('release_transcript')
     1235        IWorkflowInfo(self.context.student).fireTransition('release_transcript')
    12321236        self.flash(_('Transcript released and final transcript file saved.'))
    12331237        comment = self.request.form.get('comment', '').replace('\r', '')
     
    12461250            self, 'comment: %s' % comment.replace('\n', '<br>'))
    12471251        # Produce transcript file
    1248         self.redirect(self.url(self.context) + '/studycourse/transcript.pdf')
     1252        self.redirect(self.url(self.context) + '/transcript.pdf')
    12491253        return
    12501254
     
    12531257    for this page. It's an emergency page.
    12541258    """
    1255     grok.context(IStudentTranscript)
     1259    grok.context(IStudentStudyCourse)
    12561260    grok.name('manage_transcript_request')
    12571261    grok.require('waeup.processTranscript')
     
    13011305    grok.name('transcript.pdf')
    13021306    grok.require('waeup.viewTranscript')
    1303     form_fields = grok.AutoFields(IStudentStudyCourseTranscript)
    13041307    prefix = 'form'
    13051308    omit_fields = (
     
    13321335
    13331336    def _sigsInFooter(self):
    1334         if self.context.student.transcript_signees:
     1337        if getattr(
     1338            self.context.student['studycourse'], 'transcript_signees', None):
    13351339            return ()
    13361340        return (_('CERTIFIED TRUE COPY'),)
     
    13401344
    13411345    def _digital_sigs(self):
    1342         if self.context.student.transcript_signees:
    1343             return self.context.student.transcript_signees #.split('\n')
     1346        if getattr(
     1347            self.context.student['studycourse'], 'transcript_signees', None):
     1348            return self.context.student['studycourse'].transcript_signees
    13441349        return ()
    13451350
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/dynamicroles.py

    r11254 r15155  
    4646        'waeup.local.LocalStudentsManager': 'waeup.StudentsManager',
    4747        'waeup.local.LocalWorkflowManager': 'waeup.WorkflowManager',
     48        'waeup.local.TranscriptOfficer': 'waeup.TranscriptOfficer',
    4849        }
    4950
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/interfaces.py

    r15143 r15155  
    374374
    375375class IStudentTranscript(IKofaObject):
    376     """Representation of student transcript data.
     376    """Representation of student transcript data. Only used for
     377    StudentTranscriptRequestManageFormPage.
    377378    """
    378379
     
    389390
    390391class IStudent(IStudentBase,IUGStudentClearance,IPGStudentClearance,
    391     IStudentPersonal, IStudentTranscript):
     392    IStudentPersonal):
    392393    """Representation of a student.
    393394    """
     
    536537IStudentStudyCourseTransfer['current_level'].order = IStudentStudyCourse[
    537538    'current_level'].order
    538 
    539 class IStudentStudyCourseTranscript(IKofaObject):
    540     """An interface for student transcripts.
    541     """
    542     entry_mode = schema.Choice(
    543         title = _(u'Entry Mode'),
    544         source = StudyModeSource(),
    545         required = True,
    546         readonly = False,
    547         )
    548 
    549     entry_session = schema.Choice(
    550         title = _(u'Entry Session'),
    551         source = academic_sessions_vocab,
    552         #default = datetime.now().year,
    553         required = True,
    554         readonly = False,
    555         )
    556539
    557540class IStudentVerdictUpdate(IKofaObject):
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/permissions.py

    r15141 r15155  
    159159    """The Transcript Officer is allowed to view, to validate and to
    160160    release student transcripts. The officer is also allowed to
    161     manage student data (global role only).
     161    manage student data.
    162162    """
    163163    grok.name('waeup.TranscriptOfficer')
     
    181181                     'waeup.signTranscript',
    182182                     'waeup.viewStudent',
    183                      'waeup.viewStudentsContainer',
    184183                     )
    185184
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/studycourse.py

    r14382 r15155  
    2626from waeup.kofa.students.interfaces import (
    2727    IStudentStudyCourse, IStudentNavigation, IStudentStudyLevel,
    28     IStudentStudyCourseTranscript)
     28    IStudentTranscript)
    2929from waeup.kofa.students.studylevel import CourseTicket
    3030from waeup.kofa.students.workflow import CLEARED, RETURNING, PAID
     
    3434    """This is a container for study levels.
    3535    """
    36     grok.implements(IStudentStudyCourse, IStudentNavigation,
    37         IStudentStudyCourseTranscript)
     36    grok.implements(IStudentStudyCourse, IStudentNavigation)
    3837    grok.provides(IStudentStudyCourse)
    3938
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/tests/test_browser.py

    r15154 r15155  
    21232123        IWorkflowState(self.student).setState('transcript requested')
    21242124        notify(grok.ObjectModifiedEvent(self.student))
    2125         self.student.transcript_comment = (
     2125        self.student['studycourse'].transcript_comment = (
    21262126            u'On 07/08/2013 08:59:54 UTC K1000000 wrote:\n\nComment line 1 \n'
    21272127            'Comment line2\n\nDispatch Address:\nAddress line 1 \n'
     
    21752175        self.assertTrue('Form has been saved' in self.browser.contents)
    21762176        # Officer can validate the transcript
    2177         self.browser.open(self.student_path)
     2177        self.browser.open(self.studycourse_path + '/transcript')
    21782178        self.browser.getLink("Validate transcript").click()
    21792179        # After validation all manage forms are locked.
     
    22072207        self.assertTrue(
    22082208            u'Electronically signed by Ruth Gordon (mrtranscript) on '
    2209             in self.student.transcript_signees)
     2209            in self.student['studycourse'].transcript_signees)
    22102210        # Officer can release the transcript
    2211         self.browser.open(self.student_path)
     2211        self.browser.open(self.studycourse_path + '/transcript')
    22122212        self.browser.getLink("Release transcript").click()
    22132213        self.assertTrue(' UTC K1000000 wrote:<br><br>Comment line 1 <br>'
     
    22202220            'UTC mrtranscript wrote:\n\nHello,\nYour transcript has '
    22212221            'been sent to the address provided.\n\n'
    2222             in self.student.transcript_comment)
     2222            in self.student['studycourse'].transcript_comment)
    22232223        # The comment has been logged
    22242224        logfile = os.path.join(
     
    22502250                         'application/pdf')
    22512251        # Transcript views are no longer accesssible
    2252         self.browser.open(self.student_path)
    2253         self.assertFalse('studycourse/transcript' in self.browser.contents)
    22542252        self.browser.open(self.studycourse_path)
    22552253        self.assertFalse('studycourse/transcript' in self.browser.contents)
     
    22642262        self.assertFalse('Final Transcript' in self.browser.contents)
    22652263        # ... and transcript process information has been removed
    2266         self.assertEqual(self.student.transcript_comment, None)
    2267         self.assertEqual(self.student.transcript_signees, None)
     2264        self.assertEqual(self.student['studycourse'].transcript_comment, None)
     2265        self.assertEqual(self.student['studycourse'].transcript_signees, None)
    22682266
    22692267    def test_landingpage_transcript_officer(self):
     
    34303428            '... UTC K1000000 wrote:\n\nComment line 1 \n'
    34313429            'Comment line2\n\nDispatch Address:\nAddress line 1 \n'
    3432             'Address line2\n\n', self.student.transcript_comment)
     3430            'Address line2\n\n', self.student['studycourse'].transcript_comment)
    34333431        # The comment has been logged
    34343432        logfile = os.path.join(
     
    36993697            'firstname,flash_notice,lastname,matric_number,middlename,nationality,'
    37003698            'officer_comment,perm_address,personal_updated,phone,reg_number,'
    3701             'sex,student_id,suspended,suspended_comment,transcript_comment,'
    3702             'transcript_signees,password,state,history,certcode,is_postgrad,'
     3699            'sex,student_id,suspended,suspended_comment,'
     3700            'password,state,history,certcode,is_postgrad,'
    37033701            'current_level,current_session\r\n'
    37043702            ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,'
    3705             '1234#,123,m,K1000000,0,,,,{SSHA}' in self.browser.contents)
     3703            '1234#,123,m,K1000000,0,,{SSHA}' in self.browser.contents)
    37063704
    37073705    def test_payment_dates(self):
     
    38053803            'firstname,flash_notice,lastname,matric_number,middlename,nationality,'
    38063804            'officer_comment,perm_address,personal_updated,phone,reg_number,'
    3807             'sex,student_id,suspended,suspended_comment,transcript_comment,'
    3808             'transcript_signees,password,state,history,certcode,is_postgrad,'
     3805            'sex,student_id,suspended,suspended_comment,'
     3806            'password,state,history,certcode,is_postgrad,'
    38093807            'current_level,current_session\r\n'
    38103808            ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,'
    3811             '1234#,123,m,K1000000,0,,,,{SSHA}' in self.browser.contents)
     3809            '1234#,123,m,K1000000,0,,{SSHA}' in self.browser.contents)
    38123810        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
    38133811        job_id = self.app['datacenter'].running_exports[0][0]
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/tests/test_export.py

    r15143 r15155  
    127127        'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    128128        'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,'
    129         '+234-123-12345#,123,f,A111111,0,,,,,created'
     129        '+234-123-12345#,123,f,A111111,0,,,created'
    130130        )
    131131
     
    160160            'nationality,officer_comment,perm_address,personal_updated,'
    161161            'phone,reg_number,sex,student_id,suspended,suspended_comment,'
    162             'transcript_comment,transcript_signees,password,state,history,'
     162            'password,state,history,'
    163163            'certcode,is_postgrad,current_level,current_session\r\n'
    164164            'my adm code,my clr code,'
    165165            '1981-02-04#,anna@sample.com,,Anna,,Tester,234,M.,NG,,'
    166166            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,123,f,'
    167             'A111111,0,,,,,created'
     167            'A111111,0,,,created'
    168168            in result
    169169            )
     
    182182            'nationality,officer_comment,perm_address,personal_updated,'
    183183            'phone,reg_number,sex,student_id,suspended,suspended_comment,'
    184             'transcript_comment,transcript_signees,password,state,history,certcode,'
     184            'password,state,history,certcode,'
    185185            'is_postgrad,current_level,current_session\r\n'
    186186            'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    187187            'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"'
    188             ',,+234-123-12345#,123,f,A111111,0,,,,,created'
     188            ',,+234-123-12345#,123,f,A111111,0,,,created'
    189189            in result
    190190            )
     
    202202            'nationality,officer_comment,perm_address,personal_updated,'
    203203            'phone,reg_number,sex,student_id,suspended,suspended_comment,'
    204             'transcript_comment,transcript_signees,password,state,history,certcode,'
     204            'password,state,history,certcode,'
    205205            'is_postgrad,current_level,current_session\r\n'
    206206            'my adm code,my clr code,1981-02-04#,anna@sample.com,,'
    207207            'Anna,,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n"'
    208             ',,+234-123-12345#,123,f,A111111,0,,,,,created'
     208            ',,+234-123-12345#,123,f,A111111,0,,,created'
    209209            in result
    210210            )
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/viewlets.py

    r15150 r15155  
    3636    IStudentsContainer, IStudent, IStudentStudyCourse, IStudentStudyLevel,
    3737    ICourseTicket, IStudentOnlinePayment, IBedTicket,
    38     IStudentPaymentsContainer, IStudentsUtils, IStudentTranscript
     38    IStudentPaymentsContainer, IStudentsUtils,
    3939    )
    4040from waeup.kofa.students.workflow import (
     
    747747class RequestTranscriptActionButton(ManageActionButton):
    748748    grok.order(8)
    749     grok.context(IStudentTranscript)
     749    grok.context(IStudent)
    750750    grok.view(StudentBaseDisplayFormPage)
    751751    grok.require('waeup.handleStudent')
     
    763763class ValidateTranscriptActionButton(ManageActionButton):
    764764    grok.order(8)
    765     grok.context(IStudentTranscript)
    766     grok.view(StudentBaseDisplayFormPage)
     765    grok.context(IStudentStudyCourse)
     766    grok.view(StudyCourseTranscriptPage)
    767767    grok.require('waeup.processTranscript')
    768768    text = _('Validate transcript')
     
    772772    @property
    773773    def target_url(self):
    774         if self.context.state != TRANSREQ:
     774        if self.context.student.state != TRANSREQ:
    775775            return ''
    776776        return self.view.url(self.view.context, self.target)
     
    786786class ReleaseTranscriptActionButton(ManageActionButton):
    787787    grok.order(8)
    788     grok.context(IStudentTranscript)
    789     grok.view(StudentBaseDisplayFormPage)
     788    grok.context(IStudentStudyCourse)
     789    grok.view(StudyCourseTranscriptPage)
    790790    grok.require('waeup.processTranscript')
    791791    text = _('Release transcript')
     
    795795    @property
    796796    def target_url(self):
    797         if self.context.state != TRANSVAL:
     797        if self.context.student.state != TRANSVAL:
    798798            return ''
    799799        return self.view.url(self.view.context, self.target)
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/workflow.py

    r15153 r15155  
    303303            getUtility(IExtFileStore).deleteFileByContext(
    304304                obj, attr='final_transcript')
    305         obj.transcript_comment = None
    306         obj.transcript_signees = None
     305        obj['studycourse'].transcript_comment = None
     306        obj['studycourse'].transcript_signees = None
    307307    # In some tests we don't have a students container
    308308    try:
Note: See TracChangeset for help on using the changeset viewer.