Index: openacs-4/packages/assessment/assessment.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v diff -u -r1.36.2.3 -r1.36.2.4 --- openacs-4/packages/assessment/assessment.info 4 Jul 2005 15:26:16 -0000 1.36.2.3 +++ openacs-4/packages/assessment/assessment.info 18 Jul 2005 18:01:01 -0000 1.36.2.4 @@ -7,17 +7,17 @@ f f - + Eduardo Perez Ureta Assessment package that will replace the survey, quizz, complex survey, poll and other data collection packages that OpenACS currently supports. - 2005-07-04 + 2005-07-08 E-LANE Create assessments and evaluate. 0 - + @@ -34,7 +34,6 @@ - Index: openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml,v diff -u -r1.68.2.6 -r1.68.2.7 --- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 5 Jul 2005 18:42:37 -0000 1.68.2.6 +++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 18 Jul 2005 18:01:01 -0000 1.68.2.7 @@ -151,6 +151,7 @@ Title Existing Choice Set Choose the action to perform + What kind of assessment you want to create? Comparator You must set a Comparator for this Comparison Type Comparison Type @@ -542,7 +543,12 @@ Trigger Try again Two days ago + Type + Survey + Expert Assessment + Expert Assessment Type of the trigger + Survey Unhappy with your search result? Unlimited time for response Unlimited number of tries allowed Index: openacs-4/packages/assessment/sql/oracle/assessment-actions-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-actions-package-create.sql,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/assessment/sql/oracle/assessment-actions-package-create.sql 21 Jun 2005 15:14:24 -0000 1.5.2.1 +++ openacs-4/packages/assessment/sql/oracle/assessment-actions-package-create.sql 18 Jul 2005 18:01:01 -0000 1.5.2.2 @@ -127,9 +127,11 @@ db_transaction { array set user_new_info [auth::create_user -username $user_name -email $email -first_names $first_names -last_name $last_name -password $password] } + set admin_user_id [as::actions::get_admin_user_id] set administration_name [db_string admin_name "select first_names || '' '' || last_name from persons where person_id = :admin_user_id"] + set system_name [ad_system_name] set system_url [ad_parameter -package_id [ad_acs_kernel_id] SystemURL ""]. set admin_email [db_string unused "select email from parties where party_id = :admin_user_id"] Index: openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql 9 Apr 2005 22:39:27 -0000 1.6 +++ openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql 18 Jul 2005 18:01:01 -0000 1.6.2.1 @@ -122,7 +122,8 @@ -- differenciate between an assessment and a survey survey_p char(1) default 'f' constraint as_assessments_survey_p_ck - check (survey_p in ('t', 'f')) + check (survey_p in ('t', 'f')), + type integer ); -- Style Options Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.11-0.12.sql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.12-0.13.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql,v diff -u -r1.17 -r1.17.2.1 --- openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 9 Apr 2005 22:39:27 -0000 1.17 +++ openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 18 Jul 2005 18:01:01 -0000 1.17.2.1 @@ -122,7 +122,8 @@ -- differenciate between an assessment and a survey survey_p char(1) default 'f' constraint as_assessments_survey_p_ck - check (survey_p in ('t', 'f')) + check (survey_p in ('t', 'f')), + type integer ); -- Style Options Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.12-0.13.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/assessment/tcl/as-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-install-procs.tcl,v diff -u -r1.30.2.8 -r1.30.2.9 --- openacs-4/packages/assessment/tcl/as-install-procs.tcl 4 Jul 2005 16:19:14 -0000 1.30.2.8 +++ openacs-4/packages/assessment/tcl/as-install-procs.tcl 18 Jul 2005 18:01:01 -0000 1.30.2.9 @@ -167,7 +167,9 @@ content::type::attribute::new -content_type {as_assessments} -attribute_name {show_feedback} -datatype {string} -pretty_name {Assessment Show comments to the user} -column_spec {varchar(50)} content::type::attribute::new -content_type {as_assessments} -attribute_name {section_navigation} -datatype {string} -pretty_name {Assessment Navigation of sections} -column_spec {varchar(50)} content::type::attribute::new -content_type {as_assessments} -attribute_name {survey_p} -datatype {string} -pretty_name {Survey} -column_spec {char(1)} +content::type::attribute::new -content_type {as_assessments} -attribute_name {type} -datatype {number} -pretty_name {Type} -column_spec {integer} + # Sessions content::type::attribute::new -content_type {as_sessions} -attribute_name {assessment_id} -datatype {number} -pretty_name {Assessment ID} -column_spec {integer} content::type::attribute::new -content_type {as_sessions} -attribute_name {subject_id} -datatype {number} -pretty_name {Subject ID} -column_spec {integer} @@ -392,7 +394,10 @@ } } - + 0.12 0.13 { + content::type::attribute::new -content_type {as_assessments} -attribute_name {type} -datatype {number} -pretty_name {Type} -column_spec {integer} + + } } } Index: openacs-4/packages/assessment/www/assessment-section-submit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-section-submit.adp,v diff -u -r1.8.2.3 -r1.8.2.4 --- openacs-4/packages/assessment/www/assessment-section-submit.adp 15 Jun 2005 18:07:50 -0000 1.8.2.3 +++ openacs-4/packages/assessment/www/assessment-section-submit.adp 18 Jul 2005 18:01:01 -0000 1.8.2.4 @@ -3,11 +3,11 @@ @context;noquote@ - + Index: openacs-4/packages/assessment/www/assessment-single-submit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-single-submit.adp,v diff -u -r1.6.2.2 -r1.6.2.3 --- openacs-4/packages/assessment/www/assessment-single-submit.adp 7 Jun 2005 22:09:08 -0000 1.6.2.2 +++ openacs-4/packages/assessment/www/assessment-single-submit.adp 18 Jul 2005 18:01:01 -0000 1.6.2.3 @@ -3,11 +3,11 @@ @context_bar;noquote@
@assessment_data.title@
@assessment_data.html_title;noquote@
@assessment_data.instructions;noquote@
-#assessment.section_counter# -
#assessment.item_counter# +
#assessment.session_time_remaining#

