Ignore:
Timestamp:
20 Apr 2020, 08:40:41 (5 years ago)
Author:
Henrik Bettermann
Message:

Customize referee reports.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/applicant.py

    r15947 r16062  
    2222from waeup.kofa.interfaces import IExtFileStore
    2323from waeup.kofa.applicants.applicant import ApplicantFactory
     24from waeup.kofa.applicants.refereereport import (
     25    ApplicantRefereeReport, ApplicantRefereeReportFactory)
    2426from waeup.kofa.utils.helpers import attrs_to_fields
    2527from kofacustom.nigeria.applicants.applicant import NigeriaApplicant
    2628from kofacustom.iuokada.applicants.interfaces import(
    27     ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit)
     29    ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit,
     30    IPUTMEApplicantEdit, ICustomApplicantRefereeReport)
    2831
    2932class CustomApplicant(NigeriaApplicant):
     
    3336    grok.provides(ICustomApplicant)
    3437
    35 # Set all attributes of CustomApplicant required in ICustomApplicant as field
    36 # properties. Doing this, we do not have to set initial attributes
    37 # ourselves and as a bonus we get free validation when an attribute is
    38 # set.
    3938CustomApplicant = attrs_to_fields(CustomApplicant)
    4039
     
    4847    def getInterfaces(self):
    4948        return implementedBy(CustomApplicant)
     49
     50class CustomApplicantRefereeReport(ApplicantRefereeReport):
     51    """This is a custom referee report.
     52    """
     53    grok.implements(ICustomApplicantRefereeReport)
     54    grok.provides(ICustomApplicantRefereeReport)
     55
     56CustomApplicantRefereeReport = attrs_to_fields(CustomApplicantRefereeReport)
     57
     58class CustomApplicantRefereeReportFactory(ApplicantRefereeReportFactory):
     59    """A factory for applicant online payments.
     60    """
     61
     62    def __call__(self, *args, **kw):
     63        return CustomApplicantRefereeReport()
     64
     65    def getInterfaces(self):
     66        return implementedBy(CustomApplicantRefereeReport)
     67
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser.py

    r16054 r16062  
    2626from waeup.kofa.utils.helpers import string_from_bytes, file_size, now
    2727from waeup.kofa.applicants.browser import (
    28     ApplicantRegistrationPage, ApplicantsContainerPage, AdditionalFile)
     28    ApplicantRegistrationPage, ApplicantsContainerPage, AdditionalFile,
     29    RefereeReportAddFormPage, ExportPDFReportSlipPage, ExportPDFReportSlipPage2,
     30    RefereeReportDisplayFormPage)
    2931from waeup.kofa.applicants.interfaces import (
    3032    ISpecialApplicant, IApplicantsContainer)
     
    5153    ICustomPGApplicant, ICustomUGApplicant, ICustomApplicant,
    5254    ICustomPGApplicantEdit, ICustomUGApplicantEdit,
    53     ICustomApplicantOnlinePayment
     55    ICustomApplicantOnlinePayment, ICustomApplicantRefereeReport
    5456    )
    5557from kofacustom.iuokada.interfaces import MessageFactory as _
     
    246248        return form_fields
    247249
     250class RefereeReportAddFormPage(RefereeReportAddFormPage):
     251    """Add-form to add an referee report. This form
     252    is protected by a mandate.
     253    """
     254    form_fields = grok.AutoFields(
     255        ICustomApplicantRefereeReport).omit('creation_date')
     256
     257class CustomRefereeReportDisplayFormPage(RefereeReportDisplayFormPage):
     258    """A display view for referee reports.
     259    """
     260    form_fields = grok.AutoFields(ICustomApplicantRefereeReport)
     261    form_fields[
     262        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     263
     264
     265class CustomExportPDFReportSlipPage(ExportPDFReportSlipPage):
     266    form_fields = grok.AutoFields(ICustomApplicantRefereeReport)
     267    form_fields[
     268        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     269
     270class CustomExportPDFReportSlipPage2(ExportPDFReportSlipPage2):
     271    form_fields = grok.AutoFields(ICustomApplicantRefereeReport)
     272    form_fields[
     273        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     274
    248275class ResultStatement(AdditionalFile):
    249276    grok.name('res_stat.pdf')
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/interfaces.py

    r16049 r16062  
    2929from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
    3030from waeup.kofa.applicants.interfaces import (
    31     contextual_reg_num_source, IApplicantBaseData)
     31    contextual_reg_num_source, IApplicantBaseData, IApplicantRefereeReport)
    3232from waeup.kofa.refereeentries import RefereeEntryField
    3333from kofacustom.nigeria.applicants.interfaces import (
     
    7070    )
    7171
     72rating_vocab = SimpleKofaVocabulary(
     73    (_('Excellent'), 'e'),
     74    (_('Very good'), 'vg'),
     75    (_('Good'), 'g'),
     76    (_('Slightly above average'), 'saa'),
     77    (_('Average'), 'a'),
     78    (_('Below average'), 'ba'),
     79    (_('Unable to assess'), 'unable'),
     80    )
     81
     82
     83overallpromise_vocab = SimpleKofaVocabulary(
     84    (_('Very good (highest 10%'), 'vg'),
     85    (_('Above average (next 15%)'), 'aa'),
     86    (_('Average (middle 20%)'), 'a'),
     87    (_('Below average (middle 40%)'), 'ba'),
     88    )
     89
    7290class ICustomUGApplicant(IApplicantBaseData):
    7391    """An undergraduate applicant.
     
    418436    the applicant object.
    419437    """
     438
     439class ICustomApplicantRefereeReport(IApplicantRefereeReport):
     440    """A referee report.
     441    """
     442
     443    duration = schema.Text(
     444        title = _(u'How long and in what capacity have you known the candidate?'),
     445        required = False,
     446        )
     447
     448    itellectual = schema.Choice(
     449        title = _(u'Intellectual Capacity'),
     450        required = False,
     451        readonly = False,
     452        vocabulary = rating_vocab,
     453        )
     454
     455    persistent = schema.Choice(
     456        title = _(u'Capacity for Persistent and Independent Academic Study'),
     457        required = False,
     458        readonly = False,
     459        vocabulary = rating_vocab,
     460        )
     461
     462    imaginative = schema.Choice(
     463        title = _(u'Ability for Imaginative Thought'),
     464        required = False,
     465        readonly = False,
     466        vocabulary = rating_vocab,
     467        )
     468
     469    productive = schema.Choice(
     470        title = _(u'Promise of Productive Scholarship'),
     471        required = False,
     472        readonly = False,
     473        vocabulary = rating_vocab,
     474        )
     475
     476    previous = schema.Choice(
     477        title = _(u'Quality of Previous Work'),
     478        required = False,
     479        readonly = False,
     480        vocabulary = rating_vocab,
     481        )
     482
     483    expression = schema.Choice(
     484        title = _(u'Oral and Written Expression in English'),
     485        required = False,
     486        readonly = False,
     487        vocabulary = rating_vocab,
     488        )
     489
     490    personality = schema.Text(
     491        title = _(u'Please comment on the candidate\'s personality '
     492            'with particular reference to his/her moral character, emotional '
     493            'and physical stabilty'),
     494        required = False,
     495        )
     496
     497    promise = schema.Choice(
     498        title = _(u'Candidate\'s overall promise'),
     499        required = False,
     500        readonly = False,
     501        vocabulary = overallpromise_vocab,
     502        )
     503
     504    report = schema.Text(
     505        title = _(u'Any other relevant information which would help '
     506            'in determining the candidate\'s suitability?'),
     507        required = False,
     508        )
     509
     510    objection = schema.Text(
     511        title = _(u'Have you any objection to the contents of this '
     512            'evaluation being disclosed to any award-given body if '
     513            'the need arises?'),
     514        required = False,
     515        )
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/utils.py

    r16054 r16062  
    9191        """
    9292        try: title = "%s / %s / %s (%s)" % (
    93             value.__parent__.__parent__.__parent__.code,
    94             value.__parent__.__parent__.code,
     93            value.__parent__.__parent__.__parent__.longtitle,
     94            value.__parent__.__parent__.longtitle,
    9595            value.title, value.code)
    9696        except AttributeError:
Note: See TracChangeset for help on using the changeset viewer.