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.3 -r1.3.2.1 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 12 Jun 2006 02:49:51 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 24 Jan 2007 20:15:30 -0000 1.3.2.1 @@ -1,6 +1,729 @@ @page_title;noquote@ @context;noquote@ -
- -
+ + + + +
+ + +
+#assessment.assessment_form_title_description# + + + + + + + + + + * + + + + + + + + + + + + +
+ @formerror.title;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.description;noquote@ +
+ +

+ + + +

+ +
+
+
+#assessment.assessment_form_instructions# + + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.instructions;noquote@ +
+ +

+ + + +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.run_mode;noquote@ +
+ +

+ + + +

+ +
+
+#assessment.assessment_form_response_options# + + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.anonymous_p;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.secure_access_p;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.reuse_responses_p;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.show_item_name_p;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.random_p;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.number_tries;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.wait_between_tries;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.time_for_response;noquote@ +
+ +

+ + + +

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.consent_page;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.return_url;noquote@ +
+ +

+ + + +

+ +
+
+#assessment.assessment_form_time_options# + + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.start_time;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.end_time;noquote@ +
+ +

+ + + +

+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.ip_mask;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.password;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.show_feedback;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.section_navigation;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.12 -r1.12.2.1 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 26 Sep 2006 00:22:46 -0000 1.12 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 24 Jan 2007 20:15:30 -0000 1.12.2.1 @@ -7,215 +7,200 @@ assessment_id:integer,optional {__new_p 0} {permission_p 0} - {edit_p:optional "0"} {type ""} {after "0"} } -properties { context:onevalue page_title:onevalue } +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +set user_id [ad_conn user_id] + if {![info exists assessment_id] || $__new_p} { + # new + set edit_p 0 + set page_title [_ assessment.New_Assessment2] set s_assessment_id 0 - } else { + # edit + set edit_p 1 + 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 {[empty_string_p $type]} { + db_0or1row rev_id_from_item_id {} ;# sets s_assessment_id + if { $type eq "" } { # 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 set context [list [list index [_ assessment.admin]] $page_title] -set package_id [ad_conn package_id] set form_format "[lc_get formbuilder_date_format] [lc_get formbuilder_time_format]" -set user_id [ad_conn user_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"]] - -## {entry_page:text,optional,nospell {label "[_ assessment.Entry_Page]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Entry_Page_help]"}} -## {exit_page:text,optional,nospell {label "[_ assessment.Exit_Page]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Exit_Page_help]"}} - - -ad_form -name assessment_form -export {permission_p after} -action assessment-form -form { - {assessment_id:key} -} - -if {[info exists assessment_id] && $edit_p } {# - ad_form -extend -name assessment_form -form { - {name:text(inform) {label "#assessment.Name#"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.assessment_Name_help]"}} +ad_form -name assessment_form \ + -export {permission_p after} \ + -action assessment-form \ + -form { + {assessment_id:key} } -} else { - if {$type > "survey" } { - ad_form -extend -name assessment_form -form { - {name:text,optional,nospell {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.assessment_Name_help]"}} - } - } else { - ad_form -extend -name assessment_form -form { - {name:text(hidden) {value ""}} - } - } -} 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]"}} } -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]"}}} - -if { $type eq "test" } { - 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 { $edit_p } { + 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 eq "test" } { + 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]"}} + } + } else { + ad_form -extend -name assessment_form -form { {run_mode:text(hidden) {value {}}} } } -} else { - ad_form -extend -name assessment_form -form { {run_mode:text(hidden) {value {}}} } -} -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}} - } -} else { - ad_form -extend -name assessment_form -form { - {anonymous_p:text(hidden) {value t}} + 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}} + } + } else { + ad_form -extend -name assessment_form -form { + {anonymous_p:text(hidden) {value t}} + } } -} -if { $type eq "test" } { 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]"}} + {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]"}} } -} else { - ad_form -extend -name assessment_form -form { - {secure_access_p:text(hidden) {value "f"}} - {reuse_responses_p:text(hidden) {value "f"}} - } -} -if { ($type eq "test" || $type eq "5") } { ad_form -extend -name assessment_form -form { - {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}} + {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}} } -} else { - ad_form -extend -name assessment_form -form { {show_item_name_p:text(hidden) {value "f"}} } -} -if { ($type eq "test" || $type eq "5") } { ad_form -extend -name assessment_form -form { - {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}} + {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}} } -} else { - ad_form -extend -name assessment_form -form { {random_p:text(hidden) {value "t"}} } -} -if { ($type eq "test" || $type eq "3" || $type eq "4") } { ad_form -extend -name assessment_form -form { - {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}} + {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}} } -} else { - ad_form -extend -name assessment_form -form { {consent_page:text(hidden) {value ""}} } -} -if { $type != 5 } { ad_form -extend -name assessment_form -form { - {return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50}} {help_text "[_ assessment.as_Return_Url_help]"}} + {return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50}} {help_text "[_ assessment.as_Return_Url_help]"}} } -} else { - ad_form -extend -name assessment_form -form { {return_url:text(hidden) {value {}}} } -} - - -if { $type eq "test" } { - 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]"}} + + if { $type eq "test" } { + 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]"}} + } + } else { + ad_form -extend -name assessment_form -form { + {start_time:date(hidden) {value ""}} + {end_time:date(hidden) {value ""}} + } } -} else { - ad_form -extend -name assessment_form -form { - {start_time:date(hidden) {value ""}} - {end_time:date(hidden) {value ""}} + + if { $type eq "test" } { + ad_form -extend -name assessment_form -form { + {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]"}} + } + } else { + ad_form -extend -name assessment_form -form { + {number_tries:text(hidden) {value ""}} + {wait_between_tries:text(hidden) {value ""}} + } } -} -if { $type eq "test" } { - ad_form -extend -name assessment_form -form { - {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]"}} + if { $type eq "test" } { + ad_form -extend -name assessment_form -form { + {time_for_response:integer,optional,nospell {label "[_ assessment.time_for_response]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_help]"}} + } + } else { + ad_form -extend -name assessment_form -form { + {time_for_response:text(hidden) {value ""}} + } } -} else { - ad_form -extend -name assessment_form -form { - {number_tries:text(hidden) {value ""}} - {wait_between_tries:text(hidden) {value ""}} - } -} -if { $type eq "test" } { - ad_form -extend -name assessment_form -form { - {time_for_response:integer,optional,nospell {label "[_ assessment.time_for_response]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_help]"}} + if { $type eq "test" } { + ad_form -extend -name assessment_form -form { + {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]"}} + } + } else { + ad_form -extend -name assessment_form -form { + {ip_mask:text(hidden) {value ""}} + {password:text(hidden) {value ""}} + } } -} else { - ad_form -extend -name assessment_form -form { - {time_for_response:text(hidden) {value ""}} + + if { $type eq "test" } { + ad_form -extend -name assessment_form -form { + {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options} {help_text "[_ assessment.as_Feedback_help]"}} + } + } else { + ad_form -extend -name assessment_form -form { + {show_feedback:text(hidden) {value ""}} + } } -} - -if { $type eq "test" } { - ad_form -extend -name assessment_form -form { - {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]"}} + + if { $type eq "test" } { + ad_form -extend -name assessment_form -form { + {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options} {help_text "[_ assessment.as_Navigation_help]"}} + } + } else { + ad_form -extend -name assessment_form -form { + {section_navigation:text(hidden) {value ""}} + } } } else { - ad_form -extend -name assessment_form -form { - {ip_mask:text(hidden) {value ""}} - {password:text(hidden) {value ""}} + # new + ad_form -extend -name assessment_form -form { + {run_mode:text(hidden) {value {}}} + {start_time:date(hidden) {value ""}} + {end_time:date(hidden) {value ""}} + {instructions:text(hidden) {value ""}} + {anonymous_p:text(hidden) {value t}} + {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 ""}} + {return_url:text(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 ""}} } } -if { $type eq "test" } { - ad_form -extend -name assessment_form -form { - {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options} {help_text "[_ assessment.as_Feedback_help]"}} - } -} else { - ad_form -extend -name assessment_form -form { - {show_feedback:text(hidden) {value ""}} - } -} - -if { $type eq "test" } { - ad_form -extend -name assessment_form -form { - {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options} {help_text "[_ assessment.as_Navigation_help]"}} - } -} else { - ad_form -extend -name assessment_form -form { - {section_navigation:text(hidden) {value ""}} - } -} - ad_form -extend -name assessment_form -form { {type:text(hidden) {value $type}} } ad_form -extend -name assessment_form -new_request { - set name "" + set new "" set title "" set description "" set instructions "" @@ -246,8 +231,6 @@ if {![empty_string_p $end_time]} { set end_time [util::date::acquire ansi $end_time] } -} -validate { - {name {[as::assessment::unique_name -name $name -new_p $__new_p]} "[_ assessment.name_used] $assessment_id"} } -on_submit { if {$start_time == "NULL"} { set start_time "" @@ -264,7 +247,6 @@ } -new_data { db_transaction { set assessment_rev_id [as::assessment::new \ - -name $name \ -title $title \ -creator_id $user_id \ -description $description \ @@ -306,22 +288,17 @@ if {![empty_string_p $end_time]} { db_dml update_end_time {} } - if { $type eq "survey"} { - db_transaction { - set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] - - set new_section_id [as::section::new -title [_ assessment.survey_section] ] - - db_dml move_down_sections {} - set sort_order [expr $after + 1] - db_dml add_section_to_assessment {} - - if {[exists_and_not_null category_ids]} { - category::map_object -object_id $new_section_id $category_ids - } - } - } - + + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + + set new_section_id [as::section::new -title [_ assessment.Questions] ] + db_dml move_down_sections {} + set sort_order [expr $after + 1] + db_dml add_section_to_assessment {} + + if {[exists_and_not_null category_ids]} { + category::map_object -object_id $new_section_id $category_ids + } } } -edit_data { db_transaction { Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.xql,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.xql 12 Jun 2006 02:49:51 -0000 1.5 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.xql 24 Jan 2007 20:15:30 -0000 1.5.2.1 @@ -4,11 +4,11 @@ - select ci.name, cr.title, cr.description, a.instructions, a.run_mode, a.ip_mask, a.password, - a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.show_item_name_p, random_p, - a.entry_page, a.exit_page, a.consent_page, a.return_url, a.number_tries, - a.wait_between_tries, a.time_for_response, a.show_feedback, a.section_navigation, - to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time + select ci.name, cr.title, cr.description, a.instructions, a.run_mode, a.anonymous_p, a.secure_access_p, + a.reuse_responses_p, a.show_item_name_p, random_p, a.consent_page, + to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time, + a.number_tries, a.wait_between_tries, a.time_for_response, a.ip_mask, a.password, + a.show_feedback, a.section_navigation, a.entry_page, a.exit_page, a.return_url from as_assessments a, cr_revisions cr, cr_items ci where ci.item_id = :assessment_id and cr.revision_id = ci.latest_revision Index: openacs-4/packages/assessment/www/asm-admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.adp,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/assessment/www/asm-admin/index.adp 12 Jun 2006 12:14:58 -0000 1.9 +++ openacs-4/packages/assessment/www/asm-admin/index.adp 24 Jan 2007 20:15:30 -0000 1.9.2.1 @@ -4,7 +4,7 @@ #assessment.admin_categories# -| #assessment.admin_actions# | #assessment.admin_requests# | #assessment.permissions# | #assessment.View_Sessions# +| #assessment.admin_actions# | #assessment.admin_requests# | #assessment.permissions# | #assessment.View_Sessions# #assessment.admin_requests# Index: openacs-4/packages/assessment/www/asm-admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.tcl,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/assessment/www/asm-admin/index.tcl 26 Sep 2006 00:22:46 -0000 1.11 +++ openacs-4/packages/assessment/www/asm-admin/index.tcl 24 Jan 2007 20:15:30 -0000 1.11.2.1 @@ -20,7 +20,7 @@ set folder_id [as::assessment::folder_id -package_id $package_id] set categories_url [db_string get_category_url {}] set user_id [ad_conn user_id] -set sw_admin [acs_user::site_wide_admin_p -user_id $user_id] +set sw_admin_p [acs_user::site_wide_admin_p -user_id $user_id] set package_admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege "admin"] #form to upload a QTI ZIP file @@ -39,7 +39,7 @@ lappend actions "[_ assessment.New_Assessment]" {assessment-form?type=test} "[_ assessment.New_Assessment2]" -if { $sw_admin && $advanced_options_p } { +if { $sw_admin_p && $advanced_options_p } { lappend actions [_ assessment.set_reg_asm] "../admin/set-reg-assessment" [_ assessment.set_reg_asm] } @@ -53,6 +53,15 @@ set export "[_ assessment.Export]" set permissions "[_ assessment.permissions]" set admin_request "[_ assessment.Request] [_ assessment.Administration]" + switch -- $publish_status { + live { + set publish_status "[_ assessment.Live]" + } + default { + set publish_status "[_ assessment.Not_Live]" + } + } + } # Bulk action for mass setting the start and endtime of assessments. @@ -71,6 +80,9 @@ label "[_ assessment.Title]" display_template {@assessments.title;noquote@} } + publish_status { + label "[_ assessment.Publish_Status]" + } export { label "[_ assessment.Export]" link_url_eval "[export_vars -base export { assessment_id }]" Index: openacs-4/packages/assessment/www/asm-admin/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.xql,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/assessment/www/asm-admin/index.xql 12 Jun 2006 02:49:51 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/index.xql 24 Jan 2007 20:15:30 -0000 1.4.2.1 @@ -3,7 +3,7 @@ - select ci.item_id as assessment_id, cr.title + select ci.item_id as assessment_id, cr.title, ci.publish_status from cr_items ci, cr_revisions cr where cr.revision_id = ci.latest_revision and ci.content_type = 'as_assessments' Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.xql,v diff -u -r1.1 -r1.1.6.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.xql 24 Jan 2007 20:15:30 -0000 1.1.6.1 @@ -1,7 +1,7 @@ - + select r.target_rev_id as as_item_display_id, o.object_type @@ -13,7 +13,7 @@ - + update as_assessment_section_map @@ -24,7 +24,7 @@ - + update as_item_section_map @@ -35,7 +35,7 @@ - + insert into as_item_section_map @@ -50,7 +50,7 @@ - + update as_item_rels @@ -61,7 +61,7 @@ - + select required_p, max_time_to_complete, points @@ -71,7 +71,7 @@ - + update as_item_section_map 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.9 -r1.9.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 12 Jun 2006 02:49:51 -0000 1.9 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 24 Jan 2007 20:15:30 -0000 1.9.2.1 @@ -119,7 +119,7 @@ set edit_data "{ db_transaction { if {!\[db_0or1row item_type {}\] || \$object_type != \"as_item_type_mc\"} { - set mc_id \[as::item_type_mc::new \\ +5~ set mc_id \[as::item_type_mc::new \\ -title \$title \\ -increasing_p \$increasing_p \\ -allow_negative_p \$negative_p \\ Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql 12 Jun 2006 02:49:51 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql 24 Jan 2007 20:15:30 -0000 1.4.2.1 @@ -1,4 +1,4 @@ - +as Index: openacs-4/packages/assessment/www/asm-admin/item-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add.adp,v diff -u -r1.2 -r1.2.6.1 --- openacs-4/packages/assessment/www/asm-admin/item-add.adp 7 Apr 2005 22:09:19 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-add.adp 24 Jan 2007 20:15:30 -0000 1.2.6.1 @@ -1,7 +1,595 @@ @page_title;noquote@ @context;noquote@ + + + +
+Question + +
+ + + + + + + + + + * + + + + + + + + + + + + + +
+ @formerror.question_text;noquote@ +
+
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.required_p;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.feedback_right;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.feedback_wrong;noquote@ +
+ +

+ + + +

+ +
+
+
+ + + + + + + + * + + + +
+ + +
+ + + +
+ @formerror.item_type;noquote@ +
+
-
- -
+
+ Multiple Choice +

#assessment.item_type_multiple_choice_help#

+
+ + +

Correct
Answer

+ +   
+
+ + + + + + + + + + + +
+ + + + + + + + + + +
+ @formerror.choice.1;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + @formgroup.widget;noquote@ + + + + +
+ @formerror.correct.1;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.choice.2;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + @formgroup.widget;noquote@ + + + + +
+ @formerror.correct.2;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.choice.3;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + @formgroup.widget;noquote@ + + + + +
+ @formerror.correct.3;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.choice.4;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + @formgroup.widget;noquote@ + + + + +
+ @formerror.correct.4;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ @formerror.choice.5;noquote@ +
+ +

+ + + +

+ +
+ + + + + + + + + + + + + + + + + + + + + @formgroup.widget;noquote@ + + + + +
+ @formerror.correct.5;noquote@ +
+ +

+ + + +

+ +
+ +
+
+
+
+Short Answer +

#assessment.item_type_short_answer_help#

+ +
+
+Long Answer +

#assessment.item_type_long_answer_help#

+ +
+

+
+
+File Upload +

#assessment.item_type_file_upload_help#

+ +
+
+
+
+ + +
+
+
+ +
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.13 -r1.13.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add.tcl 18 Nov 2006 13:28:26 -0000 1.13 +++ openacs-4/packages/assessment/www/asm-admin/item-add.tcl 24 Jan 2007 20:15:30 -0000 1.13.2.1 @@ -7,6 +7,8 @@ assessment_id:integer section_id:integer after:integer + choice:optional,array + correct:optional,array } -properties { context:onevalue page_title:onevalue @@ -31,70 +33,123 @@ 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] { - lappend data_types [list "[_ assessment.data_type_$data_type]" $data_type] -} +#set data_types [list] +#foreach data_type [list varchar text integer float date timestamp boolean content_type] { +# lappend data_types [list "[_ assessment.data_type_$data_type]" $data_type] +#} -set item_types [list] -foreach item_type [db_list item_types {}] { - lappend item_types [list "[_ assessment.item_type_$item_type]" $item_type] -} +set item_types [as_item_type::get_item_types] - -ad_form -name item_add -action item-add -export { assessment_id section_id after type} -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} - {question_text:richtext {label "[_ assessment.item_Question]"} {html {rows 9 cols 80 style {width: 100%}}} {help_text "[_ assessment.item_Question_help]"}} + {question_text:richtext,nospell {label "[_ assessment.item_Question]"} {html {rows 5 cols 80 style {width: 99%}}} {help_text "[_ assessment.item_Question_help]"}} } -if { $type > 1} { - ad_form -extend -name item_add -form {{description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 9 cols 80}} {help_text "[_ assessment.item_Description_help]"}} - } +if { $type ne "survey"} { +# 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 + 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]"}} - {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]"}} +if { $type ne "survey"} { +ad_form -extend -name item-add -form { +# {content:file,optional {label "[_ assessment.item_Content]"} {help_text "[_ assessment.item_Content_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_add -form { {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:richtext,optional {label "[_ assessment.Feedback_right]"} {html {rows 9 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}} - {feedback_wrong:richtext,optional {label "[_ assessment.Feedback_wrong]"} {html {rows 9 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]"}} +if { $type ne "survey"} { +ad_form -extend -name item-add -form { {points:integer,optional,nospell {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} + {feedback_right:richtext,optional,nospell {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80 style {width: 99%}}} {help_text "[_ assessment.Feedback_right_help]"}} + {feedback_wrong:richtext,optional,nospell {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80 style {width: 99%}}} {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]"}} + {field_code:text(hidden),optional} + {field_name:text(hidden),optional} + {max_time_to_complete:text(hidden),optional} + {validate_block:text(hidden),optional} + {content:text(hidden),optional} + {description:text(hidden),optional {value ""}} + {data_type:text(hidden),optional {value ""}} } } else { -ad_form -extend -name item_add -form { - {description:text(hidden) {value ""}} - {content:text(hidden) {value ""}} +ad_form -extend -name item-add -form { + {description:text(hidden),optional {value ""}} + {content:text(hidden),optional {value ""}} {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}} - {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 ""}} - {data_type:text(hidden) {value ""}} + {field_code:text(hidden),optional {value ""}} + {feedback_right:text(hidden),optional {value ""}} + {feedback_wrong:text(hidden),optional {value ""}} + {max_time_to_complete:text(hidden),optional {value ""}} + {points:text(hidden),ptional {value ""}} + {data_type:text(hidden),optional {value ""}} } } -if { $type > 1} { -ad_form -extend -name item_add -form { - {data_type:text(select) {label "[_ assessment.Data_Type]"} {options $data_types} {help_text "[_ assessment.Data_Type_help]"}}} +if { $type ne "survey"} { +#ad_form -extend -name item-add -form { +# {data_type:text(select) {label "[_ assessment.Data_Type]"} {options $data_types} {help_text "[_ assessment.Data_Type_help]"}}} +#} +ad_form -extend -name item-add -form { + {item_type:text(radio) {label "[_ assessment.Item_Type]"} {options $item_types} {help_text "[_ assessment.Item_Type_help]"}} +# {validate_block:text(textarea),optional {label "[_ assessment.Validation_Block]"} {help_text "[_ assessment.lt_This_field_is_used_to]"} {html {cols 70 rows 6}}} + {num_choices:text(hidden)} +} + +############################################################################## +# Multiple Choice Section +############################################################################## + +ad_form -extend -name item-add -form { + {ms_label:text,optional} + {add_another_choice:text(submit)} +} + +if {[template::form::is_submission item-add] \ + && [template::element::get_value item-add add_another_choice] \ + eq "add_another_choice"} { + set num_choices [element::get_value item-add num_choices] + incr num_choices + element::set_value item-add num_choices $num_choices } -ad_form -extend -name item_add -form { - {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]"}} - {validate_block:text(textarea),optional {label "[_ assessment.Validation_Block]"} {help_text "[_ assessment.lt_This_field_is_used_to]"} {html {cols 70 rows 6}}} -} -new_request { + +if {![template::form::is_submission item-add] \ + && ![info exists num_choices]} { + set num_choices 5 +} else { + set num_choices [template::element::get_value item-add num_choices] +} + +template::multirow create choice_elements id +for {set i 1} {$i <=$num_choices} {incr i} { + template::multirow append choice_elements ${i} +} +as::item_type_mc::add_choices_to_form \ + -form_id item-add \ + -num_choices $num_choices \ + -choice_array_name choice \ + -correct_choice_array_name correct + +# for open questions +ad_form -extend -name item-add -form { + {reference_answer:text(textarea),optional {label "[_ assessment.oq_Reference_Answer]"} {html {rows 5 style {width:95%}}} {help_text "[_ assessment.oq_Reference_Answer_help]"}} +} + +ad_form -extend -name item-add -form { + {formbutton_ok:text(submit)} + {formbutton_add_another_question:text(submit)} +} + +ad_form -extend -name item-add -validate { + {item_type {$item_type ne "mc" || [array size choice] > [llength [lsearch -all -exact [array get choice] ""]]} "Please enter at least one choice for multiple choice question."} +} +ad_form -extend -name item-add -new_request { set name "" set question_text "" set description "" @@ -105,30 +160,44 @@ set feedback_wrong "" set max_time_to_complete "" set points "" - set data_type "varchar" - set item_type "sa" - set num_choices 10 - if { $type == 1} { - set num_choices 3 - } + set num_choices 5 + set ms_label "Choose all that apply" } -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 {[string eq $item_type "sa"]} { + + if {[exists_and_not_null formbutton_ok] || [exists_and_not_null formbutton_add_another_question]} { + # map display types to data types + switch -exact $item_type { + sa { set data_type "varchar" - } elseif {[string eq $item_type "oq"]} { + set display_type "tb" + } + oq { set data_type "text" - } elseif {[string eq $item_type "mc"]} { + set display_type "ta" + } + mc { set data_type "varchar" - } elseif {[string eq $item_type "fu"]} { + set display_type "rb" + } + ms { + #multiple select is just multiple choice with checkboxes + set item_type "mc" + set data_type "varchar" + set display_type "cb" + } + fu { set data_type "file" - } + set display_type "fu" + } + } set question_text [template::util::richtext::get_property content $question_text] db_transaction { if {![db_0or1row item_exists {}]} { + set as_item_id [as::item::new \ -item_item_id $as_item_id \ -title $question_text \ @@ -186,11 +255,55 @@ set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]] as::item_rels::new -item_rev_id $as_item_id -target_rev_id $content_rev_id -type as_item_content_rel } + # check question type + + switch -exact $item_type { + mc { + as::item_type_mc::add_to_assessment \ + -assessment_id $assessment_id \ + -section_id $section_id \ + -as_item_id $as_item_id \ + -choices [array get choice] \ + -correct_choices [array get correct] \ + -after $after \ + -title $question_text\ + -display_type $display_type + } + oq { + as::item_type_oq::add_to_assessment \ + -assessment_id $assessment_id \ + -section_id $section_id \ + -as_item_id $as_item_id \ + -after $after \ + -title $question_text + } + sa { + as::item_type_sa::add_to_assessment \ + -assessment_id $assessment_id \ + -section_id $section_id \ + -as_item_id $as_item_id \ + -after $after \ + -title $question_text + } + fu { + as::item_type_fu::add_to_assessment \ + -assessment_id $assessment_id \ + -section_id $section_id \ + -as_item_id $as_item_id \ + -after $after \ + -title $question_text + } + } } +} } -after_submit { - # now go to item-type specific form (i.e. multiple choice) - ad_returnredirect [export_vars -base "item-add-$item_type" {assessment_id section_id as_item_id after num_choices}] - ad_script_abort + if {[exists_and_not_null formbutton_ok]} { + ad_returnredirect [export_vars -base one-section {assessment_id section_id}]&\#$as_item_id + ad_script_abort + } elseif {[exists_and_not_null formbutton_add_another_question]} { + set after [expr {$after + 1}] + ad_returnredirect [export_vars -base item-add {after assessment_id section_id}]&\#$as_item_id + } } ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc.adp,v diff -u -r1.3 -r1.3.6.1 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc.adp 18 Apr 2005 10:19:13 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc.adp 24 Jan 2007 20:15:30 -0000 1.3.6.1 @@ -3,5 +3,5 @@ @context;noquote@
- +
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.9 -r1.9.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 12 Jun 2006 02:49:51 -0000 1.9 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 24 Jan 2007 20:15:30 -0000 1.9.2.1 @@ -78,13 +78,13 @@ set correct($choice_id) t } } - 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" + append ad_form_code "\{choice.$choice_id:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice($choice_id)\"\} \}\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" + append ad_form_code "\{correct.$choice_id:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \}\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" + append ad_form_code "\{correct.$choice_id:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \}\n" } # lappend validate_list "correct.$choice_id {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\"" } @@ -94,15 +94,15 @@ for {set i 1} {$i <= $num_choices} {incr i} { incr count if {[info exists choice(_$i)]} { - append ad_form_code "\{choice._$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice(_$i)\"\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n" + append ad_form_code "\{choice._$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice(_$i)\"\} \}\n" } 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" + append ad_form_code "\{choice._$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\}\}\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" + append ad_form_code "\{correct._$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\}\}\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 "\{correct._$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \}\n" } } } Index: openacs-4/packages/assessment/www/asm-admin/item-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit.tcl,v diff -u -r1.10 -r1.10.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-edit.tcl 20 Oct 2006 18:02:42 -0000 1.10 +++ openacs-4/packages/assessment/www/asm-admin/item-edit.tcl 24 Jan 2007 20:15:30 -0000 1.10.2.1 @@ -37,6 +37,8 @@ set display_type f } set question_text [list $title text/html] +set feedback_right [list $feedback_right text/html] +set feedback_wrong [list $feedback_wrong text/html] ad_form -name item_edit -mode display -action item-edit-general -export { assessment_id section_id as_item_id } -form { {question_text:richtext {label "[_ assessment.Question]"} {html {rows 3 cols 80}} {value $question_text} {help_text "[_ assessment.item_Question_help]"}} {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {value $description} {help_text "[_ assessment.item_Description_help]"}} 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.17 -r1.17.2.1 --- openacs-4/packages/assessment/www/asm-admin/one-a.adp 28 Nov 2006 18:17:53 -0000 1.17 +++ openacs-4/packages/assessment/www/asm-admin/one-a.adp 24 Jan 2007 20:15:30 -0000 1.17.2.1 @@ -4,87 +4,112 @@ - - - +
#assessment.Created_by# @assessment_data.creator_name@#assessment.on_creation_date# - #assessment.history##assessment.other_asm#
+ + + +
#assessment.Created_by# @assessment_data.creator_name@#assessment.on_creation_date# - #assessment.history##assessment.other_asm#
-

