Index: openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl 6 Jan 2006 12:37:39 -0000 1.12 +++ openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl 9 Jan 2006 05:46:50 -0000 1.13 @@ -280,7 +280,6 @@ # Add assessment and schedule section. template::form::section uos [_ curriculum-central.assessment_and_schedule] -# TODO: Work on the following assessment section. # Retrieve assessment info for Unit of Study. curriculum_central::uos::get_assessment \ -uos_id $uos_id \ @@ -307,6 +306,12 @@ } +# Add the grade descriptor widgets. +curriculum_central::uos::add_grade_descriptor_widgets \ + -uos_id $uos_id \ + -form_name uos + + # Add history section template::form::section uos [_ curriculum-central.history] @@ -339,18 +344,57 @@ foreach field [workflow::action::get_element -action_id $action_id -element edit_fields] { element set_properties uos $field -mode edit } + + # Retrieve some workflow information + workflow::case::enabled_action_get \ + -enabled_action_id $enabled_action_id \ + -array enabled_action_info + + workflow::action::get \ + -action_id $enabled_action_info(action_id) \ + -array action_info + + # If the current action is edit_assess, then set the + # grade descriptor fields as editable. + if { $action_info(short_name) eq "edit_assess"} { + foreach gd_field [curriculum_central::uos::get_grade_descriptor_fields] { + # Get the field name from the list of lists. + # type_id is the first item, and field_id is the second item. + # We are only interested in the second item. + set gd_field_name [lindex $gd_field 1] + + element set_properties uos $gd_field_name -mode edit + } + } } # on_submit block ad_form -extend -name uos -on_submit { array set row [list] + # For Grade Descriptor fields + set grade_descriptors [list] + if { $enabled_action_id ne "" } { foreach field [workflow::action::get_element \ -action_id $action_id -element edit_fields] { set row($field) [element get_value uos $field] + + ns_log Warning "NC: $field = [element get_value uos $field]" } + + # TODO: Create get_grade_descriptor_fields proc + foreach descriptor_field \ + [curriculum_central::uos::get_grade_descriptor_fields] { + set type_id [lindex $descriptor_field 0] + set field_id [lindex $descriptor_field 1] + + # Append grade_type_id followed by the description. + lappend grade_descriptors [list $type_id [element get_value uos $field_id]] + + ns_log Warning "$type_id - $field_id - [element get_value uos $field_id]" + } } set activity_log [element get_value uos activity_log] @@ -403,6 +447,9 @@ -assess_id $assess_id \ -assess_method_ids $assess_method_ids + curriculum_central::uos::update_grade_descriptors \ + -grade_set_id $grade_set_id \ + -grade_descriptors $grade_descriptors } # Do a general edit update.