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/university
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/university/certificate.py

    r5953 r5977  
    5858   
    5959    def addCourseRef(self, course, level=100, core_or_elective=True):
    60         """Add a course reference.
     60        """Add a course referrer.
    6161        """
    6262        code = "%s_%s" % (course.code, level)
     
    6767
    6868    def delCourseRef(self, code, level=None):
    69         """Delete a course reference denoted by its code.
     69        """Delete a course referrer denoted by its code.
    7070        """
    7171        for key in self.keys():
     
    122122@grok.subscribe(ICourse, grok.IObjectRemovedEvent)
    123123def removedCourseHandler(course, event):
    124     """If a course is deleted, we make sure that also references in a
     124    """If a course is deleted, we make sure that also referrers in a
    125125       certificatecontainer are removed.
    126126    """
    127127    code = course.code
    128128
    129     # Find all certcourses that reference the given course...
     129    # Find all certificatecourses that refer to given course...
    130130    try:
    131131        cat = getUtility(ICatalog, name='certcourses_catalog')
     
    136136    results = cat.searchResults(course_code=(code, code))
    137137    for certcourse in results:
    138         # Remove that reference...
     138        # Remove that referrer...
    139139        cert = certcourse.__parent__
    140140        cert.delCourseRef(code)
  • main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py

    r5951 r5977  
    11"""Interfaces of academics specific objects.
    22"""
    3 from zc.sourcefactory.basic import BasicSourceFactory
    43from zope import schema
    5 try:
    6     from zope.catalog.interfaces import ICatalog
    7 except ImportError:
    8     # BBB
    9     from zope.app.catalog.interfaces import ICatalog
    10 from zope.component import getUtility
    114from zope.interface import Attribute
    12 from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPContainer,
    13                                    SimpleWAeUPVocabulary)
    14 
    15 class CourseSource(BasicSourceFactory):
    16     """A course source delivers all courses inside the portal by looking
    17        up a catalog.
    18     """
    19     def getValues(self):
    20         catalog = getUtility(ICatalog, name='courses_catalog')
    21         return list(catalog.searchResults(code=('', 'z*')))
    22 
    23     def getToken(self, value):
    24         return value.code
    25        
    26     def getTitle(self, value):
    27         return "%s - %s" % (value.code, value.title[:64])
     5from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPContainer)
     6                                   
     7from waeup.sirp.university.vocabularies import (course_levels,
     8                                                semester, CourseSource)                                   
    289
    2910class IFaculty(IWAeUPContainer):
     
    151132        title = u'Semester/Term',
    152133        default = 0,
    153         vocabulary = SimpleWAeUPVocabulary(
    154             ('N/A', 0), ('First Semester', 1),
    155             ('Second Semester', 2), ('Combined', 3)),
     134        vocabulary = semester,
    156135        required = True,
    157136        )
     
    199178        )
    200179
    201     start_level = schema.TextLine(
     180    start_level = schema.Choice(
    202181        title = u'Start Level',
    203         default = u'100',
    204         required = True,
    205         )
    206    
    207     end_level = schema.TextLine(
     182        #source = LevelSource(),
     183        vocabulary = course_levels,
     184        default = 100,
     185        required = True,
     186        )
     187   
     188    end_level = schema.Choice(
    208189        title = u'End Level',
    209         default = u'500',
     190        #source = LevelSource(),
     191        vocabulary = course_levels,
     192        default = 500,
    210193        required = True,
    211194        )
     
    240223
    241224class ICertificateCourse(IWAeUPObject):
    242     """A certificatecourse is a course referenced by a certificate, which
     225    """A certificatecourse is referring a course and
    243226       provides some own attributes.
    244227    """
    245228    course = schema.Choice(
    246         title = u'Course referenced',
     229        title = u'Course referrer',
    247230        source = CourseSource(),
    248231        readonly = True,
    249232        )
    250233   
    251     level = schema.Int(
     234    level = schema.Choice(
    252235        title = u'Level',
    253236        required = True,
    254         default = 100,
     237        #source = LevelSource(),
     238        vocabulary = course_levels,
    255239        readonly = False,
    256240        )
     
    263247
    264248    def getCourseCode():
    265         """Return the code of the referenced course.
     249        """Return the code of the course referred to.
    266250
    267251        This is needed for cataloging.
     
    270254       
    271255class ICertificateCourseAdd(ICertificateCourse):
    272     """A certificatecourse is a course referenced by a certificate, which
     256    """A certificatecourse is referring a course and
    273257       provides some own attributes.
    274258    """
    275259    course = schema.Choice(
    276         title = u'Course to be referenced',
     260        title = u'Course',
    277261        source = CourseSource(),
    278262        readonly = False,
Note: See TracChangeset for help on using the changeset viewer.