Index: openacs-4/packages/evaluation/evaluation.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/evaluation.info,v diff -u -r1.22.2.1 -r1.22.2.2 --- openacs-4/packages/evaluation/evaluation.info 31 May 2005 23:13:09 -0000 1.22.2.1 +++ openacs-4/packages/evaluation/evaluation.info 8 Jun 2005 18:55:28 -0000 1.22.2.2 @@ -7,22 +7,23 @@ f f - + + Jose Pablo Escobedo Del Cid This package allows the users (professors and students) to use the system to submit and grade the tasks. - 2005-05-24 - + 2005-05-23 + This package allows the professors and TAs to assign tasks to the students and to grade them, and to the students to upload their answers and see their grades. - - - - - + + + + + Index: openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml,v diff -u -r1.17.2.1 -r1.17.2.2 --- openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml 31 May 2005 23:13:09 -0000 1.17.2.1 +++ openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml 8 Jun 2005 18:57:14 -0000 1.17.2.2 @@ -1,6 +1,7 @@ - + + 1 = Individual Activities Activities for students @@ -369,13 +370,14 @@ The comments/edit reason is a string with no more than 4,000 characters. The edit reason must be less than 4000 characteras long The estimated time must be grather than 0 + The file extension of the file is "%file_extension" and it should be .CSV. Sorry, we can't process it" } } } set page_title "<#_ Confirm Evaluation - The file extension of the file is \"$file_extension\" and it should be .CSV, we can't process it + The file extension of the file is "%file_extension%" and it should be .CSV, we can't process it The file is too large. (The maximun file size is %pretty_maxnbytes% bytes)" return 0 } @@ -520,6 +522,7 @@ You can see the csv files associated with the task by clicking on the "See grades sheets associated with this task" botton. You can upload a file associated to this task by using the browse button (optional) You can upload a file associated to this task by using the browse button and select the file from your computer (optional) + You can't leave the due date empty if the students have to submit their answers online. due es ($due_date y online es $online_p ) You must give an edit reason (%old_grade% --> %grade_wo_reason% Your total grade in this class is: Max Grade: Index: openacs-4/packages/evaluation/catalog/evaluation.es_GT.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/catalog/evaluation.es_GT.ISO-8859-1.xml,v diff -u -r1.5 -r1.5.4.1 --- openacs-4/packages/evaluation/catalog/evaluation.es_GT.ISO-8859-1.xml 8 Oct 2004 23:32:06 -0000 1.5 +++ openacs-4/packages/evaluation/catalog/evaluation.es_GT.ISO-8859-1.xml 8 Jun 2005 18:57:14 -0000 1.5.4.1 @@ -113,7 +113,7 @@ Ultima Modificaci�n tarde (tarde) - Una nueva asignaci�n se ha subido -%community_name%-. + Una nueva asignaci�n se ha subido -%community_name%-. �podr�n ver sus notas? Agregar miembro al grupo @@ -281,6 +281,7 @@ La raz�n de comentarios/edici�n es una cadena de caracteres de no mas de 4,000 caracteres. La raz�n de edici�n debe de ser menor a los 4,000 caracteres de largo + El tiempo estimado debe ser mayor o igual a 0 La extensi�n del archivo es "%file_extension" y deber�a ser .CSV. Lo siento, pero no podemos procesarlo" } } } set page_title "<#_ Confirm Evaluation La extensi�n del archivo \"$file_extension\" debe de ser .CSV, lo sentimos, no podemos procesarlo El archivo es muy grande. (El tama�o m�ximo es de %pretty_maxnbytes% bytes) @@ -367,6 +368,7 @@ <blockquote> <pre>%errmsg%</pre> </blockquote> + Tiempo estimado para terminar este(a) %grade_name% (en horas) Si desea agregar asignaciones en varias clases o secciones seleccione la opci�n que se encuentra Para cambiar el nombre, edite el nombre en la entrada del texto y luego haga click en el bot�n "Renombrar Grupo". @@ -481,7 +483,7 @@ Proyectos Eliminar Nota Renombrar Grupo - Hacer "sin punteo" + �Tendr� nota esta tarea? Bloquear Grupos Enviar Archivo Adjunto de la Soluci�n 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.22.2.1 -r1.22.2.2 --- openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 31 May 2005 23:13:10 -0000 1.22.2.1 +++ openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 8 Jun 2005 18:57:14 -0000 1.22.2.2 @@ -12,10 +12,10 @@ } namespace eval evaluation {} -namespace eval evaluation::apm_callback {} +namespace eval evaluation::apm {} -ad_proc -public evaluation::apm_callback::package_install { +ad_proc -public evaluation::apm::package_install { } { Does the integration whith the notifications package. @@ -109,9 +109,63 @@ } } -ad_proc -public evaluation::apm_callback::package_uninstall { +ad_proc -public evaluation::apm::package_before_upgrade { + -from_version_name:required + -to_version_name:required } { + Upgrade script for the evaluation package +} { + apm_upgrade_logic \ + -from_version_name $from_version_name \ + -to_version_name $to_version_name \ + -spec { + 0.4d 2.0d { + #Create content type attributes for content type evaluation_grades + content::type::attribute::new -content_type evaluation_grades -attribute_name grade_item_id -datatype number -pretty_name grade_item_id -column_spec integer + content::type::attribute::new -content_type evaluation_grades -attribute_name grade_name -datatype string -pretty_name grade_name -column_spec "varchar(100)" + content::type::attribute::new -content_type evaluation_grades -attribute_name grade_plural_name -datatype string -pretty_name grade_plural_name -column_spec "varchar(100)" + content::type::attribute::new -content_type evaluation_grades -attribute_name comments -datatype string -pretty_name Comments -column_spec "varchar(500)" + content::type::attribute::new -content_type evaluation_grades -attribute_name weight -datatype number -pretty_name Weight -column_spec numeric + + #Create content type attributes for content type evaluation_tasks + content::type::attribute::new -content_type evaluation_tasks -attribute_name task_item_id -datatype number -pretty_name task_item_id -column_spec integer + content::type::attribute::new -content_type evaluation_tasks -attribute_name task_name -datatype number -pretty_name task_name -column_spec integer + content::type::attribute::new -content_type evaluation_tasks -attribute_name number_of_members -datatype string -pretty_name number_of_members -column_spec varchar + content::type::attribute::new -content_type evaluation_tasks -attribute_name due_date -datatype timestamp -pretty_name due_date -column_spec timestamptz + content::type::attribute::new -content_type evaluation_tasks -attribute_name grade_item_id -datatype number -pretty_name grade_item_id -column_spec integer + content::type::attribute::new -content_type evaluation_tasks -attribute_name weight -datatype number -pretty_name weight -column_spec numeric + content::type::attribute::new -content_type evaluation_tasks -attribute_name online_p -datatype string -pretty_name online_p -column_spec "varchar(1)" + content::type::attribute::new -content_type evaluation_tasks -attribute_name late_submit_p -datatype string -pretty_name late_submit_p -column_spec "varchar(1)" + content::type::attribute::new -content_type evaluation_tasks -attribute_name requires_grade_p -datatype string -pretty_name requires_grade_p -column_spec "varchar(1)" + + #Create content type attributes for content type evaluation_tasks_sols + content::type::attribute::new -content_type evaluation_tasks_sols -attribute_name solution_item_id -datatype number -pretty_name solution_item_id -column_spec integer + content::type::attribute::new -content_type evaluation_tasks_sols -attribute_name task_item_id -datatype number -pretty_name task_item_id -column_spec integer + + #Create content type attributes for content type evaluation_answers + content::type::attribute::new -content_type evaluation_answers -attribute_name answer_item_id -datatype number -pretty_name answer_item_id -column_spec integer + content::type::attribute::new -content_type evaluation_answers -attribute_name party_id -datatype number -pretty_name party_id -column_spec integer + content::type::attribute::new -content_type evaluation_answers -attribute_name task_item_id -datatype number -pretty_name task_item_id -column_spec integer + + #Create content type attributes for content type evaluation_student_evals + content::type::attribute::new -content_type evaluation_student_evals -attribute_name evaluation_item_id -datatype number -pretty_name evaluation_item_id -column_spec integer + content::type::attribute::new -content_type evaluation_student_evals -attribute_name task_item_id -datatype number -pretty_name task_item_id -column_spec integer + content::type::attribute::new -content_type evaluation_student_evals -attribute_name party_id -datatype number -pretty_name party_id -column_spec integer + content::type::attribute::new -content_type evaluation_student_evals -attribute_name grade -datatype number -pretty_name grade -column_spec numeric + content::type::attribute::new -content_type evaluation_student_evals -attribute_name show_student_p -datatype string -pretty_name show_student_p -column_spec "varchar(1)" + + #Create content type attributes for content type evaluation_grades_sheets + content::type::attribute::new -content_type evaluation_grades_sheets -attribute_name grades_sheet_item_id -datatype number -pretty_name grades_sheet_item_id -column_spec integer + content::type::attribute::new -content_type evaluation_grades_sheets -attribute_name task_item_id -datatype number -pretty_name task_item_id -column_spec integer + + } + } +} + +ad_proc -public evaluation::apm::package_uninstall { +} { + Cleans the integration whith the notifications package. } { @@ -176,7 +230,7 @@ } } -ad_proc -public evaluation::apm_callback::package_instantiate { +ad_proc -public evaluation::apm::package_instantiate { -package_id:required } { @@ -230,7 +284,7 @@ } -ad_proc -public evaluation::apm_callback::package_uninstantiate { +ad_proc -public evaluation::apm::package_uninstantiate { -package_id:required } { @@ -285,7 +339,6 @@ content::folder::unregister_content_type -folder_id $folder_id -content_type evaluation_tasks_sols -include_subtypes t db_dml delete_task_sols_folder_map "delete from cr_folder_type_map where content_type = 'evaluation_tasks_sols'" content::folder::delete -folder_id $folder_id - ns_log notice "checkpoint 1" #evaluation_answers set folder_id [content::item::get_id -item_path "evaluation_answers_$package_id" -resolve_index f] @@ -299,7 +352,6 @@ content::folder::unregister_content_type -folder_id $folder_id -content_type evaluation_answers -include_subtypes t db_dml delete_answer_folder_map "delete from cr_folder_type_map where content_type = 'evaluation_answers'" content::folder::delete -folder_id $folder_id - ns_log notice "checkpoint 2" #evaluation_students_eval set folder_id [content::item::get_id -item_path "evaluation_student_evals_$package_id" -resolve_index f] @@ -312,8 +364,6 @@ } { evaluation::delete_student_eval -evaluation_id $evaluation_id } - ns_log notice "checkpoint 3" - content::folder::unregister_content_type -folder_id $folder_id -content_type content_revision -include_subtypes t content::folder::unregister_content_type -folder_id $folder_id -content_type evaluation_student_evals -include_subtypes t @@ -332,7 +382,6 @@ #evaluation_grades_sheets set folder_id [content::item::get_id -item_path "evaluation_grades_sheets_$package_id" -resolve_index f] - ns_log notice "checkpoint 4" db_foreach grade_sheet_item { select item_id from cr_items where parent_id = :folder_id @@ -342,7 +391,6 @@ content::folder::unregister_content_type -folder_id $folder_id -content_type content_revision -include_subtypes t content::folder::unregister_content_type -folder_id $folder_id -content_type evaluation_grades_sheets -include_subtypes t - ns_log notice "checkpoint 5" db_dml delete_grade_sheet_folder_map "delete from cr_folder_type_map where content_type = 'evaluation_grades_sheets'" content::folder::delete -folder_id $folder_id @@ -365,7 +413,6 @@ evaluation::delete_task -task_id $item_id } - ns_log notice "checkpoint 6" content::folder::unregister_content_type -folder_id $folder_id -content_type content_revision -include_subtypes t content::folder::unregister_content_type -folder_id $folder_id -content_type evaluation_tasks -include_subtypes t @@ -418,7 +465,7 @@ } } -ad_proc -public evaluation::apm_callback::after_upgrade { +ad_proc -public evaluation::apm::after_upgrade { {-from_version_name:required} {-to_version_name:required} } { 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.31.2.1 -r1.31.2.2 --- openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 31 May 2005 23:13:10 -0000 1.31.2.1 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 8 Jun 2005 18:57:14 -0000 1.31.2.2 @@ -8,7 +8,7 @@ namespace eval evaluation {} namespace eval evaluation::notification {} -namespace eval evaluation::apm_callback {} +namespace eval evaluation::apm {} ##### # @@ -92,51 +92,59 @@ db_1row get_grade_id { select grade_item_id from evaluation_grades where grade_id = :grade_id } db_foreach del_rec { select task_item_id from evaluation_tasks where grade_item_id = :grade_item_id } { db_foreach evaluation_delete_student_eval { select evaluation_id from evaluation_student_evals where task_item_id = :task_item_id } { - content::revision::delete -revision_id $evaluation_id + evaluation::revision_delete -revision_id $evaluation_id } db_foreach evaluation_delete_answer { select answer_id from evaluation_answers where task_item_id = :task_item_id } { - content::revision::delete -revision_id $answer_id + evaluation::revision_delete -revision_id $answer_id } db_foreach evaluation_delete_task_sol { select solution_id from evaluation_tasks_sols where task_item_id = :task_item_id } { - content::revision::delete -revision_id $solution_id + evaluation::revision_delete -revision_id $solution_id } db_foreach evaluation_delete_grades_sheet { select grades_sheet_id from evaluation_grades_sheets where task_item_id = :task_item_id } { - content::revision::delete -revision_id $grades_sheet_id + evaluation::revision_delete -revision_id $grades_sheet_id } db_foreach evaluation_delete_task { select task_id from evaluation_tasks where task_item_id = :task_item_id } { - content::revision::delete -revision_id $task_id } + evaluation::revision_delete -revision_id $task_id } } # db_1row get_grade_id { select grade_id as grade_task_id from evaluation_grades where grade_item_id = :grade_item_id} - content::revision::delete -revision_id $grade_id + evaluation::revision_delete -revision_id $grade_id } +ad_proc -public evaluation::revision_delete { + -revision_id:required +} { + wrapper for the content::revision::delete +} { + content::item::unset_live_revision -item_id [db_string get_revision_item_id {select item_id from cr_revisions where revision_id = :revision_id}] +} + ad_proc -public evaluation::delete_task { -task_id:required } { delete all tasks } { db_1row get_task_id { select task_item_id from evaluation_tasks where task_id = :task_id } db_foreach evaluation_delete_student_eval { select evaluation_id from evaluation_student_evals where task_item_id = :task_item_id } { - content::revision::delete -revision_id $evaluation_id + evaluation::revision_delete -revision_id $evaluation_id } db_foreach evaluation_delete_answer { select answer_id from evaluation_answers where task_item_id = :task_item_id } { - content::revision::delete -revision_id $answer_id + evaluation::revision_delete -revision_id $answer_id } db_foreach evaluation_delete_task_sol { select solution_id from evaluation_tasks_sols where task_item_id = :task_item_id } { - content::revision::delete -revision_id $solution_id + evaluation::revision_delete -revision_id $solution_id } db_foreach evaluation_delete_grades_sheet { select grades_sheet_id from evaluation_grades_sheets where task_item_id = :task_item_id } { - content::revision::delete -revision_id $grades_sheet_id + evaluation::revision_delete -revision_id $grades_sheet_id } - content::revision::delete -revision_id $task_id + evaluation::revision_delete -revision_id $task_id } ad_proc -public evaluation::delete_student_eval { -evaluation_id:required } { delete all tasks } { - content::revision::delete -revision_id $evaluation_id + evaluation::revision_delete -revision_id $evaluation_id } ad_proc -public evaluation::notification::do_notification { @@ -231,7 +239,7 @@ set revision_id [db_nextval acs_object_id_seq] set revision_name "${content_type}_${revision_id}" set folder_id [content::item::get_id -item_path "${content_type}_${package_id}" -resolve_index f] - if { $new_item_p } { + if { $new_item_p && ![db_string double_click { *SQL* }] } { set item_id [content::item::new -item_id $item_id -parent_id $folder_id -content_type $content_type -name $item_name -context_id $package_id -creation_date $creation_date] } set revision_id [content::revision::new \ @@ -397,7 +405,7 @@ set item_name "${item_id}_${title}" } - if { $new_item_p } { + if { $new_item_p && ![db_string double_click { *SQL* }] } { set item_id [content::item::new -item_id $item_id \ -parent_id $folder_id \ @@ -482,7 +490,7 @@ set creation_date [db_string get_date { *SQL* }] } - if { $new_item_p } { + if { $new_item_p && ![db_string double_click { *SQL* }] } { set item_id [content::item::new -item_id $item_id \ -parent_id $folder_id \ -content_type $content_type \ @@ -564,7 +572,7 @@ if { [empty_string_p $creation_date] } { set creation_date [db_string get_date { *SQL* }] } - if { $new_item_p } { + if { $new_item_p && ![db_string double_click { *SQL* }] } { set item_id [content::item::new \ -item_id $item_id \ -parent_id $folder_id \ @@ -652,7 +660,7 @@ set creation_date [db_string get_date { *SQL* }] } - if { $new_item_p } { + if { $new_item_p && ![db_string double_click { *SQL* }] } { set item_id [content::item::new -item_id $item_id \ -parent_id $folder_id \ -content_type $content_type \ @@ -798,7 +806,7 @@ set creation_date [db_string get_date { *SQL* }] } - if { $new_item_p } { + if { $new_item_p && ![db_string double_click { *SQL* }] } { set item_id [content::item::new -item_id $item_id \ -parent_id $folder_id \ -content_type $content_type \ @@ -883,23 +891,23 @@ $csv_formatted_content" } -ad_proc -public evaluation::apm_callback::delete_one_assignment_impl {} { +ad_proc -public 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 -public evaluation::apm_callback::delete_one_evaluation_impl {} { +ad_proc -public 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 -public evaluation::apm_callback::create_one_assignment_impl {} { +ad_proc -public evaluation::apm::create_one_assignment_impl {} { Register the service contract implementation and return the impl_id @return impl_id of the created implementation } { @@ -914,7 +922,7 @@ }] } -ad_proc -public evaluation::apm_callback::create_one_evaluation_impl {} { +ad_proc -public evaluation::apm::create_one_evaluation_impl {} { Register the service contract implementation and return the impl_id @return impl_id of the created implementation } { @@ -929,7 +937,7 @@ }] } -ad_proc -public evaluation::apm_callback::create_one_assignment_type { +ad_proc -public evaluation::apm::create_one_assignment_type { -impl_id:required } { Create the notification type for one specific assignment @@ -942,7 +950,7 @@ -description "[_ evaluation.lt_Notification_for_assi]"] } -ad_proc -public evaluation::apm_callback::create_one_evaluation_type { +ad_proc -public evaluation::apm::create_one_evaluation_type { -impl_id:required } { Create the notification type for one specific evaluation @@ -955,7 +963,7 @@ -description "[_ evaluation.lt_Notification_for_eval]"] } -ad_proc -public evaluation::apm_callback::enable_intervals_and_methods { +ad_proc -public evaluation::apm::enable_intervals_and_methods { -type_id:required } { Enable the intervals and delivery methods of a specific type Index: openacs-4/packages/evaluation/tcl/evaluation-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs.xql,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/evaluation/tcl/evaluation-procs.xql 31 May 2005 23:13:10 -0000 1.3.2.1 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.xql 8 Jun 2005 18:57:14 -0000 1.3.2.2 @@ -2,6 +2,14 @@ + + + + select count(*) from cr_items where item_id = :item_id + + + + @@ -25,6 +33,22 @@ + + + + select count(*) from cr_items where item_id = :item_id + + + + + + + + select count(*) from cr_items where item_id = :item_id + + + + @@ -36,6 +60,14 @@ + + + + select count(*) from cr_items where item_id = :item_id + + + + @@ -77,6 +109,22 @@ + + + + select count(*) from cr_items where item_id = :item_id + + + + + + + + select count(*) from cr_items where item_id = :item_id + + + + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/evaluation/www/admin/version-select.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/evaluation/www/admin/version-select.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/evaluation/www/admin/grades/grades.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades.tcl,v diff -u -r1.14.2.1 -r1.14.2.2 --- openacs-4/packages/evaluation/www/admin/grades/grades.tcl 31 May 2005 23:13:11 -0000 1.14.2.1 +++ openacs-4/packages/evaluation/www/admin/grades/grades.tcl 8 Jun 2005 18:57:14 -0000 1.14.2.2 @@ -7,8 +7,6 @@ @author jopez@galileo.edu @creation-date Feb 2004 @cvs-id $Id$ - - } -query { {orderby:optional} } @@ -112,6 +110,7 @@ set total_weight [lc_numeric %.2f $total_weight] + if { ($total_weight < 100 && $total_weight > 0) || $total_weight > 100} { set notice "[_ evaluation.lt_The_sum_of_the_weight]" } else { 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.15.2.1 -r1.15.2.2 --- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 31 May 2005 23:13:12 -0000 1.15.2.1 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 8 Jun 2005 18:57:14 -0000 1.15.2.2 @@ -5,6 +5,7 @@ @author jopez@galileo.edu @creation-date Mar 2004 + @cvs-id $Id$ } { task_id:integer,notnull @@ -171,7 +172,7 @@ db_transaction { if { [string eq $unattach_p "t"] } { - content::revision::delete -revision_id $solution_id + evaluation::revision_delete -revision_id $solution_id } else { # set storage_type to its default value according to a db constraint set storage_type "lob" 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.25.2.1 -r1.25.2.2 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 31 May 2005 23:13:12 -0000 1.25.2.1 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 8 Jun 2005 18:57:14 -0000 1.25.2.2 @@ -104,7 +104,6 @@ } } elseif { [string eq $title "link"] } { - ns_log notice "si va bien!, content trae -${content}- " if { [string eq $mode "edit"] } { set attached_p "t" @@ -221,7 +220,7 @@ } else { ad_form -extend -name task -form { {number_of_members:naturalnum - {label "[_ evaluation.Number_of_Members_]"} + {label "[_ evaluation.Number_of_Members_]"} {value "1"} {html {size 5 onChange TaskInGroups()}} {help_text "[_ evaluation.1__Individual_]"} @@ -236,7 +235,7 @@ } {net_value:float,optional - {label "[_ evaluation.Net_Value_]"} + {label "[_ evaluation.Net_Value_]"} {html {size 5}} {help_text "[_ evaluation.lt_If_you_enter_the_net_]"} {value "0"} @@ -248,7 +247,7 @@ {label "[_ evaluation.perfect_score]"} {html {size 5}} {help_text "[_ evaluation.perfect_score_help]"} - {value 0.00} + {value 100} } {answer_choice:text(radio) {label "[_ evaluation.answer_choice_]"} @@ -274,9 +273,9 @@ ad_form -extend -name task -form { {requires_grade_p:text(radio) - {label "[_ evaluation.lt_Will_this_task_requir]"} - {options {{"[_ evaluation.Yes_]" t} {"[_ evaluation.No_]" f}}} - {value t} + {label "[_ evaluation.lt_Will_this_task_requir]"} + {options {{"[_ evaluation.Yes_]" t} {"[_ evaluation.No_]" f}}} + {value t} } } if { $simple_p } { @@ -298,16 +297,16 @@ if { $more_communities_option } { ad_form -extend -name task -form { - {add_to_more_classes_p:text(checkbox),optional - {label "[_ evaluation.lt_Add_this_assignment_t]"} - {options {{"" "t"}}} - {help_text "[_ evaluation.lt_Check_this_if_you_wan_2]"} - } + {add_to_more_classes_p:text(checkbox),optional + {label "[_ evaluation.lt_Add_this_assignment_t]"} + {options {{"" "t"}}} + {help_text "[_ evaluation.lt_Check_this_if_you_wan_2]"} + } } } ad_form -extend -name task -form { - + } -edit_request { db_1row task_info { *SQL* } @@ -319,58 +318,58 @@ if {[string eq $forums_related_p t]} { set answer_choice "fr" } - + set due_date [template::util::date::from_ansi $due_date_ansi "YYYY-MM-DD HH24:MI:SS"] set weight [format %0.2f $weight] - + set perfect_score $perfect_score - + } -validate { {url - { ([string eq $url "http://"] && ![empty_string_p $upload_file]) || (![string eq $url "http://"] && [empty_string_p $upload_file]) || ([string eq $url "http://"] && [empty_string_p $upload_file]) || (![string eq $url "http://"] && [util_url_valid_p $url]) } - {[_ evaluation.lt_Upload_a_file_OR_a_ur_1] } + { ([string eq $url "http://"] && ![empty_string_p $upload_file]) || (![string eq $url "http://"] && [empty_string_p $upload_file]) || ([string eq $url "http://"] && [empty_string_p $upload_file]) || (![string eq $url "http://"] && [util_url_valid_p $url]) } + {[_ evaluation.lt_Upload_a_file_OR_a_ur_1] } } {upload_file - { ([string eq $url "http://"] && ![empty_string_p $upload_file]) || (![string eq $url "http://"] && [empty_string_p $upload_file]) || ([string eq $url "http://"] && [empty_string_p $upload_file]) } - { [_ evaluation.lt_Upload_a_file_OR_a_ur_1] } + { ([string eq $url "http://"] && ![empty_string_p $upload_file]) || (![string eq $url "http://"] && [empty_string_p $upload_file]) || ([string eq $url "http://"] && [empty_string_p $upload_file]) } + { [_ evaluation.lt_Upload_a_file_OR_a_ur_1] } } {unattach_p - { ([string eq $unattach_p "t"] && [empty_string_p $upload_file] && [string eq $url "http://"]) || [empty_string_p $unattach_p] } - { [_ evaluation.lt_First_unattach_the_fi] } + { ([string eq $unattach_p "t"] && [empty_string_p $upload_file] && [string eq $url "http://"]) || [empty_string_p $unattach_p] } + { [_ evaluation.lt_First_unattach_the_fi] } } {net_value - { !$net_value || ([empty_string_p $net_value] && [string eq $requires_grade_p f]) || (($net_value > 0) && ($net_value <= $grade_weight) && (!$weight || [empty_string_p $weight])) } - { [_ evaluation.lt_The_net_value_must_be] } + { !$net_value || ([empty_string_p $net_value] && [string eq $requires_grade_p f]) || (($net_value > 0) && ($net_value <= $grade_weight) && (!$weight || [empty_string_p $weight])) } + { [_ evaluation.lt_The_net_value_must_be] } } {weight - { !$weight || ([empty_string_p $weight] && [string eq $requires_grade_p f]) || (($weight > 0) && (!$net_value || [empty_string_p $net_value])) } - { [_ evaluation.lt_The_weight_must_be_gr] } + { !$weight || ([empty_string_p $weight] && [string eq $requires_grade_p f]) || (($weight > 0) && (!$net_value || [empty_string_p $net_value])) } + { [_ evaluation.lt_The_weight_must_be_gr] } } - {number_of_members - { $number_of_members >= 1 } - { [_ evaluation.lt_The_number_of_members]} + {number_of_members + { $number_of_members >= 1 } + { [_ evaluation.lt_The_number_of_members]} } {estimated_time - { $estimated_time >= 0 } - { [_ evaluation.lt_The_estimated_time_mu] } + { $estimated_time >= 0 } + { [_ evaluation.lt_The_estimated_time_mu] } } } -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 { if { [string eq $requires_grade_p t] } { - if { [info exists net_value] && ($net_value > 0) } { - set weight [expr $net_value*100.000/$grade_weight] - } + if { [info exists net_value] && ($net_value > 0) } { + set weight [expr $net_value*100.000/$grade_weight] + } } else { - set weight 0 - set points 0 + set weight 0 + set points 0 } set points [format %0.2f [expr ($weight*$grade_weight)/100.00]] set forums_related_p "f" @@ -384,164 +383,164 @@ set forums_related_p "t" } - + db_transaction { - - # set storage_type to its default value according to a db constraint - set storage_type "lob" + + # set storage_type to its default value according to a db constraint + set storage_type "lob" + + if { ![empty_string_p $upload_file] } { - 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] - - if { ![parameter::get -parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] } { + # 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] + + if { ![parameter::get -parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] } { set storage_type file - } - } elseif { ![string eq $url "http://"] } { + } + } elseif { ![string eq $url "http://"] } { set mime_type "text/plain" - set title "link" - } elseif { [string eq $attached_p "f"] } { - set mime_type "text/plain" + set title "link" + } elseif { [string eq $attached_p "f"] } { + set mime_type "text/plain" set title "" - } - set due_date_p 1 - - set title [evaluation::safe_url_name -name $title] - set cal_due_date [calendar::to_sql_datetime -date $due_date -time $due_date -time_p 1] - set due_date_ansi [db_string set_date " *SQL* "] - - if { [string equal $cal_due_date "-- :"]} { + } + set due_date_p 1 + + set title [evaluation::safe_url_name -name $title] + set cal_due_date [calendar::to_sql_datetime -date $due_date -time $due_date -time_p 1] + set due_date_ansi [db_string set_date " *SQL* "] + + if { [string equal $cal_due_date "-- :"]} { set due_date_p 0 - set due_date "" - } - - - if { [ad_form_new_p -key task_id] } { - set item_id $task_id + set due_date "" + } + + + 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_item_id $grade_item_id \ - -number_of_members $number_of_members \ - -online_p $online_p \ - -storage_type $storage_type \ - -due_date $due_date_ansi \ - -late_submit_p $late_submit_p \ - -requires_grade_p $requires_grade_p \ - -title $title \ - -mime_type $mime_type \ - -estimated_time $estimated_time] + -content_type evaluation_tasks \ + -content_table evaluation_tasks \ + -content_id task_id \ + -name $task_name \ + -description $description \ + -weight $weight \ + -grade_item_id $grade_item_id \ + -number_of_members $number_of_members \ + -online_p $online_p \ + -storage_type $storage_type \ + -due_date $due_date_ansi \ + -late_submit_p $late_submit_p \ + -requires_grade_p $requires_grade_p \ + -title $title \ + -mime_type $mime_type \ + -estimated_time $estimated_time] + + content::item::set_live_revision -revision_id $revision_id + + # by the moment, since I'm having a date problem with oracle10g, I have to do this in order + # to store the entire date + + db_dml update_date { + update evaluation_tasks set due_date = (select to_date(:due_date,'YYYY-MM-DD HH24:MI:SS') from dual) + where task_id = :revision_id + } + + if { ![empty_string_p $upload_file] } { + + set tmp_file [template::util::file::get_property tmp_filename $upload_file] + set content_length [file size $tmp_file] + + if { [parameter::get -parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] } { + # create the new item + db_dml lob_content { *SQL* } -blob_files [list $tmp_file] - content::item::set_live_revision -revision_id $revision_id - - # by the moment, since I'm having a date problem with oracle10g, I have to do this in order - # to store the entire date - - db_dml update_date { - update evaluation_tasks set due_date = (select to_date(:due_date,'YYYY-MM-DD HH24:MI:SS') from dual) - where task_id = :revision_id - } - - if { ![empty_string_p $upload_file] } { - - set tmp_file [template::util::file::get_property tmp_filename $upload_file] - set content_length [file size $tmp_file] - - if { [parameter::get -parameter "StoreFilesInDatabaseP" -package_id [ad_conn package_id]] } { - # create the new item - db_dml lob_content { *SQL* } -blob_files [list $tmp_file] - - # Unfortunately, we can only calculate the file size after the lob is uploaded - db_dml lob_size { *SQL* } - } else { - # create the new item - set file_name [cr_create_content_file $item_id $revision_id $tmp_file] + # Unfortunately, we can only calculate the file size after the lob is uploaded + db_dml lob_size { *SQL* } + } else { + # create the new item + set file_name [cr_create_content_file $item_id $revision_id $tmp_file] db_dml set_file_content { *SQL* } - - } - - } elseif { ![string eq $url "http://"] } { - - db_dml link_content { *SQL* } - # in order to support oracle and postgres and still using only the cr_items table to store the task - db_dml set_storage_type { *SQL* } - set content_length [string length $url] - db_dml content_size { *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* } - } - # integration with calendar - # since there is no service contract defined - - set desc_url "[_ evaluation.lt_Click_here_to_go_to_t]" - - set url [dotlrn_community::get_community_url $community_id] - - array set community_info [site_node::get -url "${url}calendar"] - set community_package_id $community_info(package_id) - set calendar_id [db_string get_cal_id { *SQL* }] - - if { ![db_0or1row calendar_mappings { *SQL* }] } { - # create cal_item - if { $due_date_p } { - set cal_item_id [calendar::item::new -start_date $cal_due_date -end_date $cal_due_date -name "[_ evaluation.Due_date_task_name]" -description $desc_url -calendar_id $calendar_id] + } + + } elseif { ![string eq $url "http://"] } { + + db_dml link_content { *SQL* } + # in order to support oracle and postgres and still using only the cr_items table to store the task + db_dml set_storage_type { *SQL* } + set content_length [string length $url] + db_dml content_size { *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* } + } + + # integration with calendar + # since there is no service contract defined + + set desc_url "[_ evaluation.lt_Click_here_to_go_to_t]" + + set url [dotlrn_community::get_community_url $community_id] + + array set community_info [site_node::get -url "${url}calendar"] + set community_package_id $community_info(package_id) + set calendar_id [db_string get_cal_id { *SQL* }] + + if { ![db_0or1row calendar_mappings { *SQL* }] } { + # create cal_item + if { $due_date_p } { + set cal_item_id [calendar::item::new -start_date $cal_due_date -end_date $cal_due_date -name "[_ evaluation.Due_date_task_name]" -description $desc_url -calendar_id $calendar_id] - db_dml insert_cal_mapping { *SQL* } - } - } else { - # edit previous cal_item - if { $due_date_p } { - calendar::item::edit -cal_item_id $cal_item_id -start_date $due_date_ansi -end_date $due_date_ansi -name "[_ evaluation.Due_date_task_name]" -description $desc_url -calendar_id $calendar_id - } - } - db_transaction { - - - if {!$simple_p } { - + db_dml insert_cal_mapping { *SQL* } + } + } else { + # edit previous cal_item + if { $due_date_p } { + calendar::item::edit -cal_item_id $cal_item_id -start_date $due_date_ansi -end_date $due_date_ansi -name "[_ evaluation.Due_date_task_name]" -description $desc_url -calendar_id $calendar_id + } + } + db_transaction { + + set relative_weight [format %0.2f [expr (($tasks_counter)*$weight)/100.00]] + set update_p [db_dml update_points { *SQL* }] + + if {!$simple_p } { + + if { $new_p } { + db_foreach get_grade_tasks {} { set relative_weight [format %0.2f [expr (($tasks_counter)*$weight)/100.00]] - set update_p [db_dml update_points { *SQL* }] - if { $new_p } { - db_foreach get_grade_tasks {} { - set relative_weight [format %0.2f [expr (($tasks_counter)*$weight)/100.00]] - db_dml update_tasks {*SQL*} - } - } - + db_dml update_tasks {*SQL*} } - } - } + + } + + + } } -after_submit { - + set redirect_to_groups_p 0 if { [info exists admin_groups_p] && $number_of_members > 1 } { - set redirect_to_groups_p 1 + set redirect_to_groups_p 1 } if { ![empty_string_p $add_to_more_classes_p] } { - ad_returnredirect [export_vars -base "task-add-to-communities" { redirect_to_groups_p {task_id $revision_id} return_url }] + ad_returnredirect [export_vars -base "task-add-to-communities" { redirect_to_groups_p {task_id $revision_id} return_url }] } elseif { $redirect_to_groups_p } { - ad_returnredirect [export_vars -base "../groups/one-task" { {task_id $revision_id} }] - ad_script_abort + ad_returnredirect [export_vars -base "../groups/one-task" { {task_id $revision_id} }] + ad_script_abort } else { if { $simple_p } { set return_url "../grades/distribution-edit?task_id=$revision_id&grade_id=$grade_id"