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.7 -r1.8
--- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 10 Jun 2004 21:08:54 -0000 1.7
+++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 7 Jul 2004 17:26:45 -0000 1.8
@@ -19,13 +19,15 @@
}
set package_id [ad_conn package_id]
+set user_id [ad_conn user_id]
set community_id [dotlrn_community::get_community_id]
set new_p [ad_form_new_p -key task_id]
+db_1row get_grade_info { *SQL* }
if { $new_p } {
- set page_title "[_ evaluation.Add_Task_]"
+ set page_title "[_ evaluation.Add_grade_name_]"
} else {
- set page_title "[_ evaluation.Edit_Task_]"
+ set page_title "[_ evaluation.Edit_grade_name_]"
}
if { [info exists admin_groups_p] } {
@@ -36,8 +38,6 @@
set checked_p ""
}
-db_1row get_grade_info { *SQL* }
-
set context [list $page_title]
set attached_p "f"
@@ -181,7 +181,7 @@
{due_date:date,to_sql(linear_date),from_sql(sql_date)
{label "[_ evaluation.Due_Date_]"}
- {format "MONTH DD YYYY"}
+ {format "MONTH DD YYYY HH24 MI SS"}
{today}
{help}
{value {[evaluation::now_plus_days -ndays 15]}}
@@ -195,10 +195,18 @@
{after_html {
}}
}
- {weight:float
- {label "[_ evaluation.Weight_]"}
+ {weight:float,optional
+ {label "[_ evaluation.lt_Weight_over_grade_wei_2]"}
+ {html {size 5}}
+ {help_text "[_ evaluation.lt_You_can_enter_the_wei]"}
+ {value "0"}
+ }
+
+ {net_value:float,optional
+ {label "[_ evaluation.Net_Value_]"}
{html {size 5}}
- {help_text "[_ evaluation.lt_over_grade_weight_of_]"}
+ {help_text "[_ evaluation.lt_If_you_enter_the_net_]"}
+ {value "0"}
}
{online_p:text(radio)
@@ -220,7 +228,7 @@
}
}
-if { $new_p && ![empty_string_p $community_id] } {
+if { $new_p && ![empty_string_p $community_id] && [db_string get_user_comunities { *SQL* }] } {
ad_form -extend -name task -form {
{add_to_more_classes_p:text(checkbox),optional
{label "[_ evaluation.lt_Add_this_assignment_t]"}
@@ -256,6 +264,14 @@
{ ([string eq $unattach_p "t"] && [empty_string_p $upload_file] && [string eq $url "http://"]) || [empty_string_p $unattach_p] }
{ [_ evaluation.lt_First_unattach_the_fi] }
}
+ {net_value
+ { [string eq [format %.2f $net_value] 0.00] || ([empty_string_p $net_value] && [string eq $requires_grade_p f]) || (($net_value > 0) && ($net_value <= $grade_weight) && ([string eq [format %.2f $weight] 0.00] || [empty_string_p $weight])) }
+ { [_ evaluation.lt_The_net_value_must_be] }
+ }
+ {weight
+ { [string eq [format %.2f $weight] 0.00] || ([empty_string_p $weight] && [string eq $requires_grade_p f]) || (($weight > 0) && ([string eq [format %.2f $net_value] 0.00] || [empty_string_p $net_value])) }
+ { [_ evaluation.lt_The_weight_must_be_gr] }
+ }
} -new_data {
evaluation::notification::do_notification -task_id $revision_id -package_id [ad_conn package_id] -edit_p 0 -notif_type one_assignment_notif
@@ -266,6 +282,14 @@
} -on_submit {
+ if { [string eq $requires_grade_p t] } {
+ if { [info exists net_value] && ($net_value > 0) } {
+ set weight [expr $net_value*100.000/$grade_weight]
+ }
+ } else {
+ set weight 0
+ }
+
db_transaction {
set mime_type "text/plain"