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 "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)
|
"
-
- append template "
- FAQ List |
- One Question |
-
"
-
- db_foreach select_faqs $query {
- append template "$faq_name | $question |
"
- }
- } 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 "
- FAQ List |
- One Question |
-
"
-
- db_foreach select_faqs $query {
- append template "$faq_name | $question |
"
- }
- } else {
- # no faqs
- append template "No faqs available | |
"
- }
+ 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_string select_name "select name from site_nodes where node_id= (select parent_id from site_nodes where object_id=:package_id)" -default ""] (more)
|
"
+
+
+ db_foreach select_faqs $query {
+ append template "$faq_name |
"
}
+ } 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 "
+# FAQ List |
+#
"
+#
+# db_foreach select_faqs $query {
+# append template "$faq_name |
"
+# }
+# } else {
+# # no faqs
+# append template "No faqs available | |
"
+# }
+# }
append template "
"
}
@@ -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