New checkbox to choose if local copies must be kept. (only for the forward form)

fixed #178
This commit is contained in:
Antoine Nguyen
2011-12-15 10:25:57 +01:00
parent 7d89e85db9
commit 680862c778
3 changed files with 14 additions and 3 deletions
+1
View File
@@ -37,6 +37,7 @@ class ChangePasswordForm(forms.Form):
class ForwardForm(forms.Form):
dest = forms.CharField(label=_("Destination(s)"), widget=forms.Textarea)
keepcopies = forms.BooleanField(label=_("Keep local copies"), required=False)
def parse_dest(self):
self.dests = []
+1 -1
View File
@@ -38,7 +38,7 @@ def options_menu(user):
"img" : static_url("pics/alias.png"),
"label" : _("Forward"),
"class" : "boxed",
"rel" : "{handler:'iframe',size:{x:360,y:320},closeBtn:true}"
"rel" : "{handler:'iframe',size:{x:360,y:350},closeBtn:true}"
}]
entries[0]["menu"] += events.raiseQueryEvent("UserMenuDisplay",
+12 -2
View File
@@ -65,15 +65,25 @@ def setforward(request, tplname="userprefs/setforward.html"):
al.address = mb.address
al.domain = mb.domain
al.enabled = mb.user.is_active
intdests = []
if form.cleaned_data["keepcopies"]:
intdests += [mb]
form.parse_dest()
al.save([], form.dests)
al.save(intdests, form.dests)
return ajax_response(request, respmsg=_("Forward updated"))
except BadDestination, e:
error = str(e)
return ajax_response(request, status="ko", template=tplname, form=form, error=error)
return ajax_response(request, status="ko", template=tplname,
form=form, error=error)
form = ForwardForm()
if al is not None:
form.fields["dest"].initial = al.extmboxes
try:
selfmb = al.mboxes.get(pk=mb.id)
except Mailbox.DoesNotExist:
pass
else:
form.fields["keepcopies"].initial = True
return _render(request, tplname, {
"form" : form
})