[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 12 Oct 2004 22:25:41 -0000


albertel		Tue Oct 12 18:25:41 2004 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - BUG#3445 try to detect when someone uploads a rendering of a Lon-CAPA reesource. (Wlooks for 'BEGIN LON-CAPA Internal'
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.342 loncom/xml/lonxml.pm:1.343
--- loncom/xml/lonxml.pm:1.342	Thu Oct  7 12:27:48 2004
+++ loncom/xml/lonxml.pm	Tue Oct 12 18:25:40 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.342 2004/10/07 16:27:48 albertel Exp $
+# $Id: lonxml.pm,v 1.343 2004/10/12 22:25:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -287,7 +287,7 @@
     my $headerstring='';
     if (($ENV{'browser.os'} eq 'mac') && (!$ENV{'browser.mathml'})) { 
 	$headerstring.=
-	    '<meta Content-Type="text/html; charset=x-mac-roman">';
+	    '<meta Content-Type="text/html; charset=x-mac-roman" />';
     } elsif (!$ENV{'browser.mathml'} && $ENV{'browser.unicode'}) {
 	$headerstring.=
 	    '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
@@ -1288,7 +1288,7 @@
 </body>
 </html>
 ENDNOTFOUND
-    $filecontents='';
+        $filecontents='';
 	if ($ENV{'request.state'} ne 'published') {
 	    if ($filetype eq 'sty') {
 		$filecontents=&createnewsty();
@@ -1299,6 +1299,10 @@
 	}
     } else {
 	unless ($ENV{'request.state'} eq 'published') {
+	    if ($filecontents=~/BEGIN LON-CAPA Internal/) {
+		&Apache::lonxml::error(&mt('This file appears to be a rendering of a Lon-CAPA resource. If this is correct, this resource will act very oddly and incorrectly.'));
+	    }
+
 	    if ($ENV{'form.attemptclean'}) {
 		$filecontents=&htmlclean($filecontents,1);
 	    }