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: Link to Current Calendar  (Read 1914 times)
0 Members and 1 Guest are viewing this topic.
nickbrewer
Guest
« on: March 15, 2007, 10:53:00 AM »

Can someome tell me how to link back to the calendar view of the calendar that is currently stored in the session?

(i want to link back to this view from some of the admin pages)

every way i've done it so far takes you back to the default calendar... instead of the one they were in.  i know there is a variable i'm missing in my button and href code.

i would like to know how to do this with the button form onclick and with normal <a href=

any help would be grand.

thank you so much.


Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #1 on: March 15, 2007, 12:23:00 PM »

The following forum message shows how to link to a specific calendar:

LINK > Direct links to multiple calendars

I have no idea how you would modify whatever link you're referring to, to pass that information.

Dan O.

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

Logged
nickbrewer
Guest
« Reply #2 on: March 15, 2007, 01:34:00 PM »

i'm sorry i should have been more descriptive.

I want to dynamically link to the calendar that they are currently using.  What your suggesting is a hard coded link.

I'm guessing that each page passes session information about the calendar they are already in.  I want to use that information to link back to the calendar view from admin pages.

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #3 on: March 16, 2007, 12:58:00 PM »

** I want to use that information to link back to the calendar view from admin pages. **

Isn't that the way the administration menus currently are?

Anyway, the currently logged calendar key is stored in the $CALENDAR_KEY variable.

JFYI

Dan O.

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

Logged
nickbrewer
Guest
« Reply #4 on: March 16, 2007, 01:22:00 PM »

I disabled the admin dropdown command list for the delete events and add / update events pages to make it less confusing for my users.  i just want to make an easy way for them to get back to the calendar if they don't want to follow through with the add/update or delete steps.

i added the below lines to the edit_delete_events.html in the admin templates without luck.

<a href="calendar.pl?calendar=<%= $CALENDAR_KEY %>"><<< Back to Calendar</a>

then changed it to...

<a href="calendar.pl?calendar=$CALENDAR_KEY"><<< Back to Calendar</a>

--------- when i click on the link in the delete events screen with the 1st line of code i get the following: ----------
http://www.mysite.org/calendar/calendar.pl?calendar=

which brings up the default calendar everytime

--------- when i click on the link in the delete events screen with the second line i get the following: --------
http://www.mysite.org/calendar/calendar.pl?calendar=$CALENDAR_KEY

which, of course, errors out because it doesn't recognize $calendar_key as a valid key

Should i be linking this differently?

Thanks so much for your help so far.  i really appreciate it.

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


[This message has been edited by nickbrewer (edited March 16, 2007).]

[This message has been edited by nickbrewer (edited March 16, 2007).]

[This message has been edited by nickbrewer (edited March 16, 2007).]

[This message has been edited by nickbrewer (edited March 16, 2007).]

[This message has been edited by nickbrewer (edited March 16, 2007).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #5 on: March 17, 2007, 11:43:00 AM »

** i added <a href="calendar.pl?calendar=<%= $CALENDAR_KEY %> to the edit_delete_events.html in the admin templates without luck. **

That variable may only be available in the calendar views. You can try using $calendar or $calendar_key or $calendar->{'key'}

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 #6 on: March 18, 2007, 03:01:00 PM »

Did any of those work?

Dan O.

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

Logged
nickbrewer
Guest
« Reply #7 on: March 18, 2007, 03:59:00 PM »

I tried some different combinations of them... and none worked.

can you put it in an anchor statement as an example for me?

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #8 on: March 18, 2007, 04:17:00 PM »

The anchor example you posted looks correct.

Just try printing out those variables somewhere (anywhere) on the template to see what they produce. Eg

- <%= $calendar %> - <%= $calendar_key %> - <%= $calendar->{'key'} %> -

(the dashes are just so you can tell that information should be printed between them)

Dan O.

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

Logged
nickbrewer
Guest
« Reply #9 on: March 19, 2007, 03:15:00 PM »

the middle one worked.

thanks.

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #10 on: March 19, 2007, 04:00:00 PM »

Glad to hear it.

Dan O.

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

Logged
ccobb
Guest
« Reply #11 on: March 30, 2007, 03:59:00 PM »

Timely topic, thanks for the tip. Now, let's go one step further. It would be great to have a $TODAY_DAY variable and a <% TODAY MONTH LINK %> tag. Also, some zero-based day/month vars that would work with the *_NAMES and *_ABBREVIATIONS vars would be a nice touch, too.

[ Afterthought: Even better would be a way to enter date(1) format directives when displaying a date. Something like the following would display "30-Mar-2007".

<%= $DATE_FMT->( "%d-%b-%Y", $TODAY_EPOCH ) %>

Take a look at the Date::Format class in the Date-Time distribution on CPAN: http://search.cpan.org/~gbarr/TimeDate-1.16/  ]

In my custom calendar, I am displaying a month view only. At the bottom is a field that works as follows.

. if the displayed month is the current month it says "Today is 30-Mar-2007", or whatever, and the text is not a link

. if the displayed month is any other month it says "Go to Current Month", and the text is a link to the current month

The following works, but it's rather cumbersome.
Thanks,

--

<%if ($MONTH eq $TODAY_MONTH) {%>

      Today is <%= substr( $TODAY_DATESTRING, -2, 2 ) %>-<%= $MONTH_ABBREVIATIONS->[ $TODAY_MONTH - 1 ] %>-<%= $TODAY_YEAR %>

<%} else {%>

      <a href="/cgi-bin/calendar/calendar.pl?month=<%= $TODAY_MONTH %>&calendar=<%= $CALENDAR_KEY %>&year=<%= $TODAY_YEAR %>"> Go to Current Month </a>

<%}%>


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

[This message has been edited by ccobb (edited March 30, 2007).]

Logged
ccobb
Guest
« Reply #12 on: March 30, 2007, 05:37:00 PM »

What a nice, extensible calendar! You know, about six years ago, I was going to help a friend with a website and was looking for a flexible, Perl-based calendar. I didn't do the project, but I've been watching CalendarScript evolve ever since. Now, six years later when I need a calendar for our Website, it's still the best choice around!

Here's a nice little hack that works like a charm.

. add Date/Format.pm to calendarscript/lib/Date/Format.pm
 (http://search.cpan.org/~gbarr/TimeDate-1.16/)

. add PTools/Date/Format.pm to calendarscript/lib/PTools/Date/Format.pm
 (http://search.cpan.org/~ccobb/PTools-0.01/)

. add the following to calendar.pl at the top of the subroutine that populates variables

sub populateTemplateVariables {
#---------------------------------------------------------
# Custom additions to calendar.pl     (ccobb: 30-Mar2007)

use PTools:  ate::Format qw( date1 );
$Template:  ateFmt = "PTools:  ate::Format";
$Template::TODAY_EPOCH = time();
#---------------------------------------------------------

. add the following to a calendar template
Today is <%= $DateFmt->time2str( "%d-%b-%Y", $TODAY_EPOCH ) %>

[ Oh, and replace the above smilys with capital D's ]

Thanks again for CalendarScript. This is great stuff.


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

[This message has been edited by ccobb (edited March 30, 2007).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #13 on: March 30, 2007, 10:02:00 PM »

** Oh, and replace the above smilys with capital D's **

with colon D ( : D - without the space between).

PS. What you've posted has nothing to do with the original message topic. It should really have been posted in its own message and appropriately titled so others can find the information when they come searching.

JMO

Dan O.

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

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #14 on: March 30, 2007, 10:09:00 PM »

ccobb,
I'm going to address your posts in reverse order so as to save space in this topic, which is truly unrelated to your investigation.

1) You don't need to create subs or relocate any modules in order to achieve what you want, because Date::Format (and POSIX, which I prefer for that matter) are ready to load as part of any standard Perl 5+ server installation. It is as easy as this (for instance):

code:
use Date::Format;
my @localtime = localtime(time);
my $BuildDate = strftime("%a, %d %b %Y %H:%M:%S %Z", @localtime);

This code creates an RFC822 compliant date ('Wed, 06 Mar 2007 08:00:00 EST') with minimal effort. You could also use gmtime(time) as your array, replacing the localized %Z param with 'GMT'. This flexibility in working with arrays is why I prefer to use strftime rather than time2str.

2) In response to your first post, if you really want to create additional Template variables within Calendarscript to achieve the same thing, see this thread, about 3/4 of the way down . . .

[This message has been edited by musicvid (edited March 31, 2007).]

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