Index: openacs-4/packages/assessment/www/asm-admin/section-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-form.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/www/asm-admin/section-form.tcl 12 Jun 2006 02:49:51 -0000 1.6 +++ openacs-4/packages/assessment/www/asm-admin/section-form.tcl 15 May 2007 20:14:18 -0000 1.7 @@ -37,24 +37,12 @@ set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] -set display_types [db_list_of_lists section_display_types {}] -set display_types [concat [list [list "[_ assessment.no_display]" ""] [list "[_ assessment.section_new_display]" "-1"]] $display_types] set type $assessment_data(type) ad_form -name section_form -action section-form -export { assessment_id after } -form { {section_id:key} } -if {[info exists section_id]} { - ad_form -extend -name section_form -form { - {name:text(inform) {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Name_help]"}} - } -} else { - ad_form -extend -name section_form -form { - {name:text,optional,nospell {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Name_help]"}} - } -} - ad_form -extend -name section_form -form { {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Title_help]"}} } @@ -77,70 +65,34 @@ {feedback_text:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Feedback_help]"}} {max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.section_time_help]"}} } -} - -ad_form -extend -name section_form -form { - {num_items:integer,optional,nospell {label "[_ assessment.num_items]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_items_help]"}} -} -if {$type > 1} { - ad_form -extend -name section_form -form { - {points:integer,optional,nospell {label "[_ assessment.points_section]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_section_help]"}} - } } else { ad_form -extend -name section_form -form { {description:text(hidden) {value ""}} {feedback_text:text(hidden) {value ""}} {max_time_to_complete:text(hidden) {value ""}} - {points:text(hidden) {value ""}} } } -ad_form -extend -name section_form -form { - {display_type_id:text(select),optional {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.section_Display_Type_help]"}} - {no_display:text(hidden) {value f} - } -} -new_request { - set name "" +ad_form -extend -name section_form -new_request { set title "" set description "" set instructions "" set feedback_text "" set max_time_to_complete "" - set num_items "" - set points "" - set display_type_id "" - set no_display "f" } -edit_request { db_1row section_data {} -} -validate { - {name {[as::assessment::unique_name -name $name -new_p $__new_p]} "[_ assessment.name_used]"} } -on_submit { set category_ids [category::ad_form::get_categories -container_object_id $package_id] - if {[empty_string_p $points]} { - set points 0 - } } -new_data { - if { [empty_string_p $display_type_id]} { - set no_display "t" - } - if { $display_type_id == -1} { - set display_type_id "" - } - - db_transaction { set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] set new_section_id [as::section::new \ - -name $name \ -title $title \ -description $description \ -instructions $instructions \ -feedback_text $feedback_text \ - -max_time_to_complete $max_time_to_complete \ - -num_items $num_items \ - -points $points \ - -display_type_id $display_type_id] + -max_time_to_complete $max_time_to_complete] db_dml move_down_sections {} set sort_order [expr $after + 1] @@ -151,16 +103,8 @@ } } } -edit_data { - + db_transaction { - if { [empty_string_p $display_type_id]} { - set no_display "t" - } - - if { $display_type_id == -1} { - set display_type_id "" - } - set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] @@ -171,9 +115,6 @@ -instructions $instructions \ -feedback_text $feedback_text \ -max_time_to_complete $max_time_to_complete \ - -num_items $num_items \ - -points $points \ - -display_type_id $display_type_id\ -assessment_id $assessment_id] db_dml update_section_of_assessment {} @@ -183,17 +124,8 @@ } } } -after_submit { - if { $no_display } { - ad_returnredirect [export_vars -base one-a {assessment_id}] - ad_script_abort - } elseif {[empty_string_p $display_type_id]} { - set section_id $new_section_id - ad_returnredirect [export_vars -base section-display-form {assessment_id section_id}] - ad_script_abort - } else { - ad_returnredirect [export_vars -base one-a {assessment_id}] - ad_script_abort - } + ad_returnredirect [export_vars -base questions {assessment_id}] + ad_script_abort } ad_return_template