Ignore:
Timestamp:
20 Jan 2012, 08:07:26 (13 years ago)
Author:
Henrik Bettermann
Message:

Some button adjustments. Remove 'Save and return' button from CourseManageFormPage? to be in accordance with other form pages.

Add some flash messages after saving data.

sendContactForm returns either True or breaks with an exception. Thus, the 'if success' statement in send methods of contact forms doesn't make sense.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
3 edited

Legend:

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

    r7459 r7490  
    615615
    616616Clicking 'Save' we will stay on the settings form. So we can change
    617 the course again. This time we will return to the overview page
    618 afterwards:
    619 
    620   >>> browser.getControl(name='form.title').value = "My renamed course"
    621   >>> ctrl = browser.getControl("Save and return")
    622   >>> ctrl.click()
    623 
    624 If we go to the settings page and click ``Cancel`` nothing will be
     617the course again. If we click ``Cancel`` nothing will be
    625618changed:
    626619
    627   >>> browser.getLink('Edit course').click()
    628620  >>> browser.getControl(name='form.title').value = "Blah"
    629621  >>> browser.getControl('Cancel').click()
    630622
    631 Our course was indeed renamed to ``My renamed course`` and not to
    632 ``Blah``:
     623Our course was not renamed to ``Blah``:
    633624
    634625  >>> browser.open('http://localhost/myuniversity/faculties/TF/TD')
    635626  >>> print browser.contents
    636627  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    637   ...<td>My renamed course</td>...
     628  ...<td>My test course</td>...
    638629  ...
    639630
     
    642633
    643634  >>> browser.open('http://localhost/myuniversity/faculties/search')
    644   >>> browser.getControl(name='query').value = "My renamed course"
     635  >>> browser.getControl(name='query').value = "My test course"
    645636  >>> browser.getControl('Search').click()
    646637  >>> print browser.contents
     
    676667  >>> browser.open(
    677668  ...     'http://localhost/myuniversity/faculties/TF/TD/@@manage#tab-2')
    678   >>> 'My renamed course' in browser.contents
     669  >>> 'My test course' in browser.contents
    679670  True
    680671
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7485 r7490  
    227227                username,usertype,self.config.name,
    228228                data['body'],self.config.email_subject)
     229        # Success is always True if sendContactForm didn't fail.
     230        # TODO: Catch exceptions.
    229231        if success:
    230232            self.flash('Your message has been sent.')
    231         else:
    232             self.flash('An smtp server error occurred.')
    233233        return
    234234
     
    460460                self.request.principal.id,usertype,self.config.name,
    461461                data['body'],self.config.email_subject)
     462        # Success is always True if sendContactForm didn't fail.
     463        # TODO: Catch exceptions.
    462464        if success:
    463465            self.flash('Your message has been sent.')
    464         else:
    465             self.flash('An smtp server error occurred.')
    466466        return
    467467
     
    12891289    def save(self, **data):
    12901290        self.applyData(self.context, **data)
     1291        self.flash('Form has been saved.')
    12911292        return
    12921293
     
    14681469    def save(self, **data):
    14691470        self.applyData(self.context, **data)
     1471        self.flash('Form has been saved.')
    14701472        return
    14711473
     
    16101612    def save(self, **data):
    16111613        self.applyData(self.context, **data)
    1612         return
    1613 
    1614     @action('Save and return')
    1615     def saveAndReturn(self, **data):
    1616         self.applyData(self.context, **data)
    1617         self.redirect(self.url(self.context))
    1618         return
     1614        self.flash('Form has been saved.')
     1615        return
     1616
     1617    #@action('Save and return')
     1618    #def saveAndReturn(self, **data):
     1619    #    self.applyData(self.context, **data)
     1620    #    self.redirect(self.url(self.context))
     1621    #    return
    16191622
    16201623    @action('Cancel', validator=NullValidator)
     
    16831686    def save(self, **data):
    16841687        self.applyData(self.context, **data)
     1688        self.flash('Form has been saved.')
    16851689        return
    16861690
     
    17811785    pnav = 1
    17821786
    1783     @action('Save and return')
     1787    @action('Save and return', style='primary')
    17841788    def saveAndReturn(self, **data):
    17851789        parent = self.context.__parent__
     
    17931797            parent.addCourseRef(**data)
    17941798            parent.delCourseRef(data['course'].code, level=old_level)
     1799        self.flash('Form has been saved.')
    17951800        self.redirect(self.url(parent))
    17961801        return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7484 r7490  
    419419        datepicker.need() # Enable jQuery datepicker in date fields.
    420420        tabs.need()
     421        self.tab1 = self.tab2 = ''
     422        qs = self.request.get('QUERY_STRING', '')
     423        if not qs:
     424            qs = 'tab1'
     425        setattr(self, qs, 'active')
    421426        super(StudentBaseManageFormPage, self).update()
    422427        self.wf_info = IWorkflowInfo(self.context)
     
    564569        datepicker.need() # Enable jQuery datepicker in date fields.
    565570        tabs.need()
     571        self.tab1 = self.tab2 = ''
     572        qs = self.request.get('QUERY_STRING', '')
     573        if not qs:
     574            qs = 'tab1'
     575        setattr(self, qs, 'active')
    566576        return super(StudentClearanceManageFormPage, self).update()
    567577
     
    714724        super(StudyCourseManageFormPage, self).update()
    715725        tabs.need()
    716         warning.need()
    717         datatable.need()
    718726        self.tab1 = self.tab2 = ''
    719727        qs = self.request.get('QUERY_STRING', '')
     
    721729            qs = 'tab1'
    722730        setattr(self, qs, 'active')
    723         return
     731        warning.need()
     732        datatable.need()
     733        return
    724734
    725735    @action('Save', style='primary')
     
    897907        super(StudyLevelManageFormPage, self).update()
    898908        tabs.need()
    899         warning.need()
    900         datatable.need()
    901909        self.tab1 = self.tab2 = ''
    902910        qs = self.request.get('QUERY_STRING', '')
     
    904912            qs = 'tab1'
    905913        setattr(self, qs, 'active')
     914        warning.need()
     915        datatable.need()
    906916        return
    907917
     
    20612071    def update(self):
    20622072        super(StudyLevelEditFormPage, self).update()
    2063     #    tabs.need()
    20642073        datatable.need()
    20652074        warning.need()
Note: See TracChangeset for help on using the changeset viewer.