Ignore:
Timestamp:
20 Sep 2011, 14:11:34 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement AddStudyLevelFormPage? for students which add the current study level including course tickets. The page can only be called in state 'school fee paid'.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/static/waeup-base.css

    r6716 r6806  
    7070
    7171.studentmenu {
    72   text-align: center;
     72  text-align: right;
    7373  line-height: 2;
    7474}
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6803 r6806  
    486486    target = 'manage'
    487487
     488class AddStudyLevelActionButton(AddActionButton):
     489    grok.order(1)
     490    grok.context(IStudentStudyCourse)
     491    grok.view(StudyCourseDisplayFormPage)
     492    grok.require('waeup.handleStudent')
     493    text = 'Add course list'
     494    target = 'add'
     495
     496    @property
     497    def target_url(self):
     498        student = self.view.context.getStudent()
     499        condition1 = student.state != 'school fee paid'
     500        condition2 = str(student['studycourse'].current_level) in \
     501            self.view.context.keys()
     502        if condition1 or condition2:
     503            return ''
     504        return self.view.url(self.view.context, self.target)
     505
    488506class StudyCourseManageFormPage(WAeUPEditFormPage):
    489507    """ Page to edit the student study course data
     
    10021020        self.redirect(self.url(self.context))
    10031021        return
     1022
     1023class AddStudyLevelFormPage(WAeUPEditFormPage):
     1024    """ Page for students to add current study levels
     1025    """
     1026    grok.context(IStudentStudyCourse)
     1027    grok.name('add')
     1028    grok.require('waeup.handleStudent')
     1029    grok.template('studyleveladdpage')
     1030    form_fields = grok.AutoFields(IStudentStudyCourse)
     1031    title = 'Study Course'
     1032    pnav = 4
     1033
     1034    @property
     1035    def label(self):
     1036        studylevelsource = StudyLevelSource().factory
     1037        code = self.context.current_level
     1038        title = studylevelsource.getTitle(self.context, code)
     1039        return 'Add current level %s' % title
     1040
     1041    def emitLockMessage(self):
     1042        self.flash('The requested form is locked (read-only).')
     1043        self.redirect(self.url(self.context))
     1044        return
     1045
     1046    def update(self):
     1047        if self.context.getStudent().state != 'school fee paid':
     1048            self.emitLockMessage()
     1049            return
     1050        super(AddStudyLevelFormPage, self).update()
     1051        return
     1052
     1053    @grok.action('Create course list now')
     1054    def addStudyLevel(self, **data):
     1055        studylevel = StudentStudyLevel()
     1056        studylevel.level = self.context.current_level
     1057        studylevel.level_session = self.context.current_session
     1058        try:
     1059            self.context.addStudentStudyLevel(
     1060                self.context.certificate,studylevel)
     1061        except KeyError:
     1062            self.flash('This level exists.')
     1063        self.redirect(self.url(self.context))
     1064        return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/studycoursepage.pt

    r6775 r6806  
    4444
    4545<div tal:condition="python: not len(context.keys())">
    46 There no levels registered yet.
     46There are no levels registered yet.
    4747</div>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/studylevelmanagepage.pt

    r6802 r6806  
    6969      <th>Mandatory</th>
    7070      <th>Score</th>
    71       <th>Automatic</th>
     71      <th>Auto</th>
    7272    </tr>
    7373  </thead>
     
    8787      <td tal:content="value/core_or_elective">MANDATORY</td>
    8888      <td tal:content="value/score">SCORE</td>
    89       <td tal:content="value/automatic">AUTOMATIC</td>
     89      <td tal:content="value/automatic">AUTO</td>
    9090    </tr>
    9191  </tbody>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/studylevelpage.pt

    r6803 r6806  
    4343      <th>Mandatory</th>
    4444      <th>Score</th>
    45       <th>Automatic</th>
     45      <th>Auto</th>
    4646    </tr>
    4747  </thead>
     
    5757      <td tal:content="value/core_or_elective">MANDATORY</td>
    5858      <td tal:content="value/score">SCORE</td>
    59       <td tal:content="value/automatic">AUTOMATIC</td>
     59      <td tal:content="value/automatic">AUTO</td>
    6060    </tr>
    6161  </tbody>
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6805 r6806  
    238238    faculty = Attribute('faculty of the original course')
    239239    department = Attribute('department of the original course')
    240     automatic = Attribute('automatical creation of ticket')
    241240
    242241    core_or_elective = schema.Bool(
     
    254253        )
    255254
     255    automatic = schema.Bool(
     256        title = u'Automatical Creation',
     257        default = False,
     258        required = False,
     259        readonly = True,
     260        )
     261
    256262class ICourseTicketAdd(ICourseTicket):
    257263    """An interface for adding course tickets
  • main/waeup.sirp/trunk/src/waeup/sirp/students/studylevel.py

    r6802 r6806  
    7474        super(CourseTicket, self).__init__()
    7575        self.code = None
    76         self.automatic = None
    7776        self.title = None
    7877        self.faculty = None
Note: See TracChangeset for help on using the changeset viewer.