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.53 -r1.54
--- openacs-4/packages/dotlrn-ecommerce/www/applications.tcl 7 Dec 2006 05:27:06 -0000 1.53
+++ openacs-4/packages/dotlrn-ecommerce/www/applications.tcl 7 Mar 2007 16:26:28 -0000 1.54
@@ -12,6 +12,7 @@
[list \
type:optional \
orderby:optional \
+ groupby:optional \
section_id:optional \
{csv_p 0} \
{as_item_id ""} \
@@ -130,7 +131,9 @@
}
}]
+lappend list_filters attendance_filter [list label "Attendance" where_clause { a.attendance >= :attendance_filter }]
set actions ""
+
set bulk_actions [list [_ dotlrn-ecommerce.Approve] application-bulk-approve [_ dotlrn-ecommerce.Approve] "[_ dotlrn-ecommerce.Reject] / [_ dotlrn-ecommerce.Cancel]" application-bulk-reject "[_ dotlrn-ecommerce.Reject] / [_ dotlrn-ecommerce.Cancel]"]
if {[parameter::get -parameter AllowApplicationBulkEmail -default 0]} {
@@ -142,17 +145,18 @@
lappend bulk_actions "[_ dotlrn-ecommerce.Mark_as_Paid]" application-bulk-payments "[_ dotlrn-ecommerce.Mark_as_Paid]"
}
-set elements {section_name {
- label "[_ dotlrn-ecommerce.Section]"
+set elements [list section_name [list \
+ label "[_ dotlrn-ecommerce.Section]" \
display_template {
@applications.course_name@: @applications.section_name@
@applications.course_name@: @applications.section_name@
-
- }
- }
+ @applications.community_id@
+ } \
+ hide_p [info exists groupby] \
+ ] \
number {
label "[_ dotlrn-ecommerce.lt_Number_in_Waiting_Lis]"
html { align center }
@@ -168,7 +172,7 @@
Approved
}
- }
+ } \
person_name {
label "[_ dotlrn-ecommerce.Participant]"
display_template {
@@ -179,7 +183,9 @@
@applications.person_name@
}
- }
+ aggregate "count"
+ aggregate_group_label "Num. Participants"
+ } \
member_state {
label "[_ dotlrn-ecommerce.Member_Request]"
display_template {
@@ -202,7 +208,7 @@
[_ dotlrn-ecommerce.lt_User_has_submitted_an]
}
- }
+ } \
assessment_result {
label "[_ dotlrn-ecommerce.Application]"
display_template {
@@ -218,12 +224,12 @@
}
html { align center }
- }
+ } \
phone {
label "[_ dotlrn-ecommerce.Phone_Number]"
hide_p {[ad_decode $_type "waitinglist approved" 0 "request approved" 0 "application approved" 0 "all" 0 1]}
- }
-}
+ } \
+ ]
if {[parameter::get -parameter AllowApplicationNotes -default 1]} {
lappend elements comments {
@@ -238,7 +244,12 @@
comments_text_plain {
label "[_ dotlrn-ecommerce.Notes]"
hide_p {[ad_decode $csv_p 1 0 1]}
- }
+ } \
+ attendance {label "Attendance"
+ aggregate "count"
+ aggregate_group_label "Num. Attendees"
+ }
+
}
lappend elements \
@@ -347,6 +358,13 @@
# has_default_p 1
#}
+
+if {[info exists groupby]} {
+ lappend actions "Ungroup" applications "Stop grouping applications by section name"
+} else {
+ lappend actions "Group by Section Name" [export_vars -base applications {{groupby section_name}}] "Group applications by section name"
+}
+
# HAM :
# this exports the current page
lappend actions \
@@ -454,14 +472,17 @@
member_state {
label "[_ dotlrn-ecommerce.Member_Request]"
}
- }
+ } -groupby {
+ label "Group By"
+ values {section_name {{groupby section_id } {orderby section_id}}}
+ }
set page_clause [template::list::page_where_clause -and -key r.rel_id -name applications]
}
set csv_session_ids [list]
-db_multirow -extend { unique_id 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 { }] {
+db_multirow -extend { unique_id 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 attendance_rate} applications applications [subst { }] {
set unique_id "${applicant_user_id}-${section_id}"
set list_type [ad_decode $member_state "needs approval" full "request approval" prereq "application sent" payment full]
@@ -511,6 +532,11 @@
if {$session_id ne ""} {
lappend csv_session_ids $session_id
}
+
+ # attendance data
+ if { $num_sessions == 0 } { set attendance_rate "0" } else { set attendance_rate [format "% .0f" [expr (${attendance}.0/$num_sessions)*100]] }
+
+
}
# HAM :
# unset section id because it seems the last section_id
@@ -546,7 +572,7 @@
lappend csv_cols "attendance" "num_sessions"
set csv_cols_labels(attendance) attendance
set csv_cols_labels(num_sessions) "number of sessions"
- template::multirow extend applications attendance num_sessions
+# template::multirow extend applications attendance num_sessions
set csv_as_item_list [list]
set assessment_rev_id_list [list]
set item_list [list]
@@ -625,10 +651,7 @@
}
}
# attendance data
- set attendance [db_string "count" "select count(user_id) from attendance_cal_item_map where user_id = :applicant_user_id and cal_item_id in (select cal_item_id from cal_items where on_which_calendar = :calendar_id and item_type_id = :item_type_id )" ]
if { $num_sessions == 0 } { set attendance_rate "0" } else { set attendance_rate [format "% .0f" [expr (${attendance}.0/$num_sessions)*100]] }
- set attendance "${attendance}"
-
}
@@ -663,4 +686,4 @@
ns_return 200 "text/x-csv" $__output
ad_script_abort
-}
\ No newline at end of file
+}