Index: openacs-4/packages/contacts/contacts.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/contacts.info,v diff -u -r1.87 -r1.88 --- openacs-4/packages/contacts/contacts.info 14 Jan 2007 11:35:23 -0000 1.87 +++ openacs-4/packages/contacts/contacts.info 23 Jan 2007 18:23:19 -0000 1.88 @@ -7,14 +7,14 @@ f f - + Matthew Geddert This application lets you collaboratively view, edit and categorize contacts. 2006-06-25 Contacts is an application for managing all those people and or organization you need to keep track of. It has a complete UI for storing and categorizing contacts. Each contact can have an arbitrary number of custom attributes associated with it, including other contacts (i.e. a certain contact "belongs" to a certain organization). It also functions as a service contract provider for attributes related to users in your system 0 - + Index: openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.2b26-1.2b27.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/sql/postgresql/upgrade/Attic/upgrade-1.2b26-1.2b27.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.2b26-1.2b27.sql 23 Jan 2007 18:23:19 -0000 1.1 @@ -0,0 +1,9 @@ +-- +-- packages/contacts/sql/postgresql/upgrade/upgrade-1.2b26-1.2b27.sql +-- +-- @author () +-- @creation-date 2007-01-23 +-- @cvs-id $Id: upgrade-1.2b26-1.2b27.sql,v 1.1 2007/01/23 18:23:19 maltes Exp $ +-- + +update acs_attributes set attribute_name = 'home_address' where attribute_name = 'visitaddress'; Index: openacs-4/packages/contacts/tcl/contacts-populate-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-populate-procs.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/packages/contacts/tcl/contacts-populate-procs.tcl 25 Nov 2006 16:28:05 -0000 1.22 +++ openacs-4/packages/contacts/tcl/contacts-populate-procs.tcl 23 Jan 2007 18:23:19 -0000 1.23 @@ -284,6 +284,38 @@ -required_p "f" \ -section_heading "" + set attribute_id [attribute::new \ + -object_type "person" \ + -attribute_name "home_address" \ + -datatype "string" \ + -pretty_name "Home Adress" \ + -pretty_plural "Home Addresses" \ + -table_name "" \ + -column_name "" \ + -default_value "" \ + -min_n_values "1" \ + -max_n_values "1" \ + -sort_order "1" \ + -storage "generic" \ + -static_p "f" \ + -if_does_not_exist] + + lang::message::register -update_sync de_DE acs-translations "ams_attribute_${attribute_id}_pretty_name" "Privatanschrift" + lang::message::register -update_sync de_DE acs-translations "ams_attribute_${attribute_id}_pretty_plural" "Privatanschrift" + + ams::attribute::new \ + -attribute_id $attribute_id \ + -widget "postal_address" \ + -dynamic_p "t" + + ams::list::attribute::map \ + -list_id $list_id \ + -attribute_id $attribute_id \ + -sort_order "90" \ + -required_p "f" \ + -section_heading "" + + # ORGA - REG set list_id [ams::list::get_list_id \ @@ -989,37 +1021,6 @@ -required_p "f" \ -section_heading "" - set attribute_id [attribute::new \ - -object_type "person" \ - -attribute_name "visitaddress" \ - -datatype "string" \ - -pretty_name "Visit Adress" \ - -pretty_plural "Visit Addresses" \ - -table_name "" \ - -column_name "" \ - -default_value "" \ - -min_n_values "1" \ - -max_n_values "1" \ - -sort_order "1" \ - -storage "generic" \ - -static_p "f" \ - -if_does_not_exist] - - lang::message::register -update_sync de_DE acs-translations "ams_attribute_${attribute_id}_pretty_name" "Besuchsanschrift" - lang::message::register -update_sync de_DE acs-translations "ams_attribute_${attribute_id}_pretty_plural" "Besuchsanschrift" - - ams::attribute::new \ - -attribute_id $attribute_id \ - -widget "postal_address" \ - -dynamic_p "t" - - ams::list::attribute::map \ - -list_id $list_id \ - -attribute_id $attribute_id \ - -sort_order "90" \ - -required_p "f" \ - -section_heading "" - # Register Relationships rel_types::create_role -role "parent_company" -pretty_name "Parent Company" -pretty_plural "Parent Companies" Index: openacs-4/packages/contacts/www/import-csv-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/import-csv-2.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/import-csv-2.adp 23 Jan 2007 18:23:20 -0000 1.1 @@ -0,0 +1,9 @@ + +#file-storage.Upload_New_File# +@context;noquote@ + +

+ @instructions;noquote@ +

+ + \ No newline at end of file Index: openacs-4/packages/contacts/www/import-csv-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/import-csv-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/import-csv-2.tcl 23 Jan 2007 18:23:20 -0000 1.1 @@ -0,0 +1,177 @@ +ad_page_contract { + page to import a csv file to the system (contacts) + + @author Nils Lohse (nils.lohse@cognovis.de) + @creation-date 21 Nov 2006 +} { + {return_url ""} + upload_file.tmpfile:tmpfile + upload_file + group_ids:integer,multiple,optional +} -properties { + context:onevalue + instructions:onevalue +} + +package require csv +# Get the file name and file path of the uploaded csv file +set file_name $upload_file +set file_path ${upload_file.tmpfile} + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] +set package_key "contacts" + +set context "[_ contacts.import_csv_2_context]" + +# Initial lists for list ids +set person_elements [list] +set organization_elements [list] +set contact_rels_employment_elements [list] + +if {![info exists group_ids]} { + set group_ids [list] +} + +# Get the CSV File +set new_file_path [ns_tmpnam] +ns_cp $file_path $new_file_path +set csv_stream [open $file_path r] +fconfigure $csv_stream -encoding utf-8 +ns_getcsv $csv_stream headers + +# Get the header information with ";" as the delimitier +set headers [string trim $headers "{}"] +set headers [split $headers ";"] + +set header_options [list] +foreach header $headers { + regsub -all { } $header {_} header + lappend header_options [list $header $header] +} + +# We needed to copy the file as it is deleted after the page runs +set file_path $new_file_path + +# Get the list of attributes +set default_group [contacts::default_group] +if {[lsearch $group_ids $default_group] == -1} { + set group_ids [concat $default_group $group_ids] +} + +foreach group_id $group_ids { + # Adding the list_name to get the elements in the form + set l_name [list ${package_id}__${group_id}] + + foreach object_type {person organization} { + # Retrieve the list ids + set list_id [ams::list::get_list_id -package_key $package_key -object_type $object_type -list_name $l_name] + if {![empty_string_p $list_id]} { + lappend list_ids $list_id + } + } +} + +# Append the list id for the employee relationship +set list_id [ams::list::get_list_id -package_key $package_key -object_type "contact_rels_employment" -list_name $package_id] +if {![empty_string_p $list_id]} { + lappend list_ids $list_id +} + +# Retrieve the elements +foreach list_id $list_ids { + set object_type [db_string object_type "select object_type from ams_lists where list_id = $list_id"] + set element_counter 0 + + foreach element [ams::elements -list_ids $list_id] { + set attribute_id [lindex $element 0] + if {[lsearch [set ${object_type}_elements] $attribute_id] <0 } { + # Append the attribute_id to the list of attributes + lappend ${object_type}_elements $attribute_id + + set required_p [lindex $element 1] + set attribute_name [lindex $element 3] + set widget [lindex $element 5] + set pretty_name [lang::util::localize [lindex $element 4]] + + # If the pretty_name matches on of the headers, then use it + set match [lsearch -regexp $headers (?i)^${pretty_name}\$] + if {$match > -1} { + set attribute_name [lindex $headers $match] + } + + # Make sure you have a header for required elements + if {$required_p} { + set opt_string "" + } else { + set opt_string ",optional" + } + + switch $widget { + postal_address { + # Postal address is made up of many values + set form_element [list ${object_type}.${attribute_id}_delivery_address:text(multiselect)$opt_string \ + [list label "[_ ams.delivery_address] ($pretty_name)"] \ + [list options "$header_options"]] + # Append the secion + if { $element_counter eq 0} { + lappend form_element [list section $object_type] + } + lappend elements $form_element + + # postal code + set form_element [list ${object_type}.${attribute_id}_postal_code:text(multiselect)$opt_string \ + [list label "[_ ams.postal_code] ($pretty_name)"] \ + [list options "$header_options"]] + lappend elements $form_element + + # municipality + set form_element [list ${object_type}.${attribute_id}_municipality:text(multiselect)$opt_string \ + [list label "[_ ams.municipality] ($pretty_name)"] \ + [list options "$header_options"]] + lappend elements $form_element + + # region + set form_element [list ${object_type}.${attribute_id}_region:text(multiselect)$opt_string \ + [list label "[_ ams.region] ($pretty_name)"] \ + [list options "$header_options"]] + lappend elements $form_element + + # country_code + set form_element [list ${object_type}.${attribute_id}_country_code:text(multiselect)$opt_string \ + [list label "[_ ams.country_code] ($pretty_name)"] \ + [list options "$header_options"]] + lappend elements $form_element + + # country + set form_element [list ${object_type}.${attribute_id}_country:text(multiselect)$opt_string \ + [list label "[_ ams.country] ($pretty_name)"] \ + [list options "$header_options"]] + lappend elements $form_element + + } + default { + set form_element [list ${object_type}.${attribute_id}:text(multiselect)$opt_string \ + [list label "$pretty_name"] \ + [list options "$header_options"] \ + [list value "$attribute_name"]] + # Append the secion + if { $element_counter eq 0} { + lappend form_element [list section $object_type] + } + lappend elements $form_element + } + } + incr element_counter + } + } +} + +#ad_return_error test $elements + +ad_form -name csv-import -action import-csv-3 -html { enctype multipart/form-data } -export { return_url file_name file_path person_elements organization_elements contact_rels_employment_elements group_ids} -form $elements + + +set instructions "[_ contacts.lt_csv_import_instructions]" + +ad_return_template Index: openacs-4/packages/contacts/www/import-csv-3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/import-csv-3.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/import-csv-3.adp 23 Jan 2007 18:23:20 -0000 1.1 @@ -0,0 +1,7 @@ + +#file-storage.Upload_New_File# +@context;noquote@ + +

