Update:
========I updated this code. The links correspond the javascript msgbox or confirm box or neither with the existance of either 1 desription box or the other or both or neither. If someone would like me to make a plug-in of this, I think I can (I'd have to put a copy of an edited template in the plugin directory). Here is the updated code:
Description: This hack will help those who don't like popup browser windows. This works in all calendar templates. This just pops up a JavaScript box with a basic event description (the viewer can also hover over the link to see the popup description). This gives the viewer the option of either choosing to go to a browser popup to see the detailed event description in html version or not. There have to be two descriptions so that you don't run into any HTML errors (just incase you put links or other html codes into your detailed descriptions). This is also useful for those visitors you have with slow internet connections. Go to http://www.sheltoncma.org/ for the SSI example, or go to http://www.sheltoncma.org/cgi-bin/calendar/calendar.pl for the grid example.
===** Keep Backups of the changes or put old codes inside <!-- (old code) --> **===
Installation:
Files you need to Edit:
* SSI.html (calendarscript\templates\calendars\{THE CALENDAR TEMPLATE}\ssi.html
* DEFAULT.html (calendarscript\templates\calendars\{THE CALENDAR TEMPLATE}\default.html
I.)
Go in the the Admin interface, then to Customize Event Fields, and add a field called: "description2" (without the quotes). This field will be the place you add the description for the popup, whereas the description field is for the popup window (If the person chooses to click OK). This is so you can have HTML in the description, without ruining your popup confirm box.
II.) SSI.html Changes
Look underneath "<%FOREACH EVENT%>"; find the bullet ( ); add this right before the code that prints the title ( <%= $EVENT->{'details'}->{'title'} %> ):
<% if ($EVENT->{details}->{description2} ne "") { %>
<% if ($EVENT->{details}->{description} ne "") { %>
<script language="JavaScript">
var event<%=$EVENT->{'details'}->{'id'}%> = "<%=$EVENT->{'details'}->{'description2'} %> \n \n"
</script>
<A HREF="JavaScript:showDetails('<%=$EVENT->{'details'}->{'id'}%>')" oldHREF="<%=$CGI_URL_QUERYSTRING%>popup=0&template=event_detail.html&event_id=<%=$EVENT->{'details'}->{'id'}%>" onClick="javascript:return confirm('Description: ' + event<%=$EVENT->{'details'}->{'id'}%> + '\n Click OK for more information. \n Click CANCEL if you do not need more information');" title="Description: <%= $EVENT->{'details'}->{'description2'} %>"> <% } %> <% } %>
<% if ($EVENT->{details}->{description2} ne "") { %>
<% if ($EVENT->{details}->{description} eq "") { %>
<script language="JavaScript">
var event<%=$EVENT->{'details'}->{'id'}%> = "<%=$EVENT->{'details'}->{'description2'} %> \n \n"
</script>
<A HREF="#" onClick="javascript:alert('Description: ' + event<%=$EVENT->{'details'}->{'id'}%> ); return false" title="Description: <%= $EVENT->{'details'}->{'description2'} %>"> <% } %> <% } %>
<% if ($EVENT->{details}->{description} ne "") { %>
<% if ($EVENT->{details}->{description2} eq "") { %>
<A HREF="<%=$CGI_URL_QUERYSTRING%>popup=0&template=event_detail.html&event_id=<%=$EVENT->{'details'}->{'id'}%>" onClick="showDetails('<%=$EVENT->{'details'}->{'id'}%>');return false;">
<% } %> <% } %>
III.) DEFAULT.html Changes
Replace all of the event links that look like this (right before the code for printing the event title):
<A HREF="<%=$CGI_URL_QUERYSTRING%>popup=0&template=event_detail.html&event_id=<%=$EVENT->{'details'}->{'id'}%>" onClick="showDetails('<%=$EVENT->{'details'}->{'id'}%>');return false;">
With This:
<% if ($EVENT->{details}->{description2} ne "") { %>
<% if ($EVENT->{details}->{description} ne "") { %>
<script language="JavaScript">
var event<%=$EVENT->{'details'}->{'id'}%> = "<%=$EVENT->{'details'}->{'description2'} %> \n \n"
</script>
<A HREF="JavaScript:showDetails('<%=$EVENT->{'details'}->{'id'}%>')" oldHREF="<%=$CGI_URL_QUERYSTRING%>popup=0&template=event_detail.html&event_id=<%=$EVENT->{'details'}->{'id'}%>" onClick="javascript:return confirm('Description: ' + event<%=$EVENT->{'details'}->{'id'}%> + '\n Click OK for more information. \n Click CANCEL if you do not need more information');" title="Description: <%= $EVENT->{'details'}->{'description2'} %>"> <% } %> <% } %>
<% if ($EVENT->{details}->{description2} ne "") { %>
<% if ($EVENT->{details}->{description} eq "") { %>
<script language="JavaScript">
var event<%=$EVENT->{'details'}->{'id'}%> = "<%=$EVENT->{'details'}->{'description2'} %> \n \n"
</script>
<A HREF="#" onClick="javascript:alert('Description: ' + event<%=$EVENT->{'details'}->{'id'}%> ); return false" title="Description: <%= $EVENT->{'details'}->{'description2'} %>"> <% } %> <% } %>
<% if ($EVENT->{details}->{description} ne "") { %>
<% if ($EVENT->{details}->{description2} eq "") { %>
<A HREF="<%=$CGI_URL_QUERYSTRING%>popup=0&template=event_detail.html&event_id=<%=$EVENT->{'details'}->{'id'}%>" onClick="showDetails('<%=$EVENT->{'details'}->{'id'}%>');return false;">
<% } %> <% } %>
You should have had to replace it in the List format area and the Grid format area.
+ Make sure you have the href before the title code, but after the time code.
++ Also, MAKE SURE that there is a </a> tag after the title.
IV.) !IMPORTANT INSTRUCTIONS!
If you need to use quotes or apostrophes, put a back-slash (\) before it. Also, to make a line break (new line) put \n before it. Here is a sample
Type this into your address bar and hit return:
javascript:alert("\"Title\"\nFirst Line\n\'Second Line\'\nThird Line");
What you see there is what you get if you use this string in your descript2 field:
\"Title\"\nFirst Line\n\'Second Line\'\nThird Line
V.) TRY OUT YOUR HACK AND MAKE SURE IT WORKS PROPERLY.
If you find bugs, have questions or comments, reply back! Or email me at webmaster@sheltoncma.org
Thanks for trying this hack!
============
Joe Sartori
cal@sheltoncma.org
http://www.sheltoncma.org/
[This message has been edited by JSartori21367 (edited December 28, 2003).]