Index: openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info,v
diff -u -r1.22 -r1.23
--- openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info 10 Aug 2005 21:30:32 -0000 1.22
+++ openacs-4/packages/dotlrn-ecommerce/dotlrn-ecommerce.info 11 Aug 2005 11:50:27 -0000 1.23
@@ -7,15 +7,15 @@
f
t
-
+
Roel Canicula
Package to tie the dotLRN, Ecommerce, Assessments and dotLRN Catalog packages together
2005-08-10
Solution Grove
Package to tie the dotLRN, Ecommerce, Assessments and dotLRN Catalog packages together. Initially intended for the MOS and MGH projects, the goal is to create a reusable module for similar projects.
0
-
+
@@ -36,11 +36,15 @@
+
+
+
+
Index: openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-init.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-init.tcl 16 Jul 2005 12:51:06 -0000 1.1
+++ openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-init.tcl 11 Aug 2005 11:50:27 -0000 1.2
@@ -12,3 +12,5 @@
ad_schedule_proc -thread t 300 dotlrn_ecommerce::section::check_elapsed_registrations
ad_schedule_proc -thread t 600 dotlrn_ecommerce::section::check_and_approve_sections_for_slots
+
+ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 23 50] dotlrn_ecommerce::notify_admins_of_waitlist
\ No newline at end of file
Index: openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl 11 Aug 2005 11:50:27 -0000 1.1
@@ -0,0 +1,75 @@
+# packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-procs.tcl
+
+ad_library {
+
+ dotlrn-ecommerce library
+
+ @author Deds Castillo (deds@i-manila.com.ph)
+ @creation-date 2005-08-11
+ @arch-tag: 83f2c08e-8bad-4fb8-8daf-73403e04c99d
+ @cvs-id $Id: dotlrn-ecommerce-procs.tcl,v 1.1 2005/08/11 11:50:27 dedsc Exp $
+}
+
+namespace eval dotlrn_ecommerce {}
+
+ad_proc -public dotlrn_ecommerce::notify_admins_of_waitlist {
+} {
+ notifies admins of what sections have reached
+ the waitlist threshold
+
+ @author Deds Castillo (deds@i-manila.com.ph)
+ @creation-date 2005-08-11
+
+ @return
+
+ @error
+} {
+ set mail_from [parameter::get -package_id [ad_acs_kernel_id] -parameter OutgoingSender]
+ set subject "Notification for waitlist"
+ set message ""
+
+ db_foreach get_sections_with_waitlist {
+ select t.*
+ from (select dc.course_name,
+ des.section_name,
+ des.notify_waiting_number,
+ (select count(*)
+ from membership_rels mr,
+ acs_rels ar
+ where ar.rel_id = mr.rel_id
+ and ar.object_id_one = des.community_id
+ and mr.member_state = 'needs approval') as waitlist_n
+ from dotlrn_catalog dc,
+ cr_items i,
+ dotlrn_ecommerce_section des
+ where dc.course_id = i.live_revision
+ and i.item_id = des.course_id
+ and des.notify_waiting_number is not null) t
+ where waitlist_n >= notify_waiting_number
+ } {
+ append message "Section: $course_name - $section_name
+Applicants in notify list: $waitlist_n
+"
+ }
+
+ if {![empty_string_p $message]} {
+ set object_id [acs_lookup_magic_object security_context_root]
+ set privilege "admin"
+ db_foreach get_swas {
+ select p.email as email_to
+ from parties p,
+ users u,
+ acs_permissions ap
+ where u.user_id = p.party_id
+ and u.user_id = ap.grantee_id
+ and ap.object_id = :object_id
+ and ap.privilege = :privilege
+ } {
+ acs_mail_lite::send \
+ -to_addr $email_to \
+ -from_addr $mail_from \
+ -subject $subject \
+ -body $message
+ }
+ }
+}