Index: openacs-4/packages/assessment/assessment.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v diff -u -r1.30 -r1.31 --- openacs-4/packages/assessment/assessment.info 15 Feb 2005 15:03:10 -0000 1.30 +++ openacs-4/packages/assessment/assessment.info 21 Feb 2005 14:32:54 -0000 1.31 @@ -7,7 +7,7 @@ f f - + Eduardo Perez Ureta Assessment package that will replace the survey, quizz, complex survey, poll and other data collection packages @@ -17,7 +17,7 @@ Create assessments and evalueate. 0 - + 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.36 -r1.37 --- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 11 Feb 2005 23:20:48 -0000 1.36 +++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 21 Feb 2005 14:32:54 -0000 1.37 @@ -102,6 +102,7 @@ Title Only %number_tries% tries allowed. You have to wait %pretty_wait_time% before your next try. + Wrong password. At the end of this assessment Attempt Author @@ -154,6 +155,7 @@ Question Identifier Question Text CSV file + Currently: Data Type Boolean File @@ -323,8 +325,12 @@ Numerical , on %creation_date% One Assessment: %assessment_data.title% + At least one correct choice required Only correct Responses Only incorrect Responses + Keywords + Keywords used for automatic grading + Reference Answer OR Order of Entry Order Type @@ -336,14 +342,19 @@ Type VarName Parameters + Password + Enter assessment password Percent Score Percentage of the points of the question this choice gives. May be larger than 100 and lower than -100. Performed Permissions points + Points for Answer + How many points is this question answer worth. Points for Question How many points is this question worth in a section. This is a measurement for relative difficulty. Points for Section + How many points is this section worth in an assessment. This is a measurement for relative difficulty. Post Check Preview Query @@ -368,6 +379,9 @@ Response Options: Response Submitted Assessment results by user + (on %results.date% by <a href="%results.user_url%">%results.first_names% %results.last_name%</a>) + Edit assessment result + Change explanation Return Return URL Old responses displayed @@ -461,6 +475,7 @@ Unsubscribe Unsubscribe user to this rule" Upload files + User Answer User Users may edit their responses Users may not edit their responses Index: openacs-4/packages/assessment/lib/actions-results.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/actions-results.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/actions-results.adp 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,7 @@ +

Actions Performed:

+ + @actions.user_message@ + + @actions.error_txt@ + + \ No newline at end of file Index: openacs-4/packages/assessment/lib/actions-results.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/actions-results.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/actions-results.tcl 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1 @@ +db_multirow actions get_actions {} Index: openacs-4/packages/assessment/lib/actions-results.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/actions-results.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/actions-results.xql 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,16 @@ + + + + + + + select * + from as_actions_log al, as_action_map am, as_actions a + where al.session_id=:session_id + and al.inter_item_check_id=am.inter_item_check_id + and am.action_id=a.action_id + + + + + Index: openacs-4/packages/assessment/lib/item-show-oq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-oq.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/lib/item-show-oq.tcl 8 Dec 2004 15:30:32 -0000 1.1 +++ openacs-4/packages/assessment/lib/item-show-oq.tcl 21 Feb 2005 14:32:55 -0000 1.2 @@ -2,9 +2,12 @@ # author Timo Hentschel (timo@timohentschel.de) db_1row item_type_data {} +set keywords [join $keywords "\n"] ad_form -name item_show_oq -mode display -action item-edit-oq -export { assessment_id section_id as_item_id } -form { {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {value $title} {help_text "[_ assessment.oq_Title_help]"}} {default_value:text(textarea),optional {label "[_ assessment.Default_Value]"} {html {rows 5 cols 80}} {value $default_value} {help_text "[_ assessment.Deafult_Value_help]"}} {feedback:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {value $feedback_text} {help_text "[_ assessment.Feedback_help]"}} + {reference_answer:text(textarea),optional {label "[_ assessment.oq_Reference_Answer]"} {html {rows 5 cols 80}} {value $reference_answer} {help_text "[_ assessment.oq_Reference_Answer_help]"}} + {keywords:text(textarea),optional {label "[_ assessment.oq_Keywords]"} {html {rows 5 cols 80}} {value $keywords} {help_text "[_ assessment.oq_Keywords_help]"}} } Index: openacs-4/packages/assessment/lib/item-show-oq.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/item-show-oq.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/lib/item-show-oq.xql 8 Dec 2004 15:30:32 -0000 1.1 +++ openacs-4/packages/assessment/lib/item-show-oq.xql 21 Feb 2005 14:32:55 -0000 1.2 @@ -4,7 +4,8 @@ - select c.title, t.default_value, t.feedback_text + select c.title, t.default_value, t.feedback_text, t.reference_answer, + t.keywords from as_item_type_oq t, cr_revisions c, as_item_rels r where t.as_item_type_id = r.target_rev_id and r.item_rev_id = :as_item_id Index: openacs-4/packages/assessment/lib/results-edit-mc.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-mc.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-mc.adp 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,27 @@ + + + + +
#assessment.User_Answer#  #assessment.oq_Reference_Answer#
+ + + + @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+
+ + + +
+
  + + + + @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+
+ + + +
+
Index: openacs-4/packages/assessment/lib/results-edit-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-mc.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-mc.tcl 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,23 @@ +# Display multiple choice type data. +# author Timo Hentschel (timo@timohentschel.de) + +db_1row item_type_data {} + +# user answer +ad_form -name results_edit_mc_user -mode display -form { + {item_data_id:text(hidden) {value $item_data_id}} +} + +set user_answer [as::item_data::get -subject_id $subject_id -as_item_id $as_item_id -session_id $session_id] + +set presentation_type [as::item_form::add_item_to_form -name results_edit_mc_user -section_id $section_id -item_id $as_item_id -session_id $session_id -default_value $user_answer -show_feedback all] + +# reference answer +ad_form -name results_edit_mc_reference -mode display -form { + {item_data_id:text(hidden) {value $item_data_id}} +} + +array set reference_answer $user_answer +set reference_answer(choice_answer) [db_list reference_answer {}] + +set presentation_type [as::item_form::add_item_to_form -name results_edit_mc_reference -section_id $section_id -item_id $as_item_id -session_id $session_id -default_value [array get reference_answer] -show_feedback correct] Index: openacs-4/packages/assessment/lib/results-edit-mc.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-mc.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-mc.xql 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,28 @@ + + + + + + + select d.subject_id, d.session_id, d.section_id, d.as_item_id + from as_item_data d + where d.item_data_id = :item_data_id + + + + + + + + select c.choice_id + from as_item_choices c, as_item_rels r, as_item_data d + where d.item_data_id = :item_data_id + and c.mc_id = r.target_rev_id + and r.item_rev_id = d.as_item_id + and r.rel_type = 'as_item_type_rel' + and c.correct_answer_p = 't' + + + + + Index: openacs-4/packages/assessment/lib/results-edit-oq.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-oq.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-oq.adp 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,8 @@ + + + + + +
#assessment.User_Answer#  #assessment.oq_Reference_Answer#
@answer_text;noquote@ @reference_answer@
+

#assessment.oq_Keywords#: +

@keywords@
Index: openacs-4/packages/assessment/lib/results-edit-oq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-oq.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-oq.tcl 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,10 @@ +# Display open question type data. +# author Timo Hentschel (timo@timohentschel.de) + +db_1row item_type_data {} +set keywords [ad_quotehtml [join $keywords "\n"]] +set answer_text [ad_text_to_html -no_links -- $answer_text] + +foreach keyword $keywords { + regsub -all $keyword $answer_text "$keyword" answer_text +} Index: openacs-4/packages/assessment/lib/results-edit-oq.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-oq.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-oq.xql 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,17 @@ + + + + + + + select d.clob_answer as answer_text, t.reference_answer, t.keywords + from as_item_type_oq t, as_item_rels r, as_item_data d + where d.item_data_id = :item_data_id + and t.as_item_type_id = r.target_rev_id + and r.item_rev_id = d.as_item_id + and r.rel_type = 'as_item_type_rel' + + + + + Index: openacs-4/packages/assessment/lib/results-edit-sa.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-sa.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-sa.adp 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,2 @@ +#assessment.User_Answer# +
@answer_text@

Index: openacs-4/packages/assessment/lib/results-edit-sa.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-sa.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-sa.tcl 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,4 @@ +# Display short answer type data. +# author Timo Hentschel (timo@timohentschel.de) + +db_1row item_type_data {} Index: openacs-4/packages/assessment/lib/results-edit-sa.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-edit-sa.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-edit-sa.xql 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,14 @@ + + + + + + + select d.text_answer as answer_text + from as_item_data d + where d.item_data_id = :item_data_id + + + + + Index: openacs-4/packages/assessment/lib/results-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-messages.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-messages.adp 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,9 @@ + +

    + +
  • @results.title@
    + @results.description@
    + @results.points@ #assessment.points# #assessment.Results_change_display#
  • +
    +

+ Index: openacs-4/packages/assessment/lib/results-messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-messages.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-messages.tcl 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,9 @@ +# Display all change messages for result points +# author Timo Hentschel (timo@timohentschel.de) + +set format "[lc_get formbuilder_date_format], [lc_get formbuilder_time_format]" + +db_multirow -extend {user_url} results result_changes { +} { + set user_url [acs_community_member_url -user_id $creation_user] +} Index: openacs-4/packages/assessment/lib/results-messages.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/results-messages.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/lib/results-messages.xql 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,26 @@ + + + + + + + select cr.title, cr.description, sr.points, p.first_names, p.last_name, + to_char(o.creation_date, :format) as date, o.creation_user + from as_session_results sr, cr_revisions cr, acs_objects o, persons p, + as_item_data d, as_session_item_map m + where cr.revision_id = sr.result_id + and o.object_id = cr.revision_id + and cr.description is not null + and p.person_id = o.creation_user + and sr.target_id = d.item_data_id + and d.session_id = :session_id + and d.section_id = :section_id + and d.as_item_id = :as_item_id + and m.item_data_id = d.item_data_id + and m.session_id = d.session_id + order by o.creation_date + + + + + Index: openacs-4/packages/assessment/lib/session-items.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-items.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/lib/session-items.adp 1 Feb 2005 14:18:09 -0000 1.3 +++ openacs-4/packages/assessment/lib/session-items.adp 21 Feb 2005 14:32:55 -0000 1.4 @@ -24,13 +24,15 @@ - + @items.result_points@ / @items.points@ #assessment.points#: @items.feedback;noquote@ - #assessment.not_yet_reviewed# - #assessment.not_answered# + #assessment.not_yet_reviewed# + #assessment.not_answered# + #assessment.Edit# + Index: openacs-4/packages/assessment/lib/session-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-items.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/lib/session-items.tcl 1 Feb 2005 14:18:09 -0000 1.3 +++ openacs-4/packages/assessment/lib/session-items.tcl 21 Feb 2005 14:32:55 -0000 1.4 @@ -1,3 +1,7 @@ +if {![exists_and_not_null edit_p]} { + set edit_p 0 +} + ad_form -name session_results_$section_id -mode display -form { {section_id:text(hidden) {value $section_id}} } @@ -33,6 +37,3 @@ set answered_p f } } -db_1row assessment_id_section {} -# Get the assessment data -as::assessment::data -assessment_id $assessment_id Index: openacs-4/packages/assessment/lib/session-items.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/lib/session-items.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/lib/session-items.xql 1 Feb 2005 14:18:09 -0000 1.3 +++ openacs-4/packages/assessment/lib/session-items.xql 21 Feb 2005 14:32:55 -0000 1.4 @@ -21,17 +21,4 @@
- - - select cr.item_id as assessment_id - from as_assessments a, cr_revisions cr, cr_items ci - where a.assessment_id = cr.revision_id - and cr.revision_id = ci.latest_revision - and exists (select 1 - from as_assessment_section_map asm - where asm.assessment_id = a.assessment_id - and asm.section_id = :section_id) - - - Index: openacs-4/packages/assessment/sql/oracle/assessment-collected-data-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-collected-data-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/sql/oracle/assessment-collected-data-create.sql 30 Jan 2005 14:16:14 -0000 1.3 +++ openacs-4/packages/assessment/sql/oracle/assessment-collected-data-create.sql 21 Feb 2005 14:32:55 -0000 1.4 @@ -126,6 +126,20 @@ create index as_item_data_pk3 on as_item_data (as_item_id, section_id, session_id); create index as_item_data_subj_idx on as_item_data (subject_id); +create table as_session_results ( + result_id integer + constraint as_sess_res_res_id_pk + primary key + constraint as_sess_res_res_id_fk + references cr_revisions(revision_id), + target_id integer + constraint as_sess_res_tgt_id_fk + references cr_revisions(revision_id), + points integer +); + +create index as_sess_res_tgt_idx on as_session_results (target_id); + -- here the selected choices are stored create table as_item_data_choices ( item_data_id integer Index: openacs-4/packages/assessment/sql/oracle/assessment-item-type-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-item-type-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/sql/oracle/assessment-item-type-create.sql 8 Dec 2004 15:30:33 -0000 1.3 +++ openacs-4/packages/assessment/sql/oracle/assessment-item-type-create.sql 21 Feb 2005 14:32:55 -0000 1.4 @@ -36,7 +36,11 @@ -- the content of this field will be prefilled in the response of the user taking the survey default_value varchar(500), -- the person correcting the answers will see the contents of this box as correct answer for comparison with the user response - feedback_text varchar(500) + feedback_text varchar(500), + -- reference text with the expected perfect answer + reference_answer clob, + -- keyword list for automatic pre-grading + keywords varchar(4000) ); -- Radiobutton display type @@ -110,7 +114,7 @@ -- an abstraction of the real size value in "small","medium","large" abs_size varchar(10), -- the orientation between the "question part" of the Item (the title/subtext) and the "answer part" (beside-left, beside-right, bellow, above) - item_answer_alignment varchar(10) + item_answer_alignment varchar(20) ); -- ShortAnswer Display Type: multiple textboxes in one item. Index: openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql 30 Jan 2005 14:16:14 -0000 1.4 +++ openacs-4/packages/assessment/sql/oracle/assessment-section-create.sql 21 Feb 2005 14:32:55 -0000 1.5 @@ -105,6 +105,8 @@ time_for_response integer, -- ip mask for restricted access ip_mask varchar(100), + -- password for restricted access + password varchar(100), -- the feedback type which will be displayed to the respondee (all, none, correct, incorrect) show_feedback varchar(50) default 'all' constraint as_assessments_feedback_ck Index: openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.10d8-0.10d9.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.10d8-0.10d9.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.10d8-0.10d9.sql 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,37 @@ +create table as_session_results ( + result_id integer + constraint as_sess_res_res_id_pk + primary key + constraint as_sess_res_res_id_fk + references cr_revisions(revision_id), + target_id integer + constraint as_sess_res_tgt_id_fk + references cr_revisions(revision_id), + points integer +); + +create index as_sess_res_tgt_idx on as_session_results (target_id); + +alter table as_item_type_oq add ( + -- reference text with the expected perfect answer + reference_answer clob, + -- keyword list for automatic pre-grading + keywords varchar(4000) +); + +alter table as_assessments add ( + password varchar(100) +); + +alter table as_item_display_tb add (alignment_help varchar(20)); +update as_item_display_tb set alignment_help = item_answer_alignment; +alter table as_item_display_tb drop column item_answer_alignment cascade constraints; +alter table as_item_display_tb add (item_answer_alignment varchar(20)); +update as_item_display_tb set item_answer_alignment = alignment_help; +alter table as_item_display_tb drop column alignment_help; + +begin + content_type.refresh_view('as_item_display_tb'); +end; +/ +show errors; Index: openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql 23 Jan 2005 18:10:48 -0000 1.8 +++ openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql 21 Feb 2005 14:32:55 -0000 1.9 @@ -124,6 +124,20 @@ create index as_item_data_pk3 on as_item_data (as_item_id, section_id, session_id); create index as_item_data_subject_id_idx on as_item_data (subject_id); +create table as_session_results ( + result_id integer + constraint as_session_results_result_id_pk + primary key + constraint as_session_results_result_id_fk + references cr_revisions(revision_id), + target_id integer + constraint as_session_results_target_id_fk + references cr_revisions(revision_id), + points integer +); + +create index as_session_results_target_idx on as_session_results (target_id); + -- here the selected choices are stored create table as_item_data_choices ( item_data_id integer Index: openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql 8 Dec 2004 15:30:33 -0000 1.8 +++ openacs-4/packages/assessment/sql/postgresql/assessment-item-type-create.sql 21 Feb 2005 14:32:55 -0000 1.9 @@ -36,7 +36,11 @@ -- the content of this field will be prefilled in the response of the user taking the survey default_value varchar(500), -- the person correcting the answers will see the contents of this box as correct answer for comparison with the user response - feedback_text varchar(500) + feedback_text varchar(500), + -- reference text with the expected perfect answer + reference_answer text, + -- keyword list for automatic pre-grading + keywords varchar(4000) ); -- Radiobutton display type 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.15 -r1.16 --- openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 23 Jan 2005 18:10:48 -0000 1.15 +++ openacs-4/packages/assessment/sql/postgresql/assessment-section-create.sql 21 Feb 2005 14:32:55 -0000 1.16 @@ -105,6 +105,8 @@ time_for_response integer, -- ip mask for restricted access ip_mask varchar(100), + -- password for restricted access + password varchar(100), -- the feedback type which will be displayed to the respondee (all, none, correct, incorrect) show_feedback varchar(50) default 'all' constraint as_assessments_show_feedback_ck Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.10d8-0.10d9.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.10d8-0.10d9.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.10d8-0.10d9.sql 21 Feb 2005 14:32:55 -0000 1.1 @@ -0,0 +1,18 @@ +create table as_session_results ( + result_id integer + constraint as_session_results_result_id_pk + primary key + constraint as_session_results_result_id_fk + references cr_revisions(revision_id), + target_id integer + constraint as_session_results_target_id_fk + references cr_revisions(revision_id), + points integer +); + +create index as_session_results_target_idx on as_session_results (target_id); + +alter table as_item_type_oq add column reference_answer text; +alter table as_item_type_oq add column keywords varchar(4000); + +alter table as_assessments add column password varchar(100); Index: openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql 23 Jan 2005 18:10:48 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-assessment-procs-oracle.xql 21 Feb 2005 14:32:56 -0000 1.6 @@ -7,7 +7,7 @@ select a.assessment_id as assessment_rev_id, cr.item_id as assessment_id, cr.title, ci.name, cr.description, o.creation_user, o.creation_date, a.instructions, a.run_mode, - a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, + a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, a.password, a.show_item_name_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, a.start_time, a.end_time, a.number_tries, a.wait_between_tries, a.time_for_response, a.show_feedback, a.section_navigation, a.creator_id, a.survey_p @@ -38,7 +38,7 @@ - select a.number_tries, a.wait_between_tries, a.ip_mask, + select a.number_tries, a.wait_between_tries, a.ip_mask, a.password as as_password, to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time, to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') as cur_time Index: openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql 23 Jan 2005 18:10:48 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-assessment-procs-postgresql.xql 21 Feb 2005 14:32:56 -0000 1.6 @@ -7,7 +7,7 @@ select a.assessment_id as assessment_rev_id, cr.item_id as assessment_id, cr.title, ci.name, cr.description, o.creation_user, o.creation_date, a.instructions, a.run_mode, - a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, + a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.ip_mask, a.password, a.show_item_name_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, a.start_time, a.end_time, a.number_tries, a.wait_between_tries, a.time_for_response, a.show_feedback, a.section_navigation, a.creator_id, a.survey_p @@ -38,7 +38,7 @@ - select a.number_tries, a.wait_between_tries, a.ip_mask, + select a.number_tries, a.wait_between_tries, a.ip_mask, a.password as as_password, to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time, to_char(now(), 'YYYY-MM-DD HH24:MI:SS') as cur_time Index: openacs-4/packages/assessment/tcl/as-assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 26 Jan 2005 11:06:45 -0000 1.18 +++ openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 21 Feb 2005 14:32:56 -0000 1.19 @@ -27,6 +27,7 @@ {-wait_between_tries ""} {-time_for_response ""} {-ip_mask ""} + {-password ""} {-show_feedback ""} {-section_navigation ""} {-survey_p ""} @@ -69,6 +70,7 @@ [list wait_between_tries $wait_between_tries] \ [list time_for_response $time_for_response] \ [list ip_mask $ip_mask] \ + [list password $password] \ [list show_feedback $show_feedback] \ [list section_navigation $section_navigation] \ [list survey_p $survey_p]] ] @@ -98,6 +100,7 @@ {-wait_between_tries ""} {-time_for_response ""} {-ip_mask ""} + {-password ""} {-show_feedback ""} {-section_navigation ""} } { @@ -132,6 +135,7 @@ [list wait_between_tries $wait_between_tries] \ [list time_for_response $time_for_response] \ [list ip_mask $ip_mask] \ + [list password $password] \ [list show_feedback $show_feedback] \ [list section_navigation $section_navigation] ] ] @@ -203,6 +207,7 @@ [list wait_between_tries $a(wait_between_tries)] \ [list time_for_response $a(time_for_response)] \ [list ip_mask $a(ip_mask)] \ + [list password $a(password)] \ [list show_feedback $a(show_feedback)] \ [list section_navigation $a(section_navigation)] ] ] @@ -258,6 +263,7 @@ [list wait_between_tries $a(wait_between_tries)] \ [list time_for_response $a(time_for_response)] \ [list ip_mask $a(ip_mask)] \ + [list password $a(password)] \ [list show_feedback $a(show_feedback)] \ [list section_navigation $a(section_navigation)] ] ] @@ -347,17 +353,19 @@ db_1row sum_of_section_points {} - if {![exists_and_not_null section_max_points]||$section_max_points==0} { - set section_max_points 1 + if {![exists_and_not_null section_max_points] || $section_max_points==0} { + set section_max_points 100 } set percent_score [expr round(100 * $section_points / $section_max_points)] + as::session_results::new -target_id $session_id -points $percent_score db_dml update_assessment_percent {} } ad_proc -public as::assessment::check_session_conditions { -assessment_id:required -subject_id:required + -password:required } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-22 @@ -386,6 +394,9 @@ set pretty_wait_time [pretty_time -seconds [expr $wait_between_tries - $cur_wait_time]] append error_list "
  • [_ assessment.assessment_wait_retry]
  • " } + if {![empty_string_p $as_password] && ![string equal $password $as_password]} { + append error_list "
  • [_ assessment.assessment_wrong_password]
  • " + } if {![empty_string_p $ip_mask]} { regsub -all {\.} "^$ip_mask" {\\.} ip_mask regsub -all {\*} $ip_mask {.*} ip_mask @@ -399,6 +410,7 @@ ad_proc as::assessment::pretty_time { {-seconds} + {-hours:boolean} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-14 @@ -407,10 +419,17 @@ } { set time "" if {![empty_string_p $seconds]} { + if {$hours_p} { + set time_hour [expr $seconds / 3600] + set seconds [expr $seconds - ($time_hour * 3600)] + } set time_min [expr $seconds / 60] set time_sec [expr $seconds - ($time_min * 60)] set pad "00" - set time "[string range $pad [string length $time_min] end]$time_min\:[string range $pad [string length $time_sec] end]$time_sec min" + if {$hours_p} { + append time "[string range $pad [string length $time_hour] end]$time_hour\:" + } + append time "[string range $pad [string length $time_min] end]$time_min\:[string range $pad [string length $time_sec] end]$time_sec min" } return $time } 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.24 -r1.25 --- openacs-4/packages/assessment/tcl/as-install-procs.tcl 15 Feb 2005 15:03:10 -0000 1.24 +++ openacs-4/packages/assessment/tcl/as-install-procs.tcl 21 Feb 2005 14:32:56 -0000 1.25 @@ -37,6 +37,7 @@ content::type::new -content_type {as_sessions} -supertype {content_revision} -pretty_name {Assessment Session} -pretty_plural {Assessment Sessions} -table_name {as_sessions} -id_column {session_id} content::type::new -content_type {as_section_data} -supertype {content_revision} -pretty_name {Assessment Section Data} -pretty_plural {Assessment Sections Data} -table_name {as_section_data} -id_column {section_data_id} content::type::new -content_type {as_item_data} -supertype {content_revision} -pretty_name {Assessment Item Data} -pretty_plural {Assessment Items Data} -table_name {as_item_data} -id_column {item_data_id} +content::type::new -content_type {as_session_results} -supertype {content_revision} -pretty_name {Assessment Session Result} -pretty_plural {Assessment Session Results} -table_name {as_session_results} -id_column {result_id} # Radiobutton display type content::type::attribute::new -content_type {as_item_display_rb} -attribute_name {html_display_options} -datatype {string} -pretty_name {HTML display Options} -column_spec {varchar(50)} @@ -111,6 +112,8 @@ # Item type open question content::type::attribute::new -content_type {as_item_type_oq} -attribute_name {default_value} -datatype {string} -pretty_name {Default Value} -column_spec {varchar(500)} content::type::attribute::new -content_type {as_item_type_oq} -attribute_name {feedback_text} -datatype {string} -pretty_name {Feedback Text} -column_spec {varchar(500)} +content::type::attribute::new -content_type {as_item_type_oq} -attribute_name {reference_answer} -datatype {text} -pretty_name {Reference Answer} -column_spec {text} +content::type::attribute::new -content_type {as_item_type_oq} -attribute_name {keywords} -datatype {string} -pretty_name {Keywords} -column_spec {varchar(4000)} # Items content::type::attribute::new -content_type {as_items} -attribute_name {subtext} -datatype {string} -pretty_name {Item Subtext} -column_spec {varchar(500)} @@ -156,6 +159,7 @@ content::type::attribute::new -content_type {as_assessments} -attribute_name {wait_between_tries} -datatype {number} -pretty_name {Assessment Wait Between Tries} -column_spec {integer} content::type::attribute::new -content_type {as_assessments} -attribute_name {time_for_response} -datatype {number} -pretty_name {Assessment Time for Response} -column_spec {integer} content::type::attribute::new -content_type {as_assessments} -attribute_name {ip_mask} -datatype {string} -pretty_name {IP Mask} -column_spec {varchar(100)} +content::type::attribute::new -content_type {as_assessments} -attribute_name {password} -datatype {string} -pretty_name {Password} -column_spec {varchar(100)} content::type::attribute::new -content_type {as_assessments} -attribute_name {show_feedback} -datatype {string} -pretty_name {Assessment Show comments to the user} -column_spec {varchar(50)} content::type::attribute::new -content_type {as_assessments} -attribute_name {section_navigation} -datatype {string} -pretty_name {Assessment Navigation of sections} -column_spec {varchar(50)} content::type::attribute::new -content_type {as_assessments} -attribute_name {survey_p} -datatype {string} -pretty_name {Survey} -column_spec {char(1)} @@ -199,6 +203,9 @@ content::type::attribute::new -content_type {as_item_data} -attribute_name {signed_data} -datatype {string} -pretty_name {Signed Data} -column_spec {varchar(500)} content::type::attribute::new -content_type {as_item_data} -attribute_name {points} -datatype {number} -pretty_name {Points awarded} -column_spec {integer} +# Session results +content::type::attribute::new -content_type {as_session_results} -attribute_name {target_id} -datatype {number} -pretty_name {Target Answer} -column_spec {integer} +content::type::attribute::new -content_type {as_session_results} -attribute_name {points} -datatype {number} -pretty_name {Points} -column_spec {integer} } ad_proc -public as::install::package_instantiate { @@ -291,10 +298,54 @@ } } } - 0.10d6 0.10d7 { as::actions::insert_actions_after_upgrade } + 0.10d8 0.10d9 { + db_transaction { + content::type::new -content_type {as_session_results} -supertype {content_revision} -pretty_name {Assessment Session Result} -pretty_plural {Assessment Session Results} -table_name {as_session_results} -id_column {result_id} + content::type::attribute::new -content_type {as_session_results} -attribute_name {target_id} -datatype {number} -pretty_name {Target Answer} -column_spec {integer} + content::type::attribute::new -content_type {as_session_results} -attribute_name {points} -datatype {number} -pretty_name {Points} -column_spec {integer} + + set packages [db_list packages {select package_id from apm_packages where package_key = 'assessment'}] + foreach package_id $packages { + set folder_id [as::assessment::folder_id -package_id $package_id] + content::folder::register_content_type -folder_id $folder_id -content_type {as_session_results} -include_subtypes t + } + + set item_data_list [db_list_of_lists get_all_item_data_ids { + select item_data_id, points + from as_item_data + where points is not null + }] + foreach item_data $item_data_list { + as::session_results::new -target_id [lindex $item_data 0] -points [lindex $item_data 1] + } + + set section_data_list [db_list_of_lists get_all_section_data_ids { + select section_data_id, points + from as_section_data + where points is not null + }] + foreach section_data $section_data_list { + as::session_results::new -target_id [lindex $section_data 0] -points [lindex $section_data 1] + } + + set session_list [db_list_of_lists get_all_session_ids { + select session_id, percent_score + from as_sessions + where percent_score is not null + }] + foreach session $session_list { + as::session_results::new -target_id [lindex $session 0] -points [lindex $session 1] + } + + content::type::attribute::new -content_type {as_assessments} -attribute_name {password} -datatype {string} -pretty_name {Password} -column_spec {varchar(100)} + + content::type::attribute::new -content_type {as_item_type_oq} -attribute_name {reference_answer} -datatype {text} -pretty_name {Reference Answer} -column_spec {text} + content::type::attribute::new -content_type {as_item_type_oq} -attribute_name {keywords} -datatype {string} -pretty_name {Keywords} -column_spec {varchar(4000)} + } + } } } Index: openacs-4/packages/assessment/tcl/as-item-data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-data-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/assessment/tcl/as-item-data-procs.tcl 19 Jan 2005 16:49:14 -0000 1.8 +++ openacs-4/packages/assessment/tcl/as-item-data-procs.tcl 21 Feb 2005 14:32:56 -0000 1.9 @@ -21,8 +21,8 @@ {-timestamp_answer ""} {-content_answer ""} {-signed_data ""} - {-points ""} {-allow_overwrite_p t} + {-points ""} } { @author Eduardo Perez (eperez@it.uc3m.es) @creation-date 2004-09-12 @@ -62,7 +62,7 @@ [list timestamp_answer $timestamp_answer] \ [list content_answer $content_answer] \ [list signed_data $signed_data] \ - [list points $points] ] ] + [list points $points ] ] ] foreach choice_id $choice_answer { db_dml save_choice_answer {} Index: openacs-4/packages/assessment/tcl/as-item-data-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-data-procs.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment/tcl/as-item-data-procs.xql 25 Jan 2005 12:47:22 -0000 1.5 +++ openacs-4/packages/assessment/tcl/as-item-data-procs.xql 21 Feb 2005 14:32:56 -0000 1.6 @@ -61,7 +61,7 @@ select d.item_data_id, d.boolean_answer, d.clob_answer, d.numeric_answer, d.integer_answer, d.text_answer, d.timestamp_answer, d.content_answer, d.points - from as_item_data d, as_session_item_map m + from as_session_item_map m, as_item_data d where d.session_id = :session_id and d.subject_id = :subject_id and d.as_item_id = :as_item_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.14 -r1.15 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 9 Feb 2005 10:42:50 -0000 1.14 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 21 Feb 2005 14:32:56 -0000 1.15 @@ -319,7 +319,8 @@ set points [expr round($max_points * $percent / 100)] - as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -choice_answer $response -points $points -allow_overwrite_p $allow_overwrite_p + set item_data_id [as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -choice_answer $response -points $points -allow_overwrite_p $allow_overwrite_p] + as::session_results::new -target_id $item_data_id -points $points } ad_proc -public as::item_type_mc::results { Index: openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 26 Jan 2005 11:06:45 -0000 1.13 +++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.tcl 21 Feb 2005 14:32:56 -0000 1.14 @@ -9,7 +9,9 @@ ad_proc -public as::item_type_oq::new { {-title ""} {-default_value ""} - {-feedback_text ""} + {-feedback_text ""} + {-reference_answer ""} + {-keywords ""} } { @author Natalia Perez (nperper@it.uc3m.es) @creation-date 2004-09-29 @@ -23,11 +25,13 @@ db_transaction { set item_item_type_oq_id [content::item::new -parent_id $folder_id -content_type {as_item_type_oq} -name [exec uuidgen]] set as_item_type_oq_id [content::revision::new \ - -item_id $item_item_type_oq_id \ - -content_type {as_item_type_oq} \ - -title $title \ - -attributes [list [list default_value $default_value] \ - [list feedback_text $feedback_text] ] ] + -item_id $item_item_type_oq_id \ + -content_type {as_item_type_oq} \ + -title $title \ + -attributes [list [list default_value $default_value] \ + [list feedback_text $feedback_text] \ + [list reference_answer $reference_answer] \ + [list keywords $keywords] ] ] } return $as_item_type_oq_id @@ -38,6 +42,8 @@ {-title ""} {-default_value ""} {-feedback_text ""} + {-reference_answer ""} + {-keywords ""} } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2004-12-07 @@ -52,7 +58,9 @@ -content_type {as_item_type_oq} \ -title $title \ -attributes [list [list default_value $default_value] \ - [list feedback_text $feedback_text] ] ] + [list feedback_text $feedback_text] \ + [list reference_answer $reference_answer] \ + [list keywords $keywords] ] ] } return $new_item_type_id @@ -75,7 +83,9 @@ set new_item_type_id [new -title $title \ -default_value $default_value \ - -feedback_text $feedback_text] + -feedback_text $feedback_text \ + -reference_answer $reference_answer \ + -keywords $keywords] } return $new_item_type_id @@ -120,7 +130,22 @@ Process a Response to an Open Question Type } { - as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -clob_answer [lindex $response 0] -points "" -allow_overwrite_p $allow_overwrite_p + db_1row item_type_data {} + set response [lindex $response 0] + + if {[llength $keywords] > 0} { + set points 0 + foreach keyword $keywords { + if {[regexp $keyword $response]} { + incr points + } + } + set points [expr round($max_points * $points / [llength $keywords])] + } else { + set points "" + } + + as::item_data::new -session_id $session_id -subject_id $subject_id -staff_id $staff_id -as_item_id $as_item_id -section_id $section_id -clob_answer $response -points $points -allow_overwrite_p $allow_overwrite_p } ad_proc -public as::item_type_oq::results { Index: openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql 26 Jan 2005 11:06:45 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-item-type-oq-procs.xql 21 Feb 2005 14:32:56 -0000 1.5 @@ -14,7 +14,8 @@ - select cr.title, i.default_value, i.feedback_text + select cr.title, i.default_value, i.feedback_text, i.reference_answer, + i.keywords from cr_revisions cr, as_item_type_oq i where cr.revision_id = :type_id and i.as_item_type_id = cr.revision_id @@ -32,6 +33,16 @@ + + + + select keywords + from as_item_type_oq + where as_item_type_id = :type_id + + + + Index: openacs-4/packages/assessment/tcl/as-section-data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-data-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/tcl/as-section-data-procs.tcl 23 Jan 2005 18:10:48 -0000 1.3 +++ openacs-4/packages/assessment/tcl/as-section-data-procs.tcl 21 Feb 2005 14:32:56 -0000 1.4 @@ -1,5 +1,5 @@ ad_library { - Item Data procs + Section Data procs @author timo@timohentschel.de @creation-date 2005-01-14 } @@ -36,7 +36,7 @@ [list section_id $section_id] \ [list subject_id $subject_id] \ [list staff_id $staff_id] \ - [list points $points] ] ] + [list points $points ] ] ] db_dml update_creation_time {} } Index: openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql 23 Jan 2005 18:10:48 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-section-procs-oracle.xql 21 Feb 2005 14:32:56 -0000 1.5 @@ -87,8 +87,7 @@ set creation_datetime= sysdate, completed_datetime = sysdate, points = 0 - where session_id = :session_id - and section_id = :section_id + where section_data_id = :section_data_id Index: openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql 23 Jan 2005 18:10:48 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-section-procs-postgresql.xql 21 Feb 2005 14:32:56 -0000 1.5 @@ -71,8 +71,7 @@ update as_section_data set points = :section_points, completed_datetime = now() - where session_id = :session_id - and section_id = :section_id + where section_data_id = :section_data_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.17 -r1.18 --- openacs-4/packages/assessment/tcl/as-section-procs.tcl 28 Jan 2005 20:31:32 -0000 1.17 +++ openacs-4/packages/assessment/tcl/as-section-procs.tcl 21 Feb 2005 14:32:56 -0000 1.18 @@ -305,11 +305,12 @@ set item_points 0 } - if {![exists_and_not_null item_max_points]||$item_max_points==0} { - set item_max_points 1 + if {![exists_and_not_null item_max_points] || $item_max_points==0} { + set item_max_points 100 } set section_points [expr round($section_max_points * $item_points / $item_max_points)] + as::session_results::new -target_id $section_data_id -points $section_points db_dml update_section_points {} } 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.10 -r1.11 --- openacs-4/packages/assessment/tcl/as-section-procs.xql 23 Jan 2005 18:10:48 -0000 1.10 +++ openacs-4/packages/assessment/tcl/as-section-procs.xql 21 Feb 2005 14:32:56 -0000 1.11 @@ -74,14 +74,18 @@ - select sum(m.points) as item_max_points, sum(d.points) as item_points - from as_item_data d, as_item_section_map m, as_session_item_map sm + select sum(m.points) as item_max_points, sum(d.points) as item_points, + max(s.section_data_id) as section_data_id + from as_item_data d, as_item_section_map m, as_session_item_map sm, + as_section_data s where m.section_id = :section_id and d.section_id = m.section_id and d.as_item_id = m.as_item_id and d.session_id = :session_id and sm.session_id = d.session_id and sm.item_data_id = d.item_data_id + and s.session_id = d.session_id + and s.section_id = d.section_id Index: openacs-4/packages/assessment/tcl/as-session-results-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-session-results-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-session-results-procs.tcl 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,38 @@ +ad_library { + Session Results procs + @author timo@timohentschel.de + @creation-date 2005-02-17 +} + +namespace eval as::session_results {} + +ad_proc -public as::session_results::new { + -target_id:required + -points:required + {-title ""} + {-description ""} +} { + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-02-17 + + New as_session_results +} { + set package_id [ad_conn package_id] + set folder_id [as::assessment::folder_id -package_id $package_id] + + # Insert as_session_results in the CR (and as_session_results table) getting the revision_id + db_transaction { + if {![db_0or1row result_exists {}]} { + set result_item_id [content::item::new -parent_id $folder_id -content_type {as_session_results} -name [exec uuidgen]] + } + set result_id [content::revision::new \ + -item_id $result_item_id \ + -content_type {as_session_results} \ + -title $title \ + -description $description \ + -attributes [list [list target_id $target_id] \ + [list points $points] ] ] + } + + return $result_id +} Index: openacs-4/packages/assessment/tcl/as-session-results-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-session-results-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/tcl/as-session-results-procs.xql 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,15 @@ + + + + + + + select cr.item_id as result_item_id + from cr_revisions cr, as_session_results sr + where sr.target_id = :target_id + and sr.result_id = cr.revision_id + + + + + Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/assessment/www/actions-results.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/actions-results.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/assessment/www/assessment-password.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-password.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/assessment-password.adp 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,7 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +
    + +
    Index: openacs-4/packages/assessment/www/assessment-password.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-password.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/assessment-password.tcl 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,41 @@ +ad_page_contract { + + This page asks for the assessment password + + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-02-20 +} -query { + assessment_id:integer,notnull +} -properties { + context_bar:onevalue + page_title:onevalue +} + +set user_id [ad_conn user_id] +set page_title "[_ assessment.Password_Enter]" +set context_bar [ad_context_bar $page_title] + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id +permission::require_permission -object_id $assessment_id -privilege read + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +set assessment_rev_id $assessment_data(assessment_rev_id) +set errors [as::assessment::check_session_conditions -assessment_id $assessment_rev_id -subject_id $user_id -password $assessment_data(password)] +if {![empty_string_p $errors]} { + ad_return_complaint 1 $errors + ad_script_abort +} + + +ad_form -name assessment_password -action assessment -form { + {assessment_id:key} + {password:text,nospell {label "[_ assessment.password]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_password_user_help]"}} +} -edit_request { +} + +ad_return_template Index: openacs-4/packages/assessment/www/assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.tcl,v diff -u -r1.35 -r1.36 --- openacs-4/packages/assessment/www/assessment.tcl 14 Feb 2005 17:14:40 -0000 1.35 +++ openacs-4/packages/assessment/www/assessment.tcl 21 Feb 2005 14:32:56 -0000 1.36 @@ -7,6 +7,7 @@ @creation-date 2004-09-13 } -query { assessment_id:integer,notnull + {password:optional ""} {session_id:integer,optional ""} {section_order:integer,optional ""} {item_order:integer,optional ""} @@ -24,14 +25,15 @@ set item_to "" # Get the assessment data as::assessment::data -assessment_id $assessment_id +permission::require_permission -object_id $assessment_id -privilege read if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" ad_script_abort } set assessment_rev_id $assessment_data(assessment_rev_id) -set errors [as::assessment::check_session_conditions -assessment_id $assessment_rev_id -subject_id $user_id] +set errors [as::assessment::check_session_conditions -assessment_id $assessment_rev_id -subject_id $user_id -password $password] if {![empty_string_p $errors]} { ad_return_complaint 1 $errors ad_script_abort @@ -232,7 +234,7 @@ # form for display an assessment with sections and items -ad_form -name show_item_form -action assessment -html {enctype multipart/form-data} -export {assessment_id section_id section_order item_order} -form { +ad_form -name show_item_form -action assessment -html {enctype multipart/form-data} -export {assessment_id section_id section_order item_order password} -form { {session_id:text(hidden) {value $session_id}} } @@ -281,7 +283,7 @@ } # create seperate submit form for each item - ad_form -name show_item_form_$as_item_id -mode $mode -action assessment -html {enctype multipart/form-data} -export {assessment_id section_id section_order item_order} -form { + ad_form -name show_item_form_$as_item_id -mode $mode -action assessment -html {enctype multipart/form-data} -export {assessment_id section_id section_order item_order password} -form { {session_id:text(hidden) {value $session_id}} {item_id:text(hidden) {value $as_item_id}} } Index: openacs-4/packages/assessment/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/index-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/index-oracle.xql 23 Jan 2005 18:10:49 -0000 1.1 +++ openacs-4/packages/assessment/www/index-oracle.xql 21 Feb 2005 14:32:56 -0000 1.2 @@ -4,7 +4,7 @@ - select cr.item_id as assessment_id, cr.title, cr.description, + select cr.item_id as assessment_id, cr.title, cr.description, a.password, to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time, to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') as cur_time @@ -16,6 +16,7 @@ from as_assessment_section_map asm, as_item_section_map ism where asm.assessment_id = a.assessment_id and ism.section_id = asm.section_id) + and acs_permission.permission_p (a.assessment_id, :user_id, 'read') = 't' Index: openacs-4/packages/assessment/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/index-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/index-postgresql.xql 4 Feb 2005 18:08:05 -0000 1.2 +++ openacs-4/packages/assessment/www/index-postgresql.xql 21 Feb 2005 14:32:56 -0000 1.3 @@ -4,7 +4,7 @@ - select cr.item_id as assessment_id, cr.title, cr.description, + select cr.item_id as assessment_id, cr.title, cr.description, a.password, to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time, to_char(now(), 'YYYY-MM-DD HH24:MI:SS') as cur_time @@ -16,6 +16,7 @@ from as_assessment_section_map asm, as_item_section_map ism where asm.assessment_id = a.assessment_id and ism.section_id = asm.section_id) + and acs_permission__permission_p (a.assessment_id, :user_id, 'read') = 't' Index: openacs-4/packages/assessment/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/index.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/assessment/www/index.tcl 4 Feb 2005 18:08:05 -0000 1.11 +++ openacs-4/packages/assessment/www/index.tcl 21 Feb 2005 14:32:56 -0000 1.12 @@ -14,6 +14,7 @@ set context_bar [ad_context_bar] set package_id [ad_conn package_id] set folder_id [as::assessment::folder_id -package_id $package_id] +set user_id [ad_conn user_id] # create a list with all assessments and their sessions template::list::create \ @@ -37,7 +38,11 @@ db_multirow -extend { session assessment_url } assessments asssessment_id_name_definition {} { set session {Sessions} if {([empty_string_p $start_time] || $start_time <= $cur_time) && ([empty_string_p $end_time] || $end_time >= $cur_time)} { - set assessment_url [export_vars -base "assessment" {assessment_id}] + if {[empty_string_p $password]} { + set assessment_url [export_vars -base "assessment" {assessment_id}] + } else { + set assessment_url [export_vars -base "assessment-password" {assessment_id}] + } } else { set assessment_url "" } Index: openacs-4/packages/assessment/www/session-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/session-oracle.xql 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,15 @@ + + + postgresql7.3 + + + + SELECT percent_score, to_char(creation_datetime, :format) AS session_start, + to_char(completed_datetime, :format) AS session_finish, + round(86400 * (completed_datetime-creation_datetime)) AS session_time + FROM as_sessions s + WHERE s.session_id = :session_id + + + + Index: openacs-4/packages/assessment/www/session-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/session-postgresql.xql 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,15 @@ + + + postgresql7.3 + + + + SELECT percent_score, to_char(creation_datetime, :format) AS session_start, + to_char(completed_datetime, :format) AS session_finish, + round(date_part('epoch', completed_datetime - creation_datetime)) as session_time + FROM as_sessions s + WHERE s.session_id = :session_id + + + + Index: openacs-4/packages/assessment/www/session.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.adp,v diff -u -r1.23 -r1.24 --- openacs-4/packages/assessment/www/session.adp 1 Feb 2005 17:52:26 -0000 1.23 +++ openacs-4/packages/assessment/www/session.adp 21 Feb 2005 14:32:56 -0000 1.24 @@ -6,7 +6,7 @@ #assessment.Assessment#: @assessment_data.title@ #assessment.User_ID#: @first_names@ @last_name@#assessment.anonymous_name# -#assessment.Attempt#: @session_attempt@ / Unlimited +#assessment.Attempt#: @session_attempt@ / @assessment_data.number_tries@ #assessment.Out_of#: @assessment_score@ #assessment.Started#: @session_start@ @@ -36,13 +36,13 @@
    - +
    - + Index: openacs-4/packages/assessment/www/session.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/assessment/www/session.tcl 24 Jan 2005 14:54:31 -0000 1.32 +++ openacs-4/packages/assessment/www/session.tcl 21 Feb 2005 14:32:56 -0000 1.33 @@ -16,6 +16,7 @@ # Get the assessment data as::assessment::data -assessment_id $assessment_id +permission::require_permission -object_id $assessment_id -privilege read if {![info exists assessment_data(assessment_id)]} { ad_return_complaint 1 "[_ assessment.Requested_assess_does]" @@ -34,6 +35,7 @@ # get start and end times db_1row session_data {} +set session_time [as::assessment::pretty_time -seconds $session_time -hours] # get the number of attempts set session_attempt [db_string session_attempt {}] Index: openacs-4/packages/assessment/www/session.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.xql,v diff -u -r1.18 -r1.19 --- openacs-4/packages/assessment/www/session.xql 20 Jan 2005 18:47:23 -0000 1.18 +++ openacs-4/packages/assessment/www/session.xql 21 Feb 2005 14:32:56 -0000 1.19 @@ -12,16 +12,6 @@
    - - - SELECT percent_score, to_char(creation_datetime, :format) AS session_start, - to_char(completed_datetime, :format) AS session_finish, - to_char(completed_datetime-creation_datetime, 'HH24:MI:SS') AS session_time - FROM as_sessions s - WHERE s.session_id = :session_id - - - select count(*) Index: openacs-4/packages/assessment/www/sessions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/sessions.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/assessment/www/sessions.tcl 24 Jan 2005 14:54:31 -0000 1.15 +++ openacs-4/packages/assessment/www/sessions.tcl 21 Feb 2005 14:32:56 -0000 1.16 @@ -18,6 +18,7 @@ set context_bar [ad_context_bar $page_title] set format "[lc_get formbuilder_date_format], [lc_get formbuilder_time_format]" set user_id [ad_conn user_id] +permission::require_permission -object_id $assessment_id -privilege read # Get the assessment data as::assessment::data -assessment_id $assessment_id Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 2 Feb 2005 21:31:15 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 21 Feb 2005 14:32:56 -0000 1.3 @@ -76,6 +76,7 @@ {wait_between_tries:integer,optional,nospell {label "[_ assessment.Minutes_for_Retry]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Minutes_Retry_help]"}} {time_for_response:integer,optional,nospell {label "[_ assessment.time_for_response]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_help]"}} {ip_mask:text,optional,nospell {label "[_ assessment.ip_mask]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_ip_mask_help]"}} + {password:text,optional,nospell {label "[_ assessment.password]"} {html {size 20 maxlength 100}} {help_text "[_ assessment.as_password_help]"}} {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options} {help_text "[_ assessment.as_Feedback_help]"}} {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options} {help_text "[_ assessment.as_Navigation_help]"}} } -new_request { @@ -98,6 +99,7 @@ set wait_between_tries "" set time_for_response "" set ip_mask "" + set password "" set show_feedback "none" set section_navigation "default path" } -edit_request { @@ -146,6 +148,7 @@ -wait_between_tries $wait_between_tries \ -time_for_response $time_for_response \ -ip_mask $ip_mask \ + -password $password \ -show_feedback $show_feedback \ -section_navigation $section_navigation] @@ -188,6 +191,7 @@ -wait_between_tries $wait_between_tries \ -time_for_response $time_for_response \ -ip_mask $ip_mask \ + -password $password \ -show_feedback $show_feedback \ -section_navigation $section_navigation] Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/assessment-form.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/assessment-form.xql 21 Feb 2005 14:32:56 -0000 1.2 @@ -4,7 +4,7 @@ - select ci.name, cr.title, cr.description, a.instructions, a.run_mode, a.ip_mask, + select ci.name, cr.title, cr.description, a.instructions, a.run_mode, a.ip_mask, a.password, a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.show_item_name_p, a.entry_page, a.exit_page, a.consent_page, a.return_url, a.number_tries, a.wait_between_tries, a.time_for_response, a.show_feedback, a.section_navigation, Index: openacs-4/packages/assessment/www/asm-admin/catalog-browse.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/catalog-browse.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/catalog-browse.tcl 9 Feb 2005 11:00:26 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/catalog-browse.tcl 21 Feb 2005 14:32:56 -0000 1.4 @@ -20,7 +20,7 @@ keywords:optional {orderby:optional "title,asc"} {page:optional 1} - search_again_url + {search_again_url:optional ""} } @@ -157,7 +157,7 @@ -key $key_name \ -pass_properties { assessment_id section_id after } \ -no_data "[_ assessment.None]" \ - -filters { assessment_id {} section_id {} after {} category_ids { type multival } join_cat {} subtree_p {} keywords {} join_key {} letter {} itype {} } \ + -filters { assessment_id {} section_id {} after {} category_ids { type multival } join_cat {} subtree_p {} keywords {} join_key {} letter {} itype {} search_again_url {} } \ -elements $elements \ -bulk_actions $bulk_actions -bulk_action_export_vars { assessment_id section_id after } -page_size 20 -page_flush_p 1 -page_query_name $page_query Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 2 Feb 2005 21:31:15 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 21 Feb 2005 14:32:56 -0000 1.3 @@ -51,6 +51,8 @@ } # add form entries for each choice +set validate_list [list] +set count_correct [array exists correct] set ad_form_code "-form \{\n" for {set i 1} {$i <= $num_choices} {incr i} { if {[info exists choice($i)]} { @@ -63,78 +65,86 @@ } else { append ad_form_code "\{correct.$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $i\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } + lappend validate_list "correct.$i {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\"" } append ad_form_code "\}" eval ad_form -extend -name item_add_mc $ad_form_code - -ad_form -extend -name item_add_mc -edit_request { - set title "" +set edit_request "{ + set title \"\" set increasing_p f set negative_p f - set num_correct_answers "" - set num_answers "" - set display_type "sa" -} -on_submit { - if {[template::form get_action item_add_mc] == "more"} { + set num_correct_answers \"\" + set num_answers \"\" + set display_type \"sa\" +}" + +set on_submit "{ + if {\[template::form get_action item_add_mc\] == \"more\"} { # add 5 more choice entries and redirect to this form incr num_choices 5 - ad_returnredirect [export_vars -base "item-add-mc" {assessment_id section_id as_item_id after as_item_type_id title increasing_p negative_p num_correct_answers num_answers display_type num_choices choice:array correct:array}] + ad_returnredirect \[export_vars -base \"item-add-mc\" {assessment_id section_id as_item_id after as_item_type_id title increasing_p negative_p num_correct_answers num_answers display_type num_choices choice:array correct:array}\] ad_script_abort } -} -edit_data { +}" + +set edit_data "{ db_transaction { - if {![db_0or1row item_type {}] || $object_type != "as_item_type_mc"} { - set mc_id [as::item_type_mc::new \ - -title $title \ - -increasing_p $increasing_p \ - -allow_negative_p $negative_p \ - -num_correct_answers $num_correct_answers \ - -num_answers $num_answers] + if {!\[db_0or1row item_type {}\] || \$object_type != \"as_item_type_mc\"} { + set mc_id \[as::item_type_mc::new \\ + -title \$title \\ + -increasing_p \$increasing_p \\ + -allow_negative_p \$negative_p \\ + -num_correct_answers \$num_correct_answers \\ + -num_answers \$num_answers\] - if {![info exists object_type]} { + if {!\[info exists object_type\]} { # first item type mapped - as::item_rels::new -item_rev_id $as_item_id -target_rev_id $mc_id -type as_item_type_rel + as::item_rels::new -item_rev_id \$as_item_id -target_rev_id \$mc_id -type as_item_type_rel } else { # old item type existing - set as_item_id [as::item::new_revision -as_item_id $as_item_id] + set as_item_id \[as::item::new_revision -as_item_id \$as_item_id\] db_dml update_item_type {} } } else { # old mc item type existing - set as_item_id [as::item::new_revision -as_item_id $as_item_id] - set mc_id [as::item_type_mc::edit \ - -as_item_type_id $as_item_type_id \ - -title $title \ - -increasing_p $increasing_p \ - -allow_negative_p $negative_p \ - -num_correct_answers $num_correct_answers \ - -num_answers $num_answers] + set as_item_id \[as::item::new_revision -as_item_id \$as_item_id\] + set mc_id \[as::item_type_mc::edit \\ + -as_item_type_id \$as_item_type_id \\ + -title \$title \\ + -increasing_p \$increasing_p \\ + -allow_negative_p \$negative_p \\ + -num_correct_answers \$num_correct_answers \\ + -num_answers \$num_answers\] db_dml update_item_type {} } set count 0 - foreach i [lsort -integer [array names choice]] { - if {![empty_string_p $choice($i)]} { + foreach i \[lsort -integer \[array names choice\]\] { + if {!\[empty_string_p \$choice(\$i)\]} { incr count - set choice_id [as::item_choice::new -mc_id $mc_id \ - -title "$choice($i)" \ - -numeric_value "" \ - -text_value "" \ - -content_value "" \ - -feedback_text "" \ - -selected_p "" \ - -correct_answer_p "[ad_decode [info exists correct($i)] 0 f t]" \ - -sort_order "$count" \ - -percent_score ""] + set choice_id \[as::item_choice::new -mc_id \$mc_id \\ + -title \$choice(\$i) \\ + -numeric_value \"\" \\ + -text_value \"\" \\ + -content_value \"\" \\ + -feedback_text \"\" \\ + -selected_p \"\" \\ + -correct_answer_p \[ad_decode \[info exists correct(\$i)\] 0 f t\] \\ + -sort_order \$count \\ + -percent_score \"\"\] } } } -} -after_submit { +}" + +set after_submit "{ # now go to form to enter choice-specific data - ad_returnredirect [export_vars -base "item-add-mc-choices" {assessment_id section_id as_item_id after mc_id display_type}] + ad_returnredirect \[export_vars -base \"item-add-mc-choices\" {assessment_id section_id as_item_id after mc_id display_type}\] ad_script_abort -} +}" +eval ad_form -extend -name item_add_mc -validate "{$validate_list}" -edit_request $edit_request -on_submit $on_submit -edit_data $edit_data -after_submit $after_submit + ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl 2 Feb 2005 21:31:15 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl 21 Feb 2005 14:32:56 -0000 1.3 @@ -39,19 +39,30 @@ {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} {default_value:text(textarea),optional,nospell {label "[_ assessment.Default_Value]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Deafult_Value_help]"}} {feedback:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_help]"}} + {reference_answer:text(textarea),optional {label "[_ assessment.oq_Reference_Answer]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Reference_Answer_help]"}} + {keywords:text(textarea),optional {label "[_ assessment.oq_Keywords]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Keywords_help]"}} {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}} } -edit_request { set title "" set default_value "" set feedback "" + set reference_answer "" + set keywords "" set display_type "tb" +} -on_submit { + set keyword_list [list] + foreach line [split $keywords "\n"] { + lappend keyword_list [string trim $line] + } } -edit_data { db_transaction { if {![db_0or1row item_type {}] || $object_type != "as_item_type_oq"} { set as_item_type_id [as::item_type_oq::new \ -title $title \ -default_value $default_value \ - -feedback_text $feedback] + -feedback_text $feedback \ + -reference_answer $reference_answer \ + -keywords $keyword_list] if {![info exists object_type]} { # first item type mapped @@ -68,7 +79,9 @@ -as_item_type_id $as_item_type_id \ -title $title \ -default_value $default_value \ - -feedback_text $feedback] + -feedback_text $feedback \ + -reference_answer $reference_answer \ + -keywords $keyword_list] db_dml update_item_type {} } Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl 9 Feb 2005 10:42:51 -0000 1.3 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl 21 Feb 2005 14:32:56 -0000 1.4 @@ -74,7 +74,11 @@ append ad_form_code "\{percent.$choice_id:text,nospell \{label \"[_ assessment.Percent_Score]\"\} \{value \"$default_percent\"\} \{html \{size 5 maxlength 5\}\} \{help_text \"[_ assessment.Percent_Score_help]\"\}\}\n" } append ad_form_code "\}" -set percentage [expr 100 / $count_correct] +if {$count_correct > 0} { + set percentage [expr 100 / $count_correct] +} else { + set percentage 0 +} eval ad_form -extend -name item_edit_mc_choices $ad_form_code Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 2 Feb 2005 21:31:15 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 21 Feb 2005 14:32:56 -0000 1.3 @@ -48,6 +48,8 @@ set ad_form_code "-form \{\n" set choices [db_list_of_lists existing_choices {}] set count 0 +set validate_list [list] +set count_correct [array exists correct] foreach one_choice $choices { util_unlist $one_choice choice_title choice_id choice_correct_p incr count @@ -64,6 +66,7 @@ } else { append ad_form_code "\{correct.$choice_id:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n" } + lappend validate_list "correct.$choice_id {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\"" } # add new empty form entries for new choices @@ -84,72 +87,80 @@ eval ad_form -extend -name item_edit_mc $ad_form_code -ad_form -extend -name item_edit_mc -edit_request { +set edit_request "{ db_1row item_type_data {} -} -on_submit { - if {[template::form get_action item_add_mc] == "more"} { +}" + +set on_submit "{ + if {\[template::form get_action item_add_mc\] == \"more\"} { # add 5 more choice entries and redirect to this form incr num_choices 5 - ad_returnredirect [export_vars -base "item-edit-mc" {assessment_id section_id as_item_id title increasing_p negative_p num_correct_answers num_answers display_type num_choices choice:array correct:array}] + ad_returnredirect \[export_vars -base \"item-edit-mc\" {assessment_id section_id as_item_id title increasing_p negative_p num_correct_answers num_answers display_type num_choices choice:array correct:array}\] ad_script_abort } -} -edit_data { +}" + +set edit_data "{ db_transaction { - set new_item_id [as::item::new_revision -as_item_id $as_item_id] - set as_item_type_id [db_string item_type_id {}] - set new_item_type_id [as::item_type_mc::edit \ - -as_item_type_id $as_item_type_id \ - -title $title \ - -increasing_p $increasing_p \ - -allow_negative_p $negative_p \ - -num_correct_answers $num_correct_answers \ - -num_answers $num_answers] + set new_item_id \[as::item::new_revision -as_item_id \$as_item_id\] + set as_item_type_id \[db_string item_type_id {}\] + set new_item_type_id \[as::item_type_mc::edit \\ + -as_item_type_id \$as_item_type_id \\ + -title \$title \\ + -increasing_p \$increasing_p \\ + -allow_negative_p \$negative_p \\ + -num_correct_answers \$num_correct_answers \\ + -num_answers \$num_answers\] - set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] - set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] - set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id] - set as_item_id [as::item::latest -as_item_id $as_item_id -section_id $new_section_id] + set new_assessment_rev_id \[as::assessment::new_revision -assessment_id \$assessment_id\] + set section_id \[as::section::latest -section_id \$section_id -assessment_rev_id \$new_assessment_rev_id\] + set new_section_id \[as::section::new_revision -section_id \$section_id -assessment_id \$assessment_id\] + set as_item_id \[as::item::latest -as_item_id \$as_item_id -section_id \$new_section_id\] db_dml update_section_in_assessment {} db_dml update_item_in_section {} db_dml update_item_type {} # edit existing choices set count 0 - foreach i [lsort -integer [array names choice]] { - if {$i > 0 && ![empty_string_p $choice($i)]} { + foreach i \[lsort -integer \[array names choice\]\] { + if {\$i > 0 && !\[empty_string_p \$choice(\$i)\]} { incr count - set new_choice_id [as::item_choice::new_revision -choice_id $i -mc_id $new_item_type_id] - set title $choice($i) - set correct_answer_p [ad_decode [info exists correct($i)] 0 f t] + set new_choice_id \[as::item_choice::new_revision -choice_id \$i -mc_id \$new_item_type_id\] + set title \$choice(\$i) + set correct_answer_p \[ad_decode \[info exists correct(\$i)\] 0 f t\] db_dml update_title {} db_dml update_correct_and_sort_order {} } } # add new choices - foreach i [lsort -integer -decreasing [array names choice]] { - if {$i < 0 && ![empty_string_p $choice($i)]} { + foreach i \[lsort -integer -decreasing \[array names choice\]\] { + if {\$i < 0 && !\[empty_string_p \$choice(\$i)\]} { incr count - set new_choice_id [as::item_choice::new -mc_id $new_item_type_id \ - -title "$choice($i)" \ - -numeric_value "" \ - -text_value "" \ - -content_value "" \ - -feedback_text "" \ - -selected_p "" \ - -correct_answer_p "[ad_decode [info exists correct($i)] 0 f t]" \ - -sort_order "$count" \ - -percent_score ""] + set new_choice_id \[as::item_choice::new -mc_id \$new_item_type_id \\ + -title \$choice(\$i) \\ + -numeric_value \"\" \\ + -text_value \"\" \\ + -content_value \"\" \\ + -feedback_text \"\" + -selected_p \"\" \\ + -correct_answer_p \[ad_decode \[info exists correct(\$i)\] 0 f t\] \\ + -sort_order \$count \\ + -percent_score \"\"\] } } } - set mc_id $new_item_type_id - set as_item_id $new_item_id - set section_id $new_section_id -} -after_submit { + set mc_id \$new_item_type_id + set as_item_id \$new_item_id + set section_id \$new_section_id +}" + +set after_submit "{ # now go to form to edit choice-specific data - ad_returnredirect [export_vars -base "item-edit-mc-choices" {assessment_id section_id as_item_id mc_id}] + ad_returnredirect \[export_vars -base \"item-edit-mc-choices\" {assessment_id section_id as_item_id mc_id}\] ad_script_abort -} +}" +eval ad_form -extend -name item_edit_mc -validate "{$validate_list}" -edit_request $edit_request -on_submit $on_submit -edit_data $edit_data -after_submit $after_submit + ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl 2 Feb 2005 21:31:15 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl 21 Feb 2005 14:32:56 -0000 1.3 @@ -33,8 +33,16 @@ {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}} {default_value:text(textarea),optional,nospell {label "[_ assessment.Default_Value]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Deafult_Value_help]"}} {feedback_text:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_help]"}} + {reference_answer:text(textarea),optional {label "[_ assessment.oq_Reference_Answer]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Reference_Answer_help]"}} + {keywords:text(textarea),optional {label "[_ assessment.oq_Keywords]"} {html {rows 5 cols 80}} {help_text "[_ assessment.oq_Keywords_help]"}} } -edit_request { db_1row item_type_data {} + set keywords [join $keywords "\n"] +} -on_submit { + set keyword_list [list] + foreach line [split $keywords "\n"] { + lappend keyword_list [string trim $line] + } } -edit_data { db_transaction { set new_item_id [as::item::new_revision -as_item_id $as_item_id] @@ -43,7 +51,9 @@ -as_item_type_id $as_item_type_id \ -title $title \ -default_value $default_value \ - -feedback_text $feedback_text] + -feedback_text $feedback_text \ + -reference_answer $reference_answer \ + -keywords $keyword_list] set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id] set section_id [as::section::latest -section_id $section_id -assessment_rev_id $new_assessment_rev_id] Index: openacs-4/packages/assessment/www/asm-admin/item-edit-oq.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-oq.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/item-edit-oq.xql 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/item-edit-oq.xql 21 Feb 2005 14:32:56 -0000 1.2 @@ -4,7 +4,8 @@ - select r.title, i.default_value, i.feedback_text + select r.title, i.default_value, i.feedback_text, i.reference_answer, + i.keywords from cr_revisions r, as_item_rels ir, as_item_type_oq i where r.revision_id = i.as_item_type_id and i.as_item_type_id = ir.target_rev_id Index: openacs-4/packages/assessment/www/asm-admin/results-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-edit.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/results-edit.adp 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,17 @@ + +@page_title;noquote@ +@context_bar;noquote@ + +@item_title;noquote@ +

    + + + +

    +#assessment.currently# @result_points@ / @max_points@ #assessment.points# +#assessment.not_yet_reviewed# +

    + + + + Index: openacs-4/packages/assessment/www/asm-admin/results-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-edit.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/results-edit.tcl 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,59 @@ +ad_page_contract { + Form to edit the points awarded to an item response. + + @author Timo Hentschel (timo@timohentschel.de) + @cvs-id $Id: +} { + session_id:integer + section_id:integer + as_item_id:integer +} -properties { + context_bar:onevalue + page_title:onevalue +} + +db_1row find_assessment {} + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +permission::require_permission -object_id $assessment_id -privilege admin + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id +set assessment_rev_id $assessment_data(assessment_rev_id) + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +db_1row get_item_data {} +set item_type [string range $item_type end-1 end] +set result_points [db_string result_points {} -default ""] + +set page_title "[_ assessment.Results_edit]" +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base results-users {assessment_id}] [_ assessment.Results_by_user]] [list [export_vars -base results-session {session_id}] [_ assessment.View_Results]] $page_title] + + +ad_form -name results_edit -action results-edit -export { session_id section_id as_item_id } -form { + {result_id:key} + {title:text,nospell,optional {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Results_edit_Title_help]"}} + {description:text(textarea) {label "[_ assessment.Results_edit_Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Results_edit_Description_help]"}} + {points:integer,nospell {label "[_ assessment.points_answer]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_answer_help]"}} +} -new_request { + set title "" + set description "" + set points "" +} -new_data { + db_transaction { + as::session_results::new -target_id $item_data_id -title $title -description $description -points $points + db_dml update_item_data {} + as::section::calculate -section_id $section_id -assessment_id $assessment_rev_id -session_id $session_id + as::assessment::calculate -assessment_id $assessment_rev_id -session_id $session_id + } +} -after_submit { + ad_returnredirect [export_vars -base results-session {session_id}] + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/results-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-edit.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/results-edit.xql 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,54 @@ + + + + + + select r.item_id as assessment_id, s.assessment_id as assessment_rev_id, + s.subject_id, p.first_names, p.last_name + from as_sessions s, cr_revisions r, persons p + where s.session_id = :session_id + and r.revision_id = s.assessment_id + and s.subject_id = p.person_id + + + + + + select d.item_data_id, o.object_type as item_type, + cr.title as item_title, ism.points as max_points + from as_item_data d, as_session_item_map m, as_item_rels r, acs_objects o, + cr_revisions cr, as_item_section_map ism + where d.session_id = :session_id + and d.section_id = :section_id + and d.as_item_id = :as_item_id + and m.session_id = d.session_id + and m.item_data_id = d.item_data_id + and r.item_rev_id = d.as_item_id + and r.target_rev_id = o.object_id + and r.rel_type = 'as_item_type_rel' + and cr.revision_id = d.as_item_id + and ism.as_item_id = d.as_item_id + and ism.section_id = d.section_id + + + + + + select r.points + from as_session_results r + where r.target_id = :item_data_id + and r.result_id = (select max(result_id) + from as_session_results r2 + where r2.target_id = :item_data_id) + + + + + + update as_item_data + set points = :points + where item_data_id = :item_data_id + + + + Index: openacs-4/packages/assessment/www/asm-admin/results-session-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-session-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/results-session-oracle.xql 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,15 @@ + + + postgresql7.3 + + + + SELECT percent_score, to_char(creation_datetime, :format) AS session_start, + to_char(completed_datetime, :format) AS session_finish, + round(86400 * (completed_datetime-creation_datetime)) AS session_time + FROM as_sessions s + WHERE s.session_id = :session_id + + + + Index: openacs-4/packages/assessment/www/asm-admin/results-session-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-session-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/results-session-postgresql.xql 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,15 @@ + + + postgresql7.3 + + + + SELECT percent_score, to_char(creation_datetime, :format) AS session_start, + to_char(completed_datetime, :format) AS session_finish, + round(date_part('epoch', completed_datetime - creation_datetime)) as session_time + FROM as_sessions s + WHERE s.session_id = :session_id + + + + Index: openacs-4/packages/assessment/www/asm-admin/results-session.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-session.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/results-session.adp 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,51 @@ + +@page_title;noquote@ +@context_bar;noquote@ + + + + + + + + + + + + + + + +
    #assessment.Assessment#: @assessment_data.title@
    #assessment.User_ID#: @first_names@ @last_name@#assessment.anonymous_name##assessment.Attempt#: @session_attempt@ / @assessment_data.number_tries@#assessment.Out_of#: @assessment_score@
    #assessment.Started#: @session_start@#assessment.Finished#: @session_finish@#assessment.Time_spent#: @session_time@
    +

    + + + + + + + +
    + + + + + + + +
    #assessment.section# @sections.title@ + (#assessment.max_time# @sections.max_time_to_complete@) + (@sections.points@ / @sections.max_points@ #assessment.points#) +
    @sections.description@
    @sections.feedback_text@
    + +
    + +
    + +
    +
    + +
    +


    +#assessment.Total_score#: @session_score@ / @assessment_score@ = @percent_score@% +
    Index: openacs-4/packages/assessment/www/asm-admin/results-session.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-session.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/results-session.tcl 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,73 @@ +ad_page_contract { + + Show the result of a session and provide links to edit the points. + + @author timo@timohentschel.de + @date 2005-02-16 + @cvs-id $Id: +} { + session_id:integer +} -properties { + context_bar:onevalue + page_title:onevalue +} + +db_1row find_assessment {} + +set package_id [ad_conn package_id] +permission::require_permission -object_id $package_id -privilege create +permission::require_permission -object_id $assessment_id -privilege admin + +# Get the assessment data +as::assessment::data -assessment_id $assessment_id + +if {![info exists assessment_data(assessment_id)]} { + ad_return_complaint 1 "[_ assessment.Requested_assess_does]" + ad_script_abort +} + +set user_id [ad_conn user_id] +if {$subject_id != $user_id} { + permission::require_permission -object_id $assessment_id -privilege admin +} + +set page_title "[_ assessment.View_Results]" +set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base results-users {assessment_id}] [_ assessment.Results_by_user]] $page_title] +set format "[lc_get formbuilder_date_format], [lc_get formbuilder_time_format]" +set session_user_url [acs_community_member_url -user_id $subject_id] + +# get start and end times +db_1row session_data {} +set session_time [as::assessment::pretty_time -seconds $session_time -hours] + +# get the number of attempts +set session_attempt [db_string session_attempt {}] + +set show_username_p 1 +# only admins are allowed to see responses of other users +if {$assessment_data(anonymous_p) == "t" && $subject_id != $user_id} { + set show_username_p 0 +} + +if {[empty_string_p $assessment_data(show_feedback)]} { + set assessment_data(show_feedback) "all" +} + +# show_feedback: none, all, incorrect, correct + + +set session_score 0 +set assessment_score 0 +db_multirow sections sections {} { + if {[empty_string_p $points]} { + set points 0 + } + if {[empty_string_p $max_points]} { + set max_points 0 + } + set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete] + incr session_score $points + incr assessment_score $max_points +} + +ad_return_template Index: openacs-4/packages/assessment/www/asm-admin/results-session.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-session.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/assessment/www/asm-admin/results-session.xql 21 Feb 2005 14:32:56 -0000 1.1 @@ -0,0 +1,43 @@ + + + + + + select r.item_id as assessment_id, s.assessment_id as assessment_rev_id, + s.subject_id, p.first_names, p.last_name + from as_sessions s, cr_revisions r, persons p + where s.session_id = :session_id + and r.revision_id = s.assessment_id + and s.subject_id = p.person_id + + + + + + select count(*) + from as_sessions s, cr_revisions r + where s.subject_id = :subject_id + and s.assessment_id = r.revision_id + and r.item_id = :assessment_id + + + + + + select s.section_id, cr.title, cr.description, ci.name, s.instructions, + s.feedback_text, m.max_time_to_complete, m.points as max_points, d.points + from as_assessment_section_map m, as_session_sections ss, as_section_data d, + 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 = m.section_id + and m.assessment_id = :assessment_rev_id + and m.section_id = ss.section_id + and ss.session_id = :session_id + and d.session_id = ss.session_id + and d.section_id = ss.section_id + order by ss.sort_order + + + + Index: openacs-4/packages/assessment/www/asm-admin/results-users.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-users.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/assessment/www/asm-admin/results-users.tcl 1 Feb 2005 22:00:10 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/results-users.tcl 21 Feb 2005 14:32:56 -0000 1.2 @@ -30,8 +30,9 @@ -multirow results \ -key sessions_id \ -elements { - all_responses { - link_url_eval {[export_vars -base "../sessions" {session_id assessment_id}]} + session_id { + label {[_ assessment.Session]} + link_url_eval {[export_vars -base "results-session" {session_id}]} } subject_name { label {[_ assessment.Subject_Name]} @@ -43,17 +44,16 @@ } percent_score { label {[_ assessment.Percent_Score]} - link_url_eval {[export_vars -base "../session" {session_id}]} + link_url_eval {[export_vars -base "results-session" {session_id}]} html {align right nowrap} } } -main_class { narrow } -db_multirow -extend { subject_url all_responses } results assessment_results { +db_multirow -extend { subject_url } results assessment_results { } { - set all_responses "[_ assessment.View_all_responses]" if {$assessment_data(anonymous_p) == "t" && $subject_id != $user_id} { set subject_name "[_ assessment.anonymous_name]" set subject_url "" Index: openacs-4/packages/assessment/www/asm-admin/section-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-form.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/assessment/www/asm-admin/section-form.tcl 2 Feb 2005 21:31:15 -0000 1.2 +++ openacs-4/packages/assessment/www/asm-admin/section-form.tcl 21 Feb 2005 14:32:56 -0000 1.3 @@ -34,7 +34,6 @@ } 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 display_types [db_list_of_lists section_display_types {}] set display_types [concat [list [list "[_ assessment.section_new_display]" ""]] $display_types] @@ -68,7 +67,7 @@ {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,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.section_time_help]"}} {num_items:integer,optional,nospell {label "[_ assessment.num_items]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_items_help]"}} - {points:integer,optional,nospell {label "[_ assessment.points_section]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}} + {points:integer,optional,nospell {label "[_ assessment.points_section]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_section_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 ""