Ignore:
Timestamp:
20 Sep 2018, 19:11:42 (6 years ago)
Author:
Henrik Bettermann
Message:

Add landing page for transcript signees.

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

Legend:

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

    r15155 r15157  
    10591059        return students
    10601060
     1061class TranscriptSigneeLandingPage(KofaPage):
     1062    """Display students with validated transcript requests, when
     1063    transcript signee logs in.
     1064    """
     1065    grok.name('my_transcript_signing_requests')
     1066    grok.require('waeup.Authenticated')
     1067    grok.context(IUniversity)
     1068    grok.template('mytranscriptrequests')
     1069    label =_('My ToDoList')
     1070
     1071    @property
     1072    def getStudents(self):
     1073        students = ([],[])
     1074        cat = queryUtility(ICatalog, name='students_catalog')
     1075        local_roles = get_user_account(self.request).getLocalRoles()
     1076        for item in local_roles.get('waeup.local.TranscriptSignee', []):
     1077            if isinstance(item, Faculty):
     1078                faccode = item.code
     1079                results = cat.searchResults(
     1080                    state=(TRANSVAL, TRANSVAL), faccode=(faccode, faccode))
     1081                for result in results:
     1082                    students[1].append(StudentQueryResultItem(result, self))
     1083        return students
     1084
    10611085#
    10621086# Search pages...
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/browser/templates/mytranscriptrequests.pt

    r15154 r15157  
    11<h3 i18n:domain="waeup.kofa" i18n:translate="" tal:condition="python:view.getStudents[0]">
    2   Transcript requested
     2  Transcripts to be validated
    33</h3>
    44<div tal:repeat="student python:view.getStudents[0]">
     
    88</div>
    99<h3 i18n:domain="waeup.kofa" i18n:translate="" tal:condition="python:view.getStudents[1]">
    10   Transcript validated
     10  Transcripts to be signed and released
    1111</h3>
    1212<div tal:repeat="student python:view.getStudents[1]">
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/browser/viewlets.py

    r15155 r15157  
    384384        return ''
    385385
     386class TranscriptSigneeStudents(ManageLink):
     387    """A link to transcript signing requests.
     388    """
     389    grok.order(6)
     390    grok.require('waeup.Authenticated')
     391
     392    link = u'my_transcript_signing_requests'
     393    text = _(u'My ToDoList')
     394
     395    def render(self):
     396        user_account = get_user_account(self.request)
     397        if user_account:
     398            local_roles = user_account.getLocalRoles()
     399            if local_roles.has_key('waeup.local.TranscriptSignee'):
     400                url = self.view.url(grok.getSite(), self.link)
     401                text = translate(self.text, context=self.request)
     402                return u'<li><a href="%s">%s</a></li>' % (url, text)
     403        return ''
     404
    386405class MyPreferences(ManageLink):
    387406    """A link to personal preferences, placed in upper left box.
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/dynamicroles.py

    r15155 r15157  
    4747        'waeup.local.LocalWorkflowManager': 'waeup.WorkflowManager',
    4848        'waeup.local.TranscriptOfficer': 'waeup.TranscriptOfficer',
     49        'waeup.local.TranscriptSignee': 'waeup.TranscriptSignee',
    4950        }
    5051
  • main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/students/tests/test_browser.py

    r15155 r15157  
    22682268        IWorkflowState(self.student).setState('transcript requested')
    22692269        notify(grok.ObjectModifiedEvent(self.student))
    2270         self.student.transcript_comment = (
    2271             u'On 07/08/2013 08:59:54 UTC K1000000 wrote:\n\nComment line 1 \n'
    2272             'Comment line2\n\nDispatch Address:\nAddress line 1 \n'
    2273             'Address line2\n\n')
    22742270        # Create transcript officer
    22752271        self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret')
     
    22892285        self.browser.getControl("Login").click()
    22902286        self.assertMatches('...You logged in...', self.browser.contents)
    2291         # Officer is on landing page
     2287        # Officer is on landing page and does see the transcript link
     2288        self.assertTrue(
     2289            'http://localhost/app/students/K1000000/studycourse/transcript'
     2290            in self.browser.contents)
     2291
     2292    def test_landingpage_transcript_signee(self):
     2293        IWorkflowState(self.student).setState('transcript validated')
     2294        notify(grok.ObjectModifiedEvent(self.student))
     2295        # Create transcript signee
     2296        self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret')
     2297        self.app['users']['mrtranscript'].email = 'mrtranscript@foo.ng'
     2298        self.app['users']['mrtranscript'].title = 'Ruth Gordon'
     2299        # We assign transcript officer role at faculty level
     2300        fac = self.app['faculties']['fac1']
     2301        prmlocal = IPrincipalRoleManager(fac)
     2302        prmlocal.assignRoleToPrincipal(
     2303            'waeup.local.TranscriptSignee', 'mrtranscript')
     2304        notify(LocalRoleSetEvent(
     2305            fac, 'waeup.local.TranscriptSignee', 'mrtranscript', granted=True))
     2306        # Login as transcript officer
     2307        self.browser.open(self.login_path)
     2308        self.browser.getControl(name="form.login").value = 'mrtranscript'
     2309        self.browser.getControl(name="form.password").value = 'mrtranscriptsecret'
     2310        self.browser.getControl("Login").click()
     2311        self.assertMatches('...You logged in...', self.browser.contents)
     2312        # Officer is on landing page and does see the transcript link
    22922313        self.assertTrue(
    22932314            'http://localhost/app/students/K1000000/studycourse/transcript'
Note: See TracChangeset for help on using the changeset viewer.