Index: openacs-4/packages/evaluation/evaluation.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/evaluation.info,v diff -u -r1.2 -r1.3 --- openacs-4/packages/evaluation/evaluation.info 30 Apr 2004 12:09:31 -0000 1.2 +++ openacs-4/packages/evaluation/evaluation.info 12 May 2004 02:07:43 -0000 1.3 @@ -15,12 +15,12 @@ - - + + Index: openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql 12 May 2004 02:07:44 -0000 1.2 @@ -94,7 +94,6 @@ primary key (class_id, revision_id) ); - create table evaluation_tasks_sols ( solution_id integer primary key, @@ -103,7 +102,7 @@ references evaluation_tasks ); --- crear indice para cada cosa que sea referenciada por otras tablas +-- create indexes create index evalutaion_tasks_sols_tid_index on evaluation_tasks_sols(task_id); select content_type__create_type ( @@ -131,7 +130,6 @@ references evaluation_tasks ); --- cada vez que se crea una constraint como unique compuestos, se crea un indice para cada cosa que va en el unique y si por ejemplo el indice es (a,b,c) se puede usar ese index para a, ab, abc, pero no para b ni c ni bc. create index evaluation_answers_tid_index on evaluation_answers(party_id,task_id); select content_type__create_type ( @@ -183,22 +181,28 @@ null -- name_method ); --- creating group_type and the table where we are going to store the information about evaluation groups for tasks in groups +-- table to store the csv sheet grades associated with the evaluations +create table evaluation_grades_sheets ( + grades_sheet_id integer + primary key, + task_id integer + constraint evaluation_gsheets_t_id_fk + references evaluation_tasks +); -create table evaluation_task_groups ( - group_id integer - constraint evaluation_task_groups_pk - primary key - constraint evaluation_task_groups_fk - references groups(group_id), - task_id integer - constraint evaluation_task_groups_tid_nn - not null - constraint evaluation_task_groups_tid_fk - references evaluation_tasks(task_id) +-- create indexes +create index evalutaion_grades_sheets_tid_index on evaluation_grades_sheets(task_id); + +select content_type__create_type ( + 'evaluation_grades_sheets', -- content_type + 'content_revision', -- super_type + 'Evaluation Grades Sheet', -- pretty_name + 'Evaluation Grades Sheets', -- pretty_plural + 'evaluation_grades_sheets', -- table_name + 'grades_sheet_id', -- id_column + null -- name_method ); -create index evaluation_task_groups_tid_index on evaluation_task_groups(task_id); select acs_object_type__create_type ( 'evaluation_task_groups', --object type @@ -213,6 +217,23 @@ null --name_method ); +-- creating group_type and the table where we are going to store the information about evaluation groups for tasks in groups + +create table evaluation_task_groups ( + group_id integer + constraint evaluation_task_groups_pk + primary key + constraint evaluation_task_groups_fk + references groups(group_id), + task_id integer + constraint evaluation_task_groups_tid_nn + not null + constraint evaluation_task_groups_tid_fk + references evaluation_tasks(task_id) +); + +create index evaluation_task_groups_tid_index on evaluation_task_groups(task_id); + insert into group_types (group_type) values ('evaluation_task_groups'); insert into acs_object_type_tables @@ -368,6 +389,7 @@ delete from evaluation_student_evals where task_id = del_rec.task_id; delete from evaluation_answers where task_id = del_rec.task_id; delete from evaluation_tasks_sols where task_id = del_rec.task_id; + delete from evaluation_grades_sheets where task_id = del_rec.task_id; END LOOP; delete from evaluation_tasks where grade_id = p_grade_id; @@ -474,6 +496,7 @@ delete from evaluation_student_evals where task_id = p_task_id; delete from evaluation_answers where task_id = p_task_id; delete from evaluation_tasks_sols where task_id = p_task_id; + delete from evaluation_grades_sheets where task_id = p_task_id; delete from evaluation_tasks where task_id = p_task_id; PERFORM content_revision__delete(p_task_id); @@ -629,6 +652,69 @@ end;' language 'plpgsql'; --------------------------------------- +-- GRADES SHEETS +--------------------------------------- + +create function evaluation__new_grades_sheet (integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar) +returns integer as ' +declare + p_item_id alias for $1; + p_revision_id alias for $2; + p_task_id alias for $3; + p_object_type alias for $4; + p_creation_date alias for $5; + p_creation_user alias for $6; + p_creation_ip alias for $7; + p_title alias for $8; -- default null + p_publish_date alias for $9; + p_nls_language alias for $10; -- default null + p_mime_type alias for $11; -- default null + + v_revision_id integer; + +begin + + v_revision_id := content_revision__new( + p_title, -- title + ''grades sheet'', -- description + p_publish_date, -- publish_date + p_mime_type, -- mime_type + p_nls_language, -- nls_language + null, -- data + p_item_id, -- item_id + p_revision_id, -- revision_id + current_timestamp, -- creation_date + p_creation_user, -- creation_user + p_creation_ip, -- creation_ip + null -- content length + ); + + insert into evaluation_grades_sheets + (grades_sheet_id, + task_id) + values + (v_revision_id, + p_task_id); + + return v_revision_id; +end; +' language 'plpgsql'; + +create function evaluation__delete_grades_sheet (integer) +returns integer as ' +declare + p_grades_sheet_id alias for $1; +begin + + delete from evaluation_grades_sheets where grades_sheet_id = p_grades_sheet_id; + + PERFORM content_revision__delete(p_grades_sheet_id); + + return 0; + +end;' language 'plpgsql'; + +--------------------------------------- -- STUDENT EVALUATIONS --------------------------------------- @@ -990,16 +1076,6 @@ -- delete all contents FOR v_item_cursor IN - select eg.grade_id - from evaluation_gradesi eg, acs_objects ao - where eg.item_id = ao.object_id - and ao.context_id = p_package_id - LOOP - PERFORM evaluation__delete_grade(v_item_cursor.grade_id); - END LOOP; - - -- delete all contents - FOR v_item_cursor IN select ea.answer_id from evaluation_answersi ea, acs_objects ao where ea.item_id = ao.object_id @@ -1020,6 +1096,16 @@ -- delete all contents FOR v_item_cursor IN + select egs.grades_sheet_id + from evaluation_grades_sheetsi egs, acs_objects ao + where egs.item_id = ao.object_id + and ao.context_id = p_package_id + LOOP + PERFORM evaluation__delete_grades_sheet(v_item_cursor.grades_sheet_id); + END LOOP; + + -- delete all contents + FOR v_item_cursor IN select etg.group_id from evaluation_tasksi et, acs_objects ao, evaluation_task_groups etg where et.item_id = ao.object_id @@ -1049,6 +1135,16 @@ PERFORM evaluation__delete_task(v_item_cursor.task_id); END LOOP; + -- delete all contents + FOR v_item_cursor IN + select eg.grade_id + from evaluation_gradesi eg, acs_objects ao + where eg.item_id = ao.object_id + and ao.context_id = p_package_id + LOOP + PERFORM evaluation__delete_grade(v_item_cursor.grade_id); + END LOOP; + return 0; end;' language 'plpgsql'; @@ -1059,7 +1155,6 @@ p_content_type alias for $2; v_item_cursor RECORD; - begin FOR v_item_cursor IN @@ -1160,6 +1255,26 @@ ''t'' -- is_default ); + -- Create the (default) content type template + + template_id := content_template__new( + ''evaluation-grades-sheets-default'', -- name + '' +@title;noquote@ +@context;noquote@ +@text;noquote@'', -- text + true -- is_live + ); + + -- Register the template for the content type + + perform content_type__register_template( + ''evaluation_grades_sheets'', -- content_type + template_id, -- template_id + ''public'', -- use_context + ''t'' -- is_default + ); + return null; end;' language 'plpgsql'; Index: openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql 12 May 2004 02:07:44 -0000 1.2 @@ -19,6 +19,12 @@ content_type__get_template('evaluation_answers','public'), 'public' ); +-- Unregister the content template +select content_type__unregister_template ( + 'evaluation_grades_sheets', + content_type__get_template('evaluation_grades_sheets','public'), + 'public' +); -- deleting templates create function inline_0 () @@ -67,7 +73,7 @@ del_rec record; begin for del_rec in select item_id from cr_items - where content_type in (''evaluation_grades'', ''evaluation_tasks'', ''evaluation_tasks_sols'', ''evaluation_answers'', ''evaluation_student_evals'') + where content_type in (''evaluation_grades'', ''evaluation_tasks'', ''evaluation_tasks_sols'', ''evaluation_answers'', ''evaluation_student_evals'', ''evaluation_grades_sheets'') loop PERFORM content_item__delete(del_rec.item_id); end loop; @@ -82,7 +88,7 @@ del_rec record; begin for del_rec in select item_id from cr_items - where content_type in (''evaluation_grades'', ''evaluation_tasks'', ''evaluation_tasks_sols'', ''evaluation_answers'', ''evaluation_student_evals'') + where content_type in (''evaluation_grades'', ''evaluation_tasks'', ''evaluation_tasks_sols'', ''evaluation_answers'', ''evaluation_student_evals'', ''evaluation_grades_sheets'') loop PERFORM content_item__delete(del_rec.item_id); end loop; @@ -95,6 +101,7 @@ delete from acs_objects where object_type = 'evaluation_tasks'; delete from acs_objects where object_type = 'evaluation_tasks_sols'; delete from acs_objects where object_type = 'evaluation_answers'; +delete from acs_objects where object_type = 'evaluation_grades_sheets'; delete from acs_objects where object_type = 'evaluation_student_evals'; delete from acs_objects where object_type = 'evaluation_task_groups'; delete from acs_objects where object_type = 'evaluation_task_group_rel'; @@ -113,6 +120,7 @@ PERFORM acs_object_type__drop_type(''evaluation_tasks'',''f''); PERFORM acs_object_type__drop_type(''evaluation_tasks_sols'',''f''); PERFORM acs_object_type__drop_type(''evaluation_answers'',''f''); +PERFORM acs_object_type__drop_type(''evaluation_grades_sheets'',''f''); PERFORM acs_object_type__drop_type(''evaluation_student_evals'',''f''); PERFORM acs_object_type__drop_type(''evaluation_task_groups'',''f''); @@ -126,6 +134,11 @@ drop view evaluation_tasks_solsx; drop table evaluation_tasks_sols; +drop index evalutaion_grades_sheets_tid_index; +drop view evaluation_grades_sheetsi; +drop view evaluation_grades_sheetsx; +drop table evaluation_grades_sheets; + drop index evaluation_student_evals_tid_index; drop index evaluation_student_evals_pid_index; drop view evaluation_student_evalsi; 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.1 -r1.2 --- openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 12 May 2004 02:07:44 -0000 1.2 @@ -57,6 +57,14 @@ 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, @@ -65,7 +73,7 @@ null, 'evaluation_student_evals' ); - } + } set creation_user [ad_verify_and_get_user_id] set creation_ip [ad_conn peeraddr] @@ -149,7 +157,7 @@ :projects_revision_id, 'Projects', -1, -- class_id temporal - 40, + 20, 'evaluation_grades', now(), --creation date :creation_user, @@ -235,35 +243,52 @@ 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_folders { + db_exec_plsql delte_evaluation_contents { select evaluation__delete_contents ( :package_id ); - + } + + db_exec_plsql delte_grades_folder { select evaluation__delete_folder ( :ev_grades_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.1 -r1.2 --- openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 12 May 2004 02:07:44 -0000 1.2 @@ -301,5 +301,48 @@ + + + + + select evaluation__new_item ( + :item_id, --item_id + :item_name, + null, --locale + :creation_user, + :package_id, + :creation_ip, + :title, + 'grades sheet', + :mime_type, --mime_type + null, --nls_language + null, --text + :storage_type, --storage_type + 'content_item', -- item_subtype + 'evaluation_grades_sheets' -- content_type + ); + + + + + + + + select evaluation__new_grades_sheet ( + :item_id, + :revision_id, + :task_id, + 'evaluation_grades_sheets', + now(), --creation date + :creation_user, + :creation_ip, + :item_name, + now(), --publish date + null, -- nls_language + :mime_type --mime_type + ); + + + 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.1 -r1.2 --- openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 12 May 2004 02:07:44 -0000 1.2 @@ -19,7 +19,6 @@ return "evaluation" } - ad_proc -public evaluation::make_url { -file_name_from_db:required } { @@ -387,4 +386,117 @@ } +ad_proc -public evaluation::new_grades_sheet { + -item_id:required + -content_type:required + -content_table:required + -content_id:required + -new_item_p:required + -task_id:required + -storage_type:required + -title:required + -mime_type:required +} { + Build a new content revision of a grades sheet. 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 + @param task_id Task which "owns" the grades sheet + @param title The name of the grades sheet + @param storage_type lob + @param mime_type Mime tipe of the grades sheet + +} { + + 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 "${item_id}_${title}" + + set revision_id [db_nextval acs_object_id_seq] + + if { $new_item_p } { + db_exec_plsql content_item_new { *SQL* } + } + + db_exec_plsql content_revision_new { *SQL* } + + return $revision_id +} + +ad_proc -public evaluation::generate_grades_sheet {} { + + # Get file_path from url + set url [ns_conn url] + + regexp {/grades-sheet-csv-([^.]+).csv$} $url match task_id + + if { ![db_0or1row get_task_info "select et.task_name, et.number_of_members + from evaluation_tasks et + where et.task_id = :task_id"] } { + # this should never happen + ad_return_error "No information" "There has been an error, there is no infomraiton about the task $task_id" + return + } + + set csv_content [list] + lappend csv_content "Grades sheet for assighment \"$task_name\"" + + lappend csv_content "\nMax Grade:" + lappend csv_content "100" + lappend csv_content "\nWill the student be able to see the grade? (Yes/No):" + lappend csv_content "Yes" + + lappend csv_content "\n\nParty id" + lappend csv_content "Party Name" + lappend csv_content "Grade" + lappend csv_content "Comments/Edit reason" + + if { $number_of_members == 1 } { + # the task is individual + + set sql_query "select cu.person_id as party_id, cu.last_name||' - '||cu.first_names as party_name, + ese.grade, + ese.description as comments + from cc_users cu left outer join evaluation_student_evalsi ese on (ese.party_id = cu.person_id + and ese.task_id = :task_id + and content_revision__is_live(ese.evaluation_id) = true)" + } else { + # the task is in groups + + set sql_query "select etg.group_id as party_id, g.group_name as party_name, + ese.grade, + ese.description as comments + from groups g, + evaluation_task_groups etg left outer join evaluation_student_evalsi ese on (ese.party_id = etg.group_id + and ese.task_id = :task_id + and content_revision__is_live(ese.evaluation_id) = true) + where etg.task_id = :task_id + and etg.group_id = g.group_id" + } + + db_foreach parties_with_to_grade $sql_query { + lappend csv_content "\n$party_id" + lappend csv_content "$party_name" + lappend csv_content "$grade" + lappend csv_content "$comments" + } if_no_rows { + ad_return_error "No parties to grade" "In order to generate this file there must be some parties assigned to this task" + return + } + + set csv_formatted_content [join $csv_content ","] + + doc_return 200 text/csv " + $csv_formatted_content" +} + + +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/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/index.adp 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/index.adp 12 May 2004 02:07:45 -0000 1.2 @@ -31,4 +31,3 @@ - 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.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl 12 May 2004 02:07:45 -0000 1.2 @@ -5,9 +5,9 @@ @author jopez@galileo.edu @creation-date Mar 2004 + @cvs_id $Id$ } { task_id:integer,notnull - grade_id:integer,notnull,optional max_grade:integer,notnull,optional item_ids:array,integer,optional item_to_edit_ids:array,optional @@ -24,8 +24,29 @@ comments_na:array,optional show_student_na:array,optional - {return_url "student-list?[export_vars -url { task_id }]"} + 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))" + } + } + } + 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] { @@ -69,6 +90,14 @@ } } 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))" @@ -96,6 +125,53 @@ } } +if { ![empty_string_p $tmp_filename] } { + + set tmp_filename "${tmp_filename}_grades_sheet" + + 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 + + # 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] + + evaluation::set_live -revision_id $revision_id + } + } + } +} + db_transaction { foreach party_id [array names grades_wa] { if { ![info exists comments_wa($party_id)] } { @@ -146,5 +222,5 @@ } } -ad_returnredirect "$return_url" +ad_returnredirect "student-list?[export_vars { task_id } ]" 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 -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.tcl 12 May 2004 02:07:45 -0000 1.2 @@ -7,7 +7,6 @@ @creation-date Mar 2004 } { task_id:integer,notnull - grade_id:integer,notnull max_grade:integer,notnull item_ids:array,integer,optional item_to_edit_ids:array,integer,optional @@ -123,7 +122,7 @@ foreach party_id [array names show_student_wa] { if { [info exists grades_wa($party_id)] && ![empty_string_p $grades_wa($party_id)] } { incr counter - set party_name [db_string get_party_name { *SQL }] + set party_name [db_string get_party_name { *SQL* }] set evaluations_wa:${counter}(rownum) $counter set evaluations_wa:${counter}(party_name) $party_name set evaluations_wa:${counter}(grade) $grades_wa($party_id) Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.adp 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.adp 12 May 2004 02:07:45 -0000 1.2 @@ -3,11 +3,29 @@ @context;noquote@ -
+
-
+ +
+
+ + + + + + + + + + + + + +
Grade students using generated file:
Generate fileSee grades sheets associated with this taskHow does this work?
+
+

