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
Calendar Script CommunityCustomizationCustomizing CalendarScript (Moderators: scott, DanO, Marty)Adding Date and Time to Event View
Pages: 1 [2] 3   Go Down
Print
Author Topic: Adding Date and Time to Event View  (Read 1539 times)
0 Members and 1 Guest are viewing this topic.
odysious
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #15 on: March 10, 2006, 08:44:00 AM »

I know this is an old thread but I was directed to it. Could someone assemble a complete listing of this mod. Please. I have been tring to get this to work but all I keep getting are errors.

I was able to fix most of the errors with the exception of one. I get an error on line 63 which refers to this line:

$schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1);

I see others have have this issue but it does not seem to have been addressed directly here.

PS: I looked into the Meta Calendar plug-in but it was no help tp me.

Thanks.

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

Logged
odysious
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #16 on: March 17, 2006, 06:55:00 AM »

Anyone? No help???

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

Logged
odysious
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #17 on: March 17, 2006, 09:53:00 AM »

Ok forget it. I got it working. The instructions above are all wrong.

Thanks anyways.

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

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: March 17, 2006, 12:33:00 PM »

** I got it working. **

Glad to hear it.

Any chance you'd be willing to let others know how to do it?

Dan O.

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

Logged
odysious
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #19 on: March 17, 2006, 02:09:00 PM »

** Any chance you'd be willing to let others know how to do it? **

I did a lot of changed through trial and error but here goes. Hopefully I remember everything.
There was no edits done to the Calendar.pl file.


1) Open default.html

2) Find the following code:
Please note for all instances of : D remove the space between the : and the D

code:

elsif ($VIEW eq "Event") {
   $EVENT->{'details'} = &getEvent($in{'event_id'});
   $db = $main:: DBEvents;
   $fields = &main:: DBGetFieldsInDisplayOrder($db);
   }


Replace with the following code:


code:

elsif ($VIEW eq "Event") {
use Time::Local;
   $EVENT->{'details'} = &getEvent($in{'event_id'});
   $db = $main:: DBSchedule;
   $schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1);
   foreach (@$schedules) {
      if ($_->{event_id} == $EVENT->{details}->{id}) {
         $EVENT->{schedule} = $_;
         last;
         }
      }
$db = $main:: DBEvents;
$fields = &main:: DBGetFieldsInDisplayOrder($db);
}

3) Look for the following code:

code:

<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>

Replace with the following code:

code:

<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>

4) Look for the following code:

code:

<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;" CLASS="text"><%= EVENT FIELD(title) %></A><BR>

Replace with the following code:

code:

<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" STYLE="text-decoration:underline;" CLASS="text"><FONT COLOR="<%=EVENT FIELD(color)%>"><%= EVENT FIELD(title) %></FONT></A><BR>


5) Find the following code:

code:

<%-- EVENT VIEW --%>
      <% } elsif ($VIEW eq "Event") { %>
      <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0">
         <%
         foreach (@$fields) {
            next unless ($db->{'properties'}->{$_}->{'display_details'});
         %>
            <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B><%=$db->{'properties'}->{$_}->{'name'}%>: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"><%=$EVENT->{details}->{$_}%></SPAN></TD></TR>
         <% } %>
      </TABLE>

Replace with the following code:

code:

<%-- EVENT VIEW --%>
      <% } elsif ($VIEW eq "Event") { %>
      <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="2">
      
         <TR>
            <TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B>Time: </B></SPAN></TD>
            <TD ALIGN="left" VALIGN="top"><SPAN CLASS="text">         
            <%            
               $start = &Date::formatTime($EVENT->{'schedule'}->{'start_time'}, $Config->get(time_format));            
               $end = &Date::formatTime($EVENT->{'schedule'}->{'end_time'}, $Config->get(time_format));            
               if ($EVENT->{'schedule'}->{'all_day'} == "1") { print "All Day"; }            
               else {               
                  print $start;               
                  if ($start ne $end) { print " - ", $end; }            
               }         
            %>         
            </SPAN>
            </TD>
         </TR>         
         <TR>
            <TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B>Date: </B></SPAN></TD>
            <TD ALIGN="left" VALIGN="top"><SPAN CLASS="text">         
            <%            
               $start = &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format));            
               $end = &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format));            
                  print $start;            
                  if ( $start ne  $end) { print " - ", $end; }         
            %>         
            </SPAN>
            </TD>
         </TR>
      
         <%
         foreach (@$fields) {
            next unless ($db->{'properties'}->{$_}->{'display_details'});
         %>

         <TR>
            <TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B><%=$db->{'properties'}->{$_}->{'name'}%>: </B></SPAN></TD>
            <TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"><%=$EVENT->{details}->{$_}%></SPAN></TD>
         </TR>
      <% } %>
      </TABLE>


