Commit 38443352 authored by stef's avatar stef

[enh] modded form and fixed wrong captcha redirect, also some i18n - the Bram commit ;)

parent ca0abd10
......@@ -47,7 +47,7 @@ def activate(request):
try:
v=Violation.objects.get(activationid=request.GET.get('key','asdf'))
except:
return HttpResponse("Thank you, this has been already activated")
return HttpResponse(_("Thank you, this has been already activated"))
if v:
actid = hashlib.sha1(''.join([chr(randint(32, 122)) for x in range(12)])).hexdigest()
to=[x.email for x in User.objects.filter(groups__name='moderator')]
......@@ -106,7 +106,7 @@ def confirm(request, id, name=None):
def sendverifymail(service,to):
actid = hashlib.sha1(''.join([chr(randint(32, 122)) for x in range(12)])).hexdigest()
msg = MIMEText(_("Thank you for submitting a new report. To finalize your submission please confirm using your validation key.\nYour verification key is %s/%s%s\nYour report will be listed after we assured it is valid.") % (settings.ROOT_URL or 'http://localhost:8001/', service, actid))
msg = MIMEText(_("Thank you for submitting a new report. To finalize your submission please confirm using your validation key.\nYour verification key is %s/%s%s\nPlease note that reports are moderated, it might take some time before your report appears online. Thank you for your patience.") % (settings.ROOT_URL or 'http://localhost:8001/', service, actid))
msg['Subject'] = _('NNMon submission verification')
msg['From'] = 'nnmon@nnmon.lqdn.fr'
msg['To'] = to
......@@ -160,7 +160,7 @@ def add(request):
form = AddViolation()
return render_to_response(
'add.html',
'index.html',
{ 'form': form, },
context_instance=RequestContext(request))
......
......@@ -2,6 +2,15 @@ function empty(node) {
if(node.text().trim()) return false;
return true;
}
function check1st4() {
if($('#id_country').val() && $('#id_operator').val() && $('#id_contract').val() && $('#id_media').val() ) {
$('#id_comment').parent().parent().show();
$('#id_email').parent().parent().show();
$('#id_nick').parent().parent().show();
$('#id_attachments0').parent().parent().show();
$("#save_button").attr('disabled','true').show();
}
}
function init_form() {
$('.help_text').hide();
$(".fieldWrapper").focusin(function(event) {if(!empty($(this).find('.help_text'))) $(this).find('.help_text').show();});
......@@ -18,37 +27,34 @@ function init_form() {
$('#id_country').change(function() {
var country=$(this).attr('value');
if(country.length>0) {
$('#id_operator').parent().parent().show();
$.getJSON('/ajax/'+country, function(data) {
$("#id_operator").autocomplete(data, { minChars: 0, autoFill: true });
$('#id_operator').focus();
});
}
check1st4();
});
$('#id_operator').change(function() {
var country=$('#id_country').attr('value');
var operator=$(this).val();
if(operator.length>0) {
$('#id_contract').parent().parent().show();
$.getJSON('/ajax/'+country+'/'+operator, function(data) {
$("#id_contract").autocomplete(data,{ minChars: 0 });
$('#id_contract').focus();
});
}
check1st4();
});
$('#id_contract').change(function() {
if($(this).val().length>0) {
$('#id_media').parent().parent().show();
$('#id_comment').parent().parent().show();
$('#id_email').parent().parent().show();
$('#id_nick').parent().parent().show();
$('#id_attachments0').parent().parent().show();
}
check1st4();
});
$('#id_media').change(function() {
check1st4();
});
$('#id_email').change(function() {
if($(this).val().length>0) {
$('#id_captcha_0').parent().parent().show();
$('#save_button').show();
$('#save_button').removeAttr('disabled');
$("#show_optionals").show();
}
});
......
......@@ -33,11 +33,16 @@ $(document).ready(function(){
{% if not form.is_bound %}
$(".fieldWrapper").hide();
$("#id_country").parent().parent().show();
$("#id_operator").parent().parent().show();
$("#id_contract").parent().parent().show();
$("#id_media").parent().parent().show();
$("#save_button").hide();
{% else %}
if($("#id_contractual").attr('checked')==false) {
$("#id_contract_excerpt").parent().parent().hide();
}
$("#show_optionals").show();
$("#optional .fieldWrapper").hide();
{% endif %}
$("#sortedlist").tablesorter();
$('.confirm_form').submit(function() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment