Index: openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 11 Aug 2004 11:50:26 -0000 1.5
+++ openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 28 Aug 2004 15:35:10 -0000 1.6
@@ -44,9 +44,6 @@
constraint as_sections_definition_nn
not null,
instructions text,
- enabled_p char(1) default 'f'
- constraint as_sections_enable_p_ck
- check (enabled_p in ('t','f')),
-- Maybe this isnt really useful
required_p char(1) default 't'
constraint as_sections_required_p_ck
Index: openacs-4/packages/assessment/tcl/assessment-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/assessment-procs.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/assessment/tcl/assessment-procs.tcl 24 Aug 2004 20:20:45 -0000 1.6
+++ openacs-4/packages/assessment/tcl/assessment-procs.tcl 28 Aug 2004 15:35:10 -0000 1.7
@@ -38,7 +38,7 @@
ad_proc -public as_item_type_mc_new {
{-name:required}
- {-title:required}
+ {-title ""}
{-increasing_p ""}
{-allow_negative_p ""}
{-num_correct_answers ""}
@@ -57,10 +57,6 @@
set item_item_type_mc_id [content::item::new -parent_id $folder_id -content_type {as_item_type_mc} -name $name -title $title ]
set as_item_type_mc_id [content::revision::new -item_id $item_item_type_mc_id -content_type {as_item_type_mc} -title $title -attributes [list [list increasing_p $increasing_p] [list allow_negative_p $allow_negative_p] [list num_correct_answers $num_correct_answers] [list num_answers $num_answers] ] ]
- foreach choice $choices {
- as_item_choice_new -mc_id $as_item_type_mc_id $choice
- }
-
return $as_item_type_mc_id
}
@@ -91,10 +87,6 @@
ad_proc -public as_item_new {
{-name:required}
{-title:required}
- {-type ""}
- {-type_attributes ""}
- {-display ""}
- {-display_attributes ""}
{-subtext ""}
{-field_code ""}
{-definition ""}
@@ -105,26 +97,73 @@
@author Eduardo Perez (eperez@it.uc3m.es)
@creation-date 2004-07-26
- New item to the data database
+ New item to the database
} {
set package_id [ad_conn package_id]
set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"]
- # Insert as_item in the CR (and as_assessments table) getting the revision_id (as_item_id)
+ # Insert as_item in the CR (and as_items table) getting the revision_id (as_item_id)
set item_item_id [content::item::new -parent_id $folder_id -content_type {as_items} -name $name -title $title ]
set as_item_id [content::revision::new -item_id $item_item_id -content_type {as_items} -title $title -attributes [list [list subtext $subtext] [list field_code $field_code] [list definition $definition] [list required_p $required_p] [list data_type $data_type] [list max_time_to_complete $max_time_to_complete] ] ]
- if {$type == {mc}} {
- set as_item_type_id [as_item_type_mc_new $type_attributes]
- }
+ return $as_item_id
+}
- if {$display == {rb}} {
- set as_item_display_id [as_item_display_rb_new $display_attributes]
- }
+ad_proc -public as_section_new {
+ {-name:required}
+ {-title:required}
+ {-instructions ""}
+ {-description ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @creation-date 2004-07-26
- # rel display and type to the item
- content::item::relate -item_id $as_item_id -object_id $as_item_type_id -relation_tag {as_item_type_rel}
- content::item::relate -item_id $as_item_id -object_id $as_item_display_id -relation_tag {as_item_display_rel}
+ New section to the database
+} {
+ set package_id [ad_conn package_id]
+ set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"]
- return $as_item_id
+ # Insert as_section in the CR (and as_sections table) getting the revision_id (as_section_id)
+ set section_item_id [content::item::new -parent_id $folder_id -content_type {as_sections} -name $name -title $title -description $description ]
+ set as_section_id [content::revision::new -item_id $section_item_id -content_type {as_sections} -title $title -description $description -attributes [list [list instructions $instructions] ] ]
+
+ return $as_section_id
}
+
+ad_proc -public as_assessment_new {
+ {-name:required}
+ {-title:required}
+ {-creator_id ""}
+ {-description ""}
+ {-instructions ""}
+ {-mode ""}
+ {-anonymous_p ""}
+ {-secure_access_p ""}
+ {-reuse_responses_p ""}
+ {-show_item_name_p ""}
+ {-entry_page ""}
+ {-exit_page ""}
+ {-consent_page ""}
+ {-return_url ""}
+ {-start_time ""}
+ {-end_time ""}
+ {-number_tries ""}
+ {-wait_between_tries ""}
+ {-time_for_response ""}
+ {-show_feedback ""}
+ {-section_navigation ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @creation-date 2004-07-26
+
+ New assessment to the database
+} {
+ set package_id [ad_conn package_id]
+ set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"]
+
+ # Insert as_assessment in the CR (and as_assessments table) getting the revision_id (as_assessment_id)
+ set assessment_item_id [content::item::new -parent_id $folder_id -content_type {as_assessments} -name $name -title $title ]
+ set as_assessment_id [content::revision::new -item_id $assessment_item_id -content_type {as_assessments} -title $title -attributes [list [list creator_id $creator_id] [list instructions $instructions] [list mode $mode] [list anonymous_p $anonymous_p] [list secure_access_p $secure_access_p] [list reuse_responses_p $reuse_responses_p] [list show_item_name_p $show_item_name_p] [list entry_page $entry_page] [list exit_page $exit_page] [list consent_page $consent_page] [list return_url $return_url] [list start_time $start_time] [list end_time $end_time] [list number_tries $number_tries] [list wait_between_tries $wait_between_tries] [list time_for_response $time_for_response] [list show_feedback $show_feedback] [list section_navigation $section_navigation] ] ]
+
+ return $as_assessment_id
+}
Index: openacs-4/packages/assessment/tcl/assessment-qti-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/assessment-qti-procs.tcl,v
diff -u -r1.14 -r1.15
--- openacs-4/packages/assessment/tcl/assessment-qti-procs.tcl 21 Jul 2004 10:21:21 -0000 1.14
+++ openacs-4/packages/assessment/tcl/assessment-qti-procs.tcl 28 Aug 2004 15:35:10 -0000 1.15
@@ -6,9 +6,6 @@
}
ad_proc -public parse_qti_xml { xmlfile } { Parse a XML QTI file } {
- set package_id [ad_conn package_id]
- set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"]
-
# Open, read and close the XML file
set file_id [open $xmlfile r]
set file_string [read $file_id]
@@ -28,9 +25,10 @@
if { [llength $assessmentNodes] > 0 } {
# There are assessments
foreach assessment $assessmentNodes {
- set as_assessments__name [$assessment getAttribute {title}]
+ set as_assessments__title [$assessment getAttribute {title}]
+ set as_assessments__name [$assessment getAttribute {ident}]
set nodesList [$assessment childNodes]
- set as_assessments__definition "NULL"
+ set as_assessments__definition ""
foreach node $nodesList {
set nodeName [$node nodeName]
if {$nodeName == "qticomment"} {
@@ -48,16 +46,15 @@
}
}
# Insert assessment in the CR (and as_assessments table) getting the revision_id (assessment_id)
- set assessment_item_id [content::item::new -parent_id $folder_id -content_type {as_assessments} -name $as_assessments__name -title $as_assessments__definition ]
- set as_assessments__assessment_id [content::revision::new -item_id $assessment_item_id -content_type {as_assessments} -title $as_assessments__definition ]
+ set as_assessments__assessment_id [as_assessment_new -name $as_assessments__name -title $as_assessments__title -description $as_assessments__definition]
-
# Section
set sectionNodes [$assessment selectNodes {section}]
foreach section $sectionNodes {
- set as_sections__name [$section getAttribute {title}]
+ set as_sections__title [$section getAttribute {title}]
+ set as_sections__name [$section getAttribute {ident}]
set nodesList [$section childNodes]
- set as_sections__definition "NULL"
+ set as_sections__definition ""
foreach node $nodesList {
set nodeName [$node nodeName]
if {$nodeName == "qticomment"} {
@@ -69,8 +66,8 @@
}
}
# Insert section in the CR (the and the as_sections table) getting the revision_id (section_id)
- set section_item_id [content::item::new -parent_id $folder_id -content_type {as_sections} -name $as_sections__name -title $as_sections__definition ]
- set as_sections__section_id [content::revision::new -item_id $section_item_id -content_type {as_sections} -title $as_sections__definition ]
+ set as_sections__section_id [as_section_new -name $as_sections__name -title $as_sections__title -description $as_sections__definition]
+
# Relation between as_sections and as_assessments
db_dml as_assessment_section_map_insert {}
# Process the items
@@ -86,14 +83,12 @@
}
ad_proc -private parse_item { qtiNode section_id} { Parse items from a XML QTI file } {
- set package_id [ad_conn package_id]
- set folder_id [db_string get_folder_id "select folder_id from cr_folders where package_id=:package_id"]
-
set itemNodes [$qtiNode selectNodes {item}]
foreach item $itemNodes {
# Order of the item_choices
set sort_order 0
- set as_items__name [$item getAttribute {title}]
+ set as_items__title [$item getAttribute {title}]
+ set as_items__name [$item getAttribute {ident}]
set objectivesNodes [$item selectNodes {objectives}]
foreach objectives $objectivesNodes {
set mattextNodes [$objectives selectNodes {material/mattext/text()}]
@@ -125,17 +120,15 @@
# shortanswer (textarea)
set as_item__display_type_id 1
}
- # Insert as_item in the CR (and as_assessments table) getting the revision_id (as_item_id)
- set item_item_id [content::item::new -parent_id $folder_id -content_type {as_items} -name $as_items__name -title $as_items__title ]
- set as_item_id [content::revision::new -item_id $item_item_id -content_type {as_items} -title $as_items__title ]
+ # Insert as_item in the CR (and as_items table) getting the revision_id (as_item_id)
+ set as_item_id [as_item_new -name $as_items__name -title $as_items__title]
foreach node $nodeNodes {
if {[$node nodeName] == {material}} {
set mattextNodes [$node selectNodes {mattext/text()}]
set mattext [lindex $mattextNodes 0]
set as_item_choices__choice_text [$mattext nodeValue]
# Insert as_item_choice in the CR (and as_item_choices table) getting the revision_id (choice_id)
- set as_items_choices__choice_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name $as_item_choices__ident -title $as_item_choices__choice_text ]
- set choice_id [content::revision::new -item_id $as_items_choices__choice_id -content_type {as_item_choices} -title $as_item_choices__choice_text ]
+ as_item_choice_new -mc_id $as_item_type_id -name $as_item_choices__ident -title $as_item_choices__choice_text -sort_order $sort_order
# order of the item_choices
incr sort_order
}
@@ -145,6 +138,7 @@
set response_lidNodes [$presentation selectNodes {.//response_lid}]
# The first node of the list. It may not be a good idea if it doesn't exist
set response_lid [lindex $response_lidNodes 0]
+ set as_item_type__name [$response_lid getAttribute {ident}]
set as_items__rcardinality [$response_lid getAttribute {rcardinality} {}]
# multiple choice either text (remember it can be internationalized or changed), images, sounds, videos
# this is the default
@@ -153,9 +147,10 @@
# multiple response either text (remember it can be internationalized or changed), images, sounds, videos
set as_item__display_type_id 3
}
- # Insert as_item in the CR (and as_assessments table) getting the revision_id (as_item_id)
- set item_item_id [content::item::new -parent_id $folder_id -content_type {as_items} -name $as_items__name -title $as_items__title ]
- set as_item_id [content::revision::new -item_id $item_item_id -content_type {as_items} -title $as_items__title ]
+ set as_item_type_id [as_item_type_mc_new -name $as_item_type__name]
+ # Insert as_item in the CR (and as_items table) getting the revision_id (as_item_id)
+ set as_item_id [as_item_new -name $as_items__name -title $as_items__title]
+ 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_type_id"] -relation_tag {as_item_type_rel} -relation_type {cr_item_rel}
set response_labelNodes [$presentation selectNodes {.//response_label}]
foreach response_label $response_labelNodes {
set as_item_choices__ident [$response_label getAttribute {ident}]
@@ -165,8 +160,7 @@
set as_item_choices__choice_text [$mattext nodeValue]
}
# Insert as_item_choice in the CR (and as_item_choices table) getting the revision_id (choice_id)
- set as_items_choices__choice_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name $as_item_choices__ident -title $as_item_choices__choice_text ]
- set choice_id [content::revision::new -item_id $as_items_choices__choice_id -content_type {as_item_choices} -title $as_item_choices__choice_text ]
+ as_item_choice_new -mc_id $as_item_type_id -name $as_item_choices__ident -title $as_item_choices__choice_text -sort_order $sort_order
# order of the item_choices
incr sort_order
}
Index: openacs-4/packages/assessment/tcl/item-form-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/item-form-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/item-form-procs.tcl 10 May 2004 12:20:10 -0000 1.1
+++ openacs-4/packages/assessment/tcl/item-form-procs.tcl 28 Aug 2004 15:35:10 -0000 1.2
@@ -4,7 +4,7 @@
@creation-date 2004-04-01
}
-ad_proc -public add_item_to_form { form item_id } { Add items to a form. The form values are stored in response_to_itrm.item_id } {
+ad_proc -public add_item_to_form { form item_id } { Add items to a form. The form values are stored in response_to_item.item_id } {
set element_name "response_to_item.$item_id"
db_1row item_properties ""
set user_value ""
@@ -15,7 +15,7 @@
template::element::create $form $element_name \
-datatype text \
-widget text \
- -label "$item_text" \
+ -label $title \
-value $user_value \
-size 40 \
-required_p $required_p
@@ -26,23 +26,27 @@
template::element::create $form $element_name \
-datatype text \
-widget textarea \
- -label "$item_text" \
+ -label $title \
-value $user_value \
-html $html \
-required_p $required_p
}
"radiobutton" {
set widget "text(radio)"
+ set item_item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:item_id"]
+ set item_mc_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE item_id=:item_item_id"]
+ set mc_id [db_string item_to_rev "SELECT revision_id FROM cr_revisions WHERE item_id=:item_mc_id"]
set optionlist [list]
db_foreach item_choices_2 "" {
- lappend optionlist [list $choice_text $choice_id]
+ ns_log notice $title
+ lappend optionlist [list $title $choice_id]
}
set options $optionlist
template::element::create $form $element_name \
-datatype text \
-widget radio \
- -label "$item_text" \
+ -label $title \
-value $user_value \
-options $options \
-required_p $required_p
@@ -58,7 +62,7 @@
template::element::create $form $element_name \
-datatype text \
-widget checkbox \
- -label "$item_text" \
+ -label $title \
-values $user_value \
-options $options \
-required_p $required_p
Index: openacs-4/packages/assessment/tcl/item-form-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/item-form-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/assessment/tcl/item-form-procs.xql 10 May 2004 12:20:10 -0000 1.1
+++ openacs-4/packages/assessment/tcl/item-form-procs.xql 28 Aug 2004 15:35:10 -0000 1.2
@@ -4,37 +4,37 @@
@items.item_text;noquote@ +@items.title@
-+ @formgroup.widget;noquote@ @formgroup.label;noquote@
- +