summaryrefslogtreecommitdiff
path: root/skins/default
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-11-26 13:10:27 +0000
committeralecpl <alec@alec.pl>2011-11-26 13:10:27 +0000
commit3e5c709fa719e2458df06e515fa4893ae743edda (patch)
tree3029b2f6afa48b2c82ca249100eb9b00f99c0981 /skins/default
parent6a6168619a2d538263eb99247b18154a72e5e298 (diff)
- Fix so TEXT key will remove all HEADER keys in IMAP SEARCH (#1488208)
Diffstat (limited to 'skins/default')
-rw-r--r--skins/default/functions.js86
1 files changed, 45 insertions, 41 deletions
diff --git a/skins/default/functions.js b/skins/default/functions.js
index 6f22bb6c2..5d55447d6 100644
--- a/skins/default/functions.js
+++ b/skins/default/functions.js
@@ -192,29 +192,32 @@ searchmenu: function(show)
if (show && ref) {
var pos = $(ref).offset();
- obj.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)})
- .find(':checked').prop('checked', false);
+ obj.css({left:pos.left, top:(pos.top + ref.offsetHeight + 2)});
if (rcmail.env.search_mods) {
- var n, mbox = rcmail.env.mailbox, mods = rcmail.env.search_mods;
+ var n, all,
+ list = $('input:checkbox[name="s_mods[]"]', obj),
+ mbox = rcmail.env.mailbox,
+ mods = rcmail.env.search_mods;
- if (rcmail.env.task != 'addressbook') {
+ if (rcmail.env.task == 'mail') {
mods = mods[mbox] ? mods[mbox] : mods['*'];
+ all = 'text';
+ }
+ else {
+ all = '*';
+ }
+ if (mods[all])
+ list.map(function() {
+ this.checked = true;
+ this.disabled = this.value != all;
+ });
+ else {
+ list.prop('disabled', false).prop('checked', false);
for (n in mods)
$('#s_mod_' + n).prop('checked', true);
}
- else {
- if (mods['*'])
- $('input:checkbox[name="s_mods[]"]').map(function() {
- this.checked = true;
- this.disabled = this.value != '*';
- });
- else {
- for (n in mods)
- $('#s_mod_' + n).prop('checked', true);
- }
- }
}
}
obj[show?'show':'hide']();
@@ -222,7 +225,7 @@ searchmenu: function(show)
set_searchmod: function(elem)
{
- var task = rcmail.env.task,
+ var all, m, task = rcmail.env.task,
mods = rcmail.env.search_mods,
mbox = rcmail.env.mailbox;
@@ -232,36 +235,37 @@ set_searchmod: function(elem)
if (task == 'mail') {
if (!mods[mbox])
mods[mbox] = rcube_clone_object(mods['*']);
- if (!elem.checked)
- delete(mods[mbox][elem.value]);
- else
- mods[mbox][elem.value] = 1;
+ m = mods[mbox];
+ all = 'text';
}
else { //addressbook
- if (!elem.checked)
- delete(mods[elem.value]);
- else
- mods[elem.value] = 1;
+ m = mods;
+ all = '*';
+ }
+
+ if (!elem.checked)
+ delete(m[elem.value]);
+ else
+ m[elem.value] = 1;
- // mark all fields
- if (elem.value == '*') {
- $('input:checkbox[name="s_mods[]"]').map(function() {
- if (this == elem)
- return;
+ // mark all fields
+ if (elem.value != all)
+ return;
- if (elem.checked) {
- mods[this.value] = 1;
- this.checked = true;
- this.disabled = true;
- }
- else {
- this.disabled = false;
- }
- });
- }
- }
+ $('input:checkbox[name="s_mods[]"]').map(function() {
+ if (this == elem)
+ return;
- rcmail.env.search_mods = mods;
+ this.checked = true;
+ if (elem.checked) {
+ this.disabled = true;
+ delete m[this.value];
+ }
+ else {
+ this.disabled = false;
+ m[this.value] = 1;
+ }
+ });
},
listmenu: function(show)