def empty_quarantine(): """Shortcut to use when no content can be displayed.""" content = loader.render_to_string( "modoboa_amavis/empty_quarantine.html", {"message_types": constants.MESSAGE_TYPES}) ctx = getctx("ok", level=2, listing=content) return render_to_json_response(ctx)
def viewmail(request, mail_id): rcpt = request.GET.get("rcpt", None) if rcpt is None: raise BadRequest(_("Invalid request")) if request.user.email == rcpt: SQLconnector().set_msgrcpt_status(rcpt, mail_id, "V") elif hasattr(request.user, "mailbox"): mb = request.user.mailbox if rcpt == mb.full_address or rcpt in mb.alias_addresses: SQLconnector().set_msgrcpt_status(rcpt, mail_id, "V") content = loader.get_template("modoboa_amavis/_email_display.html").render( {"mail_id": mail_id}) menu = viewm_menu(request.user, mail_id, rcpt) ctx = getctx("ok", menu=menu, listing=content) request.session["location"] = "viewmail" return render_to_json_response(ctx)
def viewmail(request, mail_id): rcpt = request.GET["rcpt"] if request.user.email == rcpt: get_connector().set_msgrcpt_status(rcpt, mail_id, 'V') elif request.user.mailbox_set.count(): mb = Mailbox.objects.get(user=request.user) if rcpt == mb.full_address or rcpt in mb.alias_addresses: get_connector().set_msgrcpt_status(rcpt, mail_id, 'V') content = Template(""" <iframe src="{{ url }}" id="mailcontent"></iframe> """).render(Context({"url": reverse("amavis:mailcontent_get", args=[mail_id])})) menu = viewm_menu(request.user, mail_id, rcpt) ctx = getctx("ok", menu=menu, listing=content) request.session['location'] = 'viewmail' return render_to_json_response(ctx)
def viewmail(request, mail_id): rcpt = request.GET.get("rcpt", None) if rcpt is None: raise BadRequest(_("Invalid request")) if request.user.email == rcpt: get_connector().set_msgrcpt_status(rcpt, mail_id, 'V') elif request.user.mailbox_set.count(): mb = Mailbox.objects.get(user=request.user) if rcpt == mb.full_address or rcpt in mb.alias_addresses: get_connector().set_msgrcpt_status(rcpt, mail_id, 'V') content = Template(""" <iframe src="{{ url }}" id="mailcontent"></iframe> """).render(Context({"url": reverse("amavis:mailcontent_get", args=[mail_id])})) menu = viewm_menu(request.user, mail_id, rcpt) ctx = getctx("ok", menu=menu, listing=content) request.session['location'] = 'viewmail' return render_to_json_response(ctx)
def empty_quarantine(): """Shortcut to use when no content can be displayed.""" content = "<div class='alert alert-info'>%s</div>" % _("Empty quarantine") ctx = getctx("ok", level=2, listing=content) return render_to_json_response(ctx)