Index: openacs-4/packages/assessment/assessment.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v diff -u -r1.10 -r1.11 --- openacs-4/packages/assessment/assessment.info 9 Dec 2004 11:11:04 -0000 1.10 +++ openacs-4/packages/assessment/assessment.info 10 Dec 2004 11:42:36 -0000 1.11 @@ -7,7 +7,7 @@ f f - + oracle postgresql @@ -20,7 +20,7 @@ 0 E-LANE Create assessments and evalueate. - + Index: openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml,v diff -u -r1.11 -r1.12 --- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 9 Dec 2004 11:10:57 -0000 1.11 +++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 10 Dec 2004 11:42:19 -0000 1.12 @@ -17,6 +17,7 @@ Add items to section Add new question Add new section + Add new section display Add sections to assessment Add to assessment "%assessment_data.title%" Add to section "%section_title%" @@ -39,6 +40,7 @@ Title Attempt Author + Back button allowed Below Beside-Left Beside-Right @@ -100,6 +102,7 @@ Edit Question: Short Answer Edit Question: Open Question Edit Section + Edit Display Editable Email Options: End Time @@ -179,6 +182,8 @@ Out of Percent Score points + Points for Question + Points for Section Preview Question Question not answered @@ -188,6 +193,7 @@ Registrated respondents required regarding this survey Remove: + Remove Choice Remove Question Remove Section - Removes all questions and responses @@ -208,7 +214,12 @@ Search and add sections Search and add sections to assessment "%assessment_data.title%" SECTION + Branched section Section Navigation + -- New -- + Number of questions per page + Order of questions + Section Template Sections Secure Access Required Secure access required @@ -228,6 +239,7 @@ Subject Subject Name Submit + Seperate submit for each question Subtext Summary This question will be corrected by the teacher Index: openacs-4/packages/assessment/lib/item-show-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-mc.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/lib/item-show-mc.tcl 8 Dec 2004 15:30:32 -0000 1.1 +++ openacs-4/packages/assessment/lib/item-show-mc.tcl 10 Dec 2004 11:42:22 -0000 1.2 @@ -15,13 +15,26 @@ # add form entries for each choice set ad_form_code "-form \{\n" set count 0 -db_foreach get_choices {} { +set choices [db_list_of_lists get_choices {}] +set total [llength $choices] +foreach one_choice $choices { + util_unlist $one_choice choice_id title correct_answer_p feedback_text selected_p percent_score sort_order incr count + set options "" + if {$count < $total} { + append options { \"[_} + } + if {$count > 1} { + append options { \"[_} + } + append options { \"[_} + if {$correct_answer_p == "t"} { - append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $count\"\} \{value \"$title \"\}\}\n" + append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $count\"\} \{value \" $title$options\"\}\}\n" } else { - append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $count\"\} \{value \"$title \"\}\}\n" + append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $count\"\} \{value \" $title$options\"\}\}\n" } + append ad_form_code "\{selected.$choice_id:text(select),optional \{label \"[_ assessment.Default_Selected]\"\} \{options \$boolean_options\} \{value $selected_p\} \{help_text \"[_ assessment.Default_Selected_help]\"\}\}\n" append ad_form_code "\{feedback.$choice_id:text(textarea),optional \{label \"[_ assessment.Feedback]\"\} \{html \{rows 8 cols 80\}\} \{value \"$feedback_text\"\} \{help_text \"[_ assessment.choice_Feedback_help]\"\}\}\n" append ad_form_code "\{percent.$choice_id:text \{label \"[_ assessment.Percent_Score]\"\} \{value \"$percent_score\"\} \{html \{size 5 maxlength 5\}\} \{help_text \"[_ assessment.Percent_Score_help]\"\}\}\n" Index: openacs-4/packages/assessment/lib/item-show-mc.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-mc.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/lib/item-show-mc.xql 8 Dec 2004 15:30:32 -0000 1.1 +++ openacs-4/packages/assessment/lib/item-show-mc.xql 10 Dec 2004 11:42:22 -0000 1.2 @@ -18,8 +18,8 @@ - select c.choice_id, r.title, c.correct_answer_p, c.feedback_text, c.selected_p, - c.correct_answer_p, c.percent_score + select c.choice_id, r.title, c.correct_answer_p, c.feedback_text, + c.selected_p, c.percent_score, c.sort_order from as_item_choices c, cr_revisions r where r.revision_id = c.choice_id and c.mc_id = :as_item_type_id Index: openacs-4/packages/assessment/lib/section-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/lib/section-items.adp 9 Dec 2004 11:10:57 -0000 1.5 +++ openacs-4/packages/assessment/lib/section-items.adp 10 Dec 2004 11:42:22 -0000 1.6 @@ -19,12 +19,17 @@ -@items.rownum@. * + @items.rownum@. @items.name@ * + + + + + + + #assessment.Edit# -#assessment.disabled# - #assessment.Copy# #assessment.Add_New# @@ -40,6 +45,7 @@ #assessment.remove_item# (#assessment.max_time# @items.max_time_to_complete@) +(@items.points@ #assessment.points#) @@ -48,7 +54,7 @@ - +
@items.title;noquote@
@@ -72,7 +78,7 @@ - + #assessment.Add_New# #assessment.Search_Item# Index: openacs-4/packages/assessment/lib/section-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-items.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/lib/section-items.tcl 14 Nov 2004 16:45:52 -0000 1.1 +++ openacs-4/packages/assessment/lib/section-items.tcl 10 Dec 2004 11:42:22 -0000 1.2 @@ -8,6 +8,9 @@ regsub -all -line -nocase -- { - select i.as_item_id, cr.title, i.definition, ism.required_p, - ism.enabled_p, ism.section_id, ism.sort_order, ism.adp_chunk, - ism.max_time_to_complete - from as_items i, cr_revisions cr, as_item_section_map ism - where cr.revision_id = i.as_item_id + select i.as_item_id, cr.title, ci.name, ism.required_p, + ism.section_id, ism.sort_order, + ism.max_time_to_complete, ism.points + from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism + where ci.item_id = cr.item_id + and cr.revision_id = i.as_item_id and i.as_item_id = ism.as_item_id and ism.section_id = :section_id order by ism.sort_order Index: openacs-4/packages/assessment/lib/section-show.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-show.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/lib/section-show.adp 9 Dec 2004 11:10:57 -0000 1.1 +++ openacs-4/packages/assessment/lib/section-show.adp 10 Dec 2004 11:42:22 -0000 1.2 @@ -14,9 +14,9 @@ -@items.rownum@. * -#assessment.disabled# +@items.rownum@. @items.name@ * (#assessment.max_time# @items.max_time_to_complete@) +(@items.points@ #assessment.points#) @@ -25,7 +25,7 @@ - +
@items.title;noquote@
Index: openacs-4/packages/assessment/lib/section-show.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/section-show.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/lib/section-show.tcl 9 Dec 2004 11:10:57 -0000 1.1 +++ openacs-4/packages/assessment/lib/section-show.tcl 10 Dec 2004 11:42:22 -0000 1.2 @@ -8,6 +8,9 @@ regsub -all -line -nocase -- { - select i.as_item_id, cr.title, i.definition, ism.required_p, - ism.enabled_p, ism.section_id, ism.sort_order, ism.adp_chunk, - ism.max_time_to_complete - from as_items i, cr_revisions cr, as_item_section_map ism - where cr.revision_id = i.as_item_id + select i.as_item_id, cr.title, ci.name, ism.required_p, + ism.section_id, ism.sort_order, + ism.max_time_to_complete, ism.points + from as_items i, cr_revisions cr, cr_items ci, as_item_section_map ism + where ci.item_id = cr.item_id + and cr.revision_id = i.as_item_id and i.as_item_id = ism.as_item_id and ism.section_id = :section_id order by ism.sort_order Index: openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql 17 Nov 2004 17:16:07 -0000 1.12 +++ openacs-4/packages/assessment/sql/postgresql/assessment-item-create.sql 10 Dec 2004 11:42:22 -0000 1.13 @@ -13,11 +13,9 @@ constraint as_items_item_id_fk references cr_revisions(revision_id), -- a secondary label, needed for many kinds of questions - subtext varchar(500), - -- a short label for use in data output header rows, etc + subtext varchar(500), + -- a short label for use in data output header rows; default = cr_items.name field_code varchar(500), - -- some descriptive text - definition text, -- whether Item must be answered (default value, can be overriden) required_p char(1) default 'f' constraint as_items_required_p_ck @@ -26,12 +24,12 @@ data_type varchar(50), -- optional max number of seconds to perform Item max_time_to_complete integer, - -- a denormalization to cache the generated "widget" for the Item (NB: when any change is made to an as_item_choice related to an as_item, this will have to be updated!) - adp_chunk varchar(500), -- right feedback feedback_right text, -- wrong feedback - feedback_wrong text + feedback_wrong text, + -- number of points for item; might be used for defining difficulty levels + points integer ); -- contains additional information for all multiple choices (radiobutton, checkbox) 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.11 -r1.12 --- openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 6 Dec 2004 12:27:57 -0000 1.11 +++ openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 10 Dec 2004 11:42:22 -0000 1.12 @@ -7,35 +7,29 @@ --Section Display Types: define types of display for an groups of Items. create table as_section_display_types ( - section_display_type_id integer + display_type_id integer constraint as_section_display_types_id_pk - primary key, - -- name - section_type_name varchar(25), - -- all-items; one-item-per-page; variable (get item groups from mapping table) - pagination_style varchar(25) - constraint as_section_display_types_pagination_style_nn - not null, + primary key + constraint as_section_display_types_id_fk + references cr_revisions(revision_id), + -- number of items displayed per page + num_items integer, + -- adp template + adp_chunk text, -- whether this Section defines a branch point or whether this Section simply transitions to the next Section branched_p char(1) default 'f' constraint as_section_display_types_branched_p_ck check (branched_p in ('t','f')), - -- the pattern by which 2..n Items are laid out when displayed (horizontal, vertical, matrix_col-row, matrix_row-col) - item_orientation varchar(25) default 'horizontal' - constraint as_section_display_types_item_orientation_ck - check (item_orientation in ('horizontal','vertical','matrix_col-row','matrix_row-col')), - -- whether to display labels of the Items - item_labels_as_headers_p char(1) default 't' - constraint as_section_display_types_item_labels_as_headers_p_ck - check (item_labels_as_headers_p in ('t','f')), - -- May actually be superfluous - presentation_type varchar(25), - -- the orientation between the "section description part" of the Section and the group of Items (beside-left, beside-right, bellow, above) - item_aligment varchar(25) - constraint as_section_display_types_item_alignment_ck - check (item_aligment in ('beside_left','beside_right','below','above')), - -- other stuff like the grid dimensions - display_options varchar(25) + -- whether the back button is not allowed to work + back_button_p char(1) default 't' + constraint as_section_display_types_back_button_p_ck + check (back_button_p in ('t','f')), + -- whether each answer has to be submitted via a seperate button + submit_answer_p char(1) default 'f' + constraint as_section_display_types_submit_answer_p_ck + check (submit_answer_p in ('t','f')), + -- order in which the items will appear (randomized, alphabetical, order_of_entry) + sort_order_type varchar(20) ); -- Sections: represents logically-grouped set of items @@ -45,21 +39,13 @@ primary key constraint as_sections_section_id_fk references cr_revisions(revision_id), - section_display_type_id integer - constraint as_sections_section_display_type_id_fk - references as_section_display_types (section_display_type_id), - -- text used for identification and selection in admin pages, not for end-user pages - definition text, + display_type_id integer + constraint as_sections_display_type_id_fk + references as_section_display_types (display_type_id), -- text displayed on user pages instructions text, - -- Maybe this isnt really useful - required_p char(1) default 't' - constraint as_sections_required_p_ck - check (required_p in ('t','f')), - -- References an item in the CR (for an image, audio file or video file) - content_value integer, - -- number of points for section - numeric_value integer, + -- number of points for section; might be used for defining difficulty levels + points integer, -- preset text to show user feedback_text text, -- max number of seconds to perform Section @@ -156,42 +142,32 @@ section_id integer constraint as_assessment_section_map_section_id_fk references as_sections (section_id), - -- feedback - feedback_text text, -- maximum time to complete a section max_time_to_complete integer, -- order in which a section will be displayed - sort_order integer + sort_order integer, + -- this is the relative weight of a section in an assessment + points integer ); -- Item Section Map: defines the items of a section create table as_item_section_map ( as_item_id integer - constraint as_item_section_map_item_id_fk - references as_items (as_item_id), + constraint as_item_section_map_item_id_fk + references as_items (as_item_id), section_id integer constraint as_item_section_map_section_id_fk references as_sections (section_id), - enabled_p char(1) default 't' - constraint as_item_section_map_enabled_p_ck - check (enabled_p in ('t','f')), -- whether Item must be answered required_p char(1) default 'f' constraint as_item_section_map_required_p_ck check (required_p in ('t','f')), - item_default integer, - -- references CR - content_value integer - constraint as_item_section_map_content_value_fk - references cr_revisions, - -- points for the item - numeric_value integer, - -- feedback for the item - feedback_text text, -- maximum time to answer the item max_time_to_complete integer, - -- display code - adp_chunk varchar(25), -- order in which items appear in a section - sort_order integer + sort_order integer, + -- fixed position in display. 0 for default, negative values relative to section end + fixed_position integer, + -- this is the relative weight of an item in a section + points integer ); Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.04d-0.05d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.04d-0.05d.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.04d-0.05d.sql 10 Dec 2004 11:42:22 -0000 1.1 @@ -0,0 +1,57 @@ +alter table as_sections drop constraint as_sections_section_display_type_id_fk; + +drop table as_section_display_types; + +--Section Display Types: define types of display for an groups of Items. +create table as_section_display_types ( + display_type_id integer + constraint as_section_display_types_id_pk + primary key + constraint as_section_display_types_id_fk + references cr_revisions(revision_id), + -- number of items displayed per page + num_items integer, + -- adp template + adp_chunk text, + -- whether this Section defines a branch point or whether this Section simply transitions to the next Section + branched_p char(1) default 'f' + constraint as_section_display_types_branched_p_ck + check (branched_p in ('t','f')), + -- whether the back button is not allowed to work + back_button_p char(1) default 't' + constraint as_section_display_types_back_button_p_ck + check (back_button_p in ('t','f')), + -- whether each answer has to be submitted via a seperate button + submit_answer_p char(1) default 'f' + constraint as_section_display_types_submit_answer_p_ck + check (submit_answer_p in ('t','f')), + -- order in which the items will appear (randomized, alphabetical, order_of_entry) + sort_order_type varchar(20) +); + +alter table as_sections drop column section_display_type_id cascade; +alter table as_sections add column display_type_id integer constraint as_sections_display_type_id_fk references as_section_display_types (display_type_id); +alter table as_sections drop column definition cascade; +alter table as_sections drop column content_value cascade; +alter table as_sections drop column numeric_value cascade; +alter table as_sections drop column required_p cascade; +alter table as_sections add points integer; + +alter table as_assessment_section_map drop column feedback_text cascade; +alter table as_assessment_section_map add points integer; + +alter table as_item_section_map drop column enabled_p cascade; +alter table as_item_section_map drop column item_default cascade; +alter table as_item_section_map drop column content_value cascade; +alter table as_item_section_map drop column numeric_value cascade; +alter table as_item_section_map drop column feedback_text cascade; +alter table as_item_section_map drop column adp_chunk cascade; +alter table as_item_section_map add fixed_position integer; +alter table as_item_section_map add points integer; + +alter table as_items drop column definition cascade; +alter table as_items drop column adp_chunk cascade; +alter table as_items add points integer; + +select content_type__refresh_view('as_items'); +select content_type__refresh_view('as_sections'); Index: openacs-4/packages/assessment/tcl/as-assessment-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-assessment-procs.xql 8 Dec 2004 15:30:34 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-assessment-procs.xql 10 Dec 2004 11:42:23 -0000 1.4 @@ -25,8 +25,8 @@ insert into as_assessment_section_map - (select :new_assessment_id as assessment_id, section_id, feedback_text, - max_time_to_complete, sort_order + (select :new_assessment_id as assessment_id, section_id, + max_time_to_complete, sort_order, points from as_assessment_section_map where assessment_id = :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 -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-install-procs.tcl 8 Dec 2004 15:30:34 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-install-procs.tcl 10 Dec 2004 11:42:23 -0000 1.9 @@ -29,6 +29,7 @@ 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_section_display_types} -supertype {content_revision} -pretty_name {Assessment Section Display Type} -pretty_plural {Assessment Section Display Types} -table_name {as_section_display_types} -id_column {display_type_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} @@ -112,22 +113,28 @@ # Items 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_items} -attribute_name {points} -datatype {number} -pretty_name {Points awarded for this item} -column_spec {integer} # Sections -content::type::create_attribute -content_type {as_sections} -attribute_name {section_display_type_id} -datatype {number} -pretty_name {Section Display Type} -column_spec {integer} +content::type::create_attribute -content_type {as_sections} -attribute_name {display_type_id} -datatype {number} -pretty_name {Section Display Type} -column_spec {integer} 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_sections} -attribute_name {definition} -datatype {string} -pretty_name {Section Definition} -column_spec {text} -content::type::create_attribute -content_type {as_sections} -attribute_name {required_p} -datatype {boolean} -pretty_name {Section Required} -column_spec {char(1)} content::type::create_attribute -content_type {as_sections} -attribute_name {feedback_text} -datatype {string} -pretty_name {Section Feedback} -column_spec {text} content::type::create_attribute -content_type {as_sections} -attribute_name {max_time_to_complete} -datatype {number} -pretty_name {Section Max Time to Complete} -column_spec {integer} +content::type::create_attribute -content_type {as_sections} -attribute_name {points} -datatype {number} -pretty_name {Points awarded for this section} -column_spec {integer} +# Section Display Types +content::type::create_attribute -content_type {as_section_display_types} -attribute_name {num_items} -datatype {number} -pretty_name {Number of items displayed per page} -column_spec {integer} +content::type::create_attribute -content_type {as_section_display_types} -attribute_name {adp_chunk} -datatype {string} -pretty_name {Section Display Template} -column_spec {text} +content::type::create_attribute -content_type {as_section_display_types} -attribute_name {branched_p} -datatype {boolean} -pretty_name {Section Branched} -column_spec {char(1)} +content::type::create_attribute -content_type {as_section_display_types} -attribute_name {back_button_p} -datatype {boolean} -pretty_name {Back button allowed} -column_spec {char(1)} +content::type::create_attribute -content_type {as_section_display_types} -attribute_name {submit_answer_p} -datatype {boolean} -pretty_name {Seperate submit for each answer} -column_spec {char(1)} +content::type::create_attribute -content_type {as_section_display_types} -attribute_name {sort_order_type} -datatype {string} -pretty_name {Item sort order type} -column_spec {varchar(20)} + # Assessments 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} @@ -206,6 +213,7 @@ 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_section_display_types} -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 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 -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-item-form-procs.xql 27 Oct 2004 13:51:09 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-item-form-procs.xql 10 Dec 2004 11:42:23 -0000 1.3 @@ -3,39 +3,31 @@ - select - as_item_choicesx.choice_id, as_item_choicesx.title, as_item_choicesx.content_value - from - as_item_choicesx - where - as_item_choicesx.mc_id=:mc_id - order by - as_item_choicesx.sort_order + select i.choice_id, cr.title, i.content_value + from as_item_choices i, cr_revisions cr + where i.mc_id = :mc_id + and cr.revision_id = i.choice_id + order by i.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 i.choice_id, cr.title + from as_item_choices i, cr_revisions cr + where i.mc_id = :mc_id + and cr.revision_id = i.choice_id + order by i.sort_order - select - as_itemsx.title, as_itemsx.required_p - from - as_itemsx - where - as_itemsx.as_item_id=:item_id + select cr.title, i.required_p + from as_items i, cr_revisions cr + where i.as_item_id = :item_id + and cr.revision_id = i.as_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 -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-procs.tcl 10 Dec 2004 11:42:23 -0000 1.5 @@ -7,16 +7,17 @@ namespace eval as::item {} ad_proc -public as::item::new { + {-name:required} {-title:required} {-description ""} {-subtext ""} {-field_code ""} - {-definition ""} {-required_p ""} {-data_type ""} {-max_time_to_complete ""} {-feedback_right ""} {-feedback_wrong ""} + {-points ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-07-26 @@ -28,19 +29,23 @@ # Insert as_item in the CR (and as_items table) getting the revision_id (as_item_id) db_transaction { - set item_item_id [content::item::new -parent_id $folder_id -content_type {as_items} -name [exec uuidgen] -title $title ] + set item_item_id [db_nextval acs_object_id_seq] + if {[empty_string_p $name]} { + set name "ITE_$item_item_id" + } + set item_item_id [content::item::new -item_id $item_item_id -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 \ -description $description \ -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] ] ] + [list feedback_wrong $feedback_wrong] \ + [list points $points] ] ] } return $as_item_id @@ -52,12 +57,12 @@ {-description ""} {-subtext ""} {-field_code ""} - {-definition ""} {-required_p ""} {-data_type ""} {-max_time_to_complete ""} {-feedback_right ""} {-feedback_wrong ""} + {-points ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 @@ -74,12 +79,12 @@ -description $description \ -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] ] ] + [list feedback_wrong $feedback_wrong] \ + [list points $points] ] ] copy_types -as_item_id $as_item_id -new_item_id $new_item_id } @@ -105,12 +110,12 @@ -description $description \ -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] ] ] + [list feedback_wrong $feedback_wrong] \ + [list points $points] ] ] copy_types -as_item_id $as_item_id -new_item_id $new_item_id as::assessment::copy_categories -from_id $as_item_id -to_id $new_item_id @@ -121,6 +126,7 @@ ad_proc -public as::item::copy { -as_item_id:required + -name:required } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 @@ -135,20 +141,24 @@ db_1row item_data {} append title "[_ assessment.copy_appendix]" - set item_item_id [content::item::new -parent_id $folder_id -content_type {as_items} -name [exec uuidgen] -title $title ] + set item_item_id [db_nextval acs_object_id_seq] + if {[empty_string_p $name]} { + set name "ITE_$item_item_id" + } + set item_item_id [content::item::new -item_id $item_item_id -parent_id $folder_id -content_type {as_items} -name $name -title $title ] set new_item_id [content::revision::new \ -item_id $item_item_id \ -content_type {as_items} \ -title $title \ -description $description \ -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] ] ] + [list feedback_wrong $feedback_wrong] \ + [list points $points] ] ] as::assessment::copy_categories -from_id $as_item_id -to_id $new_item_id Index: openacs-4/packages/assessment/tcl/as-item-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-procs.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -15,8 +15,8 @@ select cr.item_id as item_item_id, cr.title, cr.description, i.subtext, i.field_code, - i.definition, i.required_p, i.data_type, i.max_time_to_complete, - i.feedback_right, i.feedback_wrong + i.required_p, i.data_type, i.max_time_to_complete, + i.feedback_right, i.feedback_wrong, i.points from cr_revisions cr, as_items i where cr.revision_id = :as_item_id and i.as_item_id = cr.revision_id @@ -28,8 +28,8 @@ select cr.title, cr.description, i.subtext, i.field_code, - i.definition, i.required_p, i.data_type, i.max_time_to_complete, - i.feedback_right, i.feedback_wrong + i.required_p, i.data_type, i.max_time_to_complete, + i.feedback_right, i.feedback_wrong, i.points from cr_revisions cr, as_items i where cr.revision_id = :as_item_id and i.as_item_id = cr.revision_id 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 -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 8 Dec 2004 15:30:34 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 10 Dec 2004 11:42:23 -0000 1.5 @@ -68,6 +68,38 @@ return $new_item_type_id } +ad_proc -public as::item_type_mc::new_revision { + -as_item_type_id:required + {-with_choices_p "t"} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-07 + + Create new revision of Multiple Choice item in the data database +} { + # Update as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) + db_transaction { + db_1row item_type_data {} + set new_item_type_id [content::revision::new \ + -item_id $type_item_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] ] ] + + if {$with_choices_p == "t"} { + set choices [db_list get_choices {}] + foreach choice_id $choices { + set new_choice_id [as::item_choice::new_revision -choice_id $choice_id -mc_id $new_item_type_id] + } + } + } + + return $new_item_type_id +} + ad_proc -public as::item_type_mc::copy { -type_id:required } { Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -23,6 +23,28 @@ + + + + select cr.item_id as type_item_id, cr.title, i.increasing_p, + i.allow_negative_p, i.num_correct_answers, i.num_answers + from cr_revisions cr, as_item_type_mc i + where cr.revision_id = :as_item_type_id + and i.as_item_type_id = cr.revision_id + + + + + + + + select choice_id + from as_item_choices + where mc_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-section-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-display-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-section-display-procs.tcl 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,81 @@ +ad_library { + Section Display Type procs + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-09 +} + +namespace eval as::section_display {} + +ad_proc -public as::section_display::new { + {-title:required} + {-description ""} + {-num_items ""} + {-adp_chunk ""} + {-branched_p ""} + {-back_button_p ""} + {-submit_answer_p ""} + {-sort_order_type ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-09 + + New section display 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_section_display_type in the CR (and as_section_display_types table) getting the revision_id (display_type_id) + db_transaction { + set display_item_id [content::item::new -parent_id $folder_id -content_type {as_section_display_types} -name [exec uuidgen] -title $title -description $description ] + + set display_id [content::revision::new \ + -item_id $display_item_id \ + -content_type {as_section_display_types} \ + -title $title \ + -description $description \ + -attributes [list [list num_items $num_items] \ + [list adp_chunk $adp_chunk] \ + [list branched_p $branched_p] \ + [list back_button_p $back_button_p] \ + [list submit_answer_p $submit_answer_p] \ + [list sort_order_type $sort_order_type] ] ] + } + + return $display_id +} + +ad_proc -public as::section_display::edit { + {-display_type_id:required} + {-title:required} + {-description ""} + {-num_items ""} + {-adp_chunk ""} + {-branched_p ""} + {-back_button_p ""} + {-submit_answer_p ""} + {-sort_order_type ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2004-12-09 + + Edit section display type in the database +} { + # edit as_section_display_type in the CR + set display_item_id [db_string display_item_id {}] + + db_transaction { + set display_id [content::revision::new \ + -item_id $display_item_id \ + -content_type {as_section_display_types} \ + -title $title \ + -description $description \ + -attributes [list [list num_items $num_items] \ + [list adp_chunk $adp_chunk] \ + [list branched_p $branched_p] \ + [list back_button_p $back_button_p] \ + [list submit_answer_p $submit_answer_p] \ + [list sort_order_type $sort_order_type] ] ] + } + + return $display_id +} Index: openacs-4/packages/assessment/tcl/as-section-display-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-display-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-section-display-procs.xql 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,14 @@ + + + + + + + select item_id + from cr_revisions + where revision_id = :display_type_id + + + + + 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 -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 8 Dec 2004 15:30:34 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 10 Dec 2004 11:42:23 -0000 1.6 @@ -7,14 +7,14 @@ namespace eval as::section {} ad_proc -public as::section::new { + {-name:required} {-title:required} {-description ""} - {-definition ""} {-instructions ""} {-feedback_text ""} {-max_time_to_complete ""} - {-required_p t} - {-section_display_type_id ""} + {-display_type_id ""} + {-points ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-07-26 @@ -26,19 +26,22 @@ # Insert as_section in the CR (and as_sections table) getting the revision_id (as_section_id) db_transaction { - set section_item_id [content::item::new -parent_id $folder_id -content_type {as_sections} -name [exec uuidgen] -title $title -description $description ] + set section_item_id [db_nextval acs_object_id_seq] + if {[empty_string_p $name]} { + set name "SEC_$section_item_id" + } + set section_item_id [content::item::new -item_id $section_item_id -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 definition $definition] \ - [list instructions $instructions] \ + -attributes [list [list instructions $instructions] \ [list feedback_text $feedback_text] \ [list max_time_to_complete $max_time_to_complete] \ - [list required_p $required_p] \ - [list section_display_type_id $section_display_type_id] ] ] + [list display_type_id $display_type_id] \ + [list points $points] ] ] } return $as_section_id @@ -48,12 +51,11 @@ {-section_id:required} {-title:required} {-description ""} - {-definition ""} {-instructions ""} {-feedback_text ""} {-max_time_to_complete ""} - {-required_p t} - {-section_display_type_id ""} + {-display_type_id ""} + {-points ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-10-26 @@ -69,12 +71,11 @@ -content_type {as_sections} \ -title $title \ -description $description \ - -attributes [list [list definition $definition] \ - [list instructions $instructions] \ + -attributes [list [list instructions $instructions] \ [list feedback_text $feedback_text] \ [list max_time_to_complete $max_time_to_complete] \ - [list required_p $required_p] \ - [list section_display_type_id $section_display_type_id] ] ] + [list display_type_id $display_type_id] \ + [list points $points] ] ] copy_items -section_id $section_id -new_section_id $new_section_id } @@ -98,12 +99,12 @@ -content_type {as_sections} \ -title $title \ -description $description \ - -attributes [list [list definition $definition] \ - [list instructions $instructions] \ + -attributes [list [list instructions $instructions] \ [list feedback_text $feedback_text] \ [list max_time_to_complete $max_time_to_complete] \ [list required_p $required_p] \ - [list section_display_type_id $section_display_type_id] ] ] + [list display_type_id $display_type_id] \ + [list points $points] ] ] copy_items -section_id $section_id -new_section_id $new_section_id as::assessment::copy_categories -from_id $section_id -to_id $new_section_id @@ -114,6 +115,7 @@ ad_proc -public as::section::copy { {-section_id:required} + {-name:required} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-11-07 @@ -128,18 +130,22 @@ db_1row section_data {} append title "[_ assessment.copy_appendix]" - set section_item_id [content::item::new -parent_id $folder_id -content_type {as_sections} -name [exec uuidgen] -title $title -description $description ] + set section_item_id [db_nextval acs_object_id_seq] + if {[empty_string_p $name]} { + set name "SEC_$section_item_id" + } + set section_item_id [content::item::new -item_id $section_item_id -parent_id $folder_id -content_type {as_sections} -name $name -title $title -description $description ] set new_section_id [content::revision::new \ -item_id $section_item_id \ -content_type {as_sections} \ -title $title \ -description $description \ - -attributes [list [list definition $definition] \ - [list instructions $instructions] \ + -attributes [list [list instructions $instructions] \ [list feedback_text $feedback_text] \ [list max_time_to_complete $max_time_to_complete] \ [list required_p $required_p] \ - [list section_display_type_id $section_display_type_id] ] ] + [list display_type_id $display_type_id] \ + [list points $points] ] ] copy_items -section_id $section_id -new_section_id $new_section_id as::assessment::copy_categories -from_id $section_id -to_id $new_section_id Index: openacs-4/packages/assessment/tcl/as-section-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/tcl/as-section-procs.xql 8 Dec 2004 15:30:34 -0000 1.2 +++ openacs-4/packages/assessment/tcl/as-section-procs.xql 10 Dec 2004 11:42:23 -0000 1.3 @@ -15,8 +15,8 @@ select cr.item_id as section_item_id, cr.title, cr.description, - s.definition, s.instructions, s.feedback_text, s.max_time_to_complete, - s.required_p, s.section_display_type_id + s.instructions, s.feedback_text, s.max_time_to_complete, + s.display_type_id, s.points from cr_revisions cr, as_sections s where cr.revision_id = :section_id and s.section_id = cr.revision_id @@ -28,8 +28,8 @@ select cr.title, cr.description, - s.definition, s.instructions, s.feedback_text, s.max_time_to_complete, - s.required_p, s.section_display_type_id + s.instructions, s.feedback_text, s.max_time_to_complete, + s.display_type_id, s.points from cr_revisions cr, as_sections s where cr.revision_id = :section_id and s.section_id = cr.revision_id @@ -41,9 +41,8 @@ insert into as_item_section_map - (select as_item_id, :new_section_id, enabled_p, required_p, item_default, - content_value, numeric_value, feedback_text, max_time_to_complete, - adp_chunk, sort_order + (select as_item_id, :new_section_id, required_p, max_time_to_complete, + sort_order, fixed_position, points from as_item_section_map where section_id = :section_id) Index: openacs-4/packages/assessment/www/admin/catalog-item-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/catalog-item-add.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/catalog-item-add.adp 9 Dec 2004 11:10:57 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/catalog-item-add.adp 10 Dec 2004 11:42:23 -0000 1.2 @@ -19,9 +19,19 @@ -@items.rownum@. +@items.rownum@. @items.name@ * + (#assessment.max_time# @items.max_time_to_complete@) +(@items.points@ #assessment.points#) + - + + + + + + + +
@items.title;noquote@
Index: openacs-4/packages/assessment/www/admin/catalog-item-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/catalog-item-add.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/catalog-item-add.tcl 9 Dec 2004 11:10:57 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/catalog-item-add.tcl 10 Dec 2004 11:42:23 -0000 1.2 @@ -73,6 +73,14 @@ if {$presentation_type == "fitb"} { regsub -all -line -nocase -- { - select i.as_item_id, cr.title, i.definition - from as_items i, cr_revisions cr - where cr.revision_id = i.as_item_id + select i.as_item_id, cr.title, ci.name, i.required_p, + i.max_time_to_complete, i.points + from as_items i, cr_revisions cr, cr_items ci + where ci.item_id = cr.item_id + and cr.revision_id = i.as_item_id and i.as_item_id in ([join $as_item_id ,]) order by i.as_item_id @@ -48,8 +50,14 @@ - insert into as_item_section_map (as_item_id, section_id, sort_order) - values (:as_item_id, :new_section_id, :after) + insert into as_item_section_map + (as_item_id, section_id, required_p, sort_order, max_time_to_complete, + fixed_position, points) + (select :as_item_id as as_item_id, :new_section_id as section_id, + required_p, :after as sort_order, max_time_to_complete, + 0 as fixed_position, points + from as_items + where as_item_id = :as_item_id) Index: openacs-4/packages/assessment/www/admin/catalog-section-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/catalog-section-add.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/catalog-section-add.adp 9 Dec 2004 11:10:58 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/catalog-section-add.adp 10 Dec 2004 11:42:23 -0000 1.2 @@ -9,8 +9,9 @@ - @@ -19,7 +20,7 @@ -
@sections.rownum@. * +@sections.rownum@. @sections.name@ (#assessment.max_time# @sections.max_time_to_complete@) +(@sections.points@ #assessment.points#)
+
@sections.title@
Index: openacs-4/packages/assessment/www/admin/catalog-section-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/catalog-section-add.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/catalog-section-add.tcl 9 Dec 2004 11:10:58 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/catalog-section-add.tcl 10 Dec 2004 11:42:23 -0000 1.2 @@ -59,6 +59,9 @@ db_multirow sections sections {} { + if {[empty_string_p $points]} { + set points 0 + } if {![empty_string_p $max_time_to_complete]} { set max_min [expr $max_time_to_complete / 60] set max_sec [expr $max_time_to_complete - ($max_min * 60)] Index: openacs-4/packages/assessment/www/admin/catalog-section-add.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/catalog-section-add.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/catalog-section-add.xql 9 Dec 2004 11:10:58 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/catalog-section-add.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -3,10 +3,11 @@ - select s.section_id, cr.title, s.definition, s.instructions, s.required_p, - s.feedback_text, s.max_time_to_complete - from as_sections s, cr_revisions cr - where cr.revision_id = s.section_id + select s.section_id, cr.title, ci.name, s.instructions, + s.feedback_text, s.max_time_to_complete, s.points + from as_sections s, cr_revisions cr, cr_items ci + where ci.item_id = cr.item_id + and cr.revision_id = s.section_id and s.section_id in ([join $section_id ,]) order by s.section_id @@ -26,8 +27,12 @@ - insert into as_assessment_section_map (assessment_id, section_id, feedback_text, max_time_to_complete, sort_order) - values (:new_assessment_rev_id, :section_id, null, null, :after) + insert into as_assessment_section_map + (assessment_id, section_id, sort_order, max_time_to_complete, points) + (select :new_assessment_rev_id as assessment_id, :section_id as section_id, + :after as sort_order, max_time_to_complete, points + from as_sections + where section_id = :section_id) Index: openacs-4/packages/assessment/www/admin/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/index.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/admin/index.xql 14 Nov 2004 16:48:08 -0000 1.2 +++ openacs-4/packages/assessment/www/admin/index.xql 10 Dec 2004 11:42:23 -0000 1.3 @@ -5,9 +5,11 @@ select ci.item_id as assessment_id, cr.title - from cr_items ci, cr_revisions cr, as_assessments a + from cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id + and ci.parent_id = cf.folder_id + and cf.package_id = :package_id order by cr.title Index: openacs-4/packages/assessment/www/admin/item-add-display-cb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-cb.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-add-display-cb.xql 5 Dec 2004 17:14:16 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-add-display-cb.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -27,8 +27,13 @@ insert into as_item_section_map - (as_item_id, section_id, enabled_p, required_p, sort_order) - values (:as_item_id, :new_section_id, 't', 'f', :after) + (as_item_id, section_id, required_p, sort_order, max_time_to_complete, + fixed_position, points) + (select :as_item_id as as_item_id, :new_section_id as section_id, + required_p, :after as sort_order, max_time_to_complete, + 0 as fixed_position, points + from as_items + where as_item_id = :as_item_id) Index: openacs-4/packages/assessment/www/admin/item-add-display-rb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-rb.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-add-display-rb.xql 5 Dec 2004 17:14:16 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-add-display-rb.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -27,8 +27,13 @@ insert into as_item_section_map - (as_item_id, section_id, enabled_p, required_p, sort_order) - values (:as_item_id, :new_section_id, 't', 'f', :after) + (as_item_id, section_id, required_p, sort_order, max_time_to_complete, + fixed_position, points) + (select :as_item_id as as_item_id, :new_section_id as section_id, + required_p, :after as sort_order, max_time_to_complete, + 0 as fixed_position, points + from as_items + where as_item_id = :as_item_id) Index: openacs-4/packages/assessment/www/admin/item-add-display-sa.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-sa.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-add-display-sa.xql 5 Dec 2004 17:14:16 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-add-display-sa.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -27,8 +27,13 @@ insert into as_item_section_map - (as_item_id, section_id, enabled_p, required_p, sort_order) - values (:as_item_id, :new_section_id, 't', 'f', :after) + (as_item_id, section_id, required_p, sort_order, max_time_to_complete, + fixed_position, points) + (select :as_item_id as as_item_id, :new_section_id as section_id, + required_p, :after as sort_order, max_time_to_complete, + 0 as fixed_position, points + from as_items + where as_item_id = :as_item_id) Index: openacs-4/packages/assessment/www/admin/item-add-display-sb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-sb.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-add-display-sb.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-add-display-sb.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -27,8 +27,13 @@ insert into as_item_section_map - (as_item_id, section_id, enabled_p, required_p, sort_order) - values (:as_item_id, :new_section_id, 't', 'f', :after) + (as_item_id, section_id, required_p, sort_order, max_time_to_complete, + fixed_position, points) + (select :as_item_id as as_item_id, :new_section_id as section_id, + required_p, :after as sort_order, max_time_to_complete, + 0 as fixed_position, points + from as_items + where as_item_id = :as_item_id) Index: openacs-4/packages/assessment/www/admin/item-add-display-ta.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-ta.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-add-display-ta.xql 5 Dec 2004 17:14:16 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-add-display-ta.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -27,8 +27,13 @@ insert into as_item_section_map - (as_item_id, section_id, enabled_p, required_p, sort_order) - values (:as_item_id, :new_section_id, 't', 'f', :after) + (as_item_id, section_id, required_p, sort_order, max_time_to_complete, + fixed_position, points) + (select :as_item_id as as_item_id, :new_section_id as section_id, + required_p, :after as sort_order, max_time_to_complete, + 0 as fixed_position, points + from as_items + where as_item_id = :as_item_id) Index: openacs-4/packages/assessment/www/admin/item-add-display-tb.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add-display-tb.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-add-display-tb.xql 5 Dec 2004 17:14:16 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-add-display-tb.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -27,8 +27,13 @@ insert into as_item_section_map - (as_item_id, section_id, enabled_p, required_p, sort_order) - values (:as_item_id, :new_section_id, 't', 'f', :after) + (as_item_id, section_id, required_p, sort_order, max_time_to_complete, + fixed_position, points) + (select :as_item_id as as_item_id, :new_section_id as section_id, + required_p, :after as sort_order, max_time_to_complete, + 0 as fixed_position, points + from as_items + where as_item_id = :as_item_id) Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/item-add-existing-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/item-add-existing-2.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/item-add-existing.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/item-add-existing.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/item-add-existing.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/assessment/www/admin/item-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-add.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/admin/item-add.tcl 8 Dec 2004 15:30:34 -0000 1.2 +++ openacs-4/packages/assessment/www/admin/item-add.tcl 10 Dec 2004 11:42:23 -0000 1.3 @@ -41,6 +41,7 @@ ad_form -name item_add -action item-add -export { assessment_id section_id after } -form { {as_item_id:key} + {name:text {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.item_Name_help]"}} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.item_Title_help]"}} {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}} } @@ -57,35 +58,38 @@ {feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}} {feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_wrong_help]"}} {max_time_to_complete:integer,optional {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.item_time_help]"}} + {points:integer,optional {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} {data_type:text(select) {label "[_ assessment.Data_Type]"} {options $data_types} {help_text "[_ assessment.Data_Type_help]"}} {item_type:text(select) {label "[_ assessment.Item_Type]"} {options $item_types} {help_text "[_ assessment.Item_Type_help]"}} } -new_request { + set name "" set title "" set description "" set subtext "" set field_code "" - set definition "" set required_p t set feedback_right "" set feedback_wrong "" set max_time_to_complete "" + set points "" set data_type "varchar" set item_type "sa" } -on_submit { set category_ids [category::ad_form::get_categories -container_object_id $package_id] } -new_data { db_transaction { set as_item_id [as::item::new \ + -name $name \ -title $title \ -description $description \ -subtext $subtext \ -field_code $field_code \ - -definition $definition \ -required_p $required_p \ -data_type $data_type \ -feedback_right $feedback_right \ -feedback_wrong $feedback_wrong \ - -max_time_to_complete $max_time_to_complete] + -max_time_to_complete $max_time_to_complete \ + -points $points] if {[exists_and_not_null category_ids]} { category::map_object -object_id $as_item_id $category_ids Index: openacs-4/packages/assessment/www/admin/item-copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-copy.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-copy.tcl 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-copy.tcl 10 Dec 2004 11:42:23 -0000 1.2 @@ -32,13 +32,17 @@ {as_item_id:key} {item_title:text(inform) {label "[_ assessment.copy_1]"}} {from:text(inform) {label "[_ assessment.from]"} {value $assessment_data(title)}} + {name:text,optional {label "[_ assessment.Name]"} {help_text "[_ assessment.Name_help]"}} {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} -} -select_query_name {item_title} -on_submit { +} -edit_request { + db_1row item_title {} + set name "" +} -on_submit { if {$confirmation} { db_transaction { set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] set new_section_id [as::section::new_revision -section_id $section_id] - set new_item_id [as::item::copy -as_item_id $as_item_id] + set new_item_id [as::item::copy -as_item_id $as_item_id -name $name] db_dml update_section_in_assessment {} db_dml move_down_items {} Index: openacs-4/packages/assessment/www/admin/item-copy.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-copy.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-copy.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-copy.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -36,10 +36,10 @@ - insert into as_item_section_map + insert into as_item_section_map (as_item_id, section_id, required_p, max_time_to_complete, + sort_order, fixed_position, points) (select :new_item_id as as_item_id, :new_section_id as section_id, - enabled_p, required_p, item_default, content_value, numeric_value, - feedback_text, max_time_to_complete, adp_chunk, :after as sort_order + required_p, max_time_to_complete, :after as sort_order, fixed_position, points from as_item_section_map where as_item_id = :as_item_id and section_id = :section_id) Index: openacs-4/packages/assessment/www/admin/item-edit-general.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit-general.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-edit-general.tcl 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-edit-general.tcl 10 Dec 2004 11:42:23 -0000 1.2 @@ -37,6 +37,7 @@ ad_form -name item_edit_general -action item-edit-general -export { assessment_id section_id } -form { {as_item_id:key} + {name:text(inform) {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.item_Name_help]"}} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.item_Title_help]"}} {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}} } @@ -53,13 +54,13 @@ {feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}} {feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_wrong_help]"}} {max_time_to_complete:integer,optional {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.item_time_help]"}} + {points:integer,optional {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} {data_type_disp:text(inform) {label "[_ assessment.Data_Type]"} {help_text "[_ assessment.Data_Type_help]"}} {data_type:text(hidden)} {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} } -edit_request { db_1row general_item_data {} set data_type_disp "[_ assessment.data_type_$data_type]" - ##set data_type varchar set display_type [string range [db_string get_display_type {}] end-1 end] } -on_submit { set category_ids [category::ad_form::get_categories -container_object_id $package_id] @@ -72,12 +73,12 @@ -description $description \ -subtext $subtext \ -field_code $field_code \ - -definition $definition \ -required_p $required_p \ -data_type $data_type \ -feedback_right $feedback_right \ -feedback_wrong $feedback_wrong \ - -max_time_to_complete $max_time_to_complete] + -max_time_to_complete $max_time_to_complete \ + -points $points] if {[exists_and_not_null category_ids]} { category::map_object -object_id $new_item_id $category_ids Index: openacs-4/packages/assessment/www/admin/item-edit-general.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit-general.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-edit-general.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-edit-general.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -26,10 +26,11 @@ - select r.title, r.description, i.subtext, i.field_code, i.definition, i.required_p, - i.feedback_right, i.feedback_wrong, i.max_time_to_complete, i.data_type - from cr_revisions r, as_items i - where r.revision_id = i.as_item_id + select ci.name, r.title, r.description, i.subtext, i.field_code, i.required_p, + i.feedback_right, i.feedback_wrong, i.max_time_to_complete, i.data_type, i.points + from cr_items ci, cr_revisions r, as_items i + where ci.item_id = r.item_id + and r.revision_id = i.as_item_id and i.as_item_id = :as_item_id Index: openacs-4/packages/assessment/www/admin/item-edit-mc-choices-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit-mc-choices-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-edit-mc-choices-delete.tcl 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,44 @@ +ad_page_contract { + + Deletes a choices of a multiple choice item + + @param choice_id specifies the choice + + @author timo@timohentschel.de + + @cvs-id $Id: item-swap.tcl + +} { + assessment_id:integer,notnull + section_id:integer,notnull + as_item_id:integer,notnull + choice_id:integer,notnull +} + +ad_require_permission $assessment_id admin + +db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id] + set new_item_id [as::item::new_revision -as_item_id $as_item_id] + set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id -with_choices_p f] + db_dml update_section_in_assessment {} + db_dml update_item_in_section {} + db_dml update_item_type_in_item {} + + db_1row get_sort_order_to_be_removed {} + set choices [db_list get_choices {}] + foreach old_choice_id $choices { + if {$old_choice_id != $choice_id} { + set new_choice_id [as::item_choice::new_revision -choice_id $old_choice_id -mc_id $new_mc_id] + } + } + db_dml move_up_choices {} +} on_error { + ad_return_error "Database error" "A database error occured:
$errmsg
" + ad_script_abort +} + +set section_id $new_section_id +set as_item_id $new_item_id +ad_returnredirect [export_vars -base item-edit {assessment_id section_id as_item_id}] Index: openacs-4/packages/assessment/www/admin/item-edit-mc-choices-delete.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit-mc-choices-delete.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-edit-mc-choices-delete.xql 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,69 @@ + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set as_item_id = :new_item_id + where section_id = :new_section_id + and as_item_id = :as_item_id + + + + + + + + update as_item_rels + set target_rev_id = :new_mc_id + where item_rev_id = :new_item_id + and target_rev_id = :mc_id + and rel_type = 'as_item_type_rel' + + + + + + + + select mc_id, sort_order + from as_item_choices + where choice_id = :choice_id + + + + + + + + select choice_id + from as_item_choices + where mc_id = :mc_id + + + + + + + + update as_item_choices + set sort_order = sort_order-1 + where mc_id = :new_mc_id + and sort_order > :sort_order + + + + + Index: openacs-4/packages/assessment/www/admin/item-edit-mc-choices-swap-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit-mc-choices-swap-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-edit-mc-choices-swap-oracle.xql 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,15 @@ + + +oracle8.1.6 + + + +update as_item_choices +set sort_order = (case when sort_order = :sort_order then :next_sort_order when sort_order = :next_sort_order then :sort_order end) +where mc_id = :new_mc_id +and sort_order in (:sort_order, :next_sort_order) + + + + + Index: openacs-4/packages/assessment/www/admin/item-edit-mc-choices-swap-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit-mc-choices-swap-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-edit-mc-choices-swap-postgresql.xql 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,18 @@ + + +postgresql7.1 + + + +update as_item_choices +set sort_order = (case when sort_order = (cast (:sort_order as integer)) then + cast (:next_sort_order as integer) + when +sort_order = (cast (:next_sort_order as integer)) then cast (:sort_order as integer) end) +where mc_id = :new_mc_id +and sort_order in (:sort_order, :next_sort_order) + + + + + Index: openacs-4/packages/assessment/www/admin/item-edit-mc-choices-swap.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit-mc-choices-swap.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-edit-mc-choices-swap.tcl 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,45 @@ +ad_page_contract { + + Swaps two choices of a multiple choice item, sort_order and sort_order - 1. + + @param mc_id specifies the multiple choice item + @param sort_order position of choice to be moved up or down + + @author timo@timohentschel.de + + @cvs-id $Id: item-swap.tcl + +} { + assessment_id:integer,notnull + section_id:integer,notnull + as_item_id:integer,notnull + mc_id:integer,notnull + sort_order:integer,notnull + direction:notnull +} + +ad_require_permission $assessment_id admin + +if { $direction=="up" } { + set next_sort_order [expr { $sort_order - 1 }] +} else { + set next_sort_order [expr { $sort_order + 1 }] +} + +db_transaction { + set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] + set new_section_id [as::section::new_revision -section_id $section_id] + set new_item_id [as::item::new_revision -as_item_id $as_item_id] + set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id] + db_dml update_section_in_assessment {} + db_dml update_item_in_section {} + db_dml update_item_type_in_item {} + db_dml swap_choices {} +} on_error { + ad_return_error "Database error" "A database error occured:
$errmsg
" + ad_script_abort +} + +set section_id $new_section_id +set as_item_id $new_item_id +ad_returnredirect [export_vars -base item-edit {assessment_id section_id as_item_id}] Index: openacs-4/packages/assessment/www/admin/item-edit-mc-choices-swap.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit-mc-choices-swap.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/item-edit-mc-choices-swap.xql 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,38 @@ + + + + + + + update as_assessment_section_map + set section_id = :new_section_id + where assessment_id = :new_assessment_rev_id + and section_id = :section_id + + + + + + + + update as_item_section_map + set as_item_id = :new_item_id + where section_id = :new_section_id + and as_item_id = :as_item_id + + + + + + + + update as_item_rels + set target_rev_id = :new_mc_id + where item_rev_id = :new_item_id + and target_rev_id = :mc_id + and rel_type = 'as_item_type_rel' + + + + + Index: openacs-4/packages/assessment/www/admin/item-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-edit.tcl 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-edit.tcl 10 Dec 2004 11:42:23 -0000 1.2 @@ -33,6 +33,7 @@ ad_form -name item_edit -mode display -action item-edit-general -export { assessment_id section_id as_item_id } -form { + {name:text {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {value $name} {help_text "[_ assessment.item_Name_help]"}} {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {value $title} {help_text "[_ assessment.item_Title_help]"}} {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {value $description} {help_text "[_ assessment.item_Description_help]"}} } @@ -44,11 +45,11 @@ ad_form -extend -name item_edit -form { {subtext:text,optional {label "[_ assessment.Subtext]"} {html {size 80 maxlength 500}} {value $subtext} {help_text "[_ assessment.item_Subtext_help]"}} {field_code:text,optional {label "[_ assessment.Field_Code]"} {html {size 80 maxlength 500}} {value $field_code} {help_text "[_ assessment.Field_Code_help]"}} - {definition:text(textarea),optional {label "[_ assessment.Definition]"} {html {rows 5 cols 80}} {value $definition} {help_text "[_ assessment.item_Definition_help]"}} {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {value $required_p} {help_text "[_ assessment.item_Required_help]"}} {feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {value $feedback_right} {help_text "[_ assessment.Feedback_right_help]"}} {feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {value $feedback_wrong} {help_text "[_ assessment.Feedback_wrong_help]"}} {max_time_to_complete:integer,optional {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {value $max_time_to_complete} {help_text "[_ assessment.item_time_help]"}} + {points:integer,optional {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {value $points} {help_text "[_ assessment.points_item_help]"}} {data_type:text {label "[_ assessment.Data_Type]"} {html {size 20 maxlength 20}} {value "[_ assessment.data_type_$data_type]"} {help_text "[_ assessment.Data_Type_help]"}} {display_type:text {label "[_ assessment.Display_Type]"} {value "[_ assessment.item_display_$display_type]"} {help_text "[_ assessment.Display_Type_help]"}} } Index: openacs-4/packages/assessment/www/admin/item-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/item-edit.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/item-edit.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/item-edit.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -4,10 +4,11 @@ - select r.title, r.description, i.subtext, i.field_code, i.definition, i.required_p, - i.feedback_right, i.feedback_wrong, i.max_time_to_complete, i.data_type - from cr_revisions r, as_items i - where r.revision_id = i.as_item_id + select ci.name, r.title, r.description, i.subtext, i.field_code, i.required_p, + i.feedback_right, i.feedback_wrong, i.max_time_to_complete, i.data_type, i.points + from cr_items ci, cr_revisions r, as_items i + where ci.item_id = r.item_id + and r.revision_id = i.as_item_id and i.as_item_id = :as_item_id Index: openacs-4/packages/assessment/www/admin/one-a.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/one-a.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/www/admin/one-a.adp 9 Dec 2004 11:10:58 -0000 1.4 +++ openacs-4/packages/assessment/www/admin/one-a.adp 10 Dec 2004 11:42:23 -0000 1.5 @@ -91,16 +91,21 @@ - + + Index: openacs-4/packages/assessment/www/admin/one-a.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/one-a.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/admin/one-a.tcl 9 Dec 2004 11:10:58 -0000 1.3 +++ openacs-4/packages/assessment/www/admin/one-a.tcl 10 Dec 2004 11:42:23 -0000 1.4 @@ -45,6 +45,9 @@ ] db_multirow sections assessment_sections {} { + if {[empty_string_p $points]} { + set points 0 + } if {![empty_string_p $max_time_to_complete]} { set max_min [expr $max_time_to_complete / 60] set max_sec [expr $max_time_to_complete - ($max_min * 60)] Index: openacs-4/packages/assessment/www/admin/one-a.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/one-a.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/one-a.xql 14 Nov 2004 16:43:21 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/one-a.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -3,10 +3,11 @@ - select s.section_id, cr.title, s.definition, s.instructions, s.required_p, - s.feedback_text, s.max_time_to_complete, asm.sort_order - from as_sections s, cr_revisions cr, as_assessment_section_map asm - where cr.revision_id = s.section_id + select s.section_id, cr.title, ci.name, s.instructions, s.feedback_text, + asm.max_time_to_complete, asm.sort_order, asm.points, s.display_type_id + from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm + where ci.item_id = cr.item_id + and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id = :assessment_rev_id order by asm.sort_order Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/section-add-existing-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/section-add-existing-2.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/section-add-existing.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/section-add-existing.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/admin/section-add-existing.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/assessment/www/admin/section-copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/section-copy.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/section-copy.tcl 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/section-copy.tcl 10 Dec 2004 11:42:23 -0000 1.2 @@ -31,13 +31,16 @@ {section_id:key} {section_title:text(inform) {label "[_ assessment.copy_1]"}} {from:text(inform) {label "[_ assessment.from]"} {value $assessment_data(title)}} + {name:text,optional {label "[_ assessment.Name]"} {help_text "[_ assessment.Name_help]"}} {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} -} -select_query_name {section_title} \ --on_submit { +} -edit_request { + db_1row section_title {} + set name "" +} -on_submit { if {$confirmation} { db_transaction { set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] - set new_section_id [as::section::copy -section_id $section_id] + set new_section_id [as::section::copy -section_id $section_id -name $name] db_dml move_down_sections {} set sort_order [expr $after + 1] Index: openacs-4/packages/assessment/www/admin/section-copy.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/section-copy.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/section-copy.xql 8 Dec 2004 15:30:34 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/section-copy.xql 10 Dec 2004 11:42:23 -0000 1.2 @@ -25,9 +25,9 @@ - insert into as_assessment_section_map (assessment_id, section_id, feedback_text, max_time_to_complete, sort_order) + insert into as_assessment_section_map (assessment_id, section_id, max_time_to_complete, sort_order, points) (select :new_assessment_rev_id as assessment_id, :new_section_id as section_id, - feedback_text, max_time_to_complete, :sort_order as sort_order + max_time_to_complete, :sort_order as sort_order, points from as_assessment_section_map where assessment_id = :new_assessment_rev_id and section_id = :section_id) Index: openacs-4/packages/assessment/www/admin/section-display-form.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/section-display-form.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/section-display-form.adp 10 Dec 2004 11:42:23 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +
+ +
Index: openacs-4/packages/assessment/www/admin/section-display-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/section-display-form.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/section-display-form.tcl 10 Dec 2004 11:42:24 -0000 1.1 @@ -0,0 +1,99 @@ +ad_page_contract { + Form to add/edit a section display type. + + @author Timo Hentschel (timo@timohentschel.de) + @cvs-id $Id: +} { + assessment_id:integer + section_id:integer,optional + display_type_id:integer,optional +} -properties { + context_bar:onevalue + page_title:onevalue +} + +ad_require_permission $assessment_id admin + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +if {[info exists display_type_id]} { + set page_title [_ assessment.edit_section_display] +} else { + set page_title [_ assessment.add_new_section_display] +} + +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title] +set package_id [ad_conn package_id] + +set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] + +set order_types [list] +foreach one_order_type [list alphabetical randomized order_of_entry] { + lappend order_types [list "[_ assessment.$one_order_type]" $one_order_type] +} + + +ad_form -name section_display_form -action section-display-form -export { assessment_id section_id } -form { + {display_type_id:key} + {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.sect_disp_Title_help]"}} + {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.sect_disp_Description_help]"}} + {num_items:integer,optional {label "[_ assessment.section_num_Items]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.sect_num_items_help]"}} + {adp_chunk:text(textarea),optional {label "[_ assessment.Section_Template]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_template_help]"}} + {branched_p:text(select) {label "[_ assessment.section_Branched]"} {options $boolean_options} {help_text "[_ assessment.section_branched_help]"}} + {back_button_p:text(select) {label "[_ assessment.Back_Button]"} {options $boolean_options} {help_text "[_ assessment.back_button_help]"}} + {submit_answer_p:text(select) {label "[_ assessment.Submit_Answer]"} {options $boolean_options} {help_text "[_ assessment.submit_answer_help]"}} + {sort_order_type:text(select) {label "[_ assessment.Section_Order]"} {options $order_types} {help_text "[_ assessment.section_order_help]"}} +} -new_request { + set title "" + set description "" + set num_items "" + set adp_chunk "" + set branched_p f + set back_button_p t + set submit_answer_p f + set sort_order_type order_of_entry +} -edit_request { + db_1row section_display_data {} +} -new_data { + db_transaction { + set display_id [as::section_display::new \ + -title $title \ + -description $description \ + -num_items $num_items \ + -adp_chunk $adp_chunk \ + -branched_p $branched_p \ + -back_button_p $back_button_p \ + -submit_answer_p $submit_answer_p \ + -sort_order_type $sort_order_type] + + # now update section and map display type + db_dml add_display_to_section {} + } +} -edit_data { + db_transaction { + set display_id [as::section_display::edit \ + -display_type_id $display_type_id \ + -title $title \ + -description $description \ + -num_items $num_items \ + -adp_chunk $adp_chunk \ + -branched_p $branched_p \ + -back_button_p $back_button_p \ + -submit_answer_p $submit_answer_p \ + -sort_order_type $sort_order_type] + + # now update section and map display type + db_dml add_display_to_section {} + } +} -after_submit { + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/admin/section-display-form.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/section-display-form.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/admin/section-display-form.xql 10 Dec 2004 11:42:24 -0000 1.1 @@ -0,0 +1,26 @@ + + + + + + + select cr.title, cr.description, d.num_items, d.adp_chunk, d.branched_p, + d.back_button_p, d.submit_answer_p, d.sort_order_type + from as_section_display_types d, cr_revisions cr + where cr.revision_id = d.display_type_id + and d.display_type_id = :display_type_id + + + + + + + + update as_sections + set display_type_id = :display_id + where section_id = :section_id + + + + + Index: openacs-4/packages/assessment/www/admin/section-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/section-form.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/admin/section-form.tcl 5 Dec 2004 17:15:23 -0000 1.3 +++ openacs-4/packages/assessment/www/admin/section-form.tcl 10 Dec 2004 11:42:24 -0000 1.4 @@ -34,13 +34,24 @@ set package_id [ad_conn package_id] set display_types [db_list_of_lists section_display_types {}] -set display_types [concat [list [list "" ""]] $display_types] +set display_types [concat [list [list "[_ assessment.section_new_display]" ""]] $display_types] -set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]] - ad_form -name section_form -action section-form -export { assessment_id after } -form { {section_id:key} +} + +if {[info exists section_id]} { + ad_form -extend -name section_form -form { + {name:text(inform) {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Name_help]"}} + } +} else { + ad_form -extend -name section_form -form { + {name:text {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Name_help]"}} + } +} + +ad_form -extend -name section_form -form { {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Title_help]"}} {description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Description_help]"}} } @@ -50,21 +61,20 @@ } ad_form -extend -name section_form -form { - {definition:text(textarea),optional {label "[_ assessment.Definition]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Definition_help]"}} {instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Instructions_help]"}} {feedback_text:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Feedback_help]"}} {max_time_to_complete:integer,optional {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.section_time_help]"}} - {section_display_type_id:text(select),optional {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.section_Display_Type_help]"}} - {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.section_Required_help]"}} + {points:integer,optional {label "[_ assessment.points_section]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} + {display_type_id:text(select),optional {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.section_Display_Type_help]"}} } -new_request { + set name "" set title "" set description "" - set definition "" set instructions "" set feedback_text "" set max_time_to_complete "" - set section_display_type_id "" - set required_p t + set points "" + set display_type_id "" } -edit_request { db_1row section_data {} } -on_submit { @@ -74,14 +84,14 @@ set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] set section_id [as::section::new \ + -name $name \ -title $title \ -description $description \ - -definition $definition \ -instructions $instructions \ -feedback_text $feedback_text \ -max_time_to_complete $max_time_to_complete \ - -required_p $required_p \ - -section_display_type_id $section_display_type_id] + -points $points_p \ + -display_type_id $display_type_id] db_dml move_down_sections {} set sort_order [expr $after + 1] @@ -99,12 +109,11 @@ -section_id $section_id \ -title $title \ -description $description \ - -definition $definition \ -instructions $instructions \ -feedback_text $feedback_text \ -max_time_to_complete $max_time_to_complete \ - -required_p $required_p \ - -section_display_type_id $section_display_type_id] + -points $points \ + -display_type_id $display_type_id] db_dml update_section_of_assessment {} @@ -113,8 +122,14 @@ } } } -after_submit { - ad_returnredirect [export_vars -base one-a {assessment_id}] - ad_script_abort + if {[empty_string_p $display_type_id]} { + set section_id $new_section_id + ad_returnredirect [export_vars -base section-display-form {assessment_id section_id}] + ad_script_abort + } else { + ad_returnredirect [export_vars -base one-a {assessment_id}] + ad_script_abort + } } ad_return_template Index: openacs-4/packages/assessment/www/admin/section-form.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/section-form.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/admin/section-form.xql 14 Nov 2004 16:43:21 -0000 1.1 +++ openacs-4/packages/assessment/www/admin/section-form.xql 10 Dec 2004 11:42:24 -0000 1.2 @@ -4,17 +4,21 @@ - select section_display_type_id, pagination_style - from as_section_display_types + select cr.title, d.display_type_id + from as_section_display_types d, cr_revisions cr, cr_items ci, cr_folders cf + where cr.revision_id = d.display_type_id + and ci.latest_revision = cr.revision_id + and cf.folder_id = ci.parent_id + and cf.package_id = :package_id - select ci.name, cr.title, cr.description, s.definition, s.instructions, - s.required_p, s.feedback_text, s.max_time_to_complete + select ci.name, cr.title, cr.description, s.instructions, s.display_type_id, + s.feedback_text, s.max_time_to_complete, s.points from as_sections s, cr_revisions cr, cr_items ci where cr.revision_id = s.section_id and ci.item_id = cr.item_id @@ -37,8 +41,8 @@ - insert into as_assessment_section_map (assessment_id, section_id, feedback_text, max_time_to_complete, sort_order) - values (:new_assessment_rev_id, :section_id, :feedback_text, :max_time_to_complete, :sort_order) + insert into as_assessment_section_map (assessment_id, section_id, max_time_to_complete, sort_order, points) + values (:new_assessment_rev_id, :new_section_id, :max_time_to_complete, :sort_order, :points) @@ -47,9 +51,9 @@ update as_assessment_section_map - set feedback_text = :feedback_text, - max_time_to_complete = :max_time_to_complete, - section_id = :new_section_id + set max_time_to_complete = :max_time_to_complete, + points = :points, + section_id = :new_section_id where assessment_id = :new_assessment_rev_id and section_id = :section_id
@sections.rownum@. * @sections.rownum@. @sections.name@
#assessment.Edit# #assessment.Copy# #assessment.add_new_section# -#assessment.Search_Section# +#assessment.Search_Section# +#assessment.edit_section_display# + + + #assessment.Move_Down# @@ -110,6 +115,7 @@ #assessment.remove_section# (#assessment.max_time# @sections.max_time_to_complete@) +(@sections.points@ #assessment.points#)