Index: openacs-4/contrib/packages/events/www/manage/reg-approve.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/events/www/manage/reg-approve.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/events/www/manage/reg-approve.tcl 22 Feb 2005 22:28:39 -0000 1.1
@@ -0,0 +1,43 @@
+# events/www/admin/reg-approve.tcl
+ad_page_contract {
+
+ Approve a Registration.
+
+ @param reg_id the registration to cancel
+
+ @author Matthew Geddert (geddert@yahoo.com)
+ @creation date 2002-11-11
+
+} {
+ {reg_id:naturalnum,notnull}
+ {return_url ""}
+} -validate {
+ registration_exists_p -requires {reg_id} {
+ if { ![events::registration::exists_p -reg_id $reg_id] } {
+ ad_complain "We could not find the registration you asked for."
+ return 0
+ }
+ return 1
+ }
+}
+
+events::registration::get -reg_id $reg_id -array reg_info
+events::event::get_stats -event_id $reg_info(event_id) -array event_stats
+
+set count_spotsremaining [expr $event_stats(max_people) - $event_stats(approved)]
+
+if { ![empty_string_p $event_stats(max_people)] && $count_spotsremaining == 0 } {
+ ad_return_error "Max Number Already Reached" "The maximum number of registrations for this event has already been reached.
+ You cannot approve of this registration before cancelling or waitlisting somebody else, or editing
+ the maximum number of registrants allowed for this event."
+} else {
+ events::registration::approve -reg_id $reg_id
+
+ if {![exists_and_not_null return_url]} {
+ set return_url "reg-view?reg_id=$reg_id"
+ }
+
+ ad_returnredirect $return_url
+}
+
+ad_script_abort
Index: openacs-4/contrib/packages/events/www/manage/reg-cancel-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/events/www/manage/reg-cancel-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/events/www/manage/reg-cancel-2.tcl 22 Feb 2005 22:28:39 -0000 1.1
@@ -0,0 +1,144 @@
+# File: events/admin/reg-cancel-2.tcl
+# Owner: bryanche@arsdigita.com
+# Purpose: Cancel one registration
+#####
+
+ad_page_contract {
+ Cancels a registration.
+
+ @param reg_id the registration to cancel
+ @param cancel_reason why we are canceling this reg
+
+ @author Bryan Che (bryanche@arsdigita.com)
+ @cvs_id reg-cancel-2.tcl,v 3.9.2.5 2000/09/22 01:37:39 kevin Exp
+} {
+ {reg_id:integer,notnull}
+ {cancel_reason:html,trim,optional}
+}
+
+set user_id [ad_maybe_redirect_for_registration]
+
+if {![exists_and_not_null cancel_reason]} {
+ set cancel_msg ""
+} else {
+ set cancel_msg "Explanation:\n\n"
+
+ # Strip all ^M's out of any interactively entered text message.
+ # This is because Windows browsers insist on inserting CRLF at
+ # the end of each line of a TEXTAREA.
+ regsub -all "\r" $cancel_reason "" cancel_reason
+ append cancel_msg $cancel_reason
+}
+
+
+
+set reg_check [db_0or1row sel_reg "select '1_reg_check' from
+events_registrations
+where reg_id = :reg_id
+"]
+
+if {!$reg_check} {
+ append whole_page "
+ [ad_header "Could not find registration"]
+
Couldn't find registration
+ [ad_context_bar_ws [list "index.tcl" "Events Administration"] "Cancel Registration"]
+
+
+ Registration $reg_id was not found in the database.
+ [ad_footer]"
+
+ return
+}
+
+#cancel the registration
+db_transaction {
+ db_dml update_reg "update events_registrations
+ set reg_state = 'canceled'
+ where reg_id = :reg_id"
+
+ #try to remove the user from the event's user group
+ set user_check [db_0or1row sel_user_info "select
+ e.group_id as event_group_id, r.user_id as reg_user_id, e.event_id
+ from events_events e, events_registrations r, events_prices p
+ where r.reg_id = :reg_id
+ and p.price_id = r.price_id
+ and e.event_id = p.event_id"]
+
+ if {$user_check > 0} {
+ db_dml del_ugm "delete from user_group_map
+ where group_id = :event_group_id
+ and user_id = :reg_user_id
+ and role <> 'administrator'"
+ }
+
+}
+
+set to_email [db_string sel_to_email "
+ select u.email
+ from users u, events_registrations r
+ where r.reg_id = :reg_id
+ and u.user_id = r.user_id"]
+
+append whole_page "[ad_header "Registration Canceled"]
+Registration Canceled
+[ad_context_bar_ws [list "index.tcl" "Events Administration"] "Cancel Registration"]
+
+
+$to_email's registration has been canceled. $to_email has been notified
+by e-mail:
+"
+
+#e-mail the registrant to let him know we canceled his registration
+#set from_email [db_string unused "select email from
+#users where user_id = $user_id"]
+set from_email [db_string sel_from_email "select u.email
+from users u, event_info ei, events_events e
+where e.event_id = :event_id
+and ei.group_id = e.group_id
+and u.user_id = ei.contact_user_id"]
+
+set to_email [db_string sel_to_email_addr "
+ select u.email
+ from users u, events_registrations r
+ where r.reg_id = :reg_id
+ and u.user_id = r.user_id"]
+
+set event_id [db_string sel_event_id "
+ select event_id
+ from events_registrations r, events_prices p
+ where r.reg_id = :reg_id
+ and p.price_id = r.price_id"]
+
+set email_subject "Registration Canceled"
+set email_body "Your registration for:\n
+[events_pretty_event $event_id]\n
+has been canceled.\n
+
+$cancel_msg
+
+[ad_parameter SystemURL]/events/
+"
+
+append whole_page "
+
+To: $to_email
+From: $from_email
+Subject: $email_subject
+
+$email_body
+
+
+
+Return to events administration
+[ad_footer]
+"
+
+
+doc_return 200 text/html $whole_page
+ns_conn close
+
+if [catch { ns_sendmail $to_email $from_email $email_subject $email_body } errmsg] {
+ ns_log Notice "failed sending confirmation email to customer: $errmsg"
+}
+
+##### EOF
Index: openacs-4/contrib/packages/events/www/manage/reg-cancel.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/events/www/manage/reg-cancel.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/events/www/manage/reg-cancel.adp 22 Feb 2005 22:28:39 -0000 1.1
@@ -0,0 +1,6 @@
+
+
+@title;noquote@
+@context;noquote@
+
+
Index: openacs-4/contrib/packages/events/www/manage/reg-cancel.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/events/www/manage/reg-cancel.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/events/www/manage/reg-cancel.tcl 22 Feb 2005 22:28:39 -0000 1.1
@@ -0,0 +1,104 @@
+# events/www/admin/reg-cancel.tcl
+ad_page_contract {
+
+ Cancel a Registration.
+
+ @param reg_id the registration to cancel
+
+ @author Matthew Geddert (geddert@yahoo.com)
+ @creation date 2002-11-11
+
+} {
+ {reg_id:naturalnum,notnull}
+ {return_url ""}
+} -validate {
+ registration_exists_p -requires {reg_id} {
+ if { ![events::registration::exists_p -reg_id $reg_id] } {
+ ad_complain "We could not find the registration you asked for."
+ return 0
+ }
+ return 1
+ }
+}
+
+events::registration::get -reg_id $reg_id -array reg_info
+events::event::get -event_id $reg_info(event_id) -array event_info
+events::venue::get -venue_id $event_info(venue_id) -array venue_info
+
+set title "Cancel $reg_info(user_name)'s Registration"
+set context [list [list "event?event_id=$reg_info(event_id)" "$event_info(name) in $venue_info(city)"] "Cancel $reg_info(user_name)'s Registration"]
+
+form create confirm_cancel
+
+element create confirm_cancel return_url \
+ -datatype text \
+ -widget hidden \
+ -value $return_url
+
+element create confirm_cancel reg_id \
+ -datatype integer \
+ -widget hidden \
+ -value $reg_id
+
+element create confirm_cancel inform_of_cancel \
+ -label "Action" \
+ -datatype text \
+ -widget inform \
+ -value "Cancel a reservation for $event_info(name), and send the registrant a message to notify him/her that their reservation was canceled"
+
+if {[exists_and_not_null event_info(contact_email)]} {
+ set from_addr "$event_info(contact_email) (the default contact for this event)"
+} else {
+# do we want a parameter for this?
+ set from_addr "[ad_outgoing_sender] (the system wide default outgoing sender)"
+}
+
+element create confirm_cancel send_message_from \
+ -label "From" \
+ -datatype text \
+ -widget inform \
+ -value $from_addr
+
+element create confirm_cancel send_message_to \
+ -label "To" \
+ -datatype text \
+ -widget inform \
+ -value $reg_info(user_email)
+
+element create confirm_cancel message_subject \
+ -label "Subject" \
+ -datatype text \
+ -widget inform \
+ -value "Your registration for $event_info(name) has been canceled"
+
+
+element create confirm_cancel email_body \
+ -label "Email Message" \
+ -datatype text \
+ -widget textarea \
+ -html {cols 70 rows 8 wrap soft} \
+ -value "$reg_info(user_name),
+
+Your registration request for $event_info(name) - $event_info(timespan) has been canceled.
+
+Sincerely,
+
+Event Administrator"
+
+if {[template::form is_valid confirm_cancel]} {
+ template::form get_values confirm_cancel reg_id email_body return_url
+
+ events::registration::cancel -reg_id $reg_id -email_body $email_body
+
+ if {![exists_and_not_null return_url]} {
+ set return_url "reg-view?reg_id=$reg_id"
+ }
+
+
+ ad_returnredirect $return_url
+ ad_script_abort
+
+}
+
+ad_return_template
+
Index: openacs-4/contrib/packages/events/www/manage/reg-cancel.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/events/www/manage/reg-cancel.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/events/www/manage/reg-cancel.xql 22 Feb 2005 22:28:39 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+
+
+
+ select 1
+ from events_registrations
+ where reg_id = :reg_id
+
+
+
+
Index: openacs-4/contrib/packages/events/www/manage/reg-waitlist.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/events/www/manage/reg-waitlist.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/events/www/manage/reg-waitlist.tcl 22 Feb 2005 22:28:39 -0000 1.1
@@ -0,0 +1,34 @@
+# events/www/admin/reg-approve.tcl
+ad_page_contract {
+
+ Approve a Registration.
+
+ @param reg_id the registration to cancel
+
+ @author Matthew Geddert (geddert@yahoo.com)
+ @creation date 2002-11-11
+
+} {
+ {reg_id:naturalnum,notnull}
+ {return_url ""}
+} -validate {
+ registration_exists_p -requires {reg_id} {
+ if { ![events::registration::exists_p -reg_id $reg_id] } {
+ ad_complain "We could not find the registration you asked for."
+ return 0
+ }
+ return 1
+ }
+}
+
+events::registration::waiting -reg_id $reg_id
+
+if {![exists_and_not_null return_url]} {
+ set return_url "reg-view?reg_id=$reg_id"
+}
+
+
+ad_returnredirect $return_url
+ad_script_abort
+
+