Index: openacs-4/packages/assessment/www/admin/item-add-display-cb.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-cb.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-cb.adp 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/admin/item-add-display-cb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-cb.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-cb.tcl 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,87 @@ +ad_page_contract { + Form to add an item with checkbox display. + + @author Timo Hentschel (timo@timohentschel.de) + @cvs-id $Id: +} { + assessment_id:integer + section_id:integer + as_item_id:integer + after:integer +} -properties { + context_bar:onevalue + page_title:onevalue +} + +ad_require_permission $assessment_id 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 +} + +set page_title [_ assessment.add_new_question] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + +set choice_or_types [list] +foreach choice_or_type [list horizontal vertical] { + lappend choice_or_types [list "[_ assessment.$choice_or_type]" $choice_or_type] +} + +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] +} + +set order_types [list] +foreach one_order_type [list numerical alphabetical randomized order_of_entry] { + lappend order_types [list "[_ assessment.$one_order_type]" $one_order_type] +} + +set alignment_types [list] +foreach alignment_type [list besideleft besideright below above] { + lappend alignment_types [list "[_ assessment.$alignment_type]" $alignment_type] +} + +ad_form -name item_add_display_cb -action item-add-display-cb -export { assessment_id section_id after } -form { + {as_item_id:key} + {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}} + {choice_orientation:text(select) {label "[_ assessment.Choice_Orientation]"} {options $choice_or_types} {help_text "[_ assessment.Choice_Orientation_help]"}} + {label_orientation:text(select) {label "[_ assessment.Label_Orientation]"} {options $label_or_types} {help_text "[_ assessment.Label_Orientation_help]"}} + {order_type:text(select) {label "[_ assessment.Order_Type]"} {options $order_types} {help_text "[_ assessment.Order_Type_help]"}} + {answer_alignment:text(select) {label "[_ assessment.Answer_Alignment]"} {options $alignment_types} {help_text "[_ assessment.Answer_Alignment_help]"}} +} -edit_request { + set html_options "" + set choice_orientation "vertical" + set label_orientation "top" + set order_type "order_of_entry" + set answer_alignment "beside-right" +} -edit_data { + db_transaction { + 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] + + content::item::relate -item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_id"] -object_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_display_id"] -relation_tag {as_item_display_rel} -relation_type {cr_item_rel} + + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id] + db_dml update_section_in_assessment {} + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } +} -after_submit { + # now go to assessment-page + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/admin/item-add-display-cb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-cb.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-cb.xql 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,36 @@ + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set sort_order = sort_order+1 + where section_id = :new_section_id + and sort_order > :after + + + + + + + + insert into as_item_section_map + (as_item_id, section_id, enabled_p, required_p, sort_order) + values (:as_item_id, :new_section_id, 't', 'f', :after) + + + + + Index: openacs-4/packages/assessment/www/admin/item-add-display-rb.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-rb.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-rb.adp 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/admin/item-add-display-rb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-rb.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-rb.tcl 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,87 @@ +ad_page_contract { + Form to add an item with radiobutton display. + + @author Timo Hentschel (timo@timohentschel.de) + @cvs-id $Id: +} { + assessment_id:integer + section_id:integer + as_item_id:integer + after:integer +} -properties { + context_bar:onevalue + page_title:onevalue +} + +ad_require_permission $assessment_id 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 +} + +set page_title [_ assessment.add_new_question] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + +set choice_or_types [list] +foreach choice_or_type [list horizontal vertical] { + lappend choice_or_types [list "[_ assessment.$choice_or_type]" $choice_or_type] +} + +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] +} + +set order_types [list] +foreach one_order_type [list numerical alphabetical randomized order_of_entry] { + lappend order_types [list "[_ assessment.$one_order_type]" $one_order_type] +} + +set alignment_types [list] +foreach alignment_type [list besideleft besideright below above] { + lappend alignment_types [list "[_ assessment.$alignment_type]" $alignment_type] +} + +ad_form -name item_add_display_rb -action item-add-display-rb -export { assessment_id section_id after } -form { + {as_item_id:key} + {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}} + {choice_orientation:text(select) {label "[_ assessment.Choice_Orientation]"} {options $choice_or_types} {help_text "[_ assessment.Choice_Orientation_help]"}} + {label_orientation:text(select) {label "[_ assessment.Label_Orientation]"} {options $label_or_types} {help_text "[_ assessment.Label_Orientation_help]"}} + {order_type:text(select) {label "[_ assessment.Order_Type]"} {options $order_types} {help_text "[_ assessment.Order_Type_help]"}} + {answer_alignment:text(select) {label "[_ assessment.Answer_Alignment]"} {options $alignment_types} {help_text "[_ assessment.Answer_Alignment_help]"}} +} -edit_request { + set html_options "" + set choice_orientation "vertical" + set label_orientation "top" + set order_type "order_of_entry" + set answer_alignment "beside-right" +} -edit_data { + db_transaction { + 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] + + content::item::relate -item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_id"] -object_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_display_id"] -relation_tag {as_item_display_rel} -relation_type {cr_item_rel} + + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id] + db_dml update_section_in_assessment {} + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } +} -after_submit { + # now go to assessment-page + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/admin/item-add-display-rb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-rb.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-rb.xql 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,36 @@ + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set sort_order = sort_order+1 + where section_id = :new_section_id + and sort_order > :after + + + + + + + + insert into as_item_section_map + (as_item_id, section_id, enabled_p, required_p, sort_order) + values (:as_item_id, :new_section_id, 't', 'f', :after) + + + + + Index: openacs-4/packages/assessment/www/admin/item-add-display-sa.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-sa.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-sa.adp 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/admin/item-add-display-sa.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-sa.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-sa.tcl 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,67 @@ +ad_page_contract { + Form to add an item with selectbox display. + + @author Timo Hentschel (timo@timohentschel.de) + @cvs-id $Id: +} { + assessment_id:integer + section_id:integer + as_item_id:integer + after:integer +} -properties { + context_bar:onevalue + page_title:onevalue +} + +ad_require_permission $assessment_id 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 +} + +set page_title [_ assessment.add_new_question] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + +set orientation_types [list] +foreach orientation_type [list horizontal vertical] { + lappend orientation_types [list "[_ assessment.$orientation_type]" $orientation_type] +} + + +ad_form -name item_add_display_sa -action item-add-display-sa -export { assessment_id section_id after } -form { + {as_item_id:key} + {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}} + {abs_size:text {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.Absolute_Size_help]"}} + {box_orientation:text(select) {label "[_ assessment.Box_Orientation]"} {options $orientation_types} {help_text "[_ assessment.Box_Orientation_help]"}} +} -edit_request { + set html_options "" + set abs_size 5 + set box_orientation "vertical" +} -edit_data { + db_transaction { + set as_item_display_id [as::item_display_sa::new \ + -html_display_options $html_options \ + -abs_size $abs_size \ + -box_orientation $box_orientation] + + content::item::relate -item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_id"] -object_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_display_id"] -relation_tag {as_item_display_rel} -relation_type {cr_item_rel} + + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id] + db_dml update_section_in_assessment {} + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } +} -after_submit { + # now go to assessment-page + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/admin/item-add-display-sa.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-sa.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-sa.xql 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,36 @@ + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set sort_order = sort_order+1 + where section_id = :new_section_id + and sort_order > :after + + + + + + + + insert into as_item_section_map + (as_item_id, section_id, enabled_p, required_p, sort_order) + values (:as_item_id, :new_section_id, 't', 'f', :after) + + + + + Index: openacs-4/packages/assessment/www/admin/item-add-display-ta.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-ta.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-ta.adp 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/admin/item-add-display-ta.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-ta.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-ta.tcl 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,68 @@ +ad_page_contract { + Form to add an item with textarea display. + + @author Timo Hentschel (timo@timohentschel.de) + @cvs-id $Id: +} { + assessment_id:integer + section_id:integer + as_item_id:integer + after:integer +} -properties { + context_bar:onevalue + page_title:onevalue +} + +ad_require_permission $assessment_id 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 +} + +set page_title [_ assessment.add_new_question] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + +set alignment_types [list] +foreach alignment_type [list besideleft besideright below above] { + lappend alignment_types [list "[_ assessment.$alignment_type]" $alignment_type] +} + + +ad_form -name item_add_display_ta -action item-add-display-ta -export { assessment_id section_id after } -form { + {as_item_id:key} + {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}} + {abs_size:text {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.Absolute_Size_help]"}} + {answer_alignment:text(select) {label "[_ assessment.Answer_Alignment]"} {options $alignment_types} {help_text "[_ assessment.Answer_Alignment_help]"}} +} -edit_request { + set html_options "" + set abs_size 1000 + set answer_alignment "beside-right" +} -edit_data { + db_transaction { + set as_item_display_id [as::item_display_ta::new \ + -html_display_options $html_options \ + -abs_size $abs_size \ + -acs_widget "" \ + -item_answer_alignment $answer_alignment] + + content::item::relate -item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_id"] -object_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_display_id"] -relation_tag {as_item_display_rel} -relation_type {cr_item_rel} + + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id] + db_dml update_section_in_assessment {} + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } +} -after_submit { + # now go to assessment-page + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/admin/item-add-display-ta.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-ta.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-ta.xql 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,36 @@ + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set sort_order = sort_order+1 + where section_id = :new_section_id + and sort_order > :after + + + + + + + + insert into as_item_section_map + (as_item_id, section_id, enabled_p, required_p, sort_order) + values (:as_item_id, :new_section_id, 't', 'f', :after) + + + + + Index: openacs-4/packages/assessment/www/admin/item-add-display-tb.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-tb.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-tb.adp 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/admin/item-add-display-tb.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-tb.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-tb.tcl 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,67 @@ +ad_page_contract { + Form to add an item with textbox display. + + @author Timo Hentschel (timo@timohentschel.de) + @cvs-id $Id: +} { + assessment_id:integer + section_id:integer + as_item_id:integer + after:integer +} -properties { + context_bar:onevalue + page_title:onevalue +} + +ad_require_permission $assessment_id 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 +} + +set page_title [_ assessment.add_new_question] +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] + + +set alignment_types [list] +foreach alignment_type [list besideleft besideright below above] { + lappend alignment_types [list "[_ assessment.$alignment_type]" $alignment_type] +} + + +ad_form -name item_add_display_tb -action item-add-display-tb -export { assessment_id section_id after } -form { + {as_item_id:key} + {html_options:text,optional {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}} + {abs_size:text {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.Absolute_Size_help]"}} + {answer_alignment:text(select) {label "[_ assessment.Answer_Alignment]"} {options $alignment_types} {help_text "[_ assessment.Answer_Alignment_help]"}} +} -edit_request { + set html_options "" + set abs_size 20 + set answer_alignment "beside-right" +} -edit_data { + db_transaction { + set as_item_display_id [as::item_display_tb::new \ + -html_display_options $html_options \ + -abs_size $abs_size \ + -item_answer_alignment $answer_alignment] + + content::item::relate -item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_id"] -object_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:as_item_display_id"] -relation_tag {as_item_display_rel} -relation_type {cr_item_rel} + + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id] + db_dml update_section_in_assessment {} + db_dml move_down_items {} + incr after + db_dml insert_new_item {} + } +} -after_submit { + # now go to assessment-page + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/admin/item-add-display-tb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-tb.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-add-display-tb.xql 5 Dec 2004 17:14:16 -0000 1.1 @@ -0,0 +1,36 @@ + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set sort_order = sort_order+1 + where section_id = :new_section_id + and sort_order > :after + + + + + + + + insert into as_item_section_map + (as_item_id, section_id, enabled_p, required_p, sort_order) + values (:as_item_id, :new_section_id, 't', 'f', :after) + + + + +