There are no grades to edit 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 -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.tcl 12 May 2004 02:07:45 -0000 1.2 @@ -75,4 +75,6 @@ } +set grades_sheet_item_id [db_nextval acs_object_id_seq] +ad_return_template Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-explanation.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-explanation.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-explanation.adp 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,41 @@ + +@page_title@ +@context;noquote@ + +

+ + This funcionallity allows you to upload a CSV (Comma Separated Value) file with the grades of the students. This CSV file can be edited with MS Excell and many other text editors.
+ + The file should have a pre-defined format so the system can parse it and obtain the information. If you want to use this functionallity you must follow the following steps:
+ +

    +
  1. + Generate the csv file from the system. This file has the proper structure so the system can parse it and obtain the information about the grades. This file is generated by clicking on the "Generate File" link. +
  2. +
  3. + Enter the grades for the students/groups and KEEP THE STRUCTURE of the file. If you are editing a grade, you MUST give an edit reason in the "Comments/Edit reason" field. +
      +
    • + The grade must be a REAL NUMBER. +
    • +
    • + The comments/edit reason is a string with no more than 4,000 characters. +
    • +
    • + Do NOT change the "party id" field because with this file we associate the grade with the student or group. +
    • +
    + If you do not want to grade or edit the grade of a student/group, just leave intact the fields of that row, or you can delete the whole row.
    + The system assumes that the grades start at the 7th line of the file. +
  4. +
  5. + Save the csv file and KEEP THE CSV FORMAT. The CSV file can be edited with any text editor (and MS Excell) but you have to save it keeping the CSV format. If you do not keep the format, the system will not be able to parse the file. +
  6. +
  7. + Send the file using the "Send file" botton. The system will parse the file and you will be asked for a confirmation (if everything is ok with the file) for the grades. +
  8. +
