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)OneClick Add Event and Email Notify
Pages: [1]   Go Down
Print
Author Topic: OneClick Add Event and Email Notify  (Read 597 times)
0 Members and 1 Guest are viewing this topic.
preisi
New Member
*

Karma: 0
Offline Offline

Posts: 0

Web Developer


WWW
« on: January 31, 2003, 04:21:00 PM »

Does anyone know how to get these two plugins to work together? i.e After someone submits an event through the OneClick Add Event plugin the administrator of that calendar gets an email from the Email Notify Plugin.
Logged

-Paul Reisinger
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #1 on: January 31, 2003, 06:26:00 PM »

Check the command_add_oneclick_event.pl file in the OneClick plug-in's directory to see if it has the following line towards the end of it:

&handleCustomFunction("after_add_event");

Dan O.

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

Logged
preisi
New Member
*

Karma: 0
Offline Offline

Posts: 0

Web Developer


WWW
« Reply #2 on: February 01, 2003, 09:06:00 PM »

My script does not have that towards the end of it. How would I go about adding this funtion?? I've included the code from my command_add_oneclick_event.pl file.

sub command_add_oneclick_event {
   &checkPermissions("","ADD_EVENT");
   my ($properties,$name,$error);
   my ($db) = new DBFile($events_db);
   my ($id);
   foreach (keys %in) {
      if ((/^FIELD_(.*)/) && ($in{$_} ne "")) {
         $properties->{$1} = $in{$_};
         }
      }
   $error=0;
   foreach (keys %{$db->{'properties'}}) {
      if ($db->{'properties'}->{$_}->{'required'} && ($properties->{$_} eq "")) {
         $name = $db->{'properties'}->{$_}->{'name'} | | $_;
         &addUserMessage(&getMessage("FIELD_IS_REQUIRED",$name));
         $error=1;
         }
      }
   if ($error) {
      $Template::record = $properties;
      &ERROR(&getMessage("EVENT_NOT_ADDED_FIELDS_MISSING"));
      }
   unless ($Config->get("allow_html")) {
      foreach (keys %{$properties}) {
         $properties->{$_} = &HTML::filter($properties->{$_});
         }
      }
   $properties->{'author_id'} = $User->{'username'};
   $properties->{'author_name'} = $User->{'name'};
   $properties->{'time_added'} = time;
   if ($User->hasPermission("","APPROVE") | | $User->hasPermission($calendar,"APPROVE_OWN_EVENTS")) {
      $properties->{'approved'} = 1;
      }
   else {
      &addUserMessage(&getMessage("EVENT_SAVED_PENDING_APPROVAL"));
      }
   if ($id = $db->addRecord($properties)) {
      &addUserMessage(&getMessage("EVENT_ADDED"));
      $properties->{'id'} = $id;
      $Template::event = $properties;
      }
   else {
      &ERROR($db->getErrorMessage());
      }

   my ($db) = new DBFile($schedule_db);
   my ($event_id) = $id;
   my ($schedule);

   foreach (sort keys %in) {
      if (/^SCHEDULE_(.*)/) {
         $schedule->{$1} = $in{$_};
         }
      }
   $db->deleteRecords( {'event_id'=>$event_id} );
   if (&Event::scheduleEvent($db, $schedule, $event_id)) {
      &addUserMessage(&getMessage("SCHEDULE_SAVED"));
      }
   else {
      &addUserMessage(&getMessage("ERROR_WHILE_SAVING_SCHEDULE"));
      &addUserMessage(&Event::getErrorMessage());
      $Template::schedule = $schedule;
      &showSameScreen();
      }
   }
1;

------------------
-Paul Reisinger

Logged

-Paul Reisinger
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #3 on: February 01, 2003, 10:00:00 PM »

Try changing the very end of it to:

&showSameScreen();
}
&handleCustomFunction("after_add_event");
}
1;

Or you can download the most current version of that plug-in which incorporates that change into it already.

Dan O.


[This message has been edited by DanO (edited February 01, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #4 on: February 08, 2003, 06:27:00 PM »

Did it work?

Dan O.

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

Logged
preisi
New Member
*

Karma: 0
Offline Offline

Posts: 0

Web Developer


WWW
« Reply #5 on: February 09, 2003, 02:14:00 PM »

It sure did! Thanks!

I first tried to install the updated onclick script but that didnt work? I then added

&showSameScreen();
}
&handleCustomFunction("after_add_event");
}
1 ;

to my original script and that worked great.

Thanks again

------------------
-Paul Reisinger

[This message has been edited by preisi (edited February 09, 2003).]

Logged

-Paul Reisinger
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #6 on: February 09, 2003, 04:01:00 PM »

That's strange but I'm gad you got it going.

Dan O.

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

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