Ignore:
Timestamp:
26 Apr 2011, 10:35:52 (14 years ago)
Author:
Henrik Bettermann
Message:

Implement a vocabulary module in university and move some vocabularies to it.

Rebuild the certificatepage page template.

Rename Course Reference to Course Referrer. It's very difficult to find a proper name for these 'certificatecourse' objects. But we have to clearly distinguish courses and referrers of courses as they are not the same.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r5951 r5977  
    11841184            if a['level'] > b['level']:
    11851185                return 1
     1186            if a['semester'] < b['semester']:
     1187                return -1
     1188            if a['semester'] > b['semester']:
     1189                return 1               
    11861190            if a['mandatory'] != b['mandatory']:
    11871191                if a['mandatory'] == False and b['mandatory'] == True:
     
    11961200        entries = []
    11971201        levels = dict()
    1198         for key, course in self.context.items():
    1199             certcourse = self.context[key]
     1202        for key, certcourse in self.context.items():
    12001203            course = certcourse.course
    12011204            level = certcourse.level
    12021205            mandatory = certcourse.core_or_elective
    12031206            title = course.title
    1204             code = course.code
    1205             course_url = self.url(self.context[key])
     1207            courseref_url = self.url(self.context[key])
     1208            course_url = self.url(course)
    12061209            semester = course.semester
    12071210
    12081211            new_entry = dict(
    1209                 level=level, mandatory=mandatory, url=course_url,
    1210                 title=title, code=code, semester=semester)
     1212                level=level, mandatory=mandatory, url=courseref_url,
     1213                title=title, semester=semester, course=course, code=key,
     1214                course_url=course_url)
    12111215            if str(level) not in levels.keys():
    12121216                levels[str(level)] = dict()
     
    12781282    @property
    12791283    def title(self):
    1280         return 'Course Reference: %s' % (self.context.course.code)
     1284        return 'Course Referrer: %s' % (self.context.__name__)
    12811285
    12821286class CertificateCourseFormPage(WAeUPEditFormPage):
     
    12911295    @property
    12921296    def title(self):
    1293         return 'Edit course reference'
     1297        return 'Edit course referrer'
    12941298   
    12951299    @grok.action('Save and return')
     
    13211325    form_fields = grok.AutoFields(ICertificateCourseAdd)
    13221326    pnav = 1
    1323     title = 'Add course reference'
    1324 
    1325     @grok.action('Add course reference')
     1327    title = 'Add course referrer'
     1328
     1329    @grok.action('Add course referrer')
    13261330    def addCertcourse(self, **data):
    13271331        try:
    13281332            self.context.addCourseRef(**data)
    13291333        except KeyError:
    1330             self.status = Invalid('The chosen course reference is already part of'
     1334            self.status = Invalid('The chosen course referrer is already part of'
    13311335                                  'this certificate')
    13321336            return
    13331337        except DuplicationError:
    1334             self.status = Invalid('The chosen course reference is already part of'
     1338            self.status = Invalid('The chosen course referrer is already part of'
    13351339                                  'this certificate')
    13361340            return
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatecoursepage.pt

    r5950 r5977  
    1 <h2 tal:content="context/course/code">TITLE</h2>
     1<h2 tal:content="context/__name__">TITLE</h2>
    22
    33<table class="listing">
     
    66  <tbody>
    77    <tr class="odd">
    8       <td>Reference Code:</td>
     8      <td>Code:</td>
    99      <td tal:content="context/__name__">CODE</td>
    1010    </tr> 
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatepage.pt

    r5946 r5977  
    11<h2 tal:content="context/title">TITLE</h2>
    22
    3 <table class="listing">
     3<table class="zebra">
    44  <thead>
    55  </thead>
    66  <tbody>
    7     <tr class="odd">
     7    <tr>
    88      <td>Code:</td>
    99      <td tal:content="context/__name__">CODE</td>
    1010    </tr>   
    11     <tr class="even">
     11    <tr>
    1212      <td>Title:</td>
    1313      <td tal:content="context/title">THE TITLE</td>
    1414    </tr>
    15     <tr class="odd">
     15    <tr>
    1616      <td>Start Level:</td>
    1717      <td tal:content="context/start_level">START_LEVEL</td>
    1818    </tr>
    19     <tr class="even">
     19    <tr>
    2020      <td>End Level:</td>
    2121      <td tal:content="context/end_level">END_LEVEL</td>
    2222    </tr>
    23     <tr class="odd">
     23    <tr>
    2424      <td>Study Mode:</td>
    2525      <td tal:content="context/study_mode">STUDY_MODE</td>
    2626    </tr>
    27     <tr class="even">
     27    <tr>
    2828      <td>Application Category:</td>
    2929      <td tal:content="context/application_category">APPLICATION_CATEGORY</td>
     
    3232</table>
    3333
    34 <h3>Courses</h3>
     34<h3><span tal:content="context/__name__">Code</span> Course Referrers</h3>
    3535
     36    <table class="zebra">
     37      <thead>
     38        <tr>
     39          <th>Course Referrer</th>
     40          <th>Course</th>
     41          <th>Title</th>
     42          <th>Level</th>
     43          <th>Semester</th>
     44          <th>Mandatory</th>
     45          <th>&nbsp;</th>
     46        </tr>     
     47      </thead>   
     48      <tbody>
     49      <span tal:omit-tag="" tal:repeat="level python: sorted(view.getCourseList().items())">
     50      <span tal:omit-tag="" tal:repeat="semester python: sorted(level[1].items())">
     51      <tr tal:repeat="courseref python:semester[1]">
     52        <td> <a href="" tal:attributes="href courseref/url" tal:content="courseref/code">courseref code</a></td>
     53        <td> <a href="" tal:attributes="href courseref/course_url" tal:content="courseref/course/code">course code</a></td>
     54        <td tal:content="courseref/title">title</td>
     55        <td tal:content="python:level[0]">level</td>
     56        <td tal:content="python:semester[0]">semester</td>
     57        <td tal:content="courseref/mandatory">mandatory</td>
     58        <td>
     59            <form method="POST">
     60              <input type="hidden" name="code"
     61                 value="" tal:attributes="value courseref/course/code" />
     62              <input type="hidden" name="level"
     63                 value="" tal:attributes="value python:level[0]" />
     64              <input type="submit" name="delcourse" value="delete" />
     65             </form>       
     66        </td>
     67      </tr>
     68      </span>
     69      </span>
     70      </tbody>
     71    </table>
    3672
    37 <div tal:repeat="level python: sorted(view.getCourseList().items())">
    38   <b>
    39     Level <span tal:replace="python: level[0]">100</span>
    40   </b>
    41 
    42   <div tal:repeat="semester python: sorted(level[1].items())">
    43     <div tal:condition="python: semester[0] == '0'">
    44       &nbsp;&nbsp;Untimed courses
    45     </div>
    46     <div tal:condition="python: semester[0] == '1'">
    47       &nbsp;&nbsp;First semester
    48     </div>
    49     <div tal:condition="python: semester[0] == '2'">
    50       &nbsp;&nbsp;Second semester
    51     </div>
    52     <div tal:condition="python: semester[0] == '3'">
    53       &nbsp;&nbsp;Combined
    54     </div>
    55    
    56     <div tal:repeat="course python:semester[1]">
    57       &nbsp;&nbsp;&nbsp;&nbsp;
    58         <form method="POST">
    59           <input type="hidden" name="code"
    60                  value="" tal:attributes="value course/code" />
    61           <input type="hidden" name="level"
    62                  value="" tal:attributes="value python:level[0]" />
    63           <input type="submit" name="delcourse" value="delete" />
    64 
    65       <a href=""
    66          tal:attributes="href course/url"
    67          ><span tal:content="course/code">code</span>
    68       </a>
    69       <span tal:content="course/title">title</span>
    70       <span tal:condition="course/mandatory">
    71         [mandatory]
    72       </span>
    73       <span tal:condition="not: course/mandatory">
    74         [optional]
    75       </span>
    76         </form>
    77     </div>
    78   </div>
    79 
    80 </div>
    81 
    82 
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r5950 r5977  
    344344    grok.context(ICertificateCourse)
    345345    grok.view(CertificateCoursePage)
    346     text = 'Edit course reference'
     346    text = 'Edit course referrer'
    347347
    348348#
     
    384384    grok.view(CertificatePage)
    385385    grok.order(4)
    386     text = 'Add course reference'
     386    text = 'Add course referrer'
    387387    target = 'addcertificatecourse'
    388388
Note: See TracChangeset for help on using the changeset viewer.