- Fixed listmenu (added workaround for http://bugs.jquery.com/ticket/9284)

- Small code improvements and use preferred .prop() instead of .attr() for some properties
release-0.6
alecpl 14 years ago
parent e2f185e1b3
commit 491133a0b2

@ -394,7 +394,7 @@ function rcube_webmail()
// display 'loading' message on form submit, lock submit button
$('form').submit(function () {
$('input[type=submit]', this).attr('disabled', true);
$('input[type=submit]', this).prop('disabled', true);
rcmail.display_message('', 'loading');
});
@ -4018,7 +4018,7 @@ function rcube_webmail()
var elem = $('#ff_'+col);
if (elem.length) {
elem.show().focus();
$(menu).children('option[value="'+col+'"]').attr('disabled', true);
$(menu).children('option[value="'+col+'"]').prop('disabled', true);
}
else {
var lastelem = $('.ff_'+col),
@ -4042,22 +4042,18 @@ function rcube_webmail()
if (colprop.type == 'text' || colprop.type == 'date') {
input = $('<input>')
.addClass('ff_'+col)
.attr('type', 'text')
.attr('name', '_'+col+name_suffix)
.attr('size', colprop.size)
.attr({type: 'text', name: '_'+col+name_suffix, size: colprop.size})
.appendTo(cell);
this.init_edit_field(col, input);
}
else if (colprop.type == 'composite') {
var childcol, cp, first;
for (var childcol in colprop.childs) {
for (childcol in colprop.childs) {
cp = colprop.childs[childcol];
input = $('<input>')
.addClass('ff_'+childcol)
.attr('type', 'text')
.attr('name', '_'+childcol+name_suffix)
.attr('size', cp.size)
.attr({type: 'text', name: '_'+childcol+name_suffix, size: cp.size})
.appendTo(cell);
cell.append(" ");
this.init_edit_field(childcol, input);
@ -4080,8 +4076,7 @@ function rcube_webmail()
if (input) {
var delbutton = $('<a href="#del"></a>')
.addClass('contactfieldbutton deletebutton')
.attr('title', this.get_label('delete'))
.attr('rel', col)
.attr({title: this.get_label('delete'), rel: col})
.html(this.env.delbutton)
.click(function(){ ref.delete_edit_field(this); return false })
.appendTo(cell);
@ -4092,7 +4087,7 @@ function rcube_webmail()
// disable option if limit reached
if (!colprop.count) colprop.count = 0;
if (++colprop.count == colprop.limit && colprop.limit)
$(menu).children('option[value="'+col+'"]').attr('disabled', true);
$(menu).children('option[value="'+col+'"]').prop('disabled', true);
}
}
}
@ -4119,14 +4114,13 @@ function rcube_webmail()
if (addmenu.length) {
var option = addmenu.children('option[value="'+col+'"]');
if (option.length)
option.attr('disabled', false);
option.prop('disabled', false);
else
option = $('<option>').attr('value', col).html(colprop.label).appendTo(addmenu);
addmenu.show();
}
};
this.upload_contact_photo = function(form)
{
if (form && form.elements._photo.value) {
@ -4392,7 +4386,7 @@ function rcube_webmail()
row.cells[1].innerHTML = '*';
// update subscription checkbox
$('input[name="_subscribed[]"]', row).val(name).attr('checked', true);
$('input[name="_subscribed[]"]', row).val(name).prop('checked', true);
}
this.init_subscription_list();
@ -4501,7 +4495,7 @@ function rcube_webmail()
{
var id = this.get_folder_row_id(folder);
if (id)
$('input[name="_subscribed[]"]', $('#'+id)).attr('disabled', true);
$('input[name="_subscribed[]"]', $('#'+id)).prop('disabled', true);
};
this.folder_size = function(folder)

@ -176,12 +176,12 @@ searchmenu: function(show)
if (show && ref) {
var pos = $(ref).offset();
obj.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)})
.find(':checked').attr('checked', false);
.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).attr('checked', true);
$('#s_mod_' + n).prop('checked', true);
}
}
obj[show?'show':'hide']();
@ -219,21 +219,20 @@ listmenu: function(show)
obj.css({ left:pos.left, top:(pos.top + ref.offsetHeight + 2)});
// set form values
$('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').attr('checked', 1);
$('input[name="sort_ord"][value="DESC"]').attr('checked', rcmail.env.sort_order=='DESC' ? 1 : 0);
$('input[name="sort_ord"][value="ASC"]').attr('checked', rcmail.env.sort_order=='DESC' ? 0 : 1);
$('input[name="view"][value="thread"]').attr('checked', rcmail.env.threading ? 1 : 0);
$('input[name="view"][value="list"]').attr('checked', rcmail.env.threading ? 0 : 1);
$('input[name="sort_col"][value="'+rcmail.env.sort_col+'"]').prop('checked', true);
$('input[name="sort_ord"][value="DESC"]').prop('checked', rcmail.env.sort_order == 'DESC');
$('input[name="sort_ord"][value="ASC"]').prop('checked', rcmail.env.sort_order != 'DESC');
$('input[name="view"][value="thread"]').prop('checked', rcmail.env.threading ? true : false);
$('input[name="view"][value="list"]').prop('checked', rcmail.env.threading ? false : true);
// list columns
var cols = $('input[name="list_col[]"]');
var found, cols = $('input[name="list_col[]"]');
for (var i=0; i<cols.length; i++) {
var found = 0;
if (cols[i].value != 'from')
found = jQuery.inArray(cols[i].value, rcmail.env.coltypes) != -1;
else
found = (jQuery.inArray('from', rcmail.env.coltypes) != -1
|| jQuery.inArray('to', rcmail.env.coltypes) != -1);
$(cols[i]).attr('checked',found ? 1 : 0);
$(cols[i]).prop('checked', found);
}
}

Loading…
Cancel
Save