- +
- - - +
#assessment.Assessment_Title#:

#assessment.publish_status#

#assessment.Description#:

#assessment.Instructions#:

#assessment.Type#:

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

#assessment.Live##assessment.Not_Live# (#assessment.Change_status#)

- -

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

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

#assessment.None##assessment.type_s# #assessment.type_ea# #assessment.Edit#

- - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + [ #assessment.Edit# ] + [ #assessment.Edit# ] + [ #assessment.Edit# ] -
+ #assessment.reg_asm# +
#assessment.View_Responses# - #assessment.All# | - #assessment.By_user# | - #assessment.CSV_file#
#assessment.Assessment_Title#:@assessment_data.title;noquote@ #assessment.Edit#
#assessment.publish_status#:#assessment.Live##assessment.Not_Live# (#assessment.Change_status#)
#assessment.Description#:#assessment.None#@assessment_data.description;noquote@ + #assessment.Edit#
#assessment.Instructions#:#assessment.None#@assessment_data.instructions;noquote@ + #assessment.Edit#
#assessment.Type#:#assessment.None# + #assessment.type_s# + #assessment.type_test# + (#assessment.Change_type#) +
#assessment.View_Responses# + #assessment.All# | + #assessment.By_user# | + #assessment.CSV_file#
#assessment.Response_Options# #assessment.Response_Options#
#assessment.anonymous_users_allow##assessment.reg_users_required# - - [ + #assessment.anonymous_users_allow# + #assessment.reg_users_required# - + [ #assessment.make_non_anonymous##assessment.make_anonymous# ]
#assessment.secure_access_require##assessment.unsecure_access_allow# - - [ + [ #assessment.make_unsecure##assessment.make_secure# ]
#assessment.reuse_responses##assessment.dont_reuse_responses# - - [ + [ #assessment.make_not_reuse_respo##assessment.make_reuse_responses# ]
#assessment.show_item_name##assessment.hide_item_name# - - [ + [ #assessment.make_hide_item_name##assessment.make_show_item_name# ]
#assessment.limited_tries##assessment.unlimited_tries# - - [ #assessment.Edit# ]
#assessment.time_to_wait##assessment.no_waiting# - - [ #assessment.Edit# ]
#assessment.time_response##assessment.unlimited_time# - - [ #assessment.Edit# ]
#assessment.Email_Options#@notification_chunk;noquote@
#assessment.Send_bulkmail# #assessment.regarding_this_assess#
-
#assessment.Extreme_Actions# #assessment.Delete_this_assess# #assessment.Removes_all_questio#
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.11 -r1.11.2.1 --- openacs-4/packages/assessment/www/asm-admin/one-a.tcl 12 Jun 2006 02:49:51 -0000 1.11 +++ openacs-4/packages/assessment/www/asm-admin/one-a.tcl 24 Jan 2007 20:15:30 -0000 1.11.2.1 @@ -14,49 +14,58 @@ {asm_instance ""} {reg_url ""} } -set is_reg_asm_p "" + set package_id [ad_conn package_id] -set p_title "" permission::require_permission -object_id $package_id -privilege create permission::require_permission -object_id $assessment_id -privilege admin -set admin_p [acs_user::site_wide_admin_p] + # Get the assessment data as::assessment::data -assessment_id $assessment_id set title [as::assessment::title -title $assessment_data(title)] +set p_title [_ assessment.One_Assessment_data] set context [list [list index [_ assessment.admin]] $title] set assessment_rev_id $assessment_data(assessment_rev_id) set subsite_id [subsite::main_site_id] +set registration_id [parameter::get -parameter RegistrationId -package_id $subsite_id] set url [apm_package_url_from_id $subsite_id] + +set admin_p [acs_user::site_wide_admin_p] set anonymous_p [db_string has_privilege {} -default "f"] set read_p [permission::permission_p -object_id $assessment_id -privilege read -party_id -1] -set value [parameter::get -parameter RegistrationId -package_id $subsite_id] +set creation_date [util_AnsiDatetoPrettyDate $assessment_data(creation_date)] +set creator_url [acs_community_member_url -user_id $assessment_data(creation_user)] +set history_url [export_vars -base assessment-history {assessment_id}] +set edit_url [export_vars -base assessment-form {assessment_id}] +set toggle_publish_url [export_vars -base toggle-publish {assessment_id}] +set toggle_type_url [export_vars -base toggle-type {assessment_id}] +set toggle_anon_url [export_vars -base toggle-boolean {assessment_id {param anonymous_p}}] +set toggle_secure_url [export_vars -base toggle-boolean {assessment_id {param secure_access_p}}] +set toggle_reuse_url [export_vars -base toggle-boolean {assessment_id {param reuse_responses_p}}] +set toggle_show_name_url [export_vars -base toggle-boolean {assessment_id {param show_item_name_p}}] +set sessions_url [export_vars -base sessions {assessment_id}] +set results_url [export_vars -base results-users {assessment_id}] +set export_url [export_vars -base results-export {assessment_id}] + if { [exists_and_not_null asm_instance]} { set reg_url "[apm_package_url_from_id $asm_instance]admin" } else { set reg_url "../admin" } -if { [string eq $assessment_id $value] } { - set is_reg_asm_p "[_ assessment.reg_asm]" -} -if {[exists_and_not_null is_reg_asm_p]} { +if { $assessment_id eq $registration_id } { + # This is the user-registration assessment + set is_reg_asm_p 1 set p_title "[_ assessment.Reg_Assessment_title]" -} else { - set p_title [_ assessment.One_Assessment_data] - } - if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort } -set creation_date [util_AnsiDatetoPrettyDate $assessment_data(creation_date)] -set creator_link [acs_community_member_url -user_id $assessment_data(creation_user)] if {$assessment_data(number_tries) > 0} { set response_limit_toggle "[_ assessment.allow_multiple]" } else { @@ -72,24 +81,12 @@ -pretty_name $title \ -url [export_vars -base one-a {assessment_id reg_p}] ] -db_multirow sections assessment_sections {} { +db_multirow -extend { section_url } sections assessment_sections {} { if {[empty_string_p $points]} { set points 0 } set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete] + set section_url [export_vars -base one-section {assessment_id section_id}] } -list::create \ - -name sections \ - -pass_properties assessment_id \ - -multirow sections \ - -key section_id \ - -no_data "[_ assessment.None]" \ - -elements { - title { - label "[_ assessment.Sections]" - display_template {@sections.title;noquote@} - } - } - ad_return_template Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/asm-admin/one-section.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/one-section.tcl'. 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/one-section.xql'. 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/questions.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/questions.tcl'. 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/questions.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/assessment/www/asm-admin/results-users.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-users.adp,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/assessment/www/asm-admin/results-users.adp 8 Dec 2006 23:55:26 -0000 1.4 +++ openacs-4/packages/assessment/www/asm-admin/results-users.adp 24 Jan 2007 20:15:30 -0000 1.4.2.1 @@ -3,7 +3,7 @@ @context;noquote@ - +

