This is just what I was looking for, thanks!
I made some changes:
- fix all day events
- add 'am' and 'pm' to times
- remove unnecessary lines
Here are the changes (this is in approve.html):
<%
$total = 0;
$config = $main::Config;
foreach $e (@$events) {
$total++;
$id = $e->{details}->{id};
$title = $e->{details}->{title};
$desc = $e->{details}->{description};
$author = $e->{details}->{author_name}." (".$e->{details}->{author_id}.")";
$event_id = $id;
$event = $events_db->getRecord( {'event_id'=>$event_id} );
$schedule = $schedule_db->getRecord( {'event_id'=>$event->{id}} );
$_static_dates_range = "dates";
if ($schedule) {
#foreach $key (sort keys %$schedule) { print "$key = $schedule->{$key}<BR>\n"; }
if ($schedule->{'recurrence_type'} eq "") {
my (@dates);
my ($occurences) = $schedule_db->getRecords( {'event_id'=>$event->{id}} );
if ($#{$occurences} > 0) {
# More than one occurrence
#print ("more than one occurrence");
foreach $occurence (@$occurences) {
push(@dates,&SimpleDateFormat::formatDate($occurence->{start},$config->get("date_format")));
}
$_static_dates_range = "dates";
$_static_dates = join(", ",@dates);
} else {
# Only one!
#print ("only once occurrence");
if ($schedule->{'start'} == $schedule->{end}) {
$_static_dates_range = "dates";
$_static_dates = &SimpleDateFormat::formatDate($schedule->{start},$config->get("date_format"));
} else {
$_static_dates_range = "range";
$_static_start_date = &SimpleDateFormat::formatDate($schedule->{start},$config->get("date_format"));
$_static_end_date = &SimpleDateFormat::formatDate($schedule->{end},$config->get("date_format"));
}
}
}
}
%>
<TR>
<TD ALIGN="center" VALIGN="top">
<SELECT NAME="APPROVE_<%=$id%>"><OPTION VALUE="">No Action</OPTION><OPTION VALUE="APPROVE">Approve</OPTION><OPTION VALUE="REJECT">Reject</OPTION></SELECT>
<BR>
<INPUT TYPE="button" CLASS="button" VALUE="Edit" onClick="edit_event('<%=$id%>')">
</TD>
<TD ALIGN="left" VALIGN="top"><table border=0 cellpadding=0>
<tr><td valign='top'><b>Title:</B><td><%=$title%><BR>
<tr><td valign='top'><b>Description:</B><td><%=$desc%><BR>
<tr><td><b>User:</B><td><%=$author%><BR>
<tr><td><b>Event ID:</B><td><font color=crimson><%= $id%></font><BR>
<tr><td valign='top'><b>Schedule:</B><td>
<%if($schedule) {
if ($schedule->{all_day}) { print 'all day';
} else {
($_start_hh,$_start_mm) = ($schedule->{start_time} =~ /(\d\d)(\d\d)/);
$_start_ampm = 'am';
if($_start_hh > 12) { $_start_hh -= 12; $_start_ampm = 'pm' }
($_end_hh,$_end_mm) = ($schedule->{end_time} =~ /(\d\d)(\d\d)/);
$_end_ampm = 'am';
if($_end_hh > 12) { $_end_hh -= 12; $_end_ampm = 'pm' }
print $_start_hh,':',$_start_mm,' ',$_start_ampm,
' to ',$_end_hh,':',$_end_mm,' ',$_end_ampm,' on';
}
print '<br>',$_static_dates;
} else {
print 'not scheduled';
}%>
<BR>
</table>
</TD>
</TR>
<% } %>
<% if ($total==0) { %>
------------------
See some of my modifications to CalendarScript at http://www.prayforoneanother.org/cgi-bin/cal/calendar.pl
[This message has been edited by mraj (edited March 19, 2005).]