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


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: 1 [2]   Go Down
Print
Author Topic: Mouseover swap display  (Read 816 times)
0 Members and 1 Guest are viewing this topic.
SoulBoy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #15 on: January 02, 2004, 05:13:00 PM »

I cant link right to the file without getting a 500 internal server error. But here is a txt file of the code:
http://216.194.96.172/test.txt

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #16 on: January 03, 2004, 06:27:00 AM »

The code looks right, you could try putting spaces around the $DAY->{'dd'} variable to see if that helps. Eg.

<%FOREACH EVENT%>
linktext[<% $DAY->{'dd'} %>] .= " <%= EVENT FIELD(title) %><br><%= EVENT FIELD(description) %><br>"
<%/FOREACH%>

If that doesn't work you could try making a separate variable to hold the day value like:

<%FOREACH EVENT%>
<% $daynumber = $DAY->{'dd'}; %>
linktext[<% $daynumber %>] .= " <%= EVENT FIELD(title) %><br><%= EVENT FIELD(description) %><br>"
<%/FOREACH%>

BTW. You might also want to move the <%/FOREACH%> tag to the following line as shown in the code above. In the page code you linked to, it is directly at the end of the linktext[ ... line.

Dan O.

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

Logged
SoulBoy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #17 on: January 03, 2004, 10:10:00 AM »

Thanks so much for your help Dan. You are awesome! Still no luck tho.

I've tried another approach and had some success. I've hacked  my tooltip template to make it appear to do the same thing. The only problem I have with that script (which has always been a problem) is that if you have an event or event description with the single quote character -->  '  <--
Then it will break the popup for that event.

For example, if your event title is:

"It's your birthday!"

It will not show the popup because of the single quote used in the word "it's". However, if I just made the event description

"Its your birthday!"

Then it would work fine.

This is obviously because of the onMouseover event which looks something like this:

ONMOUSEOVER="popup('It's your birthday')";

So obviously, when the event with a single quote is put into the mouseover event, it breaks it.

So I guess I have a question. Is there a way to tell the script to ignore any single quotes within the event? Or a method that I could use to get it to work if an evnt has that character? I know I could go through all my events and just make sure I don't add any single quotes, but that sort of sucks.

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #18 on: January 03, 2004, 04:47:00 PM »

** Is there a way to tell the script to ignore any single quotes within the event? **

That should read "to tell the JavaScript to ..." as that is the problem, not CalendarScript.

Yes, escape them. That is done by putting a "\" (without the quotes) in front of the offending character.

Dan O.

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

Logged
SoulBoy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #19 on: January 05, 2004, 09:00:00 AM »

"That should read "to tell the JavaScript to ..." as that is the problem, not CalendarScript."


Yep   that's what I ment.


"Yes, escape them. That is done by putting a "\" (without the quotes) in front of the offending character."


I've been trying to come up with a way so when the events are loaded, that I can get the javascript to automatically replace any  '  with  \'

Something like:

<SCRIPT> var SwapText = "<%FOREACH EVENT%><%= SCHEDULE FIELD(start_time) %> <%= EVENT FIELD(title) %> <%= EVENT FIELD(description) %><br><br><%/FOREACH%>"; SwapText = SwapText.replace(/\'/g, "\'");
document.write(SwapText)
</script>

Now, that would call all the events in the month and if they had a ' character it would replace it with \'

But I'm sort of lost as to where I should be using this (or if it's possible) with what I have so far.

My brain has been fried. lol

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #20 on: January 05, 2004, 02:11:00 PM »

**  that I can get the javascript to automatically replace any ' with \' **

It might be easier for the calendar to do that using Perl. Just have it done in the script template and output directly in the code which generates the JavaScript.

Something like <%= $EVENT->{details}->{description} =~ s/'/\\'/g %>

Note: You'd likely have to escape the \ (\\) as shown in the example above.

Dan O.

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

Logged
Pages: 1 [2]   Go Up
Print
Jump to: