From 8e8b5e1027e8b67f21ea0f817f17b2586d56f952 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 26 May 2009 23:01:36 +0200 Subject: [PATCH] Show seven days in the agenda view. --- kronolith/js/src/kronolith.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/kronolith/js/src/kronolith.js b/kronolith/js/src/kronolith.js index 0fe921f1a..0dee38a7c 100644 --- a/kronolith/js/src/kronolith.js +++ b/kronolith/js/src/kronolith.js @@ -299,7 +299,7 @@ KronolithCore = { }); // Build new calendar view. - while (day.compareTo(dates[1]) < 1) { + while (!day.isAfter(dates[1])) { tbody.insert(this.createWeekRow(day, date.getMonth(), dates).show()); day.next().week(); } @@ -312,8 +312,11 @@ KronolithCore = { break; case 'agenda': - var tbody = $('kronolithViewAgendaBody'); + var tbody = $('kronolithViewAgendaBody'), + dates = this.viewDates(date, view), + day = dates[0].clone(), row; + this.setTitle(Kronolith.text.agenda + ' ' + dates[0].toString('d') + ' - ' + dates[1].toString('d')); $('kronolithViewAgenda').down('caption span').setText(Kronolith.text.agenda); // Remove old rows. Maybe we should only rebuild the calendars if @@ -325,7 +328,10 @@ KronolithCore = { }); // Build new calendar view. - tbody.insert(this.createAgendaDay(date, 0).show()); + while (!day.isAfter(dates[1])) { + tbody.insert(this.createAgendaDay(day, 0).show()); + day.next().day(); + } break; } }, @@ -480,6 +486,7 @@ KronolithCore = { { var tbody = $('kronolithMinical').down('tbody'), dates = this.viewDates(date, 'month'), day = dates[0].clone(), + date7 = date.clone().add(1).week(), weekStart, weekEnd, weekEndDay, td, tr; // Update header. @@ -509,7 +516,8 @@ KronolithCore = { if (view && (view == 'month' || (view == 'week' && date.between(weekStart, weekEnd)) || - ((view == 'day' || view == 'agenda') && date.compareTo(day) == 0))) { + (view == 'day' && date.equals(day)) || + (view == 'agenda' && !day.isBefore(date) && day.isBefore(date7)))) { td.addClassName('kronolithSelected'); } td.setText(day.getDate()); @@ -1104,6 +1112,9 @@ KronolithCore = { end.moveToLastDayOfMonth(); end.moveToEndOfWeek(); break; + case 'agenda': + end.add(6).days(); + break; } return [start, end]; -- 2.11.0