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 CommunityCustomizationHacks and Mods (Moderators: scott, DanO, Marty)Redirecting to calendar after adding event
Pages: [1] 2   Go Down
Print
Author Topic: Redirecting to calendar after adding event  (Read 875 times)
0 Members and 1 Guest are viewing this topic.
guymal
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: May 15, 2002, 06:33:00 AM »

How can I redirect to the calendar page after adding a new event (instead of going back to the add event page)?
TIA,
Guy
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: May 15, 2002, 01:24:00 PM »


For non-recurring events, it may be possible to just change the reference to "main.html" in the schedule_event_non_recur.html template file to "default.html" (or whatever you're calling the default calendar template). It is located in the templates/admin/English directory.

If that works the same should be changed in the schedule_event_recurring.html template file.

Dan O.

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

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #2 on: May 15, 2002, 06:25:00 PM »

I doubt if that will work, since the add and scheduling events happens in the calendar_admin.pl script, which doesn't know how to parse the view template.  However, you're not out of luck.  I just threw together a quick plugin that uses http redirects to send the user back to the calendar page after they have added and scheduled the event.  Have a look at http://www.csworkbench.com/CSMods/  and you'll see a file called Redirector.zip (and tgz) about halfway down the page.  Enjoy!

btw, installation is standard.  Just unzip/untar in the plugins directory and enable it under Manage Plugins in the admin application.

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

Logged

guymal
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: May 16, 2002, 01:04:00 AM »

Thanks David, works great.
I also downloaded your OneClick Event Entry plugin.

Now I have a new problem:
When I add an event using the regular "Add Event" command the Redirector works.
BUT:
When I add an event using the "Add OneClick Event" option from the menu the Redirector doesn't work.

Oh yea, one more thing: is there a way to add the "Add OneClick Event" as a command from the left navigation bar?

Thanks,
Guy

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #4 on: May 16, 2002, 01:18:00 AM »

To get the redirector code to work with the OneClick plugin, copy the code inside the after_schedule_event.pl file in the Redirector to the end of the command_add_oneclick_event.pl file, just before the last closing bracket ('}').

To add OneClick event entry, find this section (line 153 or so of default.html):

code:

<%if ($User->hasPermission($CALENDAR_KEY,"ADD_EVENT")) { %>
   <TR><TD BGCOLOR="<%=$_COMMAND_OPTION_BGCOLOR%>"><B><a href="<%=$ADMIN_CGI_URL%>?calendar=<%=$CALENDAR_KEY%>&username=<%=$User->{username}%>&template=add_edit_event.html" CLASS="commandtext">Add Event</A></B></TD></TR>
<%}%>

Then copy the <TR><TD ... line changing the template from add_edit_event.html to schedule_oneclick_non_recurring.html, and also changing the Add Event text to Add OneClick Event or something similar.  Alternatively, you can completely replace the original Add Event section with the changes above if you want OneClick to replace normal event addition.

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

Logged

guymal
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #5 on: May 16, 2002, 01:46:00 AM »

I added the code from after_schedule_event.pl to the end of the command_add_oneclick_event.pl and the redirect works but it redirects to Jan 1970.

Thanks for all your help,
Guy

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #6 on: May 16, 2002, 06:57:00 PM »

Change this line:

   my ($ss, $mi, $hh, $dd, $mm, $yy) = gmtime($db->getRecord({'event_id' => $in{'EVENT_id'}})->{start});

to this:

   my ($ss, $mi, $hh, $dd, $mm, $yy) = gmtime($db->getRecord({'event_id' => $Template::event->{'id'}})->{start});

in the part of the oneclick subroutine that you edited.  That should fix your problem.

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

Logged

guymal
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #7 on: May 18, 2002, 11:31:00 PM »

Thanks, worked like a charm!
Guy
Logged
phs2911
New Member
*

Karma: 0
Offline Offline

Posts: 0

student


WWW
« Reply #8 on: June 03, 2002, 10:24:00 AM »

I'm trying to add the redirector to work with OneClick.  I used to use my own redirection statement, but it was inefficient (had to load the Admin menu first, then it would redirect, so it was slow).  I've decided yours looks much more streamlined, but I'm having trouble implementing it.  

Do I copy the entire contents of after_schedule_event.pl into command_add_oneclick_event.pl, just before the closing bracket?  When I do that, no redirection occurs (no error, either).  I know my error is probably in one single line of code...

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

Logged
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #9 on: June 04, 2002, 01:08:00 AM »

Not quite the entire contents.  Leave out:

sub after_schedule_event
{

and


}

1;

That sounds like it will fix your problem.

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

Logged

adam5532
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #10 on: June 20, 2002, 02:15:00 AM »

Dave,

I've got the Redirector working with One-Click and have also altered default.html so that the ADD button on the calendar does One-Click Entry.

It works great, but when I click EDIT events on the calendar, the redirector doesn't work. Does the edit_delete_events.html file need to be modified as well?

Thanks,
Adam

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #11 on: January 19, 2003, 08:58:00 PM »

** It works great, but when I click EDIT events on the calendar, the redirector doesn't work. **

Adam,

You may be able to get around that by duplicating the Redirector plug-in's file after_schedule_event.pl and renaming it to after_edit_event.pl. Now in after_edit_event.pl you'd need to change the line:

sub after_schedule_event

to

sub after_edit_event

and putting it in the same directory as the Redirector plug-in's files. That way the same code should be called after editing an event? It is untested though.

Dan O.


[This message has been edited by DanO (edited January 20, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #12 on: June 04, 2003, 06:57:00 PM »

I have updated the command_add_oneclick_event.pl file in the
OneClick Event Entry plug-in to include the after_schedule_event
hook so hopefully it will work out of the box
with the Redirector plug-in.

All updated files are contained in the OneClick.2003-06.zip
file now available at the Unofficial CalendarScript - Mods and Plugins site.

Let me know if there are any problems.

Dan O.

[This message has been edited by DanO (edited June 04, 2003).]

Logged
xoldmaster
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #13 on: October 13, 2004, 09:22:00 AM »

Hello.
I add this plugin to my calendar. It works, but it redirect me to calendar_admin.pl, not to calendar.pl

Any suggestions?

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #14 on: October 13, 2004, 12:44:00 PM »

** it redirect me to calendar_admin.pl, not to calendar.pl **

Are your CalendarScript files still using the default .pl file name extension
or did you change them to .cgi?

Dan O.

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

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