+ +You can see the csv files associated with the task by clicking on the "See grades sheets associated with this task" botton. + +

\ No newline at end of file Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-explanation.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-explanation.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-explanation.tcl 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,16 @@ +# /packages/evaluation/www/admin/evaluations/grades-sheet-explanation.tcl + +ad_page_contract { + + @author jopez@galileo.edu + @creation-date May 2004 + @cvs-id $Id: grades-sheet-explanation.tcl,v 1.1 2004/05/12 02:07:45 josee Exp $ + +} { + task_id:integer,notnull +} + +set page_title "Grades Sheet Explanation" +set context [list [list "[export_vars -base student-list { task_id }]" "Studen List"] "Grades Sheet Explanation"] + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse-postgresql.xql 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,45 @@ + + + + postgresql7.4 + + + + + select evaluation__party_name(:party_id,:task_id) + + + + + + + + select grade from evaluation_student_evals where party_id = :party_id and task_id = :task_id and content_revision__is_live(evaluation_id) = true + + + + + + + + select 1 from evaluation_student_evalsi where task_id = :task_id and party_id = :party_id and grade = :grade and description = :comments and content_revision__is_live(evaluation_id) = true + + + + + + + select 1 from evaluation_student_evalsi where task_id = :task_id and party_id = :party_id and grade = :grade and description is null and content_revision__is_live(evaluation_id) = true + + + + + + + + select evaluation_id from evaluation_student_evals where task_id = :task_id and party_id = :party_id and content_revision__is_live(evaluation_id) = true + + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.adp 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,27 @@ + +@page_title;noquote@ +@context;noquote@ + +

