Ignore:
Timestamp:
22 Jun 2013, 07:43:52 (11 years ago)
Author:
Henrik Bettermann
Message:

Render public link to past-questions pdf file depending on course1 department code.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/applicants
Files:
2 edited

Legend:

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

    r10337 r10338  
    2222from kofacustom.nigeria.applicants.browser import NigeriaApplicantEditFormPage
    2323
     24PASTQ_ALL = ['ADT','EPCS','ESM','HEK','VTE']
     25
     26PASTQ_AL = ['ENL','FAA','FOL','HIS','LAL',
     27            'PHL','THR','BUL','JIL','LAW','PPL','PUL'] + PASTQ_ALL
     28
     29PASTQ_BS = ['ANT','ANY','CHH','COH','HAE','MED','MEH','PHS','SUR',
     30            'PCG','PCH','PCO', 'PCT','PHA','PHM','PMB','ANA','MBC',
     31            'MLS','NSC','PSY','DPV','ODR','OSP','PER', 'RES','AEB',
     32            'BCH','BOT','CED','EVL','MCB','OPT','PBB','SLT','ZOO',
     33            'AEE','ANS', 'CRS','FIS','FOW','SOS'] + PASTQ_ALL
     34
     35PASTQ_EPS = ['CHE','CVE','DMIC','EEE','MCH','PEE','PRE','CHM',
     36             'CSC','GLY','MTH','PHY'] + PASTQ_ALL
     37
     38PASTQ_MSS = ['ACC','BNK','BUS','ECO','GEO','POL','SAA','SWK'] + PASTQ_ALL
    2439
    2540class CustomApplicantRegistrationPage(ApplicantRegistrationPage):
     
    3853    """
    3954    grok.template('applicanteditpage')
     55
     56    def _show_pastq(self):
     57        return self.target.startswith('putme') \
     58               and self.context.state == 'paid' \
     59               and getattr(self.context, 'course1') is not None
     60
     61    @property
     62    def show_pastq_al(self):
     63        return self._show_pastq() \
     64               and self.context.course1.__parent__.__parent__.code in PASTQ_AL
     65
     66    @property
     67    def show_pastq_bs(self):
     68        return self._show_pastq() \
     69               and self.context.course1.__parent__.__parent__.code in PASTQ_BS
     70
     71    @property
     72    def show_pastq_eps(self):
     73        return self._show_pastq() \
     74               and self.context.course1.__parent__.__parent__.code in PASTQ_EPS
     75
     76    @property
     77    def show_pastq_mss(self):
     78        return self._show_pastq() \
     79               and self.context.course1.__parent__.__parent__.code in PASTQ_MSS
     80
     81
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser_templates/applicanteditpage.pt

    r10287 r10338  
    1919  </div>
    2020
    21   <div tal:condition="python: view.target.startswith('putme') and
    22                               view.context.__parent__.year == 2014 and
    23                               view.context.state == 'paid'">
    24     <br />
    25     <a href="https://uniben.waeup.org/downloads/PastExercises.pdf"
     21  <h4 tal:condition="view/show_pastq_al">
     22    Download past questions
     23    <a href="https://uniben.waeup.org/downloads/ArtsAndLaw.pdf"
    2624        i18n:translate="">
    27       Download past questions to exercise.
    28     </a><br /><br />
    29   </div>
     25      'Arts And Law'
     26    </a>
     27     to exercise.
     28  </h4>
     29
     30  <h4 tal:condition="view/show_pastq_bs">
     31    Download past questions
     32    <a href="https://uniben.waeup.org/downloads/BiologicalSciences.pdf"
     33        i18n:translate="">
     34      'Biological Sciences'
     35    </a>
     36     to exercise.
     37  </h4>
     38
     39  <h4 tal:condition="view/show_pastq_eps">
     40    Download past questions
     41    <a href="https://uniben.waeup.org/downloads/EngineeringAndPhysicalSciences.pdf"
     42        i18n:translate="">
     43      'Engineering And Physical Sciences'
     44    </a>
     45     to exercise.
     46  </h4>
     47
     48  <h4 tal:condition="view/show_pastq_mss">
     49    Download past questions
     50    <a href="https://uniben.waeup.org/downloads/ManagementAndSocialSciences.pdf"
     51        i18n:translate="">
     52      'Management And Social Sciences'
     53    </a>
     54     to exercise.
     55  </h4>
    3056
    3157  <table class="form-table">
Note: See TracChangeset for help on using the changeset viewer.