Thanks!
-------------------------webmaster@sheltoncma.org http://www.sheltoncma.org/ Joe Sartori
[This message has been edited by JSartori21367 (edited August 05, 2006).]
Probably, it's done on the 4-Week grid view. I haven't looked into what would be necessary to make it possible on the Month View though.
Dan O.
------------------
[This message has been edited by DanO (edited February 25, 2003).]
Open the Date.inc file in the calendarscript/lib directory. Find the line at the end of the sub getTimeSpan { routine:
return ($start,$end);
add the following code directly before it:
my ($monthday, $weekday, $yearday) = (localtime $start)[3,6,7];
if ($weekday && $weekday < 6){$dooffset = ($weekday+1) * 60 * 60 * 24;$start -= $dooffset;}
my ($monthday, $weekday, $yearday) = (localtime $end)[3,6,7];
if ($weekday){$dooffset = (6 - $weekday) * 60 * 60 * 24;$end += $dooffset;}
You should also modify one line in the default.html template file (if you're using the default tamplales) or else the month name will not be printed on the fist of each month (so users will know where they are).
The code that needs to be modified is in the middle of a line and is:
<%if($DAY->{'dd'}==1&&$VIEW ne "Month"){%><%=$DAY->{'monthname'}%>?<%}%>
and should be changed to:
<%if($DAY->{'dd'}==1){%><%=$DAY->{'monthname'}%>?<%}%>
That's it.
Let me know how it works.
That worked great. Just a couple of things...
This affects all calendars, which creates this problem: One calendar has Sunday as the first day of the month, another has Monday as the first day of the month. This creates some weirdness. Also, it doesn't show the name of the month for the previous dates to the current month shown.
Is there a way to affect different calendars differently?Is there a way to make it work with a grid, regardless of the starting day of the week?Is there a way to make it show the month name for the previous dates to the month (it's set for the First, which makes sense)?
Thanks, this is VERY useful!
----webmaster@sheltoncma.com http://www.sheltoncma.com Joe Sartori
I thought that could be a problem.
** Is there a way to make it work with a grid, regardless of the starting day of the week? **
I'm sure some sort of if statement could be included for the different set ups and the offset values adjusted accordingly. I however don't have a calendar set up that way to test with so someone else would have to look into that.
** Is there a way to affect different calendars differently? **
Again, using some sort of if conditional should be able to be used.
** Is there a way to make it show the month name for the previous dates to the month **
Maybe. I don't know how to do it though, see if you can figure it out.
[This message has been edited by DanO (edited February 26, 2003).]
I redid the mod and tested with calendars starting on either Sunday or Monday and it appears to work Ok in both. I have no idea if it will work for calendars that start with any other days.
As always, use at your own risk:
In the Date.inc file right near the end of the sub getTimeSpan { insert:
if ($week_start_day <= $start_wd){my $dooffset = (7-(7-$start_wd)-$week_start_day) * 60 * 60 * 24;$start -= $dooffset;}else{$dooffset = (7-$week_start_day) * 60 * 60 * 24;$start -= $dooffset;}
($end_ss,$end_mi,$end_hh,$end_dd,$end_mm,$end_yy,$end_wd,$end_yd,$end_isdst) = localtime($end);
# the above should all be on one line! (this line is NOT part of the code)
if ($end_wd >= $week_start_day){$dooffset = (6 + $week_start_day - $end_wd) * 60 * 60 * 24;$end += $dooffset;}
before the lines:
return ($start,$end);}
1;
<%=$DAY->{'monthname'}%> will print the month name of the calendar grid it is in.
It isn't working for me. Did your revisions replace the original modifications, or add to it? Either way, when I add it, it has the same original problem. The second way doesn't change anything at all. Also, what do you mean by
quote: # the above should all be on one line! (this line is NOT part of the code)
Thanks.
-------------------------webmaster@sheltoncma.com http://www.sheltoncma.com/ Joe Sartori
[This message has been edited by JSartori21367 (edited March 01, 2003).]
Replace.
** what do you mean by "# the above should all be on one line! (this line is NOT part of the code)" **
It means that the lines:
is really suppose to be ONE line of code but since this forum raps long lines it got displayed on 2. That line should really look like:
code:($end_ss,$end_mi,$end_hh,$end_dd,$end_mm,$end_yy,$end_wd,$end_yd,$end_isdst) = localtime($end);
Sorry but I don't know what to tell you. Maybe someone else will give it a go?
[This message has been edited by DanO (edited March 01, 2003).]
Insert
code:if ($week_start_day <= $start_wd){my $dooffset = (7-(7-$start_wd)-$week_start_day) * 60 * 60 * 24;$start -= $dooffset;}else{$dooffset = (7-$week_start_day) * 60 * 60 * 24;$start -= $dooffset;}($end_ss,$end_mi,$end_hh,$end_dd,$end_mm,$end_yy,$end_wd,$end_yd,$end_isdst) = localtime($end);
if ($week_start_day <= $start_wd){my $dooffset = (7-(7-$start_wd)-$week_start_day) * 60 * 60 * 24;$start -= $dooffset;}else{$dooffset = (7-$week_start_day) * 60 * 60 * 24;$start -= $dooffset;}($end_ss,$end_mi,$end_hh,$end_dd,$end_mm,$end_yy,$end_wd,$end_yd,$end_isdst) = localtime($end);
and
code:if ($end_wd >= $week_start_day){$dooffset = (6 + $week_start_day - $end_wd) * 60 * 60 * 24;$end += $dooffset;}
just before the
1;?? Is this all ??
Thanks a lot!
That's all of it but it ALL GOES RIGHT BEFORE the lines:
[This message has been edited by DanO (edited March 02, 2003).]
Thank you, it's working now. This is great!
?Yo Soy MUY ALEGRE!
[This message has been edited by JSartori21367 (edited March 02, 2003).]
Glad to hear it.
<%if($DAY->{'dd'}==1&&$VIEW ne "Month")
to just
<%if($DAY->{'dd'}==1)
The month name will print on the first of every month to make it easier for users to know one month's dates from the next when 2 or more month's events are shown on the same calendar grid.
JFYI.
Here's a little addition to change the background color of the cells that are NOT in the current month.
In the default.html file, down around line 182 just after "ACTUAL DISPLAY AREA" "MONTHLY OR WEEKLY VIEW", change the tag for the data cell for each day from this:
code:<TD CLASS="thinborder" VALIGN=TOP WIDTH=14% <%=$rowheight%> BGCOLOR="<%IF SELECTED%><%=$_GRID_CELL_SELECTED_BGCOLOR%><%ELSE%><%=$_GRID_CELL_BGCOLOR%><%/IF%>">
<TD CLASS="thinborder" VALIGN=TOP WIDTH=14% <%=$rowheight%> BGCOLOR="<%IF SELECTED%><%=$_GRID_CELL_SELECTED_BGCOLOR%><%ELSE%><%=$_GRID_CELL_BGCOLOR%><%/IF%>">
to this:
code:<TD CLASS="thinborder" VALIGN=TOP WIDTH=14% <%=$rowheight%> BGCOLOR="<%IF SELECTED%><%=$_GRID_CELL_SELECTED_BGCOLOR%><%ELSE%><%if($DAY->{'mm'}==$MONTH){%><%=$_GRID_CELL_BGCOLOR%><% } else { %><%=$_GRID_DATE_BGCOLOR%><% } %><%/IF%>">
<TD CLASS="thinborder" VALIGN=TOP WIDTH=14% <%=$rowheight%> BGCOLOR="<%IF SELECTED%><%=$_GRID_CELL_SELECTED_BGCOLOR%><%ELSE%><%if($DAY->{'mm'}==$MONTH){%><%=$_GRID_CELL_BGCOLOR%><% } else { %><%=$_GRID_DATE_BGCOLOR%><% } %><%/IF%>">
As we don't have a separate color for this, it just uses the DateText background color as the whole Cell background color for those days outside the current month.
[This message has been edited by rwhirn (edited April 13, 2004).]