+ @html;noquote@ +

Index: openacs-4/packages/contacts/www/import-csv-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/import-csv-3.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/import-csv-3.tcl 23 Jan 2007 18:23:20 -0000 1.1 @@ -0,0 +1,147 @@ +ad_page_contract { + Page to upload files and generate new task for dpm/fpm + + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2006-01-13 +} { + file_name:notnull + file_path:notnull + {organization:array,multiple} + {person:array,multiple} + {contact_rels_employment:array,multiple,optional} + person_elements + organization_elements + contact_rels_employment_elements + {group_ids ""} +} -properties { + context:onevalue + page_title:onevalue +} + +# Get the number of elements +set organization_element_count [llength $organization_elements] +set person_element_count [llength $person_elements] +set contact_rels_employment_count [llength $contact_rels_employment_elements] + +set html "" +if {$contact_rels_employment_count > 0} { + append html "" +} + +append html "" + +# Append the column headings +append html "" + +foreach object_type {person organization contact_rels_employment} { + foreach element [set ${object_type}_elements] { + + # Retrieve the attribute so we can get the widget + ams::attribute::get -attribute_id $element -array attribute + + # Store the widget in an array so we can reuse it later. + set widget($element) $attribute(widget) + set attribute_name($element) $attribute(attribute_name) + switch $attribute(widget) { + postal_address { + + # The address is made up of the parts + # delivery_address (street), postal_code, municipality (city) + # region, country_code (two chars), country + foreach address_part {delivery_address postal_code municipality region country_code country} { + if {[exists_and_not_null ${object_type}(${element}_${address_part})]} { + append html "" + } else { + append html "" + } + } + } + default { + if {[exists_and_not_null ${object_type}($element)]} { + append html "" + } else { + append html "" + } + } + } + } +} + +append html "" +# Now it is time for the actual contents + +# Get the CSV File +set csv_stream [open $file_path r] +fconfigure $csv_stream -encoding utf-8 +ns_getcsv $csv_stream headers + +# Get the header information with ";" as the delimitier +set headers [string trim $headers "{}"] +set headers [split $headers ";"] + +# Now loop through the CSV Stream as long as there is still a line left. +while {1} { + set n_fields [gets $csv_stream one_line] + if {$n_fields == -1} { + break + } + + append html "" + #Place the attributes in a list + package require csv + set value_list [csv::split $one_line ";"] + for {set i 0} {$i < $n_fields} {incr i} { + set header [lindex $headers $i] + regsub -all { } $header {_} header + set values($header) [lindex $value_list $i] + } + # And now append the values + foreach object_type {person organization contact_rels_employment} { + foreach element [set ${object_type}_elements] { + + # Differentiate between the widgets + switch $widget($element) { + + # Here we have to deal again with the postal_address + postal_address { + + foreach address_part {delivery_address postal_code municipality region country_code country} { + + # Check if a match was made + if {[exists_and_not_null ${object_type}(${element}_${address_part})]} { + + # Column is the name of the header in the CSV + set column [set ${object_type}(${element}_${address_part})] + if {[exists_and_not_null values($column)]} { + append html "" + } else { + append html "" + } + } else { + append html "" + } + } + } + default { + if {[exists_and_not_null ${object_type}($element)]} { + set column [set ${object_type}($element)] + if {[exists_and_not_null values($column)]} { + append html "" + } else { + append html "" + } + } else { + append html "" + } + } + } + } + } + append html "" +} + + +append html "
PersonOrganisationEmployee
[_ ams.${address_part}] \[[attribute::pretty_name -attribute_id $element]::$element\]
([set ${object_type}(${element}_${address_part})])
[_ ams.${address_part}] \[[attribute::pretty_name -attribute_id $element]::$element\][attribute::pretty_name -attribute_id $element] \[$attribute_name($element)::$element\]
([set ${object_type}($element)])
[attribute::pretty_name -attribute_id $element] \[$attribute_name($element)::$element\]
$values($column)$values($column)
" +set context "$file_name" +append html "OK" + \ No newline at end of file Index: openacs-4/packages/contacts/www/import-csv-4.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/import-csv-4.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/import-csv-4.tcl 23 Jan 2007 18:23:20 -0000 1.1 @@ -0,0 +1,301 @@ +ad_page_contract { + Save the import files + + @author Malte Sussdorff + @creation-date 2006-01-13 +} { + file_name:notnull + file_path:notnull + {organization:array,multiple} + {person:array,multiple} + {contact_rels_employment:array,multiple,optional} + person_elements + organization_elements + contact_rels_employment_elements + {group_ids ""} +} -properties { + context:onevalue + page_title:onevalue +} + +# The usual defaults +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +# Get the number of elements +set organization_element_count [llength $organization_elements] +set person_element_count [llength $person_elements] +set contact_rels_employment_count [llength $contact_rels_employment_elements] + + +foreach object_type {person organization contact_rels_employment} { + foreach element [set ${object_type}_elements] { + + # Retrieve the attribute so we can get the widget + ams::attribute::get -attribute_id $element -array attribute + + # Store the widget in an array so we can reuse it later. + set widget($element) $attribute(widget) + } +} + + +# Get the CSV File +set csv_stream [open $file_path r] +fconfigure $csv_stream -encoding utf-8 +ns_getcsv $csv_stream headers + +# Get the header information with ";" as the delimitier +set headers [string trim $headers "{}"] +set headers [split $headers ";"] + +# Get the attribute values for the required attributes to create a person / organization +set orga_attribute_id [attribute::id -object_type organization -attribute_name "name"] +set first_names_id [attribute::id -object_type person -attribute_name first_names] +set last_name_id [attribute::id -object_type person -attribute_name last_name] +set email_id [attribute::id -object_type person -attribute_name email] + + +# Now loop through the CSV Stream as long as there is still a line left. +while {1} { + set n_fields [gets $csv_stream one_line] + if {$n_fields == -1} { + break + } + + #Place the attributes in a list + package require csv + set value_list [csv::split $one_line ";"] + for {set i 0} {$i < $n_fields} {incr i} { + set header [lindex $headers $i] + regsub -all { } $header {_} header + set values($header) [lindex $value_list $i] + } + + + append html "$one_line
" + ############ + # Deal with the organization + ############ + set existing_organizations "" + set organization_revision_id "" + set organization_id "" + set person_id "" + set person_revision_id "" + set existing_persons "" + + if {[exists_and_not_null organization($orga_attribute_id)]} { + set column [set organization($orga_attribute_id)] + if {[exists_and_not_null values($column)]} { + set organization_name $values($column) + + # Figure out if this organization already exists. + set existing_organization_ids [db_list check_existing_orgas {select organization_id from organizations where name = :organization_name } ] + if {[llength $existing_organization_ids] == 0} { + #organization does not exist, create it + append html "Create orga:: $organization_name
" + set organization_id [organization::new -name $organization_name] + set organization_revision_id [contact::revision::new -party_id $organization_id] + + } else { + # If organization already exists, get first id + append html "existing orga:: $organization_name
" + set organization_id [lindex $existing_organization_ids 0] + set organization_revision_id [content::item::get_best_revision -item_id $organization_id] + } + + if {$organization_id ne ""} { + # Add to the groups + foreach group_id $group_ids { + set rel_id [db_string existing_rel { select rel_id from acs_rels where rel_type = 'organization_rel' and object_id_one = :group_id and object_id_two = :organization_id } -default 0] + if {$rel_id eq 0} { + set rel_id [db_string insert_rels2 { select acs_rel__new (NULL::integer,'organization_rel',:group_id,:organization_id,NULL,NULL,NULL) as org_rel_id }] + db_dml insert_state2 { insert into membership_rels (rel_id,member_state) values (:rel_id,'approved') } + append html "Added to group_id :: $group_id" + } + } + } + } + } + + ########## + # Deal with person + ########## + + # Set the person elements + foreach person_element {first_names last_name email} { + # set the default + set $person_element " " + if {[exists_and_not_null person([set ${person_element}_id])]} { + set column [set person([set ${person_element}_id])] + if {[exists_and_not_null values($column)]} { + set $person_element $values($column) + } + } + } + + + # Cheack if the person exists + if {$email ne " "} { + set person_id [party::get_by_email -email $email] + } else { + set person_id "" + set email "" + } + + if {$person_id eq ""} { + set existing_person_ids [db_list check_existing_persons {select party_id from parties, persons where party_id = person_id and last_name = :last_name and first_names = :first_names}] + + # Check if the person is employed by company + # Stop at the first person. + foreach existing_person_id $existing_person_ids { + if {[contact::util::get_employee_organization -employee_id $existing_person_id] eq $organization_id} { + set person_id $existing_person_id + break + } + } + } + + append html "PERSON $person_id :: $first_names :: $last_name :: $email
" + + # Create new. This needs ammendment later + if {$person_id eq "" && ( $first_names ne "" || $last_name ne "")} { + + set person_id [person::new \ + -first_names $first_names \ + -last_name $last_name \ + -email $email] + + # todo: set correct locale + callback contact::person_add -package_id $package_id -person_id $person_id + + # Add to the groups + foreach group_id $group_ids { + group::add_member \ + -group_id $group_id \ + -user_id $person_id \ + -rel_type "membership_rel" + } + } + + #set revision_id to newly created revision for this party_id + set person_revision_id [contact::revision::new -party_id $person_id] + + # And now create the relationship + if {$organization_id ne "" && $person_id ne ""} { + set contact_rels_employment_revision_id [relation_add "contact_rels_employment" $person_id $organization_id] + } + + # And now append the values + foreach object_type {person organization contact_rels_employment} { + if {[exists_and_not_null ${object_type}_revision_id]} { + set revision_id [set ${object_type}_revision_id] + } else { + break + } + + foreach attribute_id [set ${object_type}_elements] { + + # Differentiate between the widgets + switch $widget($attribute_id) { + postal_address { + # Here we have to deal again with the postal_address + + # Let's assume by default we are not going to save + # the address + set save_p 0 + + # Initialize the variable + foreach address_part {delivery_address postal_code municipality region country_code country} { + set $address_part "" + # Check if a match was made + + if {[exists_and_not_null ${object_type}(${attribute_id}_${address_part})]} { + # Column is the name of the header in the CSV + set column [set ${object_type}(${attribute_id}_${address_part})] + if {[exists_and_not_null values($column)]} { + append html "$values($column) - " + set $address_part $values($column) + # We have something in the address, so + # save it. + set save_p 1 + } else { + set $address_part "" + } + } + } + + # Now make the country a country code + if {![exists_and_not_null country_code]} { + if {[exists_and_not_null country]} { + # We do have the country, so let's figure + # out the code for it. + set country_code [ref_countries::get_country_code -country $country] + } elseif {$save_p} { + set country_code [lindex [parameter::get_from_package_key -parameter "DefaultISOCountryCode" -package_key "ams" -default ""] 0] + } + } + + # Now save it + if {$country_code ne ""} { + append html "postal:: $country_code $municipality
" + ams::attribute::save::postal_address -object_id [set ${object_type}_revision_id] \ + -attribute_id $attribute_id -object_type $object_type -delivery_address $delivery_address \ + -municipality $municipality -region $region -postal_code $postal_code -country_code $country_code + } + } + date { + # Date widgets + if {[exists_and_not_null ${object_type}($attribute_id)]} { + set column [set ${object_type}($attribute_id)] + if {[exists_and_not_null values($column)]} { + if {[regexp {^([0-9]+)\.([0-9]+)\.([0-9]+)$} $values($column) match day month year]} { + append html "DATE SAVED: $values($column) :: $person_id" + ams::attribute::save::timestamp -object_id [set ${object_type}_revision_id] -attribute_id $attribute_id -object_type $object_type -day $day -year $year -month $month -hour 00 -minute 00 + } + } + } + } + telecom_number - mobile_number { + # Phone Attributes + if {[exists_and_not_null ${object_type}($attribute_id)]} { + set column [set ${object_type}($attribute_id)] + if {[exists_and_not_null values($column)]} { + ams::attribute::save::simple_phone_number -object_id [set ${object_type}_revision_id] -attribute_id $attribute_id -phone_number $values($column) -object_type $object_type + } + } + } + checkbox - select - multiselect { + # Multiple Choice + if {[exists_and_not_null ${object_type}($attribute_id)]} { + set column [set ${object_type}($attribute_id)] + if {[exists_and_not_null values($column)]} { + ams::attribute::save::mc -object_id [set ${object_type}_revision_id] -attribute_id $attribute_id -value $values($column) -object_type $object_type + } + } + } + integer { + # Number type widgets + if {[exists_and_not_null ${object_type}($attribute_id)]} { + set column [set ${object_type}($attribute_id)] + if {[exists_and_not_null values($column)]} { + ams::attribute::save::number -object_id [set ${object_type}_revision_id] -attribute_id $attribute_id -number $values($column) -object_type $object_type + } + } + } + textbox - textarea - richtext - url - skype - default { + # Text type widgets + if {[exists_and_not_null ${object_type}($attribute_id)]} { + set column [set ${object_type}($attribute_id)] + if {[exists_and_not_null values($column)]} { + ams::attribute::save::text -object_id [set ${object_type}_revision_id] -attribute_id $attribute_id \ + -value $values($column) -object_type $object_type + } + } + } + } + } + } + +} +ad_return_error test $html Index: openacs-4/packages/contacts/www/import-csv.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/import-csv.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/import-csv.adp 23 Jan 2007 18:23:20 -0000 1.1 @@ -0,0 +1,9 @@ + +#file-storage.Upload_New_File# +@context;noquote@ + +

+ @instructions;noquote@ +

+ + \ No newline at end of file Index: openacs-4/packages/contacts/www/import-csv.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/import-csv.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/www/import-csv.tcl 23 Jan 2007 18:23:20 -0000 1.1 @@ -0,0 +1,35 @@ +ad_page_contract { + page to import a csv file to the system (contacts) + + @author Nils Lohse (nils.lohse@cognovis.de) + @creation-date 21 Nov 2006 +} { + upload_file:trim,optional + {return_url ""} + upload_file.tmpfile:tmpfile,optional +} -properties { + context:onevalue + instructions:onevalue +} + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] + +set context "[_ file-storage.Add_File]" + +set options [contact::groups -output "ad_form"] +#ad_return_error test $options + +ad_form -name file-import -action import-csv-2 -html { enctype multipart/form-data } -export { return_url } -form { + {upload_file:file {label "[_ file-storage.Upload_a_file]"} {html "size 30"}} + {group_ids:integer(checkbox),multiple,optional + {label "[_ contacts.Groups]"} + {options "$options"} + {help_text "[_ contacts.cvs_groups_help]"} + } +} + + +set instructions "[_ contacts.lt_csv_import_instructions]" + +ad_return_template