mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -28,6 +28,9 @@ Admin.prototype = {
|
||||
}
|
||||
}
|
||||
}, this));
|
||||
if (this.navobj.getparam("searchquery") != undefined) {
|
||||
$("#searchquery").attr("value", this.navobj.getparam("searchquery"));
|
||||
}
|
||||
|
||||
this.listen();
|
||||
},
|
||||
@@ -51,7 +54,13 @@ Admin.prototype = {
|
||||
|
||||
do_search: function(e) {
|
||||
e.preventDefault();
|
||||
this.navobj.setparam("searchquery", $("#searchquery").attr("value")).update();
|
||||
var squery = $("#searchquery").attr("value");
|
||||
if (squery != "") {
|
||||
this.navobj.setparam("searchquery", squery);
|
||||
} else {
|
||||
this.navobj.delparam("searchquery");
|
||||
}
|
||||
this.navobj.update();
|
||||
},
|
||||
|
||||
getpage_loader: function(e) {
|
||||
@@ -157,6 +166,19 @@ var Identities = function(options) {
|
||||
};
|
||||
|
||||
Identities.prototype = {
|
||||
initialize: function(options) {
|
||||
Admin.prototype.initialize.call(this, options);
|
||||
|
||||
if (this.navobj.getparam("idtfilter") != undefined) {
|
||||
var text = this.navobj.getparam("idtfilter");
|
||||
$("#searchform").parent().after(this.make_tag(text, "idt"));
|
||||
}
|
||||
if (this.navobj.getparam("grpfilter") != undefined) {
|
||||
var text = this.navobj.getparam("grpfilter");
|
||||
$("#searchform").parent().after(this.make_tag(text, "grp"));
|
||||
}
|
||||
},
|
||||
|
||||
list_cb: function(data) {
|
||||
Admin.prototype.list_cb.call(this, data);
|
||||
|
||||
@@ -181,19 +203,45 @@ Identities.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
make_tag: function(text, type) {
|
||||
var $tag = $("<a />", {"name": type, "class" : "btn btn-mini", "html": text});
|
||||
var $i = $("<i />", {"class" : "icon-remove"}).prependTo($tag);
|
||||
|
||||
$tag.click($.proxy(this.remove_tag, this));
|
||||
return $tag;
|
||||
},
|
||||
|
||||
remove_tag: function(e) {
|
||||
var $tag = $(e.target);
|
||||
|
||||
if ($tag.is("i")) {
|
||||
$tag = $tag.parent();
|
||||
}
|
||||
e.preventDefault();
|
||||
this.navobj.delparam($tag.attr("name") + "filter").update();
|
||||
$tag.remove();
|
||||
},
|
||||
|
||||
filter_by_tag: function(e) {
|
||||
var $link = $(e.target);
|
||||
e.preventDefault();
|
||||
|
||||
if ($link.hasClass("idt")) {
|
||||
this.navobj.setparam("idtfilter", $link.attr("name")).update();
|
||||
if (this.navobj.getparam("idtfilter") == undefined && $link.hasClass("idt")) {
|
||||
var text = $link.attr("name");
|
||||
this.navobj.setparam("idtfilter", text).update();
|
||||
$("#searchform").parent().after(this.make_tag(text, "idt"));
|
||||
return;
|
||||
}
|
||||
if ($link.hasClass("grp")) {
|
||||
if (this.navobj.getparam("grpfilter") == undefined && $link.hasClass("grp")) {
|
||||
var text = $link.attr("name");
|
||||
this.navobj
|
||||
.setparam("idtfilter", "account")
|
||||
.setparam("grpfilter", $link.attr("name"))
|
||||
.setparam("grpfilter", text)
|
||||
.update();
|
||||
if ($("a[name=idt]").length == 0) {
|
||||
$("#searchform").parent().after(this.make_tag("account", "idt"));
|
||||
}
|
||||
$("#searchform").parent().after(this.make_tag(text, "grp"));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
{{ block.super }}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
admin = new Domains({
|
||||
squery: "{{ squery }}"
|
||||
});
|
||||
admin = new Domains();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -24,9 +24,7 @@ function get_mboxes_list(container) {
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
admin = new Identities({
|
||||
squery: "{{ squery }}"
|
||||
});
|
||||
admin = new Identities();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -10,6 +10,7 @@ var admin;
|
||||
<ul class="nav nav-list">
|
||||
<li class="nav-header">{% trans "Filter" %}</li>
|
||||
<li>{% include "admin/searchform.html" %}</li>
|
||||
<li id="taglist"></li>
|
||||
<li class="nav-header">{% trans "Actions" %}</li>
|
||||
{% block actions %}{% endblock %}
|
||||
{% get_extra_admin_content user "leftcol" selection %}
|
||||
|
||||
@@ -35,7 +35,7 @@ def _domains(request):
|
||||
q = Q(name__contains=squery)
|
||||
q |= Q(domainalias__name__contains=squery)
|
||||
domains = domains.filter(q).distinct()
|
||||
return render_listing(request, "domains", objects=domains, squery=squery)
|
||||
return render_listing(request, "domains", objects=domains)
|
||||
|
||||
@login_required
|
||||
def domains(request, tplname="admin/domains.html"):
|
||||
|
||||
@@ -85,7 +85,7 @@ History.prototype = {
|
||||
var params = splits[1].split('&');
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var tmp = params[i].split('=');
|
||||
this.setparam(tmp[0], tmp[1]);
|
||||
this.setparam(tmp[0], tmp[1], false);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
@@ -144,8 +144,12 @@ History.prototype = {
|
||||
this.params[def[0]] = def[1];
|
||||
},
|
||||
|
||||
setparam: function(name, value) {
|
||||
this.params[name] = encodeURIComponent(value);
|
||||
setparam: function(name, value, encode) {
|
||||
if (encode == undefined || encode) {
|
||||
this.params[name] = encodeURIComponent(value);
|
||||
} else {
|
||||
this.params[name] = value;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
@@ -158,7 +162,7 @@ History.prototype = {
|
||||
if (this.params[name] === undefined) {
|
||||
return (defvalue != undefined) ? defvalue : undefined;
|
||||
}
|
||||
return this.params[name];
|
||||
return decodeURIComponent(this.params[name]);
|
||||
},
|
||||
|
||||
baseurl: function(value, noreset) {
|
||||
|
||||
Reference in New Issue
Block a user