Index: openacs-4/packages/assessment/assessment.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/assessment/assessment.info 27 Sep 2004 13:18:07 -0000 1.5
+++ openacs-4/packages/assessment/assessment.info 14 Oct 2004 11:49:12 -0000 1.6
@@ -25,8 +25,8 @@
-
-
+
+
Index: openacs-4/packages/assessment/tcl/as-assessment-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,45 @@
+ad_library {
+ Assessment procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::assessment {}
+
+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 -description $description -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/as-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-install-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-install-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,195 @@
+# /packages/assessment/tcl/as-install-procs.tcl
+
+ad_library {
+ Assessment Package callbacks library
+
+ Procedures that deal with installing.
+
+ @creation-date 2004-09-20
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+}
+
+namespace eval as::install {}
+
+ad_proc -public as::install::assessment_create_install {
+} {
+ Creates the content type and adds in attributes.
+} {
+
+content::type::create_type -content_type {as_item_choices} -supertype {content_revision} -pretty_name {Assessment Item Choice} -pretty_plural {Assessment Item Choices} -table_name {as_item_choices} -id_column {choice_id}
+content::type::create_type -content_type {as_item_sa_answers} -supertype {content_revision} -pretty_name {Assessment Item Answer} -pretty_plural {Assessment Item Answer} -table_name {as_item_sa_answers} -id_column {choice_id}
+content::type::create_type -content_type {as_item_type_mc} -supertype {content_revision} -pretty_name {Assessment Item Type Multiple Choice} -pretty_plural {Assessment Item Type Multiple Choice} -table_name {as_item_type_mc} -id_column {as_item_type_id}
+content::type::create_type -content_type {as_item_type_oq} -supertype {content_revision} -pretty_name {Assessment Item Type Open Question} -pretty_plural {Assessment Item Type Open Question} -table_name {as_item_type_oq} -id_column {as_item_type_id}
+content::type::create_type -content_type {as_item_type_sa} -supertype {content_revision} -pretty_name {Assessment Item Type Short Answer} -pretty_plural {Assessment Item Type Short Answer} -table_name {as_item_type_sa} -id_column {as_item_type_id}
+content::type::create_type -content_type {as_item_display_rb} -supertype {content_revision} -pretty_name {Assessment Item Display Radio Button} -pretty_plural {Assessment Item Display Radio Button} -table_name {as_item_display_rb} -id_column {as_item_display_id}
+content::type::create_type -content_type {as_item_display_cb} -supertype {content_revision} -pretty_name {Assessment Item Display CheckBox} -pretty_plural {Assessment Item Display CheckBox} -table_name {as_item_display_cb} -id_column {as_item_display_id}
+content::type::create_type -content_type {as_item_display_tb} -supertype {content_revision} -pretty_name {Assessment Item Display TextBox} -pretty_plural {Assessment Item Display TextBox} -table_name {as_item_display_tb} -id_column {as_item_display_id}
+content::type::create_type -content_type {as_item_display_sa} -supertype {content_revision} -pretty_name {Assessment Item Display Short Answer} -pretty_plural {Assessment Item Display Short Answer} -table_name {as_item_display_sa} -id_column {as_item_display_id}
+content::type::create_type -content_type {as_item_display_ta} -supertype {content_revision} -pretty_name {Assessment Item Display TextArea} -pretty_plural {Assessment Item Display TextArea} -table_name {as_item_display_ta} -id_column {as_item_display_id}
+content::type::create_type -content_type {as_items} -supertype {content_revision} -pretty_name {Assessment Item} -pretty_plural {Assessment Items} -table_name {as_items} -id_column {as_item_id}
+content::type::create_type -content_type {as_sections} -supertype {content_revision} -pretty_name {Assessment Section} -pretty_plural {Assessment Sections} -table_name {as_sections} -id_column {section_id}
+content::type::create_type -content_type {as_assessments} -supertype {content_revision} -pretty_name {Assessment Assessment} -pretty_plural {Assessment Assessments} -table_name {as_assessments} -id_column {assessment_id}
+content::type::create_type -content_type {as_sessions} -supertype {content_revision} -pretty_name {Assessment Session} -pretty_plural {Assessment Sessions} -table_name {as_sessions} -id_column {session_id}
+content::type::create_type -content_type {as_section_data} -supertype {content_revision} -pretty_name {Assessment Section Data} -pretty_plural {Assessment Sections Data} -table_name {as_section_data} -id_column {section_data_id}
+content::type::create_type -content_type {as_item_data} -supertype {content_revision} -pretty_name {Assessment Item Data} -pretty_plural {Assessment Items Data} -table_name {as_item_data} -id_column {item_data_id}
+
+content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {choice_orientation} -datatype {string} -pretty_name {Choice Orientation} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {choice_label_orientation} -datatype {string} -pretty_name {Choice Label Orientation} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {sort_order_type} -datatype {string} -pretty_name {Sort Order Type} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_rb} -attribute_name {item_answer_alignment} -datatype {string} -pretty_name {Item Answer Alignment} -column_spec {varchar(20)}
+
+content::type::create_attribute -content_type {as_item_display_cb} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_item_display_cb} -attribute_name {choice_orientation} -datatype {string} -pretty_name {Choice Orientation} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_cb} -attribute_name {choice_label_orientation} -datatype {string} -pretty_name {Choice Label Orientation} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_cb} -attribute_name {allow_multiple_p} -datatype {string} -pretty_name {Allow Multiple} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_item_display_cb} -attribute_name {sort_order_type} -datatype {string} -pretty_name {Sort Order Type} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_cb} -attribute_name {item_answer_alignment} -datatype {string} -pretty_name {Item Answer Alignment} -column_spec {varchar(20)}
+
+content::type::create_attribute -content_type {as_item_display_tb} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_item_display_tb} -attribute_name {abs_size} -datatype {string} -pretty_name {Abstraction Real Size} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_tb} -attribute_name {item_answer_alignment} -datatype {string} -pretty_name {Item Answer Alignment} -column_spec {varchar(20)}
+
+content::type::create_attribute -content_type {as_item_display_sa} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_item_display_sa} -attribute_name {abs_size} -datatype {string} -pretty_name {Abstraction Real Size} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_sa} -attribute_name {box_orientation} -datatype {string} -pretty_name {Box Orientation} -column_spec {varchar(20)}
+
+content::type::create_attribute -content_type {as_item_display_ta} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_item_display_ta} -attribute_name {abs_size} -datatype {string} -pretty_name {Abstraction Real Size} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_ta} -attribute_name {acs_widget} -datatype {string} -pretty_name {ACS Templating Widget} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_display_ta} -attribute_name {item_answer_alignment} -datatype {string} -pretty_name {Item Answer Alignment} -column_spec {varchar(20)}
+
+content::type::create_attribute -content_type {as_item_type_mc} -attribute_name {increasing_p} -datatype {boolean} -pretty_name {Increasing} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_item_type_mc} -attribute_name {allow_negative_p} -datatype {boolean} -pretty_name {Allow Negative} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_item_type_mc} -attribute_name {num_correct_answers} -datatype {number} -pretty_name {Number of Correct Answers} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_type_mc} -attribute_name {num_answers} -datatype {number} -pretty_name {Number of Answers} -column_spec {integer}
+
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {mc_id} -datatype {number} -pretty_name {Parent ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {data_type} -datatype {string} -pretty_name {Data Type} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {numeric_value} -datatype {number} -pretty_name {Numeric Value} -column_spec {numeric}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {text_value} -datatype {string} -pretty_name {Text Value} -column_spec {varchar(500)}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {boolean_value} -datatype {boolean} -pretty_name {Boolean Value} -column_spec {boolean}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {content_value} -datatype {number} -pretty_name {Content Value} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {feedback_text} -datatype {string} -pretty_name {Feedback Text} -column_spec {varchar(500)}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {correct_answer_p} -datatype {boolean} -pretty_name {Correct Answer} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {selected_p} -datatype {boolean} -pretty_name {Selected} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {percent_score} -datatype {number} -pretty_name {Percent Score} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_choices} -attribute_name {sort_order} -datatype {number} -pretty_name {Sort Order} -column_spec {integer}
+
+content::type::create_attribute -content_type {as_item_type_sa} -attribute_name {increasing_p} -datatype {boolean} -pretty_name {Increasing} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_item_type_sa} -attribute_name {allow_negative_p} -datatype {boolean} -pretty_name {Allow Negative} -column_spec {char(1)}
+
+content::type::create_attribute -content_type {as_item_sa_answers} -attribute_name {answer_id} -datatype {number} -pretty_name {Parent ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_sa_answers} -attribute_name {data_type} -datatype {string} -pretty_name {Data Type} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_sa_answers} -attribute_name {case_sensitive_p} -datatype {boolean} -pretty_name {Case Sensitive} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_item_sa_answers} -attribute_name {percent_score} -datatype {number} -pretty_name {Percent Score} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_sa_answers} -attribute_name {compare_by} -datatype {string} -pretty_name {Comparasion} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_sa_answers} -attribute_name {regexp_text} -datatype {string} -pretty_name {Regexp} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_item_sa_answers} -attribute_name {allowed_answerbox_list} -datatype {string} -pretty_name {Allowed Answerbox List} -column_spec {varchar(20)}
+
+content::type::create_attribute -content_type {as_item_type_oq} -attribute_name {default_value} -datatype {string} -pretty_name {Default Value} -column_spec {varchar(500)}
+content::type::create_attribute -content_type {as_item_type_oq} -attribute_name {feedback_text} -datatype {string} -pretty_name {Feedback Text} -column_spec {varchar(500)}
+
+
+content::type::create_attribute -content_type {as_items} -attribute_name {subtext} -datatype {string} -pretty_name {Item Subtext} -column_spec {varchar(500)}
+content::type::create_attribute -content_type {as_items} -attribute_name {field_code} -datatype {string} -pretty_name {Item Field Code} -column_spec {varchar(500)}
+content::type::create_attribute -content_type {as_items} -attribute_name {definition} -datatype {string} -pretty_name {Item Definition} -column_spec {varchar(500)}
+content::type::create_attribute -content_type {as_items} -attribute_name {required_p} -datatype {boolean} -pretty_name {Item Required} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_items} -attribute_name {data_type} -datatype {string} -pretty_name {Item Data Type} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_items} -attribute_name {max_time_to_complete} -datatype {number} -pretty_name {Item Max Time to Complete} -column_spec {integer}
+content::type::create_attribute -content_type {as_items} -attribute_name {adp_chunk} -datatype {string} -pretty_name {Item Adp Chunk} -column_spec {varchar(500)}
+content::type::create_attribute -content_type {as_items} -attribute_name {feedback_wrong} -datatype {string} -pretty_name {Item Right Feedback} -column_spec {text}
+content::type::create_attribute -content_type {as_items} -attribute_name {feedback_right} -datatype {string} -pretty_name {Item Wrong Feedback} -column_spec {text}
+
+
+content::type::create_attribute -content_type {as_sections} -attribute_name {instructions} -datatype {string} -pretty_name {Section Instructions} -column_spec {text}
+
+
+content::type::create_attribute -content_type {as_assessments} -attribute_name {creator_id} -datatype {number} -pretty_name {Assessment Creator Identifier} -column_spec {integer}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {instructions} -datatype {string} -pretty_name {Assessment Creator Instructions} -column_spec {text}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {mode} -datatype {string} -pretty_name {Assessment Mode} -column_spec {varchar(25)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {anonymous_p} -datatype {boolean} -pretty_name {Assessment Anonymous} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {secure_access_p} -datatype {boolean} -pretty_name {Assessment Secure Access} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {reuse_responses_p} -datatype {boolean} -pretty_name {Assessment Reuse Responses} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {show_item_name_p} -datatype {boolean} -pretty_name {Assessment Show question titles} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {entry_page} -datatype {string} -pretty_name {Assessment Customizable Entry page} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {exit_page} -datatype {string} -pretty_name {Assessment Customizable Thank/Exit page} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {consent_page} -datatype {string} -pretty_name {Assessment Consent Pages} -column_spec {text}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {return_url} -datatype {string} -pretty_name {Assessment Return URL} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {start_time} -datatype {number} -pretty_name {Assessment Start Time} -column_spec {timestamptz}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {end_time} -datatype {number} -pretty_name {Assessment End Time} -column_spec {timestamptz}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {number_tries} -datatype {number} -pretty_name {Assessment Number Tries} -column_spec {integer}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {wait_between_tries} -datatype {number} -pretty_name {Assessment Wait Between Tries} -column_spec {integer}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {time_for_response} -datatype {number} -pretty_name {Assessment Time for Response} -column_spec {integer}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {show_feedback} -datatype {string} -pretty_name {Assessment Show comments to the user} -column_spec {varchar(50)}
+content::type::create_attribute -content_type {as_assessments} -attribute_name {section_navigation} -datatype {string} -pretty_name {Assessment Navigation of sections} -column_spec {varchar(50)}
+
+content::type::create_attribute -content_type {as_sessions} -attribute_name {assessment_id} -datatype {number} -pretty_name {Assessment ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {subject_id} -datatype {number} -pretty_name {Subject ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {staff_id} -datatype {number} -pretty_name {Staff ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {target_datetime} -datatype {number} -pretty_name {Target Date Time} -column_spec {timestamptz}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {creation_datetime} -datatype {number} -pretty_name {Creation Date Time} -column_spec {timestamptz}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {first_mod_datetime} -datatype {number} -pretty_name {First Submission} -column_spec {timestamptz}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {last_mod_datetime} -datatype {number} -pretty_name {Most Recent Submission} -column_spec {timestamptz}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {completed_datetime} -datatype {number} -pretty_name {Final Submission} -column_spec {timestamptz}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {session_status} -datatype {string} -pretty_name {Session Status} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {assessment_status} -datatype {string} -pretty_name {Assessment Status} -column_spec {varchar(20)}
+content::type::create_attribute -content_type {as_sessions} -attribute_name {percent_score} -datatype {number} -pretty_name {Percent Score} -column_spec {integer}
+
+content::type::create_attribute -content_type {as_section_data} -attribute_name {session_id} -datatype {number} -pretty_name {Session ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_section_data} -attribute_name {section_id} -datatype {number} -pretty_name {Section ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_section_data} -attribute_name {subject_id} -datatype {number} -pretty_name {Subject ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_section_data} -attribute_name {staff_id} -datatype {number} -pretty_name {Staff ID} -column_spec {integer}
+
+content::type::create_attribute -content_type {as_item_data} -attribute_name {session_id} -datatype {number} -pretty_name {Session ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {subject_id} -datatype {number} -pretty_name {Subject ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {staff_id} -datatype {number} -pretty_name {Staff ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {as_item_id} -datatype {number} -pretty_name {Item ID} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {is_unknown_p} -datatype {boolean} -pretty_name {Is Unknown} -column_spec {char(1)}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {choice_id_answer} -datatype {number} -pretty_name {Choice ID Answer} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {boolean_answer} -datatype {boolean} -pretty_name {Boolean Answer} -column_spec {boolean}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {clob_answer} -datatype {string} -pretty_name {Clob Answer} -column_spec {text}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {numeric_answer} -datatype {number} -pretty_name {Numeric Answer} -column_spec {numeric}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {integer_answer} -datatype {number} -pretty_name {Integer Answer} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {text_answer} -datatype {string} -pretty_name {Text Answer} -column_spec {varchar(500)}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {timestamp_answer} -datatype {number} -pretty_name {TimeStamp Answer} -column_spec {timestamptz}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {content_answer} -datatype {number} -pretty_name {Content Answer} -column_spec {integer}
+content::type::create_attribute -content_type {as_item_data} -attribute_name {signed_data} -datatype {string} -pretty_name {Signed Data} -column_spec {varchar(500)}
+
+content::type::register_relation_type -content_type {as_items} -target_type {as_item_type_mc} -relation_tag {as_item_type_rel}
+content::type::register_relation_type -content_type {as_items} -target_type {as_item_type_sa} -relation_tag {as_item_type_rel}
+content::type::register_relation_type -content_type {as_items} -target_type {as_item_type_oq} -relation_tag {as_item_type_rel}
+content::type::register_relation_type -content_type {as_items} -target_type {as_item_display_rb} -relation_tag {as_item_display_rel}
+content::type::register_relation_type -content_type {as_items} -target_type {as_item_display_cb} -relation_tag {as_item_display_rel}
+content::type::register_relation_type -content_type {as_items} -target_type {as_item_display_tb} -relation_tag {as_item_display_rel}
+content::type::register_relation_type -content_type {as_items} -target_type {as_item_display_sa} -relation_tag {as_item_display_rel}
+content::type::register_relation_type -content_type {as_items} -target_type {as_item_display_ta} -relation_tag {as_item_display_rel}
+
+}
+
+ad_proc -public as::install::package_instantiate {
+ -package_id:required
+} {
+ Define folders
+
+} {
+
+ set folder_id [content::folder::new -name "assessment_$package_id" -package_id $package_id ]
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_choices} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_type_mc} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_sa_answers} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_type_sa} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_type_oq} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_display_rb} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_display_cb} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_display_tb} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_display_sa} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_display_ta} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_items} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_sections} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_assessments} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_sessions} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_section_data} -include_subtypes t
+ content::folder::register_content_type -folder_id $folder_id -content_type {as_item_data} -include_subtypes t
+
+}
Index: openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-answer-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,34 @@
+ad_library {
+ Item answer procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_answer {}
+
+ad_proc -public as::item_answer::new {
+ {-answer_id:required}
+ {-name:required}
+ {-title:required}
+ {-data_type ""}
+ {-case_sensitive_p ""}
+ {-percent_score ""}
+ {-compare_by ""}
+ {-regexp_text ""}
+ {-allowed_answerbox_list ""}
+} {
+ @author Natalia Perez (eperez@it.uc3m.es)
+ @creation-date 2004-09-29
+
+ New item answer to the data 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_answer in the CR (and as_item_sa_answers table) getting the revision_id (as_item_answer_id)
+ set item_answer_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name $name -title $title ]
+ set as_item_answer_id [content::revision::new -item_id $item_answer_id -content_type {as_item_answers} -title $title -attributes [list [list answer_id $answer_id ] [list data_type $data_type ] [list case_sensitive_p $case_sensitive_p ] [list percent_score $percent_score] [list compare_by $compare_by] [list regexp_text $regexp_text] [list allowed_answerbox_list $allowed_answerbox_list] ] ]
+ # FIXME too much code repetition here
+ # maybe there are more efficient ways to to it (maybe using hashes to pass the values between functions)
+ return $as_item_answer_id
+}
Index: openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-choice-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,39 @@
+ad_library {
+ Item choice procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_choice {}
+
+ad_proc -public as::item_choice::new {
+ {-mc_id:required}
+ {-name:required}
+ {-title:required}
+ {-data_type ""}
+ {-numeric_value ""}
+ {-text_value ""}
+ {-boolean_value:boolean ""}
+ {-content_value ""}
+ {-feedback_text ""}
+ {-selected_p:boolean ""}
+ {-correct_answer_p ""}
+ {-sort_order ""}
+ {-percent_score ""}
+
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @creation-date 2004-07-26
+
+ New item choice to the data 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_choice in the CR (and as_item_choices table) getting the revision_id (as_item_choice_id)
+ set item_choice_id [content::item::new -parent_id $folder_id -content_type {as_item_choices} -name $name -title $title ]
+ set as_item_choice_id [content::revision::new -item_id $item_choice_id -content_type {as_item_choices} -title $title -attributes [list [list mc_id $mc_id ] [list data_type $data_type ] [list numeric_value $numeric_value ] [list $text_value text_value] [list boolean_value $boolean_value] [list content_value $content_value] [list feedback_text $feedback_text] [list selected_p $selected_p] [list correct_answer_p $correct_answer_p] [list sort_order $sort_order] [list percent_score $percent_score] ] ]
+ # FIXME too much code repetition here
+ # maybe there are more efficient ways to to it (maybe using hashes to pass the values between functions)
+ return $as_item_choice_id
+}
Index: openacs-4/packages/assessment/tcl/as-item-data-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-data-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-data-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,38 @@
+ad_library {
+ Item Data procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_data {}
+
+ad_proc -public as::item_data::new {
+ {-session_id:required}
+ {-event_id ""}
+ {-subject_id ""}
+ {-staff_id ""}
+ {-as_item_id:required}
+ {-choice_id_answer ""}
+ {-boolean_answer ""}
+ {-numeric_answer ""}
+ {-integer_answer ""}
+ {-text_answer ""}
+ {-timestamp_answer ""}
+ {-content_answer ""}
+ {-signed_data ""}
+ {-percent_score ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @creation-date 2004-09-12
+
+ New as_item_data 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_data in the CR (and as_item_data table) getting the revision_id (item_data_id)
+ set item_data_id [content::item::new -parent_id $folder_id -content_type {as_item_data} -name "$as_item_id-$session_id-$choice_id_answer" -title "$as_item_id-$session_id-$choice_id_answer" ]
+ set as_item_data_id [content::revision::new -item_id $item_data_id -content_type {as_item_data} -title "$as_item_id-$session_id-$choice_id_answer" -attributes [list [list session_id $session_id] [list event_id $event_id] [list subject_id $subject_id] [list staff_id $staff_id] [list as_item_id $as_item_id] [list choice_id_answer $choice_id_answer] [list boolean_answer $boolean_answer] [list numeric_answer $numeric_answer] [list integer_answer $integer_answer] [list text_answer $text_answer] [list timestamp_answer $timestamp_answer] [list content_answer $content_answer] [list signed_data $signed_data] [list percent_score $percent_score] ] ]
+
+ return $as_item_data_id
+}
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-display-cb-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,31 @@
+ad_library {
+ Item display checkbox Type procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_display_cb {}
+
+ad_proc -public as::item_display_cb::new {
+ {-name:required}
+ {-html_display_options ""}
+ {-choice_orientation ""}
+ {-choice_label_orientation ""}
+ {-sort_order_type ""}
+ {-item_answer_alignment ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @author Natalia Perez (nperper@it.uc3m.es)
+ @creation-date 2004-09-23
+
+ New Item Display CheckBox Type 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_display_cb in the CR (and as_item_display_cb table) getting the revision_id (as_item_display_id)
+ set item_item_display_cb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_cb} -name $name]
+ set as_item_display_cb_id [content::revision::new -item_id $item_item_display_cb_id -content_type {as_item_display_cb} -attributes [list [list html_display_options $html_display_options] [list choice_orientation $choice_orientation] [list choice_label_orientation $choice_label_orientation] [list sort_order_type $sort_order_type] [list item_answer_alignment $item_answer_alignment] ] ]
+
+ return $as_item_display_cb_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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-display-rb-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,31 @@
+ad_library {
+ Item display radio button Type procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_display_rb {}
+
+ad_proc -public as::item_display_rb::new {
+ {-name:required}
+ {-html_display_options ""}
+ {-choice_orientation ""}
+ {-choice_label_orientation ""}
+ {-sort_order_type ""}
+ {-item_answer_alignment ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @author Natalia Perez (nperper@it.uc3m.es)
+ @creation-date 2004-07-26
+
+ New Item Display RadioButton Type 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_display_rb in the CR (and as_item_display_rb table) getting the revision_id (as_item_display_id)
+ set item_item_display_rb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_rb} -name $name]
+ set as_item_display_rb_id [content::revision::new -item_id $item_item_display_rb_id -content_type {as_item_display_rb} -attributes [list [list html_display_options $html_display_options] [list choice_orientation $choice_orientation] [list choice_label_orientation $choice_label_orientation] [list sort_order_type $sort_order_type] [list item_answer_alignment $item_answer_alignment] ] ]
+
+ return $as_item_display_rb_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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-display-sa-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,28 @@
+ad_library {
+ Item display short answer Type procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_display_sa {}
+
+ad_proc -public as::item_display_sa::new {
+ {-name:required}
+ {-html_display_options ""}
+ {-abs_size ""}
+ {-box_orientation ""}
+} {
+ @author Natalia Perez (nperper@it.uc3m.es)
+ @creation-date 2004-09-29
+
+ New Item Display Short Answer Type 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_display_sa in the CR (and as_item_display_sa table) getting the revision_id (as_item_display_id)
+ set item_item_display_sa_id [content::item::new -parent_id $folder_id -content_type {as_item_display_sa} -name $name]
+ set as_item_display_sa_id [content::revision::new -item_id $item_item_display_sa_id -content_type {as_item_display_sa} -attributes [list [list html_display_options $html_display_options] [list abs_size $abs_size] [list box_orientation $box_orientation] ] ]
+
+ return $as_item_display_sa_id
+}
\ No newline at end of file
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-display-ta-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,30 @@
+ad_library {
+ Item display textarea Type procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_display_ta {}
+
+ad_proc -public as::item_display_ta::new {
+ {-name:required}
+ {-html_display_options ""}
+ {-abs_size ""}
+ {-acs_widget ""}
+ {-item_answer_alignment ""}
+} {
+ @author Natalia Perez (nperper@it.uc3m.es)
+ @creation-date 2004-09-29
+
+ New Item Display TextArea Type 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_display_ta in the CR (and as_item_display_ta table) getting the revision_id (as_item_display_id)
+ set item_item_display_ta_id [content::item::new -parent_id $folder_id -content_type {as_item_display_ta} -name $name]
+ set as_item_display_ta_id [content::revision::new -item_id $item_item_display_ta_id -content_type {as_item_display_ta} -attributes [list [list html_display_options $html_display_options] [list abs_size $abs_size] [list acs_widget $acs_widget] [list item_answer_alignment $item_answer_alignment] ] ]
+
+ return $as_item_display_ta_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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-display-tb-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,28 @@
+ad_library {
+ Item display textbox Type procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_display_tb {}
+
+ad_proc -public as::item_display_tb::new {
+ {-name:required}
+ {-html_display_options ""}
+ {-abs_size ""}
+ {-item_answer_alignment ""}
+} {
+ @author Natalia Perez (nperper@it.uc3m.es)
+ @creation-date 2004-09-29
+
+ New Item Display TextBox Type 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_display_tb in the CR (and as_item_display_tb table) getting the revision_id (as_item_display_id)
+ set item_item_display_tb_id [content::item::new -parent_id $folder_id -content_type {as_item_display_tb} -name $name]
+ set as_item_display_tb_id [content::revision::new -item_id $item_item_display_tb_id -content_type {as_item_display_tb} -attributes [list [list html_display_options $html_display_options] [list abs_size $abs_size] [list item_answer_alignment $item_answer_alignment] ] ]
+
+ return $as_item_display_tb_id
+}
\ No newline at end of file
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-form-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,87 @@
+ad_library {
+ Items and forms
+ @author alvaro@it.uc3m.es
+ @creation-date 2004-04-01
+}
+
+namespace eval as::item_form {}
+
+ad_proc -public as::item_form::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 ""
+
+ set item_item_id [db_string cr_item_from_revision "select item_id from cr_revisions where revision_id=:item_id"]
+ set item_display_id [db_string item_item_type "SELECT related_object_id FROM cr_item_rels WHERE relation_tag = 'as_item_display_rel' AND item_id=:item_item_id"]
+ db_0or1row as_item_display_rbx "SELECT item_id AS as_item_display_rbx__item_id FROM as_item_display_rbx WHERE item_id=:item_display_id"
+ db_0or1row as_item_display_tbx "SELECT item_id AS as_item_display_tbx__item_id FROM as_item_display_tbx WHERE item_id=:item_display_id"
+ db_0or1row as_item_display_tax "SELECT item_id AS as_item_display_tax__item_id FROM as_item_display_tax WHERE item_id=:item_display_id"
+ set presentation_type "checkbox" ;# DEFAULT
+ if {[info exists as_item_display_rbx__item_id]} {set presentation_type "radio"}
+ if {[info exists as_item_display_tbx__item_id]} {set presentation_type "fitb"}
+ if {[info exists as_item_display_tax__item_id]} {set presentation_type "textarea"}
+
+ #Add the items depending on the 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
+ }
+
+ "textarea" {
+ set html {rows 15 cols 55}
+ template::element::create $form $element_name \
+ -datatype text \
+ -widget textarea \
+ -label $title \
+ -value $user_value \
+ -html $html \
+ -nospell \
+ -required_p $required_p
+ }
+
+ "radio" {
+ 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 relation_tag = 'as_item_type_rel' AND 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 $title $choice_id]
+ }
+ set options $optionlist
+ template::element::create $form $element_name \
+ -datatype text \
+ -widget radio \
+ -label $title \
+ -value $user_value \
+ -options $options \
+ -required_p $required_p
+ }
+
+ "checkbox" {
+ 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 relation_tag = 'as_item_type_rel' AND 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 choices [list]
+ set optionlist [list]
+ db_foreach item_choices_2 "" {
+ lappend optionlist [list $title $choice_id]
+ }
+ set options $optionlist
+ template::element::create $form $element_name \
+ -datatype text \
+ -widget checkbox \
+ -label $title \
+ -values $user_value \
+ -options $options \
+ -required_p $required_p
+ }
+ }
+ return $presentation_type
+}
Index: openacs-4/packages/assessment/tcl/as-item-form-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-form-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-form-procs.xql 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,41 @@
+
+
+
+
+
+ select
+ as_item_choicesx.choice_id, as_item_choicesx.title
+ from
+ as_item_choicesx
+ where
+ as_item_choicesx.mc_id=:mc_id
+ order by
+ as_item_choicesx.sort_order
+
+
+
+
+
+ select
+ as_item_choicesx.choice_id, as_item_choicesx.title
+ from
+ as_item_choicesx
+ where
+ as_item_choicesx.mc_id=:mc_id
+ order by
+ as_item_choicesx.sort_order
+
+
+
+
+
+ select
+ as_itemsx.title, as_itemsx.required_p
+ from
+ as_itemsx
+ where
+ as_itemsx.as_item_id=:item_id
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-item-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,34 @@
+ad_library {
+ Item procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item {}
+
+ad_proc -public as::item::new {
+ {-name:required}
+ {-title:required}
+ {-subtext ""}
+ {-field_code ""}
+ {-definition ""}
+ {-required_p ""}
+ {-data_type ""}
+ {-max_time_to_complete ""}
+ {-feedback_right ""}
+ {-feedback_wrong ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @creation-date 2004-07-26
+
+ 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_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] [list feedback_right $feedback_right] [list feedback_wrong $feedback_wrong] ] ]
+
+ return $as_item_id
+}
\ No newline at end of file
Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,32 @@
+ad_library {
+ Multiple choice item procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_type_mc {}
+
+
+ad_proc -public as::item_type_mc::new {
+ {-name:required}
+ {-title ""}
+ {-increasing_p ""}
+ {-allow_negative_p ""}
+ {-num_correct_answers ""}
+ {-num_answers ""}
+ {-choices ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @creation-date 2004-07-26
+
+ New Multiple Choice item to the data 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_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id)
+ 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] ] ]
+
+ return $as_item_type_mc_id
+}
\ No newline at end of file
Index: openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,28 @@
+ad_library {
+ Open Question item procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_type_oq {}
+
+ad_proc -public as::item_type_oq::new {
+ {-name:required}
+ {-title ""}
+ {-default_value ""}
+ {-feedback_text ""}
+} {
+ @author Natalia Perez (nperper@it.uc3m.es)
+ @creation-date 2004-09-29
+
+ New Open Question item to the data 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_type_oq in the CR (and as_item_type_oq table) getting the revision_id (as_item_type_id)
+ set item_item_type_oq_id [content::item::new -parent_id $folder_id -content_type {as_item_type_oq} -name $name -title $title ]
+ set as_item_type_oq_id [content::revision::new -item_id $item_item_type_oq_id -content_type {as_item_type_oq} -title $title -attributes [list [list default_value $default_value] [list feedback_text $feedback_text] ] ]
+
+ return $as_item_type_oq_id
+}
Index: openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-item-type-sa-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,28 @@
+ad_library {
+ Short answer item procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::item_type_sa {}
+
+ad_proc -public as::item_type_sa::new {
+ {-name:required}
+ {-title ""}
+ {-increasing_p ""}
+ {-allow_negative_p ""}
+} {
+ @author Natalia Perez (nperper@it.uc3m.es)
+ @creation-date 2004-09-29
+
+ New Short Answer Answers item to the data 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_type_sa in the CR (and as_item_type_sa table) getting the revision_id (as_item_type_id)
+ set item_item_type_sa_id [content::item::new -parent_id $folder_id -content_type {as_item_type_sa} -name $name -title $title ]
+ set as_item_type_sa_id [content::revision::new -item_id $item_item_type_sa_id -content_type {as_item_type_sa} -title $title -attributes [list [list increasing_p $increasing_p] [list allow_negative_p $allow_negative_p] ] ]
+
+ return $as_item_type_sa_id
+}
Index: openacs-4/packages/assessment/tcl/as-qti-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/as-qti-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-qti-procs-postgresql.xql 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,20 @@
+
+
+
+ postgresql7.4
+
+
+
+ INSERT INTO as_assessment_section_map (assessment_id, section_id, sort_order)
+ VALUES (:as_assessments__assessment_id, :as_sections__section_id, :as_assessment_section_map__sort_order)
+
+
+
+
+
+ INSERT INTO as_item_section_map (as_item_id, section_id, sort_order)
+ VALUES (:as_item_id, :section_id, :as_item_section_map__sort_order)
+
+
+
+
Index: openacs-4/packages/assessment/tcl/as-qti-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-qti-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-qti-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,268 @@
+ad_library {
+ assessment -- QTI parser library routines
+ @author eperez@it.uc3m.es
+ @creation-date 2004-04-16
+ @cvs-id $Id: as-qti-procs.tcl,v 1.1 2004/10/14 11:44:51 eduardop Exp $
+}
+
+namespace eval as::qti {}
+
+ad_proc -public as::qti::parse_qti_xml { xmlfile } { Parse a XML QTI file } {
+ # set utf-8 system encoding
+ encoding system utf-8
+
+ # Parser
+ # XML => DOM document
+ set file_id [open $xmlfile r]
+ dom parse -channel $file_id document
+ close $file_id
+ # DOM document => DOM root
+ $document documentElement root
+ # XPath v1.0
+ set questestinteropNodes [$root selectNodes {/questestinterop}]
+ foreach questestinterop $questestinteropNodes {
+ # Looks for assessments
+ set assessmentNodes [$questestinterop selectNodes {assessment}]
+ if { [llength $assessmentNodes] > 0 } {
+ # There are assessments
+ foreach assessment $assessmentNodes {
+ set as_assessments__title "Assessment"
+ if {[$assessment hasAttribute {title}]} {
+ set as_assessments__title [$assessment getAttribute {title}]
+ }
+ set as_assessments__name [$assessment getAttribute {ident}]
+ set nodesList [$assessment childNodes]
+ set as_assessments__definition ""
+ foreach node $nodesList {
+ set nodeName [$node nodeName]
+ if {$nodeName == "qticomment"} {
+ set definitionNodes [$assessment selectNodes {qticomment/text()}]
+ if {[llength $definitionNodes] != 0} {
+ set definition [lindex $definitionNodes 0]
+ set as_assessments__definition [$definition nodeValue]
+ }
+ } elseif {$nodeName == "objectives"} {
+ set definitionNodes [$assessment selectNodes {objectives/material/mattext/text()}]
+ if {[llength $definitionNodes] != 0} {
+ set definition [lindex $definitionNodes 0]
+ set as_assessments__definition [$definition nodeValue]
+ }
+ }
+ }
+ # Insert assessment in the CR (and as_assessments table) getting the revision_id (assessment_id)
+ 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_assessment_section_map__sort_order 0
+ set as_sections__title "Section"
+ if {[$section hasAttribute {title}]} {
+ set as_sections__title [$section getAttribute {title}]
+ }
+ set as_sections__name [$section getAttribute {ident}]
+ set nodesList [$section childNodes]
+ set as_sections__definition ""
+ foreach node $nodesList {
+ set nodeName [$node nodeName]
+ if {$nodeName == "qticomment"} {
+ set definitionNodes [$section selectNodes {qticomment/text()}]
+ if {[llength $definitionNodes] != 0} {
+ set definition [lindex $definitionNodes 0]
+ set as_sections__definition [$definition nodeValue]
+ }
+ }
+ }
+ # Insert section in the CR (the and the as_sections table) getting the revision_id (section_id)
+ 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 {}
+ incr as_assessment_section_map__sort_order
+ # Process the items
+ as::qti::parse_item $section $as_sections__section_id
+ }
+ }
+ } else {
+ # Just items (no assessments)
+ as::qti::parse_item $questestinterop 0
+ }
+ }
+ return 1
+}
+
+ad_proc -private as::qti::parse_item { qtiNode section_id} { Parse items from a XML QTI file } {
+ set as_item_section_map__sort_order 0
+ set itemNodes [$qtiNode selectNodes {item}]
+ foreach item $itemNodes {
+ # Order of the item_choices
+ set sort_order 0
+ #isn't used
+ set as_items__title "Item"
+ if {[$item hasAttribute {title}]} {
+ set as_items__title [$item getAttribute {title}]
+ }
+ set as_items__name [$item getAttribute {ident}]
+ array set as_item_choices__correct_answer_p {}
+ array set as_item_choices__score {}
+ set as_items__feedback_right {}
+ set as_items__feedback_wrong {}
+ set as_items__description {}
+ set objectivesNodes [$item selectNodes {objectives}]
+ foreach objectives $objectivesNodes {
+ set mattextNodes [$objectives selectNodes {material/mattext/text()}]
+ foreach mattext $mattextNodes {
+ set as_items__description [$mattext nodeValue]
+ }
+ }
+ set itemfeedbackNodes [$item selectNodes {itemfeedback}]
+ foreach itemfeedback $itemfeedbackNodes {
+ if {[regexp displayRight [$itemfeedback getAttribute {ident} {}]]} {
+ set feedback_textNodes [$itemfeedback selectNodes {.//mattext/text()}]
+ set as_items__feedback_right [[lindex $feedback_textNodes 0] nodeValue]
+ }
+ if {[regexp displayWrong [$itemfeedback getAttribute {ident} {}]]} {
+ set feedback_textNodes [$itemfeedback selectNodes {.//mattext/text()}]
+ set as_items__feedback_wrong [[lindex $feedback_textNodes 0] nodeValue]
+ }
+ }
+ set resprocessingNodes [$item selectNodes {resprocessing}]
+ foreach resprocessing $resprocessingNodes {
+ set respconditionNodes [$resprocessing selectNodes {respcondition}]
+ foreach respcondition $respconditionNodes {
+ set title "Correct"
+ if {[$respcondition hasAttribute {title}]} {
+ set title [$respcondition getAttribute {title} {}]
+ }
+ if {$title == {Correct}} {
+ set correctNodes [$respcondition selectNodes {conditionvar/and/varequal/text()}]
+ foreach correct $correctNodes {
+ set as_item_choices__correct_answer_p([string trim [$correct nodeValue]]) {t}
+ }
+ }
+ if {$title == {adjustscore}} {
+ set choice {}
+ set score {}
+ set scoreNodes [$respcondition selectNodes {conditionvar/varequal/text()}]
+ foreach correct $scoreNodes {
+ set choice [string trim [$correct nodeValue]]
+ }
+ set scoreNodes [$respcondition selectNodes {setvar[@varname='SCORE']/text()}]
+ foreach scorenode $scoreNodes {
+ set score [string trim [$scorenode nodeValue]]
+ }
+ set as_item_choices__score($choice) $score
+ }
+ }
+ }
+ set presentationNodes [$item selectNodes {presentation}]
+ foreach presentation $presentationNodes {
+ set presentationChildNodes [$presentation selectNodes {.//material|.//response_str}]
+ set materialNodes [$presentation selectNodes {.//material}]
+ set material [lindex $materialNodes 0]
+ # Initialize in case it doesn't exist
+ set as_items__title {}
+ if {[$material nodeName] == {material}} {
+ set mattextNodes [$material selectNodes {mattext/text()}]
+ set mattext [lindex $mattextNodes 0]
+ set as_items__title [$mattext nodeValue]
+ }
+ set render_fibNodes [$presentation selectNodes {.//render_fib}]
+ if {[llength $render_fibNodes] > 0} {
+ set as_items__title {}
+ # fillinblank or shortanswer
+ set render_fib [lindex $render_fibNodes 0]
+ # fillinblank (textbox)
+ # this is the default
+ set as_item_display_id {}
+ if {[$render_fib hasAttribute {rows}]} {
+ # shortanswer (textarea)
+ set as_item_display_id [as::item_display_ta::new -name [ad_generate_random_string]]
+ foreach node $presentationChildNodes {
+ if {[$node nodeName] == {material}} {
+ set mattextNodes [$node selectNodes {mattext/text()}]
+ set mattext [lindex $mattextNodes 0]
+ append as_items__title [ad_quotehtml [$mattext nodeValue]]
+ }
+ }
+ set as_item_type_id [as::item_type_oq::new -name [ad_generate_random_string]]
+ } else {
+ set as_item_display_id [as::item_display_tb::new -name [ad_generate_random_string]]
+
+ set as_item_type_id [as::item_type_mc::new -name [ad_generate_random_string]]
+ foreach node $presentationChildNodes {
+ if {[$node nodeName] == {material}} {
+ set mattextNodes [$node selectNodes {mattext/text()}]
+ set mattext [lindex $mattextNodes 0]
+ append as_items__title [ad_quotehtml [$mattext nodeValue]]
+ } elseif {[$node nodeName] == {response_str}} {
+ set as_item_choices__ident [$node getAttribute {ident}]
+ # get the correct response
+ set as_item_choices__choice_text_nodes [$node selectNodes "//conditionvar/or/varequal\[@respident='$as_item_choices__ident'\]/text()"]
+ set as_item_choices__choice_text {}
+ foreach respident $as_item_choices__choice_text_nodes {
+ lappend as_item_choices__choice_text [string trim [$respident nodeValue]]
+ }
+ # Insert as_item_choice in the CR (and as_item_choices table) getting the revision_id (choice_id)
+ set as_item_choice_id [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
+ append 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 -feedback_right $as_items__feedback_right -feedback_wrong $as_items__feedback_wrong]
+ 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}
+ 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}
+ } else {
+ 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 "Single"
+ if {[$response_lid hasAttribute {rcardinality}]} {
+ 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
+ set as_item_display_id {}
+ if {$as_items__rcardinality == {Multiple}} {
+ # multiple response either text (remember it can be internationalized or changed), images, sounds, videos
+ set as_item_display_id [as::item_display_cb::new -name [ad_generate_random_string]]
+ } else {
+ set as_item_display_id [as::item_display_rb::new -name [ad_generate_random_string]]
+ }
+ 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 -feedback_right $as_items__feedback_right -feedback_wrong $as_items__feedback_wrong]
+ 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}
+ 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 response_labelNodes [$presentation selectNodes {.//response_label}]
+ foreach response_label $response_labelNodes {
+ set as_item_choices__ident [$response_label getAttribute {ident}]
+ set mattextNodes [$response_label selectNodes {material/mattext/text()}]
+ set as_item_choices__choice_text [db_null]
+ foreach mattext $mattextNodes {
+ 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_item_choices__correct_answer_p($as_item_choices__ident) [expr [info exists as_item_choices__correct_answer_p($as_item_choices__ident)]?{t}:{f}]
+ if {![info exists as_item_choices__score($as_item_choices__ident)]} {
+ set as_item_choices__score($as_item_choices__ident) 0
+ }
+ 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 -correct_answer_p $as_item_choices__correct_answer_p($as_item_choices__ident) -percent_score $as_item_choices__score($as_item_choices__ident)
+ # order of the item_choices
+ incr sort_order
+ }
+ }
+ }
+ # Relation between as_items and as_sections
+ if {$section_id != 0} {
+ db_dml as_item_section_map_insert {}
+ incr as_item_section_map__sort_order
+ }
+ }
+ return 1
+}
Index: openacs-4/packages/assessment/tcl/as-section-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,28 @@
+ad_library {
+ Section procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::section {}
+
+ad_proc -public as::section::new {
+ {-name:required}
+ {-title:required}
+ {-instructions ""}
+ {-description ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @creation-date 2004-07-26
+
+ 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"]
+
+ # 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
+}
\ No newline at end of file
Index: openacs-4/packages/assessment/tcl/as-session-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-session-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/tcl/as-session-procs.tcl 14 Oct 2004 11:44:51 -0000 1.1
@@ -0,0 +1,38 @@
+ad_library {
+ Session procs
+ @author eperez@it.uc3m.es, nperper@it.uc3m.es
+ @creation-date 2004-07-26
+}
+
+namespace eval as::session {}
+
+ad_proc -public as::session::new {
+ {-assessment_id:required}
+ {-subject_id:required}
+ {-staff_id ""}
+ {-target_datetime ""}
+ {-creation_datetime ""}
+ {-first_mod_datetime ""}
+ {-last_mod_datetime ""}
+ {-completed_datetime ""}
+ {-ip_address ""}
+ {-percent_score ""}
+ {-consent_timestamp ""}
+} {
+ @author Eduardo Perez (eperez@it.uc3m.es)
+ @creation-date 2004-09-12
+
+ New as_session 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"]
+
+# # Check to see if there's a session already to not submit another one
+# db_0or1row as_session_last {SELECT session_id AS as_session_id FROM as_sessionsx WHERE subject_id = :subject_id AND assessment_id = :assessment_id}
+# if { ! [info exists as_session_id] } {
+ # Insert as_session in the CR (and as_sessions table) getting the revision_id (session_id)
+ set session_id [content::item::new -parent_id $folder_id -content_type {as_sessions} -name "$subject_id-$assessment_id-[ad_generate_random_string]" -title "$subject_id-$assessment_id-[ad_generate_random_string]" ]
+ set as_session_id [content::revision::new -item_id $session_id -content_type {as_sessions} -title "$subject_id-$assessment_id-[ad_generate_random_string]" -attributes [list [list assessment_id $assessment_id] [list subject_id $subject_id] [list staff_id $staff_id] [list target_datetime $target_datetime] [list creation_datetime $creation_datetime] [list first_mod_datetime $first_mod_datetime] [list last_mod_datetime $last_mod_datetime] [list completed_datetime $completed_datetime] [list percent_score $percent_score] [list consent_timestamp $consent_timestamp] ] ]
+# }
+ return $as_session_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.24 -r1.25
--- openacs-4/packages/assessment/tcl/assessment-qti-procs.tcl 14 Oct 2004 11:35:50 -0000 1.24
+++ openacs-4/packages/assessment/tcl/assessment-qti-procs.tcl 14 Oct 2004 11:54:22 -0000 1.25
@@ -45,7 +45,7 @@
}
}
# Insert assessment in the CR (and as_assessments table) getting the revision_id (assessment_id)
- set as_assessments__assessment_id [as_assessment_new -name $as_assessments__name -title $as_assessments__title -description $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}]
@@ -66,7 +66,7 @@
}
}
# Insert section in the CR (the and the as_sections table) getting the revision_id (section_id)
- set as_sections__section_id [as_section_new -name $as_sections__name -title $as_sections__title -description $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 {}
@@ -162,11 +162,11 @@
set as_item_display_id {}
if {[$render_fib hasAttribute {rows}]} {
# shortanswer (textarea)
- set as_item_display_id [as_item_display_sa_new -name [ad_generate_random_string]]
+ set as_item_display_id [as::item_display_sa::new -name [ad_generate_random_string]]
} else {
- set as_item_display_id [as_item_display_tb_new -name [ad_generate_random_string]]
+ set as_item_display_id [as::item_display_tb::new -name [ad_generate_random_string]]
}
- set as_item_type_id [as_item_type_mc_new -name [ad_generate_random_string]]
+ set as_item_type_id [as::item_type_mc::new -name [ad_generate_random_string]]
foreach node $presentationChildNodes {
if {[$node nodeName] == {material}} {
set mattextNodes [$node selectNodes {mattext/text()}]
@@ -181,14 +181,14 @@
lappend as_item_choices__choice_text [string trim [$respident nodeValue]]
}
# Insert as_item_choice in the CR (and as_item_choices table) getting the revision_id (choice_id)
- set as_item_choice_id [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]
+ set as_item_choice_id [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
append 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 -feedback_right $as_items__feedback_right -feedback_wrong $as_items__feedback_wrong]
+ set as_item_id [as::item::new -name $as_items__name -title $as_items__title -feedback_right $as_items__feedback_right -feedback_wrong $as_items__feedback_wrong]
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}
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}
} else {
@@ -202,13 +202,13 @@
set as_item_display_id {}
if {$as_items__rcardinality == {Multiple}} {
# multiple response either text (remember it can be internationalized or changed), images, sounds, videos
- set as_item_display_id [as_item_display_cb_new -name [ad_generate_random_string]]
+ set as_item_display_id [as::item_display_cb::new -name [ad_generate_random_string]]
} else {
- set as_item_display_id [as_item_display_rb_new -name [ad_generate_random_string]]
+ set as_item_display_id [as::item_display_rb::new -name [ad_generate_random_string]]
}
- set as_item_type_id [as_item_type_mc_new -name $as_item_type__name]
+ 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 -feedback_right $as_items__feedback_right -feedback_wrong $as_items__feedback_wrong]
+ set as_item_id [as::item::new -name $as_items__name -title $as_items__title -feedback_right $as_items__feedback_right -feedback_wrong $as_items__feedback_wrong]
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}
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 response_labelNodes [$presentation selectNodes {.//response_label}]
@@ -224,7 +224,7 @@
if {![info exists as_item_choices__score($as_item_choices__ident)]} {
set as_item_choices__score($as_item_choices__ident) 0
}
- 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 -correct_answer_p $as_item_choices__correct_answer_p($as_item_choices__ident) -percent_score $as_item_choices__score($as_item_choices__ident)
+ 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 -correct_answer_p $as_item_choices__correct_answer_p($as_item_choices__ident) -percent_score $as_item_choices__score($as_item_choices__ident)
# order of the item_choices
incr sort_order
}
Index: openacs-4/packages/assessment/tcl/install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/Attic/install-procs.tcl,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/assessment/tcl/install-procs.tcl 7 Oct 2004 11:08:38 -0000 1.11
+++ openacs-4/packages/assessment/tcl/install-procs.tcl 14 Oct 2004 11:50:51 -0000 1.12
@@ -9,9 +9,9 @@
@author eperez@it.uc3m.es, nperper@it.uc3m.es
}
-namespace eval assessment::install {}
+namespace eval as::install {}
-ad_proc -public assessment::install::assessment_create_install {
+ad_proc -public as::install::assessment_create_install {
} {
Creates the content type and adds in attributes.
} {
@@ -167,7 +167,7 @@
}
-ad_proc -public assessment::install::package_instantiate {
+ad_proc -public as::install::package_instantiate {
-package_id:required
} {
Define folders
Index: openacs-4/packages/assessment/www/assessment.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/assessment/www/assessment.tcl 7 Oct 2004 13:39:57 -0000 1.8
+++ openacs-4/packages/assessment/www/assessment.tcl 14 Oct 2004 11:48:36 -0000 1.9
@@ -10,7 +10,7 @@
set context [list "[_ assessment.Show_Items]"]
-set as_session_id [as_session_new -assessment_id $assessment_id -subject_id [ad_conn user_id]]
+set as_session_id [as::session::new -assessment_id $assessment_id -subject_id [ad_conn user_id]]
set assessment_name [db_string assessment_name {
SELECT title
@@ -29,7 +29,7 @@
}
db_multirow -extend {presentation_type html} items query_all_items {} {
- set presentation_type [add_item_to_form show_item_form $as_item_id]
+ set presentation_type [as::item_form::add_item_to_form show_item_form $as_item_id]
if {$presentation_type == {fitb}} {
regsub -all -line -nocase -- {