Changeset 16120 for main


Ignore:
Timestamp:
15 Jun 2020, 07:58:00 (4 years ago)
Author:
Henrik Bettermann
Message:

Finetune transcript processing. Allow transcript officers to request a transcript.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
8 edited

Legend:

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

    r16118 r16120  
    16631663    buttonname = _('Check status now')
    16641664    pnav = 8
    1665     websites = (('DemoPortal', 'http://localhost:8080/app/'),)
    1666     appl_url1 = 'http://localhost:8080/app/applicants'
    1667     appl_url2 = 'http://localhost:8080/app/applicants'
     1665    websites = (('DemoPortal', 'https://kofa-demo.waeup.org/'),)
     1666    appl_url1 = 'https://kofa-demo.waeup.org/applicants'
     1667    appl_url2 = 'https://kofa-demo.waeup.org/applicants'
    16681668
    16691669    def update(self, SUBMIT=None):
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r16116 r16120  
    15461546        self.browser.getControl(name="email").value = 'aa@aa.aa'
    15471547        self.browser.getControl("Check status now").click()
    1548         # Here the test fails because it seems that
    1549         # xmlrpclib.ServerProxy can't be
    1550         # used in tests even if we use
    1551         # zope.app.testing.xmlrpc import ServerProxy with correct
    1552         # URL. Any idea Uli?
    15531548        self.assertTrue('No student record was found in Kofa'
    15541549            in self.browser.contents)
    1555         self.browser.getControl(
    1556           name="unique_id").value = self.applicant.applicant_id
    1557         self.browser.getControl(name="email").value = 'aa@aa.aa'
    1558         self.browser.getControl("Check status now").click()
    15591550
    15601551class ApplicantsExportTests(ApplicantsFullSetup, FunctionalAsyncTestCase):
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/layout.py

    r15882 r16120  
    206206        if self.widgets.get('transcript_comment'):
    207207            self.widgets['transcript_comment'].height = 12
     208        if self.widgets.get('transcript_remark'):
     209            self.widgets['transcript_remark'].height = 6
    208210        if self.widgets.get('jamb_subjects'):
    209211            self.widgets['jamb_subjects'].height = 6
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r16086 r16120  
    11501150    notice = ''
    11511151    pnav = 4
    1152     buttonname = _('Submit')
     1152    buttonname = _('Request now')
    11531153    with_ac = True
    11541154
     
    12151215        return
    12161216
     1217class TOStudentTranscriptRequestPage(StudentTranscriptRequestPage):
     1218    """ Page to request transcript by student
     1219    """
     1220    grok.context(IStudent)
     1221    grok.name('request_transcript_for_student')
     1222    grok.require('waeup.processTranscript')
     1223    grok.template('transcriptrequest')
     1224    label = _('Request transcript for student')
     1225    with_ac = False
     1226
    12171227class StudentTranscriptSignView(UtilityView, grok.View):
    12181228    """ View to sign transcript
     
    12631273    grok.template('transcriptprocess')
    12641274    label = _('Validate transcript')
    1265     buttonname = _('Save comment and validate transcript')
     1275    buttonname1 = _('Save comment')
     1276    buttonname2 = _('Save comment and validate transcript')
    12661277    pnav = 4
    12671278
     
    12871298        return levelremarks
    12881299
    1289     def update(self, SUBMIT=None):
     1300    def update(self, SUBMIT=None, SAVE=None):
    12901301        super(StudentTranscriptValidateFormPage, self).update()
    12911302        if self.context.student.state != TRANSREQ:
     
    13031314        else:
    13041315            self.signees = ''
    1305         if SUBMIT is None:
    1306             return
    1307         # Fire transition
    1308         IWorkflowInfo(self.context.student).fireTransition('validate_transcript')
    1309         self.flash(_('Transcript validated.'))
    1310         comment = self.request.form.get('comment', '').replace('\r', '')
    1311         tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc)
    1312         today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z')
    1313         old_transcript_comment = getattr(
    1314             self.context, 'transcript_comment', None)
    1315         if old_transcript_comment == None:
    1316             old_transcript_comment = ''
    1317         self.context.transcript_comment = '''On %s %s wrote:
     1316        if SUBMIT is None and SAVE is None:
     1317            return
     1318        if SAVE or SUBMIT:
     1319            # Save comment and append old comment
     1320            comment = self.request.form.get('comment', '').replace('\r', '')
     1321            tz = getattr(queryUtility(IKofaUtils), 'tzinfo', pytz.utc)
     1322            today = now(tz).strftime('%d/%m/%Y %H:%M:%S %Z')
     1323            old_transcript_comment = getattr(
     1324                self.context, 'transcript_comment', None)
     1325            if old_transcript_comment == None:
     1326                old_transcript_comment = ''
     1327            self.context.transcript_comment = '''On %s %s wrote:
    13181328
    13191329%s
    13201330
    1321 %s''' % (today, self.request.principal.id, comment,
    1322          old_transcript_comment)
    1323         self.context.writeLogMessage(
    1324             self, 'comment: %s' % comment.replace('\n', '<br>'))
     1331%s''' % (today, self.request.principal.id, comment, old_transcript_comment)
     1332            self.context.writeLogMessage(
     1333                self, 'comment: %s' % comment.replace('\n', '<br>'))
     1334        if SUBMIT:
     1335            # Fire transition
     1336            IWorkflowInfo(self.context.student).fireTransition('validate_transcript')
     1337            self.flash(_('Transcript validated.'))
    13251338        self.redirect(self.url(self.context) + '/transcript')
    13261339        return
     
    13341347    grok.template('transcriptprocess')
    13351348    label = _('Release transcript')
    1336     buttonname = _('Save comment and release transcript')
     1349    buttonname1 = None
     1350    buttonname2 = _('Save comment and release transcript')
    13371351    pnav = 4
    13381352
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/transcriptprocess.pt

    r15333 r16120  
    4040            <td colspan="2">
    4141              <br />
    42               <input type="submit" name="SUBMIT" class="btn btn-primary"
    43                      tal:attributes="value view/buttonname" />
     42              <input
     43                data-toggle="tooltip"
     44                title="Comments will be added to the correspondence.
     45                  They can't be edited or removed after saving."
     46                onclick="return window.confirm('Are you really sure?')"
     47                type="submit" name="SAVE" class="btn btn-primary"
     48                tal:condition="view/buttonname1"
     49                tal:attributes="value view/buttonname1" />
     50              <input
     51                data-toggle="tooltip"
     52                title="Comments will be added to the correspondence.
     53                  They can't be edited or removed after saving and
     54                  transcript validation."
     55                onclick="return window.confirm('Are you really sure?')"
     56                type="submit" name="SUBMIT" class="btn btn-primary"
     57                     tal:attributes="value view/buttonname2" />
    4458            </td>
    4559          </tr>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r15998 r16120  
    637637        )
    638638
    639     transcript_remark = schema.TextLine(
     639    transcript_remark = schema.Text(
    640640        title = _(u'Transcript Remark'),
    641641        required = False,
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r16086 r16120  
    21252125
    21262126    def test_process_transcript(self):
    2127         IWorkflowState(self.student).setState('transcript requested')
     2127        IWorkflowState(self.student).setState('graduated')
    21282128        notify(grok.ObjectModifiedEvent(self.student))
    21292129        self.student['studycourse'].transcript_comment = (
     
    21452145        self.browser.getControl("Login").click()
    21462146        self.assertMatches('...You logged in...', self.browser.contents)
     2147        # Officer can request transcript for students
     2148        self.browser.open(self.student_path)
     2149        self.browser.getLink("Request transcript for student").click()
     2150        self.browser.getControl("Request now").click()
     2151        self.assertEqual(self.student.state, 'transcript requested')
    21472152        # Officer can see his roles
    21482153        self.browser.getLink("My Roles").click()
     
    36213626        self.browser.getControl(name="comment").value = 'Comment line 1 \nComment line2'
    36223627        self.browser.getControl(name="address").value = 'Address line 1 \nAddress line2'
    3623         self.browser.getControl("Submit").click()
     3628        self.browser.getControl("Request now").click()
    36243629        self.assertMatches('...Transcript processing has been started...',
    36253630                          self.browser.contents)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r16085 r16120  
    764764        return self.view.url(self.view.context, self.target)
    765765
     766class TORequestTranscriptActionButton(RequestTranscriptActionButton):
     767    grok.require('waeup.processTranscript')
     768    text = _('Request transcript for student')
     769    target = 'request_transcript_for_student'
     770
    766771
    767772class ValidateTranscriptActionButton(ManageActionButton):
Note: See TracChangeset for help on using the changeset viewer.