Index: openacs-4/packages/faq/faq.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/faq.info,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/faq/faq.info 1 Apr 2004 22:52:45 -0000 1.11 +++ openacs-4/packages/faq/faq.info 19 May 2004 20:07:02 -0000 1.12 @@ -14,10 +14,13 @@ 2003-11-10 Ybos Corporation Handles frequently asked questions Q&A presentation. Can be one Q&A per page or all presented flat. Straightforward application with room for improvement. + 0 + + - + Index: openacs-4/packages/faq/tcl/faq-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/faq-install-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/faq/tcl/faq-install-procs.tcl 1 Apr 2004 22:52:47 -0000 1.1 +++ openacs-4/packages/faq/tcl/faq-install-procs.tcl 19 May 2004 20:07:02 -0000 1.2 @@ -12,12 +12,14 @@ package install callback } { faq::sc::register_implementations + faq::apm_callback::package_install } ad_proc -private faq::install::package_uninstall {} { package uninstall callback } { faq::sc::unregister_implementations + faq::apm_callback::package_uninstall } ad_proc -private faq::install::package_upgrade { @@ -34,6 +36,7 @@ # need to install the faq callbacks faq::sc::register_faq_fts_impl faq::sc::register_faq_q_and_a_fts_impl + faq::apm_callback::package_install } } } Index: openacs-4/packages/faq/tcl/faq-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/faq-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/tcl/faq-procs.tcl 19 May 2004 20:09:43 -0000 1.1 @@ -0,0 +1,26 @@ +ad_library { + + Faq Library - Reply Handling + + @creation-date 2004-03-31 + @author Ben Adida + @Modifyed by Gerardo Morales +} + + +namespace eval faq::notification { + + ad_proc -public get_url { + object_id + } { + returns a full url to the object_id. + handles messages and forums. + } { + + set q_and_a_id $object_id + db_1row get_faq_id "*SQL*" + set faq_url "[ad_url][ad_conn package_url]" + return ${faq_url}one-faq?faq_id=$faq_id + + } +} Index: openacs-4/packages/faq/tcl/faq-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/faq-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/tcl/faq-procs.xql 19 May 2004 20:09:43 -0000 1.1 @@ -0,0 +1,21 @@ + + + + + + select faq_id from faq_q_and_as + where entry_id = $q_and_a_id + + + + + + + + + + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/tcl/q-and-a-procs.tcl 19 May 2004 20:09:43 -0000 1.1 @@ -0,0 +1,61 @@ +ad_library { + + Faq Library - Reply Handling + @creation-date 2004-04-02 + @Author Gerardo Morales +} + + +namespace eval faq::notification_delivery { + + ad_proc -public do_notification { + question + answer + entry_id + faq_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 [wrap_string $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 + + 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 + + + + } +} Index: openacs-4/packages/faq/tcl/q-and-a-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/Attic/q-and-a-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/tcl/q-and-a-procs.xql 19 May 2004 20:09:43 -0000 1.1 @@ -0,0 +1,23 @@ + + + + + + + select faq_name from + faqs where faq_id = :faq_id + + + + + + select persons.first_names || ' ' || persons.last_name as name, + parties.email + from persons, parties + where person_id = :user_id + and person_id = party_id + + + + + Index: openacs-4/packages/faq/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/index.adp,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/faq/www/index.adp 22 Dec 2003 23:24:40 -0000 1.8 +++ openacs-4/packages/faq/www/index.adp 19 May 2004 20:07:02 -0000 1.9 @@ -1,7 +1,9 @@ @context;noquote@ #faq.FAQs# - +

+ @notification_chunk;noquote@ +

#faq.administer# Index: openacs-4/packages/faq/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/index.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/faq/www/index.tcl 17 May 2003 10:34:44 -0000 1.5 +++ openacs-4/packages/faq/www/index.tcl 19 May 2004 20:07:02 -0000 1.6 @@ -27,6 +27,14 @@ set admin_p 0 + +set notification_chunk [notification::display::request_widget \ + -type all_faq_qa_notif \ + -object_id [ad_conn package_id] \ + -pretty_name FAQs \ + -url [ad_conn url] \ + ] + if {[ad_permission_p -user_id $user_id $package_id faq_admin_faq]} { set admin_p 1 } Index: openacs-4/packages/faq/www/one-faq.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/one-faq.adp,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/faq/www/one-faq.adp 28 Mar 2004 15:09:11 -0000 1.9 +++ openacs-4/packages/faq/www/one-faq.adp 19 May 2004 20:07:02 -0000 1.10 @@ -1,7 +1,9 @@ @context;noquote@ +

+ @notification_chunk;noquote@ +

@faq_name;noquote@ -@faq_id;noquote@ #faq.lt_no_questions# Index: openacs-4/packages/faq/www/one-faq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/one-faq.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/faq/www/one-faq.tcl 4 Sep 2002 13:28:32 -0000 1.2 +++ openacs-4/packages/faq/www/one-faq.tcl 19 May 2004 20:07:02 -0000 1.3 @@ -27,4 +27,11 @@ where faq_id = :faq_id order by sort_key" +set notification_chunk [notification::display::request_widget \ + -type one_faq_qa_notif \ + -object_id $faq_id \ + -pretty_name $faq_name \ + -url [ad_conn url]?faq_id=$faq_id \ + ] + ad_return_template Index: openacs-4/packages/faq/www/admin/q-and-a-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/q-and-a-add-edit.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/faq/www/admin/q-and-a-add-edit.tcl 28 Nov 2003 20:41:31 -0000 1.2 +++ openacs-4/packages/faq/www/admin/q-and-a-add-edit.tcl 19 May 2004 20:07:03 -0000 1.3 @@ -93,6 +93,7 @@ answer = :answer where entry_id = :entry_id" } -after_submit { + faq::notification_delivery::do_notification $question $answer $entry_id $faq_id $user_id ad_returnredirect "one-faq?faq_id=$faq_id" ad_script_abort }