mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -96,13 +96,16 @@ def menu(target, user):
|
||||
def create_user_record(user, mailbox):
|
||||
from models import Users
|
||||
|
||||
u = Users()
|
||||
u.email = mailbox.full_address
|
||||
u.fullname = mailbox.user.fullname
|
||||
u.local = "1"
|
||||
u.priority = 7
|
||||
u.policy_id = 1
|
||||
u.save()
|
||||
try:
|
||||
Users.objects.get(email=mailbox.full_address)
|
||||
except Users.DoesNotExist:
|
||||
u = Users()
|
||||
u.email = mailbox.full_address
|
||||
u.fullname = mailbox.user.fullname
|
||||
u.local = "1"
|
||||
u.priority = 7
|
||||
u.policy_id = 1
|
||||
u.save()
|
||||
|
||||
@events.observe("ModifyMailbox")
|
||||
def modify_user_record(mailbox, oldmailbox):
|
||||
|
||||
@@ -71,6 +71,8 @@ Webmail.prototype = {
|
||||
$.proxy(this.compose_loader, this));
|
||||
$(document).on("click", "a[name*=mark-]",
|
||||
$.proxy(this.send_mark_request, this));
|
||||
$(document).on("click", "a[name=compress]",
|
||||
$.proxy(this.compress, this));
|
||||
$(document).on("click", "a[name=empty]",
|
||||
$.proxy(this.empty, this));
|
||||
$(document).on("click", "#bottom-bar a",
|
||||
@@ -167,7 +169,7 @@ Webmail.prototype = {
|
||||
|
||||
go_back_to_listing: function() {
|
||||
var curmb = this.get_current_mailbox();
|
||||
this.navobject.delparam("mailid").delparam("mbox")
|
||||
this.navobject.reset()
|
||||
.setparams({action: "listmailbox", mbox: curmb});
|
||||
this.restore_nav_params();
|
||||
this.navobject.update();
|
||||
@@ -189,10 +191,16 @@ Webmail.prototype = {
|
||||
},
|
||||
|
||||
page_update: function(response) {
|
||||
/*if (this.gspinner) {
|
||||
this.gspinner.hide();
|
||||
}*/
|
||||
var curmb = this.get_current_mailbox();
|
||||
|
||||
$(window).unbind("resize");
|
||||
this.enable_mb_actions();
|
||||
for (var idx in this.options.ro_mboxes) {
|
||||
if (curmb == this.options.ro_mboxes[idx]) {
|
||||
this.enable_mb_actions(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (response.menu != undefined) {
|
||||
$("#menubar").html(response.menu);
|
||||
$("#searchfield").searchbar({navobj: this.navobject});
|
||||
@@ -622,7 +630,9 @@ Webmail.prototype = {
|
||||
$("body").notify("error", data.respmsg);
|
||||
return;
|
||||
}
|
||||
cb.apply(this, [data]);
|
||||
if (cb != undefined) {
|
||||
cb.apply(this, [data]);
|
||||
}
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
@@ -637,8 +647,14 @@ Webmail.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
delete_message: function(e) {
|
||||
compress: function(e) {
|
||||
e.preventDefault();
|
||||
var $link = $(e.target);
|
||||
this.send_mb_action($link.attr("href"));
|
||||
},
|
||||
|
||||
delete_message: function(e) {
|
||||
var $link = get_target(e, "a");
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: $link.attr("href"),
|
||||
@@ -758,13 +774,6 @@ Webmail.prototype = {
|
||||
if (!$('li[name="' + curmb + '"]').hasClass("active")) {
|
||||
this.load_and_select_mailbox(curmb);
|
||||
}
|
||||
this.enable_mb_actions();
|
||||
for (var idx in this.options.ro_mboxes) {
|
||||
if (curmb == this.options.ro_mboxes[idx]) {
|
||||
this.enable_mb_actions(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.page_update(resp);
|
||||
$("#emails").htmltable();
|
||||
this.htmltable = $("#emails").data("htmltable");
|
||||
|
||||
@@ -93,7 +93,7 @@ def listmailbox_menu(selection, folder, user):
|
||||
"label" : _("Actions"),
|
||||
"class" : "btn",
|
||||
"menu" : [
|
||||
{"name" : "fdaction",
|
||||
{"name" : "compress",
|
||||
"label" : _("Compress folder"),
|
||||
"url" : "compact/%s/" % folder}
|
||||
]
|
||||
|
||||
@@ -55,7 +55,7 @@ def move(request):
|
||||
raise WebmailError(_("Invalid request"))
|
||||
mbc = get_imapconnector(request)
|
||||
mbc.move(request.GET["msgset"], request.session["mbox"], request.GET["to"])
|
||||
resp = listmailbox(request, request.session["mbox"])
|
||||
resp = listmailbox(request, request.session["mbox"], update_session=False)
|
||||
resp.update(status="ok")
|
||||
return ajax_simple_response(resp)
|
||||
|
||||
@@ -297,7 +297,7 @@ def set_nav_params(request):
|
||||
elif request.session["navparams"].has_key(p):
|
||||
del request.session["navparams"][p]
|
||||
|
||||
def listmailbox(request, defmailbox="INBOX"):
|
||||
def listmailbox(request, defmailbox="INBOX", update_session=True):
|
||||
"""Mailbox content listing
|
||||
|
||||
Return a list of messages contained in the specified mailbox. The
|
||||
@@ -309,13 +309,15 @@ def listmailbox(request, defmailbox="INBOX"):
|
||||
:return: a dictionnary
|
||||
"""
|
||||
mbox = request.GET.get("mbox", defmailbox)
|
||||
set_nav_params(request)
|
||||
if update_session:
|
||||
set_nav_params(request)
|
||||
request.session["mbox"] = mbox
|
||||
|
||||
lst = ImapListing(request.user, request.session["password"],
|
||||
baseurl="?action=listmailbox&mbox=%s&" % mbox,
|
||||
folder=mbox,
|
||||
elems_per_page=int(parameters.get_user(request.user, "MESSAGES_PER_PAGE")),
|
||||
**request.session["navparams"])
|
||||
request.session["mbox"] = mbox
|
||||
return lst.render(request, request.session["pageid"])
|
||||
|
||||
def render_compose(request, form, posturl, email=None, insert_signature=False):
|
||||
|
||||
Reference in New Issue
Block a user