Commit 7bc78640 authored by Frank Bergmann's avatar Frank Bergmann

- Fixed alerts for forums

	- Fixed bug in im_send_alert
	- Cleaned up code in forum/www/new-2.tc
parent 2486ee08
# /packages/intranet-core/tcl/intranet-alerts.tcl # /packages/intranet-core/tcl/intranet-alert-procs.tcl
# #
# Copyright (C) 1998-2004 various parties # Copyright (C) 1998-2006 various parties
# The code is based on ArsDigita ACS 3.4 # The code is based on ArsDigita ACS 3.4
# #
# This program is free software. You can redistribute it # This program is free software. You can redistribute it
...@@ -24,7 +24,7 @@ ad_library { ...@@ -24,7 +24,7 @@ ad_library {
# ------------------------------------------------------------------- # -------------------------------------------------------------------
# Add an alert to the database alert queue # Add an alert to the database alert queue
# ------------------------------------------------------------------- # -------------------------------------------------------------------
ad_proc im_send_alert {target_id frequency subject {message ""} } { ad_proc -public im_send_alert {target_id frequency subject {message ""} } {
Add a new alert to the queue for a specific user. Add a new alert to the queue for a specific user.
The idea is to aggregate several alerts into a single email, The idea is to aggregate several alerts into a single email,
to avoid hundereds or emails, for example if a user has been to avoid hundereds or emails, for example if a user has been
...@@ -52,13 +52,14 @@ ad_proc im_send_alert {target_id frequency subject {message ""} } { ...@@ -52,13 +52,14 @@ ad_proc im_send_alert {target_id frequency subject {message ""} } {
} }
# Determine the sender address # Determine the sender address
set sender_email [ad_parameter -package_id [ad_acs_kernel_id] SystemOwner "" "webmaster@local\ set sender_email [ad_parameter -package_id [ad_acs_kernel_id] SystemOwner "" "webmaster@localhost"]
host"]
if [catch { if [catch {
set sender_email [db_string sender_email "select email as sender_email from parties where\ set sender_email [db_string sender_email "select email as sender_email from parties where party_id = :current_user_id" -default $sender_email]
party_id = :current_user_id" -default "asfd@asdf.com"]
} errmsg] { } errmsg] {
# nothing - use default ns_log Notice "im_send_alert: Error determining email for sender $current_user_id: $errmsg"
ad_return_complaint 1 "Error determining email for sender $current_user_id:<br>
<pre>$errmsg</pre>"
return
} }
...@@ -67,6 +68,11 @@ host"] ...@@ -67,6 +68,11 @@ host"]
ns_sendmail $email $sender_email $subject $message ns_sendmail $email $sender_email $subject $message
} errmsg] { } errmsg] {
ns_log Notice "im_send_alert: Error sending to \"$email\": $errmsg" ns_log Notice "im_send_alert: Error sending to \"$email\": $errmsg"
# ad_return_complaint 1 " Error sending email to '$email':<br>
# <pre>$errmsg</pre>"
# return
} else { } else {
ns_log Notice "im_send_alert: Sent mail to $email\n" ns_log Notice "im_send_alert: Sent mail to $email\n"
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment