add: calendar = calendar || getSelectedCalendar(); var calendars = getCalendarManager().getCalendars({}); calendars = calendars.filter(function(el) { return !el.readOnly; });  if (calendar.readOnly && mode == "new" && calendars.length < 1) {  return; } else if (calendar.readOnly && mode == "new") {   calendar = calendars[0]; if (calendarItem) {    calendarItem.calendar = calendars[0]; } } 
context: function openEventDialog(calendarItem, calendar, mode, callback, job){    // Set up some defaults    calendar = calendar || getCompositeCalendar().defaultCalendar;    mode = mode || "new";    // Setup the window arguments    var args = new Object();    args.calendarEvent = calendarItem;    args.calendar = calendar;    args.mode = mode;    args.onOk = callback;    args.job = job;    // this will be called if file->new has been selected from within the dialog    args.onNewEvent = function(calendar) {        createEventWithDialog(calendar, null, null);    }    // the dialog will reset this to auto when it is done loading.    window.setCursor("wait");    // ask the provide if this item is an invitation. if this is the case    // we'll open the summary dialog since the user is not allowed to change    // the details of the item.    var isInvitation = false;    try {        isInvitation = calendar.isInvitation(calendarItem);    }    catch(e) {}    // open the dialog modeless    var url = "chrome://calendar/content/sun-calendar-event-dialog.xul";    if (isInvitation || calendar.readOnly) {        url = "chrome://calendar/content/calendar-summary-dialog.xul";    }    openDialog(url, "_blank", "chrome,titlebar,resizable", args);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9421/b8e17ac4944a53b1a7be4f857340a62c7e76bc55/calendar-item-editing.js/buggy/calendar/base/content/calendar-item-editing.js