Index: openacs-4/packages/attendance/lib/cp-attendance.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/lib/cp-attendance.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/attendance/lib/cp-attendance.adp 18 Dec 2005 03:07:26 -0000 1.4 +++ openacs-4/packages/attendance/lib/cp-attendance.adp 28 Dec 2005 00:24:27 -0000 1.5 @@ -1,8 +1,14 @@ + + + + @attendance_msg;noquote@ + Index: openacs-4/packages/attendance/lib/cp-attendance.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/lib/cp-attendance.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/attendance/lib/cp-attendance.tcl 18 Dec 2005 03:07:26 -0000 1.10 +++ openacs-4/packages/attendance/lib/cp-attendance.tcl 28 Dec 2005 00:24:27 -0000 1.11 @@ -18,48 +18,63 @@ set calendar_id [dotlrn_calendar::get_group_calendar_id -community_id $community_id] set calendar_url [calendar_portlet_display::get_url_stub $calendar_id] -if { ! [db_0or1row item_type_id { }] } { - set item_type_id [calendar::item_type_new -calendar_id $calendar_id -type "Session"] -} +if { [db_0or1row item_type_id { }] } { + + # we try and autocreate a session type + # set item_type_id [calendar::item_type_new -calendar_id $calendar_id -type "Session"] + + # HAM : 121905 + # session calendar type is created when a new section is created in + # dotlrn-ecommerce/catalog user interface + # there are some circumstances where administrators go to dotlrn/admin + # and create the communities/classes there hence the calendar type session + # does not get created + # instead of auto creating, let's check for the presence of the Calendar Type "Session" + # and just give a message with a link to create it -set grade_item_id [db_string "getgradeid" ""] - -# ns_log Notice " -- Attendance Package ID : $attendance_package_id, Grade Item : $grade_item_id --" - -attendance::add_sessions -community_id $community_id -grade_item_id $grade_item_id -package_id $attendance_package_id - -template::list::create \ - -name session_list \ - -multirow session_list \ - -pass_properties { attendance_url current_url calendar_url calendar_id item_type_id } \ - -key task_id \ - -no_data "No sessions" \ - -elements { - session_name { - label "Session" - display_template { @session_list.session_name@ } + set grade_item_id [db_string "getgradeid" ""] + + # ns_log Notice " -- Attendance Package ID : $attendance_package_id, Grade Item : $grade_item_id --" + + attendance::add_sessions -community_id $community_id -grade_item_id $grade_item_id -package_id $attendance_package_id + + template::list::create \ + -name session_list \ + -multirow session_list \ + -pass_properties { attendance_url current_url calendar_url calendar_id item_type_id } \ + -key task_id \ + -no_data "No sessions" \ + -elements { + session_name { + label "Session" + display_template { @session_list.session_name@ } + } + date_time { + label "Date and Time" + } + action { + label "Actions" + html "nowrap" + display_template { Edit | Attendance | Print
Delete | Email Attendees } + } } - date_time { - label "Date and Time" + + db_multirow -extend {session_name cal_item_id date_time grade_id} session_list get_sessions { } { + set cal_item_id [db_string "getcalid" "select cal_item_id from evaluation_cal_task_map where task_item_id=:item_id" -default ""] + set session_name [db_string "geteventname" "select name from acs_events where event_id=:cal_item_id" -default ""] + set grade_id [db_string "getgradeid" "select grade_id from evaluation_grades where grade_item_id = :grade_item_id" -default ""] + set date_time [db_string datetime { + select to_char(start_date, 'Mon dd, yyyy hh:miam-')||to_char(end_date, 'hh:miam') + from cal_items ci, acs_events e, acs_activities a, timespans s, time_intervals t + where e.timespan_id = s.timespan_id + and s.interval_id = t.interval_id + and e.activity_id = a.activity_id + and e.event_id = ci.cal_item_id + and ci.cal_item_id = :cal_item_id + } -default ""] } - action { - label "Actions" - html "nowrap" - display_template { Edit | Attendance | Print
Delete | Email Attendees } - } - } -db_multirow -extend {session_name cal_item_id date_time grade_id} session_list get_sessions { } { - set cal_item_id [db_string "getcalid" "select cal_item_id from evaluation_cal_task_map where task_item_id=:item_id" -default ""] - set session_name [db_string "geteventname" "select name from acs_events where event_id=:cal_item_id" -default ""] - set grade_id [db_string "getgradeid" "select grade_id from evaluation_grades where grade_item_id = :grade_item_id" -default ""] - set date_time [db_string datetime { - select to_char(start_date, 'Mon dd, yyyy hh:miam-')||to_char(end_date, 'hh:miam') - from cal_items ci, acs_events e, acs_activities a, timespans s, time_intervals t - where e.timespan_id = s.timespan_id - and s.interval_id = t.interval_id - and e.activity_id = a.activity_id - and e.event_id = ci.cal_item_id - and ci.cal_item_id = :cal_item_id - } -default ""] +} else { + set attendance_msg "To use the Attendance Tracking feature you must create a \"Session\" designtation for calendar events. Click here to let the system create the \"Session\" designation and enable attendance tracking." } +