@items.name@: *
- @items.title;noquote@ *
- @items.content;noquote@
-
-
-
-
-
-
-
-
+
+
+
+ @items.name@: *
+
+
@items.title;noquote@ *
+
@items.content;noquote@
+
-
-
-
-
-
-
- @formgroup.label;noquote@
-
-
-
-
-
- @items.description;noquote@
-
-
-
- @formgroup.widget;noquote@ @formgroup.label;noquote@
-
-
-
-
- @formgroup.widget;noquote@ @formgroup.label;noquote@
-
-
-
-
-
- @formgroup.widget;noquote@
-
-
-
-
-
- @items.html;noquote@
-
-
-
-
+
-
+
+
+
+
+ @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+
+
+
+ @formgroup.widget;noquote@ @formgroup.label;noquote@
+
+
+
+
+
+ @formgroup.widget;noquote@
+
+
+
+
+
+
+ @items.html;noquote@
+
+
+
+
+
+
+
+
@items.subtext@
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/assessment/www/assessment-single-submit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/assessment-single-submit.adp,v
diff -u -N -r1.7 -r1.8
--- openacs-4/packages/assessment/www/assessment-single-submit.adp 30 May 2005 10:53:27 -0000 1.7
+++ openacs-4/packages/assessment/www/assessment-single-submit.adp 12 Jun 2006 02:49:51 -0000 1.8
@@ -1,13 +1,13 @@
-@page_title;noquote@
+@assessment_data.html_title;noquote@
@context;noquote@
-@assessment_data.title@
+
@assessment_data.instructions;noquote@
-#assessment.section_counter#
- #assessment.item_counter#
+
#assessment.session_time_remaining#
#assessment.section_time_remaining#
Index: openacs-4/packages/assessment/www/assessment.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.tcl,v
diff -u -N -r1.50 -r1.51
--- openacs-4/packages/assessment/www/assessment.tcl 7 Feb 2006 10:44:57 -0000 1.50
+++ openacs-4/packages/assessment/www/assessment.tcl 12 Jun 2006 02:49:51 -0000 1.51
@@ -15,6 +15,7 @@
{return_url:optional}
response_to_item:array,optional,multiple,html
{next_asm:optional}
+ {response:multiple,optional}
} -properties {
context:onevalue
page_title:onevalue
@@ -27,6 +28,7 @@
set item_to ""
set url ""
+
if { [info exists return_url] } {
set url $return_url
@@ -243,6 +245,8 @@
as::assessment::calculate -session_id $session_id -assessment_id $assessment_rev_id
db_dml session_finished {}
as::assessment::check::eval_aa_checks -session_id $session_id -assessment_id $assessment_id
+ # section based aa checks
+ as::assessment::check::eval_sa_checks -session_id $session_id -assessment_id $assessment_id
as::assessment::check::eval_m_checks -session_id $session_id -assessment_id $assessment_id
if {[empty_string_p $assessment_data(return_url)]} {
ad_returnredirect [export_vars -base finish {session_id assessment_id return_url next_asm}]
@@ -259,20 +263,27 @@
{session_id:text(hidden) {value $session_id}}
}
-multirow create items as_item_id name title description subtext required_p max_time_to_complete presentation_type html submitted_p content as_item_type_id choice_orientation next_title next_pr_type
+multirow create items as_item_id name title description subtext required_p max_time_to_complete presentation_type html submitted_p content as_item_type_id choice_orientation next_title validate_block next_pr_type
set unsubmitted_list [list]
set validate_list [list]
set required_count 0
foreach one_item $item_list {
- util_unlist $one_item as_item_id name title description subtext required_p max_time_to_complete content_rev_id content_filename content_type as_item_type_id
+ util_unlist $one_item as_item_id name title description subtext required_p max_time_to_complete content_rev_id content_filename content_type as_item_type_id validate_block
if {$required_p == "t"} {
# make sure that mandatory items are answered
lappend validate_list "response_to_item.$as_item_id {\[exists_and_not_null response_to_item($as_item_id)\]} \"\[_ assessment.form_element_required\]\""
incr required_count
}
+
+ foreach {check_expr check_message} [split $validate_block \n] {
+ regsub -all {%answer%} $check_expr \$response_to_item($as_item_id) check_expr
+ regsub -all {%answer%} [lang::util::localize $check_message] \$response_to_item($as_item_id) check_message
+ lappend validate_list "response_to_item.$as_item_id { $check_expr } { $check_message }"
+ }
+
set default_value ""
set submitted_p f
@@ -317,6 +328,7 @@
# save answer
set response_item_id \$item_id
+
db_1row process_item_type {}
set item_type \[string range \$item_type end-1 end\]
if {!\[info exists response_to_item(\$response_item_id)\]} {
@@ -330,7 +342,14 @@
}
set points \[ad_decode \$points \"\" 0 \$points\]
- as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response_to_item(\$response_item_id) -max_points \$points -allow_overwrite_p \$display(back_button_p)
+
+ set response \$response_to_item(\$response_item_id)
+
+ if { \$item_type == \"fu\" } {
+ set response \[list \$response_to_item(\$response_item_id) \$response_to_item(\${response_item_id}.tmpfile) \$response_to_item(\${response_item_id}.content-type)\]
+ }
+
+ as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response -max_points \$points -allow_overwrite_p \$display(back_button_p)
}
}"
set after_submit "{
@@ -373,6 +392,10 @@
}
}
+ad_form -extend -name show_item_form -on_request {
+ as::assessment::check::eval_or_checks -session_id $session_id -section_id $section_id
+}
+
if {$display(submit_answer_p) != "t"} {
# process multiple submit
set template "assessment-section-submit"
@@ -398,7 +421,13 @@
}
set points \[ad_decode \$points \"\" 0 \$points\]
- as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response_to_item(\$response_item_id) -max_points \$points -allow_overwrite_p \$display(back_button_p)
+ set response \$response_to_item(\$response_item_id)
+
+ if { \$item_type == \"fu\" } {
+ set response \[list \$response_to_item(\$response_item_id) \$response_to_item(\${response_item_id}.tmpfile) \$response_to_item(\${response_item_id}.content-type)\]
+ }
+
+ as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response -max_points \$points -allow_overwrite_p \$display(back_button_p)
}
if {\$section_order != \$new_section_order} {
@@ -434,6 +463,8 @@
as::assessment::calculate -session_id \$session_id -assessment_id \$assessment_rev_id
db_dml session_finished {}
as::assessment::check::eval_aa_checks -session_id $session_id -assessment_id $assessment_id
+ # section based aa checks
+ as::assessment::check::eval_sa_checks -session_id $session_id -assessment_id $assessment_id
as::assessment::check::eval_m_checks -session_id $session_id -assessment_id $assessment_id
if {\[empty_string_p \$assessment_data(return_url)\]} {
ad_returnredirect \[export_vars -base finish {session_id assessment_id return_url next_asm}\]
@@ -458,7 +489,14 @@
set item_type [string range $item_type end-1 end]
set points [ad_decode $points "" 0 $points]
- as::item_type_$item_type\::process -type_id $item_type_id -session_id $session_id -as_item_id $response_item_id -section_id $section_id -subject_id $user_id -response "" -max_points $points -allow_overwrite_p $display(back_button_p)
+ set response \$response_to_item(\$response_item_id)\
+
+ if { \$item_type == \"fu\" } {
+ set response \[list \$response_to_item(\$response_item_id) \$response_to_item(\${response_item_id}.tmpfile) \$response_to_item(\${response_item_id}.content-type)\]
+ }
+
+ as::item_type_\$item_type\\::process -type_id \$item_type_id -session_id \$session_id -as_item_id \$response_item_id -section_id \$section_id -subject_id \$user_id -response \$response -max_points \$points -allow_overwrite_p \$display(back_button_p)
+
}
if {$section_order != $new_section_order} {
@@ -480,6 +518,8 @@
as::assessment::calculate -session_id $session_id -assessment_id $assessment_rev_id
db_dml session_finished {}
as::assessment::check::eval_aa_checks -session_id $session_id -assessment_id $assessment_id
+ # section based aa checks
+ as::assessment::check::eval_sa_checks -session_id $session_id -assessment_id $assessment_id
as::assessment::check::eval_m_checks -session_id $session_id -assessment_id $assessment_id
if {[empty_string_p $assessment_data(return_url)]} {
ad_returnredirect [export_vars -base finish {session_id assessment_id return_url next_asm}]
Index: openacs-4/packages/assessment/www/assessment.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/Attic/assessment.xql,v
diff -u -N -r1.16 -r1.17
--- openacs-4/packages/assessment/www/assessment.xql 7 Feb 2006 10:44:57 -0000 1.16
+++ openacs-4/packages/assessment/www/assessment.xql 12 Jun 2006 02:49:51 -0000 1.17
@@ -19,7 +19,7 @@
from as_sessions
where completed_datetime is null
and assessment_id = :assessment_rev_id
- and subject_id = :user_id
+ and subject_id = :user_id and subject_id <> 0
Index: openacs-4/packages/assessment/www/finish.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/finish.tcl,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/finish.tcl 9 May 2005 21:58:24 -0000 1.6
+++ openacs-4/packages/assessment/www/finish.tcl 12 Jun 2006 02:49:51 -0000 1.7
@@ -15,22 +15,35 @@
}
set user_id [ad_conn user_id]
-if { $user_id != 0} {
- db_dml update_session {update as_sessions set subject_id=:user_id where session_id=:session_id}
+
+if { ![string eq $user_id 0]} {
+ db_dml update_session {update as_sessions set subject_id=:user_id where session_id=:session_id}
+ db_dml update_session {update as_item_data set subject_id=:user_id where session_id=:session_id}
}
-if {[info exists return_url]} {
- if { $return_url != ""} {
- ad_returnredirect "$return_url"
- }
-}
+
set page_title "[_ assessment.Response_Submitted]"
set context [list $page_title]
+callback imsld::finish_object -object_id $assessment_id
+
+
if { [exists_and_not_null next_asm ] } {
ad_returnredirect "assessment?assessment_id=$next_asm"
+}
+
+set value [parameter::get -parameter "RegistrationId" -package_id [subsite::main_site_id]]
+
+if {[info exists return_url]} {
+ if { $return_url != ""} {
+ ad_returnredirect "$return_url"
+ } else {
+ if { [string eq $value $assessment_id] } {
+ ad_returnredirect "/pvt/home"
+ }
+ }
}
ad_return_template
Index: openacs-4/packages/assessment/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/index.tcl,v
diff -u -N -r1.14 -r1.15
--- openacs-4/packages/assessment/www/index.tcl 29 Apr 2005 18:38:50 -0000 1.14
+++ openacs-4/packages/assessment/www/index.tcl 12 Jun 2006 02:49:51 -0000 1.15
@@ -24,7 +24,7 @@
-elements {
title {
label "[_ assessment.open_assessments]"
- display_template {@assessments.title@ }
+ display_template {@assessments.title;noquote@ }
}
} -main_class {
narrow
@@ -33,6 +33,7 @@
# get the information of all open assessments
template::multirow create assessments assessment_id title description assessment_url
db_foreach open_asssessments {} {
+ set title [as::assessment::title -title $title]
if {([empty_string_p $start_time] || $start_time <= $cur_time) && ([empty_string_p $end_time] || $end_time >= $cur_time)} {
if {[empty_string_p $password]} {
set assessment_url [export_vars -base "assessment" {assessment_id}]
@@ -51,7 +52,7 @@
-elements {
title {
label "[_ assessment.Assessments]"
- display_template {@sessions.title@}
+ display_template {@sessions.title;noquote@}
}
session {
label {[_ assessment.Sessions]}
Index: openacs-4/packages/assessment/www/session.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.adp,v
diff -u -N -r1.27 -r1.28
--- openacs-4/packages/assessment/www/session.adp 6 May 2005 16:07:13 -0000 1.27
+++ openacs-4/packages/assessment/www/session.adp 12 Jun 2006 02:49:51 -0000 1.28
@@ -1,13 +1,13 @@
@page_title;noquote@
-@context;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.Percent_Score#: @assessment_score@
+#assessment.User_ID#: @first_names@ @last_name@ #assessment.lt_bNoteb_This_assessmen##assessment.anonymous_name#
+#assessment.Attempt#: @session_attempt@ / @assessment_data.number_tries@
+ #assessment.Percent_Score#: @assessment_score@
#assessment.Started#: @session_start@
#assessment.Finished#: @session_finish@
@@ -28,7 +28,7 @@
#assessment.section# @sections.title@
(#assessment.max_time# @sections.max_time_to_complete@)
- (@sections.points@ / @sections.max_points@ #assessment.points#)
+ (@sections.points@ / @sections.max_points@ #assessment.points#)
@sections.description@
@@ -48,4 +48,7 @@
#assessment.Total_score#: @session_score@ / @assessment_score@ = @percent_score@%
+
+
+
Index: openacs-4/packages/assessment/www/session.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/session.tcl,v
diff -u -N -r1.34 -r1.35
--- openacs-4/packages/assessment/www/session.tcl 6 May 2005 16:07:13 -0000 1.34
+++ openacs-4/packages/assessment/www/session.tcl 12 Jun 2006 02:49:51 -0000 1.35
@@ -8,7 +8,7 @@
} {
session_id:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -29,7 +29,7 @@
}
set page_title "[_ assessment.View_Results]"
-set context [list [list [export_vars -base sessions {assessment_id}] "[_ assessment.Show_Sessions]"] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base sessions {assessment_id}] "[_ assessment.Show_Sessions]"] $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]
@@ -67,4 +67,8 @@
incr assessment_score $max_points
}
+set showpoints [parameter::get -parameter "ShowPoints" -default 1 ]
+
+set comments_installed_p [apm_package_enabled_p "general-comments"]
+
ad_return_template
Index: openacs-4/packages/assessment/www/sessions.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/sessions.adp,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/sessions.adp 6 May 2005 16:07:13 -0000 1.4
+++ openacs-4/packages/assessment/www/sessions.adp 12 Jun 2006 02:49:51 -0000 1.5
@@ -1,5 +1,5 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/sessions.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/sessions.tcl,v
diff -u -N -r1.17 -r1.18
--- openacs-4/packages/assessment/www/sessions.tcl 6 May 2005 16:07:13 -0000 1.17
+++ openacs-4/packages/assessment/www/sessions.tcl 12 Jun 2006 02:49:51 -0000 1.18
@@ -10,12 +10,12 @@
assessment_id:notnull
{subject_id:integer,optional ""}
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
set page_title "[_ assessment.Show_Sessions]"
-set context [list $page_title]
+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
@@ -62,7 +62,7 @@
}
assessment_name {
label {Assessment}
- display_template {@sessions.assessment_name@ @sessions.assessment_name@ }
+ display_template {@sessions.assessment_name;noquote@ @sessions.assessment_name;noquote@ }
}
completed_datetime {
label {[_ assessment.Finish_Time]}
@@ -87,7 +87,7 @@
}
assessment_name {
label {Assessment}
- display_template {@sessions.assessment_name@ @sessions.assessment_name@ }
+ display_template {@sessions.assessment_name;noquote@ @sessions.assessment_name;noquote@ }
}
completed_datetime {
label {[_ assessment.Finish_Time]}
Index: openacs-4/packages/assessment/www/admin/asm-action-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-delete.adp,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/admin/asm-action-delete.adp 6 May 2005 17:05:16 -0000 1.4
+++ openacs-4/packages/assessment/www/admin/asm-action-delete.adp 12 Jun 2006 02:49:51 -0000 1.5
@@ -1,6 +1,6 @@
-@page_title;noquote@
-@context;noquote@
+Action Delete
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/admin/asm-action-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-delete.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/admin/asm-action-delete.tcl 6 May 2005 17:05:16 -0000 1.4
+++ openacs-4/packages/assessment/www/admin/asm-action-delete.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -5,13 +5,10 @@
@cvs-id $Id:
} {
action_id:integer
-} -properties {
- page_title:onevalue
- context:onevalue
}
set page_title [_ assessment.delete]
-set context [list [list index [_ assessment.admin]] [list [export_vars -base asm-action-new {action_id} ] [_ assessment.action_admin] ] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base asm-action-new {action_id} ] [_ assessment.action_admin] ] $page_title]
db_1row select_action_info {select name,description,tcl_code
from as_actions
where action_id = :action_id}
Index: openacs-4/packages/assessment/www/admin/asm-action-new.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-new.adp,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/admin/asm-action-new.adp 6 May 2005 17:05:16 -0000 1.4
+++ openacs-4/packages/assessment/www/admin/asm-action-new.adp 12 Jun 2006 02:49:51 -0000 1.5
@@ -1,6 +1,6 @@
@page_title@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/admin/asm-action-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-new.tcl,v
diff -u -N -r1.7 -r1.8
--- openacs-4/packages/assessment/www/admin/asm-action-new.tcl 6 May 2005 17:14:17 -0000 1.7
+++ openacs-4/packages/assessment/www/admin/asm-action-new.tcl 12 Jun 2006 02:49:51 -0000 1.8
@@ -5,9 +5,6 @@
@cvs-id $Id:
} {
action_id:optional
-} -properties {
- title:onevalue
- context:onevalue
}
set package_id [ad_conn package_id]
@@ -24,7 +21,7 @@
}
set page_title "[_ assessment.add_new_action]"
-set context [list [list [export_vars -base asm-action-admin ] [_ assessment.action_admin]] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base asm-action-admin ] [_ assessment.action_admin]] $page_title]
ad_form -name action_admin -form {
action_id:key
Index: openacs-4/packages/assessment/www/admin/asm-action-param-admin.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-param-admin.adp,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/admin/asm-action-param-admin.adp 6 May 2005 17:05:16 -0000 1.5
+++ openacs-4/packages/assessment/www/admin/asm-action-param-admin.adp 12 Jun 2006 02:49:51 -0000 1.6
@@ -1,5 +1,5 @@
-@page_title;noquote@
+@page_title@
@context;noquote@
Index: openacs-4/packages/assessment/www/admin/asm-action-param-admin.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-param-admin.tcl,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/admin/asm-action-param-admin.tcl 9 Jun 2005 19:19:47 -0000 1.6
+++ openacs-4/packages/assessment/www/admin/asm-action-param-admin.tcl 12 Jun 2006 02:49:51 -0000 1.7
@@ -6,9 +6,6 @@
} {
action_id
parameter_id:optional
-} -properties {
- page_title:onevalue
- context:onevalue
}
if { ![ad_form_new_p -key parameter_id] } {
Index: openacs-4/packages/assessment/www/admin/asm-action-param-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-param-delete.adp,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/admin/asm-action-param-delete.adp 6 May 2005 17:05:16 -0000 1.4
+++ openacs-4/packages/assessment/www/admin/asm-action-param-delete.adp 12 Jun 2006 02:49:51 -0000 1.5
@@ -1,6 +1,6 @@
-@page_title;noquote@
-@context;noquote@
+Param Delete
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/admin/asm-action-param-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-param-delete.tcl,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/admin/asm-action-param-delete.tcl 6 May 2005 17:17:11 -0000 1.5
+++ openacs-4/packages/assessment/www/admin/asm-action-param-delete.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -6,13 +6,10 @@
} {
parameter_id:integer
action_id:integer
-} -properties {
- page_title:onevalue
- context:onevalue
}
set page_title [_ assessment.delete_parameter]
-set context [list [list [export_vars -base asm-action-new {action_id} ] [_ assessment.action_admin] ] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base asm-action-new {action_id} ] [_ assessment.action_admin] ] $page_title]
db_1row select_param_info {select type,varname,description,query
from as_action_params
where parameter_id = :parameter_id}
Index: openacs-4/packages/assessment/www/admin/set-reg-assessment.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/set-reg-assessment.adp,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/admin/set-reg-assessment.adp 9 Jun 2005 20:44:08 -0000 1.1
+++ openacs-4/packages/assessment/www/admin/set-reg-assessment.adp 12 Jun 2006 02:49:51 -0000 1.2
@@ -5,7 +5,7 @@
#acs-subsite.no_assessment#
-#acs-subsite.create_asm#
+#acs-subsite.create_asm#
Index: openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl 9 Jun 2005 20:44:08 -0000 1.1
+++ openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -13,7 +13,7 @@
set asm_instance [ad_conn package_id]
if {![exists_and_not_null assessment_id]} {
- set value [parameter::get -parameter AsmForRegisterId -package_id $subsite_id]
+ set value [parameter::get -parameter RegistrationId -package_id $subsite_id]
set assessment_id $value
}
@@ -46,7 +46,8 @@
ad_returnredirect "${url}asm-admin/one-a?assessment_id=$assessment_id®_p=1&asm_instance=$asm_instance"
}
} else {
- parameter::set_value -package_id [subsite::main_site_id] -parameter AsmForRegisterId -value $assessment_id
+ parameter::set_value -package_id [subsite::main_site_id] -parameter RegistrationId -value $assessment_id
+ parameter::set_value -package_id [subsite::main_site_id] -parameter RegistrationImplName -value "asm_url"
ad_returnredirect ""
}
}
Index: openacs-4/packages/assessment/www/asm-admin/action-params.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/action-params.tcl,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/asm-admin/action-params.tcl 9 Jun 2005 19:19:47 -0000 1.6
+++ openacs-4/packages/assessment/www/asm-admin/action-params.tcl 12 Jun 2006 02:49:51 -0000 1.7
@@ -69,16 +69,15 @@
db_foreach get_params {} {
set choices [list]
if { $type == "n" } {
- if { $action_perform == "aa" || $action_perform == "m"} {
+ if { $action_perform == "aa" || $action_perform == "m" || $action_perform == "or" || $action_perform == "sa"} {
set choices [db_list_of_lists choices {}]
} else {
set choices [db_list_of_lists prev_choices {}]
}
} else {
set choices [db_list_of_lists choices_param $query]
- }
-
- set parameter [list [list param_$parameter_id:text(select),optional [list label $varname] [list options $choices] [list help_text $description]]]
+ }
+ set parameter [list [list param_$parameter_id:text(select),optional [list label $varname] [list html [list style "width:200px"]] [list options $choices] [list help_text $description]]]
ad_form -extend -name get_params -form $parameter
}
Index: openacs-4/packages/assessment/www/asm-admin/action-params.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/action-params.xql,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/action-params.xql 18 Feb 2005 16:18:49 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/action-params.xql 12 Jun 2006 02:49:51 -0000 1.5
@@ -30,23 +30,15 @@
- select cri.title, sm.as_item_id
+ select cri.title, cri.item_id as as_item_id
from as_item_section_map sm, cr_revisions cri
- where sm.as_item_id = cri.revision_id and sm.section_id in (
- select s.section_id
- from as_sections s, cr_revisions cr, cr_items ci,
- as_assessment_section_map asm,as_item_section_map sm
- where ci.item_id = cr.item_id
- and cr.revision_id = s.section_id
- and s.section_id = asm.section_id
- and asm.assessment_id = :new_assessment_revision)
-
+ where sm.as_item_id = cri.revision_id and sm.section_id = :section_id
- select cri.title, sm.as_item_id
+ select cri.title, cri.item_id as as_item_id
from as_item_section_map sm, cr_revisions cri
where sm.as_item_id = cri.revision_id and sm.section_id in (
select s.section_id
Index: openacs-4/packages/assessment/www/asm-admin/action-select.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/action-select.tcl,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/asm-admin/action-select.tcl 10 Jun 2005 16:11:46 -0000 1.6
+++ openacs-4/packages/assessment/www/asm-admin/action-select.tcl 12 Jun 2006 02:49:51 -0000 1.7
@@ -12,6 +12,7 @@
edit_check:optional
by_item_p:optional
item_id:optional
+ {section_check_p 0}
} -properties {
context:onevalue
title:onevalue
@@ -34,7 +35,11 @@
set context [list [list index [_ assessment.admin]] [list "one-a?assessment_id=$assessment_id" $title] [_ assessment.action_select]]
set title "[_ assessment.action_select]"
-set options [list [list "[_ assessment.immediately]" "i"] [list "[_ assessment.at_the_end]" "aa"] [list "[_ assessment.manually]" "m"]]
+if {$section_check_p} {
+ set options [list [list "On Request" "or"] [list "[_ assessment.at_the_end]" "sa"]]
+} else {
+ set options [list [list "[_ assessment.immediately]" "i"] [list "[_ assessment.at_the_end]" "aa"] [list "[_ assessment.manually]" "m"]]
+}
set actions_list [db_list_of_lists get_actions {} ]
set return_url ""
Index: openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl 7 Apr 2005 23:01:29 -0000 1.6
+++ openacs-4/packages/assessment/www/asm-admin/add-edit-check.tcl 12 Jun 2006 02:49:51 -0000 1.7
@@ -39,8 +39,10 @@
set condition_sql [db_string get_item_id {}]
#parse condition_sql to get item_id
set cond_list [split $condition_sql "="]
- set item_id [lindex [split [lindex $cond_list 2] " "] 0]
-
+ set item_id [lindex [split [lindex $cond_list 2] ")"] 0]
+ set item_id [content::item::get_latest_revision -item_id $item_id]
+
+
} else {
set item_id $as_item_id
}
@@ -49,6 +51,7 @@
set section_id_from $section_id
}
+
set as_item_id $item_id
set as_item_type_id [db_string item_type_id {}]
@@ -127,11 +130,11 @@
} -edit_request {
db_1row get_check_properties {}
- set condition_sql [db_string get_item_id {}]
+ set condition_sql $check_sql
#parse condition_sql to get choice_id
set cond_list [split $condition_sql "="]
- #set condition [string range [lindex $cond_list 1] 0 3]
- set condition [lindex [split [lindex $cond_list 1] " "] 0]
+ set condition [lindex [split [lindex $cond_list 1] ")"] 0]
+ #ad_return_complaint 1 "${condition} $choices"
} -edit_data {
set check_sql [as::assessment::check::get_sql -condition $condition -item_id $item_id]
Index: openacs-4/packages/assessment/www/asm-admin/add-edit-check.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-check.xql,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/add-edit-check.xql 1 Feb 2005 22:00:10 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/add-edit-check.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -33,7 +33,7 @@
- select r.title,c.choice_id
+ select r.title, r.item_id
from as_item_choices c, cr_revisions r
where r.revision_id = c.choice_id
and c.mc_id = :as_item_type_id
Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-oracle.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-oracle.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+ oracle 8.1.6
+
+
+
+
+ declare begin
+ :1 := as_inter_item_check.new (
+ inter_item_check_id => :inter_item_check_id,
+ name => :name,
+ action_p => :action_p,
+ section_id_from => :section_id_from,
+ section_id_to => null,
+ check_sql => :check_sql,
+ description => :description,
+ postcheck_p => :postcheck_p,
+ item_id => null,
+ assessment_id => :assessment_id,
+ creation_user => :user_id,
+ context_id => null,
+ object_type => 'as_inter_item_check',
+ creation_date => :date
+ );
+ end;
+
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-postgresql.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check-postgresql.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+ select as_inter_item_check__new (:inter_item_check_id,
+ :action_p,
+ :section_id_from,
+ null,
+ :check_sql,
+ :name,
+ :description,
+ :postcheck_p,
+ null,
+ :user_id,
+ null,
+ :assessment_id)
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.adp 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,5 @@
+
+ @title@ Triggers
+ @context;noquote@
+
+
Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,94 @@
+# oacs-5-2/packages/assessment/www/asm-admin/add-edit-section-check.tcl
+
+ad_page_contract {
+
+ adds or edits checks bound to sections
+
+ @author Deds Castillo (deds@i-manila.com.ph)
+ @creation-date 2005-07-26
+ @arch-tag: 29e2145c-7bcc-4a3d-b2e7-b43a2e305f7c
+ @cvs-id $Id: add-edit-section-check.tcl,v 1.2 2006/06/12 02:49:51 daveb Exp $
+} {
+ assessment_id:integer
+ section_id:integer,optional
+ inter_item_check_id:optional
+ edit_check:optional
+ by_item_p:optional
+} -properties {
+} -validate {
+} -errors {
+}
+
+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
+set item_id ""
+set return_url ""
+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
+}
+
+set title $assessment_data(title)
+set context [list [list index [_ assessment.admin]] [list "one-a?assessment_id=$assessment_id" $title] "$title Triggers"]
+
+set section_id_from $section_id
+
+set as_item_id $item_id
+
+if {[exists_and_not_null edit_check]} {
+ set return_url "&check_id=$inter_item_check_id&edit_check=t"
+}
+if {[exists_and_not_null by_item_p]} {
+ if {$by_item_p==1} {
+ append return_url "&item_id=$item_id&by_item_p=$by_item_p"
+ } else {
+ append return_url "&by_item_p=$by_item_p"
+ }
+}
+
+ad_form \
+ -name new_check \
+ -export { assessment_id section_id return_url } \
+ -form {
+ inter_item_check_id:key
+ {section_id_from:integer(hidden)
+ {value $section_id_from}
+ }
+ {name:text(text)
+ {label "[_ assessment.Name]"}
+ {help_text "[_ assessment.name_of_trigger]"}
+ }
+ {postcheck_p:boolean(radio)
+ {label "[_ assessment.post_check]"}
+ {options { {"[_ assessment.yes]" t} {"[_ assessment.no]" f}}}
+ {help_text "[_ assessment.help_postcheck_p]"}
+ }
+ {description:text(textarea)
+ {label "[_ assessment.action_description]"}
+ {html {cols 40} {rows 20}}
+ {help_text "[_ assessment.description_trigger]"}
+ }
+ {action_p:text(hidden)
+ {value "t"}
+ }
+ } \
+ -new_data {
+ set user_id [ad_conn user_id]
+ set check_sql "select 1 as perform_p from dual"
+ db_transaction {
+ set date [db_string get_date {select sysdate from dual}]
+ db_exec_plsql new_check {}
+ }
+ } -edit_request {
+ db_1row get_check_properties {}
+ } -edit_data {
+ set check_sql "select 1 as perform_p from dual"
+ db_dml update_check {}
+ } -after_submit {
+ set url [as::assessment::check::add_check_return_url $action_p]
+ ad_returnredirect "${url}?assessment_id=$assessment_id&inter_item_check_id=$inter_item_check_id§ion_id=$section_id_from§ion_check_p=1$return_url"
+}
Index: openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/add-edit-section-check.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ select *
+ from as_inter_item_checks
+ where inter_item_check_id = :inter_item_check_id
+
+
+
+
+
+ update as_inter_item_checks
+ set name = :name,
+ section_id_from = :section_id_from,
+ action_p = :action_p,
+ postcheck_p = :postcheck_p,
+ check_sql = :check_sql
+ where inter_item_check_id = :inter_item_check_id
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/admin-request.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/admin-request.tcl,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/admin-request.tcl 4 Feb 2005 21:14:22 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/admin-request.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -39,17 +39,25 @@
set assessment_query ""
set state_query ""
+if {![acs_user::site_wide_admin_p -user_id [ad_conn user_id]]} {
+ set permission "and c.assessment_id in (select object_id from acs_permissions where grantee_id=:party_id and privilege='admin')"
+}
if {[exists_and_not_null assessment] && $assessment!="all"} {
permission::require_permission -object_id $assessment -privilege admin
- if {[permission::permission_p -object_id $package_id -party_id $party_id -privilege admin] == 0} {
- set permission "and c.assessment_id in (select object_id from acs_permissions where grantee_id=:party_id and privilege='admin')"}
as::assessment::data -assessment_id $assessment
set d_assessment $assessment
set new_assessment_revision $assessment_data(assessment_rev_id)
set assessment_query "and c.section_id_from in (select s.section_id from as_sections s, cr_revisions cr, cr_items ci, as_assessment_section_map asm where ci.item_id = cr.item_id and cr.revision_id = s.section_id and s.section_id = asm.section_id and asm.assessment_id = :new_assessment_revision)"
-}
+} else {
+
+ set assessment_query "and assessment_id in (select ci.item_id as assessment_i
+ from cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision
+ and a.assessment_id = cr.revision_id
+ and ci.parent_id = cf.folder_id and cf.package_id = :package_id)"
+}
if {[exists_and_not_null state]} {
set d_state $state
@@ -181,3 +189,4 @@
}
+
Index: openacs-4/packages/assessment/www/asm-admin/assessment-copy.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-copy.tcl,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/assessment-copy.tcl 2 May 2005 10:11:22 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/assessment-copy.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -36,6 +36,7 @@
{assessment_id:key}
{assessment_title:text(inform) {label "[_ assessment.copy_1]"}}
{name:text,optional {label "[_ assessment.Name]"} {help_text "[_ assessment.Name_help]"}}
+ {new_title:text,optional {label "[_ assessment.Title]"} {help_text "[_ assessment.as_Title_help]"}}
{node_id:text(select) {label "[_ assessment.Target_Community]"} {options $node_options} {help_text "[_ assessment.Target_Community_help]"}}
{confirmation:text(radio) {label " "} {options $confirm_options} {value f}}
} -edit_request {
@@ -45,7 +46,7 @@
} -on_submit {
if {$confirmation} {
set folder_id [as::assessment::folder_id -package_id [site_node::get_object_id -node_id $node_id]]
- set assessment_id [as::assessment::copy -assessment_id $assessment_id -name $name -folder_id $folder_id]
+ set assessment_id [as::assessment::copy -assessment_id $assessment_id -name $name -folder_id $folder_id -new_title $new_title]
}
permission::grant -party_id $user_id -object_id $assessment_id -privilege admin
} -after_submit {
Index: openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl 8 Apr 2005 00:45:36 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/assessment-delete.tcl 12 Jun 2006 02:49:51 -0000 1.4
@@ -31,7 +31,7 @@
ad_form -name assessment_delete_confirm -action assessment-delete -form {
{assessment_id:key}
{assessment_title:text(inform) {label "[_ assessment.remove_1]"}}
- {confirmation:text(radio) {label " "} {options $confirm_options} {value f}}
+ {confirmation:text(radio) {label " "} {options $confirm_options} {value t}}
} -select_query_name {assessment_title} \
-on_submit {
if {$confirmation} {
Index: openacs-4/packages/assessment/www/asm-admin/assessment-form.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-form.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 8 Apr 2005 00:45:56 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/assessment-form.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,7 +1,6 @@
@page_title;noquote@
@context;noquote@
-
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 -N -r1.9 -r1.10
--- openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 29 Apr 2005 21:16:31 -0000 1.9
+++ openacs-4/packages/assessment/www/asm-admin/assessment-form.tcl 12 Jun 2006 02:49:51 -0000 1.10
@@ -7,26 +7,34 @@
assessment_id:integer,optional
{__new_p 0}
{permission_p 0}
+ {edit_p:optional "0"}
+ {type ""}
+ {after "0"}
} -properties {
context:onevalue
page_title:onevalue
}
-
+
if {![info exists assessment_id] || $__new_p} {
set page_title [_ assessment.New_Assessment2]
set s_assessment_id 0
+
} else {
set page_title [_ assessment.Edit_Assessment]
permission::require_permission -object_id $assessment_id -privilege admin
set s_assessment_id 0
db_0or1row rev_id_from_item_id {}
+ if {[empty_string_p $type]} {
+ # Get the assessment data
+ as::assessment::data -assessment_id $assessment_id
+ set type $assessment_data(type)
+ }
}
set package_id [ad_conn package_id]
permission::require_permission -object_id $package_id -privilege create
set context [list [list index [_ assessment.admin]] $page_title]
set package_id [ad_conn package_id]
-set sql_format "YYYY-MM-DD HH24:MI:SS"
set form_format "[lc_get formbuilder_date_format] [lc_get formbuilder_time_format]"
set user_id [ad_conn user_id]
@@ -39,59 +47,174 @@
## {exit_page:text,optional,nospell {label "[_ assessment.Exit_Page]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Exit_Page_help]"}}
-ad_form -name assessment_form -export permission_p -action assessment-form -form {
+ad_form -name assessment_form -export {permission_p after} -action assessment-form -form {
{assessment_id:key}
}
-if {[info exists assessment_id]} {
+if {[info exists assessment_id] && $edit_p } {#
ad_form -extend -name assessment_form -form {
{name:text(inform) {label "#assessment.Name#"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.assessment_Name_help]"}}
}
} else {
- ad_form -extend -name assessment_form -form {
- {name:text,optional,nospell {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.assessment_Name_help]"}}
+ if {$type > 1 } {
+ ad_form -extend -name assessment_form -form {
+ {name:text,optional,nospell {label "[_ assessment.Name]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.assessment_Name_help]"}}
+ }
+ } else {
+ ad_form -extend -name assessment_form -form {
+ {name:text(hidden) {value ""}}
+ }
}
}
ad_form -extend -name assessment_form -form {
{title:text,nospell {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.as_Title_help]"}}
- {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Description_help]"}}
}
+ad_form -extend -name assessment_form -form { {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Description_help]"}}
+}
+
if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} {
category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id $s_assessment_id -form_name assessment_form
}
-ad_form -extend -name assessment_form -form {
- {instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Instructions_help]"}}
- {run_mode:text,optional,nospell {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}} {help_text "[_ assessment.as_Mode_help]"}}
+ad_form -extend -name assessment_form -form {{instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Instructions_help]"}}}
+
+if { $type == 2 } {
+ ad_form -extend -name assessment_form -form {
+ {run_mode:text,optional,nospell {label "[_ assessment.Mode]"} {html {size 25 maxlength 25}} {help_text "[_ assessment.as_Mode_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form { {run_mode:text(hidden) {value {}}} }
}
-if { !$permission_p } {
+
+if { (!$permission_p) } {
ad_form -extend -name assessment_form -form {
{anonymous_p:text(select) {label "[_ assessment.Anonymous_Responses]"} {options $boolean_options} {help_text "[_ assessment.as_Anonymous_help]"} {value f}}
}
} else {
ad_form -extend -name assessment_form -form {
{anonymous_p:text(hidden) {value t}}
}
-
}
-ad_form -extend -name assessment_form -form {{secure_access_p:text(select) {label "[_ assessment.Secure_Access_1]"} {options $boolean_options} {help_text "[_ assessment.as_Secure_Access_help]"}}
- {reuse_responses_p:text(select) {label "[_ assessment.Reuse_Responses_1]"} {options $boolean_options} {help_text "[_ assessment.as_Reuse_Responses_help]"}}
- {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}}
- {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}}
- {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}}
- {return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50 maxlength 50}} {help_text "[_ assessment.as_Return_Url_help]"}}
- {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_Start_Time_help]"}}
- {end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.End_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_End_Time_help]"}}
- {number_tries:integer,optional,nospell {label "[_ assessment.Number_of_Tries]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Number_Tries_help]"}}
- {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 {
+
+if { $type == 2 && [empty_string_p $edit_p]} {
+ ad_form -extend -name assessment_form -form {
+ {secure_access_p:text(select) {label "[_ assessment.Secure_Access_1]"} {options $boolean_options} {help_text "[_ assessment.as_Secure_Access_help]"}}
+ {reuse_responses_p:text(select) {label "[_ assessment.Reuse_Responses_1]"} {options $boolean_options} {help_text "[_ assessment.as_Reuse_Responses_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form {
+ {secure_access_p:text(hidden) {value "f"}}
+ {reuse_responses_p:text(hidden) {value "f"}}
+ }
+}
+
+
+if { ($type == 2 || $type == 5) } {
+ ad_form -extend -name assessment_form -form {
+ {show_item_name_p:text(select) {label "[_ assessment.Show_Item_Name_1]"} {options $boolean_options} {help_text "[_ assessment.as_Show_Item_Name_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form { {show_item_name_p:text(hidden) {value "f"}} }
+}
+
+if { ($type == 2 || $type == 5) } {
+ ad_form -extend -name assessment_form -form {
+ {random_p:text(select) {label "[_ assessment.Allow_Random]"} {options $boolean_options} {help_text "[_ assessment.as_Allow_Random_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form { {random_p:text(hidden) {value "t"}} }
+}
+
+if { ($type == 2 || $type == 3 || $type == 4) } {
+ ad_form -extend -name assessment_form -form {
+ {consent_page:text(textarea),optional,nospell {label "[_ assessment.Consent_Page]"} {html {rows 5 cols 80}} {help_text "[_ assessment.as_Consent_Page_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form { {consent_page:text(hidden) {value ""}} }
+}
+
+if { $type != 5 } {
+ ad_form -extend -name assessment_form -form {
+ {return_url:text,optional,nospell {label "[_ assessment.Return_Url]"} {html {size 50}} {help_text "[_ assessment.as_Return_Url_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form { {return_url:text(hidden) {value {}}} }
+}
+
+
+if { $type == 2 } {
+ ad_form -extend -name assessment_form -form {
+ {start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_Start_Time_help]"}}
+ {end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.End_Time]"} {format $form_format} {help} {help_text "[_ assessment.as_End_Time_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form {
+ {start_time:date(hidden) {value ""}}
+ {end_time:date(hidden) {value ""}}
+ }
+}
+
+if { $type == 2 } {
+ ad_form -extend -name assessment_form -form {
+ {number_tries:integer,optional,nospell {label "[_ assessment.Number_of_Tries]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Number_Tries_help]"}}
+ {wait_between_tries:integer,optional,nospell {label "[_ assessment.Minutes_for_Retry]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_Minutes_Retry_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form {
+ {number_tries:text(hidden) {value ""}}
+ {wait_between_tries:text(hidden) {value ""}}
+ }
+}
+
+if { $type == 2 } {
+ ad_form -extend -name assessment_form -form {
+ {time_for_response:integer,optional,nospell {label "[_ assessment.time_for_response]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.as_time_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form {
+ {time_for_response:text(hidden) {value ""}}
+ }
+}
+
+if { $type == 2 } {
+ ad_form -extend -name assessment_form -form {
+ {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]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form {
+ {ip_mask:text(hidden) {value ""}}
+ {password:text(hidden) {value ""}}
+ }
+}
+
+if { $type == 2 } {
+ ad_form -extend -name assessment_form -form {
+ {show_feedback:text(select),optional {label "[_ assessment.Show_Feedback]"} {options $feedback_options} {help_text "[_ assessment.as_Feedback_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form {
+ {show_feedback:text(hidden) {value ""}}
+ }
+}
+
+if { $type == 2 } {
+ ad_form -extend -name assessment_form -form {
+ {section_navigation:text(select),optional {label "[_ assessment.Section_Navigation]"} {options $navigation_options} {help_text "[_ assessment.as_Navigation_help]"}}
+ }
+} else {
+ ad_form -extend -name assessment_form -form {
+ {section_navigation:text(hidden) {value ""}}
+ }
+}
+
+ad_form -extend -name assessment_form -form {
+ {type:text(hidden) {value $type}}
+}
+
+ad_form -extend -name assessment_form -new_request {
set name ""
set title ""
set description ""
@@ -116,15 +239,15 @@
set section_navigation "default path"
} -edit_request {
db_1row assessment_data {}
-
+
if {![empty_string_p $start_time]} {
set start_time [util::date::acquire ansi $start_time]
}
if {![empty_string_p $end_time]} {
set end_time [util::date::acquire ansi $end_time]
}
} -validate {
- {name {[as::assessment::unique_name -name $name -new_p $__new_p]} "[_ assessment.name_used]"}
+ {name {[as::assessment::unique_name -name $name -new_p $__new_p]} "[_ assessment.name_used] $assessment_id"}
} -on_submit {
if {$start_time == "NULL"} {
set start_time ""
@@ -164,7 +287,8 @@
-ip_mask $ip_mask \
-password $password \
-show_feedback $show_feedback \
- -section_navigation $section_navigation]
+ -section_navigation $section_navigation \
+ -type $type]
set assessment_id [db_string assessment_id_from_revision {}]
@@ -182,6 +306,22 @@
if {![empty_string_p $end_time]} {
db_dml update_end_time {}
}
+ if { $type == 1} {
+ db_transaction {
+ set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id]
+
+ set new_section_id [as::section::new -title [_ assessment.survey_section] ]
+
+ db_dml move_down_sections {}
+ set sort_order [expr $after + 1]
+ db_dml add_section_to_assessment {}
+
+ if {[exists_and_not_null category_ids]} {
+ category::map_object -object_id $new_section_id $category_ids
+ }
+ }
+ }
+
}
} -edit_data {
db_transaction {
@@ -208,7 +348,8 @@
-ip_mask $ip_mask \
-password $password \
-show_feedback $show_feedback \
- -section_navigation $section_navigation]
+ -section_navigation $section_navigation \
+ -type $type]
if {[exists_and_not_null category_ids]} {
category::map_object -object_id $assessment_rev_id $category_ids
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 -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/assessment-form.xql 13 Apr 2005 18:51:19 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/assessment-form.xql 12 Jun 2006 02:49:51 -0000 1.5
@@ -8,7 +8,7 @@
a.anonymous_p, a.secure_access_p, a.reuse_responses_p, a.show_item_name_p, random_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,
- to_char(a.start_time, :sql_format) as start_time, to_char(a.end_time, :sql_format) as end_time
+ 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
from as_assessments a, cr_revisions cr, cr_items ci
where ci.item_id = :assessment_id
and cr.revision_id = ci.latest_revision
@@ -57,4 +57,25 @@
+
+
+
+ update as_assessment_section_map
+ set sort_order = sort_order+1
+ where assessment_id = :new_assessment_rev_id
+ and sort_order > :after
+
+
+
+
+
+
+
+ insert into as_assessment_section_map (assessment_id, section_id,sort_order)
+ values (:new_assessment_rev_id, :new_section_id,:sort_order)
+
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/assessment-new.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-new.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/assessment-new.adp 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,4 @@
+
+@page_title;noquote@
+@context;noquote@
+
\ No newline at end of file
Index: openacs-4/packages/assessment/www/asm-admin/assessment-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/assessment-new.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/assessment-new.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,47 @@
+ad_page_contract {
+ @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net)
+} {
+ assessment_id:integer,optional
+ {type ""}
+ {permission_p ""}
+ {page_title ""}
+} -properties {
+ context:onevalue
+ page_title:onevalue
+}
+
+if {[info exists assessment_id]} {
+
+ # Get the assessment data
+ as::assessment::data -assessment_id $assessment_id
+ set type $assessment_data(type)
+ set page_title [_ assessment.Edit_Assessment]
+ set type $assessment_data(type)
+ append page_title ": $assessment_data(title)"
+
+} else {
+ set page_title [_ assessment.New_Assessment2]
+}
+set context [list [list index [_ assessment.admin]] $page_title]
+
+set types_list [list [list "[_ assessment.type_s]" 1] [list "[_ assessment.type_ea]" 2 ]]
+
+ad_form -name assessment_type -export {assessment_id permission_p} -form {
+ {type:text(radio)
+ {label "[_ assessment.choose_type]"}
+ {options $types_list}
+ {value $type}
+ }
+} -on_submit {
+ if { [exists_and_not_null assessment_id]} {
+ set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id]
+ db_dml update_asm { update as_assessments set type=:type where assessment_id=:new_assessment_rev_id}
+ ad_returnredirect [export_vars -base one-a {assessment_id}]
+ } else {
+ if { ![empty_string_p $permission_p]} {
+ ad_returnredirect [export_vars -base assessment-form {type assessment_id permission_p}]
+ } else {
+ ad_returnredirect [export_vars -base assessment-form {type assessment_id}]
+ }
+ }
+}
\ No newline at end of file
Index: openacs-4/packages/assessment/www/asm-admin/catalog-browse.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/catalog-browse.xql,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/catalog-browse.xql 21 Apr 2005 09:16:56 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/catalog-browse.xql 12 Jun 2006 02:49:51 -0000 1.3
@@ -105,7 +105,7 @@
where m.section_id = :section_id)
and exists (select 1 from as_item_rels ir where item_rev_id =
cr.revision_id and ir.rel_type = 'as_item_display_rel')
- and ao.object_id = ci.item_id
+ and ao.object_id = cr.revision_id
and p.person_id = ao.creation_user
and ir.item_rev_id = cr.revision_id
and ir.target_rev_id = o.object_id
@@ -131,7 +131,7 @@
and i.as_item_id not in (select m.as_item_id
from as_item_section_map m
where m.section_id = :section_id)
- and ao.object_id = ci.item_id
+ and ao.object_id = cr.revision_id
and p.person_id = ao.creation_user
and ir.item_rev_id = cr.revision_id
and ir.target_rev_id = o.object_id
Index: openacs-4/packages/assessment/www/asm-admin/checks-admin.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-admin.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/checks-admin.adp 7 Apr 2005 21:45:23 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/checks-admin.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -2,6 +2,14 @@
@title@ #assessment.Administration#
@context;noquote@
+On Request (section check)
+
+
+
+#assessment.after_this_asm# (section check)
+
+
+
#assessment.after_this_asm#
Index: openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl,v
diff -u -N -r1.8 -r1.9
--- openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl 11 Apr 2005 19:08:59 -0000 1.8
+++ openacs-4/packages/assessment/www/asm-admin/checks-admin.tcl 12 Jun 2006 02:49:51 -0000 1.9
@@ -26,15 +26,16 @@
set show_p 0
set by_item_p 1
set item_p "&item_id=$item_id"
- set item_id_check $item_id
+ set item_id_check $item_id
+ set as_item_id_i [db_string get_item_id { select item_id from cr_revisions where revision_id = :item_id}]
set check_list "and c.inter_item_check_id in ("
set checks [db_list_of_lists get_all_checks { }]
set count 0
foreach check $checks {
set cond_list [split [lindex $check 1] "="]
- set as_item_id [lindex [split [lindex $cond_list 2] " "] 0]
- if { $item_id == $as_item_id} {
+ set as_item_id [lindex [split [lindex $cond_list 2] ")"] 0]
+ if { $as_item_id_i == $as_item_id} {
incr count
append check_list "[lindex $check 0],"
}
@@ -47,6 +48,8 @@
append check_list ")"
}
+db_multirow or_checks get_or_checks {}
+db_multirow sa_checks get_sa_checks {}
db_multirow aa_checks get_aa_checks {}
db_multirow i_checks get_i_checks {}
db_multirow branches get_branches {}
@@ -64,6 +67,94 @@
template::list::create \
+ -name or_checks \
+ -multirow or_checks \
+ -key inter_item_check_id \
+ -bulk_actions {
+ "\#assessment.Delete\#" "confirm-delete" "\#assessment.delete_checked\#"
+ }\
+ -bulk_action_method post \
+ -bulk_action_export_vars {
+ assessment_id
+ section_id
+ {type_check t}
+ item_id_check
+ by_item_p
+ }\
+ -row_pretty_plural "[_ assessment.Assessment] [_ assessment.triggers]" \
+ -elements {
+ name {
+ label "[_ assessment.Name]"
+ display_template {
+ @or_checks.name@
+ }
+ }
+ action_name {
+ label "[_ assessment.action_to_perform]"
+ }
+ counter {
+ display_template {
+
+
+
+
+
+
+
+
+ #assessment.notify_user#
+
+ }
+
+ }
+ }
+
+
+template::list::create \
+ -name sa_checks \
+ -multirow sa_checks \
+ -key inter_item_check_id \
+ -bulk_actions {
+ "\#assessment.Delete\#" "confirm-delete" "\#assessment.delete_checked\#"
+ }\
+ -bulk_action_method post \
+ -bulk_action_export_vars {
+ assessment_id
+ section_id
+ {type_check t}
+ item_id_check
+ by_item_p
+ }\
+ -row_pretty_plural "[_ assessment.Assessment] [_ assessment.triggers]" \
+ -elements {
+ name {
+ label "[_ assessment.Name]"
+ display_template {
+ @sa_checks.name@
+ }
+ }
+ action_name {
+ label "[_ assessment.action_to_perform]"
+ }
+ counter {
+ display_template {
+
+
+
+
+
+
+
+
+ #assessment.notify_user#
+
+ }
+
+ }
+ }
+
+
+template::list::create \
-name aa_checks \
-multirow aa_checks \
-key inter_item_check_id \
@@ -83,7 +174,7 @@
name {
label "[_ assessment.Name]"
display_template {
- @aa_checks.name@
+ @aa_checks.name@
}
}
action_name {
@@ -129,7 +220,7 @@
name {
label "[_ assessment.Name]"
display_template {
- @i_checks.name@
+ @i_checks.name@
}
}
action_name {
@@ -174,7 +265,7 @@
name {
label "[_ assessment.Name]"
display_template {
- @m_checks.name@
+ @m_checks.name@
}
}
action_name {
@@ -209,7 +300,7 @@
name {
label "[_ assessment.Name]"
display_template {
- @branches.name@
+ @branches.name@
}
}
section_id_to {
Index: openacs-4/packages/assessment/www/asm-admin/checks-admin.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-admin.xql,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/checks-admin.xql 2 Feb 2005 16:54:12 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/checks-admin.xql 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,18 @@
+
+
+ select c.check_sql,am.action_perform,c.inter_item_check_id,c.name,a.name as action_name, am.order_by,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'or' and c.action_p = 't'and c.assessment_id=:assessment_id $check_list order by order_by
+
+
+
+
+
+ select c.check_sql,am.action_perform,c.inter_item_check_id,c.name,a.name as action_name, am.order_by,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'sa' and c.action_p = 't'and c.assessment_id=:assessment_id $check_list order by order_by
+
+
+
select c.check_sql,am.action_perform,c.inter_item_check_id,c.name,a.name as action_name, am.order_by,c.section_id_from from as_inter_item_checks c,as_actions a, as_action_map am where am.inter_item_check_id = c.inter_item_check_id and am.action_id=a.action_id and c.section_id_from =:section_id and am.action_perform = 'aa' and c.action_p = 't'and c.assessment_id=:assessment_id $check_list order by order_by
Index: openacs-4/packages/assessment/www/asm-admin/checks-delete-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/checks-delete-oracle.xql,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/checks-delete-oracle.xql 27 Feb 2005 17:07:18 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/checks-delete-oracle.xql 12 Jun 2006 02:49:51 -0000 1.4
@@ -6,7 +6,7 @@
begin
- as_inter_item_check.delete($check_id);
+ as_inter_item_check.del($check_id);
end;
Index: openacs-4/packages/assessment/www/asm-admin/confirm-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/confirm-delete.tcl,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/confirm-delete.tcl 6 May 2005 16:46:54 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/confirm-delete.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -8,9 +8,6 @@
assessment_id
by_item_p:integer
item_id_check:optional
-} -properties {
- title:onevalue
- context:onevalue
}
set inter_item_check_id [split $inter_item_check_id " "]
@@ -20,7 +17,7 @@
as::assessment::data -assessment_id $assessment_id
set title "$assessment_data(title)"
-set context [list [list index [_ assessment.admin]] [list "one-a?assessment_id=$assessment_id" $title] [list "checks-admin?assessment_id=$assessment_id§ion_id=$section_id" "$title [_ assessment.Administration]"] "[_ assessment.trigger_delete]"]
+set context [list [list "one-a?assessment_id=$assessment_id" $title] [list "checks-admin?assessment_id=$assessment_id§ion_id=$section_id" "$title [_ assessment.Administration]"] "[_ assessment.trigger_delete]"]
set title "[_ assessment.trigger_delete]"
Index: openacs-4/packages/assessment/www/asm-admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.adp,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/asm-admin/index.adp 18 Aug 2005 17:33:42 -0000 1.6
+++ openacs-4/packages/assessment/www/asm-admin/index.adp 12 Jun 2006 02:49:51 -0000 1.7
@@ -1,11 +1,10 @@
-@title;noquote@
@context;noquote@
#assessment.admin_categories#
-| #assessment.admin_actions# | #assessment.admin_requests# | #assessment.permissions#
+| #assessment.admin_actions# | #assessment.admin_requests# | #assessment.permissions#
#assessment.admin_requests#
Index: openacs-4/packages/assessment/www/asm-admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.tcl,v
diff -u -N -r1.9 -r1.10
--- openacs-4/packages/assessment/www/asm-admin/index.tcl 17 Feb 2006 12:13:55 -0000 1.9
+++ openacs-4/packages/assessment/www/asm-admin/index.tcl 12 Jun 2006 02:49:51 -0000 1.10
@@ -20,27 +20,36 @@
set folder_id [as::assessment::folder_id -package_id $package_id]
set categories_url [db_string get_category_url {}]
set user_id [ad_conn user_id]
+set sw_admin [acs_user::site_wide_admin_p -user_id $user_id]
set package_admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege "admin"]
-if { $package_admin_p == 0} {
- set m_name "get_all_assessments_admin"
-} else {
- set m_name "get_all_assessments"
-}
-
#form to upload a QTI ZIP file
ad_form -name form_upload_file -action {unzip-file} -html {enctype multipart/form-data} -form {
{zipfile:file {label "[_ assessment.Import_QTI_ZIP_File]"}}
}
-set actions [list "[_ assessment.New_Assessment]" assessment-form "[_ assessment.New_Assessment2]"]
+set actions [list]
+set advanced_options_p [parameter::get -parameter ShowAdvancedOptions -default 1]
+if { $advanced_options_p } {
+ lappend actions "[_ assessment.New_Survey]" {assessment-form?type=1} "[_ assessment.New_Survey]" \
+ "[_ assessment.New_Review_Assessment]" {assessment-form?type=3} "[_ assessment.New_Review_Assessment]" \
+ "[_ assessment.New_Partial_Assessment]" {assessment-form?type=4} "[_ assessment.New_Partial_Assessment]" \
+ "[_ assessment.New_Quick_Assessment]" {assessment-form?type=5} "[_ assessment.New_Quick_Assessment]"
+}
+lappend actions "[_ assessment.New_Assessment]" {assessment-form?type=2} "[_ assessment.New_Assessment2]"
+
+if { $sw_admin && $advanced_options_p } {
+ lappend actions [_ assessment.set_reg_asm] "../admin/set-reg-assessment" [_ assessment.set_reg_asm]
+}
+
if {[ad_permission_p [acs_magic_object "security_context_root"] "admin"]} {
# lappend actions "[_ assessment.Admin_catalog]" "catalog/" "[_ assessment.Admin_catalog]"
}
#get all assessments order by title
-db_multirow -extend { export permissions admin_request} assessments $m_name {} {
+db_multirow -extend { export permissions admin_request} assessments get_all_assessments {} {
+ set title [as::assessment::title -title $title]
set export "[_ assessment.Export]"
set permissions "[_ assessment.permissions]"
set admin_request "[_ assessment.Request] [_ assessment.Administration]"
@@ -60,7 +69,7 @@
-elements {
title {
label "[_ assessment.Title]"
- link_url_eval "[export_vars -base one-a { assessment_id }]"
+ display_template {@assessments.title;noquote@ }
}
export {
label "[_ assessment.Export]"
Index: openacs-4/packages/assessment/www/asm-admin/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/index.xql,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/index.xql 18 Aug 2005 17:33:42 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/index.xql 12 Jun 2006 02:49:51 -0000 1.4
@@ -3,31 +3,19 @@
-
select ci.item_id as assessment_id, cr.title
from cr_items ci, cr_revisions cr
where cr.revision_id = ci.latest_revision
and ci.content_type = 'as_assessments'
and ci.parent_id = :folder_id
+ and exists (select 1 from acs_object_party_privilege_map ppm
+ where ppm.object_id = ci.item_id
+ and ppm.privilege = 'admin'
+ and ppm.party_id = :user_id)
order by cr.title
-
-
-
- select ci.item_id as assessment_id, cr.title
- from cr_items ci, cr_revisions cr
- where cr.revision_id = ci.latest_revision
- and ci.content_type = 'as_assessments'
- and ci.parent_id = :folder_id
- and ci.item_id in (select object_id from acs_permissions where
- grantee_id=:user_id and privilege='admin')
- order by cr.title
-
-
-
-
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl 7 Apr 2005 22:35:43 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-cb.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -8,6 +8,7 @@
section_id:integer
as_item_id:integer
after:integer
+ {type ""}
} -properties {
context:onevalue
page_title:onevalue
@@ -27,8 +28,68 @@
set page_title [_ assessment.add_item_display_cb]
set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set type $assessment_data(type)
+if {$type == 1} {
+ set html_options ""
+ set choice_orientation "vertical"
+ set label_orientation "top"
+ set order_type "order_of_entry"
+ set answer_alignment "besideright"
+ db_transaction {
+ 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]
+ db_dml update_section_in_assessment {}
+ set old_item_id $as_item_id
+
+ if {![db_0or1row item_display {}] || $object_type != "as_item_display_cb"} {
+ set as_item_display_id [as::item_display_cb::new \
+ -html_display_options $html_options \
+ -choice_orientation $choice_orientation \
+ -choice_label_orientation $label_orientation \
+ -sort_order_type $order_type \
+ -item_answer_alignment $answer_alignment]
+
+ if {![info exists object_type]} {
+ # first item display mapped
+ as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel
+ } else {
+ # old item display existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ db_dml update_item_display {}
+ }
+ } else {
+ # old cb item display existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ set as_item_display_id [as::item_display_cb::edit \
+ -as_item_display_id $as_item_display_id \
+ -html_display_options $html_options \
+ -choice_orientation $choice_orientation \
+ -choice_label_orientation $label_orientation \
+ -sort_order_type $order_type \
+ -item_answer_alignment $answer_alignment]
+
+ db_dml update_item_display {}
+ }
+
+ set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0]
+ if {$old_item_id == 0} {
+ db_dml move_down_items {}
+ incr after
+ db_dml insert_new_item {}
+ } else {
+ db_1row item_data {}
+ db_dml update_item {}
+ }
+ }
+ ad_returnredirect [export_vars -base one-a {assessment_id}]\#$as_item_id
+ ad_script_abort
+
+}
+
+
set choice_or_types [list]
foreach choice_or_type [list horizontal vertical] {
lappend choice_or_types [list "[_ assessment.$choice_or_type]" $choice_or_type]
@@ -114,7 +175,7 @@
}
} -after_submit {
# now go to assessment-page
- ad_returnredirect [export_vars -base one-a {assessment_id}]
+ ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id
ad_script_abort
}
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-f.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-f.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-f.adp 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,7 @@
+
+@page_title;noquote@
+@context;noquote@
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-f.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-f.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-f.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,97 @@
+ad_page_contract {
+ Form to add an item with shortanswer display.
+
+ @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net)
+
+} {
+ assessment_id:integer
+ section_id:integer
+ as_item_id:integer
+ after:integer
+} -properties {
+ context:onevalue
+ page_title:onevalue
+}
+
+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 page_title [_ assessment.add_item_display_f]
+set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+
+
+set orientation_types [list]
+foreach orientation_type [list horizontal vertical] {
+ lappend orientation_types [list "[_ assessment.$orientation_type]" $orientation_type]
+}
+
+
+ad_form -name item_add_display_f -action item-add-display-f -export { assessment_id section_id after } -form {
+ {as_item_id:key}
+ {html_options:text,optional,nospell {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}}
+ {abs_size:text,nospell {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.Absolute_Size_help]"} }
+ {box_orientation:text(select) {label "[_ assessment.Box_Orientation]"} {options $orientation_types} {help_text "[_ assessment.Box_Orientation_help]"}}
+} -edit_request {
+ set html_options ""
+ set abs_size "1000"
+ set box_orientation "vertical"
+} -validate {
+ {html_options {[as::assessment::check_html_options -options $html_options]} "[_ assessment.error_html_options]"}
+} -edit_data {
+ db_transaction {
+ 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]
+ db_dml update_section_in_assessment {}
+ set old_item_id $as_item_id
+
+ if {![db_0or1row item_display {}] || $object_type != "as_item_display_f"} {
+ set as_item_display_id [as::item_display_f::new \
+ -html_display_options $html_options \
+ -abs_size $abs_size \
+ -box_orientation $box_orientation]
+
+ if {![info exists object_type]} {
+ # first item display mapped
+ as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel
+ } else {
+ # old item display existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ }
+ } else {
+ # old f item display existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ set as_item_display_id [as::item_display_f::edit \
+ -as_item_display_id $as_item_display_id \
+ -html_display_options $html_options \
+ -abs_size $abs_size \
+ -box_orientation $box_orientation]
+ }
+
+ set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0]
+ if {$old_item_id == 0} {
+ db_dml move_down_items {}
+ incr after
+ db_dml insert_new_item {}
+ } else {
+ db_dml update_item_display {}
+ db_1row item_data {}
+ db_dml update_item {}
+ }
+ }
+} -after_submit {
+ # now go to assessment-page
+ ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id
+ ad_script_abort
+}
+
+ad_return_template
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-f.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-f.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-f.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+ select r.target_rev_id as as_item_display_id, o.object_type
+ from as_item_rels r, acs_objects o
+ where r.item_rev_id = :as_item_id
+ and r.rel_type = 'as_item_display_rel'
+ and o.object_id = r.target_rev_id
+
+
+
+
+
+
+
+ update as_assessment_section_map
+ set section_id = :new_section_id
+ where assessment_id = :new_assessment_rev_id
+ and section_id = :section_id
+
+
+
+
+
+
+
+ update as_item_section_map
+ set sort_order = sort_order+1
+ where section_id = :new_section_id
+ and sort_order > :after
+
+
+
+
+
+
+
+ insert into as_item_section_map
+ (as_item_id, section_id, required_p, sort_order, max_time_to_complete,
+ fixed_position, points)
+ (select :as_item_id as as_item_id, :new_section_id as section_id,
+ required_p, :after as sort_order, max_time_to_complete,
+ 0 as fixed_position, points
+ from as_items
+ where as_item_id = :as_item_id)
+
+
+
+
+
+
+
+ update as_item_rels
+ set target_rev_id = :as_item_display_id
+ where item_rev_id = :as_item_id
+ and rel_type = 'as_item_display_rel'
+
+
+
+
+
+
+
+ select required_p, max_time_to_complete, points
+ from as_items
+ where as_item_id = :as_item_id
+
+
+
+
+
+
+
+ update as_item_section_map
+ set as_item_id = :as_item_id,
+ required_p = :required_p,
+ max_time_to_complete = :max_time_to_complete,
+ points = :points
+ where as_item_id = :old_item_id
+ and section_id = :new_section_id
+
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl 7 Apr 2005 22:36:19 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-rb.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -8,6 +8,7 @@
section_id:integer
as_item_id:integer
after:integer
+ {type ""}
} -properties {
context:onevalue
page_title:onevalue
@@ -20,15 +21,72 @@
# 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 page_title [_ assessment.add_item_display_rb]
set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set type $assessment_data(type)
+if { $type == 1} {
+ set html_options ""
+ set choice_orientation "vertical"
+ set label_orientation "top"
+ set order_type "order_of_entry"
+ set answer_alignment "besideright"
+ db_transaction {
+ 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]
+ db_dml update_section_in_assessment {}
+ set old_item_id $as_item_id
+
+ if {![db_0or1row item_display {}] || $object_type != "as_item_display_rb"} {
+ set as_item_display_id [as::item_display_rb::new \
+ -html_display_options $html_options \
+ -choice_orientation $choice_orientation \
+ -choice_label_orientation $label_orientation \
+ -sort_order_type $order_type \
+ -item_answer_alignment $answer_alignment]
+
+ if {![info exists object_type]} {
+ # first item display mapped
+ as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel
+ } else {
+ # old item display existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ }
+ } else {
+ # old rb item display existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ set as_item_display_id [as::item_display_rb::edit \
+ -as_item_display_id $as_item_display_id \
+ -html_display_options $html_options \
+ -choice_orientation $choice_orientation \
+ -choice_label_orientation $label_orientation \
+ -sort_order_type $order_type \
+ -item_answer_alignment $answer_alignment]
+ }
+
+ set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0]
+ if {$old_item_id == 0} {
+ db_dml move_down_items {}
+ incr after
+ db_dml insert_new_item {}
+ } else {
+ db_dml update_item_display {}
+ db_1row item_data {}
+ db_dml update_item {}
+ }
+ }
+ ad_returnredirect [export_vars -base one-a {assessment_id}]\#$as_item_id
+ ad_script_abort
+}
+
set choice_or_types [list]
foreach choice_or_type [list horizontal vertical] {
lappend choice_or_types [list "[_ assessment.$choice_or_type]" $choice_or_type]
@@ -112,7 +170,7 @@
}
} -after_submit {
# now go to assessment-page
- ad_returnredirect [export_vars -base one-a {assessment_id}]
+ ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id
ad_script_abort
}
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-sa.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-sa.tcl,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/item-add-display-sa.tcl 7 Apr 2005 22:38:57 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-sa.tcl 12 Jun 2006 02:49:51 -0000 1.4
@@ -90,7 +90,7 @@
}
} -after_submit {
# now go to assessment-page
- ad_returnredirect [export_vars -base one-a {assessment_id}]
+ ad_returnredirect [export_vars -base one-a {assessment_id }]&\#$as_item_id
ad_script_abort
}
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl 7 Apr 2005 22:40:43 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-sb.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -8,6 +8,7 @@
section_id:integer
as_item_id:integer
after:integer
+ {type ""}
} -properties {
context:onevalue
page_title:onevalue
@@ -28,8 +29,66 @@
set page_title [_ assessment.add_item_display_sb]
set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set type $assessment_data(type)
set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+if { $type == 1} {
+ set html_options ""
+ set multiple_p f
+ set label_orientation "top"
+ set order_type "order_of_entry"
+ set answer_alignment "besideright"
+
+ db_transaction {
+ 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]
+ db_dml update_section_in_assessment {}
+ set old_item_id $as_item_id
+
+ if {![db_0or1row item_display {}] || $object_type != "as_item_display_sb"} {
+ set as_item_display_id [as::item_display_sb::new \
+ -html_display_options $html_options \
+ -multiple_p $multiple_p \
+ -choice_label_orientation $label_orientation \
+ -sort_order_type $order_type \
+ -item_answer_alignment $answer_alignment]
+
+ if {![info exists object_type]} {
+ # first item display mapped
+ as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_display_id -type as_item_display_rel
+ } else {
+ # old item display existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ }
+ } else {
+ # old sb item display existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ set as_item_display_id [as::item_display_sb::edit \
+ -as_item_display_id $as_item_display_id \
+ -html_display_options $html_options \
+ -multiple_p $multiple_p \
+ -choice_label_orientation $label_orientation \
+ -sort_order_type $order_type \
+ -item_answer_alignment $answer_alignment]
+ }
+
+ set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0]
+ if {$old_item_id == 0} {
+ db_dml move_down_items {}
+ incr after
+ db_dml insert_new_item {}
+ } else {
+ db_dml update_item_display {}
+ db_1row item_data {}
+ db_dml update_item {}
+ }
+ }
+ ad_returnredirect [export_vars -base one-a {assessment_id}]\#$as_item_id
+ ad_script_abort
+
+}
+
set label_or_types [list]
foreach label_or_type [list top left right bottom] {
lappend label_or_types [list "[_ assessment.$label_or_type]" $label_or_type]
@@ -51,13 +110,15 @@
{multiple_p:text(select) {label "[_ assessment.Multiple]"} {options $boolean_options} {help_text "[_ assessment.Multiple_help]"}}
{label_orientation:text(hidden)}
{order_type:text(select) {label "[_ assessment.Order_Type]"} {options $order_types} {help_text "[_ assessment.Order_Type_help]"}}
+ {prepend_empty_p:text(select) {label "[_ assessment.Prepend_Empty_Item]"} {options $boolean_options} {help_text "[_ assessment.lt_Prepend_an_empty_item]"}}
{answer_alignment:text(hidden)}
} -edit_request {
set html_options ""
set multiple_p f
set label_orientation "top"
set order_type "order_of_entry"
set answer_alignment "besideright"
+ set prepend_empty_p f
} -validate {
{html_options {[as::assessment::check_html_options -options $html_options]} "[_ assessment.error_html_options]"}
} -edit_data {
@@ -74,7 +135,8 @@
-multiple_p $multiple_p \
-choice_label_orientation $label_orientation \
-sort_order_type $order_type \
- -item_answer_alignment $answer_alignment]
+ -item_answer_alignment $answer_alignment \
+ -prepend_empty_p $prepend_empty_p]
if {![info exists object_type]} {
# first item display mapped
@@ -92,7 +154,8 @@
-multiple_p $multiple_p \
-choice_label_orientation $label_orientation \
-sort_order_type $order_type \
- -item_answer_alignment $answer_alignment]
+ -item_answer_alignment $answer_alignment \
+ -prepend_empty_p $prepend_empty_p]
}
set old_item_id [as::item::latest -as_item_id $old_item_id -section_id $new_section_id -default 0]
@@ -108,7 +171,7 @@
}
} -after_submit {
# now go to assessment-page
- ad_returnredirect [export_vars -base one-a {assessment_id}]
+ ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id
ad_script_abort
}
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-ta.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-ta.tcl,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/item-add-display-ta.tcl 7 Apr 2005 22:41:26 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-ta.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -92,7 +92,7 @@
}
} -after_submit {
# now go to assessment-page
- ad_returnredirect [export_vars -base one-a {assessment_id}]
+ ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id
ad_script_abort
}
Index: openacs-4/packages/assessment/www/asm-admin/item-add-display-tb.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-display-tb.tcl,v
diff -u -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/item-add-display-tb.tcl 7 Apr 2005 22:41:58 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/item-add-display-tb.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -42,7 +42,7 @@
{answer_alignment:text(hidden)}
} -edit_request {
set html_options ""
- set abs_size 20
+ set abs_size 200
set answer_alignment "besideright"
} -validate {
{html_options {[as::assessment::check_html_options -options $html_options]} "[_ assessment.error_html_options]"}
@@ -90,7 +90,7 @@
}
} -after_submit {
# now go to assessment-page
- ad_returnredirect [export_vars -base one-a {assessment_id}]
+ ad_returnredirect [export_vars -base one-a {assessment_id}]&\#$as_item_id
ad_script_abort
}
Index: openacs-4/packages/assessment/www/asm-admin/item-add-fu.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-fu.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-fu.adp 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,7 @@
+
+@page_title;noquote@
+@context;noquote@
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-add-fu.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-fu.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-fu.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,76 @@
+ad_page_contract {
+ Form to add a short answer item.
+
+ @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net)
+ @creation date 2005-06-23
+} {
+ assessment_id:integer
+ section_id:integer
+ as_item_id:integer
+ after:integer
+} -properties {
+ context:onevalue
+ page_title:onevalue
+}
+
+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 page_title [_ assessment.add_item_type_fu]
+set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+
+
+set display_types [list]
+foreach display_type [db_list display_types {}] {
+ lappend display_types [list "[_ assessment.item_display_$display_type]" $display_type]
+}
+
+
+ad_form -name item_add_fu -action item-add-fu -export { assessment_id section_id after } -form {
+ {as_item_id:key}
+ {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.fu_Title_help]"}}
+ {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}}
+} -edit_request {
+ set title [db_string get_title {} -default ""]
+ set display_type "f"
+} -edit_data {
+ db_transaction {
+ if {![db_0or1row item_type {}] || $object_type != "as_item_type_fu"} {
+ set as_item_type_id [as::item_type_fu::new -title $title ]
+
+ if {![info exists object_type]} {
+ # first item type mapped
+ as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_type_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]
+ db_dml update_item_type {}
+ }
+ } else {
+ # old fu item type existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ set as_item_type_id [as::item_type_fu::edit \
+ -as_item_type_id $as_item_type_id \
+ -title $title \
+ -increasing_p $increasing_p \
+ -allow_negative_p $allow_negative_p]
+
+ db_dml update_item_type {}
+ }
+ }
+} -after_submit {
+ # now go to display-type specific form (i.e. textbox)
+ ad_returnredirect [export_vars -base "item-add-display-$display_type" {assessment_id section_id as_item_id after}]
+ ad_script_abort
+}
+
+ad_return_template
Index: openacs-4/packages/assessment/www/asm-admin/item-add-fu.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-fu.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-fu.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+ select display_type
+ from as_item_types_map
+ where item_type = 'fu'
+
+
+
+
+
+
+
+ select r.target_rev_id as as_item_type_id, o.object_type
+ from as_item_rels r, acs_objects o
+ where r.item_rev_id = :as_item_id
+ and r.rel_type = 'as_item_type_rel'
+ and o.object_id = r.target_rev_id
+
+
+
+
+
+
+
+ update as_item_rels
+ set target_rev_id = :as_item_type_id
+ where item_rev_id = :as_item_id
+ and rel_type = 'as_item_type_rel'
+
+
+
+
+
+
+
+ select r.title
+ from cr_revisions r
+ where r.revision_id = :as_item_id
+
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl,v
diff -u -N -r1.8 -r1.9
--- openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl 7 Apr 2005 22:42:48 -0000 1.8
+++ openacs-4/packages/assessment/www/asm-admin/item-add-mc-choices.tcl 12 Jun 2006 02:49:51 -0000 1.9
@@ -15,6 +15,7 @@
answer_val:array,optional
percent:array,optional
selected:array,optional
+ {type ""}
} -properties {
context:onevalue
page_title:onevalue
@@ -33,9 +34,12 @@
}
set package_id [ad_conn package_id]
+set type $assessment_data(type)
set page_title [_ assessment.add_item_type_mc_choices]
set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+
+
set selected_options [list [list "[_ assessment.yes]" t]]
ad_form -name item_add_mc_choices -action item-add-mc-choices -export { assessment_id section_id after mc_id display_type } -html {enctype multipart/form-data} -form {
@@ -45,11 +49,54 @@
# add form entries for each choice
set ad_form_code "-form \{\n"
set count_correct 0
+
+if { $type == 1} {
+ set max_file_size 10000000
+ # [ad_parameter MaxAttachmentSize]
+ set pretty_max_size [util_commify_number $max_file_size]
+ set folder_id [as::assessment::folder_id -package_id $package_id]
+
+ db_transaction {
+ set count 0
+ foreach choice_id [array names feedback] {
+ set feedback_text $feedback($choice_id)
+ set selected_p [ad_decode [info exists selected($choice_id)] 0 f t]
+ set percent_score $percent($choice_id)
+ set fixed_position $fixed_pos($choice_id)
+ set answer_value $answer_val($choice_id)
+
+ eval set content "\$content_$choice_id"
+ if {![empty_string_p $content]} {
+ set filename [lindex $content 0]
+ set tmp_filename [lindex $content 1]
+ set file_mimetype [lindex $content 2]
+ set n_bytes [file size $tmp_filename]
+
+ if { $n_bytes > $max_file_size && $max_file_size > 0 } {
+ ad_return_complaint 1 "[_ assessment.file_too_large]"
+ return
+ }
+ if { $n_bytes == 0 } {
+ ad_return_complaint 1 "[_ assessment.file_zero_size]"
+ return
+ }
+ set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]]
+ } else {
+ set content_rev_id ""
+ }
+
+ db_dml update_choice_data {}
+ }
+ }
+ ad_returnredirect [export_vars -base "item-add-display-$display_type" {assessment_id section_id as_item_id after}]
+ ad_script_abort
+}
+
db_foreach get_choices {} {
if {$correct_answer_p == "t"} {
- append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \" \"\}\}\n"
+ append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] \$title\"\} \{value \" \"\}\}\n"
} else {
- append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] $title\"\} \{value \" \"\}\}\n"
+ append ad_form_code "\{infotxt.$choice_id:text(inform) \{label \"[_ assessment.Choice] \$title\"\} \{value \" \"\}\}\n"
}
append ad_form_code "\{selected.$choice_id:text(checkbox),optional \{label \"[_ assessment.Default_Selected]\"\} \{options \$selected_options\} \{help_text \"[_ assessment.Default_Selected_help]\"\}\}\n"
append ad_form_code "\{fixed_pos.$choice_id:text,optional,nospell \{label \"[_ assessment.Fixed_Position]\"\} \{html \{size 5 maxlength 5\}\} \{help_text \"[_ assessment.choice_Fixed_Position_help]\"\}\}\n"
@@ -109,7 +156,7 @@
ad_return_complaint 1 "[_ assessment.file_zero_size]"
return
}
- set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [exec uuidgen]]
+ set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]]
} else {
set content_rev_id ""
}
Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.adp,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.adp 6 May 2005 00:36:19 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.adp 12 Jun 2006 02:49:51 -0000 1.4
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.tcl,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.tcl 6 May 2005 00:36:13 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/item-add-mc-existing.tcl 12 Jun 2006 02:49:51 -0000 1.4
@@ -9,7 +9,7 @@
as_item_id:integer
after:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -26,7 +26,7 @@
}
set page_title [_ assessment.add_item_type_mc_existing]
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
set folder_id [as::assessment::folder_id -package_id $package_id]
set choice_sets [db_list_of_lists existing_choice_sets {}]
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 -N -r1.8 -r1.9
--- openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 7 Apr 2005 22:43:23 -0000 1.8
+++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.tcl 12 Jun 2006 02:49:51 -0000 1.9
@@ -33,6 +33,7 @@
set folder_id [as::assessment::folder_id -package_id $package_id]
set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+set type $assessment_data(type)
set correct_options [list [list "[_ assessment.yes]" t]]
set add_existing_link [export_vars -base "item-add-mc-existing" {assessment_id section_id as_item_id after}]
@@ -45,13 +46,29 @@
ad_form -name item_add_mc -action item-add-mc -export { assessment_id section_id after num_choices } -form {
{as_item_id:key}
{title:text {label "[_ assessment.choice_set_title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.mc_Title_help]"}}
+}
+
+if { $type > 1} {
+ad_form -extend -name item_add_mc -form {
{increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}}
{negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}}
{num_correct_answers:text,optional,nospell {label "[_ assessment.num_Correct_Answer]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Correct_help]"}}
+}
+} else {
+ad_form -extend -name item_add_mc -form {
+ {increasing_p:text(hidden) {value ""}}
+ {negative_p:text(hidden) {value ""}}
+ {num_correct_answers:text(hidden) {value ""}}
+}
+}
+
+
+ad_form -extend -name item_add_mc -form {
{num_answers:text,optional,nospell {label "[_ assessment.num_Answers]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Answers_help]"}}
{display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}}
}
+
# add form entries for each choice
set validate_list [list]
set count_correct [array exists correct]
@@ -62,6 +79,8 @@
} else {
append ad_form_code "\{choice.$i:text,optional,nospell \{label \"[_ assessment.Choice] $i\"\} \{html \{size 80 maxlength 1000\}\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n"
}
+
+ if { $type > 1} {
if {[info exists correct($i)]} {
append ad_form_code "\{correct.$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $i\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n"
} else {
@@ -70,6 +89,7 @@
if {[exists_and_not_null num_correct_answers] && $num_correct_answers > 0} {
lappend validate_list "correct.$i {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\""
}
+ }
}
append ad_form_code "\}"
if {[exists_and_not_null mc_id]} {
@@ -79,7 +99,7 @@
set edit_request "{
- set title \"\"
+ set title \[db_string get_title {} -default \"\"\]
set increasing_p f
set negative_p f
set num_correct_answers \"\"
@@ -150,6 +170,7 @@
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_script_abort
}"
Index: openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql 29 Mar 2005 10:53:35 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/item-add-mc.xql 12 Jun 2006 02:49:51 -0000 1.4
@@ -34,4 +34,14 @@
+
+
+
+ select r.title
+ from cr_revisions r
+ where r.revision_id = :as_item_id
+
+
+
+
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 -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl 7 Apr 2005 22:43:53 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/item-add-oq.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -27,6 +27,7 @@
set page_title [_ assessment.add_item_type_oq]
set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set type $assessment_data(type)
set display_types [list]
foreach display_type [db_list display_types {}] {
@@ -37,13 +38,27 @@
ad_form -name item_add_oq -action item-add-oq -export { assessment_id section_id after } -form {
{as_item_id:key}
{title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}}
+}
+
+if { $type > 1} {
+ ad_form -extend -name item_add_oq -form {
{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]"}}
+ }
+} else {
+ ad_form -extend -name item_add_oq -form {
+ {default_value:text(hidden) {value ""}}
+ {feedback:text(hidden) {value ""}}
+ {reference_answer:text(hidden) {value ""}}
+ {keywords:text(hidden) {value ""}}
+ }
+}
+ad_form -extend -name item_add_oq -form {
{display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}}
} -edit_request {
- set title ""
+ set title [db_string get_title {} -default ""]
set default_value ""
set feedback ""
set reference_answer ""
Index: openacs-4/packages/assessment/www/asm-admin/item-add-oq.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-oq.xql,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/item-add-oq.xql 1 Feb 2005 22:00:10 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/item-add-oq.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -34,4 +34,14 @@
+
+
+
+ select r.title
+ from cr_revisions r
+ where r.revision_id = :as_item_id
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl 7 Apr 2005 22:44:33 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/item-add-sa.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -29,6 +29,7 @@
set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+set type $assessment_data(type)
set display_types [list]
foreach display_type [db_list display_types {}] {
@@ -39,11 +40,22 @@
ad_form -name item_add_sa -action item-add-sa -export { assessment_id section_id after } -form {
{as_item_id:key}
{title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.sa_Title_help]"}}
- {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}}
- {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}}
+}
+if { $type > 1} {
+ ad_form -extend -name item_add_sa -form {
+ {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}}
+ {negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}}
+ }
+} else {
+ ad_form -extend -name item_add_sa -form {
+ {increasing_p:text(hidden) {value f}}
+ {negative_p:text(hidden) {value f}}
+ }
+}
+ad_form -extend -name item_add_sa -form {
{display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}}
} -edit_request {
- set title ""
+ set title [db_string get_title {} -default ""]
set increasing_p f
set negative_p f
set display_type "tb"
Index: openacs-4/packages/assessment/www/asm-admin/item-add-sa.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-sa.xql,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/item-add-sa.xql 1 Feb 2005 22:00:10 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/item-add-sa.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -34,4 +34,14 @@
+
+
+
+ select r.title
+ from cr_revisions r
+ where r.revision_id = :as_item_id
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-add-swcat.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-swcat.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-swcat.adp 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,7 @@
+
+ @page_title@
+ @header_stuff@
+ @context@
+ @focus@
+
+
\ No newline at end of file
Index: openacs-4/packages/assessment/www/asm-admin/item-add-swcat.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-swcat.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-swcat.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,83 @@
+#
+
+ad_page_contract {
+
+ Add sitewide category item
+
+ @author Dave Bauer (dave@thedesignexperience.org)
+ @creation-date 2005-05-15
+ @arch-tag: 1aaf171d-3d71-4e10-86e8-66731a80a1a5
+ @cvs-id $Id: item-add-swcat.tcl,v 1.2 2006/06/12 02:49:51 daveb Exp $
+} {
+ assessment_id:integer
+ section_id:integer
+ as_item_id:integer
+ after:integer
+} -properties {
+ context:onevalue
+ page_title:onevalue
+}
+
+
+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 page_title [_ assessment.add_item_type_sa]
+set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set header_stuff ""
+set focus ""
+
+set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+set display_types [as_item_type::get_display_types "swcat"]
+set locale [ad_conn locale]
+set category_trees [db_list_of_lists get_trees ""]
+
+ad_form -name item-add-swcat -export { assessment_id section_id after } -form {
+ {as_item_id:key}
+ {tree_id:text(select) {label "[_ assessment.Category_Tree]"} {options $category_trees} {help_text "[_ assessment.Category_Tree_help]"}}
+ {display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}}
+} -edit_request
+ set tree_id ""
+ set display_type "sb"
+} -edit_data {
+ db_transaction {
+ if {![db_0or1row item_type {}] || $object_type != "as_item_type_swcat"} {
+ set as_item_type_id [as::item_type_sa::new \
+ -tree_id $tree_id]
+
+ if {![info exists object_type]} {
+ # first item type mapped
+ as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_type_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]
+ db_dml update_item_type {}
+ }
+ } else {
+ # old sa item type existing
+ set as_item_id [as::item::new_revision -as_item_id $as_item_id]
+ set as_item_type_id [as::item_type_swcat::edit \
+ -as_item_type_id $as_item_type_id \
+ -tree_id $tree_id]
+
+ db_dml update_item_type {}
+ }
+ }
+} -after_submit {
+ # now go to display-type specific form (i.e. textbox)
+ ad_returnredirect [export_vars -base "item-add-display-$display_type" {assessment_id section_id as_item_id after}]
+ ad_script_abort
+}
+
+ad_return_template
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-add-swcat.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add-swcat.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-add-swcat.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+ select ctt.name, ctt.tree_id
+ from category_tree_translations ctt, category_trees ct
+ where ctt.tree_id=ct.tree_id
+ and ctt.locale=:locale
+
+
+
+
+
+
+
+ select r.target_rev_id as as_item_type_id, o.object_type
+ from as_item_rels r, acs_objects o
+ where r.item_rev_id = :as_item_id
+ and r.rel_type = 'as_item_type_rel'
+ and o.object_id = r.target_rev_id
+
+
+
+
+
+
+
+ update as_item_rels
+ set target_rev_id = :as_item_type_id
+ where item_rev_id = :as_item_id
+ and rel_type = 'as_item_type_rel'
+
+
+
+
+
\ No newline at end of file
Index: openacs-4/packages/assessment/www/asm-admin/item-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add.tcl,v
diff -u -N -r1.7 -r1.8
--- openacs-4/packages/assessment/www/asm-admin/item-add.tcl 15 Apr 2005 17:26:46 -0000 1.7
+++ openacs-4/packages/assessment/www/asm-admin/item-add.tcl 12 Jun 2006 02:49:51 -0000 1.8
@@ -29,6 +29,7 @@
set package_id [ad_conn package_id]
set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+set type $assessment_data(type)
set data_types [list]
foreach data_type [list varchar text integer float date timestamp boolean content_type] {
@@ -41,29 +42,60 @@
}
-ad_form -name item_add -action item-add -export { assessment_id section_id after } -html {enctype multipart/form-data} -form {
+ad_form -name item_add -action item-add -export { assessment_id section_id after type} -html {enctype multipart/form-data} -form {
{as_item_id:key}
{title:text(textarea) {label "[_ assessment.item_Title]"} {html {rows 3 cols 80 maxlength 1000}} {help_text "[_ assessment.item_Title_help]"}}
- {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}}
}
+if { $type > 1} {
+ ad_form -extend -name item_add -form {{description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}}
+ }
+}
if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} {
category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id 0 -form_name item_add
}
+if { $type > 1} {
ad_form -extend -name item_add -form {
{content:file,optional {label "[_ assessment.item_Content]"} {help_text "[_ assessment.item_Content_help]"}}
{subtext:text,optional {label "[_ assessment.Subtext]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.item_Subtext_help]"}}
{field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}}
{field_code:text,optional,nospell {label "[_ assessment.Field_Code]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Code_help]"}}
- {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}}
+}
+}
+ad_form -extend -name item_add -form { {required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}}
+}
+if { $type > 1} {
+ad_form -extend -name item_add -form {
{feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}}
{feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_wrong_help]"}}
{max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.item_time_help]"}}
{points:integer,optional,nospell {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}}
- {data_type:text(select) {label "[_ assessment.Data_Type]"} {options $data_types} {help_text "[_ assessment.Data_Type_help]"}}
+}
+} else {
+ad_form -extend -name item_add -form {
+ {description:text(hidden) {value ""}}
+ {content:text(hidden) {value ""}}
+ {subtext:text(hidden) {value ""}}
+ {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}}
+ {field_code:text(hidden) {value ""}}
+ {feedback_right:text(hidden) {value ""}}
+ {feedback_wrong:text(hidden) {value ""}}
+ {max_time_to_complete:text(hidden) {value ""}}
+ {points:text(hidden) {value ""}}
+ {data_type:text(hidden) {value ""}}
+
+}
+}
+
+if { $type > 1} {
+ad_form -extend -name item_add -form {
+ {data_type:text(select) {label "[_ assessment.Data_Type]"} {options $data_types} {help_text "[_ assessment.Data_Type_help]"}}}
+}
+ad_form -extend -name item_add -form {
{item_type:text(select) {label "[_ assessment.Item_Type]"} {options $item_types} {help_text "[_ assessment.Item_Type_help]"}}
{num_choices:integer,optional,nospell {label "[_ assessment.Num_Choices]"} {html {size 5 maxlength 3}} {help_text "[_ assessment.Num_Choices_help]"}}
+ {validate_block:text(textarea),optional {label "[_ assessment.Validation_Block]"} {help_text "[_ assessment.lt_This_field_is_used_to]"} {html {cols 70 rows 6}}}
} -new_request {
set name ""
set title ""
@@ -79,12 +111,25 @@
set data_type "varchar"
set item_type "sa"
set num_choices 10
+ if { $type == 1} {
+ set num_choices 3
+ }
} -on_submit {
set category_ids [category::ad_form::get_categories -container_object_id $package_id]
if {[empty_string_p $points]} {
set points 0
}
} -new_data {
+ if {[string eq $item_type "sa"]} {
+ set data_type "varchar"
+ } elseif {[string eq $item_type "oq"]} {
+ set data_type "text"
+ } elseif {[string eq $item_type "mc"]} {
+ set data_type "varchar"
+ } elseif {[string eq $item_type "fu"]} {
+ set data_type "file"
+ }
+
db_transaction {
if {![db_0or1row item_exists {}]} {
set as_item_id [as::item::new \
@@ -99,7 +144,8 @@
-feedback_right $feedback_right \
-feedback_wrong $feedback_wrong \
-max_time_to_complete $max_time_to_complete \
- -points $points]
+ -points $points \
+ -validate_block $validate_block]
} else {
set as_item_id [as::item::edit \
-as_item_id $as_item_id \
@@ -113,7 +159,8 @@
-feedback_right $feedback_right \
-feedback_wrong $feedback_wrong \
-max_time_to_complete $max_time_to_complete \
- -points $points]
+ -points $points \
+ -validate_block $validate_block]
db_dml delete_files {}
}
@@ -141,7 +188,7 @@
}
set folder_id [as::assessment::folder_id -package_id $package_id]
- set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [exec uuidgen]]
+ set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]]
as::item_rels::new -item_rev_id $as_item_id -target_rev_id $content_rev_id -type as_item_content_rel
}
}
Index: openacs-4/packages/assessment/www/asm-admin/item-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-delete.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-delete.adp 4 May 2005 19:47:21 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-delete.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-delete.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/item-delete.tcl 4 May 2005 19:47:16 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/item-delete.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -8,7 +8,7 @@
section_id:integer
as_item_id:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -25,15 +25,15 @@
}
set page_title "[_ assessment.remove_item]"
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
set confirm_options [list [list "[_ assessment.continue_with_remove]" t] [list "[_ assessment.cancel_and_return]" f]]
ad_form -name item_delete_confirm -action item-delete -export { assessment_id section_id } -form {
{as_item_id:key}
{item_title:text(inform) {label "[_ assessment.remove_1]"}}
{from:text(inform) {label "[_ assessment.from]"} {value $assessment_data(title)}}
- {confirmation:text(radio) {label " "} {options $confirm_options} {value f}}
+ {confirmation:text(radio) {label " "} {options $confirm_options} {value t}}
} -select_query_name {item_title} -on_submit {
if {$confirmation} {
db_transaction {
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.adp 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,7 @@
+
+@page_title;noquote@
+@context_bar;noquote@
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,89 @@
+ad_page_contract {
+ Form to edit an item with shortanswer display.
+
+ @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net)
+ @cvs-id $Id:
+} {
+ assessment_id:integer
+ section_id:integer
+ as_item_id:integer
+} -properties {
+ context_bar:onevalue
+ page_title:onevalue
+}
+
+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 page_title [_ assessment.edit_item_display_f]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
+
+set orientation_types [list]
+foreach orientation_type [list horizontal vertical] {
+ lappend orientation_types [list "[_ assessment.$orientation_type]" $orientation_type]
+}
+
+
+ad_form -name item_edit_display_f -action item-edit-display-f -export { assessment_id section_id } -form {
+ {as_item_id:key}
+ {html_display_options:text,optional,nospell {label "[_ assessment.Html_Options]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.Html_Options_help]"}}
+ {abs_size:text,nospell {label "[_ assessment.Absolute_Size]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.Absolute_Size_help]"}}
+ {box_orientation:text(select) {label "[_ assessment.Box_Orientation]"} {options $orientation_types} {help_text "[_ assessment.Box_Orientation_help]"}}
+ {as_item_display_id:text(hidden)}
+} -edit_request {
+ db_1row last_used_display_type {}
+ if {![empty_string_p $as_item_display_id]} {
+ db_1row display_type_data {}
+ } else {
+ # default data if display newly mapped
+ set html_display_options ""
+ set abs_size 5
+ set box_orientation "vertical"
+ set as_item_display_id 0
+ }
+} -validate {
+ {html_display_options {[as::assessment::check_html_options -options $html_display_options]} "[_ assessment.error_html_options]"}
+} -edit_data {
+ db_transaction {
+ set new_item_id [as::item::new_revision -as_item_id $as_item_id]
+
+ if {$as_item_display_id} {
+ # edit existing display type
+ set new_item_display_id [as::item_display_f::edit \
+ -as_item_display_id $as_item_display_id \
+ -html_display_options $html_display_options \
+ -abs_size $abs_size \
+ -box_orientation $box_orientation]
+ } else {
+ # create new display type
+ set new_item_display_id [as::item_display_f::new \
+ -html_display_options $html_display_options \
+ -abs_size $abs_size \
+ -box_orientation $box_orientation]
+ }
+
+ 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_display_of_item {}
+ }
+ set as_item_id $new_item_id
+ set section_id $new_section_id
+} -after_submit {
+ ad_returnredirect [export_vars -base "item-edit" {assessment_id section_id as_item_id}]
+ ad_script_abort
+}
+
+ad_return_template
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-f.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+ select max(d.as_item_display_id) as as_item_display_id
+ from cr_revisions r, as_item_rels ir, cr_revisions r2, as_item_display_f d
+ where r.revision_id = :as_item_id
+ and r2.item_id = r.item_id
+ and ir.item_rev_id = r2.revision_id
+ and ir.rel_type = 'as_item_display_rel'
+ and d.as_item_display_id = ir.target_rev_id
+
+
+
+
+
+
+
+ select d.html_display_options, d.abs_size, d.box_orientation
+ from cr_revisions r, as_item_display_f d
+ where r.revision_id = d.as_item_display_id
+ and d.as_item_display_id = :as_item_display_id
+
+
+
+
+
+
+
+ update as_assessment_section_map
+ set section_id = :new_section_id
+ where assessment_id = :new_assessment_rev_id
+ and section_id = :section_id
+
+
+
+
+
+
+
+ update as_item_section_map
+ set as_item_id = :new_item_id
+ where section_id = :new_section_id
+ and as_item_id = :as_item_id
+
+
+
+
+
+
+
+ update as_item_rels
+ set target_rev_id = :new_item_display_id
+ where item_rev_id = :new_item_id
+ and rel_type = 'as_item_display_rel'
+
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.adp 6 May 2005 00:27:30 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.tcl,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.tcl 6 May 2005 00:27:17 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sa.tcl 12 Jun 2006 02:49:51 -0000 1.4
@@ -8,7 +8,7 @@
section_id:integer
as_item_id:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -25,7 +25,7 @@
}
set page_title [_ assessment.edit_item_display_sa]
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
set orientation_types [list]
foreach orientation_type [list horizontal vertical] {
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl,v
diff -u -N -r1.7 -r1.8
--- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl 7 Apr 2005 22:45:54 -0000 1.7
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.tcl 12 Jun 2006 02:49:51 -0000 1.8
@@ -52,6 +52,7 @@
{choice_label_orientation:text(hidden)}
{sort_order_type:text(select) {label "[_ assessment.Order_Type]"} {options $order_types} {help_text "[_ assessment.Order_Type_help]"}}
{item_answer_alignment:text(hidden)}
+ {prepend_empty_p:text(select) {label "[_ assessment.Prepend_Empty_Item]"} {options $boolean_options} {help_text "[_ assessment.lt_Prepend_an_empty_item]"}}
{as_item_display_id:text(hidden)}
} -edit_request {
db_1row last_used_display_type {}
@@ -65,6 +66,7 @@
set sort_order_type "order_of_entry"
set item_answer_alignment "besideright"
set as_item_display_id 0
+ set prepend_empty_p f
}
} -validate {
{html_display_options {[as::assessment::check_html_options -options $html_display_options]} "[_ assessment.error_html_options]"}
@@ -80,15 +82,17 @@
-multiple_p $multiple_p \
-choice_label_orientation $choice_label_orientation \
-sort_order_type $sort_order_type \
- -item_answer_alignment $item_answer_alignment]
+ -item_answer_alignment $item_answer_alignment \
+ -prepend_empty_p $prepend_empty_p]
} else {
# create new display type
set new_item_display_id [as::item_display_sb::new \
-html_display_options $html_display_options \
-multiple_p $multiple_p \
-choice_label_orientation $choice_label_orientation \
-sort_order_type $sort_order_type \
- -item_answer_alignment $item_answer_alignment]
+ -item_answer_alignment $item_answer_alignment \
+ -prepend_empty_p $prepend_empty_p]
}
set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id]
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.xql,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.xql 1 Feb 2005 22:00:10 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-sb.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -19,7 +19,7 @@
select d.html_display_options, d.multiple_p, d.choice_label_orientation,
- d.sort_order_type, d.item_answer_alignment
+ d.sort_order_type, d.item_answer_alignment, d.prepend_empty_p
from cr_revisions r, as_item_display_sb d
where r.revision_id = d.as_item_display_id
and d.as_item_display_id = :as_item_display_id
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.adp 5 May 2005 18:55:30 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.tcl 5 May 2005 18:55:52 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-display-ta.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -8,7 +8,7 @@
section_id:integer
as_item_id:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -25,7 +25,7 @@
}
set page_title [_ assessment.edit_item_display_ta]
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
set alignment_types [list]
foreach alignment_type [list besideleft besideright below above] {
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-fu.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-fu.adp,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-fu.adp 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,7 @@
+
+@page_title;noquote@
+@context;noquote@
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-fu.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-fu.tcl,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-fu.tcl 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,61 @@
+ad_page_contract {
+ Form to edit a short answer item.
+
+ @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net)
+
+} {
+ assessment_id:integer
+ section_id:integer
+ as_item_id:integer
+} -properties {
+ context:onevalue
+ page_title:onevalue
+}
+
+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 page_title [_ assessment.edit_item_type_fu]
+set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
+
+set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+
+
+ad_form -name item_edit_fu -action item-edit-fu -export { assessment_id section_id } -form {
+ {as_item_id:key}
+ {title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}}
+} -edit_request {
+ db_1row item_type_data {}
+} -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_fu::edit \
+ -as_item_type_id $as_item_type_id \
+ -title $title]
+
+ 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 {}
+ }
+ set as_item_id $new_item_id
+ set section_id $new_section_id
+} -after_submit {
+ ad_returnredirect [export_vars -base "item-edit" {assessment_id section_id as_item_id}]
+ ad_script_abort
+}
+
+ad_return_template
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-fu.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-fu.xql,v
diff -u -N
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-fu.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+ select r.title
+ from cr_revisions r, as_item_rels ir, as_item_type_fu i
+ where r.revision_id = i.as_item_type_id
+ and i.as_item_type_id = ir.target_rev_id
+ and ir.item_rev_id = :as_item_id
+ and ir.rel_type = 'as_item_type_rel'
+
+
+
+
+
+
+
+ select target_rev_id
+ from as_item_rels
+ where item_rev_id = :new_item_id
+ and rel_type = 'as_item_type_rel'
+
+
+
+
+
+
+
+ update as_assessment_section_map
+ set section_id = :new_section_id
+ where assessment_id = :new_assessment_rev_id
+ and section_id = :section_id
+
+
+
+
+
+
+
+ update as_item_section_map
+ set as_item_id = :new_item_id
+ where section_id = :new_section_id
+ and as_item_id = :as_item_id
+
+
+
+
+
+
+
+ update as_item_rels
+ set target_rev_id = :new_item_type_id
+ where item_rev_id = :new_item_id
+ and rel_type = 'as_item_type_rel'
+
+
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl,v
diff -u -N -r1.7 -r1.8
--- openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl 15 Apr 2005 17:26:46 -0000 1.7
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-general.tcl 12 Jun 2006 02:49:51 -0000 1.8
@@ -29,6 +29,7 @@
set package_id [ad_conn package_id]
set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+set type $assessment_data(type)
set item_type [string range [db_string get_item_type {}] end-1 end]
set display_types [list]
@@ -40,8 +41,11 @@
ad_form -name item_edit_general -action item-edit-general -export { assessment_id section_id } -html {enctype multipart/form-data} -form {
{as_item_id:key}
{title:text(textarea) {label "[_ assessment.Title]"} {html {rows 3 cols 80}} {help_text "[_ assessment.item_Title_help]"}}
- {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}}
}
+if { $type > 1} {
+ ad_form -extend -name item_edit_general -form {
+ {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.item_Description_help]"}}
+ }
if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} {
category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id $as_item_id -form_name item_edit_general
@@ -52,20 +56,43 @@
{delete_content:text(checkbox),optional {label "[_ assessment.item_Delete_Content]"} {options {{{$content_name } t}} }}
}
}
-
+}
+if { $type > 1} {
ad_form -extend -name item_edit_general -form {
{content:file,optional {label "[_ assessment.item_Content]"} {help_text "[_ assessment.item_Content_help]"}}
{subtext:text,optional {label "[_ assessment.Subtext]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.item_Subtext_help]"}}
{field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}}
{field_code:text,optional,nospell {label "[_ assessment.Field_Code]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Code_help]"}}
+}
+}
+ad_form -extend -name item_edit_general -form {
{required_p:text(select) {label "[_ assessment.Required]"} {options $boolean_options} {help_text "[_ assessment.item_Required_help]"}}
+}
+if { $type > 1} {
+ad_form -extend -name item_edit_general -form {
{feedback_right:text(textarea),optional {label "[_ assessment.Feedback_right]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_right_help]"}}
{feedback_wrong:text(textarea),optional {label "[_ assessment.Feedback_wrong]"} {html {rows 5 cols 80}} {help_text "[_ assessment.Feedback_wrong_help]"}}
{max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.item_time_help]"}}
{points:integer,optional,nospell {label "[_ assessment.points_item]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_item_help]"}}
+}
+} else {
+ad_form -extend -name item_edit_general -form {
+ {description:text(hidden) {value ""}}
+ {content:text(hidden) {value ""}}
+ {subtext:text(hidden) {value ""}}
+ {field_name:text,optional,nospell {label "[_ assessment.Field_Name]"} {html {size 80 maxlength 500}} {help_text "[_ assessment.Field_Name_help]"}}
+ {field_code:text(hidden) {value ""}}
+ {feedback_right:text(hidden) {value ""}}
+ {max_time_to_complete:text(hidden) {value ""}}
+ {feedback_wrong:text(hidden) {value ""}}
+ {points:text(hidden) ""}
+}
+}
+ad_form -extend -name item_edit_general -form {
{data_type_disp:text(inform) {label "[_ assessment.Data_Type]"} {help_text "[_ assessment.Data_Type_help]"}}
{data_type:text(hidden)}
{display_type:text(select) {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.Display_Type_help]"}}
+ {validate_block:text(textarea),optional {label "[_ assessment.Validation_Block]"} {help_text "[_ assessment.lt_This_field_is_used_to]"} {html {cols 70 rows 6}}}
} -edit_request {
db_1row general_item_data {}
if {[empty_string_p $data_type]} {
@@ -93,7 +120,8 @@
-feedback_right $feedback_right \
-feedback_wrong $feedback_wrong \
-max_time_to_complete $max_time_to_complete \
- -points $points]
+ -points $points \
+ -validate_block $validate_block]
if {[exists_and_not_null category_ids]} {
category::map_object -object_id $new_item_id $category_ids
@@ -116,10 +144,13 @@
ad_return_complaint 1 "[_ assessment.file_zero_size]"
return
}
-
set folder_id [as::assessment::folder_id -package_id $package_id]
- set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [exec uuidgen]]
- db_dml update_item_content {}
+ set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]]
+ # delete content association if it exists then insert a new one
+ # otherwise we can't add a file on edit that did not exist
+ # when the question was originally created
+ db_dml delete_item_content {}
+ db_dml insert_item_content {}
} elseif {[info exists delete_content]} {
db_dml delete_item_content {}
}
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-general.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-general.xql,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-edit-general.xql 15 Apr 2005 17:26:46 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-general.xql 12 Jun 2006 02:49:51 -0000 1.3
@@ -40,7 +40,7 @@
select r.title, r.description, i.subtext, i.field_name, i.field_code, i.required_p,
- i.feedback_right, i.feedback_wrong, i.max_time_to_complete, i.data_type, i.points
+ i.feedback_right, i.feedback_wrong, i.max_time_to_complete, i.data_type, i.points, i.validate_block
from cr_revisions r, as_items i
where r.revision_id = i.as_item_id
and i.as_item_id = :as_item_id
@@ -60,6 +60,15 @@
+
+
+ insert into as_item_rels
+ (target_rev_id, item_rev_id, rel_type)
+ values
+ (:content_rev_id, :new_item_id, 'as_item_content_rel')
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-delete.tcl,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-delete.tcl 6 May 2005 15:45:34 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-delete.tcl 12 Jun 2006 02:49:51 -0000 1.4
@@ -13,7 +13,6 @@
section_id:integer,notnull
as_item_id:integer,notnull
choice_id:integer,notnull
- mc_id:integer,notnull
}
set package_id [ad_conn package_id]
@@ -24,6 +23,9 @@
set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id]
set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id]
set new_item_id [as::item::new_revision -as_item_id $as_item_id]
+ # HAM : querried the mc_id for the given choice id
+ set mc_id [db_string "get_mc_id" "select mc_id from as_item_choices where choice_id=:choice_id"]
+ # ***********
set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id -with_choices_p f]
db_dml update_section_in_assessment {}
db_dml update_item_in_section {}
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-swap.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-swap.tcl,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-swap.tcl 2 Feb 2005 21:31:15 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices-swap.tcl 12 Jun 2006 02:49:51 -0000 1.3
@@ -32,6 +32,7 @@
set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id]
set new_section_id [as::section::new_revision -section_id $section_id -assessment_id $assessment_id]
set new_item_id [as::item::new_revision -as_item_id $as_item_id]
+ as::assessment::check::copy_item_checks -assessment_id $assessment_id -section_id $new_section_id -as_item_id $as_item_id -new_item_id $new_item_id
set new_mc_id [as::item_type_mc::new_revision -as_item_type_id $mc_id]
db_dml update_section_in_assessment {}
db_dml update_item_in_section {}
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.adp 6 May 2005 00:30:14 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
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 -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl 6 May 2005 00:30:08 -0000 1.6
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-choices.tcl 12 Jun 2006 02:49:51 -0000 1.7
@@ -15,7 +15,7 @@
percent:array,optional
selected:array,optional
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -33,7 +33,7 @@
set package_id [ad_conn package_id]
set page_title [_ assessment.edit_item_type_mc_choices]
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
set selected_options [list [list "[_ assessment.yes]" t]]
@@ -124,7 +124,7 @@
ad_return_complaint 1 "[_ assessment.file_zero_size]"
return
}
- set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [exec uuidgen]]
+ set content_rev_id [cr_import_content -title $filename $folder_id $tmp_filename $n_bytes $file_mimetype [as::item::generate_unique_name]]
db_dml update_choice_content {}
} elseif {[info exists delete_content($choice_id)]} {
db_dml delete_choice_content {}
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.adp 6 May 2005 00:39:30 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.tcl,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.tcl 6 May 2005 00:39:14 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc-existing.tcl 12 Jun 2006 02:49:51 -0000 1.3
@@ -8,7 +8,7 @@
section_id:integer
as_item_id:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -25,7 +25,7 @@
}
set page_title [_ assessment.add_item_type_mc_existing]
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
set folder_id [as::assessment::folder_id -package_id $package_id]
set choice_sets [db_list_of_lists existing_choice_sets {}]
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 -N -r1.8 -r1.9
--- openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 5 May 2005 19:25:08 -0000 1.8
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-mc.tcl 12 Jun 2006 02:49:51 -0000 1.9
@@ -10,7 +10,6 @@
choice:optional,array
correct:optional,array
{num_choices:integer,optional 5}
- {old_choices:optional}
} -properties {
context:onevalue
page_title:onevalue
@@ -38,13 +37,28 @@
set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
set correct_options [list [list "[_ assessment.yes]" t]]
+set type $assessment_data(type)
+
ad_form -name item_edit_mc -action item-edit-mc -export { assessment_id section_id num_choices } -form {
{as_item_id:key}
{title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.mc_Title_help]"}}
+}
+
+if {$type > 1} {
+ ad_form -extend -name item_edit_mc -form {
{increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}}
{negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}}
{num_correct_answers:text,optional,nospell {label "[_ assessment.num_Correct_Answer]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Correct_help]"}}
+ }
+} else {
+ ad_form -extend -name item_edit_mc -form {
+ {increasing_p:text(hidden) {value ""}}
+ {negative_p:text(hidden) {value ""}}
+ {num_correct_answers:text(hidden) {value ""}}
+ }
+}
+ad_form -extend -name item_edit_mc -form {
{num_answers:text,optional,nospell {label "[_ assessment.num_Answers]"} {html {size 5 maxlength 5}} {help_text "[_ assessment.num_Answers_help]"}}
}
@@ -55,7 +69,6 @@
set count 0
set validate_list [list]
set count_correct [array exists correct]
-set old_choices [list]
foreach one_choice $choices {
util_unlist $one_choice choice_title choice_id choice_correct_p
incr count
@@ -67,40 +80,41 @@
}
append ad_form_code "\{choice.$choice_id:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice($choice_id)\"\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n"
+ if { $type > 1} {
if {[info exists correct($choice_id)]} {
append ad_form_code "\{correct.$choice_id:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n"
} 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\]\""
- lappend old_choices $choice_id
+ # lappend validate_list "correct.$choice_id {\$count_correct > 0} \"\[_ assessment.one_correct_choice_req\]\""
+ }
}
-append ad_form_code "\{old_choices:text(hidden) \{value $old_choices\}\}\n"
-if {[template::form get_action item_show_mc] == "more"} {
- # add new empty form entries for new choices
- for {set i 1} {$i <= $num_choices} {incr i} {
- incr count
- if {[info exists choice($i)]} {
- append ad_form_code "\{choice.$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice($i)\"\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n"
- } else {
- append ad_form_code "\{choice.$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n"
- }
- if {[info exists correct($i)]} {
- append ad_form_code "\{correct.$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n"
- } else {
- append ad_form_code "\{correct.$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n"
- }
+# add new empty form entries for new choices
+for {set i 1} {$i <= $num_choices} {incr i} {
+ incr count
+ if {[info exists choice(_$i)]} {
+ append ad_form_code "\{choice._$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{value \"\$choice(_$i)\"\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n"
+ } else {
+ append ad_form_code "\{choice._$i:text,optional,nospell \{label \"[_ assessment.Choice] $count\"\} \{html \{size 80 maxlength 1000\}\} \{help_text \"[_ assessment.Choice_help]\"\}\}\n"
}
+ if { $type > 1} {
+ if {[info exists correct(_$i)]} {
+ append ad_form_code "\{correct._$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{values t\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n"
+ } else {
+ append ad_form_code "\{correct._$i:text(checkbox),optional \{label \"[_ assessment.Correct_Answer_Choice] $count\"\} \{options \$correct_options\} \{help_text \"[_ assessment.Correct_Answer_help]\"\}\}\n"
+ }
+ }
}
append ad_form_code "\}"
eval ad_form -extend -name item_edit_mc $ad_form_code
+
set edit_request "{
db_1row item_type_data {}
}"
-set on_submit "{
+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
@@ -110,7 +124,6 @@
}"
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 {}\]
@@ -132,21 +145,24 @@
db_dml update_item_in_section {}
db_dml update_item_type {}
- set count 0
- set new_count \[llength \$old_choices\]
- foreach i \[array names choice\] {
- if {\[lsearch \$old_choices \$i\] != -1 } {
- # old_choices preserves the prior order
- set count \[expr \[lsearch \$old_choices \$i\] + 1\]
- # edit existing choices
+ # edit existing choices
+ set count 0
+ foreach i \[lsort \[array names choice\]\] {
+ if {\[string range \$i 0 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\]
db_dml update_title {}
db_dml update_correct_and_sort_order {}
- } elseif { !\[empty_string_p \$choice(\$i)\] } {
- # add new choices
- incr new_count
+ }
+ }
+
+ # add new choices
+ foreach i \[lsort \[array names choice\]\] {
+
+ if {\[string range \$i 0 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 \"\" \\
@@ -155,7 +171,7 @@
-feedback_text \"\" \\
-selected_p \"\" \\
-correct_answer_p \[ad_decode \[info exists correct(\$i)\] 0 f t\] \\
- -sort_order \$new_count \\
+ -sort_order \$count \\
-percent_score \"\"\]
}
}
@@ -171,7 +187,6 @@
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
-eval ad_form -extend -name item_edit_mc -validate "{$validate_list}" -edit_request $edit_request -edit_data $edit_data -after_submit $after_submit
+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.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-oq.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-edit-oq.adp 6 May 2005 00:32:51 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-oq.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
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 -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl 6 May 2005 00:32:45 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-oq.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -8,7 +8,7 @@
section_id:integer
as_item_id:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -25,17 +25,35 @@
}
set page_title [_ assessment.edit_item_type_oq]
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
+set type $assessment_data(type)
+
+
ad_form -name item_edit_oq -action item-edit-oq -export { assessment_id section_id } -form {
{as_item_id:key}
{title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}}
+}
+
+if { $type > 1} {
+ ad_form -extend -name item_edit_oq -form {
{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 {
+ }
+} else {
+ ad_form -extend -name item_edit_oq -form {
+ {default_value:text(hidden) {value ""}}
+ {feedback_text:text(hidden) {value ""}}
+ {reference_answer:text(hidden) {value ""}}
+ {keywords:text(hidden) {value ""}}
+ }
+
+}
+
+ad_form -extend -name item_edit_oq -edit_request {
db_1row item_type_data {}
set keywords [join $keywords "\n"]
} -on_submit {
Index: openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl 7 Apr 2005 22:49:52 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/item-edit-sa.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -28,14 +28,27 @@
set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] [list [export_vars -base item-edit {assessment_id section_id as_item_id}] [_ assessment.edit_item]] $page_title]
set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+set type $assessment_data(type)
ad_form -name item_edit_sa -action item-edit-sa -export { assessment_id section_id } -form {
{as_item_id:key}
{title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.oq_Title_help]"}}
- {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}}
- {allow_negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}}
-} -edit_request {
+}
+if { $type > 1} {
+ ad_form -extend -name item_edit_sa -form {
+ {increasing_p:text(select) {label "[_ assessment.Increasing]"} {options $boolean_options} {help_text "[_ assessment.Increasing_help]"}}
+ {allow_negative_p:text(select) {label "[_ assessment.Allow_Negative]"} {options $boolean_options} {help_text "[_ assessment.Allow_Negative_help]"}}
+ }
+} else {
+ ad_form -extend -name item_edit_sa -form {
+ {increasing_p:text(hidden) {value ""}}
+ {allow_negative_p:text(hidden) {value ""}}
+
+ }
+}
+
+ad_form -extend -name item_edit_sa -edit_request {
db_1row item_type_data {}
} -edit_data {
db_transaction {
Index: openacs-4/packages/assessment/www/asm-admin/item-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-edit.tcl,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/asm-admin/item-edit.tcl 15 Apr 2005 17:26:46 -0000 1.6
+++ openacs-4/packages/assessment/www/asm-admin/item-edit.tcl 12 Jun 2006 02:49:51 -0000 1.7
@@ -33,6 +33,9 @@
set item_type [string range [db_string item_type {}] end-1 end]
set display_type [string range [db_string display_type {}] end-1 end]
+if {[string eq $display_type "_f"]} {
+ set display_type f
+}
ad_form -name item_edit -mode display -action item-edit-general -export { assessment_id section_id as_item_id } -form {
{title:text(textarea) {label "[_ assessment.Title]"} {html {rows 3 cols 80}} {value $title} {help_text "[_ assessment.item_Title_help]"}}
Index: openacs-4/packages/assessment/www/asm-admin/item-swap-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-swap-postgresql.xql,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/item-swap-postgresql.xql 1 Feb 2005 22:00:10 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/item-swap-postgresql.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -2,6 +2,8 @@
postgresql 7.1
+
+
update as_item_section_map
Index: openacs-4/packages/assessment/www/asm-admin/item-swap.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-swap.tcl,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/item-swap.tcl 2 Feb 2005 21:31:15 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/item-swap.tcl 12 Jun 2006 02:49:51 -0000 1.3
@@ -19,7 +19,7 @@
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
-
+db_1row get_item_id {}
if { $direction=="up" } {
set next_sort_order [expr { $sort_order - 1 }]
} else {
@@ -36,4 +36,4 @@
ad_script_abort
}
-ad_returnredirect [export_vars -base one-a {assessment_id}]
+ad_returnredirect [export_vars -base one-a {assessment_id}]\#$as_item_id
Index: openacs-4/packages/assessment/www/asm-admin/item-swap.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-swap.xql,v
diff -u -N -r1.1 -r1.2
--- openacs-4/packages/assessment/www/asm-admin/item-swap.xql 1 Feb 2005 22:00:10 -0000 1.1
+++ openacs-4/packages/assessment/www/asm-admin/item-swap.xql 12 Jun 2006 02:49:51 -0000 1.2
@@ -12,4 +12,10 @@
+
+
+ select as_item_id from as_item_section_map where sort_order=:sort_order and section_id=:section_id
+
+
+
Index: openacs-4/packages/assessment/www/asm-admin/one-a.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/one-a.adp,v
diff -u -N -r1.12 -r1.13
--- openacs-4/packages/assessment/www/asm-admin/one-a.adp 9 Jun 2005 19:19:48 -0000 1.12
+++ openacs-4/packages/assessment/www/asm-admin/one-a.adp 12 Jun 2006 02:49:51 -0000 1.13
@@ -1,21 +1,30 @@
-@p_title@
+@p_title;noquote@
@context;noquote@
-#assessment.Created_by# @assessment_data.creator_name@ #assessment.on_creation_date# - #assessment.history#
+
-
- #assessment.Assessment_Title#:#assessment.Description#:
#assessment.Instructions#:
+ #assessment.Assessment_Title#: #assessment.Description#:
#assessment.Instructions#:
#assessment.Type#:
- #assessment.Edit#
- @assessment_data.title@ @is_reg_asm_p@
+ @assessment_data.title;noquote@
+ #assessment.Edit#
+ @is_reg_asm_p@
+
#assessment.None# @assessment_data.description;noquote@
-
#assessment.None# @assessment_data.instructions;noquote@
+ #assessment.Edit#
+
+ #assessment.None# @assessment_data.instructions;noquote@
+ #assessment.Edit#
+
#assessment.None# #assessment.type_s# #assessment.type_ea# #assessment.Edit#
+
#assessment.View_Responses#
@@ -91,7 +100,7 @@
-
+
#assessment.add_section_first#
@@ -101,30 +110,23 @@
Index: openacs-4/packages/assessment/www/asm-admin/one-a.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/one-a.tcl,v
diff -u -N -r1.10 -r1.11
--- openacs-4/packages/assessment/www/asm-admin/one-a.tcl 9 Jun 2005 19:19:48 -0000 1.10
+++ openacs-4/packages/assessment/www/asm-admin/one-a.tcl 12 Jun 2006 02:49:51 -0000 1.11
@@ -23,14 +23,15 @@
set admin_p [acs_user::site_wide_admin_p]
# Get the assessment data
as::assessment::data -assessment_id $assessment_id
-set context [list [list index [_ assessment.admin]] $assessment_data(title)]
+set title [as::assessment::title -title $assessment_data(title)]
+set context [list [list index [_ assessment.admin]] $title]
set assessment_rev_id $assessment_data(assessment_rev_id)
set subsite_id [subsite::main_site_id]
set url [apm_package_url_from_id $subsite_id]
set anonymous_p [db_string has_privilege {} -default "f"]
set read_p [permission::permission_p -object_id $assessment_id -privilege read -party_id -1]
-set value [parameter::get -parameter AsmForRegisterId -package_id $subsite_id]
+set value [parameter::get -parameter RegistrationId -package_id $subsite_id]
if { [exists_and_not_null asm_instance]} {
set reg_url "[apm_package_url_from_id $asm_instance]admin"
@@ -68,7 +69,7 @@
set notification_chunk [notification::display::request_widget \
-type assessment_response_notif \
-object_id $assessment_id \
- -pretty_name $assessment_data(title) \
+ -pretty_name $title \
-url [export_vars -base one-a {assessment_id reg_p}] ]
db_multirow sections assessment_sections {} {
@@ -78,4 +79,17 @@
set max_time_to_complete [as::assessment::pretty_time -seconds $max_time_to_complete]
}
+list::create \
+ -name sections \
+ -pass_properties assessment_id \
+ -multirow sections \
+ -key section_id \
+ -no_data "[_ assessment.None]" \
+ -elements {
+ title {
+ label "[_ assessment.Sections]"
+ display_template {@sections.title;noquote@ }
+ }
+ }
+
ad_return_template
Index: openacs-4/packages/assessment/www/asm-admin/results-export.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-export.tcl,v
diff -u -N -r1.8 -r1.9
--- openacs-4/packages/assessment/www/asm-admin/results-export.tcl 17 Feb 2006 12:13:55 -0000 1.8
+++ openacs-4/packages/assessment/www/asm-admin/results-export.tcl 12 Jun 2006 02:49:51 -0000 1.9
@@ -31,7 +31,7 @@
ad_form -name assessment_export -action results-export -form {
{assessment_id:key}
- {column_format:text(radio) {label "[_ assessment.csv_export_format]"} {options $export_options} {help_text "[_ assessment.csv_export_format_help]"}}
+ {column_format:text(radio) {label "[_ assessment.csv_export_format]"} {value "name" } {options $export_options} {help_text "[_ assessment.csv_export_format_help]"}}
{start_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.csv_Start_Time]"} {format $form_format} {help} {help_text "[_ assessment.csv_Start_Time_help]"}}
{end_time:date,to_sql(sql_date),to_html(display_date),optional {label "[_ assessment.csv_End_Time]"} {format $form_format} {help} {help_text "[_ assessment.csv_End_Time_help]"}}
} -edit_request {
Index: openacs-4/packages/assessment/www/asm-admin/results-export.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/results-export.xql,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/asm-admin/results-export.xql 17 Feb 2006 12:13:55 -0000 1.6
+++ openacs-4/packages/assessment/www/asm-admin/results-export.xql 12 Jun 2006 02:49:51 -0000 1.7
@@ -33,16 +33,26 @@
+-- select s.session_id, s.percent_score, s.subject_id,
+-- to_char(s.completed_datetime, 'YYYY-MM-DD HH24:MI:SS') as submission_date
+-- from as_sessions s,
+-- (select max(s2.session_id) as session_id, s2.subject_id
+-- from as_sessions s2, cr_revisions r
+-- where r.item_id = :assessment_id
+-- and s2.assessment_id = r.revision_id
+-- and s2.completed_datetime is not null
+-- group by s2.subject_id) sub
+-- where s.session_id = sub.session_id
+-- $start_date_sql
+-- $end_date_sql
+-- order by s.session_id
+
select s.session_id, s.percent_score, s.subject_id,
to_char(s.completed_datetime, 'YYYY-MM-DD HH24:MI:SS') as submission_date
- from as_sessions s,
- (select max(s2.session_id) as session_id, s2.subject_id
- from as_sessions s2, cr_revisions r
- where r.item_id = :assessment_id
- and s2.assessment_id = r.revision_id
- and s2.completed_datetime is not null
- group by s2.subject_id) sub
- where s.session_id = sub.session_id
+ from as_sessions s, cr_revisions r
+ where r.item_id = :assessment_id
+ and s.assessment_id = r.revision_id
+ and s.completed_datetime is not null
$start_date_sql
$end_date_sql
order by s.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 -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/results-session.adp 15 Apr 2005 17:26:46 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/results-session.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -28,7 +28,7 @@
#assessment.section# @sections.title@
(#assessment.max_time# @sections.max_time_to_complete@)
- (@sections.points@ / @sections.max_points@ #assessment.points#)
+ (@sections.points@ / @sections.max_points@ #assessment.points#)
@sections.description@
@@ -48,4 +48,9 @@
#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 -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/results-session.tcl 15 Apr 2005 17:26:46 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/results-session.tcl 12 Jun 2006 02:49:51 -0000 1.3
@@ -70,4 +70,8 @@
incr assessment_score $max_points
}
+set showpoints [parameter::get -parameter "ShowPoints" -default 1 ]
+
+set comments_installed_p [apm_package_enabled_p "general-comments"]
+
ad_return_template
Index: openacs-4/packages/assessment/www/asm-admin/section-copy.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-copy.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/section-copy.adp 6 May 2005 00:42:29 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/section-copy.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/section-copy.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-copy.tcl,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/section-copy.tcl 6 May 2005 00:42:39 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/section-copy.tcl 12 Jun 2006 02:49:51 -0000 1.4
@@ -8,7 +8,7 @@
section_id:integer
after:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -25,7 +25,7 @@
}
set page_title "[_ assessment.copy_section]"
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
set confirm_options [list [list "[_ assessment.continue_with_copy]" t] [list "[_ assessment.cancel_and_return]" f]]
Index: openacs-4/packages/assessment/www/asm-admin/section-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-delete.adp,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/section-delete.adp 6 May 2005 00:41:55 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/section-delete.adp 12 Jun 2006 02:49:51 -0000 1.3
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
Index: openacs-4/packages/assessment/www/asm-admin/section-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-delete.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/section-delete.tcl 17 Feb 2006 12:13:55 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/section-delete.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -7,7 +7,7 @@
assessment_id:integer
section_id:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -24,15 +24,15 @@
}
set page_title "[_ assessment.remove_section]"
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
set confirm_options [list [list "[_ assessment.continue_with_remove]" t] [list "[_ assessment.cancel_and_return]" f]]
ad_form -name section_delete_confirm -action section-delete -export { assessment_id } -form {
{section_id:key}
{section_title:text(inform) {label "[_ assessment.remove_1]"}}
{from:text(inform) {label "[_ assessment.from]"} {value $assessment_data(title)}}
- {confirmation:text(radio) {label " "} {options $confirm_options} {value f}}
+ {confirmation:text(radio) {label " "} {options $confirm_options} {value t}}
} -select_query_name {section_title} \
-on_submit {
if {$confirmation} {
Index: openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl 7 Apr 2005 22:54:56 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/section-display-form.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -34,6 +34,7 @@
set package_id [ad_conn package_id]
set boolean_options [list [list "[_ assessment.yes]" t] [list "[_ assessment.no]" f]]
+set type $assessment_data(type)
set order_types [list]
foreach one_order_type [list alphabetical randomized order_of_entry] {
@@ -46,12 +47,26 @@
{title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.sect_disp_Title_help]"}}
{description:text(textarea) {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.sect_disp_Description_help]"}}
{num_items:integer,optional,nospell {label "[_ assessment.section_num_Items]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.sect_num_items_help]"}}
+}
+
+if { $type > 1} {
+ ad_form -extend -name section_display_form -form {
{adp_chunk:text(textarea),optional,nospell {label "[_ assessment.Section_Template]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_template_help]"}}
{branched_p:text(select) {label "[_ assessment.section_Branched]"} {options $boolean_options} {help_text "[_ assessment.section_branched_help]"}}
{back_button_p:text(select) {label "[_ assessment.Back_Button]"} {options $boolean_options} {help_text "[_ assessment.back_button_help]"}}
{submit_answer_p:text(select) {label "[_ assessment.Submit_Answer]"} {options $boolean_options} {help_text "[_ assessment.submit_answer_help]"}}
{sort_order_type:text(select) {label "[_ assessment.Section_Order]"} {options $order_types} {help_text "[_ assessment.section_order_help]"}}
-} -new_request {
+ }
+} else {
+ ad_form -extend -name section_display_form -form {
+ {adp_chunk:text(hidden) {value ""}}
+ {branched_p:text(hidden) {value ""}}
+ {back_button_p:text(hidden) {value ""}}
+ {submit_answer_p:text(hidden) {value ""}}
+ {sort_order_type:text(hidden) {value ""}}
+ }
+}
+ad_form -extend -name section_display_form -new_request {
set title ""
set description ""
set num_items ""
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 -N -r1.5 -r1.6
--- openacs-4/packages/assessment/www/asm-admin/section-form.tcl 7 Apr 2005 22:54:44 -0000 1.5
+++ openacs-4/packages/assessment/www/asm-admin/section-form.tcl 12 Jun 2006 02:49:51 -0000 1.6
@@ -17,9 +17,11 @@
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
@@ -36,9 +38,9 @@
set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
set display_types [db_list_of_lists section_display_types {}]
-set display_types [concat [list [list "[_ assessment.section_new_display]" ""]] $display_types]
+set display_types [concat [list [list "[_ assessment.no_display]" ""] [list "[_ assessment.section_new_display]" "-1"]] $display_types]
+set type $assessment_data(type)
-
ad_form -name section_form -action section-form -export { assessment_id after } -form {
{section_id:key}
}
@@ -55,20 +57,48 @@
ad_form -extend -name section_form -form {
{title:text {label "[_ assessment.Title]"} {html {size 80 maxlength 1000}} {help_text "[_ assessment.section_Title_help]"}}
- {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Description_help]"}}
}
+if {$type > 1} {
+ ad_form -extend -name section_form -form {
+ {description:text(textarea),optional {label "[_ assessment.Description]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Description_help]"}}
+ }
+}
if {![empty_string_p [category_tree::get_mapped_trees $package_id]]} {
category::ad_form::add_widgets -container_object_id $package_id -categorized_object_id $_section_id -form_name section_form
}
+
ad_form -extend -name section_form -form {
{instructions:text(textarea),optional {label "[_ assessment.Instructions]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Instructions_help]"}}
- {feedback_text:text(textarea),optional {label "[_ assessment.Feedback]"} {html {rows 5 cols 80}} {help_text "[_ assessment.section_Feedback_help]"}}
- {max_time_to_complete:integer,optional,nospell {label "[_ assessment.time_for_completion]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.section_time_help]"}}
+}
+if {$type > 1} {
+ ad_form -extend -name section_form -form {
+ {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]"}}
+ }
+}
+
+ad_form -extend -name section_form -form {
{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_section_help]"}}
+}
+if {$type > 1} {
+ ad_form -extend -name section_form -form {
+ {points:integer,optional,nospell {label "[_ assessment.points_section]"} {html {size 10 maxlength 10}} {help_text "[_ assessment.points_section_help]"}}
+ }
+} else {
+ ad_form -extend -name section_form -form {
+ {description:text(hidden) {value ""}}
+ {feedback_text:text(hidden) {value ""}}
+ {max_time_to_complete:text(hidden) {value ""}}
+ {points:text(hidden) {value ""}}
+ }
+}
+
+ad_form -extend -name section_form -form {
{display_type_id:text(select),optional {label "[_ assessment.Display_Type]"} {options $display_types} {help_text "[_ assessment.section_Display_Type_help]"}}
+ {no_display:text(hidden) {value f}
+ }
} -new_request {
set name ""
set title ""
@@ -79,6 +109,7 @@
set num_items ""
set points ""
set display_type_id ""
+ set no_display "f"
} -edit_request {
db_1row section_data {}
} -validate {
@@ -89,6 +120,14 @@
set points 0
}
} -new_data {
+ if { [empty_string_p $display_type_id]} {
+ set no_display "t"
+ }
+ if { $display_type_id == -1} {
+ set display_type_id ""
+ }
+
+
db_transaction {
set new_assessment_rev_id [as::assessment::new_revision -assessment_id $assessment_id]
@@ -112,7 +151,16 @@
}
}
} -edit_data {
+
db_transaction {
+ if { [empty_string_p $display_type_id]} {
+ set no_display "t"
+ }
+
+ if { $display_type_id == -1} {
+ set display_type_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]
@@ -135,11 +183,14 @@
}
}
} -after_submit {
- if {[empty_string_p $display_type_id]} {
- set section_id $new_section_id
- ad_returnredirect [export_vars -base section-display-form {assessment_id section_id}]
+ if { $no_display } {
+ ad_returnredirect [export_vars -base one-a {assessment_id}]
ad_script_abort
- } else {
+ } elseif {[empty_string_p $display_type_id]} {
+ set section_id $new_section_id
+ ad_returnredirect [export_vars -base section-display-form {assessment_id section_id}]
+ ad_script_abort
+ } else {
ad_returnredirect [export_vars -base one-a {assessment_id}]
ad_script_abort
}
Index: openacs-4/packages/assessment/www/asm-admin/section-preview.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-preview.adp,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/assessment/www/asm-admin/section-preview.adp 7 Apr 2005 21:43:22 -0000 1.3
+++ openacs-4/packages/assessment/www/asm-admin/section-preview.adp 12 Jun 2006 02:49:51 -0000 1.4
@@ -1,6 +1,6 @@
@page_title;noquote@
-@context;noquote@
+@context_bar;noquote@
@assessment_data.title@
Index: openacs-4/packages/assessment/www/asm-admin/section-preview.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/section-preview.tcl,v
diff -u -N -r1.4 -r1.5
--- openacs-4/packages/assessment/www/asm-admin/section-preview.tcl 7 Apr 2005 22:55:30 -0000 1.4
+++ openacs-4/packages/assessment/www/asm-admin/section-preview.tcl 12 Jun 2006 02:49:51 -0000 1.5
@@ -8,7 +8,7 @@
assessment_id:integer
section_id:integer
} -properties {
- context:onevalue
+ context_bar:onevalue
page_title:onevalue
}
@@ -26,7 +26,7 @@
set assessment_rev_id $assessment_data(assessment_rev_id)
set page_title "[_ assessment.section_preview]"
-set context [list [list index [_ assessment.admin]] [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
+set context_bar [ad_context_bar [list [export_vars -base one-a {assessment_id}] $assessment_data(title)] $page_title]
db_1row section_data {} -column_array section
# get all items of section in correct order
Index: openacs-4/packages/assessment/www/asm-admin/sqlnet.log
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/Attic/sqlnet.log,v
diff -u -N
--- openacs-4/packages/assessment/www/asm-admin/sqlnet.log 17 Feb 2006 12:13:55 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,39 +0,0 @@
-
-
-***********************************************************************
-Fatal NI connect error 12541, connecting to:
- (DESCRIPTION=(CONNECT_DATA=(SID=*)(SERVICE_NAME=athena2.uni-heidelberg.de)(CID=(PROGRAM=)(HOST=athena2)(USER=root)))(ADDRESS=(PROTOCOL=TCP)(HOST=athena2)(PORT=1521)))
-
- VERSION INFORMATION:
- TNS for Linux: Version 9.2.0.4.0 - Production
- TCP/IP NT Protocol Adapter for Linux: Version 9.2.0.4.0 - Production
- Time: 30-AUG-2005 18:32:13
- Tracing not turned on.
- Tns error struct:
- nr err code: 0
- ns main err code: 12541
- TNS-12541: TNS:no listener
- ns secondary err code: 12560
- nt main err code: 511
- TNS-00511: No listener
- nt secondary err code: 111
- nt OS err code: 0
-
-
-***********************************************************************
-Fatal NI connect error 12514, connecting to:
- (DESCRIPTION=(CONNECT_DATA=(SID=*)(SERVICE_NAME=athena.uni-heidelberg.de)(CID=(PROGRAM=)(HOST=athena2)(USER=root)))(ADDRESS=(PROTOCOL=TCP)(HOST=athena)(PORT=1521)))
-
- VERSION INFORMATION:
- TNS for Linux: Version 9.2.0.4.0 - Production
- TCP/IP NT Protocol Adapter for Linux: Version 9.2.0.4.0 - Production
- Time: 30-AUG-2005 18:32:50
- Tracing not turned on.
- Tns error struct:
- nr err code: 0
- ns main err code: 12564
- TNS-12564: TNS:connection refused
- ns secondary err code: 0
- nt main err code: 0
- nt secondary err code: 0
- nt OS err code: 0
Index: openacs-4/packages/assessment/www/asm-admin/export/index-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index-oracle.xql,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/assessment/www/asm-admin/export/index-oracle.xql 12 Apr 2005 15:59:59 -0000 1.2
+++ openacs-4/packages/assessment/www/asm-admin/export/index-oracle.xql 12 Jun 2006 02:49:52 -0000 1.3
@@ -7,7 +7,7 @@
SELECT aic.object_id as choice_id, aic.title as choice_title, aic.item_id as choice_item_id, aic.name as choice_name, aic.description as choice_description, aic.choice_id, aic.mc_id, aic.data_type as choice_data_type, aic.numeric_value as choice_numeric_value, aic.text_value as choice_text_value, aic.boolean_value as choice_boolean_value, aic.content_value as choice_content_value, aic.feedback_text as choice_feedback_text, aic.selected_p as choice_selected_p, aic.correct_answer_p as choice_correct_answer_p, aic.sort_order as choice_sort_order, aic.percent_score as choice_percent_score, r2.revision_id as content_rev_id, r2.title as content_filename, r2.mime_type, r2.content as cr_file_name, i.content_type, i.storage_area_key
FROM cr_revisions r, cr_revisions r2, as_item_choicesx aic, cr_items i
WHERE r2.revision_id(+) = aic.content_value
- and i.item_id(+) = r2.item_id
+ and i.item_id = r2.item_id
and aic.mc_id= :mc_id
and r.revision_id = aic.choice_id
ORDER BY aic.sort_order
@@ -17,7 +17,7 @@
SELECT count(aic.correct_answer_p) as num_answers_correct
- FROM cr_revisions r, cr_revisions r2, cr_items i, as_item_choicesx aic
+ FROM cr_revisions r, cr_revisions r2, cr_items, as_item_choicesx aic
WHERE r2.revision_id(+) = aic.content_value
and i.item_id(+) = r2.item_id
and aic.mc_id= :mc_id
Index: openacs-4/packages/assessment/www/asm-admin/export/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index.vuh,v
diff -u -N -r1.8 -r1.9
--- openacs-4/packages/assessment/www/asm-admin/export/index.vuh 24 Nov 2005 15:32:49 -0000 1.8
+++ openacs-4/packages/assessment/www/asm-admin/export/index.vuh 12 Jun 2006 02:49:52 -0000 1.9
@@ -9,20 +9,20 @@
}
if {[exists_and_not_null assessment_id]} {
- # Get the assessment data
- as::assessment::data -assessment_id $assessment_id
- set download_name $assessment_data(title)
-
- # We get rid of spaces since they are annoying
- regsub -all { } $download_name {_} download_name
+ # Get the assessment data
+ as::assessment::data -assessment_id $assessment_id
+ set download_name $assessment_data(title)
+
+ # We get rid of spaces since they are annoying
+ regsub -all { } $download_name {_} download_name
- set tmp_dir $download_name
- set ext "zip"
+ set tmp_dir $download_name
+ set ext "zip"
- append download_name ".${ext}"
+ append download_name ".${ext}"
- ad_returnredirect "${assessment_id}/${download_name}"
- ad_script_abort
+ ad_returnredirect "${assessment_id}/${download_name}"
+ ad_script_abort
}
# convenient way to get the values out of a list
@@ -154,14 +154,14 @@
#sort_order_type
as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label sort_order_type -value $s_sort_order_type
}
-
+
#
as::export::new_element -value $section_description -father $section -label objectives -root $doc -material_p t
#
as::export::new_element -value $section_instructions -father $section -label rubric -root $doc -material_p t
#
as::export::new_element -value $section_feedback_text -father $section -label sectionfeedback -root $doc -material_p t -attribute_label ident -attribute_value $section_id
-
+
#
set selection_ordering [$doc createElement selection_ordering]
$section appendChild $selection_ordering
@@ -199,12 +199,15 @@
db_0or1row as_item_display_tbx "SELECT as_item_display_id AS tb__display_id FROM as_item_display_tb WHERE as_item_display_id=:item_display_id"
#textarea (short answer)
db_0or1row as_item_display_tax "SELECT as_item_display_id AS ta__display_id FROM as_item_display_ta WHERE as_item_display_id=:item_display_id"
-
+
#-
set item [$doc createElement item]
+ if { $field_name ne "" } {
+ set item_name $field_name
+ }
$item setAttribute ident $item_name
$section appendChild $item
-
+
#
as::export::new_element -value $item_description -father $item -label qticomment -root $doc
#
@@ -268,7 +271,7 @@
#item_answer_alignment
as::export::element_qtimetadatafield -root $doc -father $qtimetadata -label item_answer_alignment -value $item_answer_alignment
}
-
+
# open question item
db_0or1row as_item_oq { }
if {[info exists id__as_item_type_oq]} {
@@ -301,7 +304,7 @@
#content_type: imagen
set content_type ""
-
+
db_0or1row get_content_type_items {}
if {$content_type == "image"} {
#
@@ -316,8 +319,8 @@
file copy -force -- "${cr_path}${cr_file_name}" [file join ${in_path} $content_filename]
}
}
-
+
#find out the item type (multiple choice or multiple response)
if {[info exists cb__display_id] || [info exists rb__display_id]} {
if {[info exists cb__display_id]} {
@@ -372,7 +375,7 @@
}
} else {
#short answer
- if {[info exists ta__display_id]} {
+ if {[info exists ta__display_id] } {
#
set response_str [$doc createElement response_str]
$response_str setAttribute ident $item_name
@@ -382,8 +385,8 @@
#get rows and cols for painting a textarea (in abs_size is stored as "rows value cols value", we need to add the symbol =)
db_0or1row html_rows_cols "SELECT html_display_options FROM as_item_display_ta WHERE as_item_display_id=:item_display_id"
if {![empty_string_p $html_display_options]} {
- set rows "[lindex $html_display_options 1]"
- set columns "[lindex $html_display_options 3]"
+ set rows "[lindex $html_display_options 3]"
+ set columns "[lindex $html_display_options 1]"
} else {
set rows 5
set columns 25
@@ -404,12 +407,16 @@
} else {
#fill in the blank
#whether it's a fill-in-blank I have to split by
+ ns_log notice "DEBUG::1 $item_title"
regsub -all -line -nocase -- "" $html ":" html1
+ ns_log notice "DEBUG::3 $html1"
set item_title1 [split $html1 :]
set longitud [llength $item_title1]
-
- for {set i 0} {$i<[llength $item_title1]-1} {incr i 2} {
+
+ for {set i 0} {$i<=[llength $item_title1]-1} {incr i 2} {
+ ns_log notice "DEBUG::4 $i"
set item_title [lindex $item_title1 $i]
#
set material [$doc createElement material]
@@ -439,9 +446,9 @@
$render_fib appendChild $response_label
}
}
- }
-
- if { $assessment_data(survey_p) != "t" && ![info exists ta__display_id] } {
+ }
+
+ if { $assessment_data(survey_p) != "t" && ![info exists ta__display_id] } {
#
set resprocessing [$doc createElement resprocessing]
$item appendChild $resprocessing
@@ -461,65 +468,65 @@
#fill-in-blank
if {[info exists tb__display_id]} {
- set i 0
- db_foreach query_all_choices {} {
- #
- set or [$doc createElement or]
- $conditionvar appendChild $or
- set list_choice_title $choice_title
- for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} {
- #
- set varequal [$doc createElement varequal]
- $varequal setAttribute respident $item_name$i
- $or appendChild $varequal
- set text [$doc createCDATASection [lindex $list_choice_title $j]]
- $varequal appendChild $text
- }
- incr i 2
- }
- } else {
-
-
- #
- set and [$doc createElement and]
- $conditionvar appendChild $and
-
- set exist_false 0
- db_foreach query_all_choices2 {} {
- if {$correct_answer_p == "t" } {
- #
- set varequal [$doc createElement varequal]
- $varequal setAttribute respident $item_name
- $and appendChild $varequal
- set text [$doc createCDATASection $name]
- $varequal appendChild $text
- } else {
- set exist_false 1
+ set i 0
+ db_foreach query_all_choices {} {
+ #
+ set or [$doc createElement or]
+ $conditionvar appendChild $or
+ set list_choice_title $choice_title
+ for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} {
+ #
+ set varequal [$doc createElement varequal]
+ $varequal setAttribute respident $item_name$i
+ $or appendChild $varequal
+ set text [$doc createCDATASection [lindex $list_choice_title $j]]
+ $varequal appendChild $text
+ }
+ incr i 2
}
- }
- if { $exist_false == 1 } {
- #
- set not [$doc createElement not]
- $and appendChild $not
- #
- set or [$doc createElement or]
- $not appendChild $or
+ } else {
+
+
+ #
+ set and [$doc createElement and]
+ $conditionvar appendChild $and
+
+ set exist_false 0
db_foreach query_all_choices2 {} {
- if {$correct_answer_p == "f" } {
- #
- set varequal [$doc createElement varequal]
- $varequal setAttribute respident $item_name
- $or appendChild $varequal
- set text [$doc createCDATASection $name]
- $varequal appendChild $text
+ if {$correct_answer_p == "t" } {
+ #
+ set varequal [$doc createElement varequal]
+ $varequal setAttribute respident $item_name
+ $and appendChild $varequal
+ set text [$doc createCDATASection $name]
+ $varequal appendChild $text
+ } else {
+ set exist_false 1
}
}
- }
+ if { $exist_false == 1 } {
+ #
+ set not [$doc createElement not]
+ $and appendChild $not
+ #
+ set or [$doc createElement or]
+ $not appendChild $or
+ db_foreach query_all_choices2 {} {
+ if {$correct_answer_p == "f" } {
+ #
+ set varequal [$doc createElement varequal]
+ $varequal setAttribute respident $item_name
+ $or appendChild $varequal
+ set text [$doc createCDATASection $name]
+ $varequal appendChild $text
+ }
+ }
+ }
}
set num_answers_correct ""
db_0or1row num_answers_correct {}
-
+
if {$item_points == 1 && $num_answers_correct>1} {
#
set setvar [$doc createElement setvar]
@@ -546,202 +553,202 @@
#fill-in-blank
if {[info exists tb__display_id]} {
- set i 0
- #
- set not [$doc createElement not]
- $conditionvar appendChild $not
- #
- set and [$doc createElement and]
- $not appendChild $and
- db_foreach query_all_choices {} {
- #
- set or [$doc createElement or]
- $and appendChild $or
- set list_choice_title $choice_title
- for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} {
- #
- set varequal [$doc createElement varequal]
- $varequal setAttribute respident $item_name$i
- $or appendChild $varequal
- set text [$doc createCDATASection [lindex $list_choice_title $j]]
- $varequal appendChild $text
- }
- incr i 2
- }
-
- } else {
-
- #
- set or [$doc createElement or]
- $conditionvar appendChild $or
-
- set exist_true 0
- db_foreach query_all_choices2 {} {
- if {$correct_answer_p == "f" } {
- #
- set varequal [$doc createElement varequal]
- $varequal setAttribute respident $item_name
- $or appendChild $varequal
- set text [$doc createCDATASection $name]
- $varequal appendChild $text
- } else {
- set exist_true 1
- }
- }
- if { $exist_true == 1 } {
+ set i 0
#
set not [$doc createElement not]
- $or appendChild $not
+ $conditionvar appendChild $not
#
set and [$doc createElement and]
$not appendChild $and
- db_foreach query_all_choices2 {} {
- if {$correct_answer_p == "t" } {
- #
- set varequal [$doc createElement varequal]
- $varequal setAttribute respident $item_name
- $and appendChild $varequal
- set text [$doc createCDATASection $name]
- $varequal appendChild $text
- }
- }
- }
- }
-
- #
- set displayfeedback [$doc createElement displayfeedback]
- set linkrefid { }
- append linkrefid $item_name displayWrong
- $displayfeedback setAttribute linkrefid $linkrefid
- $respcondition appendChild $displayfeedback
-
-
- if {$item_points>1 || $num_answers_correct==1} {
- db_foreach query_all_choices {} {
- set i 0
- # [info exists tb__display_id] because for fib item choice_correct_answer_p is null
- if { $choice_correct_answer_p == "t" || [info exists tb__display_id] } {
- set list_choice_title $choice_title
- set length_list_choice_title [llength $list_choice_title]
-
- if {![info exists tb__display_id]} {
- set length_list_choice_title 1
- }
-
- for {set j 0} {$j < $length_list_choice_title} {incr j 1} {
- #
- set respcondition [$doc createElement respcondition]
- $respcondition setAttribute title "adjustscore"
- $resprocessing appendChild $respcondition
- #
- set conditionvar [$doc createElement conditionvar]
- $respcondition appendChild $conditionvar
- #
- set varequal [$doc createElement varequal]
- if {[info exists tb__display_id]} {
- $varequal setAttribute respident $item_name$i
- } else {
- $varequal setAttribute respident $item_name
+ db_foreach query_all_choices {} {
+ #
+ set or [$doc createElement or]
+ $and appendChild $or
+ set list_choice_title $choice_title
+ for {set j 0} {$j < [llength $list_choice_title]} {incr j 1} {
+ #
+ set varequal [$doc createElement varequal]
+ $varequal setAttribute respident $item_name$i
+ $or appendChild $varequal
+ set text [$doc createCDATASection [lindex $list_choice_title $j]]
+ $varequal appendChild $text
}
- $conditionvar appendChild $varequal
- if {[info exists tb__display_id]} {
- set text [$doc createCDATASection [lindex $list_choice_title $j]]
+ incr i 2
+ }
+
+ } else {
+
+ #
+ set or [$doc createElement or]
+ $conditionvar appendChild $or
+
+ set exist_true 0
+ db_foreach query_all_choices2 {} {
+ if {$correct_answer_p == "f" } {
+ #
+ set varequal [$doc createElement varequal]
+ $varequal setAttribute respident $item_name
+ $or appendChild $varequal
+ set text [$doc createCDATASection $name]
+ $varequal appendChild $text
} else {
- set text [$doc createCDATASection $choice_name]
+ set exist_true 1
}
- $varequal appendChild $text
- #
- set setvar [$doc createElement setvar]
- $setvar setAttribute varname "SCORE"
- $setvar setAttribute action "Add"
- $respcondition appendChild $setvar
- # in fib items choice_percent_score column is null
- if {[empty_string_p $choice_percent_score]} {
- set choice_percent_score 1
- } else {
- set choice_percent_score [expr round (($num_answers_correct * $choice_percent_score * 1.0) / 100)]
- }
- set text [$doc createCDATASection $choice_percent_score]
- $setvar appendChild $text
- #feedback choice
- if {![empty_string_p $choice_feedback_text]} {
- set displayfeedback [$doc createElement displayfeedback]
+ }
+ if { $exist_true == 1 } {
+ #
+ set not [$doc createElement not]
+ $or appendChild $not
+ #
+ set and [$doc createElement and]
+ $not appendChild $and
+ db_foreach query_all_choices2 {} {
+ if {$correct_answer_p == "t" } {
+ #
+ set varequal [$doc createElement varequal]
+ $varequal setAttribute respident $item_name
+ $and appendChild $varequal
+ set text [$doc createCDATASection $name]
+ $varequal appendChild $text
+ }
+ }
+ }
+ }
+
+ #
+ set displayfeedback [$doc createElement displayfeedback]
+ set linkrefid { }
+ append linkrefid $item_name displayWrong
+ $displayfeedback setAttribute linkrefid $linkrefid
+ $respcondition appendChild $displayfeedback
+
+
+ if {$item_points>1 || $num_answers_correct==1} {
+ db_foreach query_all_choices {} {
+ set i 0
+ # [info exists tb__display_id] because for fib item choice_correct_answer_p is null
+ if { $choice_correct_answer_p == "t" || [info exists tb__display_id] } {
+ set list_choice_title $choice_title
+ set length_list_choice_title [llength $list_choice_title]
+
+ if {![info exists tb__display_id]} {
+ set length_list_choice_title 1
+ }
+
+ for {set j 0} {$j < $length_list_choice_title} {incr j 1} {
+ #
+ set respcondition [$doc createElement respcondition]
+ $respcondition setAttribute title "adjustscore"
+ $resprocessing appendChild $respcondition
+ #
+ set conditionvar [$doc createElement conditionvar]
+ $respcondition appendChild $conditionvar
+ #
+ set varequal [$doc createElement varequal]
+ if {[info exists tb__display_id]} {
+ $varequal setAttribute respident $item_name$i
+ } else {
+ $varequal setAttribute respident $item_name
+ }
+ $conditionvar appendChild $varequal
+ if {[info exists tb__display_id]} {
+ set text [$doc createCDATASection [lindex $list_choice_title $j]]
+ } else {
+ set text [$doc createCDATASection $choice_name]
+ }
+ $varequal appendChild $text
+ #
+ set setvar [$doc createElement setvar]
+ $setvar setAttribute varname "SCORE"
+ $setvar setAttribute action "Add"
+ $respcondition appendChild $setvar
+ # in fib items choice_percent_score column is null
+ if {[empty_string_p $choice_percent_score]} {
+ set choice_percent_score 1
+ } else {
+ set choice_percent_score [expr round (($num_answers_correct * $choice_percent_score * 1.0) / 100)]
+ }
+ set text [$doc createCDATASection $choice_percent_score]
+ $setvar appendChild $text
+ #feedback choice
+ if {![empty_string_p $choice_feedback_text]} {
+ set displayfeedback [$doc createElement displayfeedback]
+ set linkrefid { }
+ append linkrefid $choice_name feedbackChoice
+ $displayfeedback setAttribute linkrefid $linkrefid
+ $respcondition appendChild $displayfeedback
+ }
+ }
+ }
+ incr i 2
+
+ #for feedback choice
+ if { $choice_correct_answer_p == "f" && ![empty_string_p $choice_feedback_text] } {
+ #
+ set respcondition [$doc createElement respcondition]
+ $resprocessing appendChild $respcondition
+ #
+ set conditionvar [$doc createElement conditionvar]
+ $respcondition appendChild $conditionvar
+ #
+ set varequal [$doc createElement varequal]
+ $varequal setAttribute respident $item_name
+ $conditionvar appendChild $varequal
+ set text [$doc createCDATASection $choice_name]
+ $varequal appendChild $text
+ #feedback choice
+ set displayfeedback [$doc createElement displayfeedback]
set linkrefid { }
append linkrefid $choice_name feedbackChoice
$displayfeedback setAttribute linkrefid $linkrefid
- $respcondition appendChild $displayfeedback
- }
- }
+ $respcondition appendChild $displayfeedback
+ }
+ }
}
- incr i 2
- #for feedback choice
- if { $choice_correct_answer_p == "f" && ![empty_string_p $choice_feedback_text] } {
- #
- set respcondition [$doc createElement respcondition]
- $resprocessing appendChild $respcondition
- #
- set conditionvar [$doc createElement conditionvar]
- $respcondition appendChild $conditionvar
- #
- set varequal [$doc createElement varequal]
- $varequal setAttribute respident $item_name
- $conditionvar appendChild $varequal
- set text [$doc createCDATASection $choice_name]
- $varequal appendChild $text
- #feedback choice
- set displayfeedback [$doc createElement displayfeedback]
- set linkrefid { }
- append linkrefid $choice_name feedbackChoice
- $displayfeedback setAttribute linkrefid $linkrefid
- $respcondition appendChild $displayfeedback
- }
- }
- }
+ #feedback_wrong
+ if {![empty_string_p $item_feedback_wrong] } {
+ #
+ set itemfeedback [$doc createElement itemfeedback]
+ set ident { }
+ append ident $item_name displayWrong
+ $itemfeedback setAttribute ident $ident
+ $item appendChild $itemfeedback
+ #
+ as::export::new_element -value $item_feedback_wrong -father $itemfeedback -label flow_mat -root $doc -material_p t
+ }
+
+ #feedback_right
+ if {![empty_string_p $item_feedback_right]} {
+ #
+ set itemfeedback [$doc createElement itemfeedback]
+ set ident { }
+ append ident $item_name displayRight
+ $itemfeedback setAttribute ident $ident
+ $item appendChild $itemfeedback
+ #
+ as::export::new_element -value $item_feedback_right -father $itemfeedback -label flow_mat -root $doc -material_p t
+ }
+
+ #feedback_choice
+ db_foreach query_all_choices {} {
+ if {![empty_string_p $choice_feedback_text]} {
+ #
+ set itemfeedback [$doc createElement itemfeedback]
+ set ident { }
+ append ident $choice_name feedbackChoice
+ $itemfeedback setAttribute ident $ident
+ $item appendChild $itemfeedback
+ #
+ as::export::new_element -value $choice_feedback_text -father $itemfeedback -label flow_mat -root $doc -material_p t
+ }
+ }
+ }
- #feedback_wrong
- if {![empty_string_p $item_feedback_wrong] } {
- #
- set itemfeedback [$doc createElement itemfeedback]
- set ident { }
- append ident $item_name displayWrong
- $itemfeedback setAttribute ident $ident
- $item appendChild $itemfeedback
- #
- as::export::new_element -value $item_feedback_wrong -father $itemfeedback -label flow_mat -root $doc -material_p t
- }
-
- #feedback_right
- if {![empty_string_p $item_feedback_right]} {
- #
- set itemfeedback [$doc createElement itemfeedback]
- set ident { }
- append ident $item_name displayRight
- $itemfeedback setAttribute ident $ident
- $item appendChild $itemfeedback
- #
- as::export::new_element -value $item_feedback_right -father $itemfeedback -label flow_mat -root $doc -material_p t
- }
-
- #feedback_choice
- db_foreach query_all_choices {} {
- if {![empty_string_p $choice_feedback_text]} {
- #
- set itemfeedback [$doc createElement itemfeedback]
- set ident { }
- append ident $choice_name feedbackChoice
- $itemfeedback setAttribute ident $ident
- $item appendChild $itemfeedback
- #
- as::export::new_element -value $choice_feedback_text -father $itemfeedback -label flow_mat -root $doc -material_p t
- }
- }
- }
-
}
- }
-
+}
+
#puts [$root asXML]
set outfd ""
@@ -757,15 +764,15 @@
set tmp_file "[ad_generate_random_string].zip"
set out_file [file join ${out_path} ${tmp_file}]
-
+
# get the archive command
# TODO SECURITY DONT USE GLOBBING
set cmd "zip -r -9 -X '$out_file' *"
# create the archive
with_catch errmsg {
-# TODO SECURITY DONT USE THE SHELL
- exec bash -c "cd '$in_path'; $cmd; cd -"
+ # TODO SECURITY DONT USE THE SHELL
+ exec bash -c "cd '$in_path'; $cmd; cd -"
} {
# some day we'll do something useful here
error $errmsg
Index: openacs-4/packages/assessment/www/asm-admin/export/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/export/index.xql,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/assessment/www/asm-admin/export/index.xql 24 Mar 2005 14:31:13 -0000 1.6
+++ openacs-4/packages/assessment/www/asm-admin/export/index.xql 12 Jun 2006 02:49:52 -0000 1.7
@@ -14,7 +14,7 @@
- SELECT i.as_item_id, i.title as item_title, i.name as item_name, i.description as item_description, i.subtext as item_subtext, i.field_code as item_field_code, i.required_p as item_required_p, i.data_type as item_data_type, i.max_time_to_complete as item_max_time_to_complete, i.feedback_right as item_feedback_right, i.feedback_wrong as item_feedback_wrong, i.points as item_points
+ SELECT i.as_item_id, i.title as item_title, i.name as item_name, i.description as item_description, i.subtext as item_subtext, i.field_code as item_field_code, i.required_p as item_required_p, i.data_type as item_data_type, i.max_time_to_complete as item_max_time_to_complete, i.feedback_right as item_feedback_right, i.feedback_wrong as item_feedback_wrong, i.points as item_points, i.field_name
FROM as_itemsx i, as_item_section_map ism
WHERE i.as_item_id = ism.as_item_id AND ism.section_id = :section_id
ORDER BY ism.sort_order