Index: openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml,v
diff -u -r1.25 -r1.26
--- openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 23 Jan 2005 18:10:48 -0000 1.25
+++ openacs-4/packages/assessment/catalog/assessment.en_US.ISO-8859-1.xml 23 Jan 2005 20:23:58 -0000 1.26
@@ -102,6 +102,7 @@
Copy
Copy:
(Copy)
+ Copy Assessment
Copy Question
Copy Section
Copy this assessment
@@ -276,6 +277,7 @@
Registrated respondents required
regarding this survey
Remove:
+ Remove Assessment
Remove Choice
Remove Question
Remove Section
Index: openacs-4/packages/assessment/tcl/as-assessment-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.tcl,v
diff -u -r1.16 -r1.17
--- openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 23 Jan 2005 18:10:48 -0000 1.16
+++ openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 23 Jan 2005 20:23:58 -0000 1.17
@@ -213,6 +213,61 @@
return $new_rev_id
}
+ad_proc -public as::assessment::copy {
+ {-assessment_id:required}
+ {-name ""}
+} {
+ @author Timo Hentschel (timo@timohentschel.de)
+ @creation-date 2005-01-23
+
+ Copies an assessment with all sections and items
+} {
+ set package_id [ad_conn package_id]
+ set folder_id [as::assessment::folder_id -package_id $package_id]
+
+ data -assessment_id $assessment_id
+ array set a [array get assessment_data]
+ append a(title) "[_ assessment.copy_appendix]"
+
+ db_transaction {
+ set new_assessment_id [db_nextval acs_object_id_seq]
+ if {[empty_string_p $name]} {
+ set name "ASS_$new_assessment_id"
+ }
+ set new_assessment_id [content::item::new -item_id $new_assessment_id -parent_id $folder_id -content_type {as_assessments} -name $name]
+
+ set new_rev_id [content::revision::new \
+ -item_id $new_assessment_id \
+ -content_type {as_assessments} \
+ -title $a(title) \
+ -description $a(description) \
+ -attributes [list [list creator_id $a(creator_id)] \
+ [list instructions $a(instructions)] \
+ [list run_mode $a(run_mode)] \
+ [list anonymous_p $a(anonymous_p)] \
+ [list secure_access_p $a(secure_access_p)] \
+ [list reuse_responses_p $a(reuse_responses_p)] \
+ [list show_item_name_p $a(show_item_name_p)] \
+ [list entry_page $a(entry_page)] \
+ [list exit_page $a(exit_page)] \
+ [list consent_page $a(consent_page)] \
+ [list return_url $a(return_url)] \
+ [list start_time $a(start_time)] \
+ [list end_time $a(end_time)] \
+ [list number_tries $a(number_tries)] \
+ [list wait_between_tries $a(wait_between_tries)] \
+ [list time_for_response $a(time_for_response)] \
+ [list ip_mask $a(ip_mask)] \
+ [list show_feedback $a(show_feedback)] \
+ [list section_navigation $a(section_navigation)] ] ]
+
+ copy_sections -assessment_id $a(assessment_rev_id) -new_assessment_id $new_rev_id
+ copy_categories -from_id $a(assessment_rev_id) -to_id $new_rev_id
+ }
+
+ return $new_assessment_id
+}
+
ad_proc as::assessment::copy_sections {
{-assessment_id:required}
{-new_assessment_id:required}
Index: openacs-4/packages/assessment/www/admin/assessment-copy.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/assessment-copy.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/admin/assessment-copy.adp 23 Jan 2005 20:23:58 -0000 1.1
@@ -0,0 +1,7 @@
+
+@page_title;noquote@
+@context_bar;noquote@
+
+
+
+
Index: openacs-4/packages/assessment/www/admin/assessment-copy.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/assessment-copy.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/admin/assessment-copy.tcl 23 Jan 2005 20:23:58 -0000 1.1
@@ -0,0 +1,46 @@
+ad_page_contract {
+ Confirmation form to copy an assessment.
+
+ @author Timo Hentschel (timo@timohentschel.de)
+ @cvs-id $Id:
+} {
+ assessment_id:integer
+} -properties {
+ context_bar:onevalue
+ page_title:onevalue
+}
+
+permission::permission_p -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 assessment_rev_id $assessment_data(assessment_rev_id)
+set page_title "[_ assessment.copy_assessment]"
+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]]
+
+ad_form -name assessment_copy_confirm -action assessment-copy -form {
+ {assessment_id:key}
+ {assessment_title:text(inform) {label "[_ assessment.copy_1]"}}
+ {name:text,optional {label "[_ assessment.Name]"} {help_text "[_ assessment.Name_help]"}}
+ {confirmation:text(radio) {label " "} {options $confirm_options} {value f}}
+} -edit_request {
+ db_1row assessment_title {}
+ set name ""
+} -on_submit {
+ if {$confirmation} {
+ set assessment_id [as::assessment::copy -assessment_id $assessment_id -name $name]
+ }
+} -after_submit {
+ ad_returnredirect [export_vars -base one-a {assessment_id}]
+ ad_script_abort
+}
+
+ad_return_template
Index: openacs-4/packages/assessment/www/admin/assessment-copy.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/assessment-copy.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/admin/assessment-copy.xql 23 Jan 2005 20:23:58 -0000 1.1
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ select title as assessment_title
+ from cr_revisions
+ where revision_id = :assessment_rev_id
+
+
+
+
+
Index: openacs-4/packages/assessment/www/admin/assessment-delete.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/assessment-delete.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/admin/assessment-delete.adp 23 Jan 2005 20:23:58 -0000 1.1
@@ -0,0 +1,7 @@
+
+@page_title;noquote@
+@context_bar;noquote@
+
+
+
+
Index: openacs-4/packages/assessment/www/admin/assessment-delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/assessment-delete.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/admin/assessment-delete.tcl 23 Jan 2005 20:23:58 -0000 1.1
@@ -0,0 +1,48 @@
+ad_page_contract {
+ Confirmation form to remove an assessment.
+
+ @author Timo Hentschel (timo@timohentschel.de)
+ @cvs-id $Id:
+} {
+ assessment_id:integer
+} -properties {
+ context_bar:onevalue
+ page_title:onevalue
+}
+
+permission::permission_p -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 assessment_rev_id $assessment_data(assessment_rev_id)
+set page_title "[_ assessment.remove_assessment]"
+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 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}}
+} -select_query_name {assessment_title} \
+-on_submit {
+ if {$confirmation} {
+ db_dml remove_assessment {}
+ }
+} -after_submit {
+ if {$confirmation} {
+ ad_returnredirect .
+ ad_script_abort
+ } else {
+ ad_returnredirect [export_vars -base one-a {assessment_id}]
+ ad_script_abort
+ }
+}
+
+ad_return_template
Index: openacs-4/packages/assessment/www/admin/assessment-delete.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/Attic/assessment-delete.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/www/admin/assessment-delete.xql 23 Jan 2005 20:23:58 -0000 1.1
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ select title as assessment_title
+ from cr_revisions
+ where revision_id = :assessment_rev_id
+
+
+
+
+
+
+
+ update cr_items
+ set latest_revision = null
+ where item_id = :assessment_id
+
+
+
+
+