rem: var theView = window.opener.currentView(); 
add: var theView = getCalendarView(); 
context: function getEventsAndDialogSettings(receiverFunc){    var settings = new Object();    var tempTitle = document.getElementById("title-field").value;    settings.title = (tempTitle || calGetString("calendar", "Untitled"));    settings.layoutCId = document.getElementById("layout-field").value;    settings.start = null;    settings.end = null;    settings.eventList = null;    var theView = window.opener.currentView();    switch (document.getElementById("view-field").selectedItem.value) {        case 'currentview':        case '': //just in case            settings.start = theView.startDay;            settings.end   = theView.endDay;            break;        case 'selected':            settings.eventList = theView.getSelectedItems({});            break;        case 'custom':            // We return the time from the timepickers using the selected            // timezone, as not doing so in timezones with a positive offset            // from UTC may cause the printout to include the wrong days.            var currentTimezone = calendarDefaultTimezone();            settings.start = jsDateToDateTime(document.getElementById("start-date-picker").value);            settings.start = settings.start.getInTimezone(currentTimezone);            settings.end   = jsDateToDateTime(document.getElementById("end-date-picker").value);            settings.end   = settings.end.getInTimezone(currentTimezone);            break ;        default :            dump("Error : no case in printDialog.js::printCalendar()");    }    if (settings.eventList) {        receiverFunc(settings);    } else {        // end isn't exclusive, so we need to add one day        settings.end = settings.end.clone();        settings.end.day = settings.end.day + 1;        settings.end.normalize();        settings.eventList = [];        var listener = {            onOperationComplete:            function onOperationComplete(aCalendar, aStatus, aOperationType, aId, aDateTime) {                receiverFunc(settings);            },            onGetResult:            function onGetResult(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) {                settings.eventList = settings.eventList.concat(aItems);            }        };        window.opener.getCompositeCalendar().getItems(            Components.interfaces.calICalendar.ITEM_FILTER_TYPE_EVENT |             Components.interfaces.calICalendar.ITEM_FILTER_CLASS_OCCURRENCES,            0, settings.start, settings.end, listener);    }}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/10234/4620b10226698b022fb4b803166179b73c4aaa26/printDialog.js/buggy/calendar/resources/content/printDialog.js