Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8016 Posts in 1849 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityMaking CalendarScript BetterSuggestions and Ideas (Moderators: scott, DanO, Marty)add event title allow color choice to display
Pages: [1]   Go Down
Print
Author Topic: add event title allow color choice to display  (Read 1014 times)
0 Members and 1 Guest are viewing this topic.
Eric
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: January 11, 2003, 09:20:00 AM »

Is there any way to get a drop down box that would allow someone that enters in the title field a color choice.
this works but is a pain for some.
TITLE:  <font color="red">STEVE - INVOICE
this will change the title color on the calendar. so I must be a fairly easy add to the code to get a drop down box with just words like red, blue, green etc.

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #1 on: January 12, 2003, 02:32:00 AM »

Ok, this is going to take just a little bit of work.  First, you'll need to add a color field to your events by going to Customize Event Fields in the admin area, then clicking on Add New Field.  Then change the following parameters (notice case):

Display Name: Color
Unique Field ID: color
Description: color
Required: yes
Display in Add Form: yes
Display in Details: no
Searchable: no
Input type: Selectbox

Then put each color that you want to be a choice in Display Text AND Option Value, and click add after each one.  The should fill up the list box in the middle.  Click Make Default on the one that you want to be the default, then save it.  You might want to move it up so it's closer to the title, then click Save Order.

Now you're ready to edit the template.  Open your calendarscript/templates/calendars/default directory (substitute the name of your template for default if you aren't using the default template).  Then open default.html in your favorite text editor.  Around line 34 of the file you'll see:

%>
<HTML>

Just before that closing %>, add this code:

code:

sub colorize {
   my $details = shift;
   $details->{'title'} = "<font color='" . $details->{'color'} . "'>" . $details->{'title'} . "</font>";
   }

if ($VIEW eq "EVENT") {
   colorize ($EVENT->{'details'});
   }
elsif ($VIEW ne "Search") {
   foreach $EVENT (@$EVENTS) {
      colorize ($EVENT->{'details'});
      }
   }
else {
   foreach $EVENT (@$SEARCH_RESULTS) {
      colorize ($EVENT->{'details'});
      }
   }


That should get all the titles surrounded by the font color tags.  If you want more than the title to be colored, you have to go through each section of the template, and wrap everything you want colored with:
<FONT color="<%=$EVENT->{'details'}->{'color'}%>">stuff you want colored.</FONT>

Hope that helps.

------------------
David Whittaker
http://www.uabcm.com
http://bama.ua.edu/~whitt013

Logged

Eric
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: January 12, 2003, 03:29:00 PM »

I tried it but it only made a new field with the colors i choose but when you select them it does not change the color of the entry on the calender. I get no errors in the script. I did everything you said. and thanks for the quick response on the last post.

------------------

Logged
Eric
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: January 12, 2003, 04:21:00 PM »

So sorry but I did not do everything you said!
I actually edited the wrong template. i forgot i was using the full year template. Thanks and it worked great! just what I wanted

------------------

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #4 on: January 12, 2003, 04:26:00 PM »

Great, glad to hear it.... I was beginning to wonder after I read your first post, I actually tested that one  

------------------
David Whittaker
http://www.uabcm.com
http://bama.ua.edu/~whitt013

Logged

eagledancing
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #5 on: February 29, 2004, 12:27:00 PM »

Great post thank you.

Need a abit of assistance here.  (I am not a programmer, however, I can usually follow instructions fairly well   )

We have an event custom field called eventlocation for all our calendars. On the Meta Calendar only, we wish to color code each event Title accordingly.

We have defined three choices:

OSC
Physical Location
Other Web

and we would like the title of the event in any calendar view of the Meta Calendar only (list, grid) color coded; leaving the color code alone for the event display (coming from the actual individual calendars as it is now)and leaving the individual calendars to display as they display now.

On the Meta Calendar the colors for each we would like:

OSC #2936A4

Physical Location #E6CF5E

Other Web #F2909F

Thank you for your assistance.

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 217

Please don't PM me. Post in the open forum.


WWW
« Reply #6 on: February 29, 2004, 03:20:00 PM »

** we would like the title of the event in any calendar view of the Meta Calendar only **

TubaDave's code suggestion at the other forum message I pointed you to (Color coding Events)
is closer to what  you're trying to accomplish than the solution in this message.

One thing which would need to be added to that other code (besides the
changes of the variable name and value the conditionals are based on) is
- if ($METACALENDAR eq $CALENDAR_KEY) -
for the conditional to take into account the meta calendar display only. Eg.

if ($EVENT->{details}->{category} eq "cultural" && $METACALENDAR eq $CALENDAR_KEY) {$color="#00FFFF";}

The category, cultural and value for $color being what needs to be changed
to suit your particular application. So in your case it would be something like:

if ($EVENT->{details}->{eventlocation} eq "OSC" && $METACALENDAR eq $CALENDAR_KEY) {$color="#2936A4";}


Dan O.


[This message has been edited by DanO (edited February 29, 2004).]

Logged
mcerchiaro
New Member
*

Karma: 0
Offline Offline

Posts: 0

Asst. Dir. of Development


WWW
« Reply #7 on: September 12, 2005, 06:48:00 AM »

I applied the color choice field as instructed above...it works great on the default calendar. How do I get the colors to work also when the events show up on the ssi.html calendar?

Thanks!
Mike

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 217

Please don't PM me. Post in the open forum.


WWW
« Reply #8 on: September 12, 2005, 09:20:00 PM »

** How do I get the colors to work also when the events show up on the ssi.html calendar? **

You'd have to modify the ssi.html template in a similar fashion.

Dan O.

------------------

Logged
mcerchiaro
New Member
*

Karma: 0
Offline Offline

Posts: 0

Asst. Dir. of Development


WWW
« Reply #9 on: September 23, 2005, 09:12:00 AM »

I tried placing the code in the same spot for the ssi template as the default calendar template...it didn't work. So my question is, how do I modify the ssi template to allow the selected colors to come through?

Thanks!
Mike

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 217

Please don't PM me. Post in the open forum.


WWW
« Reply #10 on: September 23, 2005, 12:12:00 PM »

** how do I modify the ssi template to allow the selected colors to come through? **

I'm afraid I don't know the exact code you'd use without doing the modifications myself (and I charge for that). You can try changing the line:

<%= $EVENT->{'details'}->{'title'} %>

to

<% colorize ($EVENT->{'details'}) %>
<%= $EVENT->{'details'}->{'title'} %>

    This code is un-tested.

Dan O.

[This message has been edited by DanO (edited September 23, 2005).]

Logged
mcerchiaro
New Member
*

Karma: 0
Offline Offline

Posts: 0

Asst. Dir. of Development


WWW
« Reply #11 on: September 26, 2005, 07:09:00 AM »

I'll try it.

Thanks!
Mike

------------------

Logged
william
Guest
« Reply #12 on: June 29, 2006, 04:54:00 AM »

Using the fulldayyear template I have managed to do the drop down colour code for text is there any way of chaning the background colour also?
Logged
Pages: [1]   Go Up
Print
Jump to: