Index: openacs-4/contrib/packages/mailing-lists/www/madmin/user-subscribe.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/mailing-lists/www/madmin/Attic/user-subscribe.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/mailing-lists/www/madmin/user-subscribe.tcl 23 Apr 2006 11:07:54 -0000 1.1.2.1 @@ -0,0 +1,82 @@ +ad_page_contract { + + Unsubscribe the users passed in from the subscription list in the multirow +} { + + list_id:integer +} + + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +permission::require_permission -object_id $list_id -privilege admin + +template::list::create \ + -name unsubscribed \ + -multirow unsubscribed \ + -key user_id \ + -bulk_actions { + "Subscribe" "user-subscribe-2" "Subscribe checked users" + } \ + -bulk_action_method post -bulk_action_export_vars { + list_id + } \ + -elements { + full_name {label "Name" + link_url_col user_url + link_html {user_id} + } + email {label "EMail" + } + + } + + + +db_multirow -extend {user_url} unsubscribed unsubscribed "" { + set user_url [acs_community_member_admin_url -user_id $user_id] +} + +set context_bar [list [list "." Administration] "Mailing List Suscribers"] +set export_vars [export_form_vars list_id] + +ad_form -name user_search -cancel_url . -form { + {user_id:search + {result_datatype integer} + {label {Search for user}} + {help_text {Type part of the name or email of the user you would like to add}} + {search_query {[db_map user_search]}} + } + {list_id:text(hidden)} + {confirmation_p:text(checkbox),optional {label "Send confirmation?"} {options {{"Yes" t}}}} + {no_emails_p:text(checkbox),optional {label "Suppress all emails?"} {options {{"Yes" t}}}} +} -on_submit { + + if {[exists_and_not_null no_emails_p]} { + set no_emails_p t + set confirmed_p t + } else { + set no_emails_p f + if {[exists_and_not_null confirmation_p]} { + set confirmed_p f + } else { + set confirmed_p t + } + } + + # subscribe user. check if user already has a map entry + if {[mailing_list::add_user -list_id $list_id -user_id $user_id -confirmed_p $confirmed_p]} { + if {$no_emails_p == "f"} { + # user is newly added to this list + # now send confirmation message to user if requested + if {$confirmed_p == "f"} { + mailing_list::util::send_mail -user_id $user_id -from_email $sender_email -subject $confirm_subject -body $confirm_body -mime_type $confirm_mime_type -charset $mime_charset -link $confirmation_link -new_password $user_password + } else { + # send welcome message if no confirmation needed + mailing_list::util::send_mail -user_id $user_id -from_email $sender_email -subject $welcome_subject -body $welcome_body -mime_type $welcome_mime_type -charset $mime_charset -link "$unsubscribe_link?[export_url_vars user_id]" -new_password $user_password + } + } + } +# ad_returnredirect "list-subscribers?[export_url_vars list_id]" +} +