From 3cacf941fa30e8c02f3f7aebcc8747036d0d8d20 Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 1 Jun 2011 13:44:51 +0000 Subject: - Add popup with basic fields selection for addressbook search --- skins/default/common.css | 16 +++++++- skins/default/functions.js | 70 ++++++++++++++++++++++++++------ skins/default/mail.css | 15 ------- skins/default/templates/addressbook.html | 16 +++++++- 4 files changed, 88 insertions(+), 29 deletions(-) (limited to 'skins/default') diff --git a/skins/default/common.css b/skins/default/common.css index 675a80cc0..a76220b53 100644 --- a/skins/default/common.css +++ b/skins/default/common.css @@ -617,7 +617,6 @@ table.records-table tr.unfocused td border: none; } - /***** roundcube webmail pre-defined classes *****/ #rcmversion @@ -815,6 +814,21 @@ ul.toolbarmenu li.separator_above padding-top: 2px; } +#searchmenu +{ + width: 160px; +} + +#searchmenu ul.toolbarmenu +{ + margin: 0; +} + +#searchmenu ul.toolbarmenu li +{ + margin: 1px 4px 1px; +} + /***** tabbed interface elements *****/ diff --git a/skins/default/functions.js b/skins/default/functions.js index 9057d97c4..603c703b2 100644 --- a/skins/default/functions.js +++ b/skins/default/functions.js @@ -186,9 +186,25 @@ searchmenu: function(show) .find(':checked').prop('checked', false); if (rcmail.env.search_mods) { - var search_mods = rcmail.env.search_mods[rcmail.env.mailbox] ? rcmail.env.search_mods[rcmail.env.mailbox] : rcmail.env.search_mods['*']; - for (var n in search_mods) - $('#s_mod_' + n).prop('checked', true); + var n, mbox = rcmail.env.mailbox, mods = rcmail.env.search_mods; + + if (rcmail.env.task != 'addressbook') { + mods = mods[mbox] ? mods[mbox] : mods['*']; + + 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'](); @@ -196,16 +212,46 @@ searchmenu: function(show) set_searchmod: function(elem) { - if (!rcmail.env.search_mods) - rcmail.env.search_mods = {}; - - if (!rcmail.env.search_mods[rcmail.env.mailbox]) - rcmail.env.search_mods[rcmail.env.mailbox] = rcube_clone_object(rcmail.env.search_mods['*']); + var task = rcmail.env.task, + mods = rcmail.env.search_mods, + mbox = rcmail.env.mailbox; + + if (!mods) + mods = {}; + + 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; + } + else { //addressbook + if (!elem.checked) + delete(mods[elem.value]); + else + mods[elem.value] = 1; + + // mark all fields + if (elem.value == '*') { + $('input:checkbox[name="s_mods[]"]').map(function() { + if (this == elem) + return; + + if (elem.checked) { + mods[this.value] = 1; + this.checked = true; + this.disabled = true; + } + else { + this.disabled = false; + } + }); + } + } - if (!elem.checked) - delete(rcmail.env.search_mods[rcmail.env.mailbox][elem.value]); - else - rcmail.env.search_mods[rcmail.env.mailbox][elem.value] = elem.value; + rcmail.env.search_mods = mods; }, listmenu: function(show) diff --git a/skins/default/mail.css b/skins/default/mail.css index a96dd48d5..a2400ec0c 100644 --- a/skins/default/mail.css +++ b/skins/default/mail.css @@ -154,21 +154,6 @@ padding-left: 2px; } -#searchmenu -{ - width: 160px; -} - -#searchmenu ul.toolbarmenu -{ - margin: 0; -} - -#searchmenu ul.toolbarmenu li -{ - margin: 1px 4px 1px; -} - #messagemenu li a.active:hover, #markmessagemenu li a.active:hover { diff --git a/skins/default/templates/addressbook.html b/skins/default/templates/addressbook.html index 668b309a7..97cd13c2f 100644 --- a/skins/default/templates/addressbook.html +++ b/skins/default/templates/addressbook.html @@ -29,11 +29,25 @@
- +
+
+ +
+
-- cgit v1.2.3