Index: openacs-4/packages/assessment/www/admin/assessment-form.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/assessment-form.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/assessment/www/admin/assessment-form.tcl 15 Nov 2004 17:17:16 -0000 1.2
+++ openacs-4/packages/assessment/www/admin/assessment-form.tcl 5 Dec 2004 17:15:23 -0000 1.3
@@ -12,56 +12,55 @@
if {[info exists assessment_id]} {
set page_title [_ assessment.Edit_Assessment]
+ set _assessment_id [db_string rev_id_from_item_id {}]
} else {
set page_title [_ assessment.New_Assessment2]
+ set _assessment_id 0
}
set context_bar [ad_context_bar $page_title]
set format "YYYY-MM-DD HH24:MI"
+set package_id [ad_conn package_id]
+set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+set feedback_options [list [list "[_ assessment.None]" none] [list "[_ assessment.All]" all] [list "[_ assessment.Only_incorrect]" incorrect] [list "[_ assessment.Only_correct]" correct]]
+set navigation_options [list [list "[_ assessment.Default_Path]" "default path"] [list "[_ assessment.Randomized]" randomized] [list "[_ assessment.Rulebased_branching]" "rule-based branching"]]
+
+
ad_form -name assessment_form -action assessment-form -form {
{assessment_id:key}
+ {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.as_Title_help]"}}
+ {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Description_help]"}}
}
-if {![exists_and_not_null assessment_id]} {
- ad_form -extend -name assessment_form -form {
- {name:text {label "[_ assessment.Name]"} {html {size 40 maxlength 400}}}
- }
+if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} {
+ category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id $_assessment_id -form_name assessment_form
}
-set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
-set feedback_options [list [list "[_ assessment.None]" none] [list "[_ assessment.All]" all] [list "[_ assessment.Only_incorrect]" incorrect] [list "[_ assessment.Only_correct]" correct]]
-set navigation_options [list [list "[_ assessment.Default_Path]" "default path"] [list "[_ assessment.Randomized]" randomized] [list "[_ assessment.Rulebased_branching]" "rule-based branching"]]
-
-
ad_form -extend -name assessment_form -form {
- {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}}}
- {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}}}
- {instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}}}
- {mode:text,optional {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}}}
- {editable_p:text(select) {label "[_ assessment.Editable]"} {options $boolean_options}}
- {anonymous_p:text(select) {label "[_ assessment.Anonymous_Responses]"} {options $boolean_options}}
- {secure_access_p:text(select) {label "[_ assessment.Secure_Access_1]"} {options $boolean_options}}
- {reuse_responses_p:text(select) {label "[_ assessment.Reuse_Responses_1]"} {options $boolean_options}}
- {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options}}
- {entry_page:text,optional {label "[_ assessment.Entry_Page]"} {html {size 50 maxlength 50}}}
- {exit_page:text,optional {label "[_ assessment.Exit_Page]"} {html {size 50 maxlength 50}}}
- {consent_page:text(textarea),optional {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}}}
- {return_url:text,optional {label "[_ assessment.Return_Url]"} {html {size 50 maxlength 50}}}
- {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.Start_Time]"} {format $format} {help}}
- {end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.End_Time]"} {format $format} {help}}
- {number_tries:integer,optional {label "[_ assessment.Number_of_Tries]"} {html {size 10 maxlength 10}}}
- {wait_between_tries:integer,optional {label "[_ assessment.Minutes_for_Retry]"} {html {size 10 maxlength 10}}}
- {time_for_response:integer,optional {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}}}
- {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options}}
- {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options}}
+ {instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Instructions_help]"}}
+ {mode:text,optional {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}} {help_text "[_ assessment.as_Mode_help]"}}
+ {anonymous_p:text(select) {label "[_ assessment.Anonymous_Responses]"} {options $boolean_options} {help_text "[_ assessment.as_Anonymous_help]"}}
+ {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]"}}
+ {entry_page:text,optional {label "[_ assessment.Entry_Page]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Entry_Page_help]"}}
+ {exit_page:text,optional {label "[_ assessment.Exit_Page]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Exit_Page_help]"}}
+ {consent_page:text(textarea),optional {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}}
+ {return_url:text,optional {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 $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 $format} {help} {help_text "[_ assessment.as_End_Time_help]"}}
+ {number_tries:integer,optional {label "[_ assessment.Number_of_Tries]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Number_Tries_help]"}}
+ {wait_between_tries:integer,optional {label "[_ assessment.Minutes_for_Retry]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Minutes_Retry_help]"}}
+ {time_for_response:integer,optional {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_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 {
set title ""
set description ""
set instructions ""
set mode ""
- set editable_p f
set anonymous_p f
set secure_access_p f
set reuse_responses_p f
@@ -93,53 +92,64 @@
if {$end_time == "NULL"} {
set end_time ""
}
+ set category_ids [category::ad_form::get_categories -container_object_id $package_id]
} -new_data {
- set assessment_rev_id [as::assessment::new \
- -title $title \
- -description $description \
- -instructions $instructions \
- -mode $mode \
- -editable_p $editable_p \
- -anonymous_p $anonymous_p \
- -secure_access_p $secure_access_p \
- -reuse_responses_p $reuse_responses_p \
- -show_item_name_p $show_item_name_p \
- -entry_page $entry_page \
- -exit_page $exit_page \
- -consent_page $consent_page \
- -return_url $return_url \
- -start_time $start_time \
- -end_time $end_time \
- -number_tries $number_tries \
- -wait_between_tries $wait_between_tries \
- -time_for_response $time_for_response \
- -show_feedback $show_feedback \
- -section_navigation $section_navigation]
+ db_transaction {
+ set assessment_rev_id [as::assessment::new \
+ -title $title \
+ -description $description \
+ -instructions $instructions \
+ -mode $mode \
+ -anonymous_p $anonymous_p \
+ -secure_access_p $secure_access_p \
+ -reuse_responses_p $reuse_responses_p \
+ -show_item_name_p $show_item_name_p \
+ -entry_page $entry_page \
+ -exit_page $exit_page \
+ -consent_page $consent_page \
+ -return_url $return_url \
+ -start_time $start_time \
+ -end_time $end_time \
+ -number_tries $number_tries \
+ -wait_between_tries $wait_between_tries \
+ -time_for_response $time_for_response \
+ -show_feedback $show_feedback \
+ -section_navigation $section_navigation]
- set assessment_id [db_string assessment_id_from_revision {}]
+ set assessment_id [db_string assessment_id_from_revision {}]
+
+ if {[exists_and_not_null category_ids]} {
+ category::map_object -object_id $assessment_rev_id $category_ids
+ }
+ }
} -edit_data {
- set assessment_rev_id [as::assessment::edit \
- -assessment_id $assessment_id \
- -title $title \
- -description $description \
- -instructions $instructions \
- -mode $mode \
- -editable_p $editable_p \
- -anonymous_p $anonymous_p \
- -secure_access_p $secure_access_p \
- -reuse_responses_p $reuse_responses_p \
- -show_item_name_p $show_item_name_p \
- -entry_page $entry_page \
- -exit_page $exit_page \
- -consent_page $consent_page \
- -return_url $return_url \
- -start_time $start_time \
- -end_time $end_time \
- -number_tries $number_tries \
- -wait_between_tries $wait_between_tries \
- -time_for_response $time_for_response \
- -show_feedback $show_feedback \
- -section_navigation $section_navigation]
+ db_transaction {
+ set assessment_rev_id [as::assessment::edit \
+ -assessment_id $assessment_id \
+ -title $title \
+ -description $description \
+ -instructions $instructions \
+ -mode $mode \
+ -anonymous_p $anonymous_p \
+ -secure_access_p $secure_access_p \
+ -reuse_responses_p $reuse_responses_p \
+ -show_item_name_p $show_item_name_p \
+ -entry_page $entry_page \
+ -exit_page $exit_page \
+ -consent_page $consent_page \
+ -return_url $return_url \
+ -start_time $start_time \
+ -end_time $end_time \
+ -number_tries $number_tries \
+ -wait_between_tries $wait_between_tries \
+ -time_for_response $time_for_response \
+ -show_feedback $show_feedback \
+ -section_navigation $section_navigation]
+
+ if {[exists_and_not_null category_ids]} {
+ category::map_object -object_id $assessment_rev_id $category_ids
+ }
+ }
} -after_submit {
ad_returnredirect [export_vars -base one-a {assessment_id}]
ad_script_abort
Index: openacs-4/packages/assessment/www/admin/assessment-form.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/assessment-form.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/www/admin/assessment-form.xql 14 Nov 2004 16:42:32 -0000 1.1
+++ openacs-4/packages/assessment/www/admin/assessment-form.xql 5 Dec 2004 17:15:23 -0000 1.2
@@ -4,7 +4,7 @@
+