Index: openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 14 May 2004 23:38:42 -0000 1.4 +++ openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 19 May 2004 17:33:08 -0000 1.5 @@ -2,7 +2,7 @@ ad_library { - Evaluations Package APM callbacks library + Evaluations Package APM callbacks library Procedures that deal with installing, instantiating, mounting. @@ -11,355 +11,84 @@ @cvs-id $Id$ } -namespace eval evaluation::apm_callbacks {} +namespace eval evaluation {} +namespace eval evaluation::apm {} -ad_proc -private evaluation::apm_callbacks::package_install { +ad_proc -private evaluation::apm::package_install { } { - Does the integration whith the notifications package. + Does the integration whith the notifications package. } { db_transaction { - - # Define notifications for new assignment - - # The notification type impl - set impl_id \ - [acs_sc::impl::new_from_spec -spec { - name one_assignment_notif_type - contract_name NotificationType - owner evaluation - aliases { - GetURL evaluation::notification::get_url - ProcessReply evaluation::notification::process_reply - } - }] - - set type_id [notification::type::new \ - -sc_impl_id $impl_id \ - -short_name one_assignment_notif \ - -pretty_name "One Assignment" \ - -description "Notification of a new Assignmnent"] - - # Enable the various intervals and delivery method - notification::type::interval_enable \ - -type_id $type_id \ - -interval_id [notification::interval::get_id_from_name -name instant] - - notification::type::interval_enable \ - -type_id $type_id \ - -interval_id [notification::interval::get_id_from_name -name hourly] - - notification::type::interval_enable \ - -type_id $type_id \ - -interval_id [notification::interval::get_id_from_name -name daily] - - notification::type::delivery_method_enable \ - -type_id $type_id \ - -delivery_method_id [notification::delivery::get_id -short_name email] - - } + + # Create the impl and aliases for one assignment + set impl_id [create_one_assignment_impl] + + # Create the notification type for one assignment + set type_id [create_one_assignment_type -impl_id $impl_id] + + # Enable the delivery intervals and delivery methods for a specific assignment + enable_intervals_and_methods -type_id $type_id + + # Create the impl and aliases for one evaluation + set impl_id [create_one_evaluation_impl] + + # Create the notification type for one evaluation + set type_id [create_one_evaluation_type -impl_id $impl_id] + + # Enable the delivery intervals and delivery methods for a specific evaluation + enable_intervals_and_methods -type_id $type_id + + } } -ad_proc -private evaluation::apm_callbacks::package_uninstall { +ad_proc -private evaluation::apm::package_uninstall { } { - Cleans the integration whith the notifications package. + Cleans the integration whith the notifications package. } { - db_transaction { - - # Delete the notification type service contract - delete_notification_type_contract - - # Delete the service contract implementation from the notifications service - unregister_email_delivery_method - - # Unregister email delivery method service contract implementation - delete_email_delivery_method_impl - - # Delete the delivery method service contract - delete_delivery_method_contract - + db_transaction { + + # Delete the type_id for a specific assignment + notification::type::delete -short_name one_assignment_notif + + # Delete the implementation for the notification of an assignment + delete_assignment_impl + + # Delete the type_id for a especific evaluation + notification::type::delete -short_name one_evaluation_notif + + # Delete the implementation for the notification of an evaluation + delete_evaluation_impl + } } -ad_proc -private evaluation::apm_callbacks::package_instantiate { - -package_id:required +ad_proc -private evaluation::apm::package_instantiate { + -package_id:required } { - Define Evaluation folders + Define Evaluation folders } { - set creation_user [ad_verify_and_get_user_id] - set creation_ip [ad_conn peeraddr] - - db_transaction { - db_exec_plsql create_evaluation_folders { - select evaluation__new_folder ( - 'evaluation_grades_'||:package_id, - 'evaluation_grades_'||:package_id, - 'Evaluation grades folder', - null, - 'evaluation_grades' - ); - - select evaluation__new_folder ( - 'evaluation_tasks_'||:package_id, - 'evaluation_tasks_'||:package_id, - 'Evaluation tasks folder', - null, - 'evaluation_tasks' - ); - - select evaluation__new_folder ( - 'evaluation_tasks_sols_'||:package_id, - 'evaluation_tasks_sols_'||:package_id, - 'Evaluation tasks solutions folder', - null, - 'evaluation_tasks_sols' - ); - - select evaluation__new_folder ( - 'evaluation_answers_'||:package_id, - 'evaluation_answers_'||:package_id, - 'Evaluation answers folder', - null, - 'evaluation_answers' - ); - - select evaluation__new_folder ( - 'evaluation_grades_sheets_'||:package_id, - 'evaluation_grades_sheets_'||:package_id, - 'Grades sheets folder', - null, - 'evaluation_grades_sheets' - ); - - select evaluation__new_folder ( - 'evaluation_student_evals_'||:package_id, - 'evaluation_student_evals_'||:package_id, - 'Evaluation student evaluations folder', - null, - 'evaluation_student_evals' - ); - } - - set creation_user [ad_verify_and_get_user_id] - set creation_ip [ad_conn peeraddr] - - set exams_item_id [db_nextval acs_object_id_seq] - set exams_item_name "evaluation_grades_${exams_item_id}" - set exams_revision_id [db_nextval acs_object_id_seq] - set exams_revision_name "evaluation_grades_${exams_revision_id}" - - db_exec_plsql exams_item_new { - select evaluation__new_item ( - :exams_item_id, --item_id - :exams_item_name, - null, - :creation_user, - :package_id, - :creation_ip, - 'Exams', - 'Exams for students', - 'text/plain', - null, - null, - 'text', - 'content_item', -- item_subtype - 'evaluation_grades' -- content_type - ); - } - - db_exec_plsql exams_revision_new { - select evaluation__new_grade ( - :exams_item_id, - :exams_revision_id, - 'Exams', - -1, -- class_id temporal - 40, - 'evaluation_grades', - now(), --creation date - :creation_user, - :creation_ip, - :exams_revision_name, - 'Exams for students', - now(), --publish date - null, --nls_language - 'text/plain' --mime_type - ); - } - - db_exec_plsql exams_live_revision { - select content_item__set_live_revision ( - :exams_revision_id - ); - } - - set projects_item_id [db_nextval acs_object_id_seq] - set projects_item_name "evaluation_grades_${projects_item_id}" - set projects_revision_id [db_nextval acs_object_id_seq] - set projects_revision_name "evaluation_grades_${projects_revision_id}" - - db_exec_plsql projects_item_new { - select evaluation__new_item ( - :projects_item_id, --item_id - :projects_item_name, - null, - :creation_user, - :package_id, - :creation_ip, - 'Projects', - 'Projects for students', - 'text/plain', - null, - null, - 'text', - 'content_item', -- item_subtype - 'evaluation_grades' -- content_type - ); - } - - db_exec_plsql projects_revision_new { - select evaluation__new_grade ( - :projects_item_id, - :projects_revision_id, - 'Projects', - -1, -- class_id temporal - 20, - 'evaluation_grades', - now(), --creation date - :creation_user, - :creation_ip, - :projects_revision_name, - 'Projects for students', - now(), --publish date - null, --nls_language - 'text/plain' --mime_type - ); - } - - db_exec_plsql projects_live_revision { - select content_item__set_live_revision ( - :projects_revision_id - ); - } - - set tasks_item_id [db_nextval acs_object_id_seq] - set tasks_item_name "evaluation_grades_${tasks_item_id}" - set tasks_revision_id [db_nextval acs_object_id_seq] - set tasks_revision_name "evaluation_grades_${tasks_revision_id}" - - db_exec_plsql tasks_item_new { - select evaluation__new_item ( - :tasks_item_id, --item_id - :tasks_item_name, - null, - :creation_user, - :package_id, - :creation_ip, - 'Tasks', - 'Tasks for students', - 'text/plain', - null, - null, - 'text', - 'content_item', -- item_subtype - 'evaluation_grades' -- content_type - ); - } - - db_exec_plsql tasks_revision_new { - select evaluation__new_grade ( - :tasks_item_id, - :tasks_revision_id, - 'Tasks', - -1, -- class_id temporal - 40, - 'evaluation_grades', - now(), --creation date - :creation_user, - :creation_ip, - :tasks_revision_name, - 'Tasks for students', - now(), --publish date - null, --nls_language - 'text/plain' --mime_type - ); - } - - db_exec_plsql tasks_live_revision { - select content_item__set_live_revision ( - :tasks_revision_id - ); - } - } + set creation_user [ad_verify_and_get_user_id] + set creation_ip [ad_conn peeraddr] + + create_folders -package_id $package_id } -ad_proc -private evaluation::apm_callbacks::package_uninstantiate { - -package_id:required +ad_proc -private evaluation::apm::package_uninstantiate { + -package_id:required } { - Delete Evaluation stuff + Delete Evaluation stuff } { - - set ev_grades_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_'||:package_id,null,'f')"] - set ev_grades_sheets_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_sheets_'||:package_id,null,'f')"] - set ev_tasks_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_'||:package_id,null,'f')"] - set ev_tasks_sols_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_sols_'||:package_id,null,'f')"] - set ev_answers_fid [db_string get_f_id "select content_item__get_id('evaluation_answers_'||:package_id,null,'f')"] - set ev_student_evals_fid [db_string get_f_id "select content_item__get_id('evaluation_student_evals_'||:package_id,null,'f')"] + + delete_contents -package_id $package_id - db_transaction { - db_exec_plsql delte_evaluation_contents { - select evaluation__delete_contents ( - :package_id - ); - } - - db_exec_plsql delte_grades_folder { - select evaluation__delete_folder ( - :ev_grades_sheets_fid, - 'evaluation_grades_sheets' - ); - } - - db_exec_plsql delte_grades_folder { - select evaluation__delete_folder ( - :ev_grades_fid, - 'evaluation_grades' - ); - } - - db_exec_plsql delte_task_folder { - select evaluation__delete_folder ( - :ev_tasks_fid, - 'evaluation_tasks' - ); - } - - db_exec_plsql delte_task_sols_folder { - select evaluation__delete_folder ( - :ev_tasks_sols_fid, - 'evaluation_tasks_sols' - ); - } - - db_exec_plsql delte_answers_folder { - select evaluation__delete_folder ( - :ev_answers_fid, - 'evaluation_answers' - ); - } - db_exec_plsql delte_evals_folder { - select evaluation__delete_folder ( - :ev_student_evals_fid, - 'evaluation_student_evals' - ); - } - } } Index: openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 12 May 2004 02:07:44 -0000 1.2 +++ openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 19 May 2004 17:33:08 -0000 1.3 @@ -344,5 +344,311 @@ + + + + + select grade_id from evaluation_tasks where task_id = :task_id and content_revision__is_live(task_id) = true + + + + + + + + select eg.grade_name, + et.task_name + from evaluation_grades eg, + evaluation_tasks et + where et.task_id = :task_id + and et.grade_id = eg.grade_id + + + + + + + + select description as edit_reason, + grade as current_grade, + evaluation__party_name(party_id,task_id) as party_name + from evaluation_student_evalsi + where evaluation_id = :evaluation_id + + + + + + + + select evaluation__new_folder ( + 'evaluation_grades_'||:package_id, + 'evaluation_grades_'||:package_id, + 'Evaluation grades folder', + null, + 'evaluation_grades' + ); + + select evaluation__new_folder ( + 'evaluation_tasks_'||:package_id, + 'evaluation_tasks_'||:package_id, + 'Evaluation tasks folder', + null, + 'evaluation_tasks' + ); + + select evaluation__new_folder ( + 'evaluation_tasks_sols_'||:package_id, + 'evaluation_tasks_sols_'||:package_id, + 'Evaluation tasks solutions folder', + null, + 'evaluation_tasks_sols' + ); + + select evaluation__new_folder ( + 'evaluation_answers_'||:package_id, + 'evaluation_answers_'||:package_id, + 'Evaluation answers folder', + null, + 'evaluation_answers' + ); + + select evaluation__new_folder ( + 'evaluation_grades_sheets_'||:package_id, + 'evaluation_grades_sheets_'||:package_id, + 'Grades sheets folder', + null, + 'evaluation_grades_sheets' + ); + + select evaluation__new_folder ( + 'evaluation_student_evals_'||:package_id, + 'evaluation_student_evals_'||:package_id, + 'Evaluation student evaluations folder', + null, + 'evaluation_student_evals' + ); + + + + + + + + select evaluation__new_item ( + :exams_item_id, --item_id + :exams_item_name, + null, + :creation_user, + :package_id, + :creation_ip, + 'Exams', + 'Exams for students', + 'text/plain', + null, + null, + 'text', + 'content_item', -- item_subtype + 'evaluation_grades' -- content_type + ); + + + + + + + + select evaluation__new_grade ( + :exams_item_id, + :exams_revision_id, + 'Exams', + -1, -- class_id temporal + 40, + 'evaluation_grades', + now(), --creation date + :creation_user, + :creation_ip, + :exams_revision_name, + 'Exams for students', + now(), --publish date + null, --nls_language + 'text/plain' --mime_type + ); + + + + + + + + select content_item__set_live_revision ( + :exams_revision_id + ); + + + + + + + select evaluation__new_item ( + :projects_item_id, --item_id + :projects_item_name, + null, + :creation_user, + :package_id, + :creation_ip, + 'Projects', + 'Projects for students', + 'text/plain', + null, + null, + 'text', + 'content_item', -- item_subtype + 'evaluation_grades' -- content_type + ); + + + + + + + + select content_item__set_live_revision ( + :projects_revision_id + ); + + + + + + + + select evaluation__new_item ( + :tasks_item_id, --item_id + :tasks_item_name, + null, + :creation_user, + :package_id, + :creation_ip, + 'Tasks', + 'Tasks for students', + 'text/plain', + null, + null, + 'text', + 'content_item', -- item_subtype + 'evaluation_grades' -- content_type + ); + + + + + + + + select evaluation__new_grade ( + :tasks_item_id, + :tasks_revision_id, + 'Tasks', + -1, -- class_id temporal + 40, + 'evaluation_grades', + now(), --creation date + :creation_user, + :creation_ip, + :tasks_revision_name, + 'Tasks for students', + now(), --publish date + null, --nls_language + 'text/plain' --mime_type + ); + + + + + + + select content_item__set_live_revision ( + :tasks_revision_id + ); + + + + + + + + select evaluation__delete_contents ( + :package_id + ); + + + + + + + + select evaluation__delete_folder ( + :ev_grades_sheets_fid, + 'evaluation_grades_sheets' + ); + + + + + + + + select evaluation__delete_folder ( + :ev_grades_fid, + 'evaluation_grades' + ); + + + + + + + + select evaluation__delete_folder ( + :ev_tasks_fid, + 'evaluation_tasks' + ); + + + + + + + + select evaluation__delete_folder ( + :ev_tasks_sols_fid, + 'evaluation_tasks_sols' + ); + + + + + + + + select evaluation__delete_folder ( + :ev_answers_fid, + 'evaluation_answers' + ); + + + + + + + + select evaluation__delete_folder ( + :ev_student_evals_fid, + 'evaluation_student_evals' + ); + + + Index: openacs-4/packages/evaluation/tcl/evaluation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 14 May 2004 23:38:42 -0000 1.3 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 19 May 2004 17:33:08 -0000 1.4 @@ -8,6 +8,7 @@ namespace eval evaluation {} namespace eval evaluation::notification {} +namespace eval evaluation::apm {} ##### # @@ -16,100 +17,133 @@ ##### ad_proc -public evaluation::notification::get_url { - -task_id:required + -task_id:required + -notif_type:required + {-evaluation_id ""} } { returns a full url to the object_id. - handles messages and forums. + handles assignments and evaluations. } { - db_1row get_grade_id "select grade_id from evaluation_tasks where task_id = :task_id and content_revision__is_live(task_id) = true" - set assignment_url "[ad_url][ad_conn package_url]" - return [export_vars -base "${assignment_url}task-view" { task_id grade_id }] - + set base_url "[ad_url][ad_conn package_url]" + switch $notif_type { + "one_assignment_notif" { + db_1row get_grade_id { *SQL* } + return [export_vars -base "${base_url}task-view" { task_id grade_id }] + } + "one_evaluation_notif" { + set evaluation_mode display + return [export_vars -base "${base_url}admin/evaluations/one-evaluation-edit" { task_id evaluation_id evaluation_mode }] + } + default { + error "Unrecognized value for notif type: $notif_type. Possible values are one_assignment_notif and one_evaluation_notif." + ad_script_abort + } + } } ad_proc -public evaluation::notification::do_notification { - -task_id:required - -package_id:required + -task_id:required + -package_id:required + -notif_type:required + {-evaluation_id ""} + {-edit_p 0} } { - - db_1row select_names { - select eg.grade_name, - et.task_name - from evaluation_grades eg, - evaluation_tasks et - where et.task_id = :task_id - and et.grade_id = eg.grade_id - } - - set new_content "If you wan to see more.... ok see [evaluation::notification::get_url -task_id $task_id]" - - # Notifies the users that requested notification for the specific assignment - + + db_1row select_names { *SQL* } + + switch $notif_type { + "one_assignment_notif" { + if { [string eq $edit_p 0] } { + set notif_subject "New Assignment ($grade_name)" + set notif_text "A new assignment was uploaded, if you want to see more details \n" + } else { + set notif_subject "Assignment Edited ($grade_name)" + set notif_text "An assignment was modified, if you want to see more details \n" + } + append notif_text "click on this link: [evaluation::notification::get_url -task_id $task_id -notif_type one_assignment_notif] \n" + set response_id $task_id + + } + "one_evaluation_notif" { + db_1row get_eval_info { *SQL* } + set user_name [person::name -person_id [ad_conn user_id]] + set notif_subject "Evaluation Modified" + set notif_text "$user_name has modified the grade of ${party_name}. \n The edit reason given by $user_name was: $edit_reason \n The current grade is: $current_grade \n\n Click on this link to see the evaluation details: [evaluation::notification::get_url -task_id $task_id -evaluation_id $evaluation_id -notif_type one_evaluation_notif] \n" + set response_id $evaluation_id + } + default { + error "Unrecognized value for notif type: $notif_type. Possible values are one_assignment_notif and one_evaluation_notif." + ad_script_abort + } + } + + # Notifies the users that requested notification for the specific object + notification::new \ - -type_id [notification::type::get_type_id -short_name one_assignment_notif] \ - -object_id $package_id \ - -response_id $task_id \ - -notif_subject "New Assignment" \ - -notif_text $new_content + -type_id [notification::type::get_type_id -short_name $notif_type] \ + -object_id $package_id \ + -response_id $response_id \ + -notif_subject $notif_subject \ + -notif_text $notif_text } ad_proc -public evaluation::package_key {} { return "evaluation" } ad_proc -public evaluation::make_url { - -file_name_from_db:required + -file_name_from_db:required } { if { [regexp "view" $file_name_from_db] } { - return $file_name_from_db - } elseif { [regexp "http://" $file_name_from_db] } { - return $file_name_from_db - } else { - return $file_name_from_db - } + return $file_name_from_db + } elseif { [regexp "http://" $file_name_from_db] } { + return $file_name_from_db + } else { + return $file_name_from_db + } } ad_proc -public evaluation::new_grade { - -item_id:required - -content_type:required - -content_table:required - -content_id:required - -new_item_p:required - -description:required - -weight:required - -name:required + -item_id:required + -content_type:required + -content_table:required + -content_id:required + -new_item_p:required + -description:required + -weight:required + -name:required } { - - Build a new content revision of a evaluation subtype. If new_item_p is - set true then a new item is first created, otherwise a new revision is created for - the item indicated by item_id. - - @param item_id The item to update or create. - @param content_type The type to make - @param content_table - @param new_item_p If true make a new item using item_id - + + Build a new content revision of a evaluation subtype. If new_item_p is + set true then a new item is first created, otherwise a new revision is created for + the item indicated by item_id. + + @param item_id The item to update or create. + @param content_type The type to make + @param content_table + @param new_item_p If true make a new item using item_id + } { - - set package_id [ad_conn package_id] - set creation_user [ad_verify_and_get_user_id] - set creation_ip [ad_conn peeraddr] - - set item_name "${content_type}_${item_id}" - - set revision_id [db_nextval acs_object_id_seq] - set revision_name "${content_type}_${revision_id}" - - if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - - } + + set package_id [ad_conn package_id] + set creation_user [ad_verify_and_get_user_id] + set creation_ip [ad_conn peeraddr] + + set item_name "${content_type}_${item_id}" + + set revision_id [db_nextval acs_object_id_seq] + set revision_name "${content_type}_${revision_id}" + + if { $new_item_p } { + db_exec_plsql content_item_new { *SQL* } - db_exec_plsql content_revision_new { *SQL* } - - return $revision_id + } + + db_exec_plsql content_revision_new { *SQL* } + + return $revision_id } @@ -536,6 +570,195 @@ $csv_formatted_content" } +ad_proc -private evaluation::apm::delete_one_assignment_impl {} { + Unregister the NotificationType implementation for one_assignment_notif_type. +} { + acs_sc::impl::delete \ + -contract_name "NotificationType" \ + -impl_name one_assignment_notif_type +} + +ad_proc -private evaluation::apm::delete_one_evaluation_impl {} { + Unregister the NotificationType implementation for one_evaluation_notif_type. +} { + acs_sc::impl::delete \ + -contract_name "NotificationType" \ + -impl_name one_evaluation_notif_type +} + +ad_proc -private evaluation::apm::create_one_assignment_impl {} { + Register the service contract implementation and return the impl_id + @return impl_id of the created implementation +} { + return [acs_sc::impl::new_from_spec -spec { + name one_assignment_notif_type + contract_name NotificationType + owner evaluation + aliases { + GetURL evaluation::notification::get_url + ProcessReply evaluation::notification::process_reply + } + }] +} + +ad_proc -private evaluation::apm::create_one_evaluation_impl {} { + Register the service contract implementation and return the impl_id + @return impl_id of the created implementation +} { + return [acs_sc::impl::new_from_spec -spec { + name one_evaluation_notif_type + contract_name NotificationType + owner evaluation + aliases { + GetURL evaluation::notification::get_url + ProcessReply evaluation::notification::process_reply + } + }] +} +ad_proc -private evaluation::apm::create_one_assignment_type { + -impl_id:required +} { + Create the notification type for one specific assignment + @return the type_id of the created type +} { + return [notification::type::new \ + -sc_impl_id $impl_id \ + -short_name one_assignment_notif \ + -pretty_name "One Assignment" \ + -description "Notification for assignments"] +} + +ad_proc -private evaluation::apm::create_one_evaluation_type { + -impl_id:required +} { + Create the notification type for one specific evaluation + @return the type_id of the created type +} { + return [notification::type::new \ + -sc_impl_id $impl_id \ + -short_name one_evaluation_notif \ + -pretty_name "One Evaluation" \ + -description "Notification for evaluations"] +} + +ad_proc -public evaluation::apm::enable_intervals_and_methods { + -type_id:required +} { + Enable the intervals and delivery methods of a specific type +} { + # Enable the various intervals and delivery method + notification::type::interval_enable \ + -type_id $type_id \ + -interval_id [notification::interval::get_id_from_name -name instant] + + notification::type::interval_enable \ + -type_id $type_id \ + -interval_id [notification::interval::get_id_from_name -name hourly] + + notification::type::interval_enable \ + -type_id $type_id \ + -interval_id [notification::interval::get_id_from_name -name daily] + + # Enable the delivery methods + notification::type::delivery_method_enable \ + -type_id $type_id \ + -delivery_method_id [notification::delivery::get_id -short_name email] +} + +ad_proc -public evaluation::apm::create_folders { + -package_id:required +} { + Helper for the apm_proc +} { + db_transaction { + db_exec_plsql create_evaluation_folders { *SQL* } + + set creation_user [ad_verify_and_get_user_id] + set creation_ip [ad_conn peeraddr] + + set exams_item_id [db_nextval acs_object_id_seq] + set exams_item_name "evaluation_grades_${exams_item_id}" + set exams_revision_id [db_nextval acs_object_id_seq] + set exams_revision_name "evaluation_grades_${exams_revision_id}" + + db_exec_plsql exams_item_new { *SQL* } + + db_exec_plsql exams_revision_new { *SQL* } + + db_exec_plsql exams_live_revision { *SQL* } + + set projects_item_id [db_nextval acs_object_id_seq] + set projects_item_name "evaluation_grades_${projects_item_id}" + set projects_revision_id [db_nextval acs_object_id_seq] + set projects_revision_name "evaluation_grades_${projects_revision_id}" + + db_exec_plsql projects_item_new { *SQL* } + + db_exec_plsql projects_revision_new { + select evaluation__new_grade ( + :projects_item_id, + :projects_revision_id, + 'Projects', + -1, -- class_id temporal + 20, + 'evaluation_grades', + now(), --creation date + :creation_user, + :creation_ip, + :projects_revision_name, + 'Projects for students', + now(), --publish date + null, --nls_language + 'text/plain' --mime_type + ); + } + + db_exec_plsql projects_live_revision { *SQL* } + + set tasks_item_id [db_nextval acs_object_id_seq] + set tasks_item_name "evaluation_grades_${tasks_item_id}" + set tasks_revision_id [db_nextval acs_object_id_seq] + set tasks_revision_name "evaluation_grades_${tasks_revision_id}" + + db_exec_plsql tasks_item_new { *SQL* } + + db_exec_plsql tasks_revision_new { *SQL* } + + db_exec_plsql tasks_live_revision { *SQL* } + + } +} + +ad_proc -public evaluation::apm::delete_contents { + -package_id:required +} { + Helper for the apm_proc +} { + + set ev_grades_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_'||:package_id,null,'f')"] + set ev_grades_sheets_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_sheets_'||:package_id,null,'f')"] + set ev_tasks_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_'||:package_id,null,'f')"] + set ev_tasks_sols_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_sols_'||:package_id,null,'f')"] + set ev_answers_fid [db_string get_f_id "select content_item__get_id('evaluation_answers_'||:package_id,null,'f')"] + set ev_student_evals_fid [db_string get_f_id "select content_item__get_id('evaluation_student_evals_'||:package_id,null,'f')"] + + db_transaction { + db_exec_plsql delte_evaluation_contents { *SQL* } + + db_exec_plsql delte_grades_sheets_folder { *SQL* } + + db_exec_plsql delte_grades_folder { *SQL* } + + db_exec_plsql delte_task_folder { *SQL* } + + db_exec_plsql delte_task_sols_folder { *SQL* } + + db_exec_plsql delte_answers_folder { *SQL* } + + db_exec_plsql delte_evals_folder { *SQL* } + } +} + ad_register_proc GET /grades-sheet-csv* evaluation::generate_grades_sheet ad_register_proc POST /grades-sheet-csv* evaluation::generate_grades_sheet Index: openacs-4/packages/evaluation/www/answer-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/answer-add-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/answer-add-edit.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/answer-add-edit.tcl 19 May 2004 17:33:08 -0000 1.2 @@ -7,19 +7,19 @@ @creation-date Mar 2004 @cvs-id $Id$ } { - task_id:integer,notnull - grade_id:integer,notnull - answer_id:integer,notnull,optional - item_id:integer,notnull,optional + task_id:integer,notnull + grade_id:integer,notnull + answer_id:integer,notnull,optional + item_id:integer,notnull,optional upload_file:trim,optional upload_file.tmpfile:tmpfile,optional + {return_url "/"} } set user_id [ad_conn user_id] set party_id [db_string get_party_id { *SQL* }] set package_id [ad_conn package_id] -set return_url "task-list?[export_vars { grade_id }]" if { [ad_form_new_p -key answer_id] } { set page_title "Upload Answer" Index: openacs-4/packages/evaluation/www/evaluation-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/evaluation-list.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/evaluation-list.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/evaluation-list.tcl 19 May 2004 17:33:08 -0000 1.2 @@ -1,4 +1,4 @@ -# /packages/evaluation/www/task-list.tcl +# /packages/evaluation/www/evaluation-list.tcl ad_page_contract { Index: openacs-4/packages/evaluation/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/index.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/evaluation/www/index.adp 14 May 2004 23:38:43 -0000 1.3 +++ openacs-4/packages/evaluation/www/index.adp 19 May 2004 17:33:08 -0000 1.4 @@ -25,10 +25,13 @@
  • There are no tasks to evaluate for this package.
  • - +
  • @grades.grade_name@
  • -
    +
    + +
    Your total grade in this class is: @total_class_grade@ +
    Index: openacs-4/packages/evaluation/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/evaluation/www/index.tcl 14 May 2004 23:38:43 -0000 1.2 +++ openacs-4/packages/evaluation/www/index.tcl 19 May 2004 17:33:08 -0000 1.3 @@ -23,6 +23,8 @@ } +set total_class_grade [format %.2f [db_string get_total_grade "select evaluation__class_total_grade(:user_id,:package_id)"]] + set notification_chunk [notification::display::request_widget \ -type one_assignment_notif \ -object_id $package_id \ Index: openacs-4/packages/evaluation/www/task-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/task-view.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/task-view.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/task-view.tcl 19 May 2004 17:33:08 -0000 1.2 @@ -7,13 +7,13 @@ @creation-date Mar 2004 @cvs-id $Id$ } { - grade_id:integer,notnull - task_id:integer,notnull,optional - item_id:integer,notnull,optional + grade_id:integer,notnull + task_id:integer,notnull,optional + item_id:integer,notnull,optional + {return_url "/"} } set package_id [ad_conn package_id] -set return_url "task-list?[export_vars { grade_id }]" set page_title "View Task" db_1row get_grade_info { *SQL* } Index: openacs-4/packages/evaluation/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/index.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/evaluation/www/admin/index.adp 14 May 2004 23:38:43 -0000 1.2 +++ openacs-4/packages/evaluation/www/admin/index.adp 19 May 2004 17:33:09 -0000 1.3 @@ -8,7 +8,7 @@

    Assignments

    -

    @notification_chunk;noquote@

    +

    @assignments_notification_chunk;noquote@


    Evaluations

    +

    @evaluations_notification_chunk;noquote@