Index: openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml,v diff -u -r1.13 -r1.14 --- openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml 8 Oct 2004 23:32:06 -0000 1.13 +++ openacs-4/packages/evaluation/catalog/evaluation.en_US.ISO-8859-1.xml 27 Oct 2004 00:49:01 -0000 1.14 @@ -297,6 +297,7 @@ The assignment "%task_name%" has been uploaded in this community. The comments/edit reason is a string with no more than 4,000 characters. The edit reason must be less than 4000 characteras long + The estimated time must be grather than 0 The file extension of the file is "%file_extension" and it should be .CSV. Sorry, we can't process it" } } @@ -388,6 +389,7 @@ <blockquote> <pre>%errmsg%</pre> </blockquote> + Time estimated to complete this $grade_name (in hours) To add this assignment to other classes (where you are administrator) To chanche the name, edit the name in the text input and then click on the "Rename Group" botton. To delete the group, click on the "Delete Group" botton. Index: openacs-4/packages/evaluation/sql/postgresql/upgrade/upgrade-0.2d-0.3d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/sql/postgresql/upgrade/upgrade-0.2d-0.3d.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/evaluation/sql/postgresql/upgrade/upgrade-0.2d-0.3d.sql 27 Oct 2004 00:49:02 -0000 1.1 @@ -0,0 +1,76 @@ +alter table evaluation_tasks add column estimated_time decimal; + +comment on column evaluation_tasks.estimated_time is ' + Estimated time to complete the assignment +'; + +create or replace function evaluation__new_task (integer, integer, varchar, integer, integer, varchar, numeric, timestamptz, char, char, char, decimal, 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_item_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; + estimated_time alias for $12; + p_object_type alias for $13; + p_creation_date alias for $14; + p_creation_user alias for $15; + p_creation_ip alias for $16; + p_title alias for $17; -- default null + p_publish_date alias for $18; + p_nls_language alias for $19; -- default null + p_mime_type alias for $20; -- 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 + p_creation_date, -- creation_date + p_creation_user, -- creation_user + p_creation_ip, -- creation_ip + null -- content length + ); + + insert into evaluation_tasks + (task_id, + task_item_id, + task_name, + number_of_members, + due_date, + grade_item_id, + weight, + online_p, + late_submit_p, + requires_grade_p) + values + (v_revision_id, + p_item_id, + p_task_name, + p_number_of_members, + p_due_date, + p_grade_item_id, + p_weight, + p_online_p, + p_late_submit_p, + p_requires_grade_p); + + return v_revision_id; +end; +' language 'plpgsql'; + Index: openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql,v diff -u -r1.16 -r1.17 --- openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 10 Sep 2004 19:16:29 -0000 1.16 +++ openacs-4/packages/evaluation/tcl/evaluation-procs-postgresql.xql 27 Oct 2004 00:49:02 -0000 1.17 @@ -189,6 +189,7 @@ :late_submit_p, :online_p, :requires_grade_p, + :estimated_time, 'evaluation_tasks', now(), --creation date :creation_user, Index: openacs-4/packages/evaluation/tcl/evaluation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 16 Sep 2004 22:48:25 -0000 1.16 +++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 27 Oct 2004 00:49:02 -0000 1.17 @@ -21,10 +21,10 @@ -notif_type:required {-evaluation_id ""} } { - returns a full url to the object_id. - handles assignments and evaluations. + returns a full url to the object_id. + handles assignments and evaluations. } { - + set base_url "[ad_url][ad_conn package_url]" switch $notif_type { "one_assignment_notif" { @@ -46,9 +46,9 @@ -user_id:required {-tag_attributes ""} } { - returns the portrait for the given user or a default portrait if not found. + returns the portrait for the given user or a default portrait if not found. } { - + if { [db_0or1row user_portrait { *SQL* }] } { set output " 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 + @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_item_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_conn user_id] - set creation_ip [ad_conn peeraddr] + set package_id [ad_conn package_id] + set creation_user [ad_conn user_id] + set creation_ip [ad_conn peeraddr] - if { [empty_string_p $item_name] } { - set item_name "${item_id}_${title}" - } + if { [empty_string_p $item_name] } { + set item_name "${item_id}_${title}" + } - set revision_id [db_nextval acs_object_id_seq] + 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* } + 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 + # 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 { @@ -338,45 +339,45 @@ {-creation_date ""} } { - 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. + 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, file or text, depending on what are we going to store + @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, 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] + 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 item_name "${item_id}_${title}" - set revision_id [db_nextval acs_object_id_seq] + set revision_id [db_nextval acs_object_id_seq] - if { [empty_string_p $publish_date] } { - set publish_date [db_string get_publish_date "select now()"] - } + if { [empty_string_p $publish_date] } { + set publish_date [db_string get_publish_date "select now()"] + } - if { [empty_string_p $creation_date] } { - set creation_date [db_string get_creation_date "select now()"] - } + if { [empty_string_p $creation_date] } { + set creation_date [db_string get_creation_date "select now()"] + } - if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - } - - db_exec_plsql content_revision_new { *SQL* } + 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 + # 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 } @@ -395,45 +396,45 @@ {-creation_date ""} } { - 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. + 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, file or text, depending on what are we going to store - @param party_id Group or user_id thaw owns the anser + @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, file 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 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 item_name "${item_id}_${title}" - set revision_id [db_nextval acs_object_id_seq] + set revision_id [db_nextval acs_object_id_seq] - if { [empty_string_p $publish_date] } { - set publish_date [db_string get_publish_date "select now()"] - } + if { [empty_string_p $publish_date] } { + set publish_date [db_string get_publish_date "select now()"] + } - if { [empty_string_p $creation_date] } { - set creation_date [db_string get_creation_date "select now()"] - } + if { [empty_string_p $creation_date] } { + set creation_date [db_string get_creation_date "select now()"] + } - if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - } - - db_exec_plsql content_revision_new { *SQL* } + 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 + # 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 { @@ -453,45 +454,45 @@ {-publish_date ""} {-creation_date ""} } { - - 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. + + 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, file or text, depending on what are we going to store - @param description Comments on the evaluation - @param mime_type Mime type of the evaluation. + @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, file 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 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 item_name "${item_id}_${title}" - set revision_id [db_nextval acs_object_id_seq] + set revision_id [db_nextval acs_object_id_seq] - if { [empty_string_p $publish_date] } { - set publish_date [db_string get_publish_date "select now()"] - } + if { [empty_string_p $publish_date] } { + set publish_date [db_string get_publish_date "select now()"] + } - if { [empty_string_p $creation_date] } { - set creation_date [db_string get_creation_date "select now()"] - } + if { [empty_string_p $creation_date] } { + set creation_date [db_string get_creation_date "select now()"] + } - if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - } - - db_exec_plsql content_revision_new { *SQL* } + if { $new_item_p } { + db_exec_plsql content_item_new { *SQL* } + } + + db_exec_plsql content_revision_new { *SQL* } } @@ -503,42 +504,42 @@ {-creation_date ""} } { - 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. + 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. + @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] + 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] - if { [empty_string_p $creation_date] } { - set creation_date [db_string get_creation_date "select now()"] - } + if { [empty_string_p $creation_date] } { + set creation_date [db_string get_creation_date "select now()"] + } - db_exec_plsql evaluation_group_new { *SQL* } - - return $group_id + db_exec_plsql evaluation_group_new { *SQL* } + + return $group_id } ad_proc -public evaluation::evaluation_group_name { - -group_id:required + -group_id:required } { - @param group_id + @param group_id } { - return [db_exec_plsql evaluation_group_name { *SQL* }] + return [db_exec_plsql evaluation_group_name { *SQL* }] } @@ -556,103 +557,103 @@ {-publish_date ""} } { - Build a new content revision of a grades sheet. If new_item_p is - set true then a new item is first created, otherwise a new revision is created for - the item indicated by item_id. + Build a new content revision of a grades sheet. If new_item_p is + set true then a new item is first created, otherwise a new revision is created for + the item indicated by item_id. - @param item_id The item to update or create. - @param content_type The type to make - @param content_table - @param new_item_p If true make a new item using item_id - @param task_id Task which "owns" the grades sheet - @param title The name of the grades sheet - @param storage_type lob or file - @param mime_type Mime tipe of the grades sheet + @param item_id The item to update or create. + @param content_type The type to make + @param content_table + @param new_item_p If true make a new item using item_id + @param task_id Task which "owns" the grades sheet + @param title The name of the grades sheet + @param storage_type lob or file + @param mime_type Mime tipe of the grades sheet } { - set package_id [ad_conn package_id] - set creation_user [ad_verify_and_get_user_id] - set creation_ip [ad_conn peeraddr] + set 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 item_name "${item_id}_${title}" - set revision_id [db_nextval acs_object_id_seq] + set revision_id [db_nextval acs_object_id_seq] - if { [empty_string_p $publish_date] } { - set publish_date [db_string get_publish_date "select now()"] - } + if { [empty_string_p $publish_date] } { + set publish_date [db_string get_publish_date "select now()"] + } - if { [empty_string_p $creation_date] } { - set creation_date [db_string get_creation_date "select now()"] - } + if { [empty_string_p $creation_date] } { + set creation_date [db_string get_creation_date "select now()"] + } - if { $new_item_p } { - db_exec_plsql content_item_new { *SQL* } - } - - db_exec_plsql content_revision_new { *SQL* } + if { $new_item_p } { + db_exec_plsql content_item_new { *SQL* } + } + + db_exec_plsql content_revision_new { *SQL* } - return $revision_id + return $revision_id } ad_proc -public evaluation::generate_grades_sheet {} { # Get file_path from url set url [ns_conn url] - + regexp {/grades-sheet-csv-([^.]+).csv$} $url match task_id - + if { ![db_0or1row get_task_info { *SQL* }] } { - # this should never happen + # this should never happen ad_return_error "No information" "There has been an error, there is no infomraiton about the task $task_id" return } - + set csv_content [list] lappend csv_content "[_ evaluation.lt_Grades_sheet_for_assi]" - lappend csv_content "\n[_ evaluation.Max_Grade_]" - lappend csv_content "100" - lappend csv_content "\n[_ evaluation.lt_Will_the_student_be_a]" - lappend csv_content "1" + lappend csv_content "\n[_ evaluation.Max_Grade_]" + lappend csv_content "100" + lappend csv_content "\n[_ evaluation.lt_Will_the_student_be_a]" + lappend csv_content "1" - lappend csv_content "\n\n[_ evaluation.Id_]" - lappend csv_content "[_ evaluation.Name_]" - lappend csv_content "[_ evaluation.Grade_]" - lappend csv_content "[_ evaluation.CommentsEdit_reason_]" - - if { $number_of_members == 1 } { - # the task is individual + lappend csv_content "\n\n[_ evaluation.Id_]" + lappend csv_content "[_ evaluation.Name_]" + lappend csv_content "[_ evaluation.Grade_]" + lappend csv_content "[_ evaluation.CommentsEdit_reason_]" + + if { $number_of_members == 1 } { + # the task is individual - set community_id [dotlrn_community::get_community_id] - if { [empty_string_p $community_id] } { - set sql_query [db_map sql_query_individual] - } else { - set sql_query [db_map sql_qyery_comm_ind] - } - - } else { - # the task is in groups - - set sql_query [db_map sql_query_groups] + set community_id [dotlrn_community::get_community_id] + if { [empty_string_p $community_id] } { + set sql_query [db_map sql_query_individual] + } else { + set sql_query [db_map sql_qyery_comm_ind] } + + } else { + # the task is in groups + set sql_query [db_map sql_query_groups] + } + db_foreach parties_with_to_grade { *SQL* } { if { ![empty_string_p $grade] } { set grade [lc_numeric $grade] } - lappend csv_content "\n$party_id" - lappend csv_content "$party_name" - lappend csv_content "$grade" - lappend csv_content "$comments" - } if_no_rows { - ad_return_error "[_ evaluation.No_parties_to_grade_]" "[_ evaluation.lt_In_order_to_generate_]" - return - } - + lappend csv_content "\n$party_id" + lappend csv_content "$party_name" + lappend csv_content "$grade" + lappend csv_content "$comments" + } if_no_rows { + ad_return_error "[_ evaluation.No_parties_to_grade_]" "[_ evaluation.lt_In_order_to_generate_]" + return + } + set csv_formatted_content [join $csv_content ","] - + doc_return 200 text/csv " $csv_formatted_content" } @@ -702,7 +703,7 @@ } }] } - + ad_proc -public evaluation::apm::create_one_assignment_type { -impl_id:required } { Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 24 Sep 2004 21:23:15 -0000 1.18 +++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 27 Oct 2004 00:49:03 -0000 1.19 @@ -226,6 +226,12 @@ {options {{"[_ evaluation.Yes_]" t} {"[_ evaluation.No_]" f}}} {value t} } + + {estimated_time:float,optional + {label "[_ evaluation.lt_Time_estimated_to_com]"} + {html {size 5}} + {value "0"} + } } if { $new_p && ![empty_string_p $community_id] && [db_string get_user_comunities { *SQL* }] } { @@ -268,10 +274,14 @@ { !$weight || ([empty_string_p $weight] && [string eq $requires_grade_p f]) || (($weight > 0) && (!$net_value || [empty_string_p $net_value])) } { [_ evaluation.lt_The_weight_must_be_gr] } } - {number_of_members + {number_of_members { $number_of_members >= 1 } { [_ evaluation.lt_The_number_of_members]} } + {estimated_time + { $estimated_time >= 0 } + { [_ evaluation.lt_The_estimated_time_mu] } + } } -new_data { evaluation::notification::do_notification -task_id $revision_id -package_id [ad_conn package_id] -edit_p 0 -notif_type one_assignment_notif @@ -329,7 +339,7 @@ -content_table evaluation_tasks -content_id task_id -name $task_name -description $description -weight $weight \ -grade_item_id $grade_item_id -number_of_members $number_of_members -online_p $online_p -storage_type $storage_type \ -due_date $due_date -late_submit_p $late_submit_p -requires_grade_p $requires_grade_p -title $title \ - -mime_type $mime_type] + -mime_type $mime_type -estimated_time $estimated_time] evaluation::set_live -revision_id $revision_id