From: Michael J. Rubinsky Date: Thu, 18 Nov 2010 06:02:59 +0000 (-0500) Subject: temporary solution for lazy loading the initial month view. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=718c7746365fc302cc75e0c220e337a5467b4677;p=horde.git temporary solution for lazy loading the initial month view. Will fix properly when a requested views are managed via a LIFO stack. --- diff --git a/kronolith/js/mobile.js b/kronolith/js/mobile.js index 4885074cd..952a6c3ef 100644 --- a/kronolith/js/mobile.js +++ b/kronolith/js/mobile.js @@ -32,6 +32,11 @@ cacheEnd: null, /** + * Temporary hack for displaying the first month view + */ + monthIsLoaded: null, + + /** * The currently displayed view **/ view: 'day', @@ -400,7 +405,7 @@ var dates = KronolithMobile.viewDates(d, 'month'); KronolithMobile.loadEvents(dates[0], dates[1], 'month'); KronolithMobile.buildCal(d); - KronolithMobile.insertEvents(dates, 'month'); + KronolithMobile.insertEvents(dates, 'month'); }, /** @@ -630,6 +635,8 @@ var currentDate = new Date(); $('body').bind('swipeleft', KronolithMobile.showNextDay); $('body').bind('swiperight', KronolithMobile.showPrevDay); + $('.kronolithDayHeader .kronolithPrevDay').bind('click', KronolithMobile.showPrevDay); + $('.kronolithDayHeader .kronolithNextDay').bind('click', KronolithMobile.showNextDay); $('#dayview').bind('pageshow', function(event, ui) { KronolithMobile.view = 'day'; $('body').bind('swipeleft', KronolithMobile.showNextDay); @@ -640,29 +647,29 @@ $('body').unbind('swiperight', KronolithMobile.showPrevDay); }); + // Event view $('#eventview').bind('pageshow', function(event, ui) { KronolithMobile.view = 'event'; }); - // Next and Prev day links for the day view. - $('.kronolithDayHeader .kronolithPrevDay').bind('click', KronolithMobile.showPrevDay); - $('.kronolithDayHeader .kronolithNextDay').bind('click', KronolithMobile.showNextDay); - // Load today's events $(".kronolithDayDate").html(currentDate.toString('ddd') + ' ' + currentDate.toString('d')); $('.kronolithDayDate').data('date', currentDate); KronolithMobile.loadEvents(currentDate, currentDate, 'day'); // Set up the month view - // Build the first month, should due this on first page show, but the - // pagecreate event doesn't seem to fire for the internal page? Not sure how - // else to do it, so just build the first month outright. - KronolithMobile.buildCal(currentDate); + //KronolithMobile.buildCal(currentDate); $('#kronolithMinicalPrev').bind('click', KronolithMobile.showPrevMonth); $('#kronolithMinicalNext').bind('click', KronolithMobile.showNextMonth); $('#monthview').bind('pageshow', function(event, ui) { KronolithMobile.view = 'month'; + if (!KronolithMobile.monthIsLoaded) { + d = KronolithMobile.viewDates($('.kronolithDayDate').data('date'), 'month'); + KronolithMobile.loadEvents(d[0], d[1], 'month'); + KronolithMobile.buildCal($('.kronolithDayDate').data('date')); + KronolithMobile.insertEvents(d, 'month'); + } $('body').bind('swipeleft', KronolithMobile.showNextMonth); $('body').bind('swiperight', KronolithMobile.showPrevMonth); });