@count_all_users@ users in community, @count_complete@ complete responses, @count_incomplete@ incomplete responses

Index: openacs-4/packages/assessment/www/asm-admin/results-users.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-users.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/assessment/www/asm-admin/results-users.tcl 8 Dec 2006 14:36:54 -0000 1.9 +++ openacs-4/packages/assessment/www/asm-admin/results-users.tcl 24 Jan 2007 20:15:30 -0000 1.9.2.1 @@ -133,4 +133,15 @@ } } +# FIXME +set dotlrn_installed_p [apm_package_installed_p dotlrn] +if {$dotlrn_installed_p} { + set count_all_users [llength [dotlrn_community::list_users [dotlrn_community::get_community_id]]] +} else { + # TODO get count from subsite + set count_all_users 0 +} + +set count_complete [template::multirow size subjects] +set count_incomplete [expr {$count_all_users - $count_complete}] ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/results-users.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-users.xql,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/assessment/www/asm-admin/results-users.xql 6 Dec 2005 14:24:34 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/results-users.xql 24 Jan 2007 20:15:30 -0000 1.2.2.1 @@ -21,5 +21,4 @@ order by s.completed_datetime - 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.6.2.1 --- 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 24 Jan 2007 20:15:30 -0000 1.6.2.1 @@ -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 one-a {assessment_id}] + ad_script_abort } ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/section-form.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-form.xql,v diff -u -r1.1 -r1.1.6.1 --- openacs-4/packages/assessment/www/asm-admin/section-form.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/section-form.xql 24 Jan 2007 20:15:30 -0000 1.1.6.1 @@ -17,11 +17,10 @@ - select ci.name, cr.title, cr.description, s.instructions, s.display_type_id, + select cr.title, cr.description, s.instructions, s.display_type_id, s.feedback_text, s.max_time_to_complete, s.points, s.num_items - from as_sections s, cr_revisions cr, cr_items ci + from as_sections s, cr_revisions cr where cr.revision_id = s.section_id - and ci.item_id = cr.item_id and s.section_id = :section_id @@ -41,8 +40,8 @@ - insert into as_assessment_section_map (assessment_id, section_id, max_time_to_complete, sort_order, points) - values (:new_assessment_rev_id, :new_section_id, :max_time_to_complete, :sort_order, :points) + insert into as_assessment_section_map (assessment_id, section_id, max_time_to_complete, sort_order) + values (:new_assessment_rev_id, :new_section_id, :max_time_to_complete, :sort_order) @@ -52,7 +51,6 @@ update as_assessment_section_map set max_time_to_complete = :max_time_to_complete, - points = :points, section_id = :new_section_id where assessment_id = :new_assessment_rev_id and section_id = :section_id Index: openacs-4/packages/assessment/www/asm-admin/sessions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/sessions.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/assessment/www/asm-admin/sessions.tcl 18 Sep 2006 16:37:23 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/sessions.tcl 24 Jan 2007 20:15:30 -0000 1.2.2.1 @@ -26,7 +26,7 @@ if {![apm_package_installed_p dotlrn] \ || [set members_party_id [dotlrn_community::get_community_id]] eq ""} { set members_party_id [application_group::group_id_from_package_id \ - -package_id [ad_conn subsite_id] + -package_id [ad_conn subsite_id]] } set form [rp_getform] @@ -175,4 +175,11 @@ [list::filter_where_clauses -and -name "sessions"] order by lower(a.title), lower(a.last_name), lower(a.first_names) -}] \ No newline at end of file +}] + + + + + + + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/asm-admin/toggle-boolean.tcl'. 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/toggle-boolean.xql'. 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/toggle-type.tcl'. 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/toggle-type.xql'. Fisheye: No comparison available. Pass `N' to diff?