I'm wanting a solution to color code events based on the user, and is scalable.
I have already implemented a solution, but as the calendars grow I'm finding this wasn't a scalable solution.
Here is what I did.
At the top of the template(default.html) I added this routine:
<%
sub myClass {
my $author_id = $EVENT->{details}->{author_id};
return $author_id;
}
%>
It's purpose is simply to return the author_id.
The routine is called everywhere events are generated. I use a div tag in this context:
<DIV class="<%= &myClass %>">
# Events are generated from tags here, normally
</DIV>
Next, I added styles for each user(author_id). So for example:
.medMeeting { background=#6699FF; }
was added in the style sheet, and there is a user named "medMeeting."
This way each event will have a div tag around it and the class will correspond to the author_id. The author_id is also in the style sheet, thus each event is color coded by the user.
Here is where it begins to spin out of control. When we want to color code events, we must login as that user and ad the event. This isn't too bad if there are only a couple of users. However, this is no longer the case :-(
Not to mention that this is a headache, going in and modifying the style sheet each time a user is added is more maintence. Let me point out, that when I say user, I'm thinking of it as an event category. That category is what I'm wanting color coded.
So, what am I looking for? I want a better solution that gives the functionality I'm looking for. It scales well and is easy to maintain.
One solution I'm thinking about is...
Each calendar has one "super user". This user can post to this calendar only.
On the admin tool where you add an event. Have a drop down menu that is generated dynamically listing the users for this calendar. The user is selected (remember this is category type for color coding), enters the event as normal. When they submit the event. The event is automatically wrapped in font tag specifying a color(no style sheet needed). Then it is stored in the events file. So, when the event is next pulled it will display with color. Problem here is, the text will be colored. I'm sure I can work it out with a div tag that specifies style, so I get a colored block (yea good idea).
There are some other small items that need to be worked out like a list of colors, associating the user with a color in a config table, etc.
One thing I'd like to avoid here is modifying the script so much that future upgrades won't be applicable.
Disclaimer--
I'm thinking out loud here so if I've said something stupid it wasn't me. ;-)
thanks for you input in advance,
Byron