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 -N -r1.6 -r1.7 --- openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml 5 Aug 2004 00:32:55 -0000 1.6 +++ openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml 12 Aug 2004 17:46:41 -0000 1.7 @@ -81,6 +81,11 @@ Comments Comments/Edit reason: Comments/Edit reason + #>"> + </form> +</if> + +<# Confirm Confirm Evaluation Group Create Group Index: openacs-4/packages/evaluation/lib/tasks-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/Attic/tasks-chunk-postgresql.xql,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/evaluation/lib/tasks-chunk-postgresql.xql 5 Aug 2004 23:39:11 -0000 1.9 +++ openacs-4/packages/evaluation/lib/tasks-chunk-postgresql.xql 12 Aug 2004 17:46:41 -0000 1.10 @@ -40,7 +40,8 @@ cr.title as task_title, et.data as task_data, et.task_id as revision_id, - cr.content_length, + coalesce(cr.content_length,0) as content_length, + et.late_submit_p, ea.answer_id as answer_id from cr_revisions cr, evaluation_tasksi et left outer join evaluation_answersi ea on (ea.task_item_id = et.task_item_id and content_revision__is_live(ea.answer_id) = true @@ -53,6 +54,14 @@ + + + + select 1 from dual where :due_date > now() + + + + Index: openacs-4/packages/evaluation/lib/tasks-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/tasks-chunk.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/evaluation/lib/tasks-chunk.tcl 5 Aug 2004 00:32:55 -0000 1.9 +++ openacs-4/packages/evaluation/lib/tasks-chunk.tcl 12 Aug 2004 17:46:41 -0000 1.10 @@ -64,8 +64,9 @@ #student lappend elements answer \ [list label "" \ - link_url_col answer_url \ - link_html { title "[_ evaluation-portlet.Addedit_answer_]" }] + link_url_col answer_url \ + display_template { @tasks.answer;noquote@ } \ + link_html { title "[_ evaluation-portlet.Addedit_answer_]" }] lappend elements view \ [list label "" \ sub_class narrow \ @@ -166,7 +167,7 @@ } if { [string eq $online_p "t"] } { - if { ([template::util::date::compare $due_date [template::util::date::now]] > 0) } { + if { [db_string compare_due_date { *SQL* } -default 0] } { if { [empty_string_p $answer_id] } { set answer "[_ evaluation-portlet.submit_answer_]" set answer_mode edit @@ -176,15 +177,15 @@ set answer_mode display set answer_url "[export_vars -base "${base_url}answer-add-edit" { grade_id task_id answer_id return_url answer_mode }]" } - } elseif { [string eq $turn_in_late_p "t"] } { + } elseif { [string eq $late_submit_p "t"] } { if { [empty_string_p $answer_id] } { set answer "[_ evaluation-portlet.lt_submit_answer_style_f]" set answer_mode edit set answer_url "[export_vars -base "${base_url}answer-add-edit" { grade_id task_id return_url answer_mode }]" } else { set answer "[_ evaluation-portlet.lt_submit_answer_style_f_1]" set answer_mode display - set answer_url "[export_vars -base "${base_url}admin/tasks/solution-add-edit" { grade_id task_id answer_id return_url solution_mode }]" + set answer_url "[export_vars -base "${base_url}answer-add-edit" { grade_id task_id answer_id return_url answer_mode }]" } } if { $number_of_members > 1 && [string eq [db_string get_group_id { *SQL* }] 0] } { Index: openacs-4/packages/evaluation/www/answer-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/answer-add-edit-postgresql.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/evaluation/www/answer-add-edit-postgresql.xql 4 Aug 2004 19:16:54 -0000 1.5 +++ openacs-4/packages/evaluation/www/answer-add-edit-postgresql.xql 12 Aug 2004 17:46:42 -0000 1.6 @@ -29,6 +29,14 @@ + + + + select 1 from evaluation_tasks where task_id = :task_id and due_date < now() + + + + 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 -N -r1.7 -r1.8 --- openacs-4/packages/evaluation/www/answer-add-edit.tcl 30 Jul 2004 22:50:09 -0000 1.7 +++ openacs-4/packages/evaluation/www/answer-add-edit.tcl 12 Aug 2004 17:46:42 -0000 1.8 @@ -16,7 +16,7 @@ return_url:notnull } -validate { late_submit { - if { ![db_string late_turn_in { *SQL* }] && ([template::util::date::compare [db_string due_date "select due_date from evaluation_tasks where task_id = :task_id"] [template::util::date::now]] < 0) } { + if { [string eq [db_string late_turn_in { *SQL* }] "f"] && [db_string compare_dates { *SQL* } -default 0] } { ad_complain "[_ evaluation.lt_This_task_can_not_be_]" } } @@ -39,7 +39,7 @@ db_1row task_info { *SQL* } -ad_form -html { enctype multipart/form-data } -name answer -cancel_url $return_url -export { item_id grade_id task_id attached_p return_url } -form { +ad_form -html { enctype multipart/form-data } -name answer -cancel_url $return_url -export { item_id grade_id task_id return_url } -form { answer_id:key 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 -N -r1.6 -r1.7 --- openacs-4/packages/evaluation/www/task-view.tcl 30 Jul 2004 22:50:09 -0000 1.6 +++ openacs-4/packages/evaluation/www/task-view.tcl 12 Aug 2004 17:46:42 -0000 1.7 @@ -21,7 +21,7 @@ db_1row get_task_info { *SQL* } -ad_form -name task -has_submit 1 -has_edit 1 -export { return_url item_id storage_type grade_id attached_p } -mode display -form { +ad_form -name task -has_submit 1 -has_edit 1 -export { return_url item_id storage_type grade_id } -mode display -form { task_id:key Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.adp 27 Jul 2004 03:02:13 -0000 1.5 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.adp 12 Aug 2004 17:46:42 -0000 1.6 @@ -67,7 +67,7 @@ - + Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.tcl 10 Jun 2004 21:08:53 -0000 1.3 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.tcl 12 Aug 2004 17:46:42 -0000 1.4 @@ -73,7 +73,7 @@ if { ![string eq $old_grade [format %.2f [lc_numeric $grades($party_id)]]] } { incr counter if { ![info exists reasons($party_id)] || [empty_string_p $reasons($party_id)] } { - set grade_wo_reason $grades$party_id) + set grade_wo_reason $grades($party_id) ad_complain "[_ evaluation.lt_You_must_give_an_edit]" } set grades_to_edit($party_id) $grades($party_id) Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl 30 Jul 2004 22:50:10 -0000 1.3 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl 12 Aug 2004 17:46:42 -0000 1.4 @@ -12,8 +12,6 @@ operation } -ns_log notice "por comprarar ($operation) con ([_ evaluation.lt_Yes_I_really_want_to_]) \n" - if { [string eq $operation [_ evaluation.lt_Yes_I_really_want_to_]] } { db_transaction { db_exec_plsql delete_evaluation { *SQL* } Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit-postgresql.xql 7 Jul 2004 17:26:44 -0000 1.3 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit-postgresql.xql 12 Aug 2004 17:46:42 -0000 1.4 @@ -7,28 +7,55 @@ select evaluation__party_name(ese.party_id,et.task_id) as party_name, - ea.data as answer_data, - ea.title as answer_title, ese.party_id, ese.grade, - ese.item_id, - ese.show_student_p, - to_char(ea.last_modified, 'YYYY-MM-DD HH24:MI:SS') as submission_date_ansi, - ea.last_modified as submission_date, ese.last_modified as evaluation_date, et.online_p, et.due_date, - ese.evaluation_id - from evaluation_tasks et, - evaluation_student_evalsi ese left outer join evaluation_answersi ea on (ea.party_id = ese.party_id - and ea.task_id = ese.task_id - and content_revision__is_live(ea.answer_id) = true) + et.task_item_id, + ese.show_student_p, + ese.evaluation_id, + ese.item_id + from evaluation_tasks et, + evaluation_student_evalsi ese where et.task_id = :task_id - and et.task_id = ese.task_id + and et.task_item_id = ese.task_item_id and content_revision__is_live(ese.evaluation_id) = true - and ese.grade is not null + $orderby + + + + select ea.data as answer_data, + ea.title as answer_title, + ea.revision_id, + to_char(ea.creation_date, 'YYYY-MM-DD HH24:MI:SS') as submission_date_ansi, + ea.last_modified as submission_date + from evaluation_answersi ea + where ea.party_id = :party_id + and ea.task_item_id = :task_item_id + and content_revision__is_live(ea.answer_id) = true + + + + + + + + select 1 from dual where :submission_date > :evaluation_date + + + + + + + + select 1 from dual where :submission_date > :due_date + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.tcl 7 Jul 2004 17:26:44 -0000 1.6 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.tcl 12 Aug 2004 17:46:42 -0000 1.7 @@ -1,43 +1,44 @@ # /packages/evaluaiton/www/admin/evaluations/evaluations-edit.tcl ad_page_contract { - Displays the evaluations of students in order to edit them - + Displays the evaluations of students in order to edit them + @author jopez@galileo.edu @creation-date Mar 2004 @cvs-id $Id$ } { - task_id:integer,notnull - {return_url "student-list?[export_vars -url { task_id }]"} + task_id:integer,notnull + {return_url "student-list?[export_vars -url { task_id }]"} } set page_title "[_ evaluation.Edit_Evaluations_]" set context [list [list "[export_vars -base student-list { task_id }]" "[_ evaluation.Studen_List_]"] "[_ evaluation.Edit_Evaluations_]"] set elements [list party_name \ - [list label "[_ evaluation.Name_]" \ - orderby_asc {party_name asc} \ - orderby_desc {party_name desc}] \ - answer \ - [list label "[_ evaluation.Answer_]" \ - link_url_col answer_url \ - link_html { title "View answer" }] \ - submission_date_pretty \ - [list label "[_ evaluation.Submission_Date_]" \ - orderby_asc {submission_date asc} \ - orderby_desc {submission_date desc}] \ - grade \ - [list label "[_ evaluation.Maximun_Grade_] " \ - display_template { } ] \ - edit_reason \ - [list label "[_ evaluation.Edit_Reason_]" \ - display_template { } \ - ] \ - show_student_p \ - [list label "[_ evaluation.lt_Allow_the_students_br]" \ - display_template { Yes No } \ - ] \ - ] + [list label "[_ evaluation.Name_]" \ + orderby_asc {party_name asc} \ + orderby_desc {party_name desc}] \ + answer \ + [list label "[_ evaluation.Answer_]" \ + display_template { @evaluated_students.answer;noquote@ } \ + link_url_col answer_url \ + link_html { title "View answer" }] \ + submission_date_pretty \ + [list label "[_ evaluation.Submission_Date_]" \ + orderby_asc {submission_date asc} \ + orderby_desc {submission_date desc}] \ + grade \ + [list label "[_ evaluation.Maximun_Grade_] " \ + display_template { } ] \ + edit_reason \ + [list label "[_ evaluation.Edit_Reason_]" \ + display_template { } \ + ] \ + show_student_p \ + [list label "[_ evaluation.lt_Allow_the_students_br]" \ + display_template { Yes No } \ + ] \ + ] template::list::create \ -name evaluated_students \ @@ -54,37 +55,40 @@ db_multirow -extend { answer answer_url radio_yes_checked radio_no_checked submission_date_pretty } evaluated_students get_evaluated_students { *SQL* } { - set submission_date_pretty [lc_time_fmt $submission_date_ansi "%q"] set grade [format %.2f [lc_numeric $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 answer "[_ evaluation.No_response_]" - } elseif { [regexp "http://" $answer_data] } { - set answer_url "[export_vars -base "$answer_data" { }]" - set answer "[_ evaluation.View_answer_]" - } else { - # we assume it's a file - set answer_url "[export_vars -base "[ad_conn package_url]view/$answer_title" { }]" - } - if { ![string eq $answer "[_ evaluation.No_response_]"] && ([template::util::date::compare $submission_date $evaluation_date] > 0) } { - append answer_url " [_ evaluation.NEW_answer_]" - } - if { [template::util::date::compare $submission_date $due_date] > 0 } { - set pretty_submission_date "$pretty_submission_date [_ evaluation.late__1]" - } + if { [string eq $online_p "t"] } { + if { [db_0or1row get_answer_info { *SQL* }] } { + + # working with answer stuff (if it has a file/url attached) + if { [empty_string_p $answer_data] } { + set answer "[_ evaluation.No_response_]" + } elseif { [regexp "http://" $answer_data] } { + set answer_url "[export_vars -base "$answer_data" { }]" + set answer "[_ evaluation.View_answer_]" + } else { + # we assume it's a file + set answer_url "[export_vars -base "[ad_conn package_url]view/$answer_title" { }]" + } + if { ![string eq $answer "[_ evaluation.No_response_]"] && [db_string compare_evaluation_date { *SQL* } -default 0] } { + set answer " [_ evaluation.View_NEW_answer_]" + } + set submission_date_pretty [lc_time_fmt $submission_date_ansi "%q"] + if { [db_string compare_submission_date { *SQL* } -default 0] } { + set submission_date_pretty "$submission_date_pretty [_ evaluation.late__1]" + } } - - if { [string eq $show_student_p "t"] } { - set radio_yes_checked "checked" - set radio_no_checked "" - } else { - set radio_yes_checked "" - set radio_no_checked "checked" - } - - set evaluation_ids($party_id) $evaluation_id - set item_to_edit_ids($party_id) $item_id + } + + if { [string eq $show_student_p "t"] } { + set radio_yes_checked "checked" + set radio_no_checked "" + } else { + set radio_yes_checked "" + set radio_no_checked "checked" + } + + set evaluation_ids($party_id) $evaluation_id + set item_to_edit_ids($party_id) $item_id } set grades_sheet_item_id [db_nextval acs_object_id_seq] 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 -N -r1.6 -r1.7 --- openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.tcl 30 Jul 2004 22:50:10 -0000 1.6 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.tcl 12 Aug 2004 17:46:42 -0000 1.7 @@ -143,7 +143,6 @@ } else { set community_id [dotlrn_community::get_community_id] - ns_log notice "vamos bien... part $party_id comm $community_id\n" if { [empty_string_p $community_id] } { if { ![db_string valid_user { *SQL* }] } { incr errors Index: openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql 2 Aug 2004 17:49:56 -0000 1.7 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql 12 Aug 2004 17:46:42 -0000 1.8 @@ -31,6 +31,22 @@ + + + + select 1 from dual where :submission_date > :evaluation_date + + + + + + + + select 1 from dual where :submission_date > :due_date + + + + 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 -N -r1.10 -r1.11 --- openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 30 Jul 2004 22:50:10 -0000 1.10 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 12 Aug 2004 17:46:42 -0000 1.11 @@ -62,7 +62,7 @@ display_template { @evaluated_students.action;noquote@ } \ link_url_col action_url \ ] \ - ] + ] if { [string eq $online_p "t"] } { lappend elements submission_date_pretty \ @@ -78,7 +78,7 @@ display_template {} \ link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id task_id evaluation_mode }]} \ link_html { title "[_ evaluation.View_evaluation_]" } \ - ] + ] lappend elements edit \ [list label "" \ sub_class narrow \ @@ -117,7 +117,7 @@ incr total_evaluated lappend done_students $party_id set grade [format %.2f [lc_numeric $grade]] - + if { [string eq $online_p "t"] } { if { [db_0or1row get_answer_info { *SQL* }] } { # working with answer stuff (if it has a file/url attached) @@ -131,11 +131,11 @@ set action_url "[export_vars -base "../../view/$answer_title" { revision_id }]" set action "[_ evaluation.View_answer_]" } - if { [string eq $action "[_ evaluation.View_answer_]"] && ([template::util::date::compare $submission_date $evaluation_date] > 0) } { + if { [string eq $action "[_ evaluation.View_answer_]"] && ([db_string compare_evaluation_date { *SQL* } -default 0] ) } { set action " [_ evaluation.View_NEW_answer_]" } set submission_date_pretty [lc_time_fmt $submission_date_ansi "%c"] - if { [template::util::date::compare $submission_date $due_date] > 0 } { + if { [db_string compare_submission_date { *SQL* } -default 0] } { set submission_date_pretty "[_ evaluation.lt_submission_date_prett]" } } else { @@ -161,8 +161,8 @@ orderby_asc {party_name asc} \ orderby_desc {party_name desc} \ link_url_col party_url \ - ] \ - ] + ] \ + ] if { [string eq $show_portrait_p "t"] && [string eq $number_of_members "1"] } { lappend elements portrait \ @@ -220,7 +220,7 @@ lappend done_students $party_id if { [string eq $online_p "t"] } { set submission_date_pretty "[lc_time_fmt $submission_date_ansi "%Q"] [lc_time_fmt $submission_date_ansi "%X"]" - if { [template::util::date::compare $submission_date $due_date] > 0 } { + if { [db_string compare_submission_date { *SQL* } -default 0] } { set submission_date_pretty "[_ evaluation.lt_submission_date_prett_1]" } else { } @@ -244,7 +244,7 @@ orderby_asc {party_name asc} \ orderby_desc {party_name desc} \ link_url_col party_url \ - ] \ + ] \ ] if { [string eq $show_portrait_p "t"] && [string eq $number_of_members "1"] } { Index: openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql 7 Jul 2004 17:26:45 -0000 1.3 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql 12 Aug 2004 17:46:42 -0000 1.4 @@ -10,15 +10,26 @@ crr.title, crr.item_id, cri.storage_type, - crr.revision_id - from evaluation_tasks_sols ets, cr_items cri, cr_revisions crr + crr.revision_id, + ets.mime_type + from evaluation_tasks_solsi ets, cr_items cri, cr_revisions crr where ets.solution_id = :solution_id and ets.solution_id = crr.revision_id and crr.item_id = cri.item_id + + + + select evaluation__delete_task_sol(solution_id) + from evaluation_tasks_sols + where task_item_id = :task_item_id + + + + 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 -N -r1.7 -r1.8 --- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 30 Jul 2004 22:50:11 -0000 1.7 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 12 Aug 2004 17:46:42 -0000 1.8 @@ -15,219 +15,223 @@ {solution_mode "edit"} grade_id:integer,notnull return_url + {attached_p "f"} } set package_id [ad_conn package_id] if { [ad_form_new_p -key solution_id] } { - set page_title "[_ evaluation.Add_Task_Solution_]" + set page_title "[_ evaluation.Add_Task_Solution_]" } else { - set page_title "[_ evaluation.lt_ViewEdit_Task_Solutio]" + set page_title "[_ evaluation.lt_ViewEdit_Task_Solutio]" } db_1row task_info { *SQL* } set context [list [list [export_vars -base ../grades/grades { }] "[_ evaluation.Grades_]"] $page_title] -set attached_p "f" -ad_form -html { enctype multipart/form-data } -name solution -cancel_url $return_url -export { return_url grade_id item_id storage_type task_id attached_p } -mode $solution_mode -form { +ad_form -html { enctype multipart/form-data } -name solution -cancel_url $return_url -export { return_url grade_id item_id storage_type task_id } -mode $solution_mode -form { - solution_id:key + solution_id:key } if { ![ad_form_new_p -key solution_id] } { - db_1row get_sol_info { *SQL* } - - if { [string eq $storage_type "lob"] } { + db_1row get_sol_info { *SQL* } + + if { [string eq $storage_type "lob"] } { - if { [string eq $solution_mode "edit"] } { - set attached_p "t" - - ad_form -extend -name solution -form { - {upload_file:file,optional - {label "[_ evaluation.File_]"} - {html "size 30"} - {help_text "[_ evaluation.lt_Currently_title_is_at]"} - } - {unattach_p:text(checkbox),optional - {label "[_ evaluation.Unattach_file_]"} - {options {{"" "t"}}} - {help_text "[_ evaluation.lt_Check_this_if_you_wan]"} - } - {url:text(text),optional - {label "[_ evaluation.URL__1]"} - {value "http://"} - } - } - } else { - ad_form -extend -name solution -form { - {upload_file:text,optional - {label "[_ evaluation.File_]"} - {html "size 30"} - {value "[return $title]"} - {after_html "$title"} - } - {unattach_p:text(hidden) - } - {url:text(hidden) - } - } + if { [string eq $solution_mode "edit"] } { + set attached_p "t" + + ad_form -extend -name solution -form { + {upload_file:file,optional + {label "[_ evaluation.File_]"} + {html "size 30"} + {help_text "[_ evaluation.lt_Currently_title_is_at]"} } - } elseif { [string eq $title "link"] } { - - if { [string eq $solution_mode "edit"] } { - - set attached_p "t" - - ad_form -extend -name solution -form { - - {upload_file:file,optional - {label "[_ evaluation.File_]"} - {html "size 30"} - } - {url:text(text),optional - {label "[_ evaluation.URL__1]"} - {value "http://"} - {help_text "[_ evaluation.lt_Currently_content_is_]"} - } - {unattach_p:text(checkbox),optional - {label "[_ evaluation.Unassociate_url_]"} - {options {{"" "t"}}} - {help_text "[_ evaluation.lt_Check_this_if_you_wan]"} - } - } - } else { - ad_form -extend -name solution -form { - - {upload_file:text(hidden) - } - {url:text(text),optional - {label "[_ evaluation.URL__1]"} - {value "$content"} - {after_html "$content"} - } - {unattach_p:text(hidden) - } - } + {unattach_p:text(checkbox),optional + {label "[_ evaluation.Unattach_file_]"} + {options {{"" "t"}}} + {help_text "[_ evaluation.lt_Check_this_if_you_wan]"} } + {url:text(text),optional + {label "[_ evaluation.URL__1]"} + {value "http://"} + } + } } else { - ad_form -extend -name solution -form { - - {upload_file:file,optional - {label "[_ evaluation.File_]"} - {html "size 30"} - } - {url:text(text),optional - {label "[_ evaluation.URL__1]"} - {value "http://"} - } - {unattach_p:text(hidden),optional - {value ""} - } + ad_form -extend -name solution -form { + {upload_file:text,optional + {label "[_ evaluation.File_]"} + {html "size 30"} + {value "[return $title]"} + {after_html "$title"} } + {unattach_p:text(hidden) + } + {url:text(hidden) + } + } } -} else { - - ad_form -extend -name solution -form { + } elseif { [string eq $title "link"] } { + + if { [string eq $solution_mode "edit"] } { + + set attached_p "t" + + ad_form -extend -name solution -form { {upload_file:file,optional - {label "[_ evaluation.File_]"} - {html "size 30"} + {label "[_ evaluation.File_]"} + {html "size 30"} } {url:text(text),optional - {label "[_ evaluation.URL__1]"} - {value "http://"} + {label "[_ evaluation.URL__1]"} + {value "http://"} + {help_text "[_ evaluation.lt_Currently_content_is_]"} + } + {unattach_p:text(checkbox),optional + {label "[_ evaluation.Unassociate_url_]"} + {options {{"" "t"}}} + {help_text "[_ evaluation.lt_Check_this_if_you_wan]"} } - {unattach_p:text(hidden),optional - {value ""} + } + } else { + ad_form -extend -name solution -form { + + {upload_file:text(hidden) } + {url:text(text),optional + {label "[_ evaluation.URL__1]"} + {value "$content"} + {after_html "$content"} + } + {unattach_p:text(hidden) + } + } } + } else { + ad_form -extend -name solution -form { + + {upload_file:file,optional + {label "[_ evaluation.File_]"} + {html "size 30"} + } + {url:text(text),optional + {label "[_ evaluation.URL__1]"} + {value "http://"} + } + {unattach_p:text(hidden),optional + {value ""} + } + } + } +} else { + + ad_form -extend -name solution -form { + + {upload_file:file,optional + {label "[_ evaluation.File_]"} + {html "size 30"} + } + {url:text(text),optional + {label "[_ evaluation.URL__1]"} + {value "http://"} + } + {unattach_p:text(hidden),optional + {value ""} + } + } } ad_form -extend -name solution -form { } -edit_request { - - db_1row solution_info { *SQL* } + + db_1row solution_info { *SQL* } } -validate { - {url - { ([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]) || ([string eq $url "http://"] && [empty_string_p $upload_file] && [string eq $unattach_p "t"]) } - { [_ evaluation.lt_Upload_a_file_OR_a_va] } - } - {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] && [string eq $unattach_p "t"]) } - { [_ evaluation.lt_Upload_a_file_OR_a_ur] } - } - {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] } - } + {url + { ([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]) || ([string eq $url "http://"] && [empty_string_p $upload_file] && [string eq $unattach_p "t"]) } + { [_ evaluation.lt_Upload_a_file_OR_a_va] } + } + {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] && [string eq $unattach_p "t"]) } + { [_ evaluation.lt_Upload_a_file_OR_a_ur] } + } + {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] } + } } -on_submit { - - db_transaction { + + db_transaction { + if { [string eq $unattach_p "t"] } { + db_exec_plsql unassociate_task_sol { *SQL* } + } else { + 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 + + } elseif { ![string eq $url "http://"] } { set mime_type "text/plain" + set title "link" + set storage_type text + } elseif { [string eq $attached_p "f"] } { + 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 - } elseif { ![string eq $url "http://"] } { - set mime_type "text/plain" - set title "link" - set storage_type text - } + } + + set title [evaluation::safe_url_name -name $title] + if { [ad_form_new_p -key solution_id] } { + set item_id $solution_id + } + + set revision_id [evaluation::new_solution -new_item_p [ad_form_new_p -key solution_id] -item_id $item_id -content_type evaluation_tasks_sols \ + -content_table evaluation_tasks_sols -content_id solution_id -storage_type $storage_type -task_item_id $task_item_id \ + -title $title -mime_type $mime_type] + + evaluation::set_live -revision_id $revision_id + + if { ![empty_string_p $upload_file] } { - set title [evaluation::safe_url_name -name $title] - if { [ad_form_new_p -key solution_id] } { - set item_id $solution_id - } - - set revision_id [evaluation::new_solution -new_item_p [ad_form_new_p -key solution_id] -item_id $item_id -content_type evaluation_tasks_sols \ - -content_table evaluation_tasks_sols -content_id solution_id -storage_type $storage_type -task_item_id $task_item_id \ - -title $title -mime_type $mime_type] + set tmp_file [template::util::file::get_property tmp_filename $upload_file] - evaluation::set_live -revision_id $revision_id + # 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* } + set content_length [string length $url] + db_dml lob_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* } + } - 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* } - set content_length 0 - db_dml lob_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* } - } elseif { [string eq $unattach_p "t"] } { - db_dml unassociate_task_sol { *SQL* } - } } - - ad_returnredirect "$return_url" - ad_script_abort + } + + ad_returnredirect "$return_url" + ad_script_abort } ad_return_template Index: openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql 30 Jul 2004 22:50:11 -0000 1.3 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql 12 Aug 2004 17:46:42 -0000 1.4 @@ -55,12 +55,4 @@ - - - - delete from evaluation_tasks_sols where task_id=:task_id - - - - Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql 30 Jul 2004 22:50:11 -0000 1.6 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql 12 Aug 2004 17:46:42 -0000 1.7 @@ -21,6 +21,7 @@ select content_revision__get_content(et.revision_id) as content, et.title, et.item_id, + et.mime_type, cri.storage_type from evaluation_tasksi et, cr_items cri where et.task_id = :task_id @@ -81,7 +82,7 @@ - content_revision__content_copy(:task_id, :revision_id) + select content_revision__content_copy(:task_id,:revision_id) 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 -N -r1.13 -r1.14 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 5 Aug 2004 23:39:49 -0000 1.13 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 12 Aug 2004 17:46:42 -0000 1.14 @@ -16,6 +16,7 @@ return_url admin_groups_p:optional {add_to_more_classes_p ""} + {attached_pd "f"} } set package_id [ad_conn package_id] @@ -40,8 +41,7 @@ set context [list $page_title] -set attached_p "f" -ad_form -html { enctype multipart/form-data } -name task -cancel_url $return_url -export { return_url item_id storage_type grade_id attached_p } -mode $mode -form { +ad_form -html { enctype multipart/form-data } -name task -cancel_url $return_url -export { return_url item_id storage_type grade_id } -mode $mode -form { task_id:key @@ -248,10 +248,6 @@ set weight [format %.2f [lc_numeric $weight]] } -validate { - {due_date - { [template::util::date::compare $due_date [template::util::date::now]] > 0 } - { [_ evaluation.lt_Due_date_must_be_in_t] } - } {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] } @@ -291,11 +287,7 @@ } 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 @@ -312,6 +304,10 @@ set mime_type "text/plain" set title "link" set storage_type text + } elseif { [string eq $attached_p "f"] } { + set mime_type "text/plain" + set title "" + set storage_type text } set title [evaluation::safe_url_name -name $title] @@ -343,10 +339,11 @@ } elseif { ![string eq $url "http://"] } { db_dml link_content { *SQL* } - set content_length 0 + set content_length [string length $url] db_dml lob_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* } } Index: openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.tcl 5 Aug 2004 00:32:55 -0000 1.6 +++ openacs-4/packages/evaluation-portlet/lib/evaluations-chunk.tcl 12 Aug 2004 17:46:42 -0000 1.7 @@ -108,7 +108,6 @@ set task_weight "[_ evaluation-portlet.Not_available_]" } - ns_log notice "el answer data es ($answer_data ([db_string content_length "select content_length from cr_revisions where revision_id = :answer_id" -default nada])) y el title es -$answer_title-! \n" # working with answer stuff (if it has a file/url attached) if { [empty_string_p $answer_data] } { set answer_url "" Index: openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql 11 Aug 2004 00:50:39 -0000 1.7 +++ openacs-4/packages/evaluation-portlet/lib/tasks-chunk-postgresql.xql 12 Aug 2004 17:46:42 -0000 1.8 @@ -41,6 +41,7 @@ et.data as task_data, et.task_id as revision_id, coalesce(cr.content_length,0) as content_length, + et.late_submit_p, ea.answer_id as answer_id from cr_revisions cr, evaluation_tasksi et left outer join evaluation_answersi ea on (ea.task_item_id = et.task_item_id and content_revision__is_live(ea.answer_id) = true @@ -53,6 +54,14 @@ + + + + select 1 from dual where :due_date > now() + + + + Index: openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl 5 Aug 2004 00:32:55 -0000 1.6 +++ openacs-4/packages/evaluation-portlet/lib/tasks-chunk.tcl 12 Aug 2004 17:46:42 -0000 1.7 @@ -63,9 +63,10 @@ } else { #student lappend elements answer \ - [list label "" \ - link_url_col answer_url \ - link_html { title "[_ evaluation-portlet.Addedit_answer_]" }] + [list label "" \ + link_url_col answer_url \ + display_template { @tasks.answer;noquote@ } \ + link_html { title "[_ evaluation-portlet.Addedit_answer_]" }] lappend elements view \ [list label "" \ sub_class narrow \ @@ -145,7 +146,7 @@ set answer_mode display set due_date_pretty [lc_time_fmt $due_date_ansi "%q"] # working with task stuff (if it has a file/url attached) - if { [string eq $task_title "link"] } { + if { [empty_string_p $task_data] } { set task_url "[export_vars -base "${base_url}task-view" { grade_id task_id return_url }]" set task_name "[_ evaluation-portlet.task_name_No_data_]" } elseif { [string eq $task_title "link"] } { @@ -166,7 +167,7 @@ } if { [string eq $online_p "t"] } { - if { ([template::util::date::compare $due_date [template::util::date::now]] > 0) } { + if { [db_string compare_due_date { *SQL* } -default 0] } { if { [empty_string_p $answer_id] } { set answer "[_ evaluation-portlet.submit_answer_]" set answer_mode edit @@ -176,15 +177,15 @@ set answer_mode display set answer_url "[export_vars -base "${base_url}answer-add-edit" { grade_id task_id answer_id return_url answer_mode }]" } - } elseif { [string eq $turn_in_late_p "t"] } { + } elseif { [string eq $late_submit_p "t"] } { if { [empty_string_p $answer_id] } { set answer "[_ evaluation-portlet.lt_submit_answer_style_f]" set answer_mode edit set answer_url "[export_vars -base "${base_url}answer-add-edit" { grade_id task_id return_url answer_mode }]" } else { set answer "[_ evaluation-portlet.lt_submit_answer_style_f_1]" set answer_mode display - set answer_url "[export_vars -base "${base_url}admin/tasks/solution-add-edit" { grade_id task_id answer_id return_url solution_mode }]" + set answer_url "[export_vars -base "${base_url}answer-add-edit" { grade_id task_id answer_id return_url answer_mode }]" } } if { $number_of_members > 1 && [string eq [db_string get_group_id { *SQL* }] 0] } {