Add the classfication field to the by service fields

This commit is contained in:
Benjamin Dauvergne 2010-12-17 17:00:46 +01:00
parent 52d8f1b1c4
commit 2bf7d961f0
1 changed files with 40 additions and 33 deletions

View File

@ -99,51 +99,58 @@ vous connecter au portail de l'IFEF. Il peut contenir seulement des lettres et d
else:
form.add(HtmlWidget, htmltext('<p>%s</p>') % _('A password will be mailed to you.'))
classification = get_request().form.get('classification')
if classification:
if not check_classification(classification):
classification = None
if version == 1:
s='<label><p><em>%s:</em></p></label><select name="classification" size="18">' % _('Vous etes')
for q in schema:
if isinstance(q[1], tuple):
s += '<optgroup label="%s">' % q[0]
for r in q[1:]:
code, text = r
add_classification = True
if keys and 'classification' not in keys:
add_classification = False
if add_classification:
classification = get_request().form.get('classification')
if classification:
if not check_classification(classification):
classification = None
if version == 1:
s='<label><p><em>%s:</em></p></label><select name="classification" size="18">' % _('Vous etes')
for q in schema:
if isinstance(q[1], tuple):
s += '<optgroup label="%s">' % q[0]
for r in q[1:]:
code, text = r
if code == classification:
selected = 'selected="1"'
else:
selected = ''
s += '<option %s value="%s">%s</option>\n' % (selected, code, text)
s += '</optgroup>\n'
else:
code, text = q
if code == classification:
selected = 'selected="1"'
else:
selected = ''
s += '<option %s value="%s">%s</option>\n' % (selected, code, text)
s += '</optgroup>\n'
s += '</select>'
else:
s='<label><p><em>%s:</em></p></label><cite style="display: block; margin: 1em; font-size: 70%%">' % _('Vous etes')
for i, q in enumerate(schema):
if isinstance(q, tuple):
s += '<p>%s' % q[0]
for j, q in enumerate(q[1:]):
s += '<input id="s%s-%s" value="%s-%s" type="radio" name="RadioGroup">%s</input>' % (i, j, i, j, q)
s += '</p>\n'
else:
code, text = q
if code == classification:
selected = 'selected="1"'
else:
selected = ''
s += '<option %s value="%s">%s</option>\n' % (selected, code, text)
s += '</select>'
else:
s='<label><p><em>%s:</em></p></label><cite style="display: block; margin: 1em; font-size: 70%%">' % _('Vous etes')
for i, q in enumerate(schema):
if isinstance(q, tuple):
s += '<p>%s' % q[0]
for j, q in enumerate(q[1:]):
s += '<input id="s%s-%s" value="%s-%s" type="radio" name="RadioGroup">%s</input>' % (i, j, i, j, q)
s += '</p>\n'
s += '<p><input id="s%s" value="%s" type="radio" name="RadioGroup">%s</input></p>' % (i, i, q)
s+='</cite>'
else:
s += '<p><input id="s%s" value="%s" type="radio" name="RadioGroup">%s</input></p>' % (i, i, q)
s+='</cite>'
if get_request().get_method() == 'POST' and not classification:
if add_classification and get_request().get_method() == 'POST' \
and not classification:
form.set_error('username', ' ')
form.add(HtmlWidget, 'erreur', htmltext('<div class="error"><strong>%s</strong></div>') % _('Vous devez choisir une classification'))
elif get_request().get_method() == 'GET':
get_request().form = {}
form.add(HtmlWidget, 'classification', htmltext(s))
if add_classification:
form.add(HtmlWidget, 'classification', htmltext(s))
# domain name: fepem
re_captcha_public_key = '6LcIULoSAAAAAIbUohbBeHCcUeWAt74sjvjK6w5W'
re_captcha_private_key = '6LcIULoSAAAAADfaFk2E9x9G2FgpSsnNIfUV1rlS'