summaryrefslogtreecommitdiff
path: root/skins/larry/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'skins/larry/ui.js')
-rw-r--r--skins/larry/ui.js102
1 files changed, 63 insertions, 39 deletions
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index 5ae3962d0..391e7ab9d 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -1,3 +1,5 @@
+// @license http://creativecommons.org/publicdomain/zero/1.0/legalcode CC0
+
/**
* Roundcube functions for default skin interface
*
@@ -9,7 +11,6 @@
* See http://creativecommons.org/licenses/by-sa/3.0/ for details.
*/
-
function rcube_mail_ui()
{
var env = {};
@@ -41,6 +42,7 @@ function rcube_mail_ui()
this.show_popup = show_popup;
this.add_popup = add_popup;
this.set_searchmod = set_searchmod;
+ this.set_searchscope = set_searchscope;
this.show_uploadform = show_uploadform;
this.show_header_row = show_header_row;
this.hide_header_row = hide_header_row;
@@ -138,7 +140,8 @@ function rcube_mail_ui()
if (rcmail.env.task == 'mail') {
rcmail.addEventListener('menu-open', menu_open)
.addEventListener('menu-save', menu_save)
- .addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list') });
+ .addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) })
+ .addEventListener('responseaftersearch', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list', true) });
var dragmenu = $('#dragmessagemenu');
if (dragmenu.length) {
@@ -253,6 +256,10 @@ function rcube_mail_ui()
new rcube_splitter({ id:'identviewsplitter', p1:'#identitieslist', p2:'#identity-details',
orientation:'v', relative:true, start:266, min:180, size:12 }).init();
}
+ else if (rcmail.env.action == 'responses') {
+ new rcube_splitter({ id:'responseviewsplitter', p1:'#identitieslist', p2:'#identity-details',
+ orientation:'v', relative:true, start:266, min:180, size:12 }).init();
+ }
else if (rcmail.env.action == 'preferences' || !rcmail.env.action) {
new rcube_splitter({ id:'prefviewsplitter', p1:'#sectionslist', p2:'#preferences-box',
orientation:'v', relative:true, start:266, min:180, size:12 }).init();
@@ -329,7 +336,7 @@ function rcube_mail_ui()
});
// set min-width to show all toolbar buttons
- var screen = $('body > div.minwidth');
+ var screen = $('body.minwidth');
if (screen.length) {
screen.css('min-width', $('.toolbar').width() + $('#quicksearchbar').width() + $('#searchfilter').width() + 30);
}
@@ -378,6 +385,7 @@ function rcube_mail_ui()
config = popupconfig[id];
if (obj.is(':visible')
&& target.id != id+'link'
+ && target != obj.get(0) // check if scroll bar was clicked (#1489832)
&& !config.toggle
&& (!config.editable || !target_overlaps(target, obj.get(0)))
&& (!config.sticky || !rcube_mouse_is_over(e, obj.get(0)))
@@ -633,12 +641,6 @@ function rcube_mail_ui()
obj[show?'show':'hide']();
- // hide drop-down elements on buggy browsers
- if (bw.ie6 && config.overlap) {
- $('select').css('visibility', show?'hidden':'inherit');
- $('select', obj).css('visibility', 'inherit');
- }
-
return show;
}
@@ -729,13 +731,12 @@ function rcube_mail_ui()
/**
*
*/
- function switch_view_mode(mode)
+ function switch_view_mode(mode, force)
{
- if (rcmail.env.threading != (mode == 'thread'))
- rcmail.set_list_options(null, undefined, undefined, mode == 'thread' ? 1 : 0);
-
- $('#maillistmode, #mailthreadmode').removeClass('selected');
- $('#mail'+mode+'mode').addClass('selected');
+ if (force || !$('#mail'+mode+'mode').hasClass('disabled')) {
+ $('#maillistmode, #mailthreadmode').removeClass('selected');
+ $('#mail'+mode+'mode').addClass('selected');
+ }
}
@@ -761,11 +762,15 @@ function rcube_mail_ui()
obj = popups['searchmenu'],
list = $('input:checkbox[name="s_mods[]"]', obj),
mbox = rcmail.env.mailbox,
- mods = rcmail.env.search_mods;
+ mods = rcmail.env.search_mods,
+ scope = rcmail.env.search_scope || 'base';
if (rcmail.env.task == 'mail') {
+ if (scope == 'all')
+ mbox = '*';
mods = mods[mbox] ? mods[mbox] : mods['*'];
all = 'text';
+ $('input:radio[name="s_scope"]').prop('checked', false).filter('#s_scope_'+scope).prop('checked', true);
}
else {
all = '*';
@@ -856,7 +861,7 @@ function rcube_mail_ui()
// set checkboxes
$('input[name="list_col[]"]').each(function() {
- $(this).prop('checked', $.inArray(this.value, rcmail.env.coltypes) != -1);
+ $(this).prop('checked', $.inArray(this.value, rcmail.env.listcols) != -1);
});
$dialog.dialog({
@@ -896,7 +901,11 @@ function rcube_mail_ui()
{
var all, m, task = rcmail.env.task,
mods = rcmail.env.search_mods,
- mbox = rcmail.env.mailbox;
+ mbox = rcmail.env.mailbox,
+ scope = $('input[name="s_scope"]:checked').val();
+
+ if (scope == 'all')
+ mbox = '*';
if (!mods)
mods = {};
@@ -918,23 +927,29 @@ function rcube_mail_ui()
m[elem.value] = 1;
// mark all fields
- if (elem.value != all)
- return;
+ if (elem.value == all) {
+ $('input:checkbox[name="s_mods[]"]').map(function() {
+ if (this == elem)
+ return;
+
+ this.checked = true;
+ if (elem.checked) {
+ this.disabled = true;
+ delete m[this.value];
+ }
+ else {
+ this.disabled = false;
+ m[this.value] = 1;
+ }
+ });
+ }
- $('input:checkbox[name="s_mods[]"]').map(function() {
- if (this == elem)
- return;
+ rcmail.set_searchmods(m);
+ }
- this.checked = true;
- if (elem.checked) {
- this.disabled = true;
- delete m[this.value];
- }
- else {
- this.disabled = false;
- m[this.value] = 1;
- }
- });
+ function set_searchscope(elem)
+ {
+ rcmail.set_searchscope(elem.value);
}
function push_contactgroup(p)
@@ -1210,6 +1225,7 @@ function rcube_splitter(p)
{
this.p1 = $(this.p.p1);
this.p2 = $(this.p.p2);
+ this.parent = this.p1.parent();
// check if referenced elements exist, otherwise abort
if (!this.p1.length || !this.p2.length)
@@ -1222,7 +1238,7 @@ function rcube_splitter(p)
.attr('id', this.id)
.attr('unselectable', 'on')
.addClass('splitter ' + (this.horizontal ? 'splitter-h' : 'splitter-v'))
- .appendTo(this.p1.parent())
+ .appendTo(this.parent)
.bind('mousedown', onDragStart);
if (this.horizontal) {
@@ -1261,7 +1277,7 @@ function rcube_splitter(p)
this.p2.css('top', Math.ceil(this.pos + this.halfsize + 2) + 'px');
this.handle.css('top', Math.round(this.pos - this.halfsize + this.offset)+'px');
if (bw.ie) {
- var new_height = parseInt(this.p2.parent().outerHeight(), 10) - parseInt(this.p2.css('top'), 10) - (bw.ie8 ? 2 : 0);
+ var new_height = parseInt(this.parent.outerHeight(), 10) - parseInt(this.p2.css('top'), 10) - (bw.ie8 ? 2 : 0);
this.p2.css('height', (new_height > 0 ? new_height : 0) + 'px');
}
}
@@ -1270,7 +1286,7 @@ function rcube_splitter(p)
this.p2.css('left', Math.ceil(this.pos + this.halfsize) + 'px');
this.handle.css('left', Math.round(this.pos - this.halfsize + this.offset + 3)+'px');
if (bw.ie) {
- var new_width = parseInt(this.p2.parent().outerWidth(), 10) - parseInt(this.p2.css('left'), 10) ;
+ var new_width = parseInt(this.parent.outerWidth(), 10) - parseInt(this.p2.css('left'), 10) ;
this.p2.css('width', (new_width > 0 ? new_width : 0) + 'px');
}
}
@@ -1343,7 +1359,7 @@ function rcube_splitter(p)
var pos = rcube_event.get_mouse_pos(e);
if (me.relative) {
- var parent = me.p1.parent().offset();
+ var parent = me.parent.offset();
pos.x -= parent.left;
pos.y -= parent.top;
}
@@ -1351,12 +1367,18 @@ function rcube_splitter(p)
if (me.horizontal) {
if (((pos.y - me.halfsize) > me.p1pos.top) && ((pos.y + me.halfsize) < (me.p2pos.top + me.p2.outerHeight()))) {
me.pos = Math.max(me.min, pos.y - me.offset);
+ if (me.pos > me.min)
+ me.pos = Math.min(me.pos, me.parent.height() - me.min);
+
me.resize();
}
}
else {
if (((pos.x - me.halfsize) > me.p1pos.left) && ((pos.x + me.halfsize) < (me.p2pos.left + me.p2.outerWidth()))) {
me.pos = Math.max(me.min, pos.x - me.offset);
+ if (me.pos > me.min)
+ me.pos = Math.min(me.pos, me.parent.width() - me.min);
+
me.resize();
}
}
@@ -1395,11 +1417,11 @@ function rcube_splitter(p)
function onResize(e)
{
if (me.horizontal) {
- var new_height = parseInt(me.p2.parent().outerHeight(), 10) - parseInt(me.p2[0].style.top, 10) - (bw.ie8 ? 2 : 0);
+ var new_height = parseInt(me.parent.outerHeight(), 10) - parseInt(me.p2[0].style.top, 10) - (bw.ie8 ? 2 : 0);
me.p2.css('height', (new_height > 0 ? new_height : 0) +'px');
}
else {
- var new_width = parseInt(me.p2.parent().outerWidth(), 10) - parseInt(me.p2[0].style.left, 10);
+ var new_width = parseInt(me.parent.outerWidth(), 10) - parseInt(me.p2[0].style.left, 10);
me.p2.css('width', (new_width > 0 ? new_width : 0) + 'px');
}
};
@@ -1431,3 +1453,5 @@ rcube_splitter.get_instance = function(id)
{
return rcube_splitter._instances[id];
};
+
+// @license-end