[LON-CAPA-cvs] cvs: loncom /imspackages imsprocessor.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sun, 30 Sep 2007 13:20:11 -0000


raeburn		Sun Sep 30 09:20:11 2007 EDT

  Modified files:              
    /loncom/imspackages	imsprocessor.pm 
  Log:
  WebCT Campus Edition 4.1 differences
  - varname attribute in <setvar> is set to que_score instead of answerValue
  - <matimage> inside <presentation><flow><material>
  
  Fix typo:
  Replace webct4ce with webctce4 
  
  
Index: loncom/imspackages/imsprocessor.pm
diff -u loncom/imspackages/imsprocessor.pm:1.40 loncom/imspackages/imsprocessor.pm:1.41
--- loncom/imspackages/imsprocessor.pm:1.40	Sat Apr 15 12:44:56 2006
+++ loncom/imspackages/imsprocessor.pm	Sun Sep 30 09:20:08 2007
@@ -2834,6 +2834,12 @@
             $$settings{$id}{texttype} = $attr->{texttype};
             $currtexttype = $attr->{texttype};
         }
+        if ("@state" eq "questestinterop section item presentation flow material matimage") {
+            $$settings{$id}{imagtype} = $attr->{imagtype};
+            $currimagtype = $attr->{imagtype};
+            $$settings{$id}{uri} = $attr->{uri};
+
+        }
         if ("@state" eq "questestinterop section item presentation flow response_lid") {
             $$settings{$id}{class} = 'multiplechoice';
             $list = $attr->{ident};
@@ -3053,12 +3059,18 @@
             }
         }
         if ("@state" eq "questestinterop section item resprocessing respcondition setvar") {
-            if ($setvar{varname} eq "answerValue") { # Multiple Choice
+            if ($setvar{varname} eq "answerValue") { # Multiple Choice WebCT4.0
                 if ($text =~ m/^\d+$/) {
                     if ($text > 0) {
                         push(@{$$settings{$id}{$list}{correctanswer}},$answer_id);   
                     }
                 }
+            } elsif ($setvar{varname} eq "que_score") { # Multiple Choice WebCT4.1
+                if ($text =~ m/^\d+$/) {
+                    if ($text > 0) {
+                        push(@{$$settings{$id}{$list}{correctanswer}},$answer_id);
+                    }
+                }
             }
         }
         if ("@state" eq "questestinterop section item resprocessing itemproc_extension webct:x_webct_v01_autocalculate webct:x_webct_v01_anstolerance") {
@@ -3197,7 +3209,7 @@
     push @{$sequencesfiles},'question_database.sequence';
     foreach my $category (sort keys %{$catinfo}) {
         my $seqname;
-        if ($cms eq 'webct4ce') { 
+        if ($cms eq 'webctce4') { 
             $seqname = $$catinfo{$category}{title}.'_'.$category;
         } else {
             $seqname = $$catinfo{$category}{title};
@@ -3286,12 +3298,12 @@
             $probtitle{$id} =~ s/:/_/g;
             $probtitle{$id} .= '_'.$id;
         }
-        if (($cms eq 'webct4ce' && $container ne 'database') ||
+        if (($cms eq 'webctce4' && $container ne 'database') ||
             ($cms eq 'webctvista4'))   {
             my $probdir;
             my $catid = $$settings{$$allids[0]}{category};
             if ($catid) {
-                if ($cms eq 'webct4ce') { 
+                if ($cms eq 'webctce4') { 
                     $probdir = $$catinfo{$catid}{title}.'_'.$catid;
                 } else {
                     $probdir = $$catinfo{$catid}{title};
@@ -3325,7 +3337,7 @@
                     my $probdir;
                     my $catid = $$settings{$$allids[$j]}{category};
                     if ($catid) {
-                        if ($cms eq 'webct4ce') {
+                        if ($cms eq 'webctce4') {
                             $probdir = $$catinfo{$catid}{title}.'_'.$catid;
                         } else {
                             $probdir = $$catinfo{$catid}{title};
@@ -3756,7 +3768,7 @@
         if ($$settings{$id}{class} eq 'numerical') {
             foreach my $numid (@{$$settings{$id}{numids}}) {
                 foreach my $var (keys %{$$settings{$id}{$numid}{vars}}) {
-                    if ($cms eq 'webct4ce') {
+                    if ($cms eq 'webctce4') {
                         $$settings{$id}{text} =~ s/{($var)}/\$$1 /g;
                     } elsif ($cms eq 'webctvista4') {
                         $$settings{$id}{text} =~ s/\[($var)\]/\$$1 /g;
@@ -3782,8 +3794,9 @@
             }
         }
         $$total{prob} ++;
+
         if (exists($$settings{$id}{uri})) {
-            if ($cms eq 'webct4ce') {
+            if ($cms eq 'webctce4') {
                 if ($$settings{$id}{imagtype} =~ /^image\//) {
                     $questionimage = '<p><img src="../../resfiles/'.$$settings{$id}{uri}.'" /></p>'."\n";
                 } else {
@@ -4092,7 +4105,7 @@
                      ($$settings{$id}{class} eq 'shortanswer')) {
                 my $labelnum = 0;
                 my @str_labels = ();
-                if ($cms eq 'webct4ce') {
+                if ($cms eq 'webctce4') {
                     foreach my $str_id (@{$$settings{$id}{str}}) {
                         foreach my $label (@{$$settings{$id}{$str_id}{labels}}) {
                             push(@str_labels,$label);
@@ -4252,7 +4265,7 @@
                             }
                             $increment .= '1';
                         }
-                        if ($cms eq 'webct4ce') { 
+                        if ($cms eq 'webctce4') { 
                             $formula =~ s/{($var)}/(\$$1)/g;
                         } elsif ($cms eq 'webctvista4') {
                             $formula =~ s/\[($var)\]/(\$$1)/g;
@@ -4305,7 +4318,7 @@
             my $probdir;
             my $catid = $$settings{$id}{category};
             if ($catid) {
-                if ($cms eq 'webct4ce') {
+                if ($cms eq 'webctce4') {
                     $probdir = $$catinfo{$catid}{title}.'_'.$catid;
                 } else {
                     $probdir = $$catinfo{$catid}{title};