#assessment.section_time_remaining#
- + Index: openacs-4/packages/assessment/www/finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/finish.tcl,v diff -u -r1.6.2.4 -r1.6.2.5 --- openacs-4/packages/assessment/www/finish.tcl 21 Jun 2005 15:14:25 -0000 1.6.2.4 +++ openacs-4/packages/assessment/www/finish.tcl 18 Jul 2005 18:01:01 -0000 1.6.2.5 @@ -15,8 +15,12 @@ } set user_id [ad_conn user_id] -db_dml update_session {update as_sessions set subject_id=:user_id where session_id=:session_id} +if { ![string eq $user_id 0]} { + + db_dml update_session {update as_sessions set subject_id=:user_id where session_id=:session_id} + db_dml update_session {update as_item_data set subject_id=:user_id where session_id=:session_id} +} set page_title "[_ assessment.Response_Submitted]" Index: openacs-4/packages/assessment/www/sessions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/sessions.tcl,v diff -u -r1.17.2.1 -r1.17.2.2 --- openacs-4/packages/assessment/www/sessions.tcl 31 May 2005 23:13:01 -0000 1.17.2.1 +++ openacs-4/packages/assessment/www/sessions.tcl 18 Jul 2005 18:01:01 -0000 1.17.2.2 @@ -62,7 +62,7 @@ } assessment_name { label {Assessment} - display_template {@sessions.assessment_name@@sessions.assessment_name@} + display_template {@sessions.assessment_name;noquote@@sessions.assessment_name;noquote@} } completed_datetime { label {[_ assessment.Finish_Time]} @@ -87,7 +87,7 @@ } assessment_name { label {Assessment} - display_template {@sessions.assessment_name@@sessions.assessment_name@} + display_template {@sessions.assessment_name;noquote@@sessions.assessment_name;noquote@} } completed_datetime { label {[_ assessment.Finish_Time]} Index: openacs-4/packages/assessment/www/admin/set-reg-assessment.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/set-reg-assessment.adp,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/assessment/www/admin/set-reg-assessment.adp 10 Jun 2005 18:53:31 -0000 1.1.2.2 +++ openacs-4/packages/assessment/www/admin/set-reg-assessment.adp 18 Jul 2005 18:01:01 -0000 1.1.2.3 @@ -5,7 +5,7 @@ #acs-subsite.no_assessment# -#acs-subsite.create_asm# +#acs-subsite.create_asm#

Index: openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl 8 Apr 2005 00:45:36 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl 18 Jul 2005 18:01:01 -0000 1.3.2.1 @@ -31,7 +31,7 @@ ad_form -name assessment_delete_confirm -action assessment-delete -form { {assessment_id:key} {assessment_title:text(inform) {label "[_ assessment.remove_1]"}} - {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} + {confirmation:text(radio) {label " "} {options $confirm_options} {value t}} } -select_query_name {assessment_title} \ -on_submit { if {$confirmation} { Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 8 Apr 2005 00:45:56 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 18 Jul 2005 18:01:01 -0000 1.2.2.1 @@ -1,7 +1,6 @@ @page_title;noquote@ @context;noquote@ -
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 Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/asm-admin/assessment-new.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/asm-admin/assessment-new.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl 7 Apr 2005 22:35:43 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl 18 Jul 2005 18:01:01 -0000 1.5.2.1 @@ -8,6 +8,7 @@ section_id:integer as_item_id:integer after:integer + {type ""} } -properties { context:onevalue page_title:onevalue @@ -27,8 +28,68 @@ set page_title [_ assessment.add_item_display_cb] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set type $assessment_data(type) +if {$type == 1} { + set html_options "" + set choice_orientation "vertical" + set label_orientation "top" + set order_type "order_of_entry" + set answer_alignment "besideright" + db_transaction { + 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] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + db_dml update_section_in_assessment {} + set old_item_id $as_item_id + + if {![db_0or1row item_display {}] || $object_type != "as_item_display_cb"} { + set as_item_display_id [as::item_display_cb::new \ + -html_display_options $html_options \ + -choice_orientation $choice_orientation \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + + if {![info exists object_type]} { + # first item display mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel + } else { + # old item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + db_dml update_item_display {} + } + } else { + # old cb item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_display_id [as::item_display_cb::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_options \ + -choice_orientation $choice_orientation \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + + db_dml update_item_display {} + } + + set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] + if {$old_item_id == 0} { + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } else { + db_1row item_data {} + db_dml update_item {} + } + } + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort + +} + + set choice_or_types [list] foreach choice_or_type [list horizontal vertical] { lappend choice_or_types [list "[_ assessment.$choice_or_type]" $choice_or_type] Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl 7 Apr 2005 22:36:19 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl 18 Jul 2005 18:01:01 -0000 1.5.2.1 @@ -8,6 +8,7 @@ section_id:integer as_item_id:integer after:integer + {type ""} } -properties { context:onevalue page_title:onevalue @@ -20,15 +21,72 @@ # Get the assessment data as::assessment::data -assessment_id $assessment_id + if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort } set page_title [_ assessment.add_item_display_rb] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set type $assessment_data(type) +if { $type == 1} { + set html_options "" + set choice_orientation "vertical" + set label_orientation "top" + set order_type "order_of_entry" + set answer_alignment "besideright" + db_transaction { + 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] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + db_dml update_section_in_assessment {} + set old_item_id $as_item_id + + if {![db_0or1row item_display {}] || $object_type != "as_item_display_rb"} { + set as_item_display_id [as::item_display_rb::new \ + -html_display_options $html_options \ + -choice_orientation $choice_orientation \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + + if {![info exists object_type]} { + # first item display mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel + } else { + # old item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + } + } else { + # old rb item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_display_id [as::item_display_rb::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_options \ + -choice_orientation $choice_orientation \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + } + + set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] + if {$old_item_id == 0} { + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } else { + db_dml update_item_display {} + db_1row item_data {} + db_dml update_item {} + } + } + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort +} + set choice_or_types [list] foreach choice_or_type [list horizontal vertical] { lappend choice_or_types [list "[_ assessment.$choice_or_type]" $choice_or_type] Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl 7 Apr 2005 22:40:43 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl 18 Jul 2005 18:01:01 -0000 1.5.2.1 @@ -8,6 +8,7 @@ section_id:integer as_item_id:integer after:integer + {type ""} } -properties { context:onevalue page_title:onevalue @@ -28,8 +29,66 @@ set page_title [_ assessment.add_item_display_sb] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set type $assessment_data(type) set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +if { $type == 1} { + set html_options "" + set multiple_p f + set label_orientation "top" + set order_type "order_of_entry" + set answer_alignment "besideright" + + db_transaction { + 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] + set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] + db_dml update_section_in_assessment {} + set old_item_id $as_item_id + + if {![db_0or1row item_display {}] || $object_type != "as_item_display_sb"} { + set as_item_display_id [as::item_display_sb::new \ + -html_display_options $html_options \ + -multiple_p $multiple_p \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + + if {![info exists object_type]} { + # first item display mapped + as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel + } else { + # old item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + } + } else { + # old sb item display existing + set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_display_id [as::item_display_sb::edit \ + -as_item_display_id $as_item_display_id \ + -html_display_options $html_options \ + -multiple_p $multiple_p \ + -choice_label_orientation $label_orientation \ + -sort_order_type $order_type \ + -item_answer_alignment $answer_alignment] + } + + set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0] + if {$old_item_id == 0} { + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } else { + db_dml update_item_display {} + db_1row item_data {} + db_dml update_item {} + } + } + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort + +} + set label_or_types [list] foreach label_or_type [list top left right bottom] { lappend label_or_types [list "[_ assessment.$label_or_type]" $label_or_type] Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl 31 May 2005 23:13:02 -0000 1.8.2.1 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl 18 Jul 2005 18:01:01 -0000 1.8.2.2 @@ -15,6 +15,7 @@ answer_val:array,optional percent:array,optional selected:array,optional + {type ""} } -properties { context:onevalue page_title:onevalue @@ -33,9 +34,12 @@ } set package_id [ad_conn package_id] +set type $assessment_data(type) set page_title [_ assessment.add_item_type_mc_choices] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + set selected_options [list [list "[_ assessment.yes]" t]] ad_form -name item_add_mc_choices -action item-add-mc-choices -export { assessment_id section_id after mc_id display_type } -html {enctype multipart/form-data} -form { @@ -45,6 +49,49 @@ # add form entries for each choice set ad_form_code "-form \{\n" set count_correct 0 + +if { $type == 1} { + set max_file_size 10000000 + # [ad_parameter MaxAttachmentSize] + set pretty_max_size [util_commify_number $max_file_size] + set folder_id [as::assessment::folder_id -package_id $package_id] + + db_transaction { + set count 0 + foreach choice_id [array names feedback] { + set feedback_text $feedback($choice_id) + set selected_p [ad_decode [info exists selected($choice_id)] 0 f t] + set percent_score $percent($choice_id) + set fixed_position $fixed_pos($choice_id) + set answer_value $answer_val($choice_id) + + eval set content "\$content_$choice_id" + if {![empty_string_p $content]} { + set filename [lindex $content 0] + set tmp_filename [lindex $content 1] + set file_mimetype [lindex $content 2] + set n_bytes [file size $tmp_filename] + + if { $n_bytes > $max_file_size && $max_file_size > 0 } { + ad_return_complaint 1 "[_ assessment.file_too_large]" + return + } + if { $n_bytes == 0 } { + ad_return_complaint 1 "[_ assessment.file_zero_size]" + return + } + set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]] + } else { + set content_rev_id "" + } + + db_dml update_choice_data {} + } + } + ad_returnredirect [export_vars -base "item-add-display-$display_type" {assessment_id section_id as_item_id after}] + ad_script_abort +} + db_foreach get_choices {} { if {$correct_answer_p == "t"} { append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \"\"\}\}\n" Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 7 Apr 2005 22:43:23 -0000 1.8 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 18 Jul 2005 18:01:01 -0000 1.8.2.1 @@ -33,6 +33,7 @@ set folder_id [as::assessment::folder_id -package_id $package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set correct_options [list [list "[_ assessment.yes]" t]] set add_existing_link [export_vars -base "item-add-mc-existing" {assessment_id section_id as_item_id after}] @@ -45,13 +46,29 @@ ad_form -name item_add_mc -action item-add-mc -export { assessment_id section_id after num_choices } -form { {as_item_id:key} {title:text {label "[_ assessment.choice_set_title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.mc_Title_help]"}} +} + +if { $type > 1} { +ad_form -extend -name item_add_mc -form { {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} {num_correct_answers:text,optional,nospell {label "[_ assessment.num_Correct_Answer]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Correct_help]"}} +} +} else { +ad_form -extend -name item_add_mc -form { + {increasing_p:text(hidden) {value ""}} + {negative_p:text(hidden) {value ""}} + {num_correct_answers:text(hidden) {value ""}} +} +} + + +ad_form -extend -name item_add_mc -form { {num_answers:text,optional,nospell {label "[_ assessment.num_Answers]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Answers_help]"}} {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} } + # add form entries for each choice set validate_list [list] set count_correct [array exists correct] @@ -62,6 +79,8 @@ } else { append ad_form_code "\{choice.$i:text,optional,nospell \{label \"[_ assessment.Choice] $i\"\} \{html \{size 80 maxlength 1000\}\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" } + + if { $type > 1} { if {[info exists correct($i)]} { append ad_form_code "\{correct.$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $i\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } else { @@ -70,6 +89,7 @@ if {[exists_and_not_null num_correct_answers] && $num_correct_answers > 0} { lappend validate_list "correct.$i {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\"" } + } } append ad_form_code "\}" if {[exists_and_not_null mc_id]} { @@ -149,7 +169,9 @@ set after_submit "{ # now go to form to enter choice-specific data + ad_returnredirect \[export_vars -base \"item-add-mc-choices\" {assessment_id section_id as_item_id after mc_id display_type}\] + ad_script_abort }" Index: openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl 7 Apr 2005 22:43:53 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl 18 Jul 2005 18:01:01 -0000 1.5.2.1 @@ -27,6 +27,7 @@ set page_title [_ assessment.add_item_type_oq] set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set type $assessment_data(type) set display_types [list] foreach display_type [db_list display_types {}] { @@ -37,10 +38,24 @@ ad_form -name item_add_oq -action item-add-oq -export { assessment_id section_id after } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} +} + +if { $type > 1} { + ad_form -extend -name item_add_oq -form { {default_value:text(textarea),optional,nospell {label "[_ assessment.Default_Value]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Deafult_Value_help]"}} {feedback:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_help]"}} {reference_answer:text(textarea),optional {label "[_ assessment.oq_Reference_Answer]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Reference_Answer_help]"}} {keywords:text(textarea),optional {label "[_ assessment.oq_Keywords]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Keywords_help]"}} + } +} else { + ad_form -extend -name item_add_oq -form { + {default_value:text(hidden) {value ""}} + {feedback:text(hidden) {value ""}} + {reference_answer:text(hidden) {value ""}} + {keywords:text(hidden) {value ""}} + } +} +ad_form -extend -name item_add_oq -form { {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} } -edit_request { set title "" Index: openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl 7 Apr 2005 22:44:33 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl 18 Jul 2005 18:01:01 -0000 1.4.2.1 @@ -29,6 +29,7 @@ set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set display_types [list] foreach display_type [db_list display_types {}] { @@ -39,8 +40,19 @@ ad_form -name item_add_sa -action item-add-sa -export { assessment_id section_id after } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.sa_Title_help]"}} - {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} - {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} +} +if { $type > 1} { + ad_form -extend -name item_add_sa -form { + {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} + {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} + } +} else { + ad_form -extend -name item_add_sa -form { + {increasing_p:text(hidden) {value f}} + {negative_p:text(hidden) {value f}} + } +} +ad_form -extend -name item_add_sa -form { {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} } -edit_request { set title "" Index: openacs-4/packages/assessment/www/asm-admin/item-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/assessment/www/asm-admin/item-add.tcl 31 May 2005 23:13:02 -0000 1.7.2.1 +++ openacs-4/packages/assessment/www/asm-admin/item-add.tcl 18 Jul 2005 18:01:01 -0000 1.7.2.2 @@ -29,6 +29,7 @@ set package_id [ad_conn package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set data_types [list] foreach data_type [list varchar text integer float date timestamp boolean content_type] { @@ -41,26 +42,50 @@ } -ad_form -name item_add -action item-add -export { assessment_id section_id after } -html {enctype multipart/form-data} -form { +ad_form -name item_add -action item-add -export { assessment_id section_id after type} -html {enctype multipart/form-data} -form { {as_item_id:key} {title:text(textarea) {label "[_ assessment.item_Title]"} {html {rows 3 cols 80 maxlength 1000}} {help_text "[_ assessment.item_Title_help]"}} - {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}} } +if { $type > 1} { + ad_form -extend -name item_add -form {{description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_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 0 -form_name item_add } +if { $type > 1} { ad_form -extend -name item_add -form { {content:file,optional {label "[_ assessment.item_Content]"} {help_text "[_ assessment.item_Content_help]"}} {subtext:text,optional {label "[_ assessment.Subtext]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.item_Subtext_help]"}} {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}} {field_code:text,optional,nospell {label "[_ assessment.Field_Code]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Code_help]"}} - {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}} +} +} +ad_form -extend -name item_add -form { {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}} +} +if { $type > 1} { +ad_form -extend -name item_add -form { {feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}} {feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_wrong_help]"}} {max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.item_time_help]"}} {points:integer,optional,nospell {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} +} +} else { +ad_form -extend -name item_add -form { + {description:text(hidden) {value ""}} + {content:text(hidden) {value ""}} + {subtext:text(hidden) {value ""}} + {field_name:text(hidden) {value ""}} + {field_code:text(hidden) {value ""}} + {feedback_right:text(hidden) {value ""}} + {feedback_wrong:text(hidden) {value ""}} + {max_time_to_complete:text(hidden) {value ""}} + {points:text(hidden) {value ""}} +} +} +ad_form -extend -name item_add -form { {data_type:text(select) {label "[_ assessment.Data_Type]"} {options $data_types} {help_text "[_ assessment.Data_Type_help]"}} {item_type:text(select) {label "[_ assessment.Item_Type]"} {options $item_types} {help_text "[_ assessment.Item_Type_help]"}} {num_choices:integer,optional,nospell {label "[_ assessment.Num_Choices]"} {html {size 5 maxlength 3}} {help_text "[_ assessment.Num_Choices_help]"}} @@ -79,6 +104,9 @@ set data_type "varchar" set item_type "sa" set num_choices 10 + if { $type == 1} { + set num_choices 3 + } } -on_submit { set category_ids [category::ad_form::get_categories -container_object_id $package_id] if {[empty_string_p $points]} { Index: openacs-4/packages/assessment/www/asm-admin/item-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-delete.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/assessment/www/asm-admin/item-delete.tcl 31 May 2005 23:13:02 -0000 1.4.2.1 +++ openacs-4/packages/assessment/www/asm-admin/item-delete.tcl 18 Jul 2005 18:01:01 -0000 1.4.2.2 @@ -33,7 +33,7 @@ {as_item_id:key} {item_title:text(inform) {label "[_ assessment.remove_1]"}} {from:text(inform) {label "[_ assessment.from]"} {value $assessment_data(title)}} - {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} + {confirmation:text(radio) {label " "} {options $confirm_options} {value t}} } -select_query_name {item_title} -on_submit { if {$confirmation} { db_transaction { Index: openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl 31 May 2005 23:13:02 -0000 1.7.2.1 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl 18 Jul 2005 18:01:01 -0000 1.7.2.2 @@ -29,6 +29,7 @@ set package_id [ad_conn package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set item_type [string range [db_string get_item_type {}] end-1 end] set display_types [list] @@ -40,8 +41,11 @@ ad_form -name item_edit_general -action item-edit-general -export { assessment_id section_id } -html {enctype multipart/form-data} -form { {as_item_id:key} {title:text(textarea) {label "[_ assessment.Title]"} {html {rows 3 cols 80}} {help_text "[_ assessment.item_Title_help]"}} - {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}} } +if { $type > 1} { + ad_form -extend -name item_edit_general -form { + {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_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 $as_item_id -form_name item_edit_general @@ -52,17 +56,39 @@ {delete_content:text(checkbox),optional {label "[_ assessment.item_Delete_Content]"} {options {{{$content_name} t}} }} } } - +} +if { $type > 1} { ad_form -extend -name item_edit_general -form { {content:file,optional {label "[_ assessment.item_Content]"} {help_text "[_ assessment.item_Content_help]"}} {subtext:text,optional {label "[_ assessment.Subtext]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.item_Subtext_help]"}} {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}} {field_code:text,optional,nospell {label "[_ assessment.Field_Code]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Code_help]"}} +} +} +ad_form -extend -name item_edit_general -form { {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}} +} +if { $type > 1} { +ad_form -extend -name item_edit_general -form { {feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}} {feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_wrong_help]"}} {max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.item_time_help]"}} {points:integer,optional,nospell {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} +} +} else { +ad_form -extend -name item_edit_general -form { + {description:text(hidden) {value ""}} + {content:text(hidden) {value ""}} + {subtext:text(hidden) {value ""}} + {field_name:text(hidden) {value ""}} + {field_code:text(hidden) {value ""}} + {feedback_right:text(hidden) {value ""}} + {max_time_to_complete:text(hidden) {value ""}} + {feedback_wrong:text(hidden) {value ""}} + {points:text(hidden) ""} +} +} +ad_form -extend -name item_edit_general -form { {data_type_disp:text(inform) {label "[_ assessment.Data_Type]"} {help_text "[_ assessment.Data_Type_help]"}} {data_type:text(hidden)} {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl,v diff -u -r1.8.2.3 -r1.8.2.4 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 6 Jul 2005 16:19:58 -0000 1.8.2.3 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 18 Jul 2005 18:01:01 -0000 1.8.2.4 @@ -37,14 +37,28 @@ set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] set correct_options [list [list "[_ assessment.yes]" t]] +set type $assessment_data(type) ad_form -name item_edit_mc -action item-edit-mc -export { assessment_id section_id num_choices } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.mc_Title_help]"}} +} + +if {$type > 1} { + ad_form -extend -name item_edit_mc -form { {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} {num_correct_answers:text,optional,nospell {label "[_ assessment.num_Correct_Answer]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Correct_help]"}} + } +} else { + ad_form -extend -name item_edit_mc -form { + {increasing_p:text(hidden) {value ""}} + {negative_p:text(hidden) {value ""}} + {num_correct_answers:text(hidden) {value ""}} + } +} +ad_form -extend -name item_edit_mc -form { {num_answers:text,optional,nospell {label "[_ assessment.num_Answers]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Answers_help]"}} } @@ -66,12 +80,14 @@ } append ad_form_code "\{choice.$choice_id:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice($choice_id)\"\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" + if { $type > 1} { if {[info exists correct($choice_id)]} { append ad_form_code "\{correct.$choice_id:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } else { append ad_form_code "\{correct.$choice_id:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } lappend validate_list "correct.$choice_id {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\"" + } } # add new empty form entries for new choices @@ -82,11 +98,13 @@ } else { append ad_form_code "\{choice._$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" } + if { $type > 1} { if {[info exists correct(_$i)]} { append ad_form_code "\{correct._$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } else { append ad_form_code "\{correct._$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } + } } append ad_form_code "\}" eval ad_form -extend -name item_edit_mc $ad_form_code Index: openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl 31 May 2005 23:13:02 -0000 1.4.2.1 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl 18 Jul 2005 18:01:01 -0000 1.4.2.2 @@ -27,15 +27,33 @@ set page_title [_ assessment.edit_item_type_oq] set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] +set type $assessment_data(type) + + ad_form -name item_edit_oq -action item-edit-oq -export { assessment_id section_id } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} +} + +if { $type > 1} { + ad_form -extend -name item_edit_oq -form { {default_value:text(textarea),optional,nospell {label "[_ assessment.Default_Value]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Deafult_Value_help]"}} {feedback_text:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_help]"}} {reference_answer:text(textarea),optional {label "[_ assessment.oq_Reference_Answer]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Reference_Answer_help]"}} {keywords:text(textarea),optional {label "[_ assessment.oq_Keywords]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Keywords_help]"}} -} -edit_request { + } +} else { + ad_form -extend -name item_edit_oq -form { + {default_value:text(hidden) {value ""}} + {feedback_text:text(hidden) {value ""}} + {reference_answer:text(hidden) {value ""}} + {keywords:text(hidden) {value ""}} + } + +} + +ad_form -extend -name item_edit_oq -edit_request { db_1row item_type_data {} set keywords [join $keywords "\n"] } -on_submit { Index: openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl 7 Apr 2005 22:49:52 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl 18 Jul 2005 18:01:01 -0000 1.4.2.1 @@ -28,14 +28,27 @@ set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) ad_form -name item_edit_sa -action item-edit-sa -export { assessment_id section_id } -form { {as_item_id:key} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} - {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} - {allow_negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} -} -edit_request { +} +if { $type > 1} { + ad_form -extend -name item_edit_sa -form { + {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}} + {allow_negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}} + } +} else { + ad_form -extend -name item_edit_sa -form { + {increasing_p:text(hidden) {value ""}} + {allow_negative_p:text(hidden) {value ""}} + + } +} + +ad_form -extend -name item_edit_sa -edit_request { db_1row item_type_data {} } -edit_data { db_transaction { Index: openacs-4/packages/assessment/www/asm-admin/one-a.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/one-a.adp,v diff -u -r1.11.2.3 -r1.11.2.4 --- openacs-4/packages/assessment/www/asm-admin/one-a.adp 5 Jul 2005 18:42:38 -0000 1.11.2.3 +++ openacs-4/packages/assessment/www/asm-admin/one-a.adp 18 Jul 2005 18:01:01 -0000 1.11.2.4 @@ -1,5 +1,5 @@ -@p_title@ +@p_title;noquote@ @context;noquote@
@assessment_data.title@
@assessment_data.html_title;noquote@
@assessment_data.instructions;noquote@
-#assessment.section_counter# -
#assessment.item_counter# +
#assessment.session_time_remaining#

#assessment.section_time_remaining#
@@ -11,13 +11,15 @@
- + +

#assessment.None#@assessment_data.instructions;noquote@ +

#assessment.None##assessment.type_s# #assessment.type_ea# +

#assessment.Assessment_Title#:

#assessment.Description#:

#assessment.Instructions#:

#assessment.Assessment_Title#:

#assessment.Description#:

#assessment.Instructions#:

#assessment.Type#:

- #assessment.Edit# - @assessment_data.title@
@is_reg_asm_p@
+ #assessment.Edit# + @assessment_data.title;noquote@
@is_reg_asm_p@

#assessment.None#@assessment_data.description;noquote@ -

#assessment.None#@assessment_data.instructions;noquote@

#assessment.View_Responses# Index: openacs-4/packages/assessment/www/asm-admin/one-a.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/one-a.tcl,v diff -u -r1.9.2.2 -r1.9.2.3 --- openacs-4/packages/assessment/www/asm-admin/one-a.tcl 21 Jun 2005 15:14:25 -0000 1.9.2.2 +++ openacs-4/packages/assessment/www/asm-admin/one-a.tcl 18 Jul 2005 18:01:01 -0000 1.9.2.3 @@ -23,7 +23,8 @@ set admin_p [acs_user::site_wide_admin_p] # Get the assessment data as::assessment::data -assessment_id $assessment_id -set context [list [list index [_ assessment.admin]] $assessment_data(title)] +set title [as::assessment::title -title $assessment_data(title)] +set context [list [list index [_ assessment.admin]] $title] set assessment_rev_id $assessment_data(assessment_rev_id) set subsite_id [subsite::main_site_id] @@ -68,7 +69,7 @@ set notification_chunk [notification::display::request_widget \ -type assessment_response_notif \ -object_id $assessment_id \ - -pretty_name $assessment_data(title) \ + -pretty_name $title \ -url [export_vars -base one-a {assessment_id reg_p}] ] db_multirow sections assessment_sections {} { Index: openacs-4/packages/assessment/www/asm-admin/section-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-delete.tcl,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/assessment/www/asm-admin/section-delete.tcl 31 May 2005 23:13:02 -0000 1.3.2.1 +++ openacs-4/packages/assessment/www/asm-admin/section-delete.tcl 18 Jul 2005 18:01:01 -0000 1.3.2.2 @@ -32,7 +32,7 @@ {section_id:key} {section_title:text(inform) {label "[_ assessment.remove_1]"}} {from:text(inform) {label "[_ assessment.from]"} {value $assessment_data(title)}} - {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} + {confirmation:text(radio) {label " "} {options $confirm_options} {value t}} } -select_query_name {section_title} \ -on_submit { if {$confirmation} { Index: openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl 7 Apr 2005 22:54:56 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl 18 Jul 2005 18:01:01 -0000 1.4.2.1 @@ -34,6 +34,7 @@ set package_id [ad_conn package_id] set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] +set type $assessment_data(type) set order_types [list] foreach one_order_type [list alphabetical randomized order_of_entry] { @@ -46,12 +47,26 @@ {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.sect_disp_Title_help]"}} {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.sect_disp_Description_help]"}} {num_items:integer,optional,nospell {label "[_ assessment.section_num_Items]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.sect_num_items_help]"}} +} + +if { $type > 1} { + ad_form -extend -name section_display_form -form { {adp_chunk:text(textarea),optional,nospell {label "[_ assessment.Section_Template]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_template_help]"}} {branched_p:text(select) {label "[_ assessment.section_Branched]"} {options $boolean_options} {help_text "[_ assessment.section_branched_help]"}} {back_button_p:text(select) {label "[_ assessment.Back_Button]"} {options $boolean_options} {help_text "[_ assessment.back_button_help]"}} {submit_answer_p:text(select) {label "[_ assessment.Submit_Answer]"} {options $boolean_options} {help_text "[_ assessment.submit_answer_help]"}} {sort_order_type:text(select) {label "[_ assessment.Section_Order]"} {options $order_types} {help_text "[_ assessment.section_order_help]"}} -} -new_request { + } +} else { + ad_form -extend -name section_display_form -form { + {adp_chunk:text(hidden) {value ""}} + {branched_p:text(hidden) {value ""}} + {back_button_p:text(hidden) {value ""}} + {submit_answer_p:text(hidden) {value ""}} + {sort_order_type:text(hidden) {value ""}} + } +} +ad_form -extend -name section_display_form -new_request { set title "" set description "" set num_items "" 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.5.2.1 -r1.5.2.2 --- openacs-4/packages/assessment/www/asm-admin/section-form.tcl 5 Jul 2005 16:34:05 -0000 1.5.2.1 +++ openacs-4/packages/assessment/www/asm-admin/section-form.tcl 18 Jul 2005 18:01:01 -0000 1.5.2.2 @@ -17,9 +17,11 @@ permission::require_permission -object_id $package_id -privilege create permission::require_permission -object_id $assessment_id -privilege admin + # Get the assessment data as::assessment::data -assessment_id $assessment_id + if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort @@ -37,8 +39,8 @@ 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} } @@ -55,19 +57,45 @@ ad_form -extend -name section_form -form { {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Title_help]"}} - {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Description_help]"}} } +if {$type > 1} { + ad_form -extend -name section_form -form { + {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_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 $_section_id -form_name section_form } + ad_form -extend -name section_form -form { {instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Instructions_help]"}} - {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]"}} +} +if {$type > 1} { + ad_form -extend -name section_form -form { + {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]"}} - {points:integer,optional,nospell {label "[_ assessment.points_section]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_section_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} } @@ -125,12 +153,13 @@ } -edit_data { db_transaction { - if { $display_type_id == -1} { - set display_type_id "" - } 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]