Adapt to regressions in jQuery 1.8 and jQuery UI 1.9

This commit is contained in:
Thomas Bruederli 2012-11-07 18:38:23 +01:00
parent f88e216845
commit 1b1205ba29
2 changed files with 36 additions and 15 deletions

View file

@ -249,7 +249,7 @@ function rcube_calendar_ui(settings)
// event details dialog (show only) // event details dialog (show only)
var event_show_dialog = function(event) var event_show_dialog = function(event)
{ {
var $dialog = $("#eventshow").dialog('close').removeClass().addClass('uidialog'); var $dialog = $("#eventshow").removeClass().addClass('uidialog');
var calendar = event.calendar && me.calendars[event.calendar] ? me.calendars[event.calendar] : { editable:false }; var calendar = event.calendar && me.calendars[event.calendar] ? me.calendars[event.calendar] : { editable:false };
me.selected_event = event; me.selected_event = event;
@ -382,7 +382,7 @@ function rcube_calendar_ui(settings)
var event_edit_dialog = function(action, event) var event_edit_dialog = function(action, event)
{ {
// close show dialog first // close show dialog first
$("#eventshow").dialog('close'); $("#eventshow:ui-dialog").dialog('close');
var $dialog = $('<div>'); var $dialog = $('<div>');
var calendar = event.calendar && me.calendars[event.calendar] ? me.calendars[event.calendar] : { editable:action=='new' }; var calendar = event.calendar && me.calendars[event.calendar] ? me.calendars[event.calendar] : { editable:action=='new' };
@ -721,8 +721,11 @@ function rcube_calendar_ui(settings)
// open a dialog to display detailed free-busy information and to find free slots // open a dialog to display detailed free-busy information and to find free slots
var event_freebusy_dialog = function() var event_freebusy_dialog = function()
{ {
var $dialog = $('#eventfreebusy').dialog('close'); var $dialog = $('#eventfreebusy'),
var event = me.selected_event; event = me.selected_event;
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (!event_attendees.length) if (!event_attendees.length)
return false; return false;
@ -966,7 +969,9 @@ function rcube_calendar_ui(settings)
{ {
var overlay = $('#schedule-event-time'); var overlay = $('#schedule-event-time');
if (me.selected_event.end.getTime() <= freebusy_ui.start.getTime() || me.selected_event.start.getTime() >= freebusy_ui.end.getTime()) { if (me.selected_event.end.getTime() <= freebusy_ui.start.getTime() || me.selected_event.start.getTime() >= freebusy_ui.end.getTime()) {
overlay.draggable('disable').hide(); overlay.hide();
if (overlay.data('isdraggable'))
overlay.draggable('disable');
} }
else { else {
var table = $('#schedule-freebusy-times'), var table = $('#schedule-freebusy-times'),
@ -1000,7 +1005,7 @@ function rcube_calendar_ui(settings)
// overlay is visible // overlay is visible
if (width > 0) { if (width > 0) {
overlay.css({ width: (width-5)+'px', height:(table.children('tbody').height() - 4)+'px', left:pos.left+'px', top:pos.top+'px' }).draggable('enable').show(); overlay.css({ width: (width-5)+'px', height:(table.children('tbody').height() - 4)+'px', left:pos.left+'px', top:pos.top+'px' }).show();
// configure draggable // configure draggable
if (!overlay.data('isdraggable')) { if (!overlay.data('isdraggable')) {
@ -1034,6 +1039,8 @@ function rcube_calendar_ui(settings)
} }
}).data('isdraggable', true); }).data('isdraggable', true);
} }
else
overlay.draggable('enable');
} }
else else
overlay.draggable('disable').hide(); overlay.draggable('disable').hide();
@ -1640,7 +1647,7 @@ function rcube_calendar_ui(settings)
// opens calendar day-view in a popup // opens calendar day-view in a popup
this.fisheye_view = function(date) this.fisheye_view = function(date)
{ {
$('#fish-eye-view').dialog('close'); $('#fish-eye-view:ui-dialog').dialog('close');
// create list of active event sources // create list of active event sources
var src, cals = {}, sources = []; var src, cals = {}, sources = [];
@ -1745,7 +1752,9 @@ function rcube_calendar_ui(settings)
this.calendar_edit_dialog = function(calendar) this.calendar_edit_dialog = function(calendar)
{ {
// close show dialog first // close show dialog first
var $dialog = $("#calendarform").dialog('close'); var $dialog = $("#calendarform");
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (!calendar) if (!calendar)
calendar = { name:'', color:'cc0000', editable:true, showalarms:true }; calendar = { name:'', color:'cc0000', editable:true, showalarms:true };
@ -1842,8 +1851,11 @@ function rcube_calendar_ui(settings)
this.import_events = function(calendar) this.import_events = function(calendar)
{ {
// close show dialog first // close show dialog first
var $dialog = $("#eventsimport").dialog('close'); var $dialog = $("#eventsimport"),
var form = rcmail.gui_objects.importform; form = rcmail.gui_objects.importform;
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
$('#event-import-calendar').val(calendar.id); $('#event-import-calendar').val(calendar.id);
@ -1881,7 +1893,7 @@ function rcube_calendar_ui(settings)
// callback from server if import succeeded // callback from server if import succeeded
this.import_success = function(p) this.import_success = function(p)
{ {
$("#eventsimport").dialog('close'); $("#eventsimport:ui-dialog").dialog('close');
rcmail.set_busy(false, null, me.saving_lock); rcmail.set_busy(false, null, me.saving_lock);
rcmail.gui_objects.importform.reset(); rcmail.gui_objects.importform.reset();
@ -1892,7 +1904,10 @@ function rcube_calendar_ui(settings)
// show URL of the given calendar in a dialog box // show URL of the given calendar in a dialog box
this.showurl = function(calendar) this.showurl = function(calendar)
{ {
var $dialog = $('#calendarurlbox').dialog('close'); var $dialog = $('#calendarurlbox');
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (calendar.feedurl) { if (calendar.feedurl) {
$dialog.dialog({ $dialog.dialog({

View file

@ -853,7 +853,10 @@ function rcube_tasklist_ui(settings)
*/ */
function task_show_dialog(id) function task_show_dialog(id)
{ {
var $dialog = $('#taskshow').dialog('close'), rec;; var $dialog = $('#taskshow'), rec;
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (!(rec = listdata[id]) || clear_popups({})) if (!(rec = listdata[id]) || clear_popups({}))
return; return;
@ -923,7 +926,7 @@ function rcube_tasklist_ui(settings)
*/ */
function task_edit_dialog(id, action, presets) function task_edit_dialog(id, action, presets)
{ {
$('#taskshow').dialog('close'); $('#taskshow:ui-dialog').dialog('close');
var rec = listdata[id] || presets, var rec = listdata[id] || presets,
$dialog = $('<div>'), $dialog = $('<div>'),
@ -1315,9 +1318,12 @@ function rcube_tasklist_ui(settings)
function list_edit_dialog(id) function list_edit_dialog(id)
{ {
var list = me.tasklists[id], var list = me.tasklists[id],
$dialog = $('#tasklistform').dialog('close'); $dialog = $('#tasklistform');
editform = $('#tasklisteditform'); editform = $('#tasklisteditform');
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
if (!list) if (!list)
list = { name:'', editable:true, showalarms:true }; list = { name:'', editable:true, showalarms:true };