Changeset 5950


Ignore:
Timestamp:
15 Apr 2011, 09:46:16 (14 years ago)
Author:
Henrik Bettermann
Message:

Courses and courses references (certificate courses) must be distinguishable.

Implement different interfaces for certificates.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
1 added
5 edited

Legend:

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

    r5947 r5950  
    661661  >>> ctrl = browser.getControl(name='form.course')
    662662  >>> ctrl.displayOptions
    663   ['(no value)', 'COURSE1 Course 1', 'COURSE2 Course 2']
     663  ['(no value)', 'COURSE1 - Course 1', 'COURSE2 - Course 2']
    664664
    665665We select the first course and create our certificatecourse:
     
    692692
    693693  >>> browser.open(cert_url + '/COURSE1_100')
    694   >>> browser.getLink('Edit certificate course').click()
     694  >>> browser.getLink('Edit course reference').click()
    695695
    696696Let's set a new level (it was 100 before) and save the form. This will
     
    710710changed:
    711711
    712   >>> browser.getLink('Edit certificate course').click()
     712  >>> browser.getLink('Edit course reference').click()
    713713  >>> browser.getControl(name='form.level').value = "666"
    714714  >>> browser.getControl('Cancel').click()
     
    718718  >>> browser.open(cert_url + '/COURSE1_200')
    719719  >>> print browser.contents
    720   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    721   ...Level of this course
    722   ...200...
     720  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     721  ...<td>Level:</td>
     722  ...<td>200</td>
    723723  ...
    724724
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/interfaces.py

    r5005 r5950  
    77from waeup.sirp.university.interfaces import (
    88    IFacultyContainer, IFaculty, IDepartment, ICourseContainer, ICourse,
    9     ICertificateContainer, ICertificate, ICertificateCourse)
     9    ICertificateContainer, ICertificate, ICertificateCourse, CourseSource)
    1010
    1111class IBreadcrumb(Interface):
     
    5555        """Get the list of breadcrumbs as real Python list.
    5656        """
     57       
     58class ICertificateCourseAdd(ICertificateCourse):
     59    """A certificatecourse is a course referenced by a certificate, which
     60       provides some own attributes.
     61    """
     62    course = schema.Choice(
     63        title = u'Course to be referenced',
     64        source = CourseSource(),
     65        readonly = False,
     66        )
     67   
     68    level = schema.Int(
     69        title = u'Level of this course',
     70        required = True,
     71        default = 100,
     72        readonly = False,
     73        )   
     74
     75    core_or_elective = schema.Bool(
     76        title = u'Is mandatory course (not elective)',
     77        required = True,
     78        default = True
     79        )       
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r5949 r5950  
    3434from waeup.sirp.browser.interfaces import (
    3535    IUniversity, IFacultyContainer, IFaculty, IDepartment, ICourse,
    36     ICertificate, ICertificateCourse)
     36    ICertificate, ICertificateCourse, ICertificateCourseAdd)
    3737from waeup.sirp.catalog import search_context
    3838from waeup.sirp.interfaces import(
     
    11831183    @property
    11841184    def title(self):
    1185         return "%s (%s)" % (self.context.title, self.context.code)
     1185        return "Certificate: %s (%s)" % (self.context.title, self.context.code)
    11861186
    11871187    def update(self):
     
    12361236    grok.name('manage')
    12371237    grok.require('waeup.manageUniversity')
     1238    title = u'Edit certificate'
    12381239    pnav = 1
    12391240   
    12401241    form_fields = grok.AutoFields(ICertificate)
    12411242
    1242     @property
    1243     def title(self):
    1244         # Set certificate name as form label
    1245         return self.form_fields['title'].field.get(self.context)
     1243    #@property
     1244    #def title(self):
     1245    #    # Set certificate name as form label
     1246    #    return self.form_fields['title'].field.get(self.context)
    12461247   
    12471248    @grok.action('Save')
     
    12801281# Certificate course pages...
    12811282#
    1282 class CertificateCoursePage(WAeUPDisplayFormPage):
    1283     """Course index page.
     1283class CertificateCoursePage(WAeUPPage):
     1284    """CertificateCourse index page.
    12841285    """
    12851286    grok.context(ICertificateCourse)
     
    12911292    @property
    12921293    def title(self):
    1293         return self.context.course.title
     1294        return 'Course Reference: %s' % (self.context.course.code)
    12941295
    12951296class CertificateCourseFormPage(WAeUPEditFormPage):
     
    13041305    @property
    13051306    def title(self):
    1306         return 'Edit certificate course %s' % self.context.course.code
     1307        return 'Edit course reference'
    13071308   
    13081309    @grok.action('Save and return')
     
    13151316            # the key of the entry will change as well...
    13161317            old_level = self.context.level
     1318            data['course'] = self.context.course
    13171319            parent.addCourseRef(**data)
    13181320            parent.delCourseRef(data['course'].code, level=old_level)
     
    13311333    grok.name('addcertificatecourse')
    13321334    grok.require('waeup.manageUniversity')
    1333     form_fields = grok.AutoFields(ICertificateCourse)
    1334     pnav = 1
    1335     title = 'Add course'
    1336 
    1337     @grok.action('Add course')
     1335    form_fields = grok.AutoFields(ICertificateCourseAdd)
     1336    pnav = 1
     1337    title = 'Add course reference'
     1338
     1339    @grok.action('Add course reference')
    13381340    def addCertcourse(self, **data):
    13391341        try:
    13401342            self.context.addCourseRef(**data)
    13411343        except KeyError:
    1342             self.status = Invalid('The chosen course is already part of'
     1344            self.status = Invalid('The chosen course reference is already part of'
    13431345                                  'this certificate')
    13441346            return
    13451347        except DuplicationError:
    1346             self.status = Invalid('The chosen course is already part of'
     1348            self.status = Invalid('The chosen course reference is already part of'
    13471349                                  'this certificate')
    13481350            return
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r5942 r5950  
    344344    grok.context(ICertificateCourse)
    345345    grok.view(CertificateCoursePage)
    346     text = 'Edit certificate course'
     346    text = 'Edit course reference'
    347347
    348348#
  • main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py

    r5949 r5950  
    2525       
    2626    def getTitle(self, value):
    27         return "%s %s" % (value.code, value.title[:32])
     27        return "%s - %s" % (value.code, value.title[:64])
    2828
    2929class IFaculty(IWAeUPContainer):
     
    190190    """
    191191    course = schema.Choice(
    192         title = u'Course',
     192        title = u'Course referenced',
    193193        source = CourseSource(),
     194        readonly = True,
    194195        )
    195196   
     
    197198        title = u'Level of this course',
    198199        required = True,
    199         default = 100
     200        default = 100,
     201        readonly = False,
    200202        )
    201203
     
    203205        title = u'Is mandatory course (not elective)',
    204206        required = True,
    205         default = True
     207        default = True,
    206208        )
    207209
Note: See TracChangeset for help on using the changeset viewer.