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@
- There are no tasks for this package.
@@ -22,6 +22,7 @@
Evaluations
+@evaluations_notification_chunk;noquote@
- There are no tasks to evaluate for this package.
Index: openacs-4/packages/evaluation/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/index.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/evaluation/www/admin/index.tcl 14 May 2004 23:38:43 -0000 1.2
+++ openacs-4/packages/evaluation/www/admin/index.tcl 19 May 2004 17:33:09 -0000 1.3
@@ -14,17 +14,25 @@
set context {}
set package_id [ad_conn package_id]
-# [permission::permission_p -party_id $user_id -object_id $package_id -privilege read]
+set user_id [ad_conn user_id]
+set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin]
db_multirow grades get_grades { *SQL* } {
}
-set notification_chunk [notification::display::request_widget \
+set assignments_notification_chunk [notification::display::request_widget \
-type one_assignment_notif \
-object_id $package_id \
-pretty_name "Assignments" \
-url [ad_conn url] \
]
+set evaluations_notification_chunk [notification::display::request_widget \
+ -type one_evaluation_notif \
+ -object_id $package_id \
+ -pretty_name "Evaluations" \
+ -url [ad_conn url] \
+ ]
+
ad_return_template
\ No newline at end of file
Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl 12 May 2004 02:07:45 -0000 1.2
+++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl 19 May 2004 17:33:09 -0000 1.3
@@ -1,225 +1,235 @@
# /packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl
ad_page_contract {
- This page asks for an evaluation confirmation
+ This page asks for an evaluation confirmation
- @author jopez@galileo.edu
- @creation-date Mar 2004
- @cvs_id $Id$
+ @author jopez@galileo.edu
+ @creation-date Mar 2004
+ @cvs_id $Id$
} {
- task_id:integer,notnull
- max_grade:integer,notnull,optional
- item_ids:array,integer,optional
- item_to_edit_ids:array,optional
+ task_id:integer,notnull
+ max_grade:integer,notnull,optional
+ item_ids:array,integer,optional
+ item_to_edit_ids:array,optional
- grades_to_edit:array,optional
- reasons_to_edit:array,optional
- show_student_to_edit:array,optional
+ grades_to_edit:array,optional
+ reasons_to_edit:array,optional
+ show_student_to_edit:array,optional
- grades_wa:array,optional
- comments_wa:array,optional
- show_student_wa:array,optional
+ grades_wa:array,optional
+ comments_wa:array,optional
+ show_student_wa:array,optional
- grades_na:array,optional
- comments_na:array,optional
- show_student_na:array,optional
+ grades_na:array,optional
+ comments_na:array,optional
+ show_student_na:array,optional
- grades_gs:array,optional
- comments_gs:array,optional
- show_student_gs:array,optional
- new_p_gs:array,optional
- grades_sheet_item_id:integer,optional
- upload_file:optional
- {tmp_filename:optional ""}
-
+ grades_gs:array,optional
+ comments_gs:array,optional
+ show_student_gs:array,optional
+ new_p_gs:array,optional
+ grades_sheet_item_id:integer,optional
+ upload_file:optional
+ {tmp_filename:optional ""}
+
} -validate {
- valid_grades_gs {
- set counter 0
- foreach party_id [array names grades_gs] {
- if { [info exists grades_gs($party_id)] && ![empty_string_p $grades_gs($party_id)] } {
- incr counter
- if { ![ad_var_type_check_number_p $grades_gs($party_id)] } {
- ad_complain "The grade most be a valid number ($grades_gs($party_id))"
- }
- }
+ valid_grades_gs {
+ set counter 0
+ foreach party_id [array names grades_gs] {
+ if { [info exists grades_gs($party_id)] && ![empty_string_p $grades_gs($party_id)] } {
+ incr counter
+ if { ![ad_var_type_check_number_p $grades_gs($party_id)] } {
+ ad_complain "The grade most be a valid number ($grades_gs($party_id))"
}
- if { !$counter && ([array size show_student_gs] > 0) } {
- ad_complain "There must be at least one grade to work with"
- }
+ }
}
- valid_grades_wa {
- set counter 0
- foreach party_id [array names grades_wa] {
- if { [info exists grades_wa($party_id)] && ![empty_string_p $grades_wa($party_id)] } {
- incr counter
- if { ![ad_var_type_check_number_p $grades_wa($party_id)] } {
- ad_complain "The grade most be a valid number ($grades_wa($party_id))"
- }
- }
- }
- if { !$counter && ([array size show_student_wa] > 0) } {
- ad_complain "There must be at least one grade to work with"
- }
+ if { !$counter && ([array size show_student_gs] > 0) } {
+ ad_complain "There must be at least one grade to work with"
}
- valid_grades_na {
- set counter 0
- foreach party_id [array names grades_na] {
- if { [info exists grades_na($party_id)] && ![empty_string_p $grades_na($party_id)]} {
- incr counter
- if { ![ad_var_type_check_number_p $grades_na($party_id)] } {
- ad_complain "The grade most be a valid number ($grades_na($party_id))"
- }
- }
+ }
+ valid_grades_wa {
+ set counter 0
+ foreach party_id [array names grades_wa] {
+ if { [info exists grades_wa($party_id)] && ![empty_string_p $grades_wa($party_id)] } {
+ incr counter
+ if { ![ad_var_type_check_number_p $grades_wa($party_id)] } {
+ ad_complain "The grade most be a valid number ($grades_wa($party_id))"
}
- if { !$counter && ([array size show_student_na] > 0) } {
- ad_complain "There must be at least one grade to work with"
- }
+ }
}
- valid_grades {
- set counter 0
- foreach party_id [array names grades_to_edit] {
- if { [info exists grades_to_edit($party_id)] && ![empty_string_p $grades_to_edit($party_id)] } {
- incr counter
- if { ![ad_var_type_check_number_p $grades_to_edit($party_id)] } {
- ad_complain "The grade most be a valid number ($grades_to_edit($party_id))"
- }
- }
+ if { !$counter && ([array size show_student_wa] > 0) } {
+ ad_complain "There must be at least one grade to work with"
+ }
+ }
+ valid_grades_na {
+ set counter 0
+ foreach party_id [array names grades_na] {
+ if { [info exists grades_na($party_id)] && ![empty_string_p $grades_na($party_id)]} {
+ incr counter
+ if { ![ad_var_type_check_number_p $grades_na($party_id)] } {
+ ad_complain "The grade most be a valid number ($grades_na($party_id))"
}
- if { !$counter && ([array size show_student_to_edit] > 0) } {
- ad_complain "There must be at least one grade to work with"
- }
+ }
}
- valid_data {
- foreach party_id [array names comments_gs] {
- if { [info exists comments_gs($party_id)] && ![info exists grades_gs($party_id)] } {
- ad_complain "There is a comment for a grade not realized ($comments_gs($party_id))"
- }
- if { [info exists comments_gs($party_id)] && ([string length $comments_gs($party_id)] > 400) } {
- ad_complain "There is a comment larger than we can handle. ($comments_gs($party_id))"
- }
+ if { !$counter && ([array size show_student_na] > 0) } {
+ ad_complain "There must be at least one grade to work with"
+ }
+ }
+ valid_grades {
+ set counter 0
+ foreach party_id [array names grades_to_edit] {
+ if { [info exists grades_to_edit($party_id)] && ![empty_string_p $grades_to_edit($party_id)] } {
+ incr counter
+ if { ![ad_var_type_check_number_p $grades_to_edit($party_id)] } {
+ ad_complain "The grade most be a valid number ($grades_to_edit($party_id))"
}
- foreach party_id [array names comments_wa] {
- if { [info exists comments_wa($party_id)] && ![info exists grades_wa($party_id)] } {
- ad_complain "There is a comment for a grade not realized ($comments_wa($party_id))"
- }
- if { [info exists comments_wa($party_id)] && ([string length $comments_wa($party_id)] > 400) } {
- ad_complain "There is a comment larger than we can handle. ($comments_wa($party_id))"
- }
- }
- foreach party_id [array names comments_na] {
- if { [info exists comments_na($party_id)] && ![info exists grades_na($party_id)] } {
- ad_complain "There is a comment for a grade not realized ($comments_na($party_id))"
- }
- if { [info exists comments_na($party_id)] && ([string length $comments_na($party_id)] > 400) } {
- ad_complain "There is a comment larger than we can handle. ($comments_na($party_id))"
- }
- }
- foreach party_id [array names reasons_to_edit] {
- if { [info exists reasons_to_edit($party_id)] && ![info exists grades_to_edit($party_id)] } {
- ad_complain "There is an edit reason for a grade not realized ($reasons_to_edit($party_id))"
- }
- if { [info exists reasons_to_edit($party_id)] && ([string length $reasons_to_edit($party_id)] > 400) } {
- ad_complain "There is an edit reason larger than we can handle. ($reasons_to_edit($party_id))"
- }
- }
+ }
}
+ if { !$counter && ([array size show_student_to_edit] > 0) } {
+ ad_complain "There must be at least one grade to work with"
+ }
+ }
+ valid_data {
+ foreach party_id [array names comments_gs] {
+ if { [info exists comments_gs($party_id)] && ![info exists grades_gs($party_id)] } {
+ ad_complain "There is a comment for a grade not realized ($comments_gs($party_id))"
+ }
+ if { [info exists comments_gs($party_id)] && ([string length $comments_gs($party_id)] > 400) } {
+ ad_complain "There is a comment larger than we can handle. ($comments_gs($party_id))"
+ }
+ }
+ foreach party_id [array names comments_wa] {
+ if { [info exists comments_wa($party_id)] && ![info exists grades_wa($party_id)] } {
+ ad_complain "There is a comment for a grade not realized ($comments_wa($party_id))"
+ }
+ if { [info exists comments_wa($party_id)] && ([string length $comments_wa($party_id)] > 400) } {
+ ad_complain "There is a comment larger than we can handle. ($comments_wa($party_id))"
+ }
+ }
+ foreach party_id [array names comments_na] {
+ if { [info exists comments_na($party_id)] && ![info exists grades_na($party_id)] } {
+ ad_complain "There is a comment for a grade not realized ($comments_na($party_id))"
+ }
+ if { [info exists comments_na($party_id)] && ([string length $comments_na($party_id)] > 400) } {
+ ad_complain "There is a comment larger than we can handle. ($comments_na($party_id))"
+ }
+ }
+ foreach party_id [array names reasons_to_edit] {
+ if { [info exists reasons_to_edit($party_id)] && ![info exists grades_to_edit($party_id)] } {
+ ad_complain "There is an edit reason for a grade not realized ($reasons_to_edit($party_id))"
+ }
+ if { [info exists reasons_to_edit($party_id)] && ([string length $reasons_to_edit($party_id)] > 400) } {
+ ad_complain "There is an edit reason larger than we can handle. ($reasons_to_edit($party_id))"
+ }
+ }
+ }
}
if { ![empty_string_p $tmp_filename] } {
+
+ set tmp_filename "${tmp_filename}_grades_sheet"
+
+ db_transaction {
- set tmp_filename "${tmp_filename}_grades_sheet"
+ set title [template::util::file::get_property filename $upload_file]
+ set mime_type [cr_filename_to_mime_type -create $title]
- db_transaction {
-
- set title [template::util::file::get_property filename $upload_file]
- set mime_type [cr_filename_to_mime_type -create $title]
+ set revision_id [evaluation::new_grades_sheet -new_item_p 1 -item_id $grades_sheet_item_id -content_type evaluation_grades_sheets \
+ -content_table evaluation_grades_sheets -content_id grades_sheet_id -storage_type lob -task_id $task_id \
+ -title $title -mime_type $mime_type]
+
+ evaluation::set_live -revision_id $revision_id
- set revision_id [evaluation::new_grades_sheet -new_item_p 1 -item_id $grades_sheet_item_id -content_type evaluation_grades_sheets \
- -content_table evaluation_grades_sheets -content_id grades_sheet_id -storage_type lob -task_id $task_id \
- -title $title -mime_type $mime_type]
-
- evaluation::set_live -revision_id $revision_id
-
- # create the new item
- db_dml lob_content " update cr_revisions
+ # create the new item
+ db_dml lob_content " update cr_revisions
set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]]
where revision_id = :revision_id
" -blob_files [list $tmp_filename]
+
+ set content_length [file size $tmp_filename]
+ # Unfortunately, we can only calculate the file size after the lob is uploaded
+ db_dml lob_size { update cr_revisions
+ set content_length = :content_length
+ where revision_id = :revision_id
+ }
+
+ foreach party_id [array names grades_gs] {
+ if { ![info exists comments_gs($party_id)] } {
+ set comments_gs($party_id) ""
+ } else {
+ set comments_gs($party_id) [DoubleApos $comments_gs($party_id)]
+ }
+
+ if { [info exists grades_gs($party_id)] && ![empty_string_p $grades_gs($party_id)] } {
+ set grades_gs($party_id) [expr ($grades_gs($party_id)*100)/$max_grade.0]
+ set revision_id [evaluation::new_evaluation -new_item_p $new_p_gs($party_id) -item_id $item_ids($party_id) -content_type evaluation_student_evals \
+ -content_table evaluation_student_evals -content_id evaluation_id -description $comments_gs($party_id) \
+ -show_student_p $show_student_gs($party_id) -grade $grades_gs($party_id) -task_id $task_id -party_id $party_id]
- set content_length [file size $tmp_filename]
- # Unfortunately, we can only calculate the file size after the lob is uploaded
- db_dml lob_size { update cr_revisions
- set content_length = :content_length
- where revision_id = :revision_id
- }
+ evaluation::set_live -revision_id $revision_id
- foreach party_id [array names grades_gs] {
- if { ![info exists comments_gs($party_id)] } {
- set comments_gs($party_id) ""
- } else {
- set comments_gs($party_id) [DoubleApos $comments_gs($party_id)]
- }
-
- if { [info exists grades_gs($party_id)] && ![empty_string_p $grades_gs($party_id)] } {
- set grades_gs($party_id) [expr ($grades_gs($party_id)*100)/$max_grade.0]
- set revision_id [evaluation::new_evaluation -new_item_p $new_p_gs($party_id) -item_id $item_ids($party_id) -content_type evaluation_student_evals \
- -content_table evaluation_student_evals -content_id evaluation_id -description $comments_gs($party_id) \
- -show_student_p $show_student_gs($party_id) -grade $grades_gs($party_id) -task_id $task_id -party_id $party_id]
-
- evaluation::set_live -revision_id $revision_id
- }
+ if { [string eq $new_p_gs($party_id) 0] } {
+ # if editing the grade, send the notification
+ evaluation::notification::do_notification -task_id $task_id -evaluation_id $revision_id -package_id [ad_conn package_id] -notif_type one_evaluation_notif
}
+
+ }
}
+ }
}
db_transaction {
- foreach party_id [array names grades_wa] {
- if { ![info exists comments_wa($party_id)] } {
- set comments_wa($party_id) ""
- } else {
- set comments_wa($party_id) [DoubleApos $comments_wa($party_id)]
- }
-
- if { [info exists grades_wa($party_id)] && ![empty_string_p $grades_wa($party_id)] } {
- set grades_wa($party_id) [expr ($grades_wa($party_id)*100)/$max_grade.0]
- set revision_id [evaluation::new_evaluation -new_item_p 1 -item_id $item_ids($party_id) -content_type evaluation_student_evals \
- -content_table evaluation_student_evals -content_id evaluation_id -description $comments_wa($party_id) \
- -show_student_p $show_student_wa($party_id) -grade $grades_wa($party_id) -task_id $task_id -party_id $party_id]
-
- evaluation::set_live -revision_id $revision_id
- }
+ foreach party_id [array names grades_wa] {
+ if { ![info exists comments_wa($party_id)] } {
+ set comments_wa($party_id) ""
+ } else {
+ set comments_wa($party_id) [DoubleApos $comments_wa($party_id)]
}
+
+ if { [info exists grades_wa($party_id)] && ![empty_string_p $grades_wa($party_id)] } {
+ set grades_wa($party_id) [expr ($grades_wa($party_id)*100)/$max_grade.0]
+ set revision_id [evaluation::new_evaluation -new_item_p 1 -item_id $item_ids($party_id) -content_type evaluation_student_evals \
+ -content_table evaluation_student_evals -content_id evaluation_id -description $comments_wa($party_id) \
+ -show_student_p $show_student_wa($party_id) -grade $grades_wa($party_id) -task_id $task_id -party_id $party_id]
+
+ evaluation::set_live -revision_id $revision_id
+ }
+ }
}
db_transaction {
- foreach party_id [array names grades_na] {
- if { ![info exists comments_na($party_id)] } {
- set comments_na($party_id) ""
- } else {
- set comments_na($party_id) [DoubleApos $comments_na($party_id)]
- }
- if { [info exists grades_na($party_id)] && ![empty_string_p $grades_na($party_id)] } {
- set grades_na($party_id) [expr ($grades_na($party_id)*100)/$max_grade.0]
- set revision_id [evaluation::new_evaluation -new_item_p 1 -item_id $item_ids($party_id) -content_type evaluation_student_evals \
- -content_table evaluation_student_evals -content_id evaluation_id -description $comments_na($party_id) \
- -show_student_p $show_student_na($party_id) -grade $grades_na($party_id) -task_id $task_id -party_id $party_id]
-
- evaluation::set_live -revision_id $revision_id
- }
+ foreach party_id [array names grades_na] {
+ if { ![info exists comments_na($party_id)] } {
+ set comments_na($party_id) ""
+ } else {
+ set comments_na($party_id) [DoubleApos $comments_na($party_id)]
}
+ if { [info exists grades_na($party_id)] && ![empty_string_p $grades_na($party_id)] } {
+ set grades_na($party_id) [expr ($grades_na($party_id)*100)/$max_grade.0]
+ set revision_id [evaluation::new_evaluation -new_item_p 1 -item_id $item_ids($party_id) -content_type evaluation_student_evals \
+ -content_table evaluation_student_evals -content_id evaluation_id -description $comments_na($party_id) \
+ -show_student_p $show_student_na($party_id) -grade $grades_na($party_id) -task_id $task_id -party_id $party_id]
+
+ evaluation::set_live -revision_id $revision_id
+ }
+ }
}
db_transaction {
- foreach party_id [array names grades_to_edit] {
- if { [info exists grades_to_edit($party_id)] && ![empty_string_p $grades_to_edit($party_id)] } {
- set grades_to_edit($party_id) [expr ($grades_to_edit($party_id)*100)/$max_grade.0]
- set revision_id [evaluation::new_evaluation -new_item_p 0 -item_id $item_to_edit_ids($party_id) -content_type evaluation_student_evals \
- -content_table evaluation_student_evals -content_id evaluation_id -description $reasons_to_edit($party_id) \
- -show_student_p $show_student_to_edit($party_id) -grade $grades_to_edit($party_id) -task_id $task_id -party_id $party_id]
-
- evaluation::set_live -revision_id $revision_id
- }
+ foreach party_id [array names grades_to_edit] {
+ if { [info exists grades_to_edit($party_id)] && ![empty_string_p $grades_to_edit($party_id)] } {
+ set grades_to_edit($party_id) [expr ($grades_to_edit($party_id)*100)/$max_grade.0]
+ set revision_id [evaluation::new_evaluation -new_item_p 0 -item_id $item_to_edit_ids($party_id) -content_type evaluation_student_evals \
+ -content_table evaluation_student_evals -content_id evaluation_id -description $reasons_to_edit($party_id) \
+ -show_student_p $show_student_to_edit($party_id) -grade $grades_to_edit($party_id) -task_id $task_id -party_id $party_id]
+
+ evaluation::set_live -revision_id $revision_id
+
+ # send the notification to everyone suscribed
+ evaluation::notification::do_notification -task_id $task_id -evaluation_id $revision_id -package_id [ad_conn package_id] -notif_type one_evaluation_notif
+
}
+ }
}
ad_returnredirect "student-list?[export_vars { task_id } ]"
Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.tcl 12 May 2004 02:07:45 -0000 1.1
+++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.tcl 19 May 2004 17:33:09 -0000 1.2
@@ -177,7 +177,6 @@
set evaluations_gs:rowcount $counter
set export_vars [export_vars -form { task_id max_grade grades_gs comments_gs show_student_gs item_ids new_p_gs grades_sheet_item_id tmp_filename upload_file }]
- ns_log Notice "el file handler es ($file_handler y el tmp es $tmp_filename)\n"
# writing the file in the file system so we can work with it later
flush $file_handler
close $file_handler
Index: openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1
+++ openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit-postgresql.xql 19 May 2004 17:33:09 -0000 1.2
@@ -9,7 +9,7 @@
select evaluation__party_name(ese.party_id,:task_id) as party_name,
ese.grade,
ese.show_student_p,
- ese.description
+ ese.description as comments
from evaluation_student_evalsx ese
where ese.evaluation_id = :evaluation_id
Index: openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.tcl 28 Apr 2004 11:06:41 -0000 1.1
+++ openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.tcl 19 May 2004 17:33:09 -0000 1.2
@@ -7,8 +7,9 @@
@creation-date Mar 2004
@cvs-id $Id$
} {
- task_id:integer,notnull
- evaluation_id:integer,notnull
+ task_id:integer,notnull
+ evaluation_id:integer,notnull
+ {evaluation_mode "edit"}
}
set return_url "student-list?[export_vars -url { task_id }]"
@@ -17,15 +18,15 @@
set context [list [list [export_vars -base student-list { task_id }] "Students List"] $page_title]
-if { [ad_form_new_p -key evaluation_id] } {
+if { [ad_form_new_p -key evaluation_id] || [string eq $evaluation_mode "display"] } {
set comment_label "Comments"
} else {
set comment_label "Edit Reason"
}
db_1row get_evaluation_info { *SQL* }
-ad_form -name evaluation -cancel_url $return_url -export { task_id item_id party_id } -form {
+ad_form -name evaluation -cancel_url $return_url -export { task_id item_id party_id } -mode $evaluation_mode -form {
evaluation_id:key
@@ -78,6 +79,9 @@
}
+ # send the notification to everyone suscribed
+ evaluation::notification::do_notification -task_id $task_id -evaluation_id $revision_id -package_id [ad_conn package_id] -notif_type one_evaluation_notif
+
ad_returnredirect "$return_url"
ad_script_abort
}
Index: openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 12 May 2004 02:07:45 -0000 1.2
+++ openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 19 May 2004 17:33:09 -0000 1.3
@@ -29,6 +29,7 @@
}
set done_students [list]
+set evaluation_mode "display"
#
# working with already evaluated parties
@@ -40,38 +41,38 @@
-name evaluated_students \
-multirow evaluated_students \
-actions $actions \
- -key task_id \
- -pass_properties { return_url task_id } \
- -filters { task_id {} } \
+ -key task_id \
+ -pass_properties { return_url task_id evaluation_mode } \
+ -filters { task_id {} } \
-elements {
party_name {
label "Name"
- orderby_asc {party_name asc}
- orderby_desc {party_name desc}
- link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id return_url task_id }]}
+ orderby_asc {party_name asc}
+ orderby_desc {party_name desc}
+ link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id task_id evaluation_mode }]}
link_html { title "View evaluation" }
}
grade {
label "Maximun Grade: 100"
- orderby_asc {grade asc}
- orderby_desc {grade desc}
+ orderby_asc {grade asc}
+ orderby_desc {grade desc}
}
actions {
label ""
- link_url_col actions_url
+ link_url_col actions_url
}
pretty_submission_date {
label "Sumission Date"
- orderby_asc {pretty_submission_date asc}
- orderby_desc {pretty_submission_date desc}
+ orderby_asc {pretty_submission_date asc}
+ orderby_desc {pretty_submission_date desc}
}
view {
label {}
sub_class narrow
display_template {
}
- link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id return_url task_id }]}
+ link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id task_id evaluation_mode }]}
link_html { title "View evaluation" }
}
edit {
@@ -80,7 +81,7 @@
display_template {
}
- link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id return_url task_id }]}
+ link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id task_id }]}
link_html { title "Edit evaluation" }
}
delete {
@@ -101,36 +102,36 @@
}
db_multirow -extend { actions action_url } evaluated_students evaluated_students { *SQL* } {
-
- lappend done_students $party_id
- set grade [format %.2f $grade]
- if { [string eq $online_p "t"] } {
- # working with answer stuff (if it has a file/url attached)
- if { [empty_string_p $answer_data] } {
- set action "No response"
- } elseif { [regexp "http://" $answer_data] } {
- set action_url "[export_vars -base "$answer_data" { }]"
- set action "View answer"
- } else {
- # we assume it's a file
- set action_url "[export_vars -base "../../view/$answer_title" { revision_id }]"
- set action "View answer"
- }
- if { [string eq $action "View answer"] && ([template::util::date::compare $submission_date $evaluation_date] > 0) } {
- set action "View NEW answer"
- }
- if { [template::util::date::compare $submission_date $due_date] > 0 } {
- set pretty_submission_date "$pretty_submission_date (late)"
- }
+
+ lappend done_students $party_id
+ set grade [format %.2f $grade]
+ if { [string eq $online_p "t"] } {
+ # working with answer stuff (if it has a file/url attached)
+ if { [empty_string_p $answer_data] } {
+ set action "No response"
+ } elseif { [regexp "http://" $answer_data] } {
+ set action_url "[export_vars -base "$answer_data" { }]"
+ set action "View answer"
+ } else {
+ # we assume it's a file
+ set action_url "[export_vars -base "../../view/$answer_title" { revision_id }]"
+ set action "View answer"
}
+ if { [string eq $action "View answer"] && ([template::util::date::compare $submission_date $evaluation_date] > 0) } {
+ set action "View NEW answer"
+ }
+ if { [template::util::date::compare $submission_date $due_date] > 0 } {
+ set pretty_submission_date "$pretty_submission_date (late)"
+ }
+ }
}
set total_evaluated [db_string count_evaluated_students { *SQL* }]
if { [llength $done_students] > 0 } {
- set processed_clause [db_map processed_clause]
+ set processed_clause [db_map processed_clause]
} else {
- set processed_clause ""
+ set processed_clause ""
}
set not_evaluated_with_answer [db_string get_not_eval_wa { *SQL* }]
@@ -140,33 +141,33 @@
#
set elements [list party_name \
- [list label "Name" \
- orderby_asc {party_name asc} \
- orderby_desc {party_name desc}] \
- answer \
- [list label "Answer" \
- link_url_col answer_url \
- link_html { title "View answer" }] \
- grade \
- [list label "Maximun Grade: " \
- display_template { } ] \
- comments \
- [list label "Comments" \
- display_template { } \
- ] \
- show_answer \
- [list label "Allow the students
to see the grade?" \
- display_template { Yes No } \
- ] \
- ]
+ [list label "Name" \
+ orderby_asc {party_name asc} \
+ orderby_desc {party_name desc}] \
+ answer \
+ [list label "Answer" \
+ link_url_col answer_url \
+ link_html { title "View answer" }] \
+ grade \
+ [list label "Maximun Grade: " \
+ display_template { } ] \
+ comments \
+ [list label "Comments" \
+ display_template { } \
+ ] \
+ show_answer \
+ [list label "Allow the students
to see the grade?" \
+ display_template { Yes No } \
+ ] \
+ ]
template::list::create \
-name not_evaluated_wa \
-multirow not_evaluated_wa \
- -key party_id \
- -pass_properties { task_id return_url } \
- -filters { task_id {} } \
- -orderby_name orderby_wa \
+ -key party_id \
+ -pass_properties { task_id return_url } \
+ -filters { task_id {} } \
+ -orderby_name orderby_wa \
-elements $elements
@@ -177,51 +178,51 @@
}
db_multirow -extend { answer answer_url } not_evaluated_wa get_not_evaluated_wa_students { *SQL* } {
-
- lappend done_students $party_id
- if { [string eq $online_p "t"] } {
- set answer "View answer"
- # working with answer stuff (if it has a file/url attached)
- if { [regexp "http://" $answer_data] } {
- set answer_url [export_vars -base "$answer_data" { }]
- } else {
- # we assume it's a file
- set answer_url [export_vars -base "../../view/$answer_title" { revision_id }]
- }
- if { [template::util::date::compare $submission_date $due_date] > 0 } {
- set pretty_submission_date "$pretty_submission_date (late answer)"
- }
- }
+
+ lappend done_students $party_id
+ if { [string eq $online_p "t"] } {
+ set answer "View answer"
+ # working with answer stuff (if it has a file/url attached)
+ if { [regexp "http://" $answer_data] } {
+ set answer_url [export_vars -base "$answer_data" { }]
+ } else {
+ # we assume it's a file
+ set answer_url [export_vars -base "../../view/$answer_title" { revision_id }]
+ }
+ if { [template::util::date::compare $submission_date $due_date] > 0 } {
+ set pretty_submission_date "$pretty_submission_date (late answer)"
+ }
+ }
}
#
# working with students that have not answered and have not been yet evaluated and do not have submited their answers
#
set elements [list party_name \
- [list label "Name" \
- orderby_asc {party_name asc} \
- orderby_desc {party_name desc}] \
- grade \
- [list label "Grade over " \
- display_template { } ] \
- comments \
- [list label "Comments" \
- display_template { } \
- ] \
- show_answer \
- [list label "Allow the students
to see the grade?" \
- display_template { Yes No } \
- ] \
- ]
+ [list label "Name" \
+ orderby_asc {party_name asc} \
+ orderby_desc {party_name desc}] \
+ grade \
+ [list label "Grade over " \
+ display_template { } ] \
+ comments \
+ [list label "Comments" \
+ display_template { } \
+ ] \
+ show_answer \
+ [list label "Allow the students
to see the grade?" \
+ display_template { Yes No } \
+ ] \
+ ]
template::list::create \
-name not_evaluated_na \
-multirow not_evaluated_na \
- -key party_id \
- -pass_properties { task_id return_url } \
- -filters { task_id {} } \
- -orderby_name orderby_na \
+ -key party_id \
+ -pass_properties { task_id return_url } \
+ -filters { task_id {} } \
+ -orderby_name orderby_na \
-elements $elements
set orderby_na [template::list::orderby_clause -orderby -name not_evaluated_na]
@@ -231,26 +232,26 @@
}
if { $number_of_members > 1 } {
- if { [llength $done_students] > 0 } {
- set not_evaluated_with_no_answer [db_string get_not_evaluated_na { *SQL* }]
- set not_in_clause [db_map not_in_clause]
- } else {
- set not_in_clause ""
- }
- set not_evaluated_with_no_answer [db_string count_not_eval_na { *SQL* }]
- set sql_query [db_map sql_query_one]
+ if { [llength $done_students] > 0 } {
+ set not_evaluated_with_no_answer [db_string get_not_evaluated_na { *SQL* }]
+ set not_in_clause [db_map not_in_clause]
+ } else {
+ set not_in_clause ""
+ }
+ set not_evaluated_with_no_answer [db_string count_not_eval_na { *SQL* }]
+ set sql_query [db_map sql_query_one]
} else {
- if { [llength $done_students] > 0 } {
- set not_in_clause [db_map not_yet_in_clause]
- } else {
- set not_in_clause ""
- }
- set not_evaluated_with_no_answer [db_string get_not_evaluated_left { *SQL* }]
- set sql_query [db_map sql_query_two]
+ if { [llength $done_students] > 0 } {
+ set not_in_clause [db_map not_yet_in_clause]
+ } else {
+ set not_in_clause ""
+ }
+ set not_evaluated_with_no_answer [db_string get_not_evaluated_left { *SQL* }]
+ set sql_query [db_map sql_query_two]
}
db_multirow not_evaluated_na get_not_evaluated_na_students { *SQL* } {
-
+
}
set grades_sheet_item_id [db_nextval acs_object_id_seq]
Index: openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 28 Apr 2004 11:09:54 -0000 1.1
+++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 19 May 2004 17:33:09 -0000 1.2
@@ -7,17 +7,17 @@
@creation-date Mar 2004
@cvs-id $Id$
} {
- task_id:integer,notnull
- solution_id:integer,notnull,optional
- item_id:integer,notnull,optional
+ task_id:integer,notnull
+ solution_id:integer,notnull,optional
+ item_id:integer,notnull,optional
upload_file:trim,optional
upload_file.tmpfile:tmpfile,optional
- {solution_mode "edit"}
- grade_id:integer,notnull
+ {solution_mode "edit"}
+ grade_id:integer,notnull
+ {return_url "/"}
}
set package_id [ad_conn package_id]
-set return_url "../../task-list?[export_vars { grade_id }]"
if { [ad_form_new_p -key solution_id] } {
set page_title "Add Task Solution"
@@ -217,7 +217,7 @@
}
}
- ad_returnredirect "[export_vars -base "../../task-list" { grade_id }]"
+ ad_returnredirect "$return_url"
ad_script_abort
}
Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 14 May 2004 23:38:43 -0000 1.2
+++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 19 May 2004 17:33:09 -0000 1.3
@@ -233,67 +233,73 @@
{ ([string eq $unattach_p "t"] && [empty_string_p $upload_file] && [string eq $url "http://"]) || [empty_string_p $unattach_p] }
{First unattach the file/url, then submit another one or just upload a new file/url and leave this in blank}
}
+} -new_data {
+
+ evaluation::notification::do_notification -task_id $revision_id -package_id [ad_conn package_id] -edit_p 0 -notif_type one_assignment_notif
+
+} -edit_data {
+
+ evaluation::notification::do_notification -task_id $revision_id -package_id [ad_conn package_id] -edit_p 1 -notif_type one_assignment_notif
+
} -on_submit {
+
+ db_transaction {
- db_transaction {
+ set mime_type "text/plain"
+ set title ""
+ set storage_type text
+
+ if { ![empty_string_p $upload_file] } {
+
+ # Get the filename part of the upload file
+ if { ![regexp {[^//\\]+$} $upload_file filename] } {
+ # no match
+ set filename $upload_file
+ }
+
+ set title [template::util::file::get_property filename $upload_file]
+ set mime_type [cr_filename_to_mime_type -create $title]
+
+ set storage_type lob
+ }
+
+ set due_date [db_string set_date { *SQL* }]
+
+ if { [ad_form_new_p -key task_id] } {
+ set item_id $task_id
+ }
+
+ set revision_id [evaluation::new_task -new_item_p [ad_form_new_p -key grade_id] -item_id $item_id -content_type evaluation_tasks \
+ -content_table evaluation_tasks -content_id task_id -name $task_name -description $description -weight $weight \
+ -grade_id $grade_id -number_of_members $number_of_members -online_p $online_p -storage_type $storage_type \
+ -due_date $due_date -late_submit_p $late_submit_p -requires_grade_p $requires_grade_p -title $title \
+ -mime_type $mime_type]
+
+ evaluation::set_live -revision_id $revision_id
+
+ if { ![empty_string_p $upload_file] } {
+
+ set tmp_file [template::util::file::get_property tmp_filename $upload_file]
+
+ # create the new item
+ db_dml lob_content { *SQL* } -blob_files [list $tmp_file]
+
+ set content_length [file size $tmp_file]
+ # Unfortunately, we can only calculate the file size after the lob is uploaded
+ db_dml lob_size { *SQL* }
+
+ } elseif { ![string eq $url "http://"] } {
+
+ db_dml link_content { *SQL* }
+
+ } elseif { [string eq $attached_p "t"] && ![string eq $unattach_p "t"] } {
+ # just copy the old content to the new revision
+ db_exec_plsql copy_content { *SQL* }
+ }
+ }
+} -after_submit {
+ ad_returnredirect "$return_url"
+ ad_script_abort
+}
- set mime_type "text/plain"
- set title ""
- set storage_type text
-
- if { ![empty_string_p $upload_file] } {
-
- # Get the filename part of the upload file
- if { ![regexp {[^//\\]+$} $upload_file filename] } {
- # no match
- set filename $upload_file
- }
-
- set title [template::util::file::get_property filename $upload_file]
- set mime_type [cr_filename_to_mime_type -create $title]
-
- set storage_type lob
- }
-
- set due_date [db_string set_date { *SQL* }]
-
- if { [ad_form_new_p -key task_id] } {
- set item_id $task_id
- }
-
- set revision_id [evaluation::new_task -new_item_p [ad_form_new_p -key grade_id] -item_id $item_id -content_type evaluation_tasks \
- -content_table evaluation_tasks -content_id task_id -name $task_name -description $description -weight $weight \
- -grade_id $grade_id -number_of_members $number_of_members -online_p $online_p -storage_type $storage_type \
- -due_date $due_date -late_submit_p $late_submit_p -requires_grade_p $requires_grade_p -title $title \
- -mime_type $mime_type]
-
- evaluation::set_live -revision_id $revision_id
-
- if { ![empty_string_p $upload_file] } {
-
- set tmp_file [template::util::file::get_property tmp_filename $upload_file]
-
- # create the new item
- db_dml lob_content { *SQL* } -blob_files [list $tmp_file]
-
- set content_length [file size $tmp_file]
- # Unfortunately, we can only calculate the file size after the lob is uploaded
- db_dml lob_size { *SQL* }
-
- } elseif { ![string eq $url "http://"] } {
-
- db_dml link_content { *SQL* }
-
- } elseif { [string eq $attached_p "t"] && ![string eq $unattach_p "t"] } {
- ns_log Notice "si pues.... \n"
- # just copy the old content to the new revision
- db_exec_plsql copy_content { *SQL* }
- }
- }
-
- evaluation::notification::do_notification -task_id $revision_id -package_id [ad_conn package_id]
- ad_returnredirect "$return_url"
- ad_script_abort
-}
-
ad_return_template