sms: separate setting and test pages

This commit is contained in:
Thomas NOËL 2013-03-05 20:06:30 +01:00
parent 55db0d34be
commit eb29fb0826
1 changed files with 4 additions and 13 deletions

View File

@ -698,7 +698,7 @@ class SettingsDirectory(QommonSettingsDirectory):
form = Form(enctype='multipart/form-data')
form.add(SingleSelectWidget, 'mode', title = _('SMS Mode'),
value = mode,
options = [('none', _('No support'), 'none')]+
options = [(str('none'), _('No support'), str('none'))]+
[(str(k), _(SMS.providers.get(k)[0]), str(k)) for k in SMS.providers.keys()])
form.add_submit('submit', _('Submit'))
@ -732,14 +732,7 @@ class SettingsDirectory(QommonSettingsDirectory):
form.render()
if mode != 'none':
form = Form(enctype='multipart/form-data', action='smstest')
form.add(StringWidget, 'sender', title=_('Sender'), required=True)
form.add(StringWidget, 'destinations', title=_('Destinations'), required=True)
form.add(StringWidget, 'text', title=_('Text'), required=True)
form.add_submit('submit', _('Submit'))
'<h3>%s</h3>' % _('SMS Test')
form.render()
'<p><a href="smstest">%s</a></p>' % _('SMS Test')
def smstest [html] (self):
form = Form(enctype='multipart/form-data', action='smstest')
@ -752,15 +745,13 @@ class SettingsDirectory(QommonSettingsDirectory):
if form.get_widget('cancel').parse():
return redirect('sms')
if not form.get_submit():
return redirect('sms')
get_response().breadcrumb.append(('sms', _('SMS')))
get_response().breadcrumb.append(('smstest', _('SMS Test')))
html_top('settings', title = _('SMS Test'))
'<h2>%s</h2>' % _('SMS Test')
form.render()
if not form.has_errors():
if form.get_submit() and not form.has_errors():
sms_cfg = get_cfg('sms', {})
mode = sms_cfg.get('mode', 'none')
sms = SMS.get_sms_class(mode)