Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1] 2   Go Down
Print
Author Topic: Month Wrap  (Read 675 times)
0 Members and 1 Guest are viewing this topic.
JSartori21367
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« on: February 24, 2003, 10:57:00 PM »

Someone has already probably already asked this, but I couldn't find it.  If I am viewing a calendar in the month view, is there a way to show events in the blank spots.  In other words, if the first of the month is on a saturday, can the empty boxes before it (Sunday - Friday) be filled with the previous events, and if the last day of the month is on Monday, fill the boxes after it (Tuesday - Saturday)?

Thanks!

-------------------------
webmaster@sheltoncma.org http://www.sheltoncma.org/
Joe Sartori

[This message has been edited by JSartori21367 (edited August 05, 2006).]

Logged

-------------------------
webmaster@sheltoncma.org
Joe Sartori
http://www.sheltoncma.org/
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: February 25, 2003, 05:52:00 PM »

> if the first of the month is on a saturday, can the empty boxes before it (Sunday - Friday) be filled with the previous events <

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.

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #2 on: February 25, 2003, 07:00:00 PM »

see below...

[This message has been edited by DanO (edited February 25, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: February 25, 2003, 07:00:00 PM »

Ok I did some rough figuring and this is what I came up with. It was only tested on my own calendar so use at your own risk! Also, make sure you keep a backup of your original files.

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.

Dan O.

[This message has been edited by DanO (edited February 25, 2003).]

Logged
JSartori21367
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #4 on: February 26, 2003, 12:15:00 AM »

Don O.:

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

Logged

-------------------------
webmaster@sheltoncma.org
Joe Sartori
http://www.sheltoncma.org/
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #5 on: February 26, 2003, 01:20:00 PM »

** 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. **

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.

Dan O.

[This message has been edited by DanO (edited February 26, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #6 on: February 26, 2003, 06:42:00 PM »

** Is there a way to make it work with a grid, regardless of the starting day of the week? **

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;

** Is there a way to make it show the month name for the previous dates to the month **

<%=$DAY->{'monthname'}%> will print the month name of the calendar grid it is in.

Dan O.

[This message has been edited by DanO (edited February 26, 2003).]

Logged
JSartori21367
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #7 on: March 01, 2003, 02:39:00 PM »

DanO

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).]

Logged

-------------------------
webmaster@sheltoncma.org
Joe Sartori
http://www.sheltoncma.org/
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #8 on: March 01, 2003, 05:40:00 PM »

** Did your revisions replace the original modifications, or add to it? **

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:

($end_ss,$end_mi,$end_hh,$end_dd,$end_mm,$end_yy,$end_wd,$end_yd,$end_isdst)
= localtime($end);

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);

** it has the same original problem **

Sorry but I don't know what to tell you. Maybe someone else will give it a go?

Dan O.

------------------

[This message has been edited by DanO (edited March 01, 2003).]

Logged
JSartori21367
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #9 on: March 01, 2003, 10:10:00 PM »

So the only revisions to the original Date.inc file are these?:

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);



after the 'getTimeSpan {' line (minus quotes)

and

code:
if ($end_wd >= $week_start_day){
$dooffset = (6 + $week_start_day - $end_wd) * 60 * 60 * 24;
$end += $dooffset;
}

just before the

return ($start,$end);
}

1;
Huh???   Is this all   Huh???

Thanks a lot!

-------------------------
webmaster@sheltoncma.com http://www.sheltoncma.com/
Joe Sartori

Logged

-------------------------
webmaster@sheltoncma.org
Joe Sartori
http://www.sheltoncma.org/
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #10 on: March 02, 2003, 11:54:00 AM »

** Huh??? Is this all Huh??? **

That's all of it but it ALL GOES RIGHT BEFORE the lines:

return ($start,$end);
}

1;


------------------

[This message has been edited by DanO (edited March 02, 2003).]

Logged
JSartori21367
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #11 on: March 02, 2003, 03:58:00 PM »

DanO

Thank you, it's working now.  This is great!

?Yo Soy MUY ALEGRE!


-------------------------
webmaster@sheltoncma.com http://www.sheltoncma.com/
Joe Sartori

[This message has been edited by JSartori21367 (edited March 02, 2003).]

Logged

-------------------------
webmaster@sheltoncma.org
Joe Sartori
http://www.sheltoncma.org/
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #12 on: March 02, 2003, 06:20:00 PM »

** it's working now **

Glad to hear it.

Dan O.

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #13 on: April 07, 2003, 06:21:00 PM »

BTW. In the default.html template file, if you change the part of the code which is currently:

<%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.

Dan O.

------------------

Logged
rwhirn
New Member
*

Karma: 0
Offline Offline

Posts: 0

Programmer


WWW
« Reply #14 on: April 13, 2004, 05:19:00 PM »

Great mod, DanO!

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%>">

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%>">

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).]

[This message has been edited by rwhirn (edited April 13, 2004).]

Logged
Pages: [1] 2   Go Up
Print
Jump to: