Index: openacs-4/packages/lors/tcl/lors-assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/Attic/lors-assessment-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors/tcl/lors-assessment-procs.tcl 22 Nov 2004 04:45:16 -0000 1.1 @@ -0,0 +1,55 @@ +# packages/lors/tcl/lors-assessment-procs.tcl + +ad_library { + + + + @author Natalia Perez Perez (nperper@it.uc3m.es) + @creation-date 2004-11-22 + @arch-tag: 7a9f1aab-7fad-4916-b9d0-2328b7cc7334 + @cvs-id $Id: lors-assessment-procs.tcl,v 1.1 2004/11/22 04:45:16 ernieg Exp $ +} +namespace eval lors::assessment {} + + +ad_proc -public lors::assessment::ims_qti_register_assessment { + {tmp_dir ""} +} { + Relation with assessment + +} { + + # Generate a random directory name + set tmpdirectory [ns_tmpnam] + # Create a temporary directory + file mkdir $tmpdirectory + + # UNZIP the zip file in the temporary directory + catch { exec unzip ${tmp_dir} -d $tmpdirectory } outMsg + + # Save the current package_id to restore when the assessment is + # imported + set current_package_id [ad_conn package_id] + # Get the assessment package_id associated with the current + # community + # FIXME this is a hack until I figure out how to get the + # package_id of the assessment of the current community + ad_conn -set package_id [db_string get_assessment_package_id {select package_id from apm_packages where package_key='assessment'}] + + # Read the content of the temporary directory + foreach file_i [ glob -directory $tmpdirectory *{.xml} ] { + set assessment_id [as::qti::parse_qti_xml $file_i] + } + + # Delete the temporary directory + file delete -force $tmpdirectory + + # Restore the package_id + ad_conn -set package_id $current_package_id + + set url_assessment "/assessment/assessment?assessment_id=$assessment_id" + + return $url_assessment +} + + \ No newline at end of file Index: openacs-4/packages/lorsm/www/course-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lorsm/www/Attic/course-add-3.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lorsm/www/course-add-3.tcl 4 Sep 2004 14:51:21 -0000 1.2 +++ openacs-4/packages/lorsm/www/course-add-3.tcl 22 Nov 2004 04:45:16 -0000 1.3 @@ -424,20 +424,18 @@ set res_files [lors::imsmd::getResource -node $resource -att files] set res_scormtype [lors::imsmd::getAtt $resource adlcp:scormtype] -### Addition to showcase integration with Assessment +### Addition provided by e-lane people to integrate on deployment with +# assessment package. -# if {$res_type == "ims-qti-package"} { +# In the future we need to come up with a nicier way to do this as +# this is rather a dirty hack for now. -# set res_href [ims_qti_register_assessment $tmp_dir/$res_href] - + if {$res_type == "imsqti_xmlv1p0" || $res_type == "imsqti_xmlv1p1" || $res_type =="imsqti_item_xmlv2p0"} { + set res_href [lors::assessment::ims_qti_register_assessment $tmp_dir/$res_href] + } -# } - - ## End integration showcase - - set resource_id [lors::imscp::resource_add \ -man_id $man_id \ -identifier $res_identifier \