EDIT:
OK, I've gotten a lot of requests for everything on one page. Hopefully this will do it.
Adding the time to the event view has already been covered here: http://www.calendarscript.com/support/forum/Forum4/HTML/000009.html
and adding the date has been covered here: http://www.calendarscript.com/support/forum/Forum4/HTML/000169.html
but in a rather jumbled way.
For all you newbies out there (like me) here's a condensed HOW-TO on getting this working.
BEWARE: The smiley's here are actual colon D's. That's colon-space-D. You'll need to change that in the pasted code or things won't work. I may have missed a few so be careful!
First you need to get the time to work. This required editting calendar.pl so be sure to make a backup!
Thanks to Kent for this mod:
1) In Calendar.pl,
Find:
code:
# Call-back method to get events
*Template::getEvents = \&getEvents;
*Template::getEvent = \&getEvent;
Replace with:
code:
# Call-back method to get events
*Template::getEvents = \&getEvents;
*Template::getEvent = \&getEvent;
*Template::getEvent2 = \&getEvent2;
2) Also in Calendar.pl,
Find the subroutine "getEvent", below it add this new subroutine:
code:
##################################################
# Subroutine called by Template to get the schedule
##################################################
sub getEvent2 {
my ($id2) = @_;
my ($db2) = new DBFile($schedule_db);
my ($event2) = $db2->getRecord( {'event_id'=>$id2 } );
return $event2;
}
3) Almost done... Open default.html
Find:
code:
elsif ($VIEW eq "Event") {
$EVENT->{'details'} = &getEvent($in{'event_id'});
$db = $main: BEvents;
$fields = &main: BGetFieldsInDisplayOrder($db);
Replace with:
code:
elsif ($VIEW eq "Event") {
$EVENT->{'details'} = &getEvent($in{'event_id'});
$db = $main: BEvents;
$fields = &main: BGetFieldsInDisplayOrder($db);
$EVENT2->{'schedule'} = &getEvent2($in{'event_id'});
4) Lastly, add the new fields in the html display area.
On default.html, find the event-only html display area.
code:
<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0">
<%
foreach (@$fields) {
next unless ($db->{'properties'}->{$_}->{'display_details'});
%>
to
code:
<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0">
<TR>
<TD ALIGN="right"><STRONG>Date:</STRONG></TD>
<TD><%= $MONTH_NAME %> <%= $DATE %>, <%= $YEAR %></TD>
</TD>
<SPAN CLASS="text"><TR>
<TD ALIGN="right"VALIGN="top"><B>Time:</B></TD>
<TD ALIGN="left" VALIGN="top">
<% if ( $EVENT2->{'schedule'}->{'all_day'})
{
print "All Day";
}
elsif ($EVENT2->{'schedule'}->{'start_time'} == $EVENT2->{'schedule'}->{'end_time'})
{
print
&Date::formatTime($EVENT2->{schedule}->{start_time},
$Config->get("time_format"));
}
#----DISPLAYS START AND END TIMES
else
{
print
&Date::formatTime($EVENT2->{schedule}->{start_time},
$Config->get("time_format")), " - ",
&Date::formatTime($EVENT2->{schedule}->{end_time} ,
$Config->get("time_format"));
}%> </TD>
</TR></SPAN>
<%
foreach (@$fields) {
next unless ($db->{'properties'}->{$_}->{'display_details'});
%>
This will display the dates. Thanks go to TubaDave
At the top of default.html change
code:
elsif ($VIEW eq "Event") {
$EVENT->{'details'} = &getEvent($in{'event_id'});
$db = $main: BEvents;
$fields = &main: BGetFieldsInDisplayOrder($db);
}
to
code:
elsif ($VIEW eq "Event") {
$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);
}
Now go to the EVENT VIEW section. Here's the code I added to display the date.
code
<TR>
<TD ALIGN="right"><STRONG>Date:</STRONG></TD>
<TD><%= $MONTH_NAME %> <%= $DATE %>, <%= $YEAR %></TD>
</TD>
That should do it!
[This message has been edited by canadaman (edited June 19, 2003).]