mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -536,7 +536,7 @@ Webmail.prototype = {
|
||||
return;
|
||||
}
|
||||
$parent = $ul;
|
||||
mailbox = $parent.attr("name") + this.hdelimiter + mailbox;
|
||||
mailbox = $parent.attr("name") + this.options.hdelimiter + mailbox;
|
||||
} else {
|
||||
$parent = $("#mboxes_container").children("ul");
|
||||
}
|
||||
@@ -549,8 +549,8 @@ Webmail.prototype = {
|
||||
* If needed, the mailbox will be moved to its new location.
|
||||
*/
|
||||
rename_mailbox: function(oldname, newname, oldparent, newparent) {
|
||||
var oldpattern = (oldparent) ? oldparent + this.hdelimiter + oldname : oldname;
|
||||
var newpattern = (newparent) ? newparent + this.hdelimiter + newparent : newname;
|
||||
var oldpattern = (oldparent) ? oldparent + this.options.hdelimiter + oldname : oldname;
|
||||
var newpattern = (newparent) ? newparent + this.options.hdelimiter + newname : newname;
|
||||
var $link = $("#folders").find('a[href="' + oldpattern + '"]');
|
||||
|
||||
if (oldname != newname) {
|
||||
@@ -560,14 +560,13 @@ Webmail.prototype = {
|
||||
$link.parent("li").attr("name", newpattern);
|
||||
$link.prepend($i);
|
||||
$link.attr("href", newpattern);
|
||||
this.navobject.setparam("mbox", newname).update(false, true);
|
||||
this.navobject.setparam("mbox", newpattern).update(false, true);
|
||||
}
|
||||
if (oldparent != newparent) {
|
||||
var newlocation = (newparent) ? newparent + this.hdelimiter + newname : newname;
|
||||
this.remove_mbox_from_tree($link.parent("li"));
|
||||
this.add_mailbox_to_tree(newparent, newname);
|
||||
if (this.navobject.getparam("action") == "listmailbox") {
|
||||
this.navobject.setparam("mbox", newlocation).update();
|
||||
this.navobject.setparam("mbox", newpattern).update();
|
||||
} else {
|
||||
this.select_mailbox("INBOX");
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div id="folders2" class="well">
|
||||
<ul class="nav nav-list">
|
||||
<li class="nav-header">{% trans "Parent mailbox" %}</li>
|
||||
{% print_mailboxes mboxes selected withunseen selectonly %}
|
||||
{% print_mailboxes mboxes selected withunseen selectonly hdelimiter %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -119,7 +119,7 @@ def listmailbox_menu(selection, folder, user):
|
||||
))
|
||||
|
||||
@register.simple_tag
|
||||
def print_mailboxes(tree, selected=None, withunseen=False, selectonly=False):
|
||||
def print_mailboxes(tree, selected=None, withunseen=False, selectonly=False, hdelimiter='.'):
|
||||
"""Display a tree of mailboxes and sub-mailboxes
|
||||
|
||||
:param tree: the mailboxes to display
|
||||
@@ -129,7 +129,7 @@ def print_mailboxes(tree, selected=None, withunseen=False, selectonly=False):
|
||||
for mbox in tree:
|
||||
cssclass = ""
|
||||
name = mbox["path"] if mbox.has_key("sub") else mbox["name"]
|
||||
label = separate_mailbox(mbox["name"])[0]
|
||||
label = separate_mailbox(mbox["name"], hdelimiter)[0]
|
||||
if selected == name:
|
||||
cssclass = "active"
|
||||
result += "<li name='%s' class='droppable %s'>\n" % (name, cssclass)
|
||||
@@ -157,7 +157,7 @@ def print_mailboxes(tree, selected=None, withunseen=False, selectonly=False):
|
||||
'selectfolder' if selectonly else 'loadfolder', extra_attrs, iclass, label)
|
||||
if mbox.has_key("sub") and len(mbox["sub"]):
|
||||
result += "<ul name='%s' class='nav nav-list %s'>" % (mbox["path"], ul_state) \
|
||||
+ print_mailboxes(mbox["sub"], selected, withunseen, selectonly) + "</ul>\n"
|
||||
+ print_mailboxes(mbox["sub"], selected, withunseen, selectonly, hdelimiter) + "</ul>\n"
|
||||
result += "</li>\n"
|
||||
return result
|
||||
|
||||
|
||||
@@ -134,7 +134,8 @@ def newfolder(request, tplname="webmail/folder.html"):
|
||||
"action_classes": "submit",
|
||||
"withunseen": False,
|
||||
"selectonly": True,
|
||||
"mboxes": mbc.getmboxes(request.user)}
|
||||
"mboxes": mbc.getmboxes(request.user),
|
||||
"hdelimiter": mbc.hdelimiter}
|
||||
|
||||
if request.method == "POST":
|
||||
form = FolderForm(request.POST)
|
||||
@@ -164,14 +165,15 @@ def editfolder(request, tplname="webmail/folder.html"):
|
||||
"action_label" : _("Update"),
|
||||
"action_classes" : "submit",
|
||||
"withunseen" : False,
|
||||
"selectonly" : True}
|
||||
"selectonly" : True,
|
||||
"hdelimiter": mbc.hdelimiter}
|
||||
|
||||
if request.method == "POST":
|
||||
form = FolderForm(request.POST)
|
||||
if form.is_valid():
|
||||
pf = request.POST.get("parent_folder", None)
|
||||
ctx["selected"] = pf
|
||||
oldname, oldparent = separate_mailbox(request.POST["oldname"])
|
||||
oldname, oldparent = separate_mailbox(request.POST["oldname"], sep=mbc.hdelimiter)
|
||||
res = dict(status="ok", respmsg=_("Mailbox updated"))
|
||||
if form.cleaned_data["name"] != oldname \
|
||||
or (pf != oldparent):
|
||||
@@ -193,7 +195,7 @@ def editfolder(request, tplname="webmail/folder.html"):
|
||||
name = request.GET.get("name", None)
|
||||
if name is None:
|
||||
raise WebmailError(_("Invalid request"))
|
||||
shortname, parent = separate_mailbox(name)
|
||||
shortname, parent = separate_mailbox(name, sep=mbc.hdelimiter)
|
||||
ctx["mboxes"] = mbc.getmboxes(request.user, until_mailbox=parent)
|
||||
ctx["form"] = FolderForm()
|
||||
ctx["form"].fields["oldname"].initial = name
|
||||
|
||||
Reference in New Issue
Block a user