diff --git a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm index d2ca2d2f0..038cfa08d 100644 --- a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm @@ -211,7 +211,7 @@ sub getUiLevel { sub view { # All of this really needs to be redone like the old - # EventsCalendar... except this time using getLineageWhere to + # EventsCalendar... except this time using getLineage to # filter instead of doing all sorts of pruning. Also, caching # needs to be re-enabled. Also, see the note below at line # 407 - each dayloop event array needs to be sorted by startTime. @@ -231,9 +231,10 @@ sub view { $calMonthStart = int($calMonthStart); my $calMonthEnd = $session{form}{calMonthEnd} || ($calMonthStart + $monthRangeLength - 1); $calMonthEnd = int($calMonthEnd); - $calMonthStart = 1 if (($calMonthStart < 1) || ($calMonthStart > 72)); - $calMonthEnd = 1 if (($calMonthEnd < 1) || ($calMonthEnd > 72)); + $calMonthEnd = ($calMonthStart + 72) if ($calMonthStart < $calMonthEnd - 72); $calMonthEnd = $calMonthStart if ($calMonthEnd < $calMonthStart); + #used for pagination + $monthRangeLength = $calMonthEnd - $calMonthStart + 1; my ( $junk, $sameDate, $p, @list, $date, $flag, %previous, $maxDate, $minDate); my $monthloop; @@ -324,10 +325,10 @@ sub view { # only display events for this person's Personal Calendar, if it's so set. # next unless (($calType != 1) || ($event->isMyEvent())); my $eventLength = WebGUI::DateTime::getDaysInInterval($eventStartDate,$eventEndDate); - my ($startYear, $startMonth, $startDay, $startDate, $startTime) = split " ", - WebGUI::DateTime::epochToHuman($eventStartDate, "%y %c %D %z %Z"); - my ($endYear, $endMonth, $endDay, $endDate, $endTime) = split " ", - WebGUI::DateTime::epochToHuman($eventEndDate, "%y %c %D %z %Z"); + my ($startYear, $startMonth, $startDay, $startDate, $startTime, $startAmPm, $startDayOfWeek) = split " ", + WebGUI::DateTime::epochToHuman($eventStartDate, "%y %c %D %z %Z %w"); + my ($endYear, $endMonth, $endDay, $endDate, $endTime, $endAmPm, $endDayOfWeek) = split " ", + WebGUI::DateTime::epochToHuman($eventEndDate, "%y %c %D %z %Z %w"); my $eventCycleStart = 0; # Fast-Forward Event Cycle to this month (for events spanning multiple months) $eventCycleStart = (WebGUI::DateTime::getDaysInInterval($eventStartDate,$monthStart) - 1) if ($eventStartDate < $monthStart); @@ -352,17 +353,19 @@ sub view { description=>$event->getValue("description"), name=>$event->getValue("title"), 'start.date.human'=>$startDate, - 'start.time.human'=>$startTime, + 'start.time.human'=>$startTime." ".$startAmPm, 'start.date.epoch'=>$eventStartDate, 'start.year'=>$startYear, 'start.month'=>$startMonth, 'start.day'=>$startDay, + 'start.day.dayOfWeek'=>$startDayOfWeek, 'end.date.human'=>$endDate, - 'end.time.human'=>$endTime, + 'end.time.human'=>$endTime." ".$endAmPm, 'end.date.epoch'=>$eventEndDate, 'end.year'=>$endYear, 'end.month'=>$endMonth, 'end.day'=>$endDay, + 'end.day.dayOfWeek'=>$endDayOfWeek, 'startEndYearMatch'=>($startYear eq $endYear), 'startEndMonthMatch'=>($startMonth eq $endMonth), 'startEndDayMatch'=>($startDay eq $endDay), @@ -379,8 +382,8 @@ sub view { $previous{start} = $startYear."-".$startMonth."-".$startDay; $previous{end} = $endYear."-".$endMonth."-".$endDay; - } elsif (ref $event eq "WebGUI::Asset::Relation") { - print "\n"; +# } elsif (ref $event eq "WebGUI::Asset::Relation") { +# print "\n"; } } if (($startsNow || ($startMonth eq "first")) && ($calHasEvent == 0)) { @@ -456,6 +459,40 @@ sub view { $var{'thursday.label.short'} = substr(WebGUI::DateTime::getDayName(4),0,1); $var{'friday.label.short'} = substr(WebGUI::DateTime::getDayName(5),0,1); $var{'saturday.label.short'} = substr(WebGUI::DateTime::getDayName(6),0,1); + # Create pagination variables. + $var{'pagination.pageCount.isMultiple'} = 1 if (($calMonthStart > 1) || ($maxDate > WebGUI::DateTime::addToDate($minDate,0,($monthRangeLength-1),0))); + my $prevCalMonthStart = $calMonthStart - $monthRangeLength; + my $nextCalMonthStart = $calMonthStart + $monthRangeLength; + my $prevCalMonthEnd = $calMonthEnd - $monthRangeLength; + my $nextCalMonthEnd = $calMonthEnd + $monthRangeLength; + my $monthLabel; + if ($monthRangeLength == 1) { + $monthLabel = WebGUI::International::get(560,"EventsCalendar"); + } else { + $monthLabel = WebGUI::International::get(561,"EventsCalendar"); + } + $var{'pagination.previousPage'} = '
'; + $var{'pagination.pageList.upTo20'} = '