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: Editing recurring events  (Read 963 times)
0 Members and 1 Guest are viewing this topic.
wsiddal
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: June 11, 2002, 09:17:00 AM »

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

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: June 11, 2002, 01:17:00 PM »

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).]

Logged
jmillard
New Member
*

Karma: 0
Offline Offline

Posts: 0

Network Administrator


WWW
« Reply #2 on: August 05, 2002, 05:25:00 PM »

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

Logged

Jim Millard
Kansas City, MO  USA
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: August 05, 2002, 06:32:00 PM »

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

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

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

Logged
echo
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #4 on: October 09, 2002, 05:56:00 PM »

I'm very much interested in the hack to make recurring events seperatedly editable. Is this still OK in version 3.2?

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

Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #5 on: October 09, 2002, 07:39:00 PM »

Yes.

The MOD posted above works in the latest version.

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

Logged
echo
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #6 on: October 10, 2002, 01:00:00 AM »

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?

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

Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #7 on: October 10, 2002, 08:07:00 AM »


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.

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

Logged
echo
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #8 on: October 10, 2002, 04:06:00 PM »

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?

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

Logged
Keith G
Guest
« Reply #9 on: October 10, 2002, 04:12:00 PM »

  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
Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #10 on: October 10, 2002, 04:41:00 PM »

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.

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

Logged
Keith G
Guest
« Reply #11 on: October 22, 2002, 08:27:00 AM »

Has anyone had any success getting this to work in version 3.2?
     Keith
Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #12 on: October 22, 2002, 09:19:00 PM »

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


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

Logged
echo
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #13 on: October 23, 2002, 01:39:00 AM »

Matt, are you working on this for a future update?

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

Logged
godsky
Guest
« Reply #14 on: February 04, 2003, 10:56:00 PM »

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
Logged
Pages: [1] 2   Go Up
Print
Jump to: