Index: openacs-4/packages/attendance/lib/cp-attendance-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/lib/cp-attendance-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attendance/lib/cp-attendance-oracle.xql 16 Jul 2005 13:06:32 -0000 1.1 @@ -0,0 +1,45 @@ + + + + + oracle + 8.1.6 + + + + + + select item_type_id from cal_item_types where type='Session' and calendar_id = :calendar_id and rownum = 1 + + + + + + + select et.task_name, et.number_of_members, et.task_id, et.grade_item_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, + nvl(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 + + + + + \ No newline at end of file Index: openacs-4/packages/attendance/lib/cp-attendance-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/lib/cp-attendance-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attendance/lib/cp-attendance-postgresql.xql 16 Jul 2005 13:06:32 -0000 1.1 @@ -0,0 +1,42 @@ + + + + postgresql + 7.1 + + + + + select item_type_id from cal_item_types where type='Session' and calendar_id = :calendar_id limit 1 + + + + + + select et.task_name, et.number_of_members, et.task_id, et.grade_item_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 + + + + + \ No newline at end of file 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.5 -r1.6 --- openacs-4/packages/attendance/lib/cp-attendance.tcl 16 Jul 2005 12:53:07 -0000 1.5 +++ openacs-4/packages/attendance/lib/cp-attendance.tcl 16 Jul 2005 13:06:32 -0000 1.6 @@ -9,20 +9,13 @@ set community_id [dotlrn_community::get_community_id] } -set attendance_package_id [db_string "getattpack" "select object_id from acs_objects a, apm_packages b where a.object_id = b.package_id and a.context_id = :package_id and b.package_key = 'attendance';"] +set attendance_package_id [db_string "getattpack" ""] set attendance_url [apm_package_url_from_id $attendance_package_id] - set calendar_id [dotlrn_calendar::get_group_calendar_id -community_id $community_id] set calendar_url [calendar_portlet_display::get_url_stub $calendar_id] -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 limit 1" -default 0] +set item_type_id [db_string item_type_id "" -default 0] +set grade_item_id [db_string "getgradeid" ""] -set grade_item_id [db_string "getgradeid" "select eg.grade_item_id as grade_item_id - from evaluation_grades eg, acs_objects ao, cr_items cri - where cri.live_revision = eg.grade_id - and eg.grade_item_id = ao.object_id - and ao.context_id = :attendance_package_id - and eg.grade_name = 'Attendance'"] - # 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 @@ -43,38 +36,14 @@ action { label "Actions" html "nowrap" - display_template { Edit | Attendance | Delete } + display_template { Edit | Attendance | Delete
Email Attendees } } } - -db_multirow -extend {session_name cal_item_id date_time grade_id} session_list get_sessions { - select et.task_name, et.number_of_members, et.task_id, et.grade_item_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 cal_item_id [db_string "getcalid" "select cal_item_id from evaluation_cal_task_map where task_item_id=:item_id"] - set session_name [db_string "geteventname" "select name from acs_events where event_id=:cal_item_id"] - set grade_id [db_string "getgradeid" "select grade_id from evaluation_grades where grade_item_id = :grade_item_id"] +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 Index: openacs-4/packages/attendance/lib/cp-attendance.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/lib/cp-attendance.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attendance/lib/cp-attendance.xql 16 Jul 2005 13:06:32 -0000 1.1 @@ -0,0 +1,21 @@ + + + + + + select object_id from acs_objects a, apm_packages b where a.object_id = b.package_id and a.context_id = :package_id and b.package_key = 'attendance' + + + + + + select eg.grade_item_id as grade_item_id + from evaluation_grades eg, acs_objects ao, cr_items cri + where cri.live_revision = eg.grade_id + and eg.grade_item_id = ao.object_id + and ao.context_id = :attendance_package_id + and eg.grade_name = 'Attendance' + + + + Index: openacs-4/packages/attendance/sql/oracle/attendance-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/sql/oracle/attendance-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attendance/sql/oracle/attendance-create.sql 16 Jul 2005 13:06:32 -0000 1.1 @@ -0,0 +1,5 @@ + +create table attendance_cal_item_map ( + user_id integer, + cal_item_id integer +) \ No newline at end of file Index: openacs-4/packages/attendance/tcl/attendance-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/tcl/attendance-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/attendance/tcl/attendance-procs.tcl 19 Jun 2005 06:05:05 -0000 1.3 +++ openacs-4/packages/attendance/tcl/attendance-procs.tcl 16 Jul 2005 13:06:32 -0000 1.4 @@ -16,12 +16,7 @@ Retreives grade_id and grade_item_id from evaluation and sets them in the calling environment } { - uplevel 1 { db_0or1row "getgradeid" "select eg.grade_id as grade_id, eg.grade_item_id as grade_item_id, eg.grade_plural_name - from evaluation_grades eg, acs_objects ao, cr_items cri - where cri.live_revision = eg.grade_id - and eg.grade_item_id = ao.object_id - and ao.context_id = :package_id - and eg.grade_name = 'Attendance'"} + uplevel 1 { db_0or1row "getgradeid" "" } } ad_proc create_task { @@ -33,7 +28,7 @@ Create an attendance task } { - if { ![db_0or1row "checkmap" "select task_item_id from evaluation_cal_task_map where cal_item_id = :cal_item_id"] } { + if { ![db_0or1row "checkmap" {} ] } { calendar::item::get -cal_item_id $cal_item_id -array cal_item_array @@ -74,12 +69,11 @@ where task_id = :revision_id } - db_dml link_content { update cr_revisions set content = :url where revision_id = :revision_id } - db_dml set_storage_type { update cr_items set storage_type = 'text' where item_id = :item_id } + db_dml "link_content" { } + db_dml "set_storage_type" { } set content_length [string length $url] - db_dml content_size { update cr_revisions set content_length = :content_length where revision_id = :revision_id } - - db_dml insert_cal_mapping { insert into evaluation_cal_task_map (task_item_id,cal_item_id) values (:item_id,:cal_item_id) } + db_dml "content_size" { } + db_dml "insert_cal_mapping" { } } Index: openacs-4/packages/attendance/tcl/attendance-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/tcl/attendance-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attendance/tcl/attendance-procs.xql 16 Jul 2005 13:06:32 -0000 1.1 @@ -0,0 +1,45 @@ + + + + + + select eg.grade_id as grade_id, eg.grade_item_id as grade_item_id, eg.grade_plural_name + from evaluation_grades eg, acs_objects ao, cr_items cri + where cri.live_revision = eg.grade_id + and eg.grade_item_id = ao.object_id + and ao.context_id = :package_id + and eg.grade_name = 'Attendance' + + + + + + select task_item_id from evaluation_cal_task_map where cal_item_id = :cal_item_id + + + + + + update cr_revisions set content = :url where revision_id = :revision_id + + + + + + update cr_items set storage_type = 'text' where item_id = :item_id + + + + + + update cr_revisions set content_length = :content_length where revision_id = :revision_id + + + + + + insert into evaluation_cal_task_map (task_item_id,cal_item_id) values (:item_id,:cal_item_id) + + + + Index: openacs-4/packages/attendance/www/admin/mark.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/www/admin/mark.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/attendance/www/admin/mark.tcl 19 Jun 2005 06:05:05 -0000 1.3 +++ openacs-4/packages/attendance/www/admin/mark.tcl 16 Jul 2005 13:06:32 -0000 1.4 @@ -35,7 +35,7 @@ } present { label "Present" - display_template { checked> } + display_template { checked> } } } Index: openacs-4/packages/attendance/www/admin/spam.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/www/admin/spam.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attendance/www/admin/spam.adp 16 Jul 2005 13:06:32 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +"@context;noquote@" + +Select the users to whom you would like to send an email. + + \ No newline at end of file Index: openacs-4/packages/attendance/www/admin/spam.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attendance/www/admin/spam.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/attendance/www/admin/spam.tcl 16 Jul 2005 13:06:32 -0000 1.1 @@ -0,0 +1,70 @@ +ad_page_contract { + + List all attendees + Get a calendar item id. + Retrieve the users who are either present/absent for that calendar event + Redirect to the dotlrn/spam.tcl + + @author Hamilton Chua (hamilton.chua@gmail.com) + @creation-date 2004-05-17 + @version $Id: spam.tcl,v 1.1 2005/07/16 13:06:32 hamiltonc Exp $ + +} { + item_id:integer,notnull + {check ""} + {return_url ""} +} + + +# set some variables +set community_id [dotlrn_community::get_community_id] +set community_url [dotlrn_community::get_community_url $community_id] +set page_title "Email Attendees" +set context "" + +template::list::create \ + -name email_members \ + -key user_id \ + -multirow email_members \ + -bulk_actions { + "Email Checked" "" "Send Email to Checked Attendees" + } \ + -elements { + member_name { + label "Name" + } + attendance { + label "Attendance" + } + } + +template::multirow create email_members user_id member_name attendance + +set users [dotlrn_community::list_users $community_id] +set cal_item_id $item_id + +foreach user $users { + if { [db_0or1row "checkattendance" "select user_id from attendance_cal_item_map where cal_item_id = :cal_item_id and user_id = [ns_set get $user user_id]"] } { + set attendance "Present" + } else { + set attendance "Absent" + } + template::multirow append email_members "[ns_set get $user user_id]" "[ns_set get $user first_names] [ns_set get $user last_name]" "$attendance" +} + +# set query + +#if { $who == "present" } { +# set query "select user_id from attendance_cal_item_map where cal_item_id=:cal_item_id" +#} + +#set recipients "?recipients=" + +#db_foreach "get_ids" $query { +# append recipients "$user_id," +#} + +#append spam_url $recipients +#append spam_url "&recipients_str=,&referrer=$return_url" + +#ad_returnredirect $spam_url