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.6 -r1.7 --- openacs-4/packages/attendance/lib/cp-attendance.adp 28 Dec 2005 00:37:07 -0000 1.6 +++ openacs-4/packages/attendance/lib/cp-attendance.adp 28 Dec 2005 01:31:23 -0000 1.7 @@ -1,9 +1,9 @@ - + +
Note: To add attendance tracking to an existing event in your calendar, edit the event and change the "Type" to "Session".
@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.12 -r1.13 --- openacs-4/packages/attendance/lib/cp-attendance.tcl 28 Dec 2005 00:37:07 -0000 1.12 +++ openacs-4/packages/attendance/lib/cp-attendance.tcl 28 Dec 2005 01:31:23 -0000 1.13 @@ -71,6 +71,8 @@ } } 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." + set return_url [ad_return_url] + set create_session_type_url [export_vars -base "../attendance/admin/create-cal-session-type" { return_url calendar_id }] + 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." } Index: openacs-4/packages/attendance/www/admin/create-cal-session-type.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/www/admin/create-cal-session-type.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attendance/www/admin/create-cal-session-type.tcl 28 Dec 2005 01:31:24 -0000 1.1 @@ -0,0 +1,14 @@ +ad_page_contract { + + Create a calendar session type, and redirect back to return_url + + @author Hamilton Chua (hamilton.chua@gmail.com) + +} { + {calendar_id} + {return_url} +} + +set item_type_id [calendar::item_type_new -calendar_id $calendar_id -type "Session"] + +ad_returnredirect $return_url \ No newline at end of file Index: openacs-4/packages/attendance/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/www/admin/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/attendance/www/admin/index.adp 31 May 2005 22:02:59 -0000 1.1 +++ openacs-4/packages/attendance/www/admin/index.adp 28 Dec 2005 01:31:24 -0000 1.2 @@ -2,10 +2,15 @@ @page_title@ "@context;noquote@" - - + + @attendance_msg;noquote@ -

No attendance tasks for this class. Please create a session. + + + + +

No attendance tasks for this class. Please create a session. + Index: openacs-4/packages/attendance/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/www/admin/index.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/attendance/www/admin/index.tcl 19 Jun 2005 06:05:05 -0000 1.3 +++ openacs-4/packages/attendance/www/admin/index.tcl 28 Dec 2005 01:31:24 -0000 1.4 @@ -15,65 +15,74 @@ set page_title "Attendance Tasks" set context $page_title set community_id [dotlrn_community::get_community_id] +set calendar_id [dotlrn_calendar::get_group_calendar_id -community_id $community_id] +set return_url [ad_return_url] set package_id [ad_conn package_id] # get grade info attendance::get_grade_info -package_id $package_id -ns_log Notice " -- Attendance Package ID : $package_id, Grade Item : $grade_item_id --" +# ns_log Notice " -- Attendance Package ID : $package_id, Grade Item : $grade_item_id --" # check calendar items for session and turn them into attendance tasks -attendance::add_sessions -community_id $community_id -grade_item_id $grade_item_id -package_id $package_id -set elements [list task_name \ - [list label "Task Name" \ - link_url_col task_url \ - orderby_asc {task_name asc} \ - orderby_desc {task_name desc}] \ - due_date_pretty \ - [list label "Date" \ - orderby_asc {due_date_ansi asc} \ - orderby_desc {due_date_ansi desc}] \ - action \ - [list label "Actions" \ - display_template { Delete | Mark } ]\ - ] +if { ![catch { attendance::add_sessions -community_id $community_id -grade_item_id $grade_item_id -package_id $package_id } errmsg ] } { -template::list::create \ - -name attendance_tasks \ - -multirow attendance_tasks \ - -actions { - "Attendance by Student" "summary" "" - } -key task_id \ - -filters { grade_id {} } \ - -no_data "No attendance tasks" \ - -orderby_name assignments_orderby \ - -elements $elements + set elements [list task_name \ + [list label "Task Name" \ + link_url_col task_url \ + orderby_asc {task_name asc} \ + orderby_desc {task_name desc}] \ + due_date_pretty \ + [list label "Date" \ + orderby_asc {due_date_ansi asc} \ + orderby_desc {due_date_ansi desc}] \ + action \ + [list label "Actions" \ + display_template { Delete | Mark } ]\ + ] + + template::list::create \ + -name attendance_tasks \ + -multirow attendance_tasks \ + -actions { + "Attendance by Student" "summary" "" + } -key task_id \ + -filters { grade_id {} } \ + -no_data "No attendance tasks" \ + -orderby_name assignments_orderby \ + -elements $elements + + db_multirow -extend { due_date_pretty grade_id } attendance_tasks get_tasks { + select et.task_name, et.number_of_members, et.task_id, + to_char(et.due_date,'YYYY-MM-DD HH24:MI:SS') as due_date_ansi, + et.online_p, + et.late_submit_p, + et.item_id, + et.task_item_id, + et.due_date, + et.requires_grade_p, et.description, et.grade_item_id, + cr.title as task_title, + et.data as task_data, + et.task_id as revision_id, + coalesce(round(cr.content_length/1024,0),0) as content_length, + et.late_submit_p, + crmt.label as pretty_mime_type + from cr_revisions cr, + evaluation_tasksi et, + cr_items cri, + cr_mime_types crmt + where cr.revision_id = et.revision_id + and grade_item_id = :grade_item_id + and cri.live_revision = et.task_id + and et.mime_type = crmt.mime_type + } { + set due_date_pretty [lc_time_fmt $due_date_ansi "%q %r"] + set grade_id [db_string "getgradeid" "select grade_id from evaluation_grades where grade_item_id = :grade_item_id"] + } -db_multirow -extend { due_date_pretty grade_id } attendance_tasks get_tasks { - select et.task_name, et.number_of_members, et.task_id, - to_char(et.due_date,'YYYY-MM-DD HH24:MI:SS') as due_date_ansi, - et.online_p, - et.late_submit_p, - et.item_id, - et.task_item_id, - et.due_date, - et.requires_grade_p, et.description, et.grade_item_id, - cr.title as task_title, - et.data as task_data, - et.task_id as revision_id, - coalesce(round(cr.content_length/1024,0),0) as content_length, - et.late_submit_p, - crmt.label as pretty_mime_type - from cr_revisions cr, - evaluation_tasksi et, - cr_items cri, - cr_mime_types crmt - where cr.revision_id = et.revision_id - and grade_item_id = :grade_item_id - and cri.live_revision = et.task_id - and et.mime_type = crmt.mime_type -} { - set due_date_pretty [lc_time_fmt $due_date_ansi "%q %r"] - set grade_id [db_string "getgradeid" "select grade_id from evaluation_grades where grade_item_id = :grade_item_id"] +} else { + ns_log Notice " Attendance Package Error : $errmsg" + set create_session_type_url [export_vars -base "create-cal-session-type" { calendar_id return_url }] + 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." }