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 -r1.7 -r1.8 --- openacs-4/packages/faq/www/one-faq.tcl 8 Jun 2006 01:29:22 -0000 1.7 +++ openacs-4/packages/faq/www/one-faq.tcl 15 May 2007 20:14:35 -0000 1.8 @@ -19,36 +19,24 @@ ad_require_permission $package_id faq_view_faq -if {![db_0or1row faq_info "select faq_name, separate_p from faqs where faq_id=:faq_id"]} { +faq::get_instance_info -arrayname faq_info -faq_id $faq_id + +if { [empty_string_p $faq_info(faq_name)] } { ns_returnnotfound ad_script_abort } -set context [list $faq_name] +set context [list $faq_info(faq_name)] # Use Categories? set use_categories_p [parameter::get -parameter "EnableCategoriesP" -default 0] if { $use_categories_p == 1 && [exists_and_not_null category_id] } { - - set select_sql_query "select entry_id, faq_id, question, answer, sort_key -from faq_q_and_as qa, category_object_map com, acs_named_objects nam -where faq_id = :faq_id and -com.object_id = qa.entry_id and -nam.package_id = :package_id and -com.object_id = nam.object_id and -com.category_id = :category_id -order by sort_key" - + db_multirow one_question categorized_faq "" {} } else { - - set select_sql_query "select entry_id, faq_id, question, answer, sort_key -from faq_q_and_as -where faq_id = :faq_id -order by sort_key" + db_multirow one_question uncategorized_faq "" {} } -db_multirow one_question q_and_a_info $select_sql_query # Site-Wide Categories if { $use_categories_p == 1} { @@ -60,23 +48,12 @@ Category with ID $category_id doesn't exist" return } - # Show Category in context bar - append context_base_url /cat/$category_id - lappend context [list $context_base_url $category_name] - set type "all" - } - - # Cut the URL off the last item in the context bar - if { [llength $context] > 0 } { - set context [lreplace $context end end [lindex [lindex $context end] end]] - } - - db_multirow -unclobber -extend { category_name tree_name } categories categories { - select c.category_id as category_id, c.tree_id - from categories c, category_tree_map ctm - where ctm.tree_id = c.tree_id - and ctm.object_id = :package_id - } { + + # Replace last element of context (the FAQ name) with link to that FAQ and current category name + set context [lreplace $context end end [list "one-faq?faq_id=$faq_id" $faq_info(faq_name)] $category_name] + } + + db_multirow -unclobber -extend { category_name tree_name } categories faq_categories "" { set category_name [category::get_name $category_id] set tree_name [category_tree::get_name $tree_id] } @@ -85,14 +62,14 @@ set notification_chunk [notification::display::request_widget \ -type one_faq_qa_notif \ -object_id $faq_id \ - -pretty_name $faq_name \ + -pretty_name $faq_info(faq_name) \ -url [ad_conn url]?faq_id=$faq_id \ ] set return_url "[ad_conn url]?faq_id=$faq_id" if { [apm_package_installed_p "general-comments"] && [ad_parameter "GeneralCommentsP" -package_id [ad_conn package_id]] } { - set gc_link [general_comments_create_link $faq_id $return_url] + set gc_link [general_comments_create_link -link_attributes { title="#general-comments.Add_comment#" } $faq_id $return_url] set gc_comments [general_comments_get_comments $faq_id $return_url] } else { set gc_link ""