I am receiving a "Undefined subroutine &Template::timegm called at (eval 1) line 58. " error message after I added your and Stephanie's code. Help! See http://www.headenver.org/cgi-bin/calendar.pl for the debug info.
Thanks all!
dw
use Time::Local;
somewhere before the call to timegm. You can also change all occurances of timegm to Time::Local::timegm if you'd rather. Completely up to you.
------------------David Whittaker http://www.uabcm.com/ http://www.csworkbench.com/
Between your and Stephanie's suggestions, I thought I had all the patches, but I guess not since neither the Time nor the Date is displaying! Now I'm really lost with this code. Here's my code for displaying the date:
code: <% if ($EVENT->{'schedule'}->{'start'}) { print &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format)) } %> <% if ($EVENT->{'schedule'}->{'end'} ne $EVENT->{'schedule'}->{'start'}) { print " - ", &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format)) } %>
<% if ($EVENT->{'schedule'}->{'start'}) { print &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format)) } %> <% if ($EVENT->{'schedule'}->{'end'} ne $EVENT->{'schedule'}->{'start'}) { print " - ", &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format)) } %>
and for the time display:
code: <% if ($EVENT->{'schedule'}->{'all_day'} == "1") { print "All Day" } else { if ($EVENT->{'schedule'}->{'start_time'}) { print &Date::formatTime($EVENT->{'schedule'}->{'start_time'}, $Config->get(time_format)) } if ($EVENT->{'schedule'}->{'end_time'} ne $EVENT->{'schedule'}->{'start_time'}) { print " - ", &Date::formatTime($EVENT->{'schedule'}->{'end_time'}, $Config->get(time_format)) } } %>
<% if ($EVENT->{'schedule'}->{'all_day'} == "1") { print "All Day" } else { if ($EVENT->{'schedule'}->{'start_time'}) { print &Date::formatTime($EVENT->{'schedule'}->{'start_time'}, $Config->get(time_format)) } if ($EVENT->{'schedule'}->{'end_time'} ne $EVENT->{'schedule'}->{'start_time'}) { print " - ", &Date::formatTime($EVENT->{'schedule'}->{'end_time'}, $Config->get(time_format)) } } %>
Ditto on all davidw's entries. I saw the Time::Local:: addition in the COLSPAN hack you did, so I added that, and I changed my code to read
code:<% if ($EVENT->{'schedule'}->{'start'}) { print &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format)) } %><% if ($EVENT->{'schedule'}->{'end'} ne $EVENT->{'schedule'}->{'start'}) { print " - ", &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format)) } %>
<% if ($EVENT->{'schedule'}->{'start'}) { print &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format)) } %><% if ($EVENT->{'schedule'}->{'end'} ne $EVENT->{'schedule'}->{'start'}) { print " - ", &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format)) } %>
------------------Stephanie MeemkenWebmaster, Minnesota Jayceeshttp://www.mnjaycees.org/
code: <%= $MONTH_NAME %> <%= $EVENT2->{schedule}->{date} %>, <%= $YEAR %>
<%= $MONTH_NAME %> <%= $EVENT2->{schedule}->{date} %>, <%= $YEAR %>
and the Time code:
code: <% if ($EVENT2->{'schedule'}->{'all_day'} == "1") { print "All Day" } else { if ($EVENT2->{'schedule'}->{'start_time'}) { print &Date::formatTime($EVENT2->{'schedule'}->{'start_time'}, $Config->get(time_format)) } if ($EVENT2->{'schedule'}->{'end_time'} ne $EVENT2->{'schedule'}->{'start_time'}) { print " - ", &Date::formatTime($EVENT2->{'schedule'}->{'end_time'}, $Config->get(time_format)) } } %>
<% if ($EVENT2->{'schedule'}->{'all_day'} == "1") { print "All Day" } else { if ($EVENT2->{'schedule'}->{'start_time'}) { print &Date::formatTime($EVENT2->{'schedule'}->{'start_time'}, $Config->get(time_format)) } if ($EVENT2->{'schedule'}->{'end_time'} ne $EVENT2->{'schedule'}->{'start_time'}) { print " - ", &Date::formatTime($EVENT2->{'schedule'}->{'end_time'}, $Config->get(time_format)) } } %>
Can anyone explain what I did, and are there any drawbacks???
Thanks Stephanie!dw
Make this your new getEvent section for the Event View:
code:elsif ($VIEW eq "Event") { use Time::Local; $EVENT->{'details'} = &getEvent($in{'event_id'}); $db = $main: BSchedule; $schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1); foreach (@$schedules) { if ($_->{event_id} == $EVENT->{details}->{id}) { $EVENT->{schedule} = $_; last; } } $db = $main: BEvents; $fields = &main: BGetFieldsInDisplayOrder($db); }
elsif ($VIEW eq "Event") { use Time::Local; $EVENT->{'details'} = &getEvent($in{'event_id'}); $db = $main: BSchedule; $schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1); foreach (@$schedules) { if ($_->{event_id} == $EVENT->{details}->{id}) { $EVENT->{schedule} = $_; last; } } $db = $main: BEvents; $fields = &main: BGetFieldsInDisplayOrder($db); }
Change the grid view details link to this:
code:<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>
<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>
Change the list view details link to this:
code:<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" STYLE="text-decoration:underline;" CLASS="text"><FONT COLOR="<%=EVENT FIELD(color)%>"><%= EVENT FIELD(title) %></FONT></A><BR>
<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" STYLE="text-decoration:underline;" CLASS="text"><FONT COLOR="<%=EVENT FIELD(color)%>"><%= EVENT FIELD(title) %></FONT></A><BR>
These last two I have only appended "&datestring=<%=$DAY->{datestring}%>" to the link. Everything else stays the same.
The day views require no changes because the datestring is already included in the QUERY_STRING.
In the event view section, I then added the following code after the foreach loop (before the </TABLE> tag).
code: <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B>Time: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"> <% $start = &Date::formatTime($EVENT->{'schedule'}->{'start_time'}, $Config->get(time_format)); $end = &Date::formatTime($EVENT->{'schedule'}->{'end_time'}, $Config->get(time_format)); if ($EVENT->{'schedule'}->{'all_day'} == "1") { print "All Day"; } else { print $start; if ($start ne $end) { print " - ", $end; } } %> </SPAN></TD></TR> <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B>Date: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"> <% $start = &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format)); $end = &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format)); print $start; if ( $start ne $end) { print " - ", $end; } %> </SPAN></TD></TR>
<TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B>Time: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"> <% $start = &Date::formatTime($EVENT->{'schedule'}->{'start_time'}, $Config->get(time_format)); $end = &Date::formatTime($EVENT->{'schedule'}->{'end_time'}, $Config->get(time_format)); if ($EVENT->{'schedule'}->{'all_day'} == "1") { print "All Day"; } else { print $start; if ($start ne $end) { print " - ", $end; } } %> </SPAN></TD></TR> <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B>Date: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"> <% $start = &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format)); $end = &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format)); print $start; if ( $start ne $end) { print " - ", $end; } %> </SPAN></TD></TR>
Alright. That works well on my machine. Notice that I didn't use the Time Display Mod, because the call to getEventsInRange at the top finds all the events for the selected day, and the foreach loop puts the event that matches the event we're looking at into the $EVENT->{schedule} hash, so it acts like a more powerful time display mod that actually gets the current event, not the first occurence. I hope you can get this working as well on your server as it does on mine. The only thing left to do is write a function that "describes" a recurring event, instead of just showing the date of the current one (like "Every Thursday" or "The first Wednesday of every month", etc.). But this works quite well, IMHO.
code:<A HREF="<%=$CGI_URL_QUERYSTRING%>popup=0&template=event_detail.html&event_id=<%= EVENT FIELD(id) %>&datestring=<%= $DAY->{datestring} %>" onClick="showDetails('<%= EVENT FIELD(id) %>&datestring=<%= $DAY->{datestring} %>');return false;"><%= EVENT FIELD(title) %></A>
<A HREF="<%=$CGI_URL_QUERYSTRING%>popup=0&template=event_detail.html&event_id=<%= EVENT FIELD(id) %>&datestring=<%= $DAY->{datestring} %>" onClick="showDetails('<%= EVENT FIELD(id) %>&datestring=<%= $DAY->{datestring} %>');return false;"><%= EVENT FIELD(title) %></A>
------------------Stephanie MeemkenWebmaster, Minnesota Jaycees http://www.mnjaycees.org/
[This message has been edited by kayleigh (edited May 04, 2002).]
I'm a bit wary of changing anything now (!) but I was wondering if it is possible to add the date underneath the coloured Event Title rather than at the bottom of the details? I've had a play about inserting the code at different points but it either produces odd results or just doesn't work.
many thanksBB
For instance, where you say "Make this your new getEvent section for the Event View:" I'm not sure which part of the code in the Event View (I could find that no problem) is the getEvent. Could you please modify your post and tell us exactly which lines get replaced. I think I speak for many of the users here.
Thank you very much!
------------------
quote:may I ask that you be a bit more precise with where the replacement code goes?
Find elsif ($VIEW eq "Event") { in the default.html template file towards the top.
Dan O.
ENTIRELY replaces this:
code:elsif ($VIEW eq "Event") {
elsif ($VIEW eq "Event") {
quote:So are you saying that ENTIRELY replaces elsif ($VIEW eq "Event") {
That any anything following it up until and including the closing } for the original block of code.
[This message has been edited by DanO (edited July 05, 2002).]
One last issue it seems. The datestring is emty when getting search results. The Title link to the details page does not contain it therefore the details are missing the date info (the date defaul to to a 1970 date).
So far I haven't been able to get the datestring value in the search result... Must be simple...
Any one as an idea?
Thanks.