Index: openacs-4/packages/contacts/lib/label.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/label.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/label.adp 16 Feb 2006 14:07:36 -0000 1.1
@@ -0,0 +1 @@
+
Index: openacs-4/packages/contacts/lib/label.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/label.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/label.tcl 16 Feb 2006 14:07:36 -0000 1.1
@@ -0,0 +1,204 @@
+# packages/contacts/lib/email.tcl
+# Template for email inclusion
+# @author Malte Sussdorff (sussdorff@sussdorff.de)
+# @creation-date 2005-06-14
+# @arch-tag: 48fe00a8-a527-4848-b5de-0f76dfb60291
+# @cvs-id $Id: label.tcl,v 1.1 2006/02/16 14:07:36 maltes Exp $
+
+foreach required_param {party_ids recipients} {
+ if {![info exists $required_param]} {
+ return -code error "$required_param is a required parameter."
+ }
+}
+foreach optional_param {return_url} {
+ if {![info exists $optional_param]} {
+ set $optional_param {}
+ }
+}
+set message_type "label"
+
+ad_form -action message \
+ -name letter \
+ -cancel_label "[_ contacts.Cancel]" \
+ -cancel_url $return_url \
+ -edit_buttons [list [list "[_ contacts.create_label] (this make take a bit, please be patient)" print]] \
+ -export {party_ids return_url title message_type} \
+ -form {
+ message_id:key
+ {recipients:text(inform) {label "Contacts to Export"}}
+ {label_type:text(select),optional
+ {label "[_ contacts.Label_Type]"}
+ {options {{"Avery 5160 (1in x 2.5in, 30 per sheet)" avery5160}}}
+ }
+ } -on_request {
+ } -on_submit {
+ # display the progress bar
+
+ ad_progress_bar_begin \
+ -title "Generating PDF" \
+ -message_1 "Generating mailing labels for the contacts you selected, please wait..." \
+ -message_2 "You will be automatically redirected once the file is complete."
+
+
+
+ set labels [list]
+ foreach party_id $party_ids {
+ set name [contact::name -party_id $party_id]
+ set mailing_address [contact::message::mailing_address -party_id $party_id -format "text/plain"]
+ if {[empty_string_p $mailing_address]} {
+ ad_return_error [_ contacts.Error] [_ contacts.lt_there_was_an_error_processing_this_request]
+ break
+ }
+
+ set name [openreport::clean_string_for_rml -string ${name}]
+ set mailing_address [openreport::clean_string_for_rml -string ${mailing_address}]
+
+ set one "
+${name}
+
+
+${mailing_address}
+
+"
+ lappend labels [string trim $one]
+
+
+ }
+
+
+ if { $label_type == "avery5160" } {
+
+ # onLoad=\"window.print()\"
+ set rml {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+ }
+ set rml [string trim $rml]
+ append rml "\n[join $labels "\n\n\n"]"
+ append rml "\n\n"
+
+ # Gerneate the pdf
+ set filename "contacts_labels_[ad_conn user_id]_[dt_systime -format {%Y%m%d-%H%M%S}]_[ad_generate_random_string].pdf"
+ set pdf_filename [openreport::trml2pdf -rml $rml -filename $filename]
+ util_user_message -html -message "The pdf you requested is available. You may download it now."
+ ad_progress_bar_end -url "[ad_conn package_url]pdfs/"
+
+# ad_returnredirect
+ ad_script_abort
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.2b3-1.2b4.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.2b3-1.2b4.sql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.2b3-1.2b4.sql 15 Feb 2006 10:29:50 -0000 1.3
+++ openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.2b3-1.2b4.sql 16 Feb 2006 14:07:36 -0000 1.4
@@ -12,7 +12,7 @@
-- singleton contacts instances that are upgraded need to be set to use the
-- subsites application group so that behavior doesn't change for users
-update apm_parameter_values set attr_value = '1' where parameter_id in ( select parameter_id from apm_parameters where package_key = 'contacts' and parameter_name = 'UseSubsiteAsDefaultGroup' );
+update apm_parameter_values set attr_value = '1' where parameter_id in ( select parameter_id from apm_parameters where package_key = 'contacts' and parameter_name = 'UseSubsiteAsDefaultGroup' );
-- since contacts was singleton we know there is only one package_id we need to use
-- in migrating all our user data to the appropriate package
Index: openacs-4/packages/contacts/tcl/labels-redirect-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/Attic/labels-redirect-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/tcl/labels-redirect-procs.tcl 16 Feb 2006 14:07:36 -0000 1.1
@@ -0,0 +1,33 @@
+ad_library {
+
+ Callback procs for contacts
+
+ @author Matthew Geddert (openacs@geddert.com)
+ @creation-date 2006-02-06
+ @arch-tag:
+ @cvs-id $Id: labels-redirect-procs.tcl,v 1.1 2006/02/16 14:07:36 maltes Exp $
+}
+
+ad_proc -public -callback contacts::redirect -impl labels {
+ {-party_id ""}
+ {-action ""}
+} {
+ redirect the contact to the correct pdf stuff
+} {
+ set url [ad_conn url]
+ if { [regexp {^/contacts/pdfs/} $url match] } {
+ # this is a pdf url
+ if { $url == "/contacts/pdfs/" } {
+ rp_internal_redirect "/packages/contacts/lib/pdfs"
+ } else {
+ set filename [lindex [ad_conn urlv] end]
+ if { ![regsub "^contacts_labels_[ad_conn user_id](.*).pdf$" $filename {} bogus] || ![file exists "/tmp/${filename}"] } {
+ ad_return_error "No Permission" "You do not have permission to view this file, or the temporary file has been deleted."
+ } else {
+ ns_returnfile 200 "application/pdf" "/tmp/${filename}"
+ }
+ }
+ }
+
+}
+
Index: openacs-4/packages/contacts/www/message.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/message.tcl,v
diff -u -r1.25 -r1.26
--- openacs-4/packages/contacts/www/message.tcl 15 Feb 2006 10:06:36 -0000 1.25
+++ openacs-4/packages/contacts/www/message.tcl 16 Feb 2006 14:07:37 -0000 1.26
@@ -24,7 +24,7 @@
{context_id:integer ""}
} -validate {
valid_message_type -requires {message_type} {
- if { [lsearch [list oo_mailing email letter] $message_type] < 0 } {
+ if { [lsearch [list oo_mailing email letter label] $message_type] < 0 } {
ad_complain "[_ contacts.lt_Your_provided_an_inva]"
}
}
@@ -80,7 +80,7 @@
set contact_link [lindex $recipient 2]
set email_p [lindex $recipient 3]
set letter_p [lindex $recipient 4]
- if { $message_type == "letter" } {
+ if { $message_type == "letter" || $message_type == "label" } {
if { $letter_p } {
lappend party_ids $party_id
lappend recipients $contact_link
@@ -205,7 +205,7 @@
set message_options [list]
foreach op $message_type_options {
set message_type [lindex $op 1]
- if {$message_type == "letter" || $message_type == "email"} {
+ if {$message_type == "letter" || $message_type == "email" || $message_type == "label" } {
lappend message_options [list "-- [_ contacts.New] [lindex $op 0] --" $message_type]
} else {
set ${message_type}_options [list [list [_ contacts.--none--] ""]]