Index: openacs-4/packages/evaluation/evaluation.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/evaluation.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/evaluation.info 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,27 @@ + + + + + Evaluation + Evaluations + f + f + + + Jose Pablo Escobedo Del Cid + This package allows the users (professors and students) to use the system to submit and grade the tasks. + This package allows the professors and TAs to assign tasks to the students and to grade them, and to the students to upload their answers and see their grades. + + + + + + + + + + + + + + Index: openacs-4/packages/evaluation/lib/audit-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/audit-chunk-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/audit-chunk-postgresql.xql 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,23 @@ + + + + postgresql7.4 + + + + + select to_char(ese.last_modified, 'MM-DD-YYYY HH24:MI:SS') as last_modified, + ese.modifying_user, + ese.modifying_ip, + ese.description as comments, + ese.grade as task_grade, + content_revision__is_live(evaluation_id) as is_live + from evaluation_student_evalsx ese + where ese.task_id = :task_id + and ese.party_id = :party_id + order by evaluation__party_name(party_id,task_id), ese.evaluation_id desc + + + + + Index: openacs-4/packages/evaluation/lib/audit-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/audit-chunk.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/audit-chunk.adp 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,4 @@ + +
+ +
Index: openacs-4/packages/evaluation/lib/audit-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/audit-chunk.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/audit-chunk.tcl 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,45 @@ +ad_page_contract { + + Audit chunk for displaying audit info + +} + +set user_id [ad_conn user_id] + +template::list::create \ + -name grade_tasks \ + -multirow grade_tasks \ + -key task_name \ + -pass_properties { return_url } \ + -elements { + task_grade { + label "Name" + orderby_asc {task_grade asc} + orderby_desc {task_grade desc} + } + last_modified { + label "Last Modified" + orderby_asc {last_modified asc} + orderby_desc {last_modified desc} + } + modifying_user { + label "Modifying User" + orderby_asc {modifying_user asc} + orderby_desc {modifying_user desc} + } + comments { + label "Comments" + orderby_asc {comments asc} + orderby_desc {comments desc} + } + is_live { + label "Is live?" + orderby_asc {comments asc} + orderby_desc {comments desc} + } + } + + +db_multirow grade_tasks get_task_audit_info { *SQL* } { +} + Index: openacs-4/packages/evaluation/lib/confirm-delete-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/confirm-delete-form.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/confirm-delete-form.adp 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,16 @@ +
+@export_vars;noquote@ + + + + + + + +
+ +   + +
+ +
Index: openacs-4/packages/evaluation/lib/evaluations-chunk-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/Attic/evaluations-chunk-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/evaluations-chunk-postgresql.xql 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,55 @@ + + + + postgresql7.4 + + + + + select et.task_name, et.weight as task_weight, + et.task_id + from evaluation_tasksi et + where grade_id = :grade_id + and content_revision__is_live(et.task_id) = true + $orderby + + + + + + + + select et.task_name, + ese.grade, + ese.description as comments, + (et.weight*eg.weight)/100 as task_weight, + (ese.grade*et.weight*eg.weight)/10000 as task_grade, + et.number_of_members, + et.task_id, + ea.data as answer_data, + ea.title as answer_title, + ea.answer_id + from evaluation_grades eg, + evaluation_tasks et2 left outer join evaluation_student_evalsi ese on (ese.task_id = et2.task_id and content_revision__is_live(ese.evaluation_id) = true + and ese.party_id = evaluation__party_id(:user_id,et2.task_id)), + evaluation_tasks et left outer join evaluation_answersi ea on (ea.task_id = et.task_id and content_revision__is_live(ea.answer_id) = true + and ea.party_id = evaluation__party_id(:user_id,et.task_id)) + where eg.grade_id = :grade_id + and eg.grade_id = et.grade_id + and et.task_id = et2.task_id + and content_revision__is_live(et.task_id) = true + and content_revision__is_live(eg.grade_id) = true + $orderby + + + + + + + + select evaluation__party_id(:user_id,:task_id) + + + + + Index: openacs-4/packages/evaluation/lib/evaluations-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/evaluations-chunk.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/evaluations-chunk.adp 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,4 @@ + +
+
@bottom_line;noquote@ +
Index: openacs-4/packages/evaluation/lib/evaluations-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/evaluations-chunk.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/evaluations-chunk.tcl 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,120 @@ +ad_page_contract { + + evaluations chunk to be displayed in the index page + +} + +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] +#set admin_p 1 + +set base_url [ad_conn package_url] + +db_1row get_grade_info { *SQL* } + +set elements [list task_name \ + [list label "Name" \ + link_url_col task_url \ + orderby_asc {task_name asc} \ + orderby_desc {task_name desc}] \ + ] +if { $admin_p } { + #admin + lappend elements task_weight \ + [list label "Weight" \ + display_template {
@grade_tasks_admin.task_weight@%
} \ + orderby_asc {task_weight asc} \ + orderby_desc {task_weight desc}] + set multirow_name grade_tasks_admin + set actions [list "Edit grades distribution of $grade_name" [export_vars -base "${base_url}admin/grades/distribution-edit" { grade_id }]] +} else { + #student + lappend elements grade \ + [list label "Grade over 100" \ + display_template {
@grade_tasks.grade@
} \ + orderby_asc {grade asc} \ + orderby_desc {grade desc}] + lappend elements comments \ + [list label "Comments" \ + link_url_col comments_url \ + link_html { title "View evaluation comments" }] + lappend elements task_weight \ + [list label "Weight over 100%
of class grade" \ + display_template {
@grade_tasks.task_weight@%
} \ + orderby_asc {task_weight asc} \ + orderby_desc {task_weight desc}] + lappend elements answer \ + [list label "" \ + link_url_col answer_url \ + link_html { title "View my answer" }] + set multirow_name grade_tasks + set actions "" +} + +set total_grade 0.00 +set max_grade 0.00 + +template::list::create \ + -name grade_tasks \ + -multirow $multirow_name \ + -actions $actions \ + -key task_id \ + -pass_properties { return_url mode base_url } \ + -filters { grade_id } \ + -elements $elements + + +set orderby [template::list::orderby_clause -orderby -name grade_tasks] + +if { [string equal $orderby ""] } { + set orderby " order by task_name asc" +} + +db_multirow -extend { task_url } grade_tasks_admin get_tasks_admin { *SQL* } { + set task_url [export_vars -base "${base_url}admin/evaluations/student-list" { task_id grade_id }] +} + +db_multirow -extend { comments comments_url answer answer_url } grade_tasks get_grade_tasks { *SQL* } { + if { ![empty_string_p $comments] } { + set comments "View comments" + set comments_url evaluation_view + } + + if { ![empty_string_p $grade] } { + set grade [format %.2f $grade] + set total_grade [expr $total_grade + $task_grade] + } else { + set grade "Not evaluated" + } + + set task_weight [format %.2f $task_weight] + set max_grade [expr $task_weight + $max_grade] + + # working with answer stuff (if it has a file/url attached) + if { [empty_string_p $answer_data] } { + set answer_url "" + set answer "" + } elseif { [regexp "http://" $answer_data] } { + set answer_url "[export_vars -base "$answer_data" { }]" + set answer "View my answer" + } else { + # we assume it's a file + set answer_url "[export_vars -base "${base_url}view/$answer_title" { }]" + set answer "View my answer" + } + + if { $number_of_members > 1 && [string eq [db_string get_group_id { *SQL* }] 0] } { + set answer "" + set answer_url "" + set grade "No group for task" + } + +} + +if { $admin_p } { + set bottom_line "$grade_name represents $grade_weight % of the 100% of the class" +} else { + set bottom_line "Total points in this category: $total_grade / $max_grade
+ This grade category represents the $grade_weight% of the 100% of the class" +} Index: openacs-4/packages/evaluation/lib/evaluations-chunk.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/evaluations-chunk.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/evaluations-chunk.xql 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + + select grade_name, weight as grade_weight from evaluation_grades where grade_id = :grade_id + + + + + Index: openacs-4/packages/evaluation/lib/grades-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/Attic/grades-chunk.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/grades-chunk.adp 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1 @@ +jk Index: openacs-4/packages/evaluation/lib/grades-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/Attic/grades-chunk.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/grades-chunk.tcl 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,5 @@ +ad_page_contract { + + + +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/tasks-chunk-postgresql.xql 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,66 @@ + + + + postgresql7.4 + + + + + select et.task_name, et.number_of_members, et.task_id, + to_char(et.due_date,'Month DD YYYY') as pretty_due_date, et.online_p, et.late_submit_p, et.item_id, + et.requires_grade_p, et.description, et.grade_id, + cr.content_length, + et.data as task_data, + et.title as task_title, + et.task_id as revision_id, + ets.solution_id as solution_id + from cr_revisions cr, + evaluation_tasksi et left outer join evaluation_tasks_solsi ets on (ets.task_id = et.task_id and content_revision__is_live(ets.solution_id) = true) + where cr.revision_id = et.revision_id + and grade_id = :grade_id + and content_revision__is_live(et.task_id) = true + $orderby + + + + + + + + select et.task_name, et.number_of_members, et.task_id, + to_char(et.due_date,'Month DD YYYY') as pretty_due_date, et.online_p, et.late_submit_p, et.item_id, + et.due_date, + et.requires_grade_p, et.description, et.grade_id, + et.title as task_title, + et.data as task_data, + et.task_id as revision_id, + cr.content_length, + ea.answer_id as answer_id + from cr_revisions cr, + evaluation_tasksi et left outer join evaluation_answersi ea on (ea.task_id = et.task_id and content_revision__is_live(ea.answer_id) = true + and ea.party_id = evaluation__party_id(:user_id,et.task_id)) + where cr.revision_id = et.revision_id + and grade_id = :grade_id + and content_revision__is_live(et.task_id) = true + $orderby + + + + + + + + select evaluation__party_id(:user_id,:task_id) + + + + + + + + select grade_name from evaluation_grades where grade_id = :grade_id + + + + + Index: openacs-4/packages/evaluation/lib/tasks-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/lib/tasks-chunk.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/tasks-chunk.adp 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,3 @@ + +
+ 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/lib/tasks-chunk.tcl 28 Apr 2004 11:06:40 -0000 1.1 @@ -0,0 +1,175 @@ +ad_page_contract { + + task chunk to be displayed in the index page + +} + +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] +# set admin_p 1 + +set grade_name [db_string grade_name { *SQL* }] +set base_url [ad_conn package_url] + +set mode display +set return_url "[ad_conn url]?[export_vars { grade_id }]" + +set elements [list task_name \ + [list label "Name" \ + link_url_col task_url \ + orderby_asc {task_name asc} \ + orderby_desc {task_name desc}] \ + pretty_due_date \ + [list label "Due date" \ + orderby_asc {pretty_due_date asc} \ + orderby_desc {pretty_due_date desc}] \ + ] + +if { $admin_p } { + #admin + lappend elements solution \ + [list label "" \ + link_url_col solution_url \ + link_html { title "Add/edit solution" }] + lappend elements audit_info \ + [list label "" \ + link_url_col audit_info_url \ + link_html { title "Audit info" }] + lappend elements groups_admin \ + [list label "" \ + link_url_col groups_admin_url \ + link_html { title "Groups administration" }] + lappend elements view \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}admin/tasks/task-add-edit" { grade_id task_id return_url mode }]} \ + link_html { title "View task" }] + lappend elements edit \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}admin/tasks/task-add-edit" { return_url item_id grade_id task_id }]} \ + link_html { title "Edit task" }] + lappend elements delete \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}admin/tasks/task-delete" { grade_id task_id return_url }]} \ + link_html { title "Delete task" }] + + set multirow_name tasks_admin + set actions [list "Add $grade_name" [export_vars -base "${base_url}admin/tasks/task-add-edit" { return_url grade_id }] ] +} else { + #student + lappend elements answer \ + [list label "" \ + link_url_col answer_url \ + link_html { title "Add/edit answer" }] + lappend elements view \ + [list label "" \ + sub_class narrow \ + display_template {} \ + link_url_eval {[export_vars -base "${base_url}task-view" { grade_id task_id return_url }]} \ + link_html { title "View task" }] + set multirow_name tasks + set actions "" +} + +template::list::create \ + -name tasks \ + -multirow $multirow_name \ + -actions $actions \ + -key task_id \ + -pass_properties { return_url mode base_url } \ + -filters { grade_id {} } \ + -elements $elements + + +set orderby [template::list::orderby_clause -orderby -name tasks] + +if {[string equal $orderby ""]} { + set orderby " order by task_name asc" +} + +db_multirow -extend { solution_url solution solution_mode task_url audit_info audit_info_url groups_admin groups_admin_url } tasks_admin get_tasks_admin { *SQL* } { + # working with task stuff (if it has a file/url attached) + 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 "$task_name (No data)" + } elseif { [regexp "http://" $task_data] } { + set task_url "[export_vars -base "$task_data" { }]" + set task_name "$task_name (URL)" + } else { + # we assume it's a file + set task_url "[export_vars -base "${base_url}view/$task_title" { revision_id }]" + set task_name "$task_name ([format %.0f [expr ($content_length/1024)]] Kb)" + } + + if { ![empty_string_p $solution_id] } { + set solution_mode display + set solution_url "[export_vars -base "${base_url}admin/tasks/solution-add-edit" { grade_id task_id solution_id return_url solution_mode }]" + set solution "View/Edit Solution" + } else { + set solution_mode edit + set solution_url "[export_vars -base "${base_url}admin/tasks/solution-add-edit" { grade_id task_id return_url solution_mode }]" + set solution "Upload Solution" + } + + set audit_info_url "[export_vars -base "${base_url}admin/evaluations/audit-info" { grade_id task_id }]" + set audit_info "Audit Info." + + if { ![string eq $number_of_members 1] } { + set groups_admin_url "[export_vars -base "${base_url}admin/groups/one-task" { grade_id task_id }]" + set groups_admin "Groups Admin." + } + +} + +db_multirow -extend { task_url solution_url solution solution_mode answer answer_url } tasks get_tasks { *SQL* } { + set answer_mode display + + # working with task stuff (if it has a file/url attached) + 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 "$task_name (No data)" + } elseif { [regexp "http://" $task_data] } { + set task_url "[export_vars -base "$task_data" { }]" + set task_name "$task_name (URL)" + } else { + # we assume it's a file + set task_url "[export_vars -base "${base_url}view/$task_title" { revision_id }]" + set task_name "$task_name ([format %.0f [expr ($content_length/1024)]] Kb)" + } + + if { [string eq $online_p "t"] } { + if { ([template::util::date::compare $due_date [template::util::date::now]] > 0) } { + if { [empty_string_p $answer_id] } { + set answer "turn in" + 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 "turn in again" + 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"] } { + if { [empty_string_p $answer_id] } { + set answer "turn in " + 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 "turn in again" + 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 }]" + } + } + if { $number_of_members > 1 && [string eq [db_string get_group_id { *SQL* }] 0] } { + set answer "" + set answer_url "" + } + } + +} + 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/sql/postgresql/evaluation-create.sql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,1168 @@ +-- jopez@galileo.edu + +create table evaluation_grades ( + grade_id integer + constraint evaluation_grades_id_pk + primary key + constraint evaluation_grades_id_fk + references cr_revisions(revision_id), + grade_name varchar(100), + class_id integer + constraint evaluation_grades_cid_nn + not null + constraint evaluation_grades_cid_fk + references groups, + comments text, + -- percentage of this grade type in the class + weight numeric + constraint evaluation_grades_w_ck + check (weight between 0 and 100) +); + +create index evalutaion_grades_cid_index on evaluation_grades(class_id); + +select content_type__create_type ( + 'evaluation_grades', -- content_type + 'content_revision', -- super_type + 'Evaluation Grade', -- pretty_name + 'Evaluation Grades', -- pretty_plural + 'evaluation_grades', -- table_name + 'grade_id', -- id_column + null -- name_method +); + +create table evaluation_tasks ( + task_id integer + constraint evaluation_tasks_pk + primary key + constraint evaluation_tasks_fk + references cr_revisions(revision_id), + task_name varchar + constraint evaluation_tasks_tn_nn + not null, + -- we need to know if the task is in groups or not + number_of_members integer + constraint evaluation_tasks_nom_nn + not null + constraint evaluation_tasks_nom_df + default 1, + due_date timestamp, + grade_id integer + constraint evaluation_tasks_gid_fk + references evaluation_grades, + -- percentage of the grade of the course + weight integer, + -- the task will be submitted on line + online_p char(1) + constraint evaluation_tasks_onp_ck + check(online_p in ('t','f')), + -- will the students be able to submit late their answers? + late_submit_p char(1) + constraint evaluations_tasks_lsp_ck + check(late_submit_p in ('t','f')), + requires_grade_p char(1) + constraint evaluations_tasks_rgp_ck + check(late_submit_p in ('t','f')) +); + +create index evalutaion_tasks_gid_index on evaluation_tasks(grade_id); + +select content_type__create_type ( + 'evaluation_tasks', -- content_type + 'content_revision', -- super_type + 'Evaluation Task', -- pretty_name + 'Evaluation Tasks', -- pretty_plural + 'evaluation_tasks', -- table_name + 'task_id', -- id_column + null -- name_method +); + + +-- We need a way to group tasks because there may be the case when a professor/TA +-- would want to assign a task to more than one class, and the task must be +-- associated with the tasks of the other classes. + + +create table evaluation_tasks_class_map ( + class_id integer + constraint evaluations_tasks_cmap_cid_fk + references groups, + revision_id integer + constraint evaluations_tasks_cmap_fid_fk + references cr_revisions, + constraint evaluaition_tasks_cmap_pk + primary key (class_id, revision_id) +); + + +create table evaluation_tasks_sols ( + solution_id integer + primary key, + task_id integer + constraint evaluation_tsols_tid_fk + references evaluation_tasks +); + +-- crear indice para cada cosa que sea referenciada por otras tablas +create index evalutaion_tasks_sols_tid_index on evaluation_tasks_sols(task_id); + +select content_type__create_type ( + 'evaluation_tasks_sols', -- content_type + 'content_revision', -- super_type + 'Evaluation Task Solution', -- pretty_name + 'Evaluation Tasks Solutions', -- pretty_plural + 'evaluation_tasks_sols', -- table_name + 'solution_id', -- id_column + null -- name_method +); + +create table evaluation_answers ( + answer_id integer + primary key + references cr_revisions, + -- person/group to wich the answer belongs + party_id integer + constraint evaluation_sans_pid_nn + not null + constraint evaluation_sans_pid_fk + references parties(party_id), + task_id integer + constraint evaluation_sans_tid_fk + 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 ( + 'evaluation_answers', -- content_type + 'content_revision', -- super_type + 'Student Answer', -- pretty_name + 'Student Answers', -- pretty_plural + 'evaluation_answers', -- table_name + 'answer_id', -- id_column + null -- name_method +); + + +create table evaluation_student_evals ( + evaluation_id integer + constraint evaluation_stu_evals_pk + primary key + constraint evaluation_stu_evals_fk + references acs_objects(object_id), + task_id integer + constraint evaluation_stu_evals_tid_nn + not null + constraint evaluation_stu_evals_tid_fk + references evaluation_tasks, + -- must have student_id or team_id + party_id integer + constraint evaluation_stu_evals_pid_nn + not null + constraint evaluation_stu_evals_pid_fk + references parties(party_id), + grade numeric, + show_student_p char(1) + constraint evaluation_stu_evals_ssp_df + default 't' + constraint evaluation_stu_evals_ssp_ck + check (show_student_p in ('t','f')) +); + +create index evaluation_student_evals_tid_index on evaluation_student_evals(task_id); +create index evaluation_student_evals_pid_index on evaluation_student_evals(party_id); + +select content_type__create_type ( + 'evaluation_student_evals', -- content_type + 'content_revision', -- super_type + 'Student Evaluation', -- pretty_name + 'Student Evaluations', -- pretty_plural + 'evaluation_student_evals', -- table_name + 'evaluation_id', -- id_column + 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); + +select acs_object_type__create_type ( + 'evaluation_task_groups', --object type + 'Task Group', --pretty name + 'Tasks Groups', --pretty prural + 'acs_object', --supertype + 'evaluation_task_groups', --table_name + 'group_id', --id_column + null, --package_name + 'f', --abstract_p + null, --type_extension_table + null --name_method +); + +insert into group_types (group_type) values ('evaluation_task_groups'); + +insert into acs_object_type_tables + (object_type, table_name, id_column) + values + ('evaluation_task_groups', 'evaluation_task_groups', 'group_id'); + +select acs_attribute__create_attribute ( + 'evaluation_task_groups', --object_type + 'task_id', --oattribute_name + 'integer', --datatype + 'Task id', --pretty_name + 'Task ids', --pretty_plural + 'evaluation_task_groups', --table_name + 'task_id', --column_name + null, --default_value + 1, --min_n_values + 1, --max_n_values + null, --sort_order + 'type_specific', --storage + 'f' --static_p +); + +create function evaluation__new_item (integer,varchar,varchar,integer,integer,varchar,varchar,text,varchar,varchar,text,varchar,varchar,varchar) +returns integer as ' +declare + p_item_id alias for $1; + p_name alias for $2; + p_locale alias for $3; + p_creation_user alias for $4; + p_package_id alias for $5; + p_creation_ip alias for $6; + p_title alias for $7; + p_description alias for $8; + p_mime_type alias for $9; + p_nls_language alias for $10; + p_text alias for $11; + p_storage_type alias for $12; + p_item_subtype alias for $13; + p_content_type alias for $14; + + v_item_id integer; + v_parent_id integer; + v_id integer; +begin + + select content_item__get_id(p_content_type||''_''||p_package_id,null,''f'') + into v_parent_id + from dual; + -- + -- this will be used for 2xClick protection + if p_item_id is null then + select acs_object_id_seq.nextval + into v_id + from dual; + else + v_id := p_item_id; + end if; + + v_item_id := content_item__new( + p_name, -- name + v_parent_id, -- parent_id + v_id, -- item_id + p_locale, -- locale + current_timestamp, -- creation_date + p_creation_user, -- creation_user + p_package_id, -- context_id + p_creation_ip, -- creation_ip + p_item_subtype, -- item_subtype + p_content_type, -- content_type + p_title, -- title + p_description, -- description + p_mime_type, -- mime_type + p_nls_language, -- nls_language + p_text, -- text + p_storage_type -- storage_type + ); + + return v_item_id; +end; +' language 'plpgsql'; + +--------------------------------------- +-- GRADES +--------------------------------------- + +create function evaluation__new_grade (integer, integer, varchar, integer, numeric, varchar, timestamptz, integer, varchar, varchar, varchar, timestamptz, varchar, varchar) +returns integer as ' +declare + p_item_id alias for $1; + p_revision_id alias for $2; + p_grade_name alias for $3; + p_class_id alias for $4; + p_weight alias for $5; + p_object_type alias for $6; + p_creation_date alias for $7; + p_creation_user alias for $8; + p_creation_ip alias for $9; + p_title alias for $10; -- default null + p_description alias for $11; -- default null + p_publish_date alias for $12; + p_nls_language alias for $13; -- default null + p_mime_type alias for $14; -- default null + + v_revision_id integer; + +begin + + v_revision_id := content_revision__new( + p_title, -- title + p_description, -- 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 + (grade_id, + grade_name, + class_id, + comments, + weight) + values + (v_revision_id, + p_grade_name, + p_class_id, + p_description, + p_weight); + + return v_revision_id; +end; +' language 'plpgsql'; + +create function evaluation__delete_grade (integer) +returns integer as ' +declare + p_grade_id alias for $1; + del_rec record; +begin + + FOR del_rec IN + select task_id + from evaluation_tasks + where grade_id = p_grade_id + LOOP + 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; + END LOOP; + + delete from evaluation_tasks where grade_id = p_grade_id; + delete from evaluation_grades where grade_id = p_grade_id; + + PERFORM content_revision__delete(p_grade_id); + + return 0; + +end;' language 'plpgsql'; + +create function grade__name(integer) +returns varchar as ' +declare + p_grade_id alias for $1; + v_grade_name evaluation_grades.grade_name%TYPE; +begin + select grade_name into v_grade_name + from evaluation_grades + where grade_id = p_grade_id; + + return v_grade_name; +end; +' language 'plpgsql'; + +--------------------------------------- +-- TASKS +--------------------------------------- + +create function evaluation__new_task (integer, integer, varchar, integer, integer, varchar, numeric, timestamptz, char, char, char, 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_name alias for $3; + p_number_of_members alias for $4; + p_grade_id alias for $5; + p_description alias for $6; + p_weight alias for $7; + p_due_date alias for $8; + p_late_submit_p alias for $9; + p_online_p alias for $10; + p_requires_grade_p alias for $11; + p_object_type alias for $12; + p_creation_date alias for $13; + p_creation_user alias for $14; + p_creation_ip alias for $15; + p_title alias for $16; -- default null + p_publish_date alias for $17; + p_nls_language alias for $18; -- default null + p_mime_type alias for $19; -- default null + + v_revision_id integer; + +begin + + v_revision_id := content_revision__new( + p_title, -- title + p_description, -- 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_tasks + (task_id, + task_name, + number_of_members, + due_date, + grade_id, + weight, + online_p, + late_submit_p, + requires_grade_p) + values + (v_revision_id, + p_task_name, + p_number_of_members, + p_due_date, + p_grade_id, + p_weight, + p_online_p, + p_late_submit_p, + p_requires_grade_p); + + return v_revision_id; +end; +' language 'plpgsql'; + +create function evaluation__delete_task (integer) +returns integer as ' +declare + p_task_id alias for $1; + del_rec record; +begin + + 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_tasks where task_id = p_task_id; + + PERFORM content_revision__delete(p_task_id); + + return 0; + +end;' language 'plpgsql'; + +create function task__name(integer) +returns varchar as ' +declare + p_task_id alias for $1; + v_task_name evaluations_tasks.task_name%TYPE; +begin + select task_name into v_task_name + from evaluation_tasks + where task_id = p_task_id; + + return v_task_name; +end; +' language 'plpgsql'; + +--------------------------------------- +-- TASKS SOLUTIONS +--------------------------------------- + +create function evaluation__new_task_sol (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 + ''task solution'', -- 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_tasks_sols + (solution_id, + task_id) + values + (v_revision_id, + p_task_id); + + return v_revision_id; +end; +' language 'plpgsql'; + +create function evaluation__delete_task_sol (integer) +returns integer as ' +declare + p_solution_id alias for $1; +begin + + delete from evaluation_tasks_sols where solution_id = p_solution_id; + + PERFORM content_revision__delete(p_solution_id); + + return 0; + +end;' language 'plpgsql'; + + +--------------------------------------- +-- STUDENT ANSWERS +--------------------------------------- + + +create function evaluation__new_answer (integer, 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_party_id alias for $4; + p_object_type alias for $5; + p_creation_date alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + p_title alias for $9; -- default null + p_publish_date alias for $10; + p_nls_language alias for $11; -- default null + p_mime_type alias for $12; -- default null + + v_revision_id integer; + +begin + + v_revision_id := content_revision__new( + p_title, -- title + ''evaluation answer'', -- 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_answers + (answer_id, + task_id, + party_id) + values + (v_revision_id, + p_task_id, + p_party_id); + + return v_revision_id; +end; +' language 'plpgsql'; + + +create function evaluation__delete_answer (integer) +returns integer as ' +declare + p_answer_id alias for $1; +begin + + delete from evaluation_answers where answer_id = p_answer_id; + + PERFORM content_revision__delete(p_answer_id); + + return 0; + +end;' language 'plpgsql'; + +--------------------------------------- +-- STUDENT EVALUATIONS +--------------------------------------- + +create function evaluation__new_student_eval (integer, integer, integer, integer, numeric, char, text, 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_party_id alias for $4; + p_grade alias for $5; + p_show_student_p alias for $6; + p_description alias for $7; + p_object_type alias for $8; + p_creation_date alias for $9; + p_creation_user alias for $10; + p_creation_ip alias for $11; + p_title alias for $12; -- default null + p_publish_date alias for $13; + p_nls_language alias for $14; -- default null + p_mime_type alias for $15; -- default null + + v_revision_id integer; + +begin + + v_revision_id := content_revision__new( + p_title, -- title + p_description, -- 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_student_evals + (evaluation_id, + task_id, + party_id, + grade, + show_student_p) + values + (v_revision_id, + p_task_id, + p_party_id, + p_grade, + p_show_student_p); + + return v_revision_id; +end; +' language 'plpgsql'; + +create function evaluation__delete_student_eval (integer) +returns integer as ' +declare + p_evaluation_id alias for $1; +begin + + delete from evaluation_student_evals where evaluation_id = p_evaluation_id; + + PERFORM content_revision__delete(p_evaluation_id); + + return 0; + +end;' language 'plpgsql'; + +--------------------------------------- +-- EVALUATION TASK GROUPS +--------------------------------------- + +create function evaluation__new_evaluation_task_group(integer,varchar,varchar,timestamptz,integer,varchar,integer,integer) +returns integer as ' +declare + p_task_group_id alias for $1; + p_task_group_name alias for $2; + p_join_policy alias for $3; + p_creation_date alias for $4; + p_creation_user alias for $5; + p_creation_ip alias for $6; + p_context_id alias for $7; + p_task_id alias for $8; + + v_group_id integer; + +begin + + v_group_id := acs_group__new ( + p_task_group_id, + ''evaluation_task_groups'', + p_creation_date, + p_creation_user, + p_creation_ip, + null, + null, + p_task_group_name, + p_join_policy, + p_context_id + ); + + insert into evaluation_task_groups + (group_id, + task_id) + values + (v_group_id, + p_task_id); + + return v_group_id; +end; +' language 'plpgsql'; + + +create function evaluation__delete_evaluation_task_group(integer) +returns integer as ' +declare + p_task_group_id alias for $1; + del_rec record; +begin + + for del_rec in select evaluation_id from evaluation_student_evals where party_id = p_task_group_id + loop + PERFORM content_revision__delete(del_rec.evaluation_id); + end loop; + + for del_rec in select answer_id from evaluation_answers where party_id = p_task_group_id + loop + PERFORM content_revision__delete(del_rec.answer_id); + end loop; + + for del_rec in select rel_id from acs_rels where object_id_one = p_task_group_id + loop + PERFORM acs_rel__delete(del_rec.rel_id); + end loop; + + delete from evaluation_task_groups + where group_id = p_task_group_id; + + delete from groups where group_id = p_task_group_id; + + delete from parties where party_id = p_task_group_id; + + PERFORM acs_group__delete(p_task_group_id); + + return 0; +end; +' language 'plpgsql'; + +create table evaluation_user_profile_rels ( + rel_id integer + constraint evaluation_user_profile_rels_pk + primary key +); + +select acs_rel_type__create_type( + 'evaluation_task_group_rel', + 'Evaluation Task Group Member', + 'Evaluation Task Group Members', + 'membership_rel', + 'evaluation_user_profile_rels', + 'rel_id', + 'evaluations', + 'evaluation_task_groups', + null, + 0, + null, + 'user', + null, + 0, + 1 + ); + +--------------------------------------- +-- GRADE FUNCTIONS +--------------------------------------- + +create function evaluation__task_grade (integer, integer) +returns numeric as ' +declare + + p_user_id alias for $1; + p_task_id alias for $2; + + v_grade evaluation_student_evals.grade%TYPE; + +begin + + select (ese.grade*et.weight*eg.weight)/10000 into v_grade + from evaluation_student_evals ese, evaluation_tasks et, evaluation_grades eg + where party_id = evaluation__party_id(p_user_id, ese.task_id) + and ese.task_id = p_task_id + and ese.task_id = et.task_id + and et.grade_id = eg.grade_id; + + if v_grade is null then + return 0.00; + else + return v_grade; + end if; +end;' language 'plpgsql'; + +create function evaluation__grade_total_grade (integer, integer) +returns numeric as ' +declare + + p_user_id alias for $1; + p_grade_id alias for $2; + + v_grade evaluation_student_evals.grade%TYPE; + v_grades_cursor RECORD; + +begin + + v_grade := 0; + FOR v_grades_cursor IN + select (ese.grade*et.weight*eg.weight)/10000 as grade + from evaluation_grades eg, evaluation_tasks et, evaluation_student_evalsi ese + where et.task_id = ese.task_id + and et.grade_id = eg.grade_id + and et.grade_id = p_grade_id + and ese.party_id = evaluation__party_id(p_user_id,ese.task_id) + and content_revision__is_live(ese.evaluation_id) = true + and content_revision__is_live(et.task_id) = true + LOOP + v_grade := v_grade + v_grades_cursor.grade; + END LOOP; + + return v_grade; +end;' language 'plpgsql'; + +create function evaluation__class_total_grade (integer, integer) +returns numeric as ' +declare + + p_user_id alias for $1; + p_package_id alias for $2; + + v_grade evaluation_student_evals.grade%TYPE; + v_grades_cursor RECORD; + +begin + + v_grade := 0; + FOR v_grades_cursor IN + select (ese.grade*et.weight*eg.weight)/10000 as grade + from evaluation_gradesx eg, evaluation_tasks et, evaluation_student_evalsi ese, acs_objects ao + where et.task_id = ese.task_id + and et.grade_id = eg.grade_id + and eg.item_id = ao.object_id + and ao.context_id = p_package_id + and ese.party_id = evaluation__party_id(p_user_id,ese.task_id) + and content_revision__is_live(ese.evaluation_id) = true + and content_revision__is_live(eg.grade_id) = true + and content_revision__is_live(et.task_id) = true + LOOP + v_grade := v_grade + v_grades_cursor.grade; + END LOOP; + + return v_grade; +end;' language 'plpgsql'; + +--------------------------------------- +-- OTHER FUNCTIONS +--------------------------------------- + +create function evaluation__party_name (integer,integer) +returns varchar as ' +declare + p_party_id alias for $1; + p_task_id alias for $2; + + v_number_of_members evaluation_tasks.number_of_members%TYPE; +begin + + select number_of_members into v_number_of_members + from evaluation_tasks + where task_id = p_task_id; + + if v_number_of_members = 1 then + return person__last_name(p_party_id)||'', ''||person__first_names(p_party_id); + else + return acs_group__name(p_party_id); + end if; + +end;' language 'plpgsql'; + +create function evaluation__party_id (integer,integer) +returns varchar as ' +declare + p_user_id alias for $1; + p_task_id alias for $2; + + v_number_of_members evaluation_tasks.number_of_members%TYPE; +begin + + select number_of_members into v_number_of_members + from evaluation_tasks + where task_id = p_task_id; + + if v_number_of_members = 1 then + return p_user_id; + else + return coalesce((select etg.group_id from evaluation_task_groups etg, acs_rels map + where map.object_id_one = etg.group_id + and map.object_id_two = p_user_id + and etg.task_id = p_task_id),0); + end if; + +end;' language 'plpgsql'; + +create function evaluation__new_folder (varchar,varchar,text,integer,varchar) +returns varchar as ' +declare + p_name alias for $1; + p_label alias for $2; + p_description alias for $3; + p_parent_id alias for $4; + p_content_type alias for $5; + + v_folder_id cr_folders.folder_id%TYPE; + +begin + + v_folder_id := content_folder__new( + p_name, -- name + p_label, -- label + p_description, -- description + p_parent_id -- parent_id + ); + -- associate content types with the folder + PERFORM content_folder__register_content_type ( + v_folder_id, -- folder_id + ''evaluation_grades'', -- content_type + ''t'' -- include_subtypes + ); + PERFORM content_folder__register_content_type ( + v_folder_id, -- folder_id + p_content_type, -- content_type + ''t'' -- include_subtypes + ); + + return v_folder_id; +end;' language 'plpgsql'; + +create function evaluation__delete_contents (integer) +returns integer as ' +declare + + p_package_id alias for $1; + + v_item_id cr_items.item_id%TYPE; + v_item_cursor RECORD; + +begin + + -- 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 + and ao.context_id = p_package_id + LOOP + PERFORM evaluation__delete_answer(v_item_cursor.answer_id); + END LOOP; + + -- delete all contents + FOR v_item_cursor IN + select ets.solution_id + from evaluation_tasks_solsi ets, acs_objects ao + where ets.item_id = ao.object_id + and ao.context_id = p_package_id + LOOP + PERFORM evaluation__delete_task_sol(v_item_cursor.solution_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 + and etg.task_id = et.task_id + and ao.context_id = p_package_id + LOOP + PERFORM evaluation__delete_evaluation_task_group(v_item_cursor.group_id); + END LOOP; + + -- delete all contents + FOR v_item_cursor IN + select ese.evaluation_id + from evaluation_student_evalsi ese, acs_objects ao + where ese.item_id = ao.object_id + and ao.context_id = p_package_id + LOOP + PERFORM evaluation__delete_student_eval(v_item_cursor.evaluation_id); + END LOOP; + + -- delete all contents + FOR v_item_cursor IN + select et.task_id + from evaluation_tasksi et, acs_objects ao + where et.item_id = ao.object_id + and ao.context_id = p_package_id + LOOP + PERFORM evaluation__delete_task(v_item_cursor.task_id); + END LOOP; + + return 0; +end;' language 'plpgsql'; + +create function evaluation__delete_folder (integer,varchar) +returns integer as ' +declare + p_folder_id alias for $1; + p_content_type alias for $2; + + v_item_cursor RECORD; + +begin + + FOR v_item_cursor IN + select item_id + from cr_items + where parent_id = p_folder_id + LOOP + PERFORM content_item__delete(v_item_cursor.item_id); + END LOOP; + + -- unregister_content_types + PERFORM content_folder__unregister_content_type ( + p_folder_id, -- folder_id + ''content_revision'', -- content_type + ''t'' -- include_subtypes + ); + PERFORM content_folder__unregister_content_type ( + p_folder_id, -- folder_id + p_content_type, -- content_type + ''t'' -- include_subtypes + ); + + delete from cr_folder_type_map where content_type = p_content_type; + + -- delete folder + PERFORM content_folder__delete(p_folder_id); + + return 0; +end;' language 'plpgsql'; + +--------------------------------------- +-- TEMPLATES +--------------------------------------- + +create or replace function inline_0 () +returns integer as' +declare + template_id integer; +begin + + -- Create the (default) content type template + + template_id := content_template__new( + ''evaluation-tasks-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_tasks'', -- content_type + template_id, -- template_id + ''public'', -- use_context + ''t'' -- is_default + ); + + -- Create the (default) content type template + + template_id := content_template__new( + ''evaluation-tasks-sols-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_tasks_sols'', -- content_type + template_id, -- template_id + ''public'', -- use_context + ''t'' -- is_default + ); + + -- Create the (default) content type template + + template_id := content_template__new( + ''evaluation-answers-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_answers'', -- content_type + template_id, -- template_id + ''public'', -- use_context + ''t'' -- is_default + ); + + return null; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,237 @@ +-- jopez@galileo.edu + + +-- Unregister the content template +select content_type__unregister_template ( + 'evaluation_tasks', + content_type__get_template('evaluation_tasks','public'), + 'public' +); +-- Unregister the content template +select content_type__unregister_template ( + 'evaluation_tasks_sols', + content_type__get_template('evaluation_tasks_sols','public'), + 'public' +); +-- Unregister the content template +select content_type__unregister_template ( + 'evaluation_answers', + content_type__get_template('evaluation_answers','public'), + 'public' +); + +-- deleting templates +create function inline_0 () +returns integer as ' +declare + v_template_id cr_templates.template_id%TYPE; + v_item_cursor RECORD; + +begin + + FOR v_item_cursor IN + select template_id + from cr_templates, cr_items + where name=''evaluation-tasks-default'' + LOOP + PERFORM content_template__delete(v_item_cursor.template_id); + END LOOP; + + FOR v_item_cursor IN + select template_id + from cr_templates, cr_items + where name=''evaluation-tasks-sols-default'' + LOOP + PERFORM content_template__delete(v_item_cursor.template_id); + END LOOP; + + FOR v_item_cursor IN + select template_id + from cr_templates, cr_items + where name=''evaluation-answers-default'' + LOOP + PERFORM content_template__delete(v_item_cursor.template_id); + END LOOP; + + return 0; +end; +' language 'plpgsql'; + +select inline_0 (); +drop function inline_0 (); + + +create function inline_0 () +returns integer as' +declare + 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'') + loop + PERFORM content_item__delete(del_rec.item_id); + end loop; +return 0; +end;' language 'plpgsql'; +select inline_0 (); +drop function inline_0 (); + +create function inline_0 () +returns integer as' +declare + 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'') + loop + PERFORM content_item__delete(del_rec.item_id); + end loop; +return 0; +end;' language 'plpgsql'; +select inline_0 (); +drop function inline_0 (); + +delete from acs_objects where object_type = 'evaluation_grades'; +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_student_evals'; +delete from acs_objects where object_type = 'evaluation_task_groups'; +delete from acs_objects where object_type = 'evaluation_task_group_rel'; + +delete from acs_attributes where object_type = 'evaluation_task_groups'; +delete from acs_object_type_tables where object_type = 'evaluation_task_groups'; +delete from group_types where group_type = 'evaluation_task_groups'; + +select acs_object_type__drop_type('evaluation_task_group','f'); +select acs_rel_type__drop_type('evaluation_task_group_rel','t'); + +create function inline_1 () +returns integer as' +begin +PERFORM acs_object_type__drop_type(''evaluation_grades'',''f''); +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_student_evals'',''f''); +PERFORM acs_object_type__drop_type(''evaluation_task_groups'',''f''); + +return 0; +end;' language 'plpgsql'; +select inline_1 (); +drop function inline_1 (); + +drop index evalutaion_tasks_sols_tid_index; +drop view evaluation_tasks_solsi; +drop view evaluation_tasks_solsx; +drop table evaluation_tasks_sols; + +drop index evaluation_student_evals_tid_index; +drop index evaluation_student_evals_pid_index; +drop view evaluation_student_evalsi; +drop view evaluation_student_evalsx; +drop table evaluation_student_evals; + +drop view evaluation_answersi; +drop view evaluation_answersx; +drop table evaluation_answers; + +drop table evaluation_tasks_class_map; + +drop table evaluation_task_groups; + +drop view evaluation_tasksi; +drop view evaluation_tasksx; +drop table evaluation_tasks; + +drop view evaluation_gradesi; +drop view evaluation_gradesx; +drop table evaluation_grades; + +drop function evaluation__new_item (integer,varchar,varchar,integer,integer,varchar,varchar,text,varchar,varchar,text,varchar,varchar,varchar); + +--------------------------------------- +-- GRADES +--------------------------------------- + +drop function evaluation__new_grade (integer, integer, varchar, integer, numeric, varchar, timestamptz, integer, varchar, varchar, varchar, timestamptz, varchar, varchar); + +drop function evaluation__delete_grade (integer); + +drop function grade__name(integer); + +--------------------------------------- +-- TASKS +--------------------------------------- + +drop function evaluation__new_task (integer, integer, varchar, integer, integer, varchar, numeric, timestamptz, char, char, char, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); + +drop function evaluation__delete_task (integer); + +drop function task__name(integer); + +--------------------------------------- +-- TASKS SOLUTIONS +--------------------------------------- + +drop function evaluation__new_task_sol (integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); + +drop function evaluation__delete_task_sol (integer); + +--------------------------------------- +-- STUDENT ANSWERS +--------------------------------------- + +drop function evaluation__new_answer (integer, integer, integer, integer, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); + +drop function evaluation__delete_answer (integer); + +--------------------------------------- +-- STUDENT EVALUATIONS +--------------------------------------- + +drop function evaluation__new_student_eval (integer, integer, integer, integer, numeric, char, text, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar); + +drop function evaluation__delete_student_eval (integer); + +--------------------------------------- +-- EVALUATION TASK GROUPS +--------------------------------------- + +drop function evaluation__new_evaluation_task_group(integer,varchar,varchar,timestamptz,integer,varchar,integer,integer); + +drop function evaluation__delete_evaluation_task_group(integer); + +delete from acs_rels where rel_type = 'evaluation_task_group_rel'; + +drop table evaluation_user_profile_rels; + +select acs_rel_type__drop_type('evaluation_task_group_rel','t'); + +select acs_object_type__drop_type('evaluation_task_group_rel','f'); + +--------------------------------------- +-- GRADE FUNCIONS +--------------------------------------- + +drop function evaluation__task_grade (integer, integer); + +drop function evaluation__grade_total_grade (integer, integer); + +drop function evaluation__class_total_grade (integer, integer); + +--------------------------------------- +-- OTHER FUNCIONS +--------------------------------------- + +drop function evaluation__party_name (integer,integer); + +drop function evaluation__party_id (integer,integer); + +drop function evaluation__new_folder (varchar,varchar,text,integer,varchar); + +drop function evaluation__delete_contents (integer); + +drop function evaluation__delete_folder (integer,varchar); + + 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,269 @@ +# /packages/evaluation/tcl/apm-callback-procs.tcl + +ad_library { + + Evaluations Package APM callbacks library + + Procedures that deal with installing, instantiating, mounting. + + @creation-date Apr 2004 + @author jopez@galileo.edu + @cvs-id $Id: apm-callback-procs.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ +} + +namespace eval evaluation::apm_callbacks {} + +ad_proc -private evaluation::apm_callbacks::package_instantiate { + -package_id:required +} { + + Define Evaluation folders + +} { + + set creation_user [ad_verify_and_get_user_id] + set creation_ip [ad_conn peeraddr] + + db_transaction { + db_exec_plsql create_evaluation_folders { + select evaluation__new_folder ( + 'evaluation_grades_'||:package_id, + 'evaluation_grades_'||:package_id, + 'Evaluation grades folder', + null, + 'evaluation_grades' + ); + + select evaluation__new_folder ( + 'evaluation_tasks_'||:package_id, + 'evaluation_tasks_'||:package_id, + 'Evaluation tasks folder', + null, + 'evaluation_tasks' + ); + + select evaluation__new_folder ( + 'evaluation_tasks_sols_'||:package_id, + 'evaluation_tasks_sols_'||:package_id, + 'Evaluation tasks solutions folder', + null, + 'evaluation_tasks_sols' + ); + + select evaluation__new_folder ( + 'evaluation_answers_'||:package_id, + 'evaluation_answers_'||:package_id, + 'Evaluation answers folder', + null, + 'evaluation_answers' + ); + + select evaluation__new_folder ( + 'evaluation_student_evals_'||:package_id, + 'evaluation_student_evals_'||:package_id, + 'Evaluation student evaluations folder', + null, + 'evaluation_student_evals' + ); + } + + set creation_user [ad_verify_and_get_user_id] + set creation_ip [ad_conn peeraddr] + + set exams_item_id [db_nextval acs_object_id_seq] + set exams_item_name "evaluation_grades_${exams_item_id}" + set exams_revision_id [db_nextval acs_object_id_seq] + set exams_revision_name "evaluation_grades_${exams_revision_id}" + + db_exec_plsql exams_item_new { + select evaluation__new_item ( + :exams_item_id, --item_id + :exams_item_name, + null, + :creation_user, + :package_id, + :creation_ip, + 'Exams', + 'Exams for students', + 'text/plain', + null, + null, + 'text', + 'content_item', -- item_subtype + 'evaluation_grades' -- content_type + ); + } + + db_exec_plsql exams_revision_new { + select evaluation__new_grade ( + :exams_item_id, + :exams_revision_id, + 'Exams', + -1, -- class_id temporal + 40, + 'evaluation_grades', + now(), --creation date + :creation_user, + :creation_ip, + :exams_revision_name, + 'Exams for students', + now(), --publish date + null, --nls_language + 'text/plain' --mime_type + ); + } + + db_exec_plsql exams_live_revision { + select content_item__set_live_revision ( + :exams_revision_id + ); + } + + set projects_item_id [db_nextval acs_object_id_seq] + set projects_item_name "evaluation_grades_${projects_item_id}" + set projects_revision_id [db_nextval acs_object_id_seq] + set projects_revision_name "evaluation_grades_${projects_revision_id}" + + db_exec_plsql projects_item_new { + select evaluation__new_item ( + :projects_item_id, --item_id + :projects_item_name, + null, + :creation_user, + :package_id, + :creation_ip, + 'Projects', + 'Projects for students', + 'text/plain', + null, + null, + 'text', + 'content_item', -- item_subtype + 'evaluation_grades' -- content_type + ); + } + + db_exec_plsql projects_revision_new { + select evaluation__new_grade ( + :projects_item_id, + :projects_revision_id, + 'Projects', + -1, -- class_id temporal + 40, + 'evaluation_grades', + now(), --creation date + :creation_user, + :creation_ip, + :projects_revision_name, + 'Projects for students', + now(), --publish date + null, --nls_language + 'text/plain' --mime_type + ); + } + + db_exec_plsql projects_live_revision { + select content_item__set_live_revision ( + :projects_revision_id + ); + } + + set tasks_item_id [db_nextval acs_object_id_seq] + set tasks_item_name "evaluation_grades_${tasks_item_id}" + set tasks_revision_id [db_nextval acs_object_id_seq] + set tasks_revision_name "evaluation_grades_${tasks_revision_id}" + + db_exec_plsql tasks_item_new { + select evaluation__new_item ( + :tasks_item_id, --item_id + :tasks_item_name, + null, + :creation_user, + :package_id, + :creation_ip, + 'Tasks', + 'Tasks for students', + 'text/plain', + null, + null, + 'text', + 'content_item', -- item_subtype + 'evaluation_grades' -- content_type + ); + } + + db_exec_plsql tasks_revision_new { + select evaluation__new_grade ( + :tasks_item_id, + :tasks_revision_id, + 'Tasks', + -1, -- class_id temporal + 40, + 'evaluation_grades', + now(), --creation date + :creation_user, + :creation_ip, + :tasks_revision_name, + 'Tasks for students', + now(), --publish date + null, --nls_language + 'text/plain' --mime_type + ); + } + + db_exec_plsql tasks_live_revision { + select content_item__set_live_revision ( + :tasks_revision_id + ); + } + } +} + + +ad_proc -private evaluation::apm_callbacks::package_uninstantiate { + -package_id:required +} { + + Delete Evaluation stuff + +} { + + set ev_grades_fid [db_string get_f_id "select content_item__get_id('evaluation_grades_'||:package_id,null,'f')"] + set ev_tasks_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_'||:package_id,null,'f')"] + set ev_tasks_sols_fid [db_string get_f_id "select content_item__get_id('evaluation_tasks_sols_'||:package_id,null,'f')"] + set ev_answers_fid [db_string get_f_id "select content_item__get_id('evaluation_answers_'||:package_id,null,'f')"] + set ev_student_evals_fid [db_string get_f_id "select content_item__get_id('evaluation_student_evals_'||:package_id,null,'f')"] + + db_transaction { + db_exec_plsql delte_evaluation_folders { + select evaluation__delete_contents ( + :package_id + ); + + select evaluation__delete_folder ( + :ev_grades_fid, + 'evaluation_grades' + ); + + select evaluation__delete_folder ( + :ev_tasks_fid, + 'evaluation_tasks' + ); + + select evaluation__delete_folder ( + :ev_tasks_sols_fid, + 'evaluation_tasks_sols' + ); + + select evaluation__delete_folder ( + :ev_answers_fid, + 'evaluation_answers' + ); + + select evaluation__delete_folder ( + :ev_student_evals_fid, + 'evaluation_student_evals' + ); + } + } +} Index: openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,305 @@ + + + + postgresql7.4 + + + + + select evaluation__new_item ( + :item_id, --item_id + :item_name, + null, + :creation_user, + :package_id, + :creation_ip, + :name, + :description, + 'text/plain', + null, + null, + 'text', + 'content_item', -- item_subtype + 'evaluation_grades' -- content_type + ); + + + + + + + + select evaluation__new_grade ( + :item_id, + :revision_id, + :name, + -1, -- class_id temporal + :weight, + 'evaluation_grades', + now(), --creation date + :creation_user, + :creation_ip, + :revision_name, + :description, + now(), --publish date + null, --nls_language + 'text/plain' --mime_type + ); + + + + + + + + select content_item__set_live_revision ( + :revision_id + ); + + + + + + + + select evaluation__new_item ( + :item_id, --item_id + :item_name, + null, --locale + :creation_user, + :package_id, + :creation_ip, + :name, + :description, + :mime_type, --mime_type + null, --nls_language + null, --text + :storage_type, --storage_type + 'content_item', -- item_subtype + 'evaluation_tasks' -- content_type + ); + + + + + + + + select evaluation__new_task ( + :item_id, + :revision_id, + :name, + :number_of_members, + :grade_id, -- class_id temporal + :description, + :weight, + :due_date, + :late_submit_p, + :online_p, + :requires_grade_p, + 'evaluation_tasks', + now(), --creation date + :creation_user, + :creation_ip, + :item_name, + now(), --publish date + null, -- nls_language + :mime_type --mime_type + ); + + + + + + + + update cr_items + set name = :item_name, + storage_type = :storage_type + where item_id = :item_id + + + + + + + + select evaluation__new_item ( + :item_id, --item_id + :item_name, + null, --locale + :creation_user, + :package_id, + :creation_ip, + :title, + 'task solution', + :mime_type, --mime_type + null, --nls_language + null, --text + :storage_type, --storage_type + 'content_item', -- item_subtype + 'evaluation_tasks_sols' -- content_type + ); + + + + + + + + select evaluation__new_task_sol ( + :item_id, + :revision_id, + :task_id, + 'evaluation_tasks_sols', + now(), --creation date + :creation_user, + :creation_ip, + :item_name, + now(), --publish date + null, -- nls_language + :mime_type --mime_type + ); + + + + + + + + update cr_items + set name = :item_name, + storage_type = :storage_type + where item_id = :item_id + + + + + + + + select evaluation__new_item ( + :item_id, --item_id + :item_name, + null, --locale + :creation_user, + :package_id, + :creation_ip, + :title, + 'evaluation answer', + :mime_type, --mime_type + null, --nls_language + null, --text + :storage_type, --storage_type + 'content_item', -- item_subtype + 'evaluation_answers' -- content_type + ); + + + + + + + + select evaluation__new_answer ( + :item_id, + :revision_id, + :task_id, + :party_id, + 'evaluation_answers', + now(), --creation date + :creation_user, + :creation_ip, + :item_name, + now(), --publish date + null, -- nls_language + :mime_type --mime_type + ); + + + + + + + + update cr_items + set name = :item_name, + storage_type = :storage_type + where item_id = :item_id + + + + + + + + select evaluation__new_item ( + :item_id, --item_id + :item_name, + null, --locale + :creation_user, + :package_id, + :creation_ip, + :title, + 'student evaluation', + :mime_type, --mime_type + null, --nls_language + null, --text + :storage_type, --storage_type + 'content_item', -- item_subtype + 'evaluation_student_evals' -- content_type + ) where not exists (select 1 from cr_items where item_id = :item_id); + + + + + + + + select evaluation__new_student_eval ( + :item_id, + :revision_id, + :task_id, + :party_id, + :grade, + :show_student_p, + :description, + 'evaluation_student_evals', + now(), --creation date + :creation_user, + :creation_ip, + :item_name, --title + now(), --publish date + null, -- nls_language + :mime_type --mime_type + ); + + + + + + + + select evaluation__new_evaluation_task_group ( + :group_id, + :group_name, + 'closed', + now(), + :creation_user, + :creation_ip, + :context, + :task_id + ); + + + + + + + + select acs_group__name(:group_id) as group_name + + + + + 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,390 @@ +ad_library { + Procedures in the evaluation namespace. + + @creation-date Feb 2004 + @author jopez@galileo.edu + @cvs-id $Id: evaluation-procs.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ +} + +namespace eval evaluation {} + +##### +# +# evaluation namespace +# +##### + + +ad_proc -public evaluation::package_key {} { + return "evaluation" +} + + +ad_proc -public evaluation::make_url { + -file_name_from_db:required +} { + if { [regexp "view" $file_name_from_db] } { + return $file_name_from_db + } elseif { [regexp "http://" $file_name_from_db] } { + return $file_name_from_db + } else { + return $file_name_from_db + } +} + + +ad_proc -public evaluation::new_grade { + -item_id:required + -content_type:required + -content_table:required + -content_id:required + -new_item_p:required + -description:required + -weight:required + -name:required +} { + + Build a new content revision of a evaluation subtype. If new_item_p is + set true then a new item is first created, otherwise a new revision is created for + the item indicated by item_id. + + @param item_id The item to update or create. + @param content_type The type to make + @param content_table + @param new_item_p If true make a new item using item_id + +} { + + set package_id [ad_conn package_id] + set creation_user [ad_verify_and_get_user_id] + set creation_ip [ad_conn peeraddr] + + set item_name "${content_type}_${item_id}" + + set revision_id [db_nextval acs_object_id_seq] + set revision_name "${content_type}_${revision_id}" + + if { $new_item_p } { + db_exec_plsql content_item_new { *SQL* } + + } + + db_exec_plsql content_revision_new { *SQL* } + + return $revision_id +} + + +ad_proc -public evaluation::set_live { + -revision_id:required +} { + + Makes a live revision of the revision_id provided. + + @param revision_id The revision to set live. +} { + db_exec_plsql content_set_live_revision { *SQL* } + return +} + + + +ad_proc -private evaluation::export_entire_form_except { args } { + Exports all but part of a form +} { + # exports entire form except the variables specified in args + set hidden "" + set the_form [ns_getform] + if {![empty_string_p $the_form]} { + for {set i 0} {$i<[ns_set size $the_form]} {incr i} { + set varname [ns_set key $the_form $i] + if { [lsearch -exact $args $varname] == -1 } { + set varvalue [ns_set value $the_form $i] + append hidden "\n" + } + } + } + return $hidden +} + + +ad_proc -private evaluation::now_plus_days { -ndays } { + Create a new Date object for the current date and time + plus the number of days given + with the default interval for minutes + + @author jopez@galileo.edu + @creation-date Mar 2004 +} { + set now [list] + foreach v [clock format [clock seconds] -format "%Y %m %d %H %M %S"] { + lappend now [template::util::leadingTrim $v] + } + + set day [lindex $now 2] + set month [lindex $now 1] + set interval_def [template::util::date::defaultInterval day] + for { set i [lindex $interval_def 0] } { $i <= 15 } { incr i 1 } { + incr day + if { [expr $day + $i] >= [lindex $interval_def 1] } { + incr month 1 + set day 1 + } + } + + # replace the hour and minute values in the now list with new values + set now [lreplace $now 2 2 $day] + set now [lreplace $now 1 1 $month] + + return [eval template::util::date::create $now] +} + +ad_proc -public evaluation::new_task { + -item_id:required + -content_type:required + -content_table:required + -content_id:required + -new_item_p:required + -name:required + -grade_id:required + -number_of_members:required + -requires_grade_p:required + -storage_type:required + {-online_p ""} + {-due_date ""} + {-weight:required ""} + {-late_submit_p ""} + {-description ""} + {-title ""} + {-mime_type "text/plain"} + {-item_name ""} +} { + + Build a new content revision of a task. 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 grade_id Grade type where the task belongs + @param name The name of the task + @number_of_members If the task is in groups this parameter must be > 1 + @param online_p If the task will be submited online + @due_date Due date of the task + @weight Weight of the task in the grade type + @late_submit_p If the students will be able to submit the task after due date + @description Description of the task + @storage_type File or text, depending on what are we going to store + +} { + + set package_id [ad_conn package_id] + set creation_user [ad_verify_and_get_user_id] + set creation_ip [ad_conn peeraddr] + + if { [empty_string_p $item_name] } { + 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* } + + # in order to find the file we have to set the name in cr_items the same that in cr_revisions + db_dml update_item_name { *SQL* } + return $revision_id +} + + +ad_proc -public evaluation::new_solution { + -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 "text/plain"} +} { + + Build a new content revision of a task solution. 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 solution + @param title The name of the task solution + @param storage_type lob or text, depending on what are we going to store + +} { + + 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* } + + # in order to find the file we have to set the name in cr_items the same that in cr_revisions + db_dml update_item_name { *SQL* } + return $revision_id +} + + +ad_proc -public evaluation::new_answer { + -item_id:required + -content_type:required + -content_table:required + -content_id:required + -new_item_p:required + -task_id:required + -storage_type:required + -title:required + -party_id:required + {-mime_type "text/plain"} +} { + + Build a new content revision of an answer. 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 answer + @param title The name of the task solution + @param storage_type lob or text, depending on what are we going to store + @param party_id Group or user_id thaw owns the anser +} { + + 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* } + + # in order to find the file we have to set the name in cr_items the same that in cr_revisions + db_dml update_item_name { *SQL* } + return $revision_id +} + +ad_proc -public evaluation::new_evaluation { + -item_id:required + -content_type:required + -content_table:required + -content_id:required + -new_item_p:required + -party_id:required + -task_id:required + -grade:required + {-title "evaluation"} + {-show_student_p "t"} + {-storage_type "text"} + {-description ""} + {-mime_type "text/plain"} +} { + + Build a new content revision of an evaluation. 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 been evaluated + @param party_id Party been evaluated + @param grade Grade of the evaluation + @param show_student_p If the student(s) will be able to see the grade + @param storage_type lob or text, depending on what are we going to store + @param description Comments on the evaluation + @param mime_type Mime type of the evaluation. +} { + + 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* } + +} + +ad_proc -public evaluation::new_evaluation_group { + -group_id:required + -group_name:required + -task_id:required + {-context ""} +} { + + Build a new group of type evlaution_groups for the tasks. + This procedure is just a wrapper for the pl/sql function evaluation.new_evalatuion_group + which uses the acs_group.new funcion. + + @param group_id The group_id that will be created. + @param group_key Key for the group. + @param pretty_name + @param task_id The task that will be done by the group. + @param context_id If not provided, it will be the package_id. + +} { + + if { [empty_string_p $context] } { + set context [ad_conn package_id] + } + set creation_user [ad_verify_and_get_user_id] + set creation_ip [ad_conn peeraddr] + + db_exec_plsql evaluation_group_new { *SQL* } + + return $group_id +} + +ad_proc -public evaluation::evaluation_group_name { + -group_id:required +} { + + @param group_id + +} { + + return [db_exec_plsql evaluation_group_name { *SQL* }] + +} + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/answer-add-edit-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,45 @@ + + + + postgresql7.4 + + + + + select evaluation__party_id(:user_id,:task_id) + + + + + + + + select crr.title, crr.item_id + from evaluation_answers ea, cr_revisions crr + where ea.answer_id = :answer_id + and crr.revision_id = ea.answer_id + + + + + + + + update cr_revisions + set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] + where revision_id = :revision_id + + + + + + + + update cr_revisions + set content = :url + where revision_id = :revision_id + + + + + Index: openacs-4/packages/evaluation/www/answer-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/answer-add-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/answer-add-edit.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,5 @@ + + @page_title;noquote@ + @context;noquote@ + +

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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/answer-add-edit.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,120 @@ +# /packages/evaluation/www/answer-add-edit.tcl + +ad_page_contract { + Page for editing and adding answers. + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: answer-add-edit.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ +} { + task_id:integer,notnull + grade_id:integer,notnull + answer_id:integer,notnull,optional + item_id:integer,notnull,optional + upload_file:trim,optional + upload_file.tmpfile:tmpfile,optional +} + +set user_id [ad_conn user_id] +set party_id [db_string get_party_id { *SQL* }] + +set package_id [ad_conn package_id] +set return_url "task-list?[export_vars { grade_id }]" + +if { [ad_form_new_p -key answer_id] } { + set page_title "Upload Answer" +} else { + set page_title "Change Answer" + db_1row item_data { *SQL* } + +} + +set context [list $page_title] + +ad_form -html { enctype multipart/form-data } -name answer -cancel_url $return_url -export { item_id grade_id task_id attached_p } -form { + + answer_id:key + +} + +ad_form -extend -name answer -form { + + {upload_file:file,optional + {label "File"} + {html "size 30"} + } + {url:text(text),optional + {label "URL"} + {value "http://"} + } +} + +ad_form -extend -name answer -form { + +} -edit_request { + + db_1row item_data { *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]) } + {Upload a file OR a valid url, and not both } + } + {upload_file + { ([string eq $url "http://"] && ![empty_string_p $upload_file]) || (![string eq $url "http://"] && [empty_string_p $upload_file]) } + {Upload a file OR a url, and not both} + } +} -on_submit { + + db_transaction { + + set mime_type "text/plain" + set title "" + set storage_type text + if { ![empty_string_p $upload_file] } { + + # Get the filename part of the upload file + if { ![regexp {[^//\\]+$} $upload_file filename] } { + # no match + set filename $upload_file + } + + set title [template::util::file::get_property filename $upload_file] + set mime_type [cr_filename_to_mime_type -create $title] + + set storage_type lob + } elseif { ![string eq $url "http://"] } { + set mime_type "text/plain" + set title "link" + set storage_type text + } + + if { [ad_form_new_p -key answer_id] } { + set item_id $answer_id + } + + set revision_id [evaluation::new_answer -new_item_p [ad_form_new_p -key answer_id] -item_id $item_id -content_type evaluation_answers \ + -content_table evaluation_answers -content_id answer_id -storage_type $storage_type -task_id $task_id \ + -title $title -mime_type $mime_type -party_id $party_id] + + evaluation::set_live -revision_id $revision_id + + if { ![empty_string_p $upload_file] } { + + set tmp_file [template::util::file::get_property tmp_filename $upload_file] + + # create the new item + db_dml lob_content { *SQL* } -blob_files [list $tmp_file] + + } elseif { ![string eq $url "http://"] } { + + db_dml link_content { *SQL* } + + } + } + + ad_returnredirect "$return_url" + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/evaluation/www/evaluation-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/evaluation-list-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/evaluation-list-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,43 @@ + + + + postgresql7.4 + + + + + select eg.grade_name, + eg.grade_id + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id = :package_id + order by grade_name desc + + + + + + + + + select evaluation__class_total_grade(:user_id,:package_id) + + + + + + + + select sum(et.weight*eg.weight)/100 + from evaluation_gradesi eg, evaluation_tasks et, acs_objects ao + where eg.grade_id = et.grade_id + and eg.item_id = ao.object_id + and ao.context_id = :package_id + and content_revision__is_live(eg.grade_id) = true + and content_revision__is_live(et.task_id) = true + + + + + \ No newline at end of file Index: openacs-4/packages/evaluation/www/evaluation-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/evaluation-list.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/evaluation-list.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,13 @@ + +@page_title;noquote@ +@context;noquote@ + + +
    + +
  • @grades.grade_name@
    + +
  • +
    +
+@actions;noquote@ Index: openacs-4/packages/evaluation/www/evaluation-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/evaluation-list.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/evaluation-list.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,32 @@ +# /packages/evaluation/www/task-list.tcl + +ad_page_contract { + + Display the evaluations for the group + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: evaluation-list.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ + +} -query { + {orderby:optional} +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] +#set admin_p 0 + +if { $admin_p } { + set actions "Grade Distribution" +} else { + set actions "Total current grade: [format %.2f [db_string total_grade { *SQL* }]] / [format %.2f [db_string max_grade { *SQL* }]]" +} + +set page_title "Evaluations List" +set context "Evaluations List" + +db_multirow grades get_grades { *SQL* } { +} + + Index: openacs-4/packages/evaluation/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/index-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,20 @@ + + + + postgresql7.4 + + + + + select eg.grade_name, + eg.grade_id + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id = :package_id + order by grade_name desc + + + + + Index: openacs-4/packages/evaluation/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/index.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,34 @@ + +@page_title;noquote@ +@context;noquote@ + + + Evaluations Admin + + +

Tasks

+
    + +
  • There are no tasks for this package.
  • +
    + +
  • @grades.grade_name@
    + +
  • +
    +
    +
+
+

Evaluations

+
    + +
  • There are no tasks to evaluate for this package.
  • +
    + +
  • @grades.grade_name@
    + +
  • +
    +
    +
+ Index: openacs-4/packages/evaluation/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/index.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,26 @@ +# /package/evaluation/www/index.tcl + +ad_page_contract { + + Index page for evaluation package + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: index.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ + +} + +set page_title "Evaluation Index" +set context {} +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] + +set package_id [ad_conn package_id] + +db_multirow grades get_grades { *SQL* } { + +} + +ad_return_template \ No newline at end of file Index: openacs-4/packages/evaluation/www/task-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/task-list-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/task-list-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,20 @@ + + + + postgresql7.4 + + + + + select eg.grade_name, + eg.grade_id + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id = :package_id + order by grade_name desc + + + + + Index: openacs-4/packages/evaluation/www/task-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/task-list.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/task-list.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,13 @@ + +@page_title;noquote@ +@context;noquote@ + + +
    + +
  • @grades.grade_name@
    + +
  • +
    +
+ Index: openacs-4/packages/evaluation/www/task-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/task-list.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/task-list.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,30 @@ +# /packages/evaluation/www/task-list.tcl + +ad_page_contract { + + Displays the tasks with different options depending on the user's role + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: task-list.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ + +} -query { + {orderby:optional} +} + +set package_id [ad_conn package_id] +# [permission::permission_p -party_id $user_id -object_id $package_id -privilege read] + +db_multirow grades get_grades { *SQL* } { + +} + +set page_title "Tasks List" +set context "Tasks List" + + +ad_return_template + + + + Index: openacs-4/packages/evaluation/www/task-view-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/task-view-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/task-view-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,26 @@ + + + + postgresql7.4 + + + + + select et.task_name, et.number_of_members, + et.due_date, et.weight, et.online_p, + et.late_submit_p, et.requires_grade_p, + et.description, + et.title as task_title, + et.data as task_data, + ets.title as solution_title, + ets.data as solution_data, + eg.grade_name, eg.weight as grade_weight + from evaluation_grades eg, evaluation_tasksi et + left outer join evaluation_tasks_solsi ets on (ets.task_id = et.task_id and content_revision__is_live(ets.solution_id) = true) + where et.task_id = :task_id + and et.grade_id = eg.grade_id + + + + + Index: openacs-4/packages/evaluation/www/task-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/task-view.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/task-view.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,50 @@ + +@page_title;noquote@ +@context;noquote@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Task Name + @task_name@
Description + @description;noquote@
Due Date + @due_date@
File/url associated + @task_url@
Number of Integrants + @number_of_members@
Weight + @weight@%
Grades Category + @grade_name@ - @grade_weight@%
Will this task be submitted on line? + @online_p@
Will the students be able
to submit their answers after due date?
+ @late_submit_p@
Task Solution + @solution_url;noquote@
+ + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/task-view.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,58 @@ +# /packages/evaluation/www/task-view.tcl + +ad_page_contract { + Page for viewing tasks. + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: task-view.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ +} { + grade_id:integer,notnull + task_id:integer,notnull,optional + item_id:integer,notnull,optional +} + +set package_id [ad_conn package_id] +set return_url "task-list?[export_vars { grade_id }]" +set page_title "View Task" + +db_1row get_grade_info { *SQL* } + +set context [list $page_title] + +db_1row get_task_info { *SQL* } + +if { [string eq $online_p "1"] || [string eq $online_p "t"] } { + set online_p "Yes" +} else { + set online_p "No" +} + +if { [string eq $late_submit_p "1"] || [string eq $late_submit_p "t"]} { + set late_submit_p "Yes" +} else { + set late_submit_p "No" +} + +#set description [template::util::richtext::get_property contents $description] +# working with task stuff (if it has a file/url attached) +if { [empty_string_p $task_data] } { + set task_url "No file/url associated with this task" +} elseif { [regexp "http://" $task_data] } { + set task_url "$task_data" +} else { + # we assume it's a file + set task_url "$task_title" +} + +# working with task soluiton stuff (if it has a file/url attached) +if { [empty_string_p $solution_data] } { + set solution_url "No file/url associated with this task solution" +} elseif { [regexp "http://" $solution_data] } { + set solution_url "$solution_data" +} else { + # we assume it's a file + set solution_url "$solution_title" +} + +ad_return_template Index: openacs-4/packages/evaluation/www/task-view.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/task-view.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/task-view.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + + select grade_name, weight as grade_weight from evaluation_grades where grade_id = :grade_id + + + + + Index: openacs-4/packages/evaluation/www/admin/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/index-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,20 @@ + + + + postgresql7.4 + + + + + select eg.grade_name, + eg.grade_id + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id = :package_id + order by grade_name desc + + + + + Index: openacs-4/packages/evaluation/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/index.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,39 @@ + +@page_title;noquote@ +@context;noquote@ + +

Assignment Types

+ + +

Tasks

+
    + +
  • There are no tasks for this package.
  • +
    + +
  • @grades.grade_name@
    + +
  • +
    +
    +
+
+

Evaluations

+
    + +
  • There are no tasks to evaluate for this package.
  • +
    + +
  • @grades.grade_name@
    + +
  • +
    +
    +
+
+

Grades Reports

+ \ No newline at end of file Index: openacs-4/packages/evaluation/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/index.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,23 @@ +# /package/evaluation/www/index.tcl + +ad_page_contract { + + Index page for evaluation package + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: index.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ + +} + +set page_title "Evaluation Index" +set context {} + +set package_id [ad_conn package_id] +# [permission::permission_p -party_id $user_id -object_id $package_id -privilege read] + +db_multirow grades get_grades { *SQL* } { + +} + +ad_return_template \ No newline at end of file Index: openacs-4/packages/evaluation/www/admin/evaluations/audit-info-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/audit-info-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/audit-info-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,18 @@ + + + + postgresql7.4 + + + + + select evaluation__party_name(ese.party_id,ese.task_id) as party_name, + ese.party_id + from evaluation_student_evals ese + where content_revision__is_live(ese.evaluation_id) = true + and ese.task_id = :task_id + + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/audit-info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/audit-info.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/audit-info.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,16 @@ + +@page_title;noquote@ +@context;noquote@ + +

Audit info for task "@task_name@"

+ +
    + +
  • @parties.party_name@ + +
  • +
    +
+ + + Index: openacs-4/packages/evaluation/www/admin/evaluations/audit-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/audit-info.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/audit-info.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,24 @@ +# /packages/evaluation/www/admin/evaluations/audit-info.tcl + +ad_page_contract { + + Shows the audit info for a given task + + @author jopez + @creation-date Apr 2004 + @cvs-id $Id: audit-info.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ + +} { + task_id:integer,notnull +} + +db_1row get_task_info { *SQL* } +set page_title "Audit info for task" +set context [list "Audit Info"] + +db_multirow parties get_parties { *SQL* } { + + +} + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/evaluations/audit-info.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/audit-info.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/audit-info.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + + select task_name from evaluation_tasks where task_id = :task_id + + + + + 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,150 @@ +# /packages/evaluation/www/admin/evaluations/evaluate-students-2.tcl + +ad_page_contract { + This page asks for an evaluation confirmation + + @author jopez@galileo.edu + @creation-date Mar 2004 +} { + 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 + + grades_to_edit:array,optional + reasons_to_edit:array,optional + show_student_to_edit:array,optional + + grades_wa:array,optional + comments_wa:array,optional + show_student_wa:array,optional + + grades_na:array,optional + comments_na:array,optional + show_student_na:array,optional + + {return_url "student-list?[export_vars -url { task_id }]"} +} -validate { + valid_grades_wa { + set counter 0 + foreach party_id [array names grades_wa] { + if { [info exists grades_wa($party_id)] && ![empty_string_p $grades_wa($party_id)] } { + incr counter + if { ![ad_var_type_check_number_p $grades_wa($party_id)] } { + ad_complain "The grade most be a valid number ($grades_wa($party_id))" + } + } + } + if { !$counter && ([array size show_student_wa] > 0) } { + ad_complain "There must be at least one grade to work with" + } + } + valid_grades_na { + set counter 0 + foreach party_id [array names grades_na] { + if { [info exists grades_na($party_id)] && ![empty_string_p $grades_na($party_id)]} { + incr counter + if { ![ad_var_type_check_number_p $grades_na($party_id)] } { + ad_complain "The grade most be a valid number ($grades_na($party_id))" + } + } + } + if { !$counter && ([array size show_student_na] > 0) } { + ad_complain "There must be at least one grade to work with" + } + } + valid_grades { + set counter 0 + foreach party_id [array names grades_to_edit] { + if { [info exists grades_to_edit($party_id)] && ![empty_string_p $grades_to_edit($party_id)] } { + incr counter + if { ![ad_var_type_check_number_p $grades_to_edit($party_id)] } { + ad_complain "The grade most be a valid number ($grades_to_edit($party_id))" + } + } + } + if { !$counter && ([array size show_student_to_edit] > 0) } { + ad_complain "There must be at least one grade to work with" + } + } + valid_data { + foreach party_id [array names comments_wa] { + if { [info exists comments_wa($party_id)] && ![info exists grades_wa($party_id)] } { + ad_complain "There is a comment for a grade not realized ($comments_wa($party_id))" + } + if { [info exists comments_wa($party_id)] && ([string length $comments_wa($party_id)] > 400) } { + ad_complain "There is a comment larger than we can handle. ($comments_wa($party_id))" + } + } + foreach party_id [array names comments_na] { + if { [info exists comments_na($party_id)] && ![info exists grades_na($party_id)] } { + ad_complain "There is a comment for a grade not realized ($comments_na($party_id))" + } + if { [info exists comments_na($party_id)] && ([string length $comments_na($party_id)] > 400) } { + ad_complain "There is a comment larger than we can handle. ($comments_na($party_id))" + } + } + foreach party_id [array names reasons_to_edit] { + if { [info exists reasons_to_edit($party_id)] && ![info exists grades_to_edit($party_id)] } { + ad_complain "There is an edit reason for a grade not realized ($reasons_to_edit($party_id))" + } + if { [info exists reasons_to_edit($party_id)] && ([string length $reasons_to_edit($party_id)] > 400) } { + ad_complain "There is an edit reason larger than we can handle. ($reasons_to_edit($party_id))" + } + } + } +} + +db_transaction { + foreach party_id [array names grades_wa] { + if { ![info exists comments_wa($party_id)] } { + set comments_wa($party_id) "" + } else { + set comments_wa($party_id) [DoubleApos $comments_wa($party_id)] + } + + if { [info exists grades_wa($party_id)] && ![empty_string_p $grades_wa($party_id)] } { + set grades_wa($party_id) [expr ($grades_wa($party_id)*100)/$max_grade.0] + set revision_id [evaluation::new_evaluation -new_item_p 1 -item_id $item_ids($party_id) -content_type evaluation_student_evals \ + -content_table evaluation_student_evals -content_id evaluation_id -description $comments_wa($party_id) \ + -show_student_p $show_student_wa($party_id) -grade $grades_wa($party_id) -task_id $task_id -party_id $party_id] + + evaluation::set_live -revision_id $revision_id + } + } +} + +db_transaction { + foreach party_id [array names grades_na] { + if { ![info exists comments_na($party_id)] } { + set comments_na($party_id) "" + } else { + set comments_na($party_id) [DoubleApos $comments_na($party_id)] + } + if { [info exists grades_na($party_id)] && ![empty_string_p $grades_na($party_id)] } { + set grades_na($party_id) [expr ($grades_na($party_id)*100)/$max_grade.0] + set revision_id [evaluation::new_evaluation -new_item_p 1 -item_id $item_ids($party_id) -content_type evaluation_student_evals \ + -content_table evaluation_student_evals -content_id evaluation_id -description $comments_na($party_id) \ + -show_student_p $show_student_na($party_id) -grade $grades_na($party_id) -task_id $task_id -party_id $party_id] + + evaluation::set_live -revision_id $revision_id + } + } +} + +db_transaction { + foreach party_id [array names grades_to_edit] { + if { [info exists grades_to_edit($party_id)] && ![empty_string_p $grades_to_edit($party_id)] } { + set grades_to_edit($party_id) [expr ($grades_to_edit($party_id)*100)/$max_grade.0] + set revision_id [evaluation::new_evaluation -new_item_p 0 -item_id $item_to_edit_ids($party_id) -content_type evaluation_student_evals \ + -content_table evaluation_student_evals -content_id evaluation_id -description $reasons_to_edit($party_id) \ + -show_student_p $show_student_to_edit($party_id) -grade $grades_to_edit($party_id) -task_id $task_id -party_id $party_id] + + evaluation::set_live -revision_id $revision_id + } + } +} + +ad_returnredirect "$return_url" + Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + + select evaluation__party_name(:party_id,:task_id) + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,78 @@ + +@page_title;noquote@ +@context;noquote@ + +

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

+ + +
+ @export_vars;noquote@ + + + +
+ + +
+ + + + + +
Name:@evaluations_wa.party_name@
Grade:@evaluations_wa.grade@ / @max_grade@
Comments:@evaluations_wa.comment@
Will the studen(s) be
able to see the grade?
@evaluations_wa.show_student@
+ + +
+ +
+
+ + +
+ @export_vars;noquote@ + + + +
+ + +
+ + + + + +
Name:@evaluations_na.party_name@
Grade:@evaluations_na.grade@ / @max_grade@
Comments:@evaluations_na.comment@
Will the studen(s) be
able to see the grade?
@evaluations_na.show_student@
+ + +
+ +
+
+ + +
+ @export_vars;noquote@ + + + +
+ + +
+ + + + + +
Name:@evaluations.party_name@
Grade:@evaluations.grade@ / @max_grade@
Edit Reason:@evaluations.reason@
Will the studen(s) be
able to see the grade?
@evaluations.show_student@
+ + +
+ +
+
+ +

+ + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,191 @@ +# /packages/evaluation/www/admin/evaluations/evaluate-students.tcl + +ad_page_contract { + This page asks for an evaluation confirmation + + @author jopez@galileo.edu + @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 + + grades:array,optional + reasons:array,optional + show_student:array,optional + evaluation_ids:array,integer,optional + + grades_wa:array,optional + comments_wa:array,optional + show_student_wa:array,optional + + grades_na:array,optional + comments_na:array,optional + show_student_na:array,optional + + {grade_all ""} +} -validate { + valid_grades_wa { + set counter 0 + foreach party_id [array names grades_wa] { + if { [info exists grades_wa($party_id)] && ![empty_string_p $grades_wa($party_id)] } { + incr counter + if { ![ad_var_type_check_number_p $grades_wa($party_id)] } { + ad_complain "The grade must be a valid number ($grades_wa($party_id))" + } + } + } + if { !$counter && ([array size show_student_wa] > 0)} { + ad_complain "There must be at least one grade to work with" + } + } + valid_grades_na { + set counter 0 + foreach party_id [array names grades_na] { + if { [empty_string_p $grade_all] } { + if { [info exists grades_na($party_id)] && ![empty_string_p $grades_na($party_id)] } { + incr counter + if { ![ad_var_type_check_number_p $grades_na($party_id)] } { + ad_complain "The grade must be a valid number ($grades_na($party_id))" + } + } + } else { + set grades_na($party_id) 0 + } + } + if { !$counter && ([array size show_student_na] > 0) && [empty_string_p $grade_all] } { + ad_complain "There must be at least one grade to work with" + } + } + valid_grades { + set counter 0 + foreach party_id [array names grades] { + if { [info exists grades($party_id)] && ![empty_string_p $grades($party_id)] } { + if { ![ad_var_type_check_number_p $grades($party_id)] } { + ad_complain "The grade most be a valid number ($grades($party_id))" + } else { + set old_grade [format %.2f [db_string get_old_grade { *SQL* }]] + if { ![string eq $old_grade [format %.2f $grades($party_id)]] } { + incr counter + if { ![info exists reasons($party_id)] || [empty_string_p $reasons($party_id)] } { + ad_complain "You must give an edit reason ($old_grade --> $grades($party_id))" + } + set grades_to_edit($party_id) $grades($party_id) + set reasons_to_edit($party_id) $reasons($party_id) + set show_student_to_edit($party_id) $show_student($party_id) + } + } + } + } + if { !$counter && ([array size show_student] > 0) } { + ad_complain "There must be at least one grade to work with" + } + } + valid_data { + foreach party_id [array names comments_wa] { + if { [info exists comments_wa($party_id)] && ![info exists grades_wa($party_id)] } { + ad_complain "There is a comment for a grade not realized ($comments_wa($party_id))" + } + if { [info exists comments_wa($party_id)] && ([string length $comments_wa($party_id)] > 400) } { + ad_complain "There is a comment larger than we can handle. ($comments_wa($party_id))" + } + } + foreach party_id [array names comments_na] { + if { [info exists comments_na($party_id)] && ![info exists grades_na($party_id)] } { + ad_complain "There is a comment for a grade not realized ($comments_na($party_id))" + } + if { [info exists comments_na($party_id)] && ([string length $comments_na($party_id)] > 400) } { + ad_complain "There is a comment larger than we can handle. ($comments_na($party_id))" + } + } + foreach party_id [array names reasons] { + if { [info exists reasons($party_id)] && ![info exists grades($party_id)] } { + ad_complain "There is an edit reason for a grade not realized ($reasons($party_id))" + } + if { [info exists reasons($party_id)] && ([string length $reasons($party_id)] > 400) } { + ad_complain "There is an edit reason larger than we can handle. ($reasons($party_id))" + } + } + } +} + +set page_title "Confirm Your Evaluation" +set context [list [list "[export_vars -base student-list { task_id }]" "Studen List"] "Confirm Evaluation"] + +db_1row get_task_info { *SQL* } + +# students with answer + +# if the structure of the multirow datasource ever changes, this needs to be rewritten +set counter 0 +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 evaluations_wa:${counter}(rownum) $counter + set evaluations_wa:${counter}(party_name) $party_name + set evaluations_wa:${counter}(grade) $grades_wa($party_id) + set evaluations_wa:${counter}(comment) $comments_wa($party_id) + if { [string eq $show_student_wa($party_id) "t"] } { + set evaluations_wa:${counter}(show_student) Yes + } else { + set evaluations_wa:${counter}(show_student) No + } + set item_ids($party_id) [db_nextval acs_object_id_seq] + } +} + +set evaluations_wa:rowcount $counter + +# students with no answer + +# if the structure of the multirow datasource ever changes, this needs to be rewritten +set counter 0 +foreach party_id [array names show_student_na] { + if { [info exists grades_na($party_id)] && ![empty_string_p $grades_na($party_id)] } { + incr counter + set party_name [db_string get_party_name { *SQL* }] + set evaluations_na:${counter}(rownum) $counter + set evaluations_na:${counter}(party_name) $party_name + set evaluations_na:${counter}(grade) $grades_na($party_id) + set evaluations_na:${counter}(comment) $comments_na($party_id) + if { [string eq $show_student_na($party_id) "t"] } { + set evaluations_na:${counter}(show_student) Yes + } else { + set evaluations_na:${counter}(show_student) No + } + set item_ids($party_id) [db_nextval acs_object_id_seq] + } +} + +set evaluations_na:rowcount $counter + +# editting grades + +# if the structure of the multirow datasource ever changes, this needs to be rewritten +set counter 0 +foreach party_id [array names show_student] { + if { [info exists grades_to_edit($party_id)] && ![empty_string_p $grades_to_edit($party_id)] } { + incr counter + set party_name [db_string get_party_name { *SQL* }] + set evaluations:${counter}(rownum) $counter + set evaluations:${counter}(party_name) $party_name + set evaluations:${counter}(grade) $grades_to_edit($party_id) + set evaluations:${counter}(reason) $reasons_to_edit($party_id) + if { [string eq $show_student_to_edit($party_id) "t"] } { + set evaluations:${counter}(show_student) Yes + } else { + set evaluations:${counter}(show_student) No + } + } +} + +set evaluations:rowcount $counter + +set export_vars [export_vars -form { grades_wa comments_wa show_student_wa grades_na comments_na show_student_na item_ids grades_to_edit reasons_to_edit show_student_to_edit item_to_edit_ids }] + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluate-students.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,22 @@ + + + + postgresql7.4 + + + + + select grade from evaluation_student_evals where evaluation_id = $evaluation_ids($party_id) + + + + + + + + select task_name from evaluation_tasks where task_id = :task_id + + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.4 + + + + + select evaluation__delete_student_eval ( + :evaluation_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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,29 @@ +# /packages/evaluation/www/admin/evaluations/evaluation-delete-2.tcl + +ad_page_contract { + Removes relations + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: evaluation-delete-2.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ +} { + evaluation_id:integer,notnull + task_id:integer,notnull + operation +} + +if { [string eq $operation "Yes, I really want to remove this evaluation"] } { + db_transaction { + + db_exec_plsql delete_evaluation { *SQL* } + + } on_error { + ad_return_error "Error deleting the evaluation" "We got the following error while trying to remove the evaluation:
$errmsg
" + ad_script_abort + } +} + +db_release_unused_handles + +# redirect to the index page by default +ad_returnredirect "student-list?[export_vars -url { task_id }]" Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.4 + + + + + select evaluation__party_name(party_id,task_id) as party_name + from evaluation_student_evals + where evaluation_id = :evaluation_id + + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,13 @@ + +@context;noquote@ +@page_title@ + +Are you sure you want to remove the evaluaiton on "@party_name@"? + +

+ +

+ +
+ +

\ No newline at end of file Index: openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluation-delete.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,24 @@ +# /packages/evaluation/www/admin/evaluations/evaluaiton-delete.tcl + +ad_page_contract { + + Deletes an evaluation after confirmation + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: evaluation-delete.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ + +} { + evaluation_id:integer,notnull + task_id:integer,notnull +} + +set page_title "Delete Evaluation" + +set context [list [list "[export_vars -base student-list { task_id }]" "Studen List"] "Delete Evaluation"] + +db_1row get_evaluation_info { *SQL* } + +set export_vars [export_vars -form { evaluation_id return_url task_id }] + +ad_return_template 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,34 @@ + + + + postgresql7.4 + + + + + 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, 'MM-DD-YYYY HH24:MI:SS') as pretty_submission_date, + 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) + where et.task_id = :task_id + and et.task_id = ese.task_id + and content_revision__is_live(ese.evaluation_id) = true + and ese.grade is not null + + + + + 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,14 @@ + +@page_title;noquote@ +@context;noquote@ + + +
+ +
+ +
+
+

There are no grades to edit + +

\ No newline at end of file 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/evaluations-edit.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,78 @@ +# /packages/evaluaiton/www/admin/evaluations/evaluations-edit.tcl + +ad_page_contract { + Displays the evaluations of students in order to edit them + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: evaluations-edit.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ +} { + task_id:integer,notnull + {return_url "student-list?[export_vars -url { task_id }]"} +} + +set page_title "Edit Evaluations" +set context [list [list "[export_vars -base student-list { task_id }]" "Studen List"] "Edit Evaluations"] + +set elements [list party_name \ + [list label "Name" \ + orderby_asc {party_name asc} \ + orderby_desc {party_name desc}] \ + answer \ + [list label "Answer" \ + link_url_col answer_url \ + link_html { title "View answer" }] \ + submission_date \ + [list label "Submission Date" \ + orderby_asc {submission_date asc} \ + orderby_desc {submission_date desc}] \ + grade \ + [list label "Maximun Grade: " \ + display_template { } ] \ + edit_reason \ + [list label "Edit Reason" \ + display_template { } \ + ] \ + show_student_p \ + [list label "Allow the students
to see the grade?" \ + display_template { [if { [string eq @evaluated_students.show_student_p@ "t"] } { return "Yes No " } else { return "Yes No " }] } ] \ + ]\ + +template::list::create \ + -name evaluated_students \ + -multirow evaluated_students \ + -key task_id \ + -filters { task_id {} } \ + -elements $elements + +set orderby [template::list::orderby_clause -orderby -name evaluated_students] + +if {[string equal $orderby ""]} { + set orderby " order by party_name asc" +} + +db_multirow -extend { answer answer_url } evaluated_students get_evaluated_students { *SQL* } { + + set grade [format %.2f $grade] + if { [string eq $online_p "t"] } { + # working with answer stuff (if it has a file/url attached) + if { [empty_string_p $answer_data] } { + set answer "No response" + } elseif { [regexp "http://" $answer_data] } { + set answer_url "[export_vars -base "$answer_data" { }]" + set answer "View answer" + } else { + # we assume it's a file + set answer_url "[export_vars -base "../../view/$answer_title" { }]" + } + if { ![string eq $answer "No response"] && ([template::util::date::compare $submission_date $evaluation_date] > 0) } { + append answer_url " (NEW answer)" + } + if { [template::util::date::compare $submission_date $due_date] > 0 } { + set pretty_submission_date "$pretty_submission_date (late)" + } + } + +} + + Index: openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,19 @@ + + + + postgresql7.4 + + + + + select evaluation__party_name(ese.party_id,:task_id) as party_name, + ese.grade, + ese.show_student_p, + ese.description + from evaluation_student_evalsx ese + where ese.evaluation_id = :evaluation_id + + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,5 @@ + + @page_title;noquote@ + @context;noquote@ + +

Index: openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,85 @@ +# /packages/evaluation/www/admin/evaluations/one-evaluation-edit.tcl + +ad_page_contract { + Page for editing evaluations + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: one-evaluation-edit.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ +} { + task_id:integer,notnull + evaluation_id:integer,notnull +} + +set return_url "student-list?[export_vars -url { task_id }]" + +set page_title "View/Edit Evaluation" + +set context [list [list [export_vars -base student-list { task_id }] "Students List"] $page_title] + +if { [ad_form_new_p -key evaluation_id] } { + set comment_label "Comments" +} else { + set comment_label "Edit Reason" +} + +db_1row get_evaluation_info { *SQL* } + +ad_form -name evaluation -cancel_url $return_url -export { task_id item_id party_id } -form { + + evaluation_id:key + + {party_name:text + {label "Name"} + {html {size 30}} + {mode display} + } + + {grade:text + {label "Grade"} + {html {size 5}} + } + + {comments:text(textarea) + {label "$comment_label"} + {html {rows 4 cols 40}} + } + + {show_student_p:text(radio) + {label "Will the student be able to see the grade?"} + {options {{Yes t} {No f}}} + } + + +} -edit_request { + + db_1row evaluation_info { *SQL* } + set grade [format %.2f $grade] + +} -validate { + {grade + { [ad_var_type_check_number_p $grade] } + { The grade must be a valid number } + } + {comments + { [string length $comments] < 4000 } + { The edit reason must be less than 4000 characteras long } + } + +} -on_submit { + + db_transaction { + + set revision_id [evaluation::new_evaluation -new_item_p 0 -item_id $item_id -content_type evaluation_student_evals \ + -content_table evaluation_student_evals -content_id evaluation_id -description $comments \ + -show_student_p $show_student_p -grade $grade -task_id $task_id -party_id $party_id] + + evaluation::set_live -revision_id $revision_id + + } + + ad_returnredirect "$return_url" + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/one-evaluation-edit.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,17 @@ + + + + postgresql7.4 + + + + + select ese.party_id, + ese.item_id + from evaluation_student_evalsx ese + where ese.evaluation_id = :evaluation_id + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,70 @@ + + + + postgresql7.4 + + + + + select evaluation__party_name(ese.party_id,et.task_id) as party_name, + ea.data as answer_data, + ea.title as answer_title, + ea.revision_id, + ese.party_id, + ese.grade, + to_char(ea.last_modified, 'MM-DD-YYYY HH24:MI:SS') as pretty_submission_date, + 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) + where et.task_id = :task_id + and et.task_id = ese.task_id + and content_revision__is_live(ese.evaluation_id) = true + + + + + + + + select count(party_id) from evaluation_answers ea where ea.task_id = :task_id $processed_clause and content_revision__is_live(ea.answer_id) = true + + + + + + + + and ea.party_id not in ([join $done_students ","]) + + + + + + + + select evaluation__party_name(ea.party_id, ea.task_id) as party_name, + ea.party_id, + ea.data as answer_data, + ea.title as answer_title, + ea.revision_id, + to_char(ea.last_modified, 'MM-DD-YYYY HH24:MI:SS') as pretty_submission_date, + et.due_date, + ea.last_modified as submission_date + from evaluation_answersi ea, + evaluation_tasks et + where ea.task_id = et.task_id + and et.task_id = :task_id + and ea.data is not null + and content_revision__is_live(ea.answer_id) = true + $processed_clause + + + + + 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,57 @@ + +@page_title;noquote@ +@context;noquote@ + + + + + + + + + + + + + + +
Task Name:@task_name@
Due Date:@due_date@
@groups_admin;noquote@
+ +

Evaluated Students (@total_evaluated@)

+
+
+

Students with answers that have not been evaluated (@not_evaluated_with_answer@)

+ + +
+ + +
+ +
+ +
+
+

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
+
+
+

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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,261 @@ +# /packages/evaluaiton/www/admin/evaluaitons/student-list.tcl + +ad_page_contract { + Displays the evaluations of students that have already been evaluated, + lists the ones that have not been evaluated yet (in order to evaluate them) + and deals with tasks in groups and individual. + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: student-list.tcl,v 1.1 2004/04/28 11:06:41 rocaelh Exp $ +} { + task_id:integer,notnull + {return_url "student-list?[export_vars -url { task_id }]"} + {orderby_wa:optional} + {orderby_na:optional} +} + +set user_id [ad_conn user_id] + +set page_title "Student List" +set context { "Student List" } + +db_1row get_task_info { *SQL* } + +if { $number_of_members > 1 } { + set groups_admin "Groups administration" +} else { + set groups_admin "" +} + +set done_students [list] + +# +# working with already evaluated parties +# + +set actions [list "Edit Evaluations" [export_vars -base "evaluations-edit" { task_id }]] + +template::list::create \ + -name evaluated_students \ + -multirow evaluated_students \ + -actions $actions \ + -key task_id \ + -pass_properties { return_url task_id } \ + -filters { task_id {} } \ + -elements { + party_name { + label "Name" + orderby_asc {party_name asc} + orderby_desc {party_name desc} + link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id return_url task_id }]} + link_html { title "View evaluation" } + } + grade { + label "Maximun Grade: 100" + orderby_asc {grade asc} + orderby_desc {grade desc} + } + actions { + label "" + link_url_col actions_url + } + pretty_submission_date { + label "Sumission Date" + orderby_asc {pretty_submission_date asc} + orderby_desc {pretty_submission_date desc} + } + view { + label {} + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id return_url task_id }]} + link_html { title "View evaluation" } + } + edit { + label {} + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base "one-evaluation-edit" { evaluation_id return_url task_id }]} + link_html { title "Edit evaluation" } + } + delete { + label {} + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base "evaluation-delete" { evaluation_id return_url task_id }]} + link_html { title "Delete evaluation" } + } + } + +set orderby [template::list::orderby_clause -orderby -name evaluated_students] + +if {[string equal $orderby ""]} { + set orderby " order by party_name asc" +} + +db_multirow -extend { actions action_url } evaluated_students evaluated_students { *SQL* } { + + lappend done_students $party_id + set grade [format %.2f $grade] + if { [string eq $online_p "t"] } { + # working with answer stuff (if it has a file/url attached) + if { [empty_string_p $answer_data] } { + set action "No response" + } elseif { [regexp "http://" $answer_data] } { + set action_url "[export_vars -base "$answer_data" { }]" + set action "View answer" + } else { + # we assume it's a file + set action_url "[export_vars -base "../../view/$answer_title" { revision_id }]" + set action "View answer" + } + if { [string eq $action "View answer"] && ([template::util::date::compare $submission_date $evaluation_date] > 0) } { + set action "View NEW answer" + } + if { [template::util::date::compare $submission_date $due_date] > 0 } { + set pretty_submission_date "$pretty_submission_date (late)" + } + } +} + +set total_evaluated [db_string count_evaluated_students { *SQL* }] + +if { [llength $done_students] > 0 } { + set processed_clause [db_map processed_clause] +} else { + set processed_clause "" +} + +set not_evaluated_with_answer [db_string get_not_eval_wa { *SQL* }] + +# +# working with students that have answered but have not been yet evaluated +# + +set elements [list party_name \ + [list label "Name" \ + orderby_asc {party_name asc} \ + orderby_desc {party_name desc}] \ + answer \ + [list label "Answer" \ + link_url_col answer_url \ + link_html { title "View answer" }] \ + grade \ + [list label "Maximun Grade: " \ + display_template { } ] \ + comments \ + [list label "Comments" \ + display_template { } \ + ] \ + show_answer \ + [list label "Allow the students
to see the grade?" \ + display_template { Yes No } \ + ] \ + ] + +template::list::create \ + -name not_evaluated_wa \ + -multirow not_evaluated_wa \ + -key party_id \ + -pass_properties { task_id return_url } \ + -filters { task_id {} } \ + -orderby_name orderby_wa \ + -elements $elements + + +set orderby_wa [template::list::orderby_clause -orderby -name not_evaluated_wa] + +if { [string equal $orderby_wa ""] } { + 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 + if { [string eq $online_p "t"] } { + set answer "View answer" + # working with answer stuff (if it has a file/url attached) + if { [regexp "http://" $answer_data] } { + set answer_url [export_vars -base "$answer_data" { }] + } else { + # we assume it's a file + set answer_url [export_vars -base "../../view/$answer_title" { revision_id }] + } + if { [template::util::date::compare $submission_date $due_date] > 0 } { + set pretty_submission_date "$pretty_submission_date (late answer)" + } + } +} + +# +# working with students that have not answered and have not been yet evaluated and do not have submited their answers +# + +set elements [list party_name \ + [list label "Name" \ + orderby_asc {party_name asc} \ + orderby_desc {party_name desc}] \ + grade \ + [list label "Grade over " \ + display_template { } ] \ + comments \ + [list label "Comments" \ + display_template { } \ + ] \ + show_answer \ + [list label "Allow the students
to see the grade?" \ + display_template { Yes No } \ + ] \ + ] + +template::list::create \ + -name not_evaluated_na \ + -multirow not_evaluated_na \ + -key party_id \ + -pass_properties { task_id return_url } \ + -filters { task_id {} } \ + -orderby_name orderby_na \ + -elements $elements + +set orderby_na [template::list::orderby_clause -orderby -name not_evaluated_na] + +if { [string equal $orderby_na ""] } { + set orderby_na " order by party_name asc" +} + +if { $number_of_members > 1 } { + if { [llength $done_students] > 0 } { + set not_evaluated_with_no_answer [db_string get_not_evaluated_na { *SQL* }] + set not_in_clause [db_map not_in_clause] + } else { + set not_in_clause "" + } + set not_evaluated_with_no_answer [db_string count_not_eval_na { *SQL* }] + set sql_query [db_map sql_query_one] +} else { + if { [llength $done_students] > 0 } { + set not_in_clause [db_map not_yet_in_clause] + } else { + set not_in_clause "" + } + set not_evaluated_with_no_answer [db_string get_not_evaluated_left { *SQL* }] + set sql_query [db_map sql_query_two] +} + +db_multirow not_evaluated_na get_not_evaluated_na_students { *SQL* } { + +} + + + + + Index: openacs-4/packages/evaluation/www/admin/evaluations/student-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/evaluations/student-list.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/evaluations/student-list.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,99 @@ + + + + postgresql7.4 + + + + + select et.task_name, + eg.grade_id, + eg.grade_name, + eg.weight as grade_weight, + et.weight as task_weight, + to_char(et.due_date,'Month DD YYYY') as due_date, + et.number_of_members, + et.online_p + from evaluation_grades eg, evaluation_tasks et + where et.task_id = :task_id + and et.grade_id = eg.grade_id + + + + + + + + select count(*) from evaluation_student_evals where task_id = :task_id + + + + + + + + select count(*) from evaluation_task_groups where group_id not in ([join $done_students ","]) + + + + + + + and etg.group_id not in ([join $done_students ","]) + + + + + + + select count(*) from evaluation_task_groups etg where etg.task_id = :task_id + $not_in_clause + + + + + + + where p.person_id not in ([join $done_students ","]) + + + + + + + select count(*) from cc_users p + $not_in_clause + + + + + + + select acs_group__name(etg.group_id) as party_name, + etg.group_id as party_id + from evaluation_task_groups etg + where etg.task_id = :task_id + $not_in_clause + $orderby_na + + + + + + select p.person_id as party_id, + p.last_name||', '||p.first_names as party_name + from cc_users p + $not_in_clause + $orderby_na + + + + + + + $sql_query + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/distribution-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/distribution-edit-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/distribution-edit-2.tcl 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,49 @@ +# /packages/evaluation/www/admin/grades/distribution-edit-2.tcl + +ad_page_contract { + Bulk edit a set tasks +} { + grade_id:integer,notnull + no_grade:array + weights:array +} -validate { + valid_weights { + foreach id [array names weights] { + if { ![info exists weights($id)] } { + ad_complain "The task weight can't be null" + } else { + if { ![ad_var_type_check_number_p $weights($id)] } { + ad_complain "The task weight $weights($id) must be a valid number" + } + } + } + } +} + +set without_grade [list] +set with_grade [list] +foreach id [array names weights] { + # create a list of tasks that requieres/not requires grade + if { [string eq $no_grade($id) "t"] } { + lappend with_grade $id + } else { + lappend without_grade $id + } + + set aweight $weights($id) + + db_dml update_task { *SQL* } + + if { [llength $with_grade] } { + db_dml update_tasks_with_grade { *SQL* } + } + if { [llength $without_grade] } { + db_dml update_tasks_without_grade { *SQL* } + } +} + + +ad_returnredirect "grades" + +ad_script_abort + Index: openacs-4/packages/evaluation/www/admin/grades/distribution-edit-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/distribution-edit-2.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/distribution-edit-2.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,32 @@ + + + + postgresql7.4 + + + + + update evaluation_tasks + set weight = :aweight + where task_id = :id + + + + + + + + update evaluation_tasks set requires_grade_p = 't' where task_id in ([join $with_grade ,]) + + + + + + + + update evaluation_tasks set requires_grade_p = 'f' where task_id in ([join $without_grade ,]) + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/distribution-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/Attic/distribution-edit-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/distribution-edit-postgresql.xql 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,21 @@ + + + + postgresql7.4 + + + + + select task_name, + weight as task_weight, + requires_grade_p, + task_id + from evaluation_tasksi + where grade_id = :grade_id + and content_revision__is_live(task_id) = true + order by task_name + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/distribution-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/distribution-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/distribution-edit.adp 28 Apr 2004 11:06:41 -0000 1.1 @@ -0,0 +1,21 @@ + +@page_title@ +@context@ + +

Distribution for grade "@grade_name@" + +

@grade_comments@ + + + +

+ +
+ +
+ +
+ +

There are no tasks associated with this assignments type + +

\ No newline at end of file Index: openacs-4/packages/evaluation/www/admin/grades/distribution-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/distribution-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/distribution-edit.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,54 @@ +# /packages/evaluaiton/www/admin/grades/distribution-edit.tcl + +ad_page_contract { + Bulk edit grade's distribution + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: distribution-edit.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + grade_id:integer,notnull +} + +set user_id [ad_conn user_id] + +set page_title "Assignment Types Distribution" +set context [list [list "grades" "Assignment Types"] "Assignment Types Distribution"] + +db_1row grade_info { *SQL* } + +set elements [list task_name \ + [list label "Name" \ + orderby_asc {task_name asc} \ + orderby_desc {task_name desc}] \ + task_weight \ + [list label "Weight" \ + display_template { } \ + ] \ + requires_grade \ + [list label "Requires Grade?" \ + display_template { [if { [string eq @grades.requires_grade_p@ "t"] } { return "Yes No " } else { return "Yes No " }] } \ + ] \ + ] + +template::list::create \ + -name grades \ + -multirow grades \ + -key task_id \ + -filters { grade_id {} } \ + -elements $elements + + +set orderby [template::list::orderby_clause -orderby -name grades] + +if { [string equal $orderby ""] } { + set orderby " order by task_name asc" +} + +db_multirow grades get_grade_tasks { *SQL* } { +} + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/distribution-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/distribution-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/distribution-edit.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,18 @@ + + + + postgresql7.4 + + + + + select eg.grade_name, + eg.weight as grade_weight, + eg.comments as grade_comments + from evaluation_gradesi eg + where grade_id = :grade_id + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.adp 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,8 @@ + + @page_title;noquote@ + @context;noquote@ + +

+ + + Index: openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,72 @@ +# /packages/evaluation/www/admin/grades/grades-add-edit.tcl + +ad_page_contract { + Page for editing and adding grades. + + @author jopez@galileo.edu + @creation-date Feb 2004 + @cvs-id $Id: grades-add-edit.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + grade_id:integer,notnull,optional + item_id:integer,notnull,optional +} + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] + +if { [ad_form_new_p -key grade_id] } { + set page_title "Add Assignment Type" +} else { + set page_title "Edit Assignment Type" +} + +set context [list [list [export_vars -base grades { }] "Assignment Types"] $page_title] + +ad_form -name grade -cancel_url [export_vars -base grades { }] -export { } -form { + + grade_id:key + + {grade_name:text + {label "Assignment Type Name"} + {html {size 30}} + } + + {weight:text + {label "Weight"} + {html {size 5}} + } + + {comments:text(textarea),optional + {label "Assignment Type's Comments"} + {html {rows 4 cols 40}} + } + +} -edit_request { + + db_1row get_grade_info { *SQL* } + + set grade_id $item_id + +} -validate { + + {weight + { [ad_var_type_check_number_p $weight] && ($weight >= 0) && ($weight <= 100) } + {Weight must be a real number and between 0 and 100} + } + +} -on_submit { + + db_transaction { + + set revision_id [evaluation::new_grade -new_item_p [ad_form_new_p -key grade_id] -item_id $grade_id -content_type evaluation_grades \ + -content_table evaluation_grades -content_id grade_id -name $grade_name -description $comments -weight $weight] + + evaluation::set_live -revision_id $revision_id + + } + + ad_returnredirect "grades" + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-add-edit.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,17 @@ + + + + postgresql7.4 + + + + + select grade_name, class_id, comments, weight + from evaluation_grades + where grade_id = :grade_id + + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/grades-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-delete-2-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.4 + + + + + select evaluation__delete_grade ( + :grade_id + ); + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-delete-2.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,33 @@ +# /packages/evaluation/www/ + +ad_page_contract { + Removes relations + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: grades-delete-2.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + grade_id:integer,notnull + return_url + operation +} + +if { [string eq $operation "Yes, I really want to remove this grade"] } { + db_transaction { + + db_exec_plsql delete_grade { *SQL* } + + } on_error { + ad_return_error "Error deleting the grade" "We got the following error while trying to remove the grade:
$errmsg
" + ad_script_abort + } +} else { + if { [empty_string_p $return_url] } { + # redirect to the index page by default + set return_url "grades" + } +} + +db_release_unused_handles + +ad_returnredirect $return_url Index: openacs-4/packages/evaluation/www/admin/grades/grades-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-delete.adp 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,12 @@ + +@context;noquote@ +Remove Grade + +Are you sure you want to remove the assignment type "@grade_name@"? (If your answer is yes, all the evaluations, tasks, tasks solutions and answers associated with this assignment type will be deleted too) + +

+ +

+ +
+ Index: openacs-4/packages/evaluation/www/admin/grades/grades-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-delete.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,31 @@ +# /packages/evaluation/www/admin/grades/grades-delete.tcl + +ad_page_contract { + + Deletes a grade after confirmation + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: grades-delete.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ + +} { + grade_id:integer,notnull + {return_url "index"} +} + +set user_id [ad_verify_and_get_user_id] + +set page_title "Delete Assignment Type" + +set context [list [list "grades" "Assignment Types"] "Delete Assignment Type"] + +db_1row get_grade_info " + select item_id, + grade_name + from evaluation_gradesx + where grade_id = :grade_id +" + +set export_vars [export_form_vars grade_id return_url] + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/grades/grades-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,34 @@ + + + + postgresql7.4 + + + + + select eg.grade_id, + eg.item_id, + eg.grade_name, + eg.comments, + eg.weight + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id = :package_id + $orderby + + + + + + + + select coalesce(sum(weight),0) as total_weight + from evaluation_gradesi + where content_revision__is_live(grade_id) = true + and context_id = :package_id + + + + + 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-reports-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,60 @@ + + + + postgresql7.4 + + + + + select count(eg.grade_id) + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id = [ad_conn package_id] + + + + + + + + select eg.grade_id, + eg.grade_name, + eg.weight + from evaluation_gradesx eg, acs_objects ao + where content_revision__is_live(eg.grade_id) = true + and eg.item_id = ao.object_id + and ao.context_id = :package_id + order by grade_name + + + + + + + + , trunc(evaluation__grade_total_grade(cu.user_id,$grade_id),2) as grade_$grade_id + + + + + + + + , trunc(evaluation__class_total_grade(cu.user_id,$package_id),2) as total_grade + + + + + + + + select cu.first_names||', '||cu.last_name as student_name + $sql_query + from cc_users cu + order by student_name asc + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/grades-reports.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-reports.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-reports.adp 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,6 @@ + +@page_title;noquote@ +@context;noquote@ + +
+ 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-reports.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,49 @@ +# /packages/evaluation/www/admin/grades/grades-reports.tcl + +ad_page_contract { + + Grades reports of a group + + @creation-date Apr 2004 + @author jopez@galileo.edu + @cvs-id $Id: grades-reports.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ + +} { +} -validate { + grades_for_package { + if { [string eq [db_string package_grades { *SQL* }] 0] } { + ad_complain "There are no grades for this group." + } + } +} + +set page_title "Grades Report" +set context "Grades Report" +set package_id [ad_conn package_id] + +set elements [list student_name \ + [list label "Name" \ + link_url_col student_url ] \ + ] + +db_foreach grade_type { *SQL* } { + lappend elements grade_$grade_id \ + [list label "$grade_name ($weight %)"] + + append sql_query [db_map grade_total_grade] +} + +lappend elements total_grade \ + [list label "Total Grade"] + +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* } { + +} 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-type-reports-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,46 @@ + + postgresql7.4 + + + + + select et.task_id, + et.task_name, + et.weight + from evaluation_tasksi et + where content_revision__is_live(et.task_id) = true + and et.grade_id = :grade_id + order by task_name + + + + + + + + select cu.first_names||', '||cu.last_name as student_name + $sql_query + from cc_users cu + order by student_name asc + + + + + + + + , trunc(evaluation__task_grade(cu.user_id,$task_id),2) as task_$task_id + + + + + + + + , trunc(evaluation__grade_total_grade(cu.user_id,:grade_id),2) as total_grade + + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.adp 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,6 @@ + +@page_title;noquote@ +@context;noquote@ + + +
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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,50 @@ +# /packages/evaluation/www/admin/grades/grades-types-reports.tcl + +ad_page_contract { + + Grades reports of a grade type + + @creation-date Apr 2004 + @author jopez@galileo.edu + @cvs-id $Id: grades-type-reports.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ + +} { + grade_id:integer,notnull +} -validate { + tasks_for_grade { + if { [string eq [db_string get_tasks { *SQL* }] 0] } { + ad_complain "There are no tasks for this grade type." + } + } +} + +set page_title "Grades Report" +set context [list [list "[export_vars -base grades-reports { }]" "Grades Report"] "One Grade Type"] + +set package_id [ad_conn package_id] + +set elements [list student_name \ + [list label "Name"]\ + ] + +db_foreach grade_task { *SQL* } { + lappend elements task_$task_id \ + [list label "$task_name ($weight %)"] + + append sql_query [db_map task_grade] +} + +lappend elements total_grade \ + [list label "Total"] + +append sql_query [db_map grade_total_grade] + +template::list::create \ + -name grade_tasks \ + -multirow grade_tasks \ + -key task_id \ + -elements $elements + +db_multirow grade_tasks get_grades { *SQL* } { + +} Index: openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades-type-reports.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,13 @@ + + postgresql7.4 + + + + + select count(task_id) from evaluation_tasks where grade_id = :grade_id + + + + + + Index: openacs-4/packages/evaluation/www/admin/grades/grades.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades.adp 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,8 @@ + +@page_title;noquote@ +@context;noquote@ + +
+ +

@notice;noquote@

+ Index: openacs-4/packages/evaluation/www/admin/grades/grades.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/grades/grades.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/grades/grades.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,88 @@ +# /packages/evaluation/www/admin/grades/grades.tcl + +ad_page_contract { + + List of grades and options to admin grades + + @author jopez@galileo.edu + @creation-date Feb 2004 + @cvs-id $Id: grades.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ + +} -query { + {orderby:optional} +} + +set context [list Grades] +set package_id [ad_conn package_id] + +set page_title "Admin Assignment Types" +set return_url [ad_conn url] + +set actions [list "Add assignment type" [export_vars -base "grades-add-edit" { }]] + +template::list::create \ + -name grades \ + -multirow grades \ + -actions $actions \ + -key grade_id \ + -pass_properties { return_url } \ + -elements { + grade_name { + label "Name" + orderby_asc {grade_name asc} + orderby_desc {grade_name desc} + link_url_eval {[export_vars -base "distribution-edit" { grade_id }]} + link_html { title "View assignment type distribution" } + } + weight { + label "Weight" + orderby_asc {weight asc} + orderby_desc {weight desc} + display_template { @grades.weight@% } + aggregate sum + aggregate_label {Total} + } + comments { + label "Description" + orderby_asc {comments asc} + orderby_desc {comments desc} + } + edit { + label {} + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base "grades-add-edit" { item_id grade_id }]} + link_html { title "Edit assignment type" } + } + delete { + label {} + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -base "grades-delete" { grade_id return_url }]} + link_html { title "Delete assignment type" } + } + } + +set orderby [template::list::orderby_clause -orderby -name grades] + +if {[string equal $orderby ""]} { + set orderby " order by grade_name asc" +} + +db_multirow grades get_class_grades { *SQL* } + +db_1row get_total_weight { *SQL* } + +set total_weight [format %.2f $total_weight] + +if { ![string eq $total_weight "100.00"] && ![string eq $total_weight "0"] } { + set notice "The sum of the weight of all the assignment types is $total_weight and it should be 100.00 by the end of the term(supposedly)." +} else { + set notice "" +} + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/groups/group-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-delete-2-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,17 @@ + + + + postgresql7.4 + + + + + select evaluation__delete_evaluation_task_group ( + :evaluation_group_id + ); + + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-delete-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-delete-2.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,31 @@ +# /packabes/evaluation/www/admin/groups/group-delete-2.tcl + +ad_page_contract { + Deletes a task group + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: group-delete-2.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + evaluation_group_id:integer + task_id:integer + operation +} + +if { [string eq $operation "Yes, I really want to remove this group"] } { + db_transaction { + + db_exec_plsql delete_group { *SQL* } + + + } on_error { + ad_return_error "Error deleting the evaluation" "We got the following error while trying to remove the evaluation:
$errmsg
" + ad_script_abort + } +} + +db_release_unused_handles + +# redirect to the index page by default + +ad_returnredirect "one-task?[export_vars -url { task_id }]" Index: openacs-4/packages/evaluation/www/admin/groups/group-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-delete-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-delete-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + + select acs_group__name(:evaluation_group_id) as group_name + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-delete.adp 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,13 @@ + +@context;noquote@ +@page_title@ + +Are you sure you want to remove the group "@group_name@"? (If the group has an evaluation/answer associated, it will be deleted too) + +

+ +

+ +
+ +

\ No newline at end of file Index: openacs-4/packages/evaluation/www/admin/groups/group-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-delete.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,21 @@ +# /packages/evaluation/www/admin/groups/group-delete.tcl + +ad_page_contract { + Asks for a confirmation before deleting the group + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: group-delete.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + evaluation_group_id:integer + task_id:integer +} + +set page_title "Delete Evaluation" +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"] "Delete Group"] + +db_1row get_group_info { *SQL* } + +set export_vars [export_vars -form { evaluation_group_id task_id }] + + Index: openacs-4/packages/evaluation/www/admin/groups/group-member-add-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-member-add-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-member-add-2-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,22 @@ + + + + postgresql7.4 + + + + + select acs_rel__new ( + null, + 'evaluation_task_group_rel', + :evaluation_group_id, + :student_id, + :package_id, + :creation_user_id, + :creation_ip + ); + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-member-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-member-add-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-member-add-2.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,21 @@ +# /packages/evaluation/www/admin/groups/group-member-add-2.tcl + +ad_page_contract { + Associates a student whith a group + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: group-member-add-2.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + evaluation_group_id:integer,notnull + task_id:integer,notnull + student_id:integer,notnull +} + +set creation_user_id [ad_conn user_id] +set creation_ip [ad_conn peeraddr] +set package_id [ad_conn package_id] + +db_exec_plsql associate_student { *SQL* } + +ad_returnredirect "one-task?[export_vars -url { task_id }]" Index: openacs-4/packages/evaluation/www/admin/groups/group-member-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-member-add.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-member-add.adp 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,13 @@ + +@page_title;noquote@ +@context;noquote@ + + +

Please select the group

+
+ +
+ +
+ + Index: openacs-4/packages/evaluation/www/admin/groups/group-member-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-member-add.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-member-add.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,60 @@ +# /packages/evaluation/www/admin/groups/group-ember-add.tcl + +ad_page_contract { + Displays the group list in order to add a member to one of them. + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: group-member-add.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + student_id:integer,notnull + task_id:integer,notnull + {orderby:optional} +} -validate { + target_exists { + if { [string eq "select count(group_id) from evaluation_task_groups where task_id = :task_id" 0] } { + ad_complain "There are no groups for this task yet." + } + } +} + +set page_title "Add a member to a group" +set context [list [list "[export_vars -base one-task { task_id }]" "Task Groups"] "Add Member to group"] + +set elements [list group_name \ + [list label "Group Name" \ + orderby_asc {group_name asc} \ + orderby_desc {group_name desc}] \ + number_of_members \ + [list label "No. of members" \ + orderby_asc {number_of_members asc} \ + orderby_desc {number_of_members desc}] \ + associate_to_group \ + [list label "" \ + link_url_col associate_to_group_url \ + link_html { title "Associate" }] \ + ] + + +template::list::create \ + -name evaluation_groups \ + -multirow evaluation_groups \ + -key evaluation_group_id \ + -filters { student_id {} task_id {} } \ + -elements $elements + +set orderby [template::list::orderby_clause -orderby -name evaluation_groups] + +if { [string equal $orderby ""] } { + set orderby " order by group_name asc" +} + +db_multirow -extend { associate_to_group_url associate_to_group } evaluation_groups get_evaluation_groups { *SQL* } { + set associate_to_group_url [export_vars -base "group-member-add-2" -url { task_id student_id evaluation_group_id }] + set associate_to_group "Associate to group..." +} + + + + + \ No newline at end of file Index: openacs-4/packages/evaluation/www/admin/groups/group-member-add.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-member-add.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-member-add.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,21 @@ + + + + postgresql7.4 + + + + + select g.group_name, g.group_id as evaluation_group_id, + count(map.object_id_two) as number_of_members + from groups g, acs_rels map, evaluation_task_groups etg + where map.object_id_one = g.group_id + and g.group_id = etg.group_id + and etg.task_id = :task_id + group by g.group_id, g.group_name + $orderby + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-new-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-new-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-new-2-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,22 @@ + + + + postgresql7.4 + + + + + select acs_rel__new ( + null, + 'evaluation_task_group_rel', + :evaluation_group_id, + $student_ids($student_id), + :package_id, + :creation_user_id, + :creation_ip + ); + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-new-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-new-2.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,37 @@ +# /packages/evaluation/www/admin/groups/group-new-2.tcl + +ad_page_contract { + Creates a evaluation group for a task. + + @author jopez@galileo.edu + @createion-date Mar 2004 + @cvs-id $Id: group-new-2.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + student_ids:array,integer,notnull + task_id:integer,notnull + evaluation_group_id:integer,notnull + group_name:notnull +} -validate { + students_to_work_with { + if { [array size student_ids] == 0 } { + ad_complain "There must be some students selected in order to crate the group." + } + } +} + +set creation_user_id [ad_conn user_id] +set creation_ip [ad_conn peeraddr] +set package_id [ad_conn package_id] + +db_transaction { + evaluation::new_evaluation_group -group_id $evaluation_group_id -group_name $group_name -task_id $task_id -context $package_id + foreach student_id [array names student_ids] { + if {[info exists student_ids($student_id)]} { + db_exec_plsql evaluation_relationship_new { *SQL* } + } + } +} + +ad_returnredirect "one-task?[export_vars -url { task_id }]" + + Index: openacs-4/packages/evaluation/www/admin/groups/group-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-new.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-new.adp 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,34 @@ + +@page_title;noquote@ +@context;noquote@ + + +
+@export_vars;noquote@ + + + + + + + + +
+
+ + + + + + +
Please enter the group name
+ + + + + + +
@students.rownum@.@students.student_name@
+
+
+
Index: openacs-4/packages/evaluation/www/admin/groups/group-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-new.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-new.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,42 @@ +# /packages/evaluation/www/admin/groups/group-new.tcl + +ad_page_contract { + Creates a evaluation group for a task. + + @author jopez@galileo.edu + @createion-date Mar 2004 + @cvs-id $Id: group-new.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + student_ids:array,integer,notnull + task_id:integer,notnull + {return_url "one-task?[export_vars -url { task_id }]"} +} -validate { + students_to_work_with { + if { [array size student_ids] == 0 } { + ad_complain "There must be some students selected in order to crate the group." + } + } +} + +set page_title "New Group" +set context [list [list "[export_vars -base one-task { task_id }]" "Task Groups"] "Create Group"] + +set current_groups_plus_one [db_string get_groups "select count(group_id)+1 from evaluation_task_groups where task_id = :task_id"] +set evaluation_group_id [db_nextval acs_object_id_seq] + +# if the structure of the multirow datasource ever changes, this needs to be rewritten +set counter 0 +foreach student_id [array names student_ids] { + if {[info exists student_ids($student_id)]} { + incr counter + set student_name [db_string get_student_name { *SQL* }] + set students:${counter}(rownum) $counter + set students:${counter}(student_name) $student_name + } +} + +set students:rowcount $counter + +set export_vars [export_vars -form { student_ids }] + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/groups/group-new.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-new.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-new.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + + select last_name ||', '|| first_names from persons where person_id=:student_id + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-remove-member-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-remove-member-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-remove-member-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.4 + + + + + select acs_rel__delete ( + :rel_id + ); + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-remove-member.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-remove-member.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-remove-member.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,17 @@ +# /packages/evaluation/www/admin/groups/group-remove-member.tcl + +ad_page_contract { + Deletes a task group + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: group-remove-member.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + rel_id:integer,notnull + task_id:integer,notnull + evaluation_group_id:integer,notnull +} + +db_exec_plsql delete_relationship { *SQL* } + +ad_returnredirect "one-group?[export_vars -url { evaluation_group_id task_id }]" Index: openacs-4/packages/evaluation/www/admin/groups/group-rename-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/Attic/group-rename-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-rename-2-postgresql.xql 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,15 @@ + + + + postgresql7.4 + + + + + update groups set group_name = :group_name + where group_id = :evaluation_group_id + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-rename-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/Attic/group-rename-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-rename-2.tcl 28 Apr 2004 11:06:42 -0000 1.1 @@ -0,0 +1,17 @@ +# /packages/evaluation/www/admin/groups/group-rename-2.tcl + +ad_page_contract { + Renames a group. + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: group-rename-2.tcl,v 1.1 2004/04/28 11:06:42 rocaelh Exp $ +} { + evaluation_group_id:integer + task_id:integer + group_name:notnull +} + +db_dml rename_group { *SQL* } + +ad_returnredirect "one-group?[export_vars -url { task_id evaluation_group_id }]" Index: openacs-4/packages/evaluation/www/admin/groups/group-rename.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-rename.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-rename.adp 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,18 @@ + +@page_title;noquote@ +@context;noquote@ + +
+@export_vars;noquote@ + + + + + + + + + +
Please enter the new group name

+
+ 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-rename.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,21 @@ +# /packages/evaluation/www/admin/groups/group-rename.tcl + +ad_page_contract { + Renames a group. + + @author jopez@galileo.edu + @createion-date Mar 2004 + @cvs-id $Id: group-rename.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + task_id:integer,notnull + evaluation_group_id:integer,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"] + +set group_name [evaluation::evaluation_group_name -group_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-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-reuse-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-reuse-2-postgresql.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,35 @@ + + + + postgresql7.4 + + + + + select etg.group_id as from_evaluation_group_id, + g.group_name + from evaluation_task_groups etg, groups g + where etg.task_id = :from_task_id + and etg.group_id = g.group_id + + + + + + + + select acs_rel__new ( + null, + 'evaluation_task_group_rel', + :new_evaluation_group_id, + map.object_id_two, + :package_id, + :creation_user_id, + :creation_ip + ) + from acs_rels map where map.object_id_one = :from_evaluation_group_id; + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-reuse-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-reuse-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-reuse-2.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,51 @@ +# /packages/evaluation/www/admin/groups/group-reuse-2.tcl + +ad_page_contract { + Creates groups for a task from another task + + @author jopez@galileo.edu + @creation-date Apr 2004 + @cvs-id $Id: group-reuse-2.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + task_id:integer,notnull + from_task_id:integer,notnull +} -validate { + no_groups { + if { [db_string get_groups_for_task "select count(*) from evaluation_task_groups where task_id = :task_id"] > 0 } { + ad_complain "There must be no groups for this task in order to copy the groups form another task. You can go back and delete the groups for this task." + } + } +} + +set package_id [ad_conn package_id] +set creation_user_id [ad_conn user_id] +set creation_ip [ad_conn peeraddr] + + +db_transaction { + + db_foreach evaluation_group { *SQL* } { + + set new_evaluation_group_id [db_nextval acs_object_id_seq] + + evaluation::new_evaluation_group -group_id $new_evaluation_group_id -group_name $group_name -task_id $task_id -context $package_id + + db_exec_plsql evaluation_relationship_new { *SQL* } + + } +} on_error { + ad_complain "There was an error creating the groups" + + ns_log Error "/evaluation/www/admin/groups/new-group-2.tcl choked: $errmsg" + + ad_return_error "Insert Failed" "This was the error: +
+
$errmsg
+
" + ad_script_abort +} + + +ad_returnredirect one-task.tcl?[export_vars task_id] + + Index: openacs-4/packages/evaluation/www/admin/groups/group-reuse-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-reuse-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-reuse-postgresql.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,23 @@ + + + + postgresql7.4 + + + + + select et.task_name, et.number_of_members, + et.task_id as from_task_id, + eg.grade_name + from evaluation_tasksi et, evaluation_gradesi eg + where content_revision__is_live(et.task_id) = true + and et.number_of_members > 1 + and et.grade_id = eg.grade_id + and content_revision__is_live(eg.grade_id) = true + and et.task_id <> :task_id + $orderby + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/group-reuse.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/group-reuse.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-reuse.adp 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context;noquote@ + +

Click on the task that you want the groups to be copy from

+ +
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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/group-reuse.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,49 @@ +# /packages/evaluation/www/admin/groups/group-reuse.tcl + +ad_page_contract { + Page for reusing evaluation groups + + @author jopez@galileo.edu + @creation-date Apr 2004 + @cvs-id $Id: group-reuse.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + task_id:integer,notnull + {orderby:optional} +} + +set page_title "Reuse Groups" +set context [list [list "[export_vars -base one-task { task_id }]" "Task Groups"] "Reuse Groups"] + +set elements [list task_name \ + [list label "Group Name" \ + link_url_col task_url \ + orderby_asc {task_name asc} \ + orderby_desc {task_name desc}] \ + number_of_members \ + [list label "No. of Members" \ + orderby_asc {number_of_members asc} \ + orderby_desc {number_of_members desc}] \ + grade_name \ + [list label "Grade Type" \ + orderby_asc {grade_name asc} \ + orderby_desc {grade_name desc}] \ + ] + +template::list::create \ + -name groups \ + -multirow groups \ + -filters { task_id {} } \ + -elements $elements + + +set orderby [template::list::orderby_clause -orderby -name groups] + +if { [string equal $orderby ""] } { + set orderby " order by et.task_name asc" +} + +db_multirow -extend { task_url } groups get_groups { *SQL* } { + set task_url [export_vars -base group-reuse-2 { from_task_id task_id }] +} + + \ No newline at end of file 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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/one-group.adp 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,22 @@ + +@page_title;noquote@ +@context;noquote@ + + +
+ + + + + +
+

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 -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/one-group.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,63 @@ +# /packages/evaluation/www/admin/groups/one-group.tcl + +ad_page_contract { + Shows the members of a group and options to edit the group + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: one-group.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + task_id:integer + evaluation_group_id:integer + {orderby:optional} +} + +set number_of_members [db_string get_no_of_members { *SQL* }] + +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 elements [list student_name \ + [list label "Student Name" \ + orderby_asc {student_name asc} \ + orderby_desc {student_name desc}] \ + desassociate_member \ + [list label "" \ + link_url_col desassociate_member_url \ + link_html { title "Desassociate student for this group" }] \ + ] + +template::list::create \ + -name one_group \ + -multirow one_group \ + -key group_id \ + -pass_properties { return_url evaluation_group_id } \ + -filters { task_id {} evaluation_group_id {} } \ + -actions $actions \ + -elements $elements + +set orderby [template::list::orderby_clause -orderby -name one_group] + +if { [string equal $orderby ""] } { + set orderby " order by student_name asc" +} + +db_multirow -extend { desassociate_member_url desassociate_member } one_group get_group_members { *SQL* } { + set desassociate_member_url [export_vars -base "group-remove-member" -url { evaluation_group_id task_id rel_id }] + set desassociate_member "Desassociate member" +} + +ad_return_template + + Index: openacs-4/packages/evaluation/www/admin/groups/one-group.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/one-group.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/one-group.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,30 @@ + + + + postgresql7.4 + + + + + select count(map.object_id_two) as number_of_members + from acs_rels map + where map.object_id_one = :evaluation_group_id + + + + + + + + select p.last_name||', '||p.first_names as student_name, + p.person_id as student_id, + map.rel_id + from persons p, acs_rels map + where p.person_id = map.object_id_two + and map.object_id_one = :evaluation_group_id + $orderby + + + + + Index: openacs-4/packages/evaluation/www/admin/groups/one-task.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/one-task.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/one-task.adp 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,35 @@ + +@page_title;noquote@ +@context;noquote@ + + + + + + +
@reuse_link;noquote@
+
+
+ + + + + + +
+

Number of Members
+ @n_of_members@

+
+
+
+
+ + +

Already created groups

+
+ +
+
+ + Index: openacs-4/packages/evaluation/www/admin/groups/one-task.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/one-task.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/one-task.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,112 @@ +# /evaluation/www/admin/groups/one-task.tcl + +ad_page_contract { + Shows the students and gropus associated with a task. + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: one-task.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + task_id:integer,notnull + {orderby:optional} + {orderby_groups:optional} + {return_url "one-task?[export_vars -url { task_id }]"} +} -validate { + group_task { + if { [string eq [db_string get_number_of_members { *SQL* }] 1] } { + ad_complain "This task is not in groups" + } + } +} + +db_1row get_info { *SQL* } + +set page_title "Groups for task $task_name" +set context [list "Task Groups"] + +set elements [list associate \ + [list label "" \ + display_template { } \ + ] \ + student_name \ + [list label "Name" \ + orderby_asc {student_name asc} \ + orderby_desc {student_name desc}] \ + associate_to_group \ + [list label "" \ + link_url_col associate_to_group_url \ + link_html { title "Associate to group..." }] \ + ] + + +template::list::create \ + -name students_without_group \ + -multirow students_without_group \ + -key student_id \ + -pass_properties { return_url student_id } \ + -filters { task_id {} } \ + -elements $elements + + +set orderby [template::list::orderby_clause -orderby -name students_without_group] + +if { [string equal $orderby ""] } { + set orderby " order by student_name asc" +} + +db_multirow -extend { associate_to_group_url associate_to_group } students_without_group get_students_without_group { *SQL* } { + set associate_to_group_url [export_vars -base "group-member-add" -url { task_id student_id }] + set associate_to_group "Associate to group..." +} + +set elements [list group_name \ + [list label "Group Name" \ + orderby_asc {group_name asc} \ + orderby_desc {group_name desc}] \ + members \ + [list label "Members" \ + display_template { @task_groups.members;noquote@ } \ + ] \ + number_of_members \ + [list label "Total of Members" \ + orderby_asc {number_of_members asc} \ + orderby_desc {number_of_members desc}] \ + group_administration \ + [list label "" \ + link_url_col group_administration_url \ + link_html { title "Group administration" }] \ + ] + + +template::list::create \ + -name task_groups \ + -multirow task_groups \ + -key evaluation_group_id \ + -pass_properties { return_url evaluation_group_id } \ + -filters { task_id {} } \ + -orderby_name orderby_groups \ + -elements $elements + + +set orderby_groups [template::list::orderby_clause -orderby -name task_groups] + +if { [string equal $orderby_groups ""] } { + set orderby_groups " order by group_name asc" +} + +db_multirow -extend { group_administration_url group_administration members } task_groups get_task_groups { *SQL* } { + set group_administration_url [export_vars -base "one-group" -url { task_id evaluation_group_id }] + set group_administration "Group administration" + set members [join [db_list get_group_members { *SQL* }] "
"] +} + +if { [db_string get_groups_for_task { *SQL* }] > 0 } { + set reuse_link "" +} else { + set reuse_link "Reuse groups from another task" +} + +ad_return_template + + + \ No newline at end of file Index: openacs-4/packages/evaluation/www/admin/groups/one-task.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/groups/one-task.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/groups/one-task.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,73 @@ + + + + postgresql7.4 + + + + + select number_of_members from evaluation_tasks where task_id = :task_id + + + + + + + + select task_name, number_of_members as n_of_members from evaluation_tasks where task_id = :task_id + + + + + + + + select p.last_name ||', '|| p.first_names as student_name, + p.person_id as student_id + from cc_users p + where p.person_id not in (select map.object_id_two from acs_rels map, evaluation_task_groups etg + where map.object_id_two = p.person_id + and map.object_id_one = etg.group_id + and etg.task_id = :task_id + and map.rel_type = 'evaluation_task_group_rel') + $orderby + + + + + + + + select g.group_id as evaluation_group_id, g.group_name, + count(map.object_id_two) as number_of_members + from groups g, evaluation_task_groups etg, + acs_rels map + where g.group_id = etg.group_id + and etg.group_id = map.object_id_one + and map.rel_type = 'evaluation_task_group_rel' + and etg.task_id = :task_id + group by g.group_id, g.group_name + $orderby_groups + + + + + + + + select p.last_name||', '||p.first_names from cc_users p, acs_rels map + where p.person_id = map.object_id_two + and map.object_id_one = :evaluation_group_id + + + + + + + + select count(*) from evaluation_task_groups where task_id = :task_id + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit-postgresql.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,29 @@ + + + + postgresql7.4 + + + + + select content_revision__get_content(ets.solution_id) as content, + crr.title, + crr.item_id, + cri.storage_type + from evaluation_tasks_sols 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 + + + + + + + + content_revision__content_copy(:solution_id, :revision_id) + + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.adp 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,5 @@ + + @page_title;noquote@ + @context;noquote@ + +

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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,224 @@ +# /packages/evaluation/www/admin/tasks/solution-add-edit.tcl + +ad_page_contract { + Page for editing and adding task solutions. + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: solution-add-edit.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + task_id:integer,notnull + solution_id:integer,notnull,optional + item_id:integer,notnull,optional + upload_file:trim,optional + upload_file.tmpfile:tmpfile,optional + {solution_mode "edit"} + grade_id:integer,notnull +} + +set package_id [ad_conn package_id] +set return_url "../../task-list?[export_vars { grade_id }]" + +if { [ad_form_new_p -key solution_id] } { + set page_title "Add Task Solution" +} else { + set page_title "View/Edit Task Solution" +} + +set context [list [list [export_vars -base ../grades/grades { }] "Grades"] $page_title] + +set attached_p "f" +ad_form -html { enctype multipart/form-data } -name solution -cancel_url $return_url -export { grade_id item_id storage_type task_id attached_p } -mode $solution_mode -form { + + solution_id:key + +} + +if { ![ad_form_new_p -key solution_id] } { + + 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 "File"} + {html "size 30"} + {help_text "Currently $title is attached to this task solution, but you can attach a different file/url just by adding it here"} + } + {unattach_p:text(checkbox),optional + {label "Unattach file?"} + {options {{"" "t"}}} + {help_text "Check this if you want to unattach the file"} + } + {url:text(text),optional + {label "URL"} + {value "http://"} + } + } + } else { + ad_form -extend -name solution -form { + {upload_file:text,optional + {label "File"} + {html "size 30"} + {value "[return $title]"} + {after_html "$title"} + } + {unattach_p:text(hidden) + } + {url:text(hidden) + } + } + } + } elseif { [regexp "http://" $content] } { + + if { [string eq $solution_mode "edit"] } { + + set attached_p "t" + + ad_form -extend -name solution -form { + + {upload_file:file,optional + {label "File"} + {html "size 30"} + } + {url:text(text),optional + {label "URL"} + {value "http://"} + {help_text "Currently $content is associated to this task solution, but you can associate a different url/file just by adding it here"} + } + {unattach_p:text(checkbox),optional + {label "Unassociate url?"} + {options {{"" "t"}}} + {help_text "Check this if you want to unattach the file"} + } + } + } else { + ad_form -extend -name solution -form { + + {upload_file:text(hidden) + } + {url:text(text),optional + {label "URL"} + {value "$content"} + {after_html "$content"} + } + {unattach_p:text(hidden) + } + } + } + } else { + ad_form -extend -name solution -form { + + {upload_file:file,optional + {label "File"} + {html "size 30"} + } + {url:text(text),optional + {label "URL"} + {value "http://"} + } + {unattach_p:text(hidden),optional + {value ""} + } + } + } +} else { + + ad_form -extend -name solution -form { + + {upload_file:file,optional + {label "File"} + {html "size 30"} + } + {url:text(text),optional + {label "URL"} + {value "http://"} + } + {unattach_p:text(hidden),optional + {value ""} + } + } +} + +ad_form -extend -name solution -form { + +} -edit_request { + + 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"]) } + {Upload a file OR a valid url, and not both } + } + {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"]) } + {Upload a file OR a url, and not both} + } + {unattach_p + { ([string eq $unattach_p "t"] && [empty_string_p $upload_file] && [string eq $url "http://"]) || [empty_string_p $unattach_p] } + {First unattach the file/url, then submit another one or just upload a new file/url and leave this in blank} + } +} -on_submit { + + db_transaction { + + set mime_type "text/plain" + set title "" + set storage_type text + if { ![empty_string_p $upload_file] } { + + # Get the filename part of the upload file + if { ![regexp {[^//\\]+$} $upload_file filename] } { + # no match + set filename $upload_file + } + + set title [template::util::file::get_property filename $upload_file] + set mime_type [cr_filename_to_mime_type -create $title] + + set storage_type lob + } elseif { ![string eq $url "http://"] } { + set mime_type "text/plain" + set title "link" + set storage_type text + } + + 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_id $task_id \ + -title $title -mime_type $mime_type] + + evaluation::set_live -revision_id $revision_id + + if { ![empty_string_p $upload_file] } { + + set tmp_file [template::util::file::get_property tmp_filename $upload_file] + + # create the new item + db_dml lob_content { *SQL* } -blob_files [list $tmp_file] + + } elseif { ![string eq $url "http://"] } { + + db_dml link_content { *SQL* } + + } elseif { [string eq $attached_p "t"] && ![string eq $unattach_p "t"] } { + # just copy the old content to the new revision + db_exec_plsql copy_content { *SQL* } + } elseif { [string eq $unattach_p "t"] } { + db_dml unassociate_task_sol { *SQL* } + } + } + + ad_returnredirect "[export_vars -base "../../task-list" { grade_id }]" + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/solution-add-edit.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,45 @@ + + + + postgresql7.4 + + + + + select crr.title, crr.item_id + from evaluation_tasks_sols ets, cr_revisions crr + where ets.solution_id = :solution_id + and crr.revision_id = ets.solution_id + + + + + + + + update cr_revisions + set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] + where revision_id = :revision_id + + + + + + + + update cr_revisions + set content = :url + where revision_id = :revision_id + + + + + + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit-postgresql.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,87 @@ + + + + postgresql7.4 + + + + + select grade_name, weight as grade_weight from evaluation_grades where grade_id = :grade_id + + + + + + + + select content_revision__get_content(et.revision_id) as content, + et.title, + et.item_id, + cri.storage_type + from evaluation_tasksi et, cr_items cri + where et.task_id = :task_id + and et.item_id = cri.item_id + + + + + + + + select et.task_name, et.description, to_char(et.due_date,'YYYY-MM-DD HH24:MI:SS') as due_date, + et.weight, et.number_of_members, et.online_p, et.late_submit_p, et.requires_grade_p + from evaluation_tasksi et + where task_id = :task_id + + + + + + + + select [template::util::date::get_property sql_date $due_date] from dual + + + + + + + + update cr_revisions + set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] + where revision_id = :revision_id + + + + + + + + update cr_revisions + set content = :url + where revision_id = :revision_id + + + + + + + + update cr_revisions + set content_length = :content_length + where revision_id = :revision_id + + + + + + + + content_revision__content_copy(:task_id, :revision_id) + + + + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.adp 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,5 @@ + + @page_title;noquote@ + @context;noquote@ + +

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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,298 @@ +# /packages/evaluation/www/admin/tasks/task-add-edit.tcl + +ad_page_contract { + Page for editing and adding tasks. + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: task-add-edit.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + grade_id:integer,notnull + task_id:integer,notnull,optional + item_id:integer,notnull,optional + upload_file:trim,optional + upload_file.tmpfile:tmpfile,optional + {mode "edit"} + return_url +} + +set package_id [ad_conn package_id] + +if { [ad_form_new_p -key task_id] } { + set page_title "Add Task" +} else { + set page_title "Edit Task" +} + +db_1row get_grade_info { *SQL* } + +set context [list [list [export_vars -base grades { package_id }] "Grades"] $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 { + + task_id:key + + {task_name:text + {label "Task Name"} + {html {size 30}} + } + +} + +if { ![ad_form_new_p -key task_id] } { + + db_1row get_task_info { *SQL* } + + if { [string eq $storage_type "lob"] } { + + if { [string eq $mode "edit"] } { + set attached_p "t" + + ad_form -extend -name task -form { + {upload_file:file,optional + {label "File"} + {html "size 30"} + {help_text "Currently $title is attached to this task, but you can attach a different file/url just by adding it here"} + } + {unattach_p:text(checkbox),optional + {label "Unattach file?"} + {options {{"" "t"}}} + {help_text "Check this if you want to unattach the file"} + } + {url:text(text),optional + {label "URL"} + {value "http://"} + } + } + } else { + ad_form -extend -name task -form { + {upload_file:text,optional + {label "File"} + {html "size 30"} + {value "$title"} + } + {unattach_p:text(hidden) + } + {url:text(hidden) + } + } + } + } elseif { [regexp "http://" $content] } { + + if { [string eq $mode "edit"] } { + + set attached_p "t" + + ad_form -extend -name task -form { + + {upload_file:file,optional + {label "File"} + {html "size 30"} + } + {url:text(text),optional + {label "URL"} + {value "http://"} + {help_text "Currently $content is associated to this task, but you can associate a different url/file just by adding it here"} + } + {unattach_p:text(checkbox), optional + {label "Unassociate url?"} + {options {{"" "t"}}} + {help_text "Check this if you want to unattach the file"} + } + } + } else { + ad_form -extend -name task -form { + + {upload_file:hidden + } + {url:text(text),optional + {label "URL"} + {value "$content"} + } + {unattach_p:text(hidden) + } + } + } + } else { + ad_form -extend -name task -form { + + {upload_file:file,optional + {label "File"} + {html "size 30"} + } + + {url:text(text),optional + {label "URL"} + {value "http://"} + } + + {unattach_p:text(hidden),optional + {value ""} + } + } + + } +} else { + + ad_form -extend -name task -form { + + {upload_file:file,optional + {label "File"} + {html "size 30"} + } + } + + ad_form -extend -name task -form { + + {url:text(text),optional + {label "URL"} + {value "http://"} + } + + {unattach_p:text(hidden),optional + {value ""} + } + } +} + +ad_form -extend -name task -form { + + {description:richtext,optional + {label "Task's Description"} + {html {rows 4 cols 40 wrap soft}} + } + + {due_date:date,to_sql(linear_date),from_sql(sql_date) + {label "Due Date"} + {format "MONTH DD YYYY"} + {today} + {help} + {value {[evaluation::now_plus_days -ndays 15]}} + } + + {weight:text + {label "Weight"} + {html {size 5}} + {help_text "over $grade_weight% of $grade_name"} + } + + {number_of_members:text + {label "Number of Members"} + {value "1"} + {html {size 5}} + {help_text "1 = Individual"} + } + + {online_p:text(radio) + {label "Will the task be submitted online?"} + {options {{Yes t} {No f}}} + {value t} + } + + {late_submit_p:text(radio) + {label "Can the student submit the answer
after the due date?"} + {options {{Yes t} {"No" f}}} + {value t} + } + + {requires_grade_p:text(radio) + {label "Will this task require a grade on the course?"} + {options {{Yes t} {"No" f}}} + {value t} + } + +} -edit_request { + + db_1row task_info { *SQL* } + + set due_date [template::util::date::from_ansi $due_date] + +} -validate { + {weight + { [ad_var_type_check_number_p $weight] } + {Weight is not a real number} + } + {due_date + { [template::util::date::compare $due_date [template::util::date::now]] > 0 } + {Due date must be in the future} + } + {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]) } + {Upload a file OR a url, not both} + } + {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]) } + {Upload a file OR a url, not both} + } + {number_of_members + { [ad_var_type_check_integer_p $number_of_members] } + {Number of members must be an integer} + } + {unattach_p + { ([string eq $unattach_p "t"] && [empty_string_p $upload_file] && [string eq $url "http://"]) || [empty_string_p $unattach_p] } + {First unattach the file/url, then submit another one or just upload a new file/url and leave this in blank} + } +} -on_submit { + + db_transaction { + + set mime_type "text/plain" + set title "" + set storage_type text + + if { ![empty_string_p $upload_file] } { + + # Get the filename part of the upload file + if { ![regexp {[^//\\]+$} $upload_file filename] } { + # no match + set filename $upload_file + } + + set title [template::util::file::get_property filename $upload_file] + set mime_type [cr_filename_to_mime_type -create $title] + + set storage_type lob + } + + set due_date [db_string set_date { *SQL* }] + + if { [ad_form_new_p -key task_id] } { + set item_id $task_id + } + + set revision_id [evaluation::new_task -new_item_p [ad_form_new_p -key grade_id] -item_id $item_id -content_type evaluation_tasks \ + -content_table evaluation_tasks -content_id task_id -name $task_name -description $description -weight $weight \ + -grade_id $grade_id -number_of_members $number_of_members -online_p $online_p -storage_type $storage_type \ + -due_date $due_date -late_submit_p $late_submit_p -requires_grade_p $requires_grade_p -title $title \ + -mime_type $mime_type] + + evaluation::set_live -revision_id $revision_id + + if { ![empty_string_p $upload_file] } { + + set tmp_file [template::util::file::get_property tmp_filename $upload_file] + + # create the new item + db_dml lob_content { *SQL* } -blob_files [list $tmp_file] + + set content_length [file size $tmp_file] + # Unfortunately, we can only calculate the file size after the lob is uploaded + db_dml lob_size { *SQL* } + + } elseif { ![string eq $url "http://"] } { + + db_dml link_content { *SQL* } + + } elseif { [string eq $attached_p "t"] && ![string eq $unattach_p "t"] } { + ns_log Notice "si pues.... \n" + # just copy the old content to the new revision + db_exec_plsql copy_content { *SQL* } + } + } + + ad_returnredirect "$return_url" + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/evaluation/www/admin/tasks/task-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-delete-2-postgresql.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.4 + + + + + select evaluation__delete_task ( + :task_id + ); + + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-delete-2.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,34 @@ +# /packages/evaluation/www/ + +ad_page_contract { + Removes relations + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: task-delete-2.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + task_id:integer,notnull + grade_id:integer,notnull + operation + return_url +} + +if { [string eq $operation "Yes, I really want to remove this task"] } { + db_transaction { + + db_exec_plsql delete_task { *SQL* } + + } on_error { + ad_return_error "Error deleting the task" "We got the following error while trying to remove the task:
$errmsg
" + ad_script_abort + } +} else { + if { [empty_string_p $return_url] } { + # redirect to the index page by default + set return_url "$return_url" + } +} + +db_release_unused_handles + +ad_returnredirect "$return_url" Index: openacs-4/packages/evaluation/www/admin/tasks/task-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-delete-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-delete-postgresql.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,21 @@ + + + + postgresql7.4 + + + + + select et3.task_name, + count(ets.solution_id) as task_sols, + count(ea.answer_id) as task_answers + from evaluation_tasks et3, + evaluation_tasks et2 left outer join evaluation_tasks_solsi ets on (ets.task_id = et2.task_id and content_revision__is_live(ets.solution_id) = true), + evaluation_tasks et left outer join evaluation_answersi ea on (ea.task_id = et.task_id and content_revision__is_live(ea.answer_id) = true) + where et3.task_id = :task_id + group by et3.task_name + + + + + Index: openacs-4/packages/evaluation/www/admin/tasks/task-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-delete.adp 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,12 @@ + +@context;noquote@ +Remove Grade + +Are you sure you want to delete the task "@task_name@"? (it has @task_sols@ solution(s) and @task_answers@ answer(s) assoticiated and they will be deleted too) + +

+ +

+ +
+ Index: openacs-4/packages/evaluation/www/admin/tasks/task-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/admin/tasks/task-delete.tcl 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,24 @@ +ad_page_contract { + + Deletes a task after confirmation + + @author jopez@galileo.edu + @creation-date Mar 2004 + @cvs-id $Id: task-delete.tcl,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ + +} { + task_id:integer,notnull + grade_id:integer,notnull + return_url +} + +set page_title "Delete Task" + +set context [list [list [export_vars -base ../grades/grades { }] "Grades"] $page_title] + + +db_1row get_task_info { *SQL* } + +set export_vars [export_form_vars task_id grade_id return_url] + +ad_return_template Index: openacs-4/packages/evaluation/www/view/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/view/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/view/index-postgresql.xql 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,15 @@ + + + + postgresql7.1 + + + + + select content_template__get_root_folder() + + + + + + Index: openacs-4/packages/evaluation/www/view/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/view/index.vuh,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/www/view/index.vuh 28 Apr 2004 11:09:54 -0000 1.1 @@ -0,0 +1,44 @@ +# /packages/evaluaiton/www/index.vuh + +ad_page_contract { + + @author Unknown + @creation-date Unknown + @cvs-id $Id: index.vuh,v 1.1 2004/04/28 11:09:54 rocaelh Exp $ +} { + revision_id:integer,notnull +} + +# Get the paths +set the_root [ns_info pageroot] +set the_url [ad_conn path_info] +set package_id [ad_conn package_id] + +# Get the IDs +set content_type [db_string get_content_type "select cri.content_type + from cr_items cri, cr_revisions crr + where cri.item_id = crr.item_id + and crr.revision_id = :revision_id"] + +set content_root [db_string get_folder_id "select crf.folder_id + from cr_folders crf + where crf.label = :content_type||'_'||:package_id"] + +set template_root "" + +# Serve the page + +if { [content::init the_url the_root $content_root $template_root public $revision_id $content_type] } { + set file "$the_root/$the_url" + rp_internal_redirect -absolute_path $file +} else { + # ns_returnnotfound + set page "[ad_header {Content Item Not Found}]" + append page "

Content Item Not Found

" + append page "The requested item is not available for viewing. " + append page "The item is either not available on this server or it is not in a publishable state " + append page "Unpublished items can be viewed via the CMS interface if the CMS package is installed.
" + append page "[ad_footer]" + doc_return 200 text/html $page +} +