That should do it. It worked for me.

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


[This message has been edited by odysious (edited March 17, 2006).]

[This message has been edited by odysious (edited March 17, 2006).]

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: March 17, 2006, 09:15:00 PM »

Thanks for the contribution. Hopefully it will help others.

Dan O.

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #21 on: March 18, 2006, 01:55:00 PM »

BTW. I don't know if you need to modify the links adding the &datestring=<%=$DAY->{datestring}%>.
You don't seem to be using it in your code to display the date or time(s).

JFYI

Dan O.

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

Logged
beneath_the_ashes
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #22 on: June 03, 2006, 02:58:00 AM »

i dont suppose you found the way to show the date range?

Or for reoccuring events, have the date show...."Every Tuesday", etc....

i just randomly found a link to this thread and saw some more activity on it, so i figured i could ask again...

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

Logged
cosmocanuck
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #23 on: August 14, 2006, 01:22:00 AM »

Hi there,

This seemed like the answer to my prayers, but it only half works. I followed Odysious' step by step instructions... but I couldn't find the code in my (already  somewhat customized) template to complete Step 3. I'm sure that's the cause of the following problem:

It works when I click on an event's "Details" link in Day view. However, when I click on the same event via the Search results page, I get a blank where the time should be, and 1/1/1970 as the date. (Every time.)

Hope you can help!!!

Thanks,
Cosmo

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #24 on: August 14, 2006, 12:00:00 PM »

** when I click on the same event via the Search results page, I get a blank
where the time should be, and 1/1/1970 as the date. **

Did you update the links in the search results part of the template?

Dan O.

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

Logged
Junun
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #25 on: August 23, 2006, 02:09:00 PM »

One problem i'm running into is that the code works great for me when clicking from the calendar. But if i SSI call on a main page to display a list of events, when clicked from there i get teh 1/1/1970 date. Any ideas what would be causing it?

if anyone is interested in checking it out, the site i maintain can be found at http://www.crandalllibrary.org  

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #26 on: August 23, 2006, 05:15:00 PM »

** But if i SSI call on a main page to display a list of events, when clicked
from there i get teh 1/1/1970 date. **

Did you update the links in ssi.html (or whichever) template you're using to pass the dates?


Dan O.

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

Logged
Junun
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #27 on: August 24, 2006, 08:05:00 AM »

Thank you very much DanO sir. That was an easy fix that i completely over looked.
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #28 on: August 24, 2006, 01:32:00 PM »

**  That was an easy fix that i completely over looked **

Glad to hear it.

Maybe you could post the instructions in case someone else attempts to
also use the SSI template with this mod?

Dan O.

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

Logged
Junun
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #29 on: August 24, 2006, 02:36:00 PM »

DanO, can you delete my previoius post. I dont think it is very helpful.

What I did to fix the problem was add the date string to the a href link in the SSI file.

The line will look something like this:
<A HREF="<%=$CGI_URL%>?calendar=<%=$in{'calendar'}%>&view=Event&event_id=<%= EVENT FIELD(id) %>" >

You need to change it to this:
<A HREF="<%=$CGI_URL%>?calendar=<%=$in{'calendar'}%>&view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" >

This adds the date string to the link so that when a user clicks on it it takes them to the calendar showing the proper date...not 01/01/1970. Hope this helps anyone else who might be having a problem

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