Index: openacs-4/packages/faq/tcl/q-and-a-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/q-and-a-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/faq/tcl/q-and-a-procs.tcl 3 Mar 2018 20:42:33 -0000 1.4 +++ openacs-4/packages/faq/tcl/q-and-a-procs.tcl 10 Jul 2018 08:46:27 -0000 1.5 @@ -9,54 +9,46 @@ namespace eval faq::notification_delivery { ad_proc -public do_notification { - question - answer - entry_id - faq_id - user_id - } { + question + answer + entry_id + faq_id + user_id + } { + Issues notifications for a FAQ + } { + set faq_name [db_string select_faq_name { + select faq_name from faqs + where faq_id = :faq_id + }] + set name [person::name -person_id $user_id] + set email [party::email -party_id $user_id] - db_1row select_faq_name {*SQL*} - db_1row select_user_name {*SQL*} - set q_a_text "" - append q_a_text "Question: $question -Answer: $answer" - set text_version "" set faq_url [faq::notification::get_url $entry_id] - - append text_version "Faq: $faq_name -Author: $name ($email)\n\n" - append text_version [ns_reflow_text -- $q_a_text] - append text_version "\n\n-- -To view the entire FAQ go to: -$faq_url -" - set new_content $text_version - set package_id [ad_conn package_id] - # Notifies the users that requested notification for the specific FAQ + set q_a_text [ns_reflow_text -- "Question: $question\nAnswer: $answer"] + set text_version [subst {Faq: $faq_name\nAuthor: $name ($email)\n\n$q_a_text\n\n--To view the entire FAQ go to: $faq_url}] - notification::new \ - -type_id [notification::type::get_type_id \ - -short_name one_faq_qa_notif] \ - -object_id $faq_id \ - -response_id $entry_id \ - -notif_subject "New Q&A of $faq_name" \ - -notif_text $new_content + set new_content $text_version + set package_id [ad_conn package_id] + # Notifies the users that requested notification for the specific FAQ + notification::new \ + -type_id [notification::type::get_type_id \ + -short_name one_faq_qa_notif] \ + -object_id $faq_id \ + -response_id $entry_id \ + -notif_subject "New Q&A of $faq_name" \ + -notif_text $new_content - # Notifies the users that requested notification for all FAQ's - - notification::new \ - -type_id [notification::type::get_type_id \ - -short_name all_faq_qa_notif] \ - -object_id $package_id \ - -response_id $entry_id \ - -notif_subject "New Q&A of $faq_name" \ - -notif_text $new_content - - - + # Notifies the users that requested notification for all FAQ's + notification::new \ + -type_id [notification::type::get_type_id \ + -short_name all_faq_qa_notif] \ + -object_id $package_id \ + -response_id $entry_id \ + -notif_subject "New Q&A of $faq_name" \ + -notif_text $new_content } }