Hello Dan O,
On the calendar.pl I replaced the following lines:
@{$Grid->{'grid'}->[$y]->[$x]->{'events'}} = sort { ($a->{'schedule'}->{'start'} <=> $b->{'schedule'}->{'start'}) | | ($a->{'details'}->{'id'} <=> $b->{'details'}->{'id'}) } @{$Grid->{'grid'}->[$y]->[$x]->{'events'}};
to:
@{$Grid->{'grid'}->[$y]->[$x]->{'events'}} = sort { $a->{'details'}->{'category'} cmp $b->{'details'}->{'category'} } @{$Grid->{'grid'}->[$y]->[$x]->{'events'}};
$EventList->{$Grid->{'grid'}->[$y]->[$x]->{'datestring'}} = sort { $a->{'details'}->{'category'} cmp $b->{'details'}->{'category'} } @{$Grid->{'grid'}->[$y]->[$x]->{'events'}};
These codes sort the events in alphabetical order based on the category.
I added a category field and listed the following categories in the select box.
O1_Test
02_Lecture
03_Lab
04_Homework
05_Holiday
06_Other
I wanted to print the categories in the above order.
In order to print the events in this order, I added numbers in front of each of the category name. Otherwise, Holiday will be printed first, followed with Homework, Lab, Lecture, Other, and Test.
I'm using the dayspan template and on the default.html
I added the following codes for color coding.
<%
if ($EVENT->{details}->{category} eq "01_Test") {$color="#ff0000";}
elsif ($EVENT->{details}->{category} eq "02_Lecture") {$color="#000000";}
elsif ($EVENT->{details}->{category} eq "03_Lab") {$color="#0000FF";}
elsif ($EVENT->{details}->{category} eq "04_Homework") {$color="#009900";}
elsif ($EVENT->{details}->{category} eq "05_Holiday") {$color="#FF66FF";}
elsif ($EVENT->{details}->{category} eq "06_Other") {$color="#990000";}
else {$color="#000000";}
%>
<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" CLASS="gridtext"><FONT COLOR="<%=$color%>"><%= EVENT FIELD(title) %></FONT></A><BR>
As for the line, I'd like to have a straight line that goes across each week, regardless of whether the section above or below the line is empty. And the line should be located below the dayspan line or section. I would like the homework events to be printed in the bottom half section of the box and other events on the top section of the box.
**You would have to put a conditional just before where the lines are printed out and insert an <HR> HTML tag when the category changed from one to another.**
Could you help me on the codes?
Thank you.
hawaiimikan
------------------
[This message has been edited by hawaiimikan (edited September 16, 2003).]