[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 27 Nov 2006 23:24:38 -0000


albertel		Mon Nov 27 18:24:38 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - some changes to get the existing 'btEninge' style .tasks to work again
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.208 loncom/homework/bridgetask.pm:1.209
--- loncom/homework/bridgetask.pm:1.208	Mon Nov 27 15:42:42 2006
+++ loncom/homework/bridgetask.pm	Mon Nov 27 18:24:36 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.208 2006/11/27 20:42:42 albertel Exp $
+# $Id: bridgetask.pm,v 1.209 2006/11/27 23:24:36 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1285,7 +1285,12 @@
 					     [@_]);
 		$criteria = &layout_webgrade_Criteria($dim,$id,$criteria);
 		my $internal_location=&internal_location($id);
-		$result=~s/\Q$internal_location\E/$criteria/;
+		if ($result =~ m/\Q$internal_location\E/) {
+		    $result=~s/\Q$internal_location\E/$criteria/;
+		} else {
+		    $result.=$criteria;
+		}
+
 	    }
 	}
         $result.="</div>";
@@ -2065,7 +2070,7 @@
     my $dim = &get_id($parstack,$safeeval);
     push(@Apache::bridgetask::dimension,$dim);
     &Apache::lonxml::startredirection();
-    return &internal_location($dim);
+    return;# &internal_location($dim);
 }
 
 {
@@ -2289,8 +2294,20 @@
 	    }
 	}
 	if ($result !~ /^\s*$/s) {
-	    $result = "\n".'<div class="LC_question">'.
-		"\n".$result."\n</div>\n";
+	    # FIXME? this maybe unneccssary in the future, (CSE101 BT
+	    # from Fall 2006 geenrate a div that attempts to hide some
+	    # of the output in an odd way, this is a workaround so
+	    # those old ones will continue to work.  # It puts the
+	    # LC_question div to come after any starting closie div
+	    # that the dimension produces
+	    if ($result =~ m{\s*</div>}) {
+		$result =~ s{(\s*</div>)}
+		            {$1\n<div class="LC_question">};
+	    } else {
+		$result = "\n".'<div class="LC_question">'.
+		    "\n".$result;
+	    }
+	    $result .= "\n</div>\n";
 	}
     } elsif ($target eq 'webgrade') {
 	# in case of any side effects that we need
@@ -2314,7 +2331,11 @@
 					     [@_]);
 		$criteria = &layout_webgrade_Criteria($dim,$id,$criteria);
 		my $internal_location=&internal_location($id);
-		$result=~s/\Q$internal_location\E/$criteria/;
+		if ($result =~ m/\Q$internal_location\E/) {
+		    $result =~ s/\Q$internal_location\E/$criteria/;
+		} else {
+		    $result.=$criteria ;
+		}
 	    }
 	}
 	if (&nest()) {