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/browser
Files:
2 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
Note: See TracChangeset for help on using the changeset viewer.