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] 3 4   Go Down
Print
Author Topic: Adding Date to Event page  (Read 2985 times)
0 Members and 1 Guest are viewing this topic.
davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #15 on: May 02, 2002, 06:14:00 PM »

DaveTuba,

I am receiving a "Undefined subroutine &Template::timegm called at (eval 1) line 58. " error message after I added your and Stephanie's code.  Help!  See http://www.headenver.org/cgi-bin/calendar.pl  for the debug info.

Thanks all!

dw

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #16 on: May 02, 2002, 06:18:00 PM »

Oh, yeah.  Put:

use Time::Local;

somewhere before the call to timegm.  You can also change all occurances of timegm to Time::Local::timegm if you'd rather.  Completely up to you.

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #17 on: May 02, 2002, 06:46:00 PM »

Oh yeah... you said "Oh yeah"!  :-)  Just teasing.  I'm glad you are still monitoring the board!  Adding that fixed the error.

Between your and Stephanie's suggestions, I thought I had all the patches, but I guess not since neither the Time nor the Date is displaying!  Now I'm really lost with this code.  Here's my code for displaying the date:

code:

          <% if ($EVENT->{'schedule'}->{'start'}) {
                print &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format)) } %>
          <% if ($EVENT->{'schedule'}->{'end'} ne $EVENT->{'schedule'}->{'start'}) {
                print " - ", &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format)) } %>
                     

and for the time display:

code:

          <% if ($EVENT->{'schedule'}->{'all_day'} == "1") { print "All Day" }
             else
             {
              if ($EVENT->{'schedule'}->{'start_time'}) {
                  print &Date::formatTime($EVENT->{'schedule'}->{'start_time'}, $Config->get(time_format)) }
              if ($EVENT->{'schedule'}->{'end_time'} ne $EVENT->{'schedule'}->{'start_time'}) {
                  print " - ", &Date::formatTime($EVENT->{'schedule'}->{'end_time'}, $Config->get(time_format)) }
              }
          %>
         


Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
kayleigh
New Member
*

Karma: 0
Offline Offline

Posts: 0

Computer Analyst


WWW
« Reply #18 on: May 02, 2002, 07:35:00 PM »

TubaDave,

Ditto on all davidw's entries. I saw the Time::Local:: addition in the COLSPAN hack you did, so I added that, and I changed my code to read

code:

<% if ($EVENT->{'schedule'}->{'start'}) {
   print &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format)) } %>
<% if ($EVENT->{'schedule'}->{'end'} ne $EVENT->{'schedule'}->{'start'}) {
   print " - ", &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format)) } %>


but I get nothing back on the code. Poop!

------------------
Stephanie Meemken
Webmaster, Minnesota Jaycees
http://www.mnjaycees.org/

Logged

Stephanie Meemken
Webmaster, Minnesota Jaycees

http://www.mnjaycees.org/
davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #19 on: May 02, 2002, 07:42:00 PM »

Well I can't say I totally understand, but I can hack a solution!  Here's the Date code I got to work:

code:

          <%= $MONTH_NAME %> <%= $EVENT2->{schedule}->{date} %>, <%= $YEAR %>

and the Time code:

code:

          <% if ($EVENT2->{'schedule'}->{'all_day'} == "1") { print "All Day" }
             else
             {
                if ($EVENT2->{'schedule'}->{'start_time'}) {
                   print &Date::formatTime($EVENT2->{'schedule'}->{'start_time'}, $Config->get(time_format)) }
                if ($EVENT2->{'schedule'}->{'end_time'} ne $EVENT2->{'schedule'}->{'start_time'}) {
                   print " - ", &Date::formatTime($EVENT2->{'schedule'}->{'end_time'}, $Config->get(time_format)) }
             } %>


Can anyone explain what I did, and are there any drawbacks???

dw

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
kayleigh
New Member
*

Karma: 0
Offline Offline

Posts: 0

Computer Analyst


WWW
« Reply #20 on: May 02, 2002, 07:56:00 PM »

You (I think) will list the current month & year, kinda like the problem we started with.

------------------
Stephanie Meemken
Webmaster, Minnesota Jaycees
http://www.mnjaycees.org/

Logged

Stephanie Meemken
Webmaster, Minnesota Jaycees

http://www.mnjaycees.org/
davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #21 on: May 02, 2002, 10:38:00 PM »

So far my testing is listing the correct month.  Have you had a chance to view the calendar?  Take a look at http://www.headenver.org/cgi-bin/calendar.pl.   Let me know how it displays for you.

Thanks Stephanie!
dw

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #22 on: May 03, 2002, 12:56:00 AM »

Ok.  I (finally) had time to actually put this hack in my debugging calendar (on my local apache server), and I came up with the following combination of mods.  It will display the correct date (or range of dates) for any contiguous event, and will display the date you clicked on for intermittent recurring events.  So here goes, from the top down, all done to the default template:

