|
From: Chris W. <la...@us...> - 2001-10-24 11:31:38
|
Update of /cvsroot/openinteract/OpenInteract/OpenInteract
In directory usw-pr-cvs1:/tmp/cvs-serv17845
Modified Files:
SPOPS.pm
Log Message:
updated notify() and added docs for its parameters
Index: SPOPS.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract/OpenInteract/SPOPS.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** SPOPS.pm 2001/10/20 15:17:44 1.15
--- SPOPS.pm 2001/10/24 11:31:35 1.16
***************
*** 286,303 ****
my $subject = $p->{subject} || "Object notification: $num_objects objects in mail";
my $separator = '=' x 25;
! my $msg = ( $p->{notes} ) ? join( "\n", 'Notes', "$separator$p->{notes}", $separator, "\n" ) : '';
foreach my $obj ( @{ $p->{object} } ) {
my $info = $obj->object_description;
my $object_url = join( '', 'http://', $R->{server_name}, $info->{url} );
! $msg .= "Begin $p->{type} object\n$separator\n" .
! $obj->as_string . "\n" .
! "View this object at: $object_url\n" .
! "\n$separator\nEnd $p->{type} object\n\n\n";
}
! eval { OpenInteract::Utility->send_email({
! to => $p->{email},
! from => $R->CONFIG->{mail}{admin_email} || $R->CONFIG->{admin_email},
! subject => $subject,
! message => $msg }) };
if ( $@ ) {
$R->throw({ code => 203 });
--- 286,314 ----
my $subject = $p->{subject} || "Object notification: $num_objects objects in mail";
my $separator = '=' x 25;
! my $msg = ( $p->{notes} ) ?
! join( "\n", 'Notes', "$separator$p->{notes}", $separator, "\n" ) : '';
foreach my $obj ( @{ $p->{object} } ) {
my $info = $obj->object_description;
my $object_url = join( '', 'http://', $R->{server_name}, $info->{url} );
! $msg .= <<OBJECT;
! Begin $info->{name} object
! $separator
! @{[ $obj->as_string ]}
!
! View this object at: $object_url
! $separator
! End $p->{name} object
!
! OBJECT
}
! my $from_email = $p->{email_from} ||
! $R->CONFIG->{mail}{admin_email} ||
! $R->CONFIG->{admin_email};
! eval {
! OpenInteract::Utility->send_email({ to => $p->{email},
! from => $from_email,
! subject => $subject,
! message => $msg });
! };
if ( $@ ) {
$R->throw({ code => 203 });
***************
*** 474,477 ****
--- 485,528 ----
information in your class configuration which specifies the fields you
want to use in the listing along with associated labels.
+
+ Parameters:
+
+ =over 4
+
+ =item *
+
+ B<email> ($)
+
+ Address to which we should send the notification.
+
+ =item *
+
+ B<email_from> ($) (optional)
+
+ Address from which the email should be sent. If not specified this
+ defaults to the 'admin_email' setting in your server configuration
+ (under 'mail').
+
+ =item *
+
+ B<subject> ($) (optional)
+
+ Subject of email. If not specified the subject will be 'Object
+ notification # objects in mail'.
+
+ =item *
+
+ B<object> (\@) (optional if called from an object)
+
+ If not called from an object, this should be an arrayref of objects to
+ notify someone about.
+
+ =item *
+
+ B<notes> ($) (optional)
+
+ Notes that lead off an email.
+
+ =back
=head1 TO DO
|