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.12 -r1.13
--- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 10 Dec 2004 11:42:19 -0000 1.12
+++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 10 Dec 2004 20:21:50 -0000 1.13
@@ -72,9 +72,8 @@
Boolean
File
Date
- Exponential
+ Float
Integer
- Numerical
Text
Time
Short Text
Index: openacs-4/packages/assessment/lib/section-items.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.adp,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/assessment/lib/section-items.adp 10 Dec 2004 11:42:22 -0000 1.6
+++ openacs-4/packages/assessment/lib/section-items.adp 10 Dec 2004 20:21:50 -0000 1.7
@@ -57,7 +57,7 @@
@items.title;noquote@
-
+
@formgroup.widget;noquote@ @formgroup.label;noquote@
@@ -68,6 +68,12 @@
+
+
+
+ @items.subtext@
+
+
|
Index: openacs-4/packages/assessment/lib/section-items.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/assessment/lib/section-items.xql 10 Dec 2004 11:42:22 -0000 1.2
+++ openacs-4/packages/assessment/lib/section-items.xql 10 Dec 2004 20:21:50 -0000 1.3
@@ -4,7 +4,7 @@
- select i.as_item_id, cr.title, ci.name, ism.required_p,
+ select i.as_item_id, i.subtext, cr.title, ci.name, ism.required_p,
ism.section_id, ism.sort_order,
ism.max_time_to_complete, ism.points
from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism
Index: openacs-4/packages/assessment/lib/section-show.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-show.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/assessment/lib/section-show.adp 10 Dec 2004 11:42:22 -0000 1.2
+++ openacs-4/packages/assessment/lib/section-show.adp 10 Dec 2004 20:21:50 -0000 1.3
@@ -28,7 +28,7 @@
@items.title;noquote@
-
+
@formgroup.widget;noquote@ @formgroup.label;noquote@
@@ -39,6 +39,12 @@
+
+
+
+ @items.subtext@
+
+
|
Index: openacs-4/packages/assessment/lib/section-show.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-show.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/assessment/lib/section-show.xql 10 Dec 2004 11:42:22 -0000 1.2
+++ openacs-4/packages/assessment/lib/section-show.xql 10 Dec 2004 20:21:50 -0000 1.3
@@ -4,7 +4,7 @@
- select i.as_item_id, cr.title, ci.name, ism.required_p,
+ select i.as_item_id, i.subtext, cr.title, ci.name, ism.required_p,
ism.section_id, ism.sort_order,
ism.max_time_to_complete, ism.points
from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism
Index: openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4
+++ openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5
@@ -91,3 +91,42 @@
return $new_item_display_id
}
+
+ad_proc -public as::item_display_cb::render {
+ -form:required
+ -element:required
+ -type_id:required
+ {-datatype ""}
+ {-title ""}
+ {-subtext ""}
+ {-required_p ""}
+ {-default_value ""}
+ {-data ""}
+} {
+ @author Timo Hentschel (timo@timohentschel.de)
+ @creation-date 2004-12-10
+
+ Render an Item Display CheckBox Type
+} {
+ db_1row display_item_data {}
+ if {[empty_string_p $required_p]} {
+ set required_p f
+ }
+
+ # numerical alphabetical randomized order_of_entry
+ switch -exact $sort_order_type {
+ numerical {
+ set data [lsort -real -index 1 $data]
+ }
+ alphabetical {
+ set data [lsort -dictionary -index 1 $data]
+ }
+ randomized {
+ set data [util::randomize_list $data]
+ }
+ }
+
+ set options {-datatype text -widget checkbox -label $title -help_text $subtext -values $default_value -required_p $required_p -html $html_display_options -options $data}
+
+ eval template::element::create $form $element $options
+}
Index: openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql 8 Dec 2004 15:30:34 -0000 1.1
+++ openacs-4/packages/assessment/tcl/as-item-display-cb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2
@@ -23,4 +23,15 @@
+
+
+
+ select html_display_options, choice_orientation, choice_label_orientation,
+ sort_order_type, item_answer_alignment
+ from as_item_display_cb
+ where as_item_display_id = :type_id
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4
+++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5
@@ -91,3 +91,42 @@
return $new_item_display_id
}
+
+ad_proc -public as::item_display_rb::render {
+ -form:required
+ -element:required
+ -type_id:required
+ {-datatype ""}
+ {-title ""}
+ {-subtext ""}
+ {-required_p ""}
+ {-default_value ""}
+ {-data ""}
+} {
+ @author Timo Hentschel (timo@timohentschel.de)
+ @creation-date 2004-12-10
+
+ Render an Item Display RadioButton Type
+} {
+ db_1row display_item_data {}
+ if {[empty_string_p $required_p]} {
+ set required_p f
+ }
+
+ # numerical alphabetical randomized order_of_entry
+ switch -exact $sort_order_type {
+ numerical {
+ set data [lsort -real -index 1 $data]
+ }
+ alphabetical {
+ set data [lsort -dictionary -index 1 $data]
+ }
+ randomized {
+ set data [util::randomize_list $data]
+ }
+ }
+
+ set options {-datatype text -widget radio -label $title -help_text $subtext -value $default_value -required_p $required_p -html $html_display_options -options $data}
+
+ eval template::element::create $form $element $options
+}
Index: openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql 8 Dec 2004 15:30:34 -0000 1.1
+++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2
@@ -23,4 +23,15 @@
+
+
+
+ select html_display_options, choice_orientation, choice_label_orientation,
+ sort_order_type, item_answer_alignment
+ from as_item_display_rb
+ where as_item_display_id = :type_id
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4
+++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5
@@ -80,3 +80,35 @@
return $new_item_display_id
}
+
+ad_proc -public as::item_display_sa::render {
+ -form:required
+ -element:required
+ -type_id:required
+ {-datatype ""}
+ {-title ""}
+ {-subtext ""}
+ {-required_p ""}
+ {-default_value ""}
+ {-data ""}
+} {
+ @author Timo Hentschel (timo@timohentschel.de)
+ @creation-date 2004-12-10
+
+ Render an Item Display ShortAnswer Type
+} {
+ db_1row display_item_data {}
+ if {![empty_string_p $abs_size]} {
+ set maxlength_option {-maxlength $abs_size}
+ }
+ if {[empty_string_p $required_p]} {
+ set required_p f
+ }
+ if {[empty_string_p $datatype]} {
+ set datatype text
+ }
+
+ set options {-datatype $datatype -widget text -label $title -help_text $subtext -value $default_value -required_p $required_p -html $html_display_options}
+
+ eval template::element::create $form $element $options $maxlength_option
+}
Index: openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql 8 Dec 2004 15:30:34 -0000 1.1
+++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.xql 10 Dec 2004 20:21:50 -0000 1.2
@@ -22,4 +22,14 @@
+
+
+
+ select html_display_options, abs_size, box_orientation
+ from as_item_display_sa
+ where as_item_display_id = :type_id
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 8 Dec 2004 15:30:34 -0000 1.1
+++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.tcl 10 Dec 2004 20:21:50 -0000 1.2
@@ -87,6 +87,50 @@
-sort_order_type $sort_order_type \
-item_answer_alignment $item_answer_alignment]
}
-
+
return $new_item_display_id
}
+
+ad_proc -public as::item_display_sb::render {
+ -form:required
+ -element:required
+ -type_id:required
+ {-datatype ""}
+ {-title ""}
+ {-subtext ""}
+ {-required_p ""}
+ {-default_value ""}
+ {-data ""}
+} {
+ @author Timo Hentschel (timo@timohentschel.de)
+ @creation-date 2004-12-10
+
+ Render an Item Display SelectBox Type
+} {
+ db_1row display_item_data {}
+ if {[empty_string_p $required_p]} {
+ set required_p f
+ }
+ set widget select
+ if {$multiple_p == "t"} {
+ set widget multiselect
+ }
+
+ # multiple_p
+ # numerical alphabetical randomized order_of_entry
+ switch -exact $sort_order_type {
+ numerical {
+ set data [lsort -real -index 1 $data]
+ }
+ alphabetical {
+ set data [lsort -dictionary -index 1 $data]
+ }
+ randomized {
+ set data [util::randomize_list $data]
+ }
+ }
+
+ set options {-datatype text -widget $widget -label $title -help_text $subtext -values $default_value -required_p $required_p -html $html_display_options -options $data}
+
+ eval template::element::create $form $element $options
+}
Index: openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 8 Dec 2004 15:30:34 -0000 1.1
+++ openacs-4/packages/assessment/tcl/as-item-display-sb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2
@@ -23,4 +23,15 @@
+
+
+
+ select html_display_options, multiple_p, choice_label_orientation,
+ sort_order_type, item_answer_alignment
+ from as_item_display_sb
+ where as_item_display_id = :type_id
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4
+++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5
@@ -85,3 +85,36 @@
return $new_item_display_id
}
+
+ad_proc -public as::item_display_ta::render {
+ -form:required
+ -element:required
+ -type_id:required
+ {-datatype ""}
+ {-title ""}
+ {-subtext ""}
+ {-required_p ""}
+ {-default_value ""}
+ {-data ""}
+} {
+ @author Timo Hentschel (timo@timohentschel.de)
+ @creation-date 2004-12-10
+
+ Render an Item Display TextArea Type
+} {
+ db_1row display_item_data {}
+ set maxlength_option ""
+ if {![empty_string_p $abs_size]} {
+ set maxlength_option {-maxlength $abs_size}
+ }
+ if {[empty_string_p $required_p]} {
+ set required_p f
+ }
+ if {[empty_string_p $datatype]} {
+ set datatype text
+ }
+
+ set options {-datatype $datatype -widget textarea -label $title -help_text $subtext -value $default_value -required_p $required_p -nospell -html $html_display_options}
+
+ eval template::element::create $form $element $options $maxlength_option
+}
Index: openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql 8 Dec 2004 15:30:34 -0000 1.1
+++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.xql 10 Dec 2004 20:21:50 -0000 1.2
@@ -22,4 +22,14 @@
+
+
+
+ select html_display_options, abs_size, item_answer_alignment
+ from as_item_display_ta
+ where as_item_display_id = :type_id
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4
+++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 10 Dec 2004 20:21:50 -0000 1.5
@@ -80,3 +80,36 @@
return $new_item_display_id
}
+
+ad_proc -public as::item_display_tb::render {
+ -form:required
+ -element:required
+ -type_id:required
+ {-datatype ""}
+ {-title ""}
+ {-subtext ""}
+ {-required_p ""}
+ {-default_value ""}
+ {-data ""}
+} {
+ @author Timo Hentschel (timo@timohentschel.de)
+ @creation-date 2004-12-10
+
+ Render an Item Display TextBox Type
+} {
+ db_1row display_item_data {}
+ set maxlength_option ""
+ if {![empty_string_p $abs_size]} {
+ set maxlength_option {-maxlength $abs_size}
+ }
+ if {[empty_string_p $required_p]} {
+ set required_p f
+ }
+ if {[empty_string_p $datatype]} {
+ set datatype text
+ }
+
+ set options {-datatype $datatype -widget text -label $title -help_text $subtext -value $default_value -required_p $required_p -html $html_display_options}
+
+ eval template::element::create $form $element $options $maxlength_option
+}
Index: openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql 8 Dec 2004 15:30:34 -0000 1.1
+++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.xql 10 Dec 2004 20:21:50 -0000 1.2
@@ -22,4 +22,14 @@
+
+
+
+ select html_display_options, abs_size, item_answer_alignment
+ from as_item_display_tb
+ where as_item_display_id = :type_id
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-item-form-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-form-procs.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 8 Dec 2004 15:30:34 -0000 1.8
+++ openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 10 Dec 2004 20:21:50 -0000 1.9
@@ -10,93 +10,29 @@
form
item_id
} {
+ @author Timo Hentschel (timo@timohentschel.de)
+ @modified-date 2004-12-10
+
Add items to a form. The form values are stored in response_to_item.item_id
} {
+ randomInit [randomRange 20000]
set element_name "response_to_item.$item_id"
- db_1row item_properties ""
- set user_value ""
+ db_1row item_properties {}
+ set item_type [string range $item_type end-1 end]
+ set display_type [string range $display_type end-1 end]
- set item_display_id [as::item_rels::get_target -item_rev_id $item_id -type as_item_display_rel]
- db_0or1row as_item_display_rbx "SELECT as_item_display_id AS rb__display_id FROM as_item_display_rb WHERE as_item_display_id=:item_display_id"
- db_0or1row as_item_display_tbx "SELECT as_item_display_id AS tb__display_id FROM as_item_display_tbx WHERE as_item_display_id=:item_display_id"
- db_0or1row as_item_display_tax "SELECT as_item_display_id AS ta__display_id FROM as_item_display_tax WHERE as_item_display_id=:item_display_id"
- set presentation_type "checkbox" ;# DEFAULT
- #get the presentation type
- if {[info exists rb__display_id]} {set presentation_type "radio"}
- if {[info exists tb__display_id]} {set presentation_type "fitb"}
- if {[info exists ta__display_id]} {set presentation_type "textarea"}
+ util_unlist [as::item_type_$item_type\::render -type_id $item_type_id] default_value data
- #Add the items depending on the presentation type (as_item_display_types)
- switch -- $presentation_type {
- "textbox" {
- template::element::create $form $element_name \
- -datatype text \
- -widget text \
- -label $title \
- -value $user_value \
- -size 40 \
- -required_p $required_p
- }
+ as::item_display_$display_type\::render \
+ -form $form \
+ -element $element_name \
+ -type_id $display_type_id \
+ -datatype $data_type \
+ -title $title \
+ -subtext $subtext \
+ -required_p $required_p \
+ -default_value $default_value \
+ -data $data
- "textarea" {
- db_0or1row html_rows_cols "SELECT html_display_options FROM as_item_display_ta WHERE as_item_display_id=:item_display_id"
- template::element::create $form $element_name \
- -datatype text \
- -widget textarea \
- -label $title \
- -value $user_value \
- -html $html_display_options \
- -nospell \
- -required_p $required_p
- }
-
- "radio" {
- set widget "text(radio)"
- set mc_id [as::item_rels::get_target -item_rev_id $item_id -type as_item_type_rel]
- set optionlist [list]
- db_foreach item_choices_2 "" {
- #for multiple choice item with multimedia
- if {[empty_string_p $content_value]} {
- lappend optionlist [list $title $choice_id]
- } elseif {[db_string mime_type {SELECT mime_type LIKE 'image%' FROM cr_revisions WHERE revision_id = :content_value}]} {
- lappend optionlist [list "$title" $choice_id]
- } else {
- lappend optionlist [list "$title