more_day_preview.mod
1.0
This allows for more days in the Calendar preview in the BoardIndex.
The number of days can be set from the Calendar Settings page
This mod requires the calendar_sp1.mod by Karlos & Matt Throesch
This mod changes the following files:
english.lng
Sources/BoardIndex.pl
Sources/Calendar.pl
It also adds an 8th item to the calsettings.txt file: the number of days you want to preview.
Author's Email: francesco@fampeeters.com
F Peeters
http://www.fampeeters.com
english.lng
##### End Calendar #####
$caltxt{'fp01'} = "Calendar Highlights next ";
$caltxt{'fp02'} = " days:";
$caltxt{'fp03'} = "Calendar Highlights tomorrow:";
$caltxt{'fp04'} = "No calendar entries found";
$caltxt{'fp05'} = "event.";
$caltxt{'fp06'} = "events.";
$caltxt{'fp07'} = "Number of day looking ahead";
Sources/BoardIndex.pl
$yymain .= qq~
$txt{'305'} $caltxt{'01'}
$maxfuture=@calsettings[8] || 1;
if ($maxfuture == 1) {
$yymain .= qq~
$caltxt{'fp03'}
~;
}
elsif ($maxfuture > 1) {
$yymain .= qq~
$caltxt{'fp01'}$maxfuture$caltxt{'fp02'}
~;
}
$totalcount=0;
for ($futureday = 1; $futureday <= $maxfuture; $futureday++) {
$now = timelocal(localtime);
($newd, $newm, $newy) = (localtime($now + (86400 * $futureday)))[3,4,5];
$newy += 1900;
$newm += 1;
if ($newd < 10) { $newd = "0" . $newd; }
if ($newm < 10) { $newm = "0" . $newm; }
$calcount=0;
open(FILE, "$memberdir/memberlist.txt") || die "cannot open list file";
@members = ;
close(FILE);
foreach $usernames (@members) {
chomp $usernames;
$mem = $members;
open(FILE, "$memberdir/$usernames.dat") || die "cannot open user file";
@userbd = ;
close(FILE);
chomp $userbd[16];
($matchm, $matchd, $trash) = split(/\//, $userbd[16]);
if(($matchm == $newm) && ($matchd == $newd)) {
$calcount++;
$totalcount++;
}
}
foreach $calentry (sort @calendar)
{
$yy=substr($calentry,2,2);
$mm=substr($calentry,4,2);
$dd=substr($calentry,6,2);
if ($dd == $newd && $mm == $newm && $yy+2000 == $newy)
{
$filename="20".$yy.$mm.$dd.".evt";
open (FILE,"$vardir/calendar/$filename")
|| &fatal_error("Could not open $vardir/calendar/$filename ");
@daysevents=;
close(FILE);
foreach $event (sort @daysevents)
{
$calcount++;
$totalcount++;
}
}
}
$mmm = @months[$newm-1];
if ($calcount == 1){
$yymain .= qq~
$newd $mmm $newy: $calcount $caltxt{'fp05'
}.
~;
}
elsif ($calcount >= 2)
{
$yymain .= qq~
$newd $mmm $newy: $calcount $caltxt{'fp06'
}.
~;
}
}
if ($totalcount == 0) {
$yymain .= qq~
$caltxt{'fp04'}
~;
}
Sources/Calendar.pl
{
$calpast = 1;
$calfuture = 11;
$calwidth = 4;
$calguest=1;
$caltop=0;
$caltitle=0;
$allowprivate=0;
$maxfuture=7;
{
$calpast=@calsettings[0];
$calfuture=@calsettings[1];
$calwidth=@calsettings[2];
$calguest=@calsettings[3];
$caltop=@calsettings[4];
$caltitle=@calsettings[5];
$allowprivate=@calsettings[6];
$dayoffset=@calsettings[7];
$maxfuture=@calsettings[8];
else
{
$yymain .= qq~
~;
}
$yymain .= qq~
$caltxt{'fp07'}
~;
$calpast=$FORM{'monthspast'};
$calfuture=$FORM{'monthsfuture'};
$calwidth=$FORM{'modwidth'};
$guestallow=$FORM{'enableguest'};
$caltop=$FORM{'caltop'};
$caltitle=$FORM{'caltitle'};
$allowprivate=$FORM{'allowprivate'};
$dayoffset=$FORM{'dayoffset'};
$maxfuture=$FORM{'maxfuture'};
fopen(FILE,">$vardir/calendar/calsettings.txt",1);
print FILE $calpast."\n";
print FILE $calfuture."\n";
print FILE $calwidth."\n";
print FILE $calguest."\n";
print FILE $caltop."\n";
print FILE $caltitle."\n";
print FILE $allowprivate."\n";
print FILE $dayoffset."\n";
print FILE $maxfuture."\n";