UBBFriend: Email This Page to Someone!
  CalendarScript Support Forum
  Suggestions and Ideas
  Editing recurring events

Post New Topic  Post A Reply
profile | register | preferences | search

next newest topic | next oldest topic
Author Topic:   Editing recurring events
wsiddal
Junior Member
posted June 11, 2002 09:17 AM     Click Here to See the Profile for wsiddal     Edit/Delete Message
I'm evaluating CalendarScript for use by my Church. Overall, very nice work!

It would be nice to be able to edit recurring events in a more granular way. For example, when I edit a recurring event, I'd like to be able to choose 1) edit all instances, 2) edit just this one instance, 3) edit all previous instances, or 4) edit all following instances. Same thing for delete. Is this possible?

BTW, what software is used to drive this forum? Very nice.

Bill Siddall

IP: Logged

DanO
Member
posted June 11, 2002 01:17 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
CalendarScript stores recurring events as a single item so there are no multiple instances. You would have to save each of them as a separate event in order to have each one editable separately.

If I'm not mistaken, there was a mod that would save a recurring event as separate events but I think that was one of Kent's mods that appear to be no longer online. Sorry.

quote:
what software is used to drive this forum?

UBB (Ultimate Bulletin Board). There is a link to their site in these forums that can probably be found by searching for "UBB" (without the quotes).

Dan O.

[This message has been edited by DanO (edited June 12, 2002).]

IP: Logged

jmillard
Junior Member
posted August 05, 2002 05:25 PM     Click Here to See the Profile for jmillard     Edit/Delete Message
Would it be quicker to have an "exceptions" list added to a recurring event? That would have the net effect of "deleting" the few times you don't need an item repeated, while limiting the number of granular entries required in the database.

------------------
Jim Millard
Kansas City, MO USA

IP: Logged

GoleyC
Member
posted August 05, 2002 06:32 PM     Click Here to See the Profile for GoleyC     Edit/Delete Message
Here's the hack to make recurring events seperatedly editable.

# MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE. http://www.calendarscript.com/support/forum/Forum5/HTML/000045.html


--------------------------------------------------------------------------------
In the \calendarscript\lib\Event.inc file

We need to pass an additional parameter holding the handle to the Event Database. This all goes in the subroutine beginning at line 198 called "sub scheduleEvent". On line 199 where the passed parameters get loaded we add our event database to the end:

# START OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
my ($db,$schedule,$event_id,$edb) = @_;
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE


The guts go into the "Static schedule" portion of the code which begins at line 328. 26 lines down at line 354 you'll see the "foreach $start (@start_dates)" command which writes out a separate schedule record for each date. This is where we'll modify the code to also write out a separate event record for each date. We add two lines of code before the "foreach" and an additional 12 lines a little further down to create the event records.

-------------------------------------------------
# START OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
# MULTIPLE EVENT RECORD
# This just creates and sets a flag for the first pass to
# know that we DON'T need to create a NEW record the first
# time. We'll use the one already created.
my ($fpass);
$fpass = 0;
END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE

# START OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
foreach $start (@start_dates) {
if ($start =~ /^(\d\d\d\d)(\d\d)(\d\d)$/o) {
($yy,$mm,$dd) = ($1,$2,$3);
$start = Time::Local::timegm(0,$schedule->{'start_time_mm'},$schedule->{'start_time_hh'},$dd,$mm-1,$yy);
}
if ($schedule->{'static_dates_range'} eq "dates") {
$end = $start;
}
if (!$end && $all_day) {
$end = $start;
}
elsif (!$end) {
$end = Time::Local::timegm(0,$schedule->{'end_time_mm'},$schedule->{'end_time_hh'},$dd,$mm-1,$yy);
}
# if (!$schedule->{'static_end_date'} && $all_day) {
# $schedule->{'static_end_date'} = $start;
# }

# MULTIPLE EVENT RECORD MODS
# This is where we put out multiple events for multiple
# dates if its not the first pass

if ($fpass) {
if ($event_id = $edb->addRecord($eproperties)) {
$eproperties->{'id'} = $event_id;
}
else {
&setErrorMessage(&main::getMessage("EVENT_SAVE_ERROR",$edb->getErrorMessage()));
return 0;
}
}
# If it is the first pass we just reread the event record
# for use in writing out the new records and set the first
# pass flag.

else {
$eproperties = $edb->getRecord( {'id'=>$event_id} );
$fpass = 1;
}
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE

if (!$db->addRecord( { 'event_id'=>$event_id,
-------------------------------------------------

The other change we need to make is to setup and pass the handle for the events database in the calendar_admin.pl file.

Locate the code for scheduling an event approximately 700 lines down that begins:
elsif ($in{'command'} eq "schedule_event") {

Just below this we add:

# BEGIN OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
# MULTIPLE EVENT RECORD MOD
my ($edb) = new DBFile($events_db);
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE

and then 11 lines down we change the line that calls the previously modified ScheduleEvent procedure to add the variable we just created to the parameters:

# BEGIN OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
# MULTIPLE EVENT RECORD MOD (added $edb parameter)
if (&Event::scheduleEvent($db, $schedule, $event_id, $edb)) {
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE

=================================
=================================

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

IP: Logged

echo
Junior Member
posted October 09, 2002 05:56 PM     Click Here to See the Profile for echo     Edit/Delete Message
I'm very much interested in the hack to make recurring events seperatedly editable. Is this still OK in version 3.2?

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

IP: Logged

GoleyC
Member
posted October 09, 2002 07:39 PM     Click Here to See the Profile for GoleyC     Edit/Delete Message
Yes.

The MOD posted above works in the latest version.

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

IP: Logged

echo
Junior Member
posted October 10, 2002 01:00 AM     Click Here to See the Profile for echo     Edit/Delete Message
Thanks for responding.
I was very careful to follow the instructions accurately
(even noticing a missing comment "#" character on the second "END OF MAKING...")

and my editing events remains the same, with the alert that editing (in my case deleting) a reoccuring event will effect all.

I tried testing with all fresh files in calendars/default, even logging out and in again, then adding a new event with the new code in place. Nothings broken, there just is no modification apparent.

Any ideas?

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

IP: Logged

GoleyC
Member
posted October 10, 2002 08:07 AM     Click Here to See the Profile for GoleyC     Edit/Delete Message

Follow the original link to the original post located here: http://www.calendarscript.com/support/forum/Forum5/HTML/000045.html and use that code, as the code I pasted might be missing something..don't know. It works on our system without problems, again I might have missed a line of code by copying and paste'in.

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

IP: Logged

echo
Junior Member
posted October 10, 2002 04:06 PM     Click Here to See the Profile for echo     Edit/Delete Message
Tested a completely virgin install on a different server, re-edited the mods (there was no errors above), and tried it on a default template, since I was using the simple template, and no luck! In editing, schedule, or deleting, it responds as the regular script works, the changes are for all events of a reoccuring event.

I don't know how you could help, I'm just frustrated. Thanks for trying. Does anyone know if Matt is planning to incorporate this feature in a future version?

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

IP: Logged

Keith G
unregistered
posted October 10, 2002 04:12 PM           Edit/Delete Message
Is this a mod that works in version 3.1 but not 3.2? I know I have tried this and whatever change I make to 1 of the recurring events affects all of them. Anyone using this mod in 3.2?
Keith

IP: Logged

GoleyC
Member
posted October 10, 2002 04:41 PM     Click Here to See the Profile for GoleyC     Edit/Delete Message
OK..just testing with 3.2..and it doesn't..repeat..doesn't work.

I'll look over the code to see what has changed from version 3.1 to version 3.2 and post the correct code here.

It might be a few days before I can get to it, but I'll get to it soon.

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

IP: Logged

Keith G
unregistered
posted October 22, 2002 08:27 AM           Edit/Delete Message
Has anyone had any success getting this to work in version 3.2?
Keith

IP: Logged

GoleyC
Member
posted October 22, 2002 09:19 PM     Click Here to See the Profile for GoleyC     Edit/Delete Message
I've played around with the code that was provided by TurboDave, but cannot seem to find any problems with it, and therefore, the code should work, but it doesn't.

I'll post the code changes here if anyone else would like to take a crack at finding the problems.

code:
# MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE. http://www.calendarscript.com/support/forum/Forum5/HTML/000045.html 

#
#----[ OPEN ]----------------------------------------------------
#

\calendarscript\lib\Event.inc

Note: We need to pass an additional parameter holding the handle to the Event
Database. This all goes in the subroutine beginning at line called
"sub scheduleEvent". On line where the passed parameters get loaded
we add our event database to the end:

#
#----[ FIND ]----------------------------------------------------
#

my ($db,$schedule,$event_id) = @_;


#
#----[ REPLACE WITH ]----------------------------------------------------
#

# START OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
my ($db,$schedule,$event_id,$edb) = @_;
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE


#
#----[ FIND ]----------------------------------------------------
#

foreach $start (@start_dates) {

Note: The guts go into the "Static schedule" portion of the code which begins
with "foreach $start (@start_dates) {" command which writes out a separate
schedule record for each date. This is where we'll modify the code to also
write out a separate event record for each date. We add two lines of code
before the "foreach".


#
#----[ BEFORE, ADD ]----------------------------------------------------
#

# START OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
# MULTIPLE EVENT RECORD
# This just creates and sets a flag for the first pass to know that we DON'T
# need to create a NEW record the first time. We'll use the one already created.
my ($fpass);
$fpass = 0;
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE


#
#----[ FIND ]----------------------------------------------------
#

foreach $start (@start_dates) {
if ($start =~ /^(\d\d\d\d)(\d\d)(\d\d)$/o) {
($yy,$mm,$dd) = ($1,$2,$3);
$start = Time::Local::timegm(0,$schedule->{'start_time_mm'},$schedule->{'start_time_hh'},$dd,$mm-1,$yy);
}
if ($schedule->{'static_dates_range'} eq "dates") {
$end = $start;
}
if (!$end && $all_day) {
$end = $start;
}
elsif (!$end) {
$end = Time::Local::timegm(0,$schedule->{'end_time_mm'},$schedule->{'end_time_hh'},$dd,$mm-1,$yy);
}
#if (!$schedule->{'static_end_date'} && $all_day) {
# $schedule->{'static_end_date'} = $start;
# }
if (!$db->addRecord( { 'event_id'=>$event_id

Note: This part creates the event records


#
#----[ REPLACE WITH ]----------------------------------------------------
#
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
foreach $start (@start_dates) {
if ($start =~ /^(\d\d\d\d)(\d\d)(\d\d)$/o) {
($yy,$mm,$dd) = ($1,$2,$3);
$start = Time::Local::timegm(0,$schedule->{'start_time_mm'},$schedule->{'start_time_hh'},$dd,$mm-1,$yy);
}
if ($schedule->{'static_dates_range'} eq "dates") {
$end = $start;
}
if (!$end && $all_day) {
$end = $start;
}
elsif (!$end) {
$end = Time::Local::timegm(0,$schedule->{'end_time_mm'},$schedule->{'end_time_hh'},$dd,$mm-1,$yy);
}
#if (!$schedule->{'static_end_date'} && $all_day) {
# $schedule->{'static_end_date'} = $start;
# }

# MULTIPLE EVENT RECORD MODS
# This is where we put out multiple events for
# multiple dates if its not the first pass

if ($fpass) {
if ($event_id = $edb->addRecord($eproperties)) {
$eproperties->{'id'} = $event_id;
}
else {
&setErrorMessage(&main::getMessage("EVENT_SAVE_ERROR",$edb->getErrorMessage()));
return 0;
}
}

# If it's the first pass we just reread the event record for use
# in writing out the new records and set the first pass flag.

else {
$eproperties = $edb->getRecord( { 'id'=>$event_id} );
$fpass = 1;
}
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE

if (!$db->addRecord( { 'event_id'=>$event_id,


#
#----[ OPEN ]----------------------------------------------------
#

calendar_admin.pl

Note: The other change we need to make is to setup and pass the handle for the
events database.


#
#----[ FIND ]----------------------------------------------------
#

elsif ($in{'command'} eq "schedule_event") {


#
#----[ AFTER, ADD ]----------------------------------------------------
#

# BEGIN OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
# MULTIPLE EVENT RECORD MOD
my ($edb) = new DBFile($events_db);
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE


#
#----[ FIND ]----------------------------------------------------
#


if (&Event::scheduleEvent($db, $schedule, $event_id)) {

Note: We change the line that calls the previously modified ScheduleEvent procedure
to add the variable we just created to the parameters:

#
#----[ REPLACE WITH ]----------------------------------------------------
#

# BEGIN OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE
# MULTIPLE EVENT RECORD MOD (added $edb parameter)
if (&Event::scheduleEvent($db, $schedule, $event_id, $edb)) {
# END OF MAKING REOCCURING EVENTS SEPERATEDLY EDITABLE


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

IP: Logged

echo
Junior Member
posted October 23, 2002 01:39 AM     Click Here to See the Profile for echo     Edit/Delete Message
Matt, are you working on this for a future update?

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

IP: Logged

godsky
unregistered
posted February 04, 2003 10:56 PM           Edit/Delete Message
Has anyone followed up on this effort for the re-occurring events? Looks like the thread died out, but would still like to see the capability.
Thanks,
Paul

IP: Logged

DanO
Member
posted June 14, 2003 05:33 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** Has anyone followed up on this effort for the re-occurring events? **

I just completed a plug-in which will convert recurring events, events with multiple dates
and events with a 'date range' posted to the calendar, to individual events so each can be
edited separately afterward.

It will also allow you to convert previously entered events simply by clicking to
edit their schedule and saving it, without making any changes manually.

You can read more about it in the previous forum message "SplitRecurrences plugin".

Dan O.
Unofficial CalendarScript - Mods and Plugins site


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

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

CalendarScript Home