Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/skins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2021-04-04 14:41:39 +0300
committerAleksander Machniak <alec@alec.pl>2021-04-04 14:41:39 +0300
commita399a7fa8ebc8f5046ce79a0525d33e3b94fa7b4 (patch)
tree6bc5b15506fc65a15f754a33e9135129a13bb3e2 /skins
parent352a31ec071e9b1775719ab8132b8b73d7fc8c6d (diff)
Fix invalid search fields after search scope change (#6919)
- Don't start search on initerval and scope search - Use currently selected criteria instead of the criteria defined in search_mods[*]
Diffstat (limited to 'skins')
-rw-r--r--skins/classic/functions.js13
-rw-r--r--skins/elastic/ui.js53
-rw-r--r--skins/larry/templates/mail.html6
-rw-r--r--skins/larry/ui.js31
4 files changed, 27 insertions, 76 deletions
diff --git a/skins/classic/functions.js b/skins/classic/functions.js
index a6a5b0ae3..9cce6c33d 100644
--- a/skins/classic/functions.js
+++ b/skins/classic/functions.js
@@ -254,16 +254,10 @@ searchmenu: function(show)
set_searchmod: function(elem)
{
var all, m, task = rcmail.env.task,
- mods = rcmail.env.search_mods,
+ mods = rcmail.env.search_mods || {},
mbox = rcmail.env.mailbox,
scope = $('input[name="s_scope"]:checked').val();
- if (scope == 'all')
- mbox = '*';
-
- if (!mods)
- mods = {};
-
if (task == 'mail') {
if (!mods[mbox])
mods[mbox] = rcube_clone_object(mods['*']);
@@ -282,10 +276,7 @@ set_searchmod: function(elem)
// mark all fields
if (elem.value == all) {
- $('input:checkbox[name="s_mods[]"]').map(function() {
- if (this == elem)
- return;
-
+ $('input:checkbox[name="s_mods[]"]').not(elem).map(function() {
this.checked = true;
if (elem.checked) {
this.disabled = true;
diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js
index 9afe388d7..2e2deee23 100644
--- a/skins/elastic/ui.js
+++ b/skins/elastic/ui.js
@@ -2790,9 +2790,10 @@ function rcube_elastic_ui()
*/
function searchmenu(obj)
{
- var n, all,
+ var n, all = '*',
list = $('input[name="s_mods[]"]', obj),
scope_select = $('#s_scope', obj),
+ interval_select = $('#s_interval', obj),
mbox = rcmail.env.mailbox,
mods = rcmail.env.search_mods,
scope = rcmail.env.search_scope || 'base';
@@ -2801,22 +2802,20 @@ function rcube_elastic_ui()
$(obj).data('initialized', true);
if (list.length) {
list.on('change', function() { set_searchmod(obj, this); });
- rcmail.addEventListener('beforesearch', function() { set_searchmod(obj); });
+
+ rcmail.addEventListener('beforesearch', function() {
+ rcmail.env.search_scope = scope_select.val();
+ rcmail.env.search_interval = interval_select.val();
+ });
}
}
- if (rcmail.env.search_mods) {
- if (rcmail.env.task == 'mail') {
- if (scope == 'all') {
- mbox = '*';
- }
+ scope_select.val(scope);
- mods = mods[mbox] ? mods[mbox] : mods['*'];
+ if (mods) {
+ if (rcmail.env.task == 'mail') {
+ mods = mods[mbox] || mods['*'];
all = 'text';
- scope_select.val(scope);
- }
- else {
- all = '*';
}
if (mods[all]) {
@@ -2837,18 +2836,8 @@ function rcube_elastic_ui()
function set_searchmod(menu, elem)
{
var all, m, task = rcmail.env.task,
- mods = rcmail.env.search_mods,
- mbox = rcmail.env.mailbox,
- scope = $('#s_scope', menu).val(),
- interval = $('#s_interval', menu).val();
-
- if (scope == 'all') {
- mbox = '*';
- }
-
- if (!mods) {
- mods = {};
- }
+ mods = rcmail.env.search_mods || {},
+ mbox = rcmail.env.mailbox;
if (task == 'mail') {
if (!mods[mbox]) {
@@ -2856,19 +2845,13 @@ function rcube_elastic_ui()
}
m = mods[mbox];
all = 'text';
-
- rcmail.env.search_scope = scope;
- rcmail.env.search_interval = interval;
}
- else { //addressbook
+ else {
+ // addressbook
m = mods;
all = '*';
}
- if (!elem) {
- return;
- }
-
if (!elem.checked) {
delete(m[elem.value]);
}
@@ -2878,11 +2861,7 @@ function rcube_elastic_ui()
// mark all fields
if (elem.value == all) {
- $('input[name="s_mods[]"]', menu).map(function() {
- if (this == elem) {
- return;
- }
-
+ $('input[name="s_mods[]"]', menu).not(elem).map(function() {
this.checked = true;
if (elem.checked) {
diff --git a/skins/larry/templates/mail.html b/skins/larry/templates/mail.html
index 5ef0bc211..b484668f9 100644
--- a/skins/larry/templates/mail.html
+++ b/skins/larry/templates/mail.html
@@ -54,9 +54,9 @@
<li role="separator" class="separator"><label><roundcube:label name="date" /></label></li>
<li role="menuitem"><roundcube:object name="searchinterval" id="s_interval" onchange="rcmail.set_searchinterval($(this).val())" /></li>
<li role="separator" class="separator"><label><roundcube:label name="searchscope" /></label></li>
- <li role="menuitem"><label><input type="radio" name="s_scope" value="base" id="s_scope_base" onclick="UI.set_searchscope(this)" /> <span><roundcube:label name="currentfolder" /></span></label></li>
- <li role="menuitem"><label><input type="radio" name="s_scope" value="sub" id="s_scope_sub" onclick="UI.set_searchscope(this)" /> <span><roundcube:label name="subfolders" /></span></label></li>
- <li role="menuitem"><label><input type="radio" name="s_scope" value="all" id="s_scope_all" onclick="UI.set_searchscope(this)" /> <span><roundcube:label name="allfolders" /></span></label></li>
+ <li role="menuitem"><label><input type="radio" name="s_scope" value="base" id="s_scope_base" onclick="rcmail.set_searchscope(this.value)" /> <span><roundcube:label name="currentfolder" /></span></label></li>
+ <li role="menuitem"><label><input type="radio" name="s_scope" value="sub" id="s_scope_sub" onclick="rcmail.set_searchscope(this.value)" /> <span><roundcube:label name="subfolders" /></span></label></li>
+ <li role="menuitem"><label><input type="radio" name="s_scope" value="all" id="s_scope_all" onclick="rcmail.set_searchscope(this.value)" /> <span><roundcube:label name="allfolders" /></span></label></li>
</ul>
<div class="buttons"><a class="button" href="#" onclick="if (rcmail.command('search')) UI.show_popup('searchmenu',false)"><roundcube:label name="search" /></a></div>
</div>
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index 9de92b5af..2ae662580 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -42,7 +42,6 @@ function rcube_mail_ui()
this.add_popup = add_popup;
this.import_dialog = import_dialog;
this.set_searchmod = set_searchmod;
- this.set_searchscope = set_searchscope;
this.show_header_row = show_header_row;
this.hide_header_row = hide_header_row;
this.update_quota = update_quota;
@@ -816,7 +815,7 @@ function rcube_mail_ui()
function searchmenu(show)
{
if (show && rcmail.env.search_mods) {
- var n, all,
+ var n, all = '*',
obj = popups['searchmenu'],
list = $('input:checkbox[name="s_mods[]"]', obj),
mbox = rcmail.env.mailbox,
@@ -824,21 +823,17 @@ function rcube_mail_ui()
scope = rcmail.env.search_scope || 'base';
if (rcmail.env.task == 'mail') {
- if (scope == 'all')
- mbox = '*';
- mods = mods[mbox] ? mods[mbox] : mods['*'];
+ mods = mods[mbox] || mods['*'];
all = 'text';
$('input:radio[name="s_scope"]').prop('checked', false).filter('#s_scope_'+scope).prop('checked', true);
}
- else {
- all = '*';
- }
- if (mods[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)
@@ -1000,16 +995,10 @@ function rcube_mail_ui()
function set_searchmod(elem)
{
var all, m, task = rcmail.env.task,
- mods = rcmail.env.search_mods,
+ mods = rcmail.env.search_mods || {},
mbox = rcmail.env.mailbox,
scope = $('input[name="s_scope"]:checked').val();
- if (scope == 'all')
- mbox = '*';
-
- if (!mods)
- mods = {};
-
if (task == 'mail') {
if (!mods[mbox])
mods[mbox] = rcube_clone_object(mods['*']);
@@ -1028,10 +1017,7 @@ function rcube_mail_ui()
// mark all fields
if (elem.value == all) {
- $('input:checkbox[name="s_mods[]"]').map(function() {
- if (this == elem)
- return;
-
+ $('input:checkbox[name="s_mods[]"]').not(elem).map(function() {
this.checked = true;
if (elem.checked) {
this.disabled = true;
@@ -1047,11 +1033,6 @@ function rcube_mail_ui()
rcmail.set_searchmods(m);
}
- function set_searchscope(elem)
- {
- rcmail.set_searchscope(elem.value);
- }
-
function push_contactgroup(p)
{
// lets the contacts list swipe to the left, nice!