Index: openacs-4/packages/ams/www/list-attributes.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attributes.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/ams/www/list-attributes.tcl	10 Feb 2006 01:23:26 -0000	1.5
+++ openacs-4/packages/ams/www/list-attributes.tcl	10 Apr 2006 17:21:52 -0000	1.6
@@ -18,35 +18,41 @@
 set object_type $list_info(object_type)
 set list_name $list_info(list_name)
 
-# Now we are going to get the default 
-# list_id according to the object_type
-set default_list_id [db_string get_default_list { } -default {}]
+# If we have contacts installed we can do some duplicate checking
 
-if { [string equal $default_list_id $list_id] } {
-    # We are assigning values to the default list
-    # so we are going to get all the mapped atributes
-    # for the other lists
-    set name_first_part [lindex [split $list_name "__"] 0]
-    set mapped_attributes_list [db_list get_attributes_list { }]
-    set error_message "The_attribute_is_already"
-} else {
-    # Not the default list. We get all the attributes 
-    # of the default list_id
-    set mapped_attributes_list [db_list get_default_attributes_list { }]
-    set error_message "The_attribute_is_already_default"
-}
+if {[apm_package_installed_p "contacts"]} {
+    # Now we are going to get the default 
+    # list_id according to the object_type
+    set contacts_package_id [lindex [split $list_id "__"] 0]
+    set default_group [contacts::default_group -package_id $contacts_package_id]
+    set default_list_name "${contacts_package_id}__${default_group}"
+    set default_list_id [db_string get_default_list "" -default ""]
+    if { [string equal $default_list_id $list_id] } {
+	# We are assigning values to the default list
+	# so we are going to get all the mapped atributes
+	# for the other lists
+	set name_first_part [lindex [split $list_name "__"] 0]
+	set mapped_attributes_list [db_list get_attributes_list { }]
+	set error_message "The_attribute_is_already"
+    } else {
+	# Not the default list. We get all the attributes 
+	# of the default list_id
+	set mapped_attributes_list [db_list get_default_attributes_list { }]
+	set error_message "The_attribute_is_already_default"
+    }
 
-# Before mapping any new attributes we check 
-# if they don't exist in the mapped attribute 
-# list, otherwise we would have duplicates
-foreach attribute_id $attribute_id {
-    if { ![string equal [lsearch $mapped_attributes_list $attribute_id] "-1"] } {
-	ad_return_complaint 1 "[_ ams.$error_message]"
-	ad_script_abort
+    # Before mapping any new attributes we check 
+    # if they don't exist in the mapped attribute 
+    # list, otherwise we would have duplicates
+    
+    foreach attribute_id $attribute_id {
+	if { ![string equal [lsearch $mapped_attributes_list $attribute_id] "-1"] } {
+	    ad_return_complaint 1 "[_ ams.$error_message]"
+	    ad_script_abort
+	}
     }
 }
 
-
 # If it reachs this point it means that we can map all attributes.
 foreach attribute_id $attribute_id {
     ams::list::attribute::${command} -list_id $list_id -attribute_id $attribute_id
Index: openacs-4/packages/ams/www/list-attributes.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-attributes.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/ams/www/list-attributes.xql	28 Oct 2005 16:53:54 -0000	1.1
+++ openacs-4/packages/ams/www/list-attributes.xql	10 Apr 2006 17:21:52 -0000	1.2
@@ -9,7 +9,7 @@
 		ams_lists 
 	where 
 		object_type = :object_type 
-		and list_name like '%__-2'
+		and list_name = :default_list_name
     </querytext>
 </fullquery>
 
Index: openacs-4/packages/ams/www/list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/ams/www/list.tcl	22 Nov 2005 16:51:06 -0000	1.8
+++ openacs-4/packages/ams/www/list.tcl	10 Apr 2006 17:21:52 -0000	1.9
@@ -164,14 +164,21 @@
     -multirow unmapped_attributes \
     -key attribute_id \
     -row_pretty_plural "[_ ams.Unmapped_Attributes]" \
-    -checkbox_name checkbox \
+    -checkbox_name checkbox_unmap \
     -selected_format "normal" \
     -class "list" \
     -main_class "list" \
     -sub_class "narrow" \
     -pass_properties {
-    } -actions {
-    } -elements {
+     } -bulk_actions {
+	 "#ams.Map#" "list-attributes" "#ams.lt_Map_check_attribute#"
+     } -bulk_action_export_vars { 
+	 list_id
+	 return_url
+	 return_url_label
+	 {command "map"}
+     } -actions {
+     } -elements {
         attribute_name {
             label "[_ ams.Attribute]"
             display_col attribute_name
@@ -205,6 +212,7 @@
             label "[_ ams.Table]"
             layout table
             row {
+		checkbox_unmap {}
                 pretty_name {}
                 widget {}
                 action {}