Index: openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl 11 Dec 2001 00:12:16 -0000 1.17 +++ openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl 11 Dec 2001 04:32:54 -0000 1.18 @@ -100,45 +100,41 @@ " - if { [llength $list_of_package_ids] > 1 } { +# if { [llength $list_of_package_ids] > 1 } { # more than one package_id, we're in a workspace - foreach package_id $list_of_package_ids { - - if { [db_string count_faqs "select count(*) from faq_q_and_as, acs_objects where context_id = :package_id and object_id=faq_id" ] != 0 } { - # we have faqs - append template "" - - append template " - - - " - - db_foreach select_faqs $query { - append template "" - } - } else { - # workspace no faqs - } - } - } else { - set package_id $config(package_id) - # not in workspace - if { [db_string count_faqs "select count(*) from faq_q_and_as, acs_objects where context_id = :package_id and object_id=faq_id" ] != 0 } { - # we have faqs - append template " - - - " - - db_foreach select_faqs $query { - append template "" - } - } else { - # no faqs - append template "" - } + foreach package_id $list_of_package_ids { + + if { [db_string count_faqs "select count(*) as count from faq_q_and_as, acs_objects where context_id = :package_id and object_id=faq_id" ] != 0 } { + + append template "" + + + db_foreach select_faqs $query { + append template "" } + } else { + # workspace no faqs + } + } +# } else { +# set package_id $config(package_id) +# +# # not in workspace +# if { [db_string count_faqs "select count(*) as faqcount from faq_q_and_as, acs_objects where context_id = :package_id and object_id=faq_id" ] != 0 } { +# # we have faqs +# append template " +# +# " +# +# db_foreach select_faqs $query { +# append template "" +# } +# } else { +# # no faqs +# append template "" +# } +# } append template "
Faqs from [db_string select_name "select name from site_nodes where node_id= (select parent_id from site_nodes where object_id=:package_id)" -default ""] (more)
FAQ ListOne Question
$faq_name$question
FAQ ListOne Question
$faq_name$question
No faqs available
[db_string select_name "select name from site_nodes where node_id= (select parent_id from site_nodes where object_id=:package_id)" -default ""] (more)
$faq_name
FAQ List
$faq_name
No faqs available
" } @@ -170,14 +166,18 @@ } { # get the element IDs (could be more than one!) set element_ids [portal::get_element_ids_by_ds $portal_id [my_name]] - - # remove all elements + db_transaction { foreach element_id $element_ids { - portal::remove_element $element_id + # Highly simplified (ben) + portal::remove_element_param_value -element_id $element_id -key package_id -value $package_id + + # Check if we should really remove the element + if {[llength [portal::get_element_param_list -element_id $element_id -key package_id]] == 0} { + portal::remove_element $element_id + } } } - } ad_proc -public make_self_available { portal_id