Look for this bit in default.html:
<%-- DAY VIEW --%><% } elsif ($VIEW eq "Day") { %>
<% if ($STYLE eq "Grid") { %><%-- GRID VIEW --%>
under it look for this:
<TD CLASS="thinborder" BGCOLOR="<%=$_GRID_CELL_BGCOLOR%>" VALIGN=TOP>
replace with this:
<%FOREACH EVENT%><% if ($EVENT->{details}->{category} eq "appointment") { $cellbg2="#4483D0";} elsif ($EVENT->{details}->{category} eq "block") { $cellbg2="#1C406C";}%><%/FOREACH%><%IF NO EVENTS EXIST%><%{$cellbg2=$_GRID_CELL_BGCOLOR;}%><%/IF%><TD CLASS="thinborder" BGCOLOR="<%=$cellbg2%>" VALIGN=TOP>
*tear* I'm so happy! LoL!
Later,
-Ry : )
[This message has been edited by Audiodox (edited March 10, 2004).]
but you mean you're pinting out:<TD CLASS="thinborder" BGCOLOR="<%=some color here%>" VALIGN=TOP>for each and every event listed inside a calendar grid? What about if multiple events are there?
Normally all events are printed inside a single grid (aka table cell). Where are you printing the closing table cell tags for each of those opening ones your code is causing to be printed?
Dan O.
------------------
<%FOREACH EVENT%><% if ($EVENT->{details}->{category} eq "appointment") { $cellcolor2="#4483D0";} elsif ($EVENT->{details}->{category} eq "block") { $cellcolor2="#444444";}%><%/FOREACH%><%IF NO EVENTS EXIST%><%{$cellcolor2=$_GRID_CELL_BGCOLOR;}%><%/IF%><TD CLASS="thinborder" BGCOLOR="<%=$cellcolor2%>" VALIGN=TOP><SPAN CLASS="text"><%FOREACH EVENT%><% if ($_SHOW_GRID_EVENT_BULLET) {%><%}%><% if ($_SHOW_EVENT_TIMES eq "ALL" | | $_SHOW_EVENT_TIMES eq "START") { %><% if ($EVENT->{'schedule'}->{'start_time'}) { %><%= SCHEDULE FIELD(start_time) %><% } %><% } %><% if ($_SHOW_EVENT_TIMES eq "ALL") { %><% if ($EVENT->{'schedule'}->{'end_time'}) { %>-<%= SCHEDULE FIELD(end_time) %><% } %><% } %><% if (($_SHOW_EVENT_TIMES eq "ALL" | | $_SHOW_EVENT_TIMES eq "START") && ($EVENT->{'schedule'}->{'start_time'})) { %> : <% } %><% if ($EVENT->{details}->{author_id} ne $User->{'Administrator'} ) { %><% if ($EVENT->{details}->{category} eq "appointment") {%>Booked<%} elsif ($EVENT->{details}->{category} eq "block") {%>Unavailable<%}%><% } elsif ($EVENT->{details}->{author_id} eq $User->{'Administrator'} ) { %><% if ($EVENT->{details}->{category} eq "appointment") {%><FONT SIZE="-2">[<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;">Appointment</A>]<BR></FONT><%} elsif ($EVENT->{details}->{category} eq "block") {%><FONT SIZE="-2">[<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;">Unavailable</A>]<BR></FONT><%}%><% } %><BR><%/FOREACH%><%IF NO EVENTS EXIST%> <%/IF%></SPAN></TD>
The table cell itself was already in place, I merlly(sp?) hacked it to accept a different background color, depending on what category the event was in. It dosn't work really well to have multiple category events within one hour, when I tested it, the first event category determined the cell color.
I've got a question for you, since you seem to be the leading mind in here. In the script above I've got another modification I'm working on:
<% if ($EVENT->{details}->{author_id} ne $User->{'Administrator'} ) { %><% if ($EVENT->{details}->{category} eq "appointment") {%>Booked<%} elsif ($EVENT->{details}->{category} eq "block") {%>Unavailable<%}%><% } elsif ($EVENT->{details}->{author_id} eq $User->{'Administrator'} ) { %><% if ($EVENT->{details}->{category} eq "appointment") {%><FONT SIZE="-2">[<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;">Appointment</A>]<BR></FONT><%} elsif ($EVENT->{details}->{category} eq "block") {%><FONT SIZE="-2">[<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;">Unavailable</A>]<BR></FONT><%}%><% } %>
I'm trying to make it so that only the admin, and eventually select users, will be able to view the details of a given event. At the moment I've managed to dissable all linking to details for the average user, but for what ever reason I've not managed to enable the Administrator to view the links to the details, even though I've got it set for the admin to see them. I've covored all the points I can think of to make this work, mabe you can see something I don't?
Thanx!
*edit the <TD> is out side of my <%FOREACH EVENT%> tags, so it dosn't really get created for each one, but the cell color does change depending on the category of the event. Dynamic <TD>, gotta love it
[This message has been edited by Audiodox (edited March 11, 2004).]
I think what you probably want is
<% if ($EVENT->{details}->{author_id} ne 'Administrator' ) { %>
?
------------------ScottCalendarScript.com
<% if ($User->{'username'} ne "Administrator") { %><%if ($EVENT->{details}->{category} eq 'appointment') {%>Booked<%} elsif ($EVENT->{details}->{category} eq 'block') {%>Unavailable<%}%><%} elsif ($User->{'username'} eq "Administrator") { %><%if ($EVENT->{details}->{category} eq 'appointment') {%><FONT SIZE="2">[<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;">Appointment</A>]</FONT><%} elsif ($EVENT->{details}->{category} eq 'block') {%><FONT SIZE="2">[<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;">Unavalable</A>]</FONT><%}%><%}%>
How could I not think of it!?!? The same bit is called all over the place, only with "anonymous" instead of "Administrator". Well, that's done, now to disable the contents in list mode.
** The table cell itself was already in place, I merlly(sp?) hacked it to accept a different background color, depending on what category the event was in. **
** It dosn't work really well to have multiple category events within one hour, when I tested it, the first event category determined the cell color. **
I think you might find it may not display at all in some other (non-IE) browsers if multiple events are listed because (if I'm not mistaken) the original code printed events like this:
<TD CLASS="thinborder" BGCOLOR ...event title hereevent title hereevent title hereevent title here...</TD>
And if I read your code right (I haven't actually tested it) it looks like it would be printing out something like:
<TD CLASS="thinborder" BGCOLOR ...event title here<TD CLASS="thinborder" BGCOLOR ...event title here<TD CLASS="thinborder" BGCOLOR ...event title here<TD CLASS="thinborder" BGCOLOR ...event title here...</TD>
That aint correct HTML code. Have you tried looking at the source code of the calendar to see exactly what you're printing out??
JFYI
<TR><SPAN CLASS="text"><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125"><TR><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125">7:00 am </TD><TD CLASS="thinborder" BGCOLOR="#EEEEEE" VALIGN=TOP><SPAN CLASS="text"> </SPAN></TD></TR><TR><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125">7:15 am </TD><TD CLASS="thinborder" BGCOLOR="#EEEEEE" VALIGN=TOP><SPAN CLASS="text"> </SPAN></TD></TR><TR><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125">7:30 am </TD><TD CLASS="thinborder" BGCOLOR="#EEEEEE" VALIGN=TOP><SPAN CLASS="text"> </SPAN></TD></TR><TR><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125">7:45 am </TD><TD CLASS="thinborder" BGCOLOR="#EEEEEE" VALIGN=TOP><SPAN CLASS="text"> </SPAN></TD></TR></TD></SPAN></TR>
but that's because of my display (7:00,7:15,7:30,7:45 - dosn't work yet, just more cells atm). Those are the empty cells, no events, here's with events:
<TR><SPAN CLASS="text"><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125"><TR><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125">6:00 am </TD><TD CLASS="thinborder" BGCOLOR="#444444" VALIGN=TOP><SPAN CLASS="text">6:00 am-6:15 am:Booked<BR>6:15 am-6:30 am:Unavailable<BR></SPAN></TD></TR><TR><SPAN CLASS="text"><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125"><TR><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125">6:15 am </TD><TD CLASS="thinborder" BGCOLOR="#444444" VALIGN=TOP><SPAN CLASS="text">6:00 am-6:15 am:Booked<BR>6:15 am-6:30 am:Unavailable<BR></SPAN></TD></TR><TR><SPAN CLASS="text"><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125"><TR><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125">6:30 am </TD><TD CLASS="thinborder" BGCOLOR="#444444" VALIGN=TOP><SPAN CLASS="text">6:00 am-6:15 am:Booked<BR>6:15 am-6:30 am:Unavailable<BR></SPAN></TD></TR><TR><SPAN CLASS="text"><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125"><TR><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125">6:45 am </TD><TD CLASS="thinborder" BGCOLOR="#444444" VALIGN=TOP><SPAN CLASS="text">6:00 am-6:15 am:Booked<BR>6:15 am-6:30 am:Unavailable<BR></SPAN></TD></TR></TD></SPAN></TR>
looks like all <TD> tags have a close, though I just noticed that the <SPAN> tags don't. hmmm...
* nope, same stuff, so <TD> tags have a close, But the <SPAN> tags before them don't. interesting.
Just a quick observation:
<TR><SPAN CLASS="text"><TD CLASS="thinborder" BGCOLOR="#EEEEEE" ALIGN="right" VALIGN="middle" WIDTH="125"><TR>
You can not have a <SPAN> outside of a <TD> (unless it's around the whole table). You can also not have a <TR> inside of a <TD> tag like you appear to have.
[This message has been edited by DanO (edited March 11, 2004).]
<TABLE BORDER="1" CLASS="thinborder" WIDTH=100%> <%FOREACH HOUR OF DAY%> <% next if (($HOUR < "6")); %> <%FOREACH EVENT%> <% if ($EVENT->{details}->{category} eq "appointment") { $cellcolor2="#4483D0"; } elsif ($EVENT->{details}->{category} eq "block") { $cellcolor2="#444444";}%> <%/FOREACH%> <%IF NO EVENTS EXIST%> <%{$cellcolor2=$_GRID_CELL_BGCOLOR;}%> <%/IF%> <TR> <TD CLASS="thinborder" BGCOLOR="<%=$_GRID_CELL_BGCOLOR%>" ALIGN="right" VALIGN="middle" WIDTH="125"> <SPAN CLASS="text"> <% if ($HOUR == 99) { %> All Day Events <%ELSE%> <%=Date::formatTime(&Date::LZ($HOUR)."00",$Config->{'time_format'})%> <%/IF%> </SPAN> </TD> <TD CLASS="thinborder" BGCOLOR="<%=$cellcolor2%>" VALIGN=TOP> <SPAN CLASS="text"> <%FOREACH EVENT%> <% if ($_SHOW_GRID_EVENT_BULLET) {%><%}%> <% if ($_SHOW_EVENT_TIMES eq "ALL" | | $_SHOW_EVENT_TIMES eq "START") { %> <% if ($EVENT->{'schedule'}->{'start_time'}) { %><%= SCHEDULE FIELD(start_time) %><% } %> <% } %> <% if ($_SHOW_EVENT_TIMES eq "ALL") { %> <% if ($EVENT->{'schedule'}->{'end_time'}) { %>-<%= SCHEDULE FIELD(end_time) %><% } %> <% } %> <% if (($_SHOW_EVENT_TIMES eq "ALL" | | $_SHOW_EVENT_TIMES eq "START") && ($EVENT->{'schedule'}->{'start_time'})) { %> : <% } %> <%= EVENT FIELD(title) %> <% if ($User->{'username'} ne "Administrator") { %> <%if ($EVENT->{details}->{category} eq 'appointment') {%> Booked <%} elsif ($EVENT->{details}->{category} eq 'block') {%> Unavailable <%}%> <%} elsif ($User->{'username'} eq "Administrator") { %> <%if ($EVENT->{details}->{category} eq 'appointment') {%> <FONT SIZE="2">[<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;">Appointment</A>]</FONT> <%} elsif ($EVENT->{details}->{category} eq 'block') {%> <FONT SIZE="2">[<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;">Unavalable</A>]</FONT> <%}%> <%}%> <BR> <%/FOREACH%> <%IF NO EVENTS EXIST%> <%/IF%> </SPAN> </TD> </TR> <%/FOREACH%></TABLE>
Cheers,Mike
I'm working on increments right now, so ignore the cells, but the shadeing looks good