Index: openacs-4/packages/dotlrn-ecommerce/www/application-bulk-approve.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/application-bulk-approve.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/dotlrn-ecommerce/www/application-bulk-approve.tcl 23 Jan 2006 08:04:42 -0000 1.3
+++ openacs-4/packages/dotlrn-ecommerce/www/application-bulk-approve.tcl 17 Oct 2006 23:19:00 -0000 1.4
@@ -12,14 +12,22 @@
{rel_id:multiple {}}
return_url
__confirmed_p:optional
-
+ {send_email_p 1}
+ submit2:optional
{filter_community_id ""}
{filter_member_state:multiple {{needs approval} {application sent}}}
} -properties {
} -validate {
} -errors {
}
+#If we come from a "Submit2" command, we must not send the emails.
+if { [exists_and_equal submit2 "[_ dotlrn-ecommerce.Approve_no_email]"] } {
+ set send_email_p 0
+}
+
+
+
# Properly check for permissions as non-sw-admin instructors can
# access the applications list and perform operations on their
# specific classes
@@ -93,7 +101,8 @@
}
ad_form -extend -name confirm -form {
- {approve:text(submit) {label "[_ dotlrn-ecommerce.Approve]"}}
+ {submit1:text(submit) {label "[_ dotlrn-ecommerce.Approve]"}}
+ {submit2:text(submit) {label "[_ dotlrn-ecommerce.Approve_no_email]"}}
} -on_submit {
db_foreach applications_to_approve [subst {
@@ -106,30 +115,32 @@
and (case when :filter_community_id is null then member_state != 'request approval' else r.community_id = :filter_community_id end)
}] {
- if {$email_reg_info_to == "participant"} {
- set email_user_id $user_id
- } else {
- set email_user_id $patron_id
- }
-
- if { "request approval" == $member_state } {
- array set vars [lindex [callback dotlrn::member_email_var_list -community_id $filter_community_id -to_user $email_user_id -type prereq] 0]
- set email_vars [lang::message::get_embedded_vars $reason]
- foreach var [concat $email_vars] {
- if {![info exists vars($var)]} {
- set vars($var) ""
- }
+ #Only send the emails if appropriate
+ if {$send_email_p == 1} {
+ if {$email_reg_info_to == "participant"} {
+ set email_user_id $user_id
+ } else {
+ set email_user_id $patron_id
}
- set var_list [array get vars]
- set reason "[lang::message::format $reason $var_list]"
-
- dotlrn_community::send_member_email -community_id $community_id -to_user $email_user_id -type "prereq approval" -override_email $reason -override_subject $subject
- } else {
- set email_type [ad_decode $member_state "needs approval" "waitinglist approved" "application sent" "on approval" "waitinglist approved"]
-
- dotlrn_community::send_member_email -community_id $community_id -to_user $email_user_id -type $email_type
- }
-
+
+ if { "request approval" == $member_state } {
+ array set vars [lindex [callback dotlrn::member_email_var_list -community_id $filter_community_id -to_user $email_user_id -type prereq] 0]
+ set email_vars [lang::message::get_embedded_vars $reason]
+ foreach var [concat $email_vars] {
+ if {![info exists vars($var)]} {
+ set vars($var) ""
+ }
+ }
+ set var_list [array get vars]
+ set reason "[lang::message::format $reason $var_list]"
+
+ dotlrn_community::send_member_email -community_id $community_id -to_user $email_user_id -type "prereq approval" -override_email $reason -override_subject $subject
+ } else {
+ set email_type [ad_decode $member_state "needs approval" "waitinglist approved" "application sent" "on approval" "waitinglist approved"]
+
+ dotlrn_community::send_member_email -community_id $community_id -to_user $email_user_id -type $email_type
+ }
+ }
set price [dotlrn_ecommerce::section::price $section_id]
# Approval on free registration gets the user registered immediately
Index: openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl,v
diff -u -r1.21 -r1.22
--- openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl 4 Apr 2006 13:33:30 -0000 1.21
+++ openacs-4/packages/dotlrn-ecommerce/www/application-reject.tcl 17 Oct 2006 23:19:00 -0000 1.22
@@ -2,8 +2,8 @@
ad_page_contract {
+ Reject application and maybe send rejection email
-
@author Roel Canicula (roelmc@pldtdsl.net)
@creation-date 2005-07-01
@arch-tag: 93f47ba6-c04e-419a-bcd6-60bb95553236
@@ -92,12 +92,12 @@
}
set context [list [list applications "[_ dotlrn-ecommerce.Pending_applications]"] $title]
ad_form \
+ -export { type return_url } \
-name email_form \
-export { return_url } \
-form {
- {user_id:text(hidden)}
+ {user_id:text(hidden)}
{community_id:text(hidden)}
- {type:text(hidden)}
{subject:text {html {size 60}}}
{reason:text(textarea),optional {label "[_ dotlrn-ecommerce.Reason]"} {html {rows 10 cols 60}}}
}
Index: openacs-4/packages/dotlrn-ecommerce/www/applications-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/applications-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-ecommerce/www/applications-postgresql.xql 17 Oct 2006 23:19:00 -0000 1.1
@@ -0,0 +1,134 @@
+
+
+
+ postgresql7.1
+
+
+
+ select a.title, a.assessment_id as section_assessment_rev_id
+ from dotlrn_ecommerce_section s, dotlrn_catalogi c, as_assessmentsi a, cr_items ci, cr_items ai
+ where s.course_id = c.item_id
+ and c.assessment_id = a.item_id
+ and c.course_id = ci.latest_revision
+ and a.assessment_id = ai.latest_revision
+ and s.section_id = :section_id
+
+
+
+
+
+ select distinct a.title, a.revision_id as assessment_id from dotlrn_catalog c, cr_items i, as_assessmentsx a where i.item_id=c.assessment_id and i.latest_revision=a.revision_id
+
+
+
+
+
+ select r.rel_id
+ from dotlrn_member_rels_full r
+ left join (select *
+ from ec_addresses
+ where address_id in (select max(address_id)
+ from ec_addresses
+ group by user_id)) e
+ on (r.user_id = e.user_id)
+ left join (select m.*, s.completed_datetime
+ from dotlrn_ecommerce_application_assessment_map m, as_sessions s
+ where m.session_id = s.session_id
+ and m.session_id in (select max(session_id)
+ from dotlrn_ecommerce_application_assessment_map
+ group by rel_id)) m
+ on (r.rel_id = m.rel_id),
+ dotlrn_ecommerce_section s
+ left join ec_products p
+ on (s.product_id = p.product_id),
+ dotlrn_catalog t,
+ cr_items i,
+ acs_objects o
+
+ where r.community_id = s.community_id
+ and s.course_id = i.item_id
+ and t.course_id = i.live_revision
+ and r.rel_id = o.object_id
+
+ $member_state_clause
+ $user_clause
+ $section_clause
+ [template::list::filter_where_clauses -and -name applications]
+ [template::list::orderby_clause -name applications -orderby]
+
+
+
+
+
+ select person__name(r.user_id) as person_name, member_state, r.community_id, r.user_id as applicant_user_id, s.section_name, t.course_name, s.section_id, r.rel_id, e.phone, o.creation_user as patron_id,
+ (select count(*)
+ from (select *
+ from dotlrn_member_rels_full rr,
+ acs_objects o
+ where rr.rel_id = o.object_id
+ and rr.rel_id <= r.rel_id
+ and rr.community_id = r.community_id
+ and rr.member_state = r.member_state
+ order by o.creation_date) r) as number, s.product_id, m.session_id, m.completed_datetime
+
+ from dotlrn_member_rels_full r
+ left join (select *
+ from ec_addresses
+ where address_id in (select max(address_id)
+ from ec_addresses
+ group by user_id)) e
+ on (r.user_id = e.user_id)
+ left join (select m.*, s.completed_datetime
+ from dotlrn_ecommerce_application_assessment_map m, as_sessions s
+ where m.session_id = s.session_id
+ and m.session_id in (select max(session_id)
+ from dotlrn_ecommerce_application_assessment_map
+ group by rel_id)) m
+ on (r.rel_id = m.rel_id),
+ dotlrn_ecommerce_section s
+ left join ec_products p
+ on (s.product_id = p.product_id),
+ dotlrn_catalogi t,
+ cr_items i,
+ acs_objects o
+
+ where r.community_id = s.community_id
+ and s.course_id = i.item_id
+ and t.course_id = i.live_revision
+ and r.rel_id = o.object_id
+
+ $member_state_clause
+ $user_clause
+ $section_clause
+ $page_clause
+ [template::list::filter_where_clauses -and -name applications]
+ [template::list::orderby_clause -name applications -orderby]
+
+
+
+
+
+ select g.comment_id,
+ r.content as gc_content,
+ r.title as gc_title,
+ r.mime_type as gc_mime_type,
+ acs_object__name(o.creation_user) as gc_author,
+ to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as gc_creation_date_ansi
+ from general_comments g,
+ cr_revisions r,
+ cr_items ci,
+ acs_objects o
+ where g.object_id in (select session_id
+ from as_sessions
+ where assessment_id = (select assessment_id
+ from as_sessions
+ where session_id = :session_id)
+ and subject_id = :applicant_user_id)
+ and r.revision_id = ci.live_revision
+ and ci.item_id = g.comment_id
+ and o.object_id = g.comment_id
+ order by o.creation_date
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/dotlrn-ecommerce/www/applications.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/applications.adp,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/dotlrn-ecommerce/www/applications.adp 21 Jul 2006 18:25:03 -0000 1.5
+++ openacs-4/packages/dotlrn-ecommerce/www/applications.adp 17 Oct 2006 23:19:00 -0000 1.6
@@ -12,14 +12,15 @@
-
Index: openacs-4/packages/dotlrn-ecommerce/www/applications.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/applications.tcl,v
diff -u -r1.48 -r1.49
--- openacs-4/packages/dotlrn-ecommerce/www/applications.tcl 21 Jul 2006 18:59:08 -0000 1.48
+++ openacs-4/packages/dotlrn-ecommerce/www/applications.tcl 17 Oct 2006 23:19:00 -0000 1.49
@@ -16,12 +16,15 @@
{csv_p 0} \
{as_item_id ""} \
{as_search ""} \
+ {page 1} \
+ {all 0} \
] \
[as::list::params]]
set user_id [ad_conn user_id]
set package_id [ad_conn package_id]
+permission::require_permission -object_id $package_id -privilege "admin"
set admin_p [permission::permission_p -object_id $package_id -privilege "admin"]
set return_url [ad_return_url]
@@ -259,25 +262,17 @@
if { [exists_and_not_null section_id] } {
set section_clause {and s.section_id = :section_id}
- if { [db_0or1row assessment_revision {
- select a.title, a.assessment_id as section_assessment_rev_id
- from dotlrn_ecommerce_section s, dotlrn_catalogi c, as_assessmentsi a, cr_items ci, cr_items ai
- where s.course_id = c.item_id
- and c.assessment_id = a.item_id
- and c.course_id = ci.latest_revision
- and a.assessment_id = ai.latest_revision
- and s.section_id = :section_id
- }] } {
- array set search_arr [as::list::filters -assessments [list [list $title $section_assessment_rev_id]]]
+ if { [db_0or1row assessment_revision { }] } {
+ array set search_arr [as::list::filters -assessments [list [list $title $section_assessment_rev_id]]]
} else {
- array set search_arr [list list_filters [list] assessment_search_options [list] search_js_array ""]
+ array set search_arr [list list_filters [list] assessment_search_options [list] search_js_array ""]
}
+
} else {
set section_clause ""
# we want to get all the questions that are common to dotlrn-ecommerce
# applications
- set filter_assessments [db_list_of_lists get_filter_assessments "
-select distinct a.title, a.revision_id as assessment_id from dotlrn_catalog c, cr_items i, as_assessmentsx a where i.item_id=c.assessment_id and i.latest_revision=a.revision_id"]
+ set filter_assessments [db_list_of_lists get_filter_assessments {}]
array set search_arr [as::list::filters -assessments $filter_assessments]
}
@@ -352,44 +347,20 @@
# has_default_p 1
#}
+# HAM :
+# this exports the current page
lappend actions \
- [_ dotlrn-ecommerce.Export] \
+ "[_ dotlrn-ecommerce.Export] Page" \
[export_vars -base [ad_return_url] { {csv_p 1} }] \
- [_ dotlrn-ecommerce.Export]
+ "[_ dotlrn-ecommerce.Export] Page"
-
-template::list::create \
- -name "applications" \
- -key rel_id \
- -multirow "applications" \
- -no_data "[_ dotlrn-ecommerce.No_applications]" \
- -pass_properties { return_url } \
- -page_flush_p 1 \
- -pass_properties { admin_p return_url _type } \
- -actions $actions \
- -bulk_actions $bulk_actions \
- -bulk_action_export_vars { return_url } \
- -elements $elements \
- -filters $list_filters \
- -filter_form 1 \
- -orderby {
- section_name {
- label "[_ dotlrn-ecommerce.Section_1]"
- orderby "lower(s.section_name)"
- }
- number {
- label "[_ dotlrn-ecommerce.lt_Number_in_Waiting_Lis]"
- orderby "lower(s.section_name), number"
- }
- person_name {
- label "[_ dotlrn-ecommerce.Participant]"
- orderby "lower(person__name(r.user_id))"
- }
- member_state {
- label "[_ dotlrn-ecommerce.Member_Request]"
- }
- }
-
+# this exports all data
+lappend actions \
+ "[_ dotlrn-ecommerce.Export] All" \
+ [export_vars -base [ad_return_url] { {csv_p 1} {all 1} }] \
+ "[_ dotlrn-ecommerce.Export] All"
+
+
if { $admin_p } {
set user_clause ""
} else {
@@ -409,51 +380,85 @@
set general_comments_url [apm_package_url_from_key "general-comments"]
-db_multirow -extend { approve_url reject_url asm_url section_edit_url person_url register_url comments comments_text_plain comments_truncate add_comment_url target calendar_id item_type_id num_sessions } applications applications [subst {
- select person__name(r.user_id) as person_name, member_state, r.community_id, r.user_id as applicant_user_id, s.section_name, t.course_name, s.section_id, r.rel_id, e.phone, o.creation_user as patron_id,
- (select count(*)
- from (select *
- from dotlrn_member_rels_full rr,
- acs_objects o
- where rr.rel_id = o.object_id
- and rr.rel_id <= r.rel_id
- and rr.community_id = r.community_id
- and rr.member_state = r.member_state
- order by o.creation_date) r) as number, s.product_id, m.session_id, m.completed_datetime
+if { $all } {
- from dotlrn_member_rels_full r
- left join (select *
- from ec_addresses
- where address_id in (select max(address_id)
- from ec_addresses
- group by user_id)) e
- on (r.user_id = e.user_id)
- left join (select m.*, s.completed_datetime
- from dotlrn_ecommerce_application_assessment_map m, as_sessions s
- where m.session_id = s.session_id
- and m.session_id in (select max(session_id)
- from dotlrn_ecommerce_application_assessment_map
- group by rel_id)) m
- on (r.rel_id = m.rel_id),
- dotlrn_ecommerce_section s
- left join ec_products p
- on (s.product_id = p.product_id),
- dotlrn_catalogi t,
- cr_items i,
- acs_objects o
+ # HAM : use this template to export all to csv
+ template::list::create \
+ -name "applications" \
+ -key rel_id \
+ -multirow "applications" \
+ -no_data "[_ dotlrn-ecommerce.No_applications]" \
+ -pass_properties { return_url } \
+ -pass_properties { admin_p return_url _type } \
+ -actions $actions \
+ -bulk_actions $bulk_actions \
+ -page_flush_p 1 \
+ -bulk_action_export_vars { return_url } \
+ -elements $elements \
+ -filters $list_filters \
+ -filter_form 1 \
+ -orderby {
+ section_name {
+ label "[_ dotlrn-ecommerce.Section_1]"
+ orderby "lower(s.section_name)"
+ }
+ number {
+ label "[_ dotlrn-ecommerce.lt_Number_in_Waiting_Lis]"
+ orderby "lower(s.section_name), number"
+ }
+ person_name {
+ label "[_ dotlrn-ecommerce.Participant]"
+ orderby "lower(person__name(r.user_id))"
+ }
+ member_state {
+ label "[_ dotlrn-ecommerce.Member_Request]"
+ }
+ }
+
+ set page_clause ""
+
+} else {
- where r.community_id = s.community_id
- and s.course_id = t.item_id
- and t.course_id = i.live_revision
- and r.rel_id = o.object_id
-
- $member_state_clause
- $user_clause
- $section_clause
-
- [template::list::filter_where_clauses -and -name applications]
- [template::list::orderby_clause -name applications -orderby]
-}] {
+ # HAM : use this list template to display rows
+ # has support for paging
+ template::list::create \
+ -name "applications" \
+ -key rel_id \
+ -multirow "applications" \
+ -no_data "[_ dotlrn-ecommerce.No_applications]" \
+ -pass_properties { return_url } \
+ -pass_properties { admin_p return_url _type } \
+ -actions $actions \
+ -bulk_actions $bulk_actions \
+ -page_size 25 \
+ -page_flush_p 1 \
+ -page_query_name "applications_pagination" \
+ -bulk_action_export_vars { return_url } \
+ -elements $elements \
+ -filters $list_filters \
+ -filter_form 1 \
+ -orderby {
+ section_name {
+ label "[_ dotlrn-ecommerce.Section_1]"
+ orderby "lower(s.section_name)"
+ }
+ number {
+ label "[_ dotlrn-ecommerce.lt_Number_in_Waiting_Lis]"
+ orderby "lower(s.section_name), number"
+ }
+ person_name {
+ label "[_ dotlrn-ecommerce.Participant]"
+ orderby "lower(person__name(r.user_id))"
+ }
+ member_state {
+ label "[_ dotlrn-ecommerce.Member_Request]"
+ }
+ }
+
+ set page_clause [template::list::page_where_clause -and -key r.rel_id -name applications]
+}
+
+db_multirow -extend { approve_url reject_url asm_url section_edit_url person_url register_url comments comments_text_plain comments_truncate add_comment_url target calendar_id item_type_id num_sessions } applications applications [subst { }] {
set list_type [ad_decode $member_state "needs approval" full "request approval" prereq "application sent" payment full]
set approve_url [export_vars -base application-approve { community_id {user_id $applicant_user_id} {type $list_type} return_url }]
@@ -479,28 +484,7 @@
# get associated comment
if {![empty_string_p $asm_url]} {
- db_foreach get_comments {
- select g.comment_id,
- r.content as gc_content,
- r.title as gc_title,
- r.mime_type as gc_mime_type,
- acs_object__name(o.creation_user) as gc_author,
- to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as gc_creation_date_ansi
- from general_comments g,
- cr_revisions r,
- cr_items ci,
- acs_objects o
- where g.object_id in (select session_id
- from as_sessions
- where assessment_id = (select assessment_id
- from as_sessions
- where session_id = :session_id)
- and subject_id = :applicant_user_id)
- and r.revision_id = ci.live_revision
- and ci.item_id = g.comment_id
- and o.object_id = g.comment_id
- order by o.creation_date
- } {
+ db_foreach get_comments { } {
if {[string equal $gc_mime_type "text/plain"]} {
set html_comment [dotlrn_ecommerce::util::text_to_html -text $gc_content]
} else {
@@ -519,8 +503,14 @@
set calendar_id [dotlrn_calendar::get_group_calendar_id -community_id \
[db_string get_community_id "select community_id from dotlrn_ecommerce_section where section_id=:section_id" -default ""]]
set item_type_id [db_string item_type_id "select item_type_id from cal_item_types where type='Session' and calendar_id = :calendar_id"]
- set num_sessions [db_string num_sessions "select count(cal_item_id) from cal_items where on_which_calendar = :calendar_id and item_type_id = :item_type_id"]
+ set num_sessions [db_string num_sessions "select count(cal_item_id) from cal_items where on_which_calendar = :calendar_id and item_type_id = :item_type_id"]
}
+# HAM :
+# unset section id because it seems the last section_id
+# is being picked up by the paging links
+if {[info exists section_id]} {
+ unset section_id
+}
# if we are CSV we need to get the assessment items
# since template::list has been prepared at this point we need
@@ -620,7 +610,6 @@
}
-
set __output {}
set __cols [list]
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp,v
diff -u -r1.17 -r1.18
--- openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp 15 Mar 2006 14:12:13 -0000 1.17
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/one-section.adp 17 Oct 2006 23:19:00 -0000 1.18
@@ -45,7 +45,7 @@
-#dotlrn-ecommerce.lt_Sessions_and_Attendan#
+
#dotlrn-ecommerce.lt_Sessions_and_Attendan#