Confirm your evaluation(s) on "@task_name@"

+ + +
+ @export_vars;noquote@ +
+ + +
+ + + + + +
Name:@evaluations_gs.party_name@
Grade:@evaluations_gs.grade@ / @max_grade@
Comments/Edit reason:@evaluations_gs.comment@
Will the studen(s) be
able to see the grade?
@evaluations_gs.show_student@
+ + +
+ +
+
+There are no grades in the csv file or there are no modifications in the csv file. + \ No newline at end of file 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.tcl 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,191 @@ +# /packages/evaluation/www/admin/evaluations/grades-sheet-parse.tcl + +ad_page_contract { + + Parse the csv file with the grades or the parties for a given task + + @author jopez@galileo.edu + @creation_date May 2004 + @cvs_id $Id: grades-sheet-parse.tcl,v 1.1 2004/05/12 02:07:45 josee Exp $ +} { + upload_file:notnull + upload_file.tmpfile:notnull + task_id:integer,notnull + grades_sheet_item_id:integer,notnull +} -validate { + csv_type_p { + if { [string compare [string tolower [file extension $upload_file]] ".csv"] } { + ad_complain "The file extension of the file is "[file extension $upload_file]" and it should be .CSV, we can't process it" + } + } +} + +set page_title "Confirm Evaluation" +set context [list [list "[export_vars -base student-list { task_id }]" "Studen List"] "Confirm Evaluation"] + +# Getting some info from the db about the task +if ![db_0or1row get_task_info { *SQL* }] { + # This should never happen. + ad_return_complaint 1 "
  • There is no information about this task.
  • " + return + } + +set evaluations_gs:rowcount 0 + +# Double-click protection +if { ![db_string file_exists { *SQL* }] } { + + set max_n_bytes [parameter::get -parameter MaxNumberOfBytes] + + set tmp_filename [ns_queryget upload_file.tmpfile] + + if { ![empty_string_p $max_n_bytes] && ([file size "$tmp_filename"] > $max_n_bytes) } { + ad_return_complaint 1 "The file is too large. (The maximun file size is [util_commify_number $max_n_bytes] bytes)" + return 0 + } + + set errors 0 + set errors_text "" + set counter 0 + set line_number 0 + + set file_handler [open $tmp_filename {RDWR}] + + while { ![eof $file_handler] } { + incr line_number + set one_line [gets $file_handler] + + # jump first two lines + if { $line_number <= 2 } { + continue + } + + # replace enters (<-|) with semicolons (;) + regsub -all {(,[\r\n])} $one_line "" clean_line + regsub -all {[\r\n]} $clean_line "" clean_line + + set evaluation [split $clean_line ","] + + if { $line_number == 3 } { + set max_grade [string trim [lindex $evaluation 1]] + if { ![ad_var_type_check_number_p $max_grade] } { + ad_return_error "Invalid Max Grade" "Max Grade does not seem to be a real number. Please don't leave it blank." + return + } + continue + } elseif { $line_number == 4 } { + set see_comments_p [string trim [string tolower [lindex $evaluation 1]]] + # removing the first and last " that comes from the csv format + regsub ^\" $see_comments_p "" see_comments_p + regsub \"\$ $see_comments_p "" see_comments_p + if { ![string eq $see_comments_p yes] && ![string eq $see_comments_p no] } { + ad_return_error "Bad input" "Input \"Will the student be able to see the grade\" must be YES or NO, please don't leave it blank." + return + } elseif { [string eq $see_comments_p \"yes\"] } { + set comments_p "t" + } else { + set comments_p "f" + } + continue + } elseif { $line_number <= 6 } { + continue + } + + set party_id [string trim [lindex $evaluation 0]] + set party_name [db_string get_party_name { *SQL* }] + set grade [string trim [lindex $evaluation 2]] + set comments [string trim [lindex $evaluation 3]] + + # removing the first and last " that comes from the csv format + regsub ^\" $comments "" see_comments + regsub \"\$ $comments "" see_comments + + if { [empty_string_p $party_id] && [empty_string_p $grade] && [empty_string_p $comments] } { + # "blank" line, jump it + continue + } + + if { ![empty_string_p $grade] } { + # start validations + if { ![ad_var_type_check_integer_p $party_id] } { + incr errors + append errors_text "
  • Party_id $party_id does not seems to be an integer. Please don't modify this field.
  • " + } + + if { ![ad_var_type_check_number_p $grade] } { + incr errors + append errors_text "
  • Grade $grade does not seem to be a real number.
  • " + } + + if { [string length $comments] > 4000 } { + incr errors + append errors_text "
  • Comment/edit reason on party_id $party_id is larger than 4,000 characters long, which is our max lenght. Please make this comment/edit reason shorter.
  • " + } + + # editing without reason + if { [string compare [db_string check_evaluated { *SQL* } -default $grade] $grade] && [empty_string_p $comments] } { + incr errors + append errors_text "
  • There must be an edit reason if you want to edit the grade on party_id ${party_id}.
  • " + } + + if { $errors } { + ad_return_complaint $errors $errors_text + ad_script_abort + return + } + + if { ![empty_string_p $comments] } { + if { [db_string verify_grade_change { *SQL* } -default 0] } { + # there is no change, skip it + continue + } + } else { + if { [db_string verify_grade_change_wcomments { *SQL* } -default 0] } { + # there is no change, skip it + continue + } + } + + # validation checked, prepare data structures for next page + incr counter + + set grades_gs($party_id) $grade + set comments_gs($party_id) $comments + set show_student_gs($party_id) $comments_p + + set evaluations_gs:${counter}(rownum) $counter + set evaluations_gs:${counter}(party_name) $party_name + set evaluations_gs:${counter}(grade) $grade + set evaluations_gs:${counter}(comment) $comments + if { [string eq $comments_p "t"] } { + set evaluations_gs:${counter}(show_student) Yes + } else { + set evaluations_gs:${counter}(show_student) No + } + + set evaluation_id [db_string editing_p { *SQL* } -default 0] + if { $evaluation_id } { + set item_ids($party_id) [db_string get_item_id { *SQL* }] + set new_p_gs($party_id) 0 + } else { + set item_ids($party_id) [db_nextval acs_object_id_seq] + set new_p_gs($party_id) 1 + } + + } + } + 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 + + if [catch {exec mv $tmp_filename "${tmp_filename}_grades_sheet"} errmsg] { + ad_return_error "Error while storing file" "There was a problem storing the file. Please contact the administrator. +

    This was the error:

    $errmsg
    " + ad_script_abort + } +} + Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheet-parse.xql 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,32 @@ + + + + postgresql7.4 + + + + + select task_name + from evaluation_tasks et + where task_id=:task_id + + + + + + + + select count(*) from cr_items where item_id = :grades_sheet_item_id + + + + + + + + select item_id from evaluation_student_evalsi where evaluation_id = :evaluation_id + + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets-postgresql.xql 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,30 @@ + + + + postgresql7.4 + + + + + select count(*) from evaluation_grades_sheets where task_id = :task_id and content_revision__is_live(grades_sheet_id) = true + + + + + + + + select egs.title as grades_sheet_name, + to_char(egs.creation_date,'Month DD YYYY') as upload_date, + person__name(egs.creation_user) as upload_user, + egs.data as sheet_data, + egs.revision_id + from evaluation_grades_sheetsi egs + where egs.task_id = :task_id + and content_revision__is_live(egs.grades_sheet_id) = true + $orderby + + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets.adp 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,9 @@ + +@page_title;noquote@ +@context;noquote@ + +

    These are the grades sheets used to evaluate students for this task

    + +
    + + Index: openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/grades-sheets.tcl 12 May 2004 02:07:45 -0000 1.1 @@ -0,0 +1,71 @@ +# /packages/evaluation/www/admin/evaluations/grades-sheets.tcl + +ad_page_contract { + + List the grades sheets for the task + + @author jopez@galileo.edu + @creation-date May 2004 + @cvs-id $Id: grades-sheets.tcl,v 1.1 2004/05/12 02:07:45 josee Exp $ + +} -query { + {orderby:optional} + task_id:integer,notnull +} -validate { + grades_sheets { + if { ![db_string count_grades_sheets { *SQL* }] } { + ad_complain "There are no files associated with this task" + } + } +} + + +set page_title "Grades Sheets" +set context [list [list "[export_vars -base student-list { task_id }]" "Studen List"] "Grades Sheets"] + +set base_url [ad_conn package_url] + +template::list::create \ + -name grades_sheets \ + -multirow grades_sheets \ + -key grades_sheet_id \ + -filters { task_id {} } \ + -orderby { default_value grades_sheet_name } \ + -elements { + grades_sheet_name { + label "Grades Sheet Name" + orderby_asc {grades_sheet_name asc} + orderby_desc {grades_sheet_name desc} + } + upload_date { + label "Upload Date" + orderby_asc {upload_date asc} + orderby_desc {upload_date desc} + } + upload_user { + label "Uploaded by" + orderby_asc {upload_user asc} + orderby_desc {upload_user desc} + } + view { + label {} + sub_class narrow + display_template { + + } + link_url_col view_url + link_html { title "View grades sheet" } + } + } + +set orderby [template::list::orderby_clause -orderby -name grades_sheets] + +if {[string equal $orderby ""]} { + set orderby " order by grades_sheet_name asc" +} + +db_multirow -extend { view_url } grades_sheets get_grades_sheets { *SQL* } { + set view_url "[export_vars -base "${base_url}view/$grades_sheet_name" { revision_id }]" +} + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/evaluations/student-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/student-list.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/evaluations/student-list.adp 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list.adp 12 May 2004 02:07:45 -0000 1.2 @@ -28,30 +28,65 @@
    -
    + +
    +
    + + + + + + + + + + + + + +
    Grade students using generated file:
    Generate fileSee grades sheets associated with this taskHow does this work?
    +
    +

    There are no students to eval that already answered

    -

    Students who have not submitted answers and have not been evaluated (@not_evaluated_with_no_answer@)

    - - +
    -
    Grade students with 0
    +
    +
    +
    +
    + + + + + + + + + + + + + +
    Grade students using generated file:
    Generate fileSee grades sheets associated with this taskHow does this work?
    +
    +

    There are no students to eval with no answer

    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.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 28 Apr 2004 11:06:41 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 12 May 2004 02:07:45 -0000 1.2 @@ -176,8 +176,6 @@ set orderby_wa " order by party_name asc" } -ns_log Notice "los procesados son $processed_clause" - db_multirow -extend { answer answer_url } not_evaluated_wa get_not_evaluated_wa_students { *SQL* } { lappend done_students $party_id @@ -255,6 +253,7 @@ } +set grades_sheet_item_id [db_nextval acs_object_id_seq] Index: openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql 12 May 2004 02:07:45 -0000 1.2 @@ -52,7 +52,7 @@ select cu.first_names||', '||cu.last_name as student_name $sql_query from cc_users cu - order by student_name asc + $orderby Index: openacs-4/packages/evaluation/www/admin/grades/grades-reports.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-reports.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/grades/grades-reports.tcl 28 Apr 2004 11:06:42 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/grades/grades-reports.tcl 12 May 2004 02:07:45 -0000 1.2 @@ -9,6 +9,7 @@ @cvs-id $Id$ } { + {orderby ""} } -validate { grades_for_package { if { [string eq [db_string package_grades { *SQL* }] 0] } { @@ -23,7 +24,9 @@ set elements [list student_name \ [list label "Name" \ - link_url_col student_url ] \ + link_url_col student_url \ + orderby_asc {student_name asc} \ + orderby_desc {student_name desc}] \ ] db_foreach grade_type { *SQL* } { @@ -34,16 +37,28 @@ } lappend elements total_grade \ - [list label "Total Grade"] + [list label "Total Grade" \ + orderby_asc {total_grade asc} \ + orderby_desc {total_grade desc} \ + ] append sql_query [db_map class_total_grade] template::list::create \ -name grades_report \ -multirow grades_report \ -key grade_id \ - -elements $elements - -db_multirow grades_report grades_report { *SQL* } { + -elements $elements \ + -orderby { default_value student_name } +if { ![empty_string_p $orderby] } { + set orderby "[template::list::orderby_clause -orderby -name grades_report]" +} else { + set orderby " order by student_name asc" } + + + +db_multirow grades_report grades_report { *SQL* } { + +} Index: openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql 12 May 2004 02:07:45 -0000 1.2 @@ -21,7 +21,7 @@ select cu.first_names||', '||cu.last_name as student_name $sql_query from cc_users cu - order by student_name asc + $orderby Index: openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.tcl 28 Apr 2004 11:06:42 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.tcl 12 May 2004 02:07:45 -0000 1.2 @@ -9,6 +9,7 @@ @cvs-id $Id$ } { + {orderby ""} grade_id:integer,notnull } -validate { tasks_for_grade { @@ -24,27 +25,44 @@ set package_id [ad_conn package_id] set elements [list student_name \ - [list label "Name"]\ + [list label "Name" \ + orderby_asc {student_name asc} \ + orderby_desc {student_name desc} \ + ]\ ] db_foreach grade_task { *SQL* } { lappend elements task_$task_id \ - [list label "$task_name ($weight %)"] - + [list label "$task_name ($weight %)" \ + orderby_asc {task_$task_id asc} \ + orderby_desc {task_$task_id desc} \ + ] + append sql_query [db_map task_grade] } lappend elements total_grade \ - [list label "Total"] + [list label "Total" \ + orderby_asc {total_grade asc} \ + orderby_desc {total_grade desc} \ + ] append sql_query [db_map grade_total_grade] template::list::create \ -name grade_tasks \ -multirow grade_tasks \ -key task_id \ - -elements $elements + -filters { grade_id {} } \ + -elements $elements \ + -orderby { default_value student_name } +set orderby [template::list::orderby_clause -orderby -name grade_tasks] + +if { [string equal $orderby ""] } { + set task_order " order by student_name asc" +} + db_multirow grade_tasks get_grades { *SQL* } { } Index: openacs-4/packages/evaluation/www/admin/groups/group-rename.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-rename.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/groups/group-rename.tcl 28 Apr 2004 11:09:54 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/groups/group-rename.tcl 12 May 2004 02:07:46 -0000 1.2 @@ -4,18 +4,15 @@ Renames a group. @author jopez@galileo.edu - @createion-date Mar 2004 + @creation-date Mar 2004 @cvs-id $Id$ } { - task_id:integer,notnull - evaluation_group_id:integer,notnull + evaluation_group_id:integer + task_id:integer + group_name:notnull } -set package_id [ad_conn package_id] -set page_title "New Group" -set context [list [list "[export_vars -base one-task { task_id }]" "Task Groups"] [list "[export_vars -base one-group { task_id evaluation_group_id }]" "One Group"] "Rename Group"] +db_dml rename_group { *SQL* } -set group_name [evaluation::evaluation_group_name -group_id $evaluation_group_id] +ad_returnredirect "one-group?[export_vars -url { task_id evaluation_group_id }]" -set export_vars [export_vars -form { task_id evaluation_group_id }] - Index: openacs-4/packages/evaluation/www/admin/groups/group-reuse.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-reuse.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/groups/group-reuse.tcl 28 Apr 2004 11:09:54 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/groups/group-reuse.tcl 12 May 2004 02:07:46 -0000 1.2 @@ -24,7 +24,7 @@ orderby_asc {number_of_members asc} \ orderby_desc {number_of_members desc}] \ grade_name \ - [list label "Grade Type" \ + [list label "Task Type" \ orderby_asc {grade_name asc} \ orderby_desc {grade_name desc}] \ ] Index: openacs-4/packages/evaluation/www/admin/groups/one-group.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/one-group.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/groups/one-group.adp 28 Apr 2004 11:09:54 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/groups/one-group.adp 12 May 2004 02:07:46 -0000 1.2 @@ -2,18 +2,27 @@ @page_title;noquote@ @context;noquote@ + -
    - - - - - -
    -

    Number of Members
    of this group: - @number_of_members@

    -
    -
    +
    + @export_vars;noquote@ +
    + + + + + + + + + + + +
    Group name
    +

    Number of Members
    of this group: + @number_of_members@

    +
    +
    There are no studens associated with this group. Index: openacs-4/packages/evaluation/www/admin/groups/one-group.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/one-group.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/evaluation/www/admin/groups/one-group.tcl 28 Apr 2004 11:09:54 -0000 1.1 +++ openacs-4/packages/evaluation/www/admin/groups/one-group.tcl 12 May 2004 02:07:46 -0000 1.2 @@ -17,16 +17,13 @@ set page_title "One Group" set context [list [list "[export_vars -base one-task { task_id }]" "Task Groups"] "One Group"] - if { $number_of_members } { set group_name [evaluation::evaluation_group_name -group_id $evaluation_group_id] append page_title ": $group_name" } -set actions [list "Delete Group" [export_vars -base "group-delete" { evaluation_group_id task_id }] {} \ - "Rename Group" [export_vars -base "group-rename" { evaluation_group_id task_id }] {} - ] +set actions [list "Delete Group" [export_vars -base "group-delete" { evaluation_group_id task_id }] {}] set elements [list student_name \ [list label "Student Name" \ @@ -58,6 +55,8 @@ set desassociate_member "Desassociate member" } +set export_vars [export_vars -form { task_id evaluation_group_id }] + ad_return_template