Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 4 Jul 2005 19:05:58 -0000 1.9.2.1 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 18 Jul 2005 18:01:01 -0000 1.9.2.2 @@ -8,19 +8,26 @@ {__new_p 0} {permission_p 0} {edit_p:optional "0"} + {type ""} } -properties { context:onevalue page_title:onevalue } - + if {![info exists assessment_id] || $__new_p} { set page_title [_ assessment.New_Assessment2] set s_assessment_id 0 + } else { set page_title [_ assessment.Edit_Assessment] permission::require_permission -object_id $assessment_id -privilege admin set s_assessment_id 0 db_0or1row rev_id_from_item_id {} + if {![info exist type]} { + # Get the assessment data + as::assessment::data -assessment_id $assessment_id + set type $assessment_data(type) + } } set package_id [ad_conn package_id] permission::require_permission -object_id $package_id -privilege create @@ -56,17 +63,26 @@ ad_form -extend -name assessment_form -form { {title:text,nospell {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.as_Title_help]"}} - {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Description_help]"}} } +if { $type > 1} { + ad_form -extend -name assessment_form -form { {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Description_help]"}} + } +} if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} { category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id $s_assessment_id -form_name assessment_form } -ad_form -extend -name assessment_form -form { - {instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Instructions_help]"}} - {run_mode:text,optional,nospell {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}} {help_text "[_ assessment.as_Mode_help]"}} + + +ad_form -extend -name assessment_form -form {{instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Instructions_help]"}} } +if { $type > 1} { + ad_form -extend -name assessment_form -form { + {run_mode:text,optional,nospell {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}} {help_text "[_ assessment.as_Mode_help]"}} + } +} + if { !$permission_p } { ad_form -extend -name assessment_form -form { {anonymous_p:text(select) {label "[_ assessment.Anonymous_Responses]"} {options $boolean_options} {help_text "[_ assessment.as_Anonymous_help]"} {value f}} @@ -77,22 +93,54 @@ } } -ad_form -extend -name assessment_form -form {{secure_access_p:text(select) {label "[_ assessment.Secure_Access_1]"} {options $boolean_options} {help_text "[_ assessment.as_Secure_Access_help]"}} - {reuse_responses_p:text(select) {label "[_ assessment.Reuse_Responses_1]"} {options $boolean_options} {help_text "[_ assessment.as_Reuse_Responses_help]"}} - {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}} - {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}} - {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}} - {return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Return_Url_help]"}} - {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_Start_Time_help]"}} - {end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.End_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_End_Time_help]"}} - {number_tries:integer,optional,nospell {label "[_ assessment.Number_of_Tries]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Number_Tries_help]"}} - {wait_between_tries:integer,optional,nospell {label "[_ assessment.Minutes_for_Retry]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Minutes_Retry_help]"}} - {time_for_response:integer,optional,nospell {label "[_ assessment.time_for_response]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_help]"}} - {ip_mask:text,optional,nospell {label "[_ assessment.ip_mask]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_ip_mask_help]"}} - {password:text,optional,nospell {label "[_ assessment.password]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_password_help]"}} - {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options} {help_text "[_ assessment.as_Feedback_help]"}} - {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options} {help_text "[_ assessment.as_Navigation_help]"}} -} -new_request { + +if { $type > 1} { + ad_form -extend -name assessment_form -form {{secure_access_p:text(select) {label "[_ assessment.Secure_Access_1]"} {options $boolean_options} {help_text "[_ assessment.as_Secure_Access_help]"}} + {reuse_responses_p:text(select) {label "[_ assessment.Reuse_Responses_1]"} {options $boolean_options} {help_text "[_ assessment.as_Reuse_Responses_help]"}} + {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}} + {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}} + {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}} + } +} + +ad_form -extend -name assessment_form -form {{return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Return_Url_help]"}}} + +if { $type > 1} { + ad_form -extend -name assessment_form -form { + {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_Start_Time_help]"}} + {end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.End_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_End_Time_help]"}} + {number_tries:integer,optional,nospell {label "[_ assessment.Number_of_Tries]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Number_Tries_help]"}} + {wait_between_tries:integer,optional,nospell {label "[_ assessment.Minutes_for_Retry]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Minutes_Retry_help]"}} + {time_for_response:integer,optional,nospell {label "[_ assessment.time_for_response]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_help]"}} + {ip_mask:text,optional,nospell {label "[_ assessment.ip_mask]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_ip_mask_help]"}} + {password:text,optional,nospell {label "[_ assessment.password]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_password_help]"}} + {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options} {help_text "[_ assessment.as_Feedback_help]"}} + {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options} {help_text "[_ assessment.as_Navigation_help]"}} + {type:text(hidden) {value $type}} + } +} else { + ad_form -extend -name assessment_form -form { + {description:text(hidden) value ""} + {run_mode:text(hidden) {value ""}} + {secure_access_p:text(hidden) {value "f"}} + {reuse_responses_p:text(hidden) {value "f"}} + {show_item_name_p:text(hidden) {value "f"}} + {random_p:text(hidden) {value "t"}} + {consent_page:text(hidden) {value ""}} + {start_time:date(hidden) {value ""}} + {end_time:date(hidden) {value ""}} + {number_tries:text(hidden) {value ""}} + {wait_between_tries:text(hidden) {value ""}} + {time_for_response:text(hidden) {value ""}} + {ip_mask:text(hidden) {value ""}} + {password:text(hidden) {value ""}} + {show_feedback:text(hidden) {value ""}} + {section_navigation:text(hidden) {value ""}} + {type:text(hidden) {value $type}} + } +} + +ad_form -extend -name assessment_form -new_request { set name "" set title "" set description "" @@ -165,7 +213,8 @@ -ip_mask $ip_mask \ -password $password \ -show_feedback $show_feedback \ - -section_navigation $section_navigation] + -section_navigation $section_navigation \ + -type $type] set assessment_id [db_string assessment_id_from_revision {}] @@ -209,7 +258,8 @@ -ip_mask $ip_mask \ -password $password \ -show_feedback $show_feedback \ - -section_navigation $section_navigation] + -section_navigation $section_navigation \ + -type $type] if {[exists_and_not_null category_ids]} { category::map_object -object_id $assessment_rev_id $category_ids