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@
-
+
+
+
+
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:
+
+
+ -
+ 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.
+
+ -
+ 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.
+
+ -
+ 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.
+
+ -
+ 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.
+
+
+
+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@"
+
+
+