|
@@ -1667,6 +1667,7 @@ function showEventForm(date, allDay, calEvent, jsEvent, mod, repeatOne, confirmR
|
1667
|
1667
|
var calendarObj = $('#event_calendar');
|
1668
|
1668
|
var calSelected = $('.resourceCalDAV_item.resourceCalDAV_item_selected').attr('data-id');
|
1669
|
1669
|
|
|
1670
|
+ var calendarsApiHasResponded = false
|
1670
|
1671
|
// begin custom code
|
1671
|
1672
|
$.ajax({
|
1672
|
1673
|
url: '/api/calendars/',
|
|
@@ -1703,6 +1704,7 @@ function showEventForm(date, allDay, calEvent, jsEvent, mod, repeatOne, confirmR
|
1703
|
1704
|
calendarObj.append(new Option(calName, cals[i].uid));
|
1704
|
1705
|
}
|
1705
|
1706
|
}
|
|
1707
|
+ calendarsApiHasResponded = true
|
1706
|
1708
|
})
|
1707
|
1709
|
|
1708
|
1710
|
if(mod=='new')
|
|
@@ -2394,9 +2396,15 @@ function showEventForm(date, allDay, calEvent, jsEvent, mod, repeatOne, confirmR
|
2394
|
2396
|
}
|
2395
|
2397
|
/*************************** END OF BAD HACKS SECTION ***************************/
|
2396
|
2398
|
if(calEvent.etag!='') {
|
2397
|
|
- window.setTimeout(function () {
|
2398
|
|
- $('#event_calendar').val(calEvent.res_id);
|
2399
|
|
- }, 1)
|
|
2399
|
+ var interval = window.setInterval(function () {
|
|
2400
|
+ if (calendarsApiHasResponded === true) {
|
|
2401
|
+ $('#event_calendar').val(calEvent.res_id);
|
|
2402
|
+ stopInterval()
|
|
2403
|
+ }
|
|
2404
|
+ }, 500)
|
|
2405
|
+ var stopInterval = function () {
|
|
2406
|
+ window.clearInterval(interval)
|
|
2407
|
+ }
|
2400
|
2408
|
}
|
2401
|
2409
|
}
|
2402
|
2410
|
|