Make this your new getEvent section for the Event View:

code:

elsif ($VIEW eq "Event") {
   use Time::Local;
   $EVENT->{'details'} = &getEvent($in{'event_id'});
   $db = $main: BSchedule;
   $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: BEvents;
   $fields = &main: BGetFieldsInDisplayOrder($db);
   }

Change the grid view details link to this:

code:

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

Change the list view details link to this:

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>

These last two I have only appended "&datestring=<%=$DAY->{datestring}%>" to the link.  Everything else stays the same.

The day views require no changes because the datestring is already included in the QUERY_STRING.

In the event view section, I then added the following code after the foreach loop (before the </TABLE> tag).

code:

         <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>

Alright.  That works well on my machine.  Notice that I didn't use the Time Display Mod, because the call to getEventsInRange at the top finds all the events for the selected day, and the foreach loop puts the event that matches the event we're looking at into the $EVENT->{schedule} hash, so it acts like a more powerful time display mod that actually gets the current event, not the first occurence.  I hope you can get this working as well on your server as it does on mine.  The only thing left to do is write a function that "describes" a recurring event, instead of just showing the date of the current one (like "Every Thursday" or "The first Wednesday of every month", etc.).  But this works quite well, IMHO.

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

kayleigh
New Member
*

Karma: 0
Offline Offline

Posts: 0

Computer Analyst


WWW
« Reply #23 on: May 04, 2002, 09:12:00 AM »

I use a hack that will display the event in a pop-up window. It actually passes the Event ID to the popup template for display. In order for this hack to work with that hack, all links must be changed to
code:
<A HREF="<%=$CGI_URL_QUERYSTRING%>popup=0&template=event_detail.html&event_id=<%= EVENT FIELD(id) %>&datestring=<%= $DAY->{datestring} %>" onClick="showDetails('<%= EVENT FIELD(id) %>&datestring=<%= $DAY->{datestring} %>');return false;"><%= EVENT FIELD(title) %></A>


so it will pass the datestring on to the event popup window. Otherwise, all events not occurring on today's date will register 01/01/1970. It works beautifully, Dave!

------------------
Stephanie Meemken
Webmaster, Minnesota Jaycees http://www.mnjaycees.org/

[This message has been edited by kayleigh (edited May 04, 2002).]

Logged

Stephanie Meemken
Webmaster, Minnesota Jaycees

http://www.mnjaycees.org/
BB
Guest
« Reply #24 on: June 21, 2002, 02:59:00 PM »

Hi
Thank you for all your comments on adding a date to the detail pages....after alot of frustration, I finally got it to work and it even gives ranges of dates if a race event spans several.

I'm a bit wary of changing anything now (!) but I was wondering if it is possible to add the date underneath the coloured Event Title rather than at the bottom of the details?  I've had a play about inserting the code at different points but it either produces odd results or just doesn't work.

many thanks
BB

Logged
GotMyPT
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #25 on: July 04, 2002, 06:44:00 PM »

Thanks TubaDave for your assistance! But may I ask that you be a bit more precise with where the replacement code goes? Someone like me that doesn't know Perl and who is trying to follow along... I'm just not 100% sure.

For instance, where you say "Make this your new getEvent section for the Event View:" I'm not sure which part of the code in the Event View (I could find that no problem) is the getEvent. Could you please modify your post and tell us exactly which lines get replaced. I think I speak for many of the users here.

Thank you very much!

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

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: July 04, 2002, 09:31:00 PM »

 
quote:
may I ask that you be a bit more precise with where the replacement code goes?

Find
elsif ($VIEW eq "Event") {
in the default.html template file towards the top.

Dan O.

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

Logged
GotMyPT
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #27 on: July 04, 2002, 10:37:00 PM »

So are you saying that this:

code:

elsif ($VIEW eq "Event") {   use Time::Local;   $EVENT->{'details'} = &getEvent($in{'event_id'});   $db = $main: BSchedule;   $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: BEvents;   $fields = &main: BGetFieldsInDisplayOrder($db);   }

ENTIRELY replaces this:

code:
elsif ($VIEW eq "Event") { 

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

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: July 05, 2002, 12:43:00 PM »

 
quote:
So are you saying that ENTIRELY replaces elsif ($VIEW eq "Event") {

That any anything following it up until and including the closing } for the original block of code.

Dan O.


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

[This message has been edited by DanO (edited July 05, 2002).]

Logged
jeanjerome
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #29 on: August 24, 2002, 07:18:00 PM »

Thanks a lot for this thread... I needed exactly that and  managed to make it works thanks to it!

One last issue it seems. The datestring is emty when getting search results. The Title link to the details page does not contain it therefore the details are missing the date info (the date defaul to to a 1970 date).

So far I haven't been able to get the datestring value in the search result... Must be simple...

Any one as an idea?

Thanks.

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

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