Quarantine : removed the 'options' menu from the 'viewmail' page.

fixes #233
This commit is contained in:
Antoine Nguyen
2012-04-08 15:30:27 +02:00
parent c0163d8467
commit ead269a839
2 changed files with 2 additions and 25 deletions
@@ -11,18 +11,6 @@ register = template.Library()
@register.simple_tag
def viewm_menu(user, mail_id, rcpt):
options_menu = [
{"name" : "viewmode",
"label" : _("View as plain text"),
"url" : "?mode=plain&links=0"},
{"name" : "viewmode",
"label" : _("View as HTML"),
"url" : "?mode=html&links=0"},
{"name" : "viewmode",
"label" : _("Activate links"),
"url" : "?mode=html&links=1"}
]
entries = [
{"name" : "back",
"img" : "icon-arrow-left",
@@ -45,10 +33,6 @@ def viewm_menu(user, mail_id, rcpt):
"url" : reverse(amavis_quarantine.views.delete, args=[mail_id]) \
+ ("?rcpt=%s" % rcpt if rcpt else ""),
"label" : _("Delete")},
{"name" : "options",
"label" : _("Options"),
"img" : "icon-cog",
"menu" : options_menu}
]
return render_to_string('common/buttons_list.html',
+2 -9
View File
@@ -134,9 +134,7 @@ def getmailcontent(request, mail_id):
for qm in qmails:
content += qm.mail_text
msg = email.message_from_string(content)
links = request.GET.has_key("links") and request.GET["links"] or "0"
mode = request.GET.has_key("mode") and request.GET["mode"] or "plain"
mail = SQLemail(msg, mformat=mode, links=links)
mail = SQLemail(msg, mformat="plain", links="0")
return _render(request, "common/viewmail.html", {
"headers" : mail.render_headers(),
"mailbody" : mail.body
@@ -166,15 +164,10 @@ def viewmail(request, mail_id):
msgrcpt = Msgrcpt.objects.get(mail=mail_id, rid__email=mb.full_address)
msgrcpt.rs = 'V'
msgrcpt.save()
args = []
for kw in ["mode", "links"]:
if request.GET.has_key(kw):
args += ["%s=%s" % (kw, request.GET[kw])]
content = Template("""
<iframe src="{{ url }}" id="mailcontent"></iframe>
""").render(Context({"url" : reverse(getmailcontent, args=[mail_id]) \
+ "?%s" % "&".join(args)}))
""").render(Context({"url" : reverse(getmailcontent, args=[mail_id])}))
menu = viewm_menu(request.user, mail_id, rcpt)
ctx = getctx("ok", menu=menu, listing=content)
return HttpResponse(simplejson.dumps(ctx), mimetype="application/json")