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

www lon-capa-cvs@mail.lon-capa.org
Sun, 20 Oct 2002 18:42:53 -0000


www		Sun Oct 20 14:42:53 2002 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
    /loncom/xml	lonxml.pm 
  Log:
  Bug 112
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.33 loncom/interface/londocs.pm:1.34
--- loncom/interface/londocs.pm:1.33	Fri Oct 18 10:50:22 2002
+++ loncom/interface/londocs.pm	Sun Oct 20 14:42:53 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.33 2002/10/18 14:50:22 www Exp $
+# $Id: londocs.pm,v 1.34 2002/10/20 18:42:53 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -260,6 +260,38 @@
           if ($result==OK) {
              $r->print('<font color="green">ok</font>');
              $r->rflush();
+             &Apache::lonnet::countacc($url);
+             $url=~/\.(\w+)$/;
+             if (&Apache::loncommon::fileembstyle($1) eq 'ssi') {
+		 $r->print('<br />');
+                 $r->rflush();
+                 my $default='';
+                 if ($1=~/(problem|exam|quiz|assess|survey|form|library)/) {
+                    $default=&Apache::lonnet::getfile(
+                    '/home/httpd/html/res/adm/includes/default_homework.lcpm');
+                 }
+                 for (my $i=0;$i<=$level*5;$i++) {
+                     $r->print('&nbsp;');
+                 }
+                 $r->print('- Rendering: ');
+                 &Apache::lonxml::xmlparse($r,'web',
+                   &Apache::lonnet::getfile(
+                    &Apache::lonnet::filelocation('',$url)),$default);
+                 if (($Apache::lonxml::errorcount) ||
+                     ($Apache::lonxml::warningcount)) {
+		     if ($Apache::lonxml::errorcount) {
+                        $r->print('<font color="red"><b>'.
+			  $Apache::lonxml::errorcount.' error(s)</b></font> ');
+                     }
+		     if ($Apache::lonxml::warningcount) {
+                        $r->print('<font color="blue">'.
+			  $Apache::lonxml::warningcount.' warning(s)</font>');
+                     }
+                 } else {
+                     $r->print('<font color="green">ok</font>');
+                 }
+                 $r->rflush();
+             }
 	     my $dependencies=
                 &Apache::lonnet::metadata($url,'dependencies');
              foreach (split(/\,/,$dependencies)) {
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.204 loncom/xml/lonxml.pm:1.205
--- loncom/xml/lonxml.pm:1.204	Thu Oct 17 13:13:44 2002
+++ loncom/xml/lonxml.pm	Sun Oct 20 14:42:53 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.204 2002/10/17 17:13:44 albertel Exp $
+# $Id: lonxml.pm,v 1.205 2002/10/20 18:42:53 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,7 +60,7 @@
 
 package Apache::lonxml; 
 use vars 
-qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace $prevent_entity_encode);
+qw(@pwd @outputstack $redirection $import @extlinks $metamode $evaluate %insertlist @namespace $prevent_entity_encode $errorcount $warningcount);
 use strict;
 use HTML::LCParser();
 use HTML::TreeBuilder();
@@ -852,6 +852,8 @@
   my ($request,$target)=@_;
   $Apache::lonxml::request=$request;
   $Apache::lonxml::registered = 0;
+  $errorcount=0;
+  $warningcount=0;
   &init_counter();
   @Apache::lonxml::pwd=();
   @Apache::lonxml::extlinks=();
@@ -1352,6 +1354,7 @@
 }
 
 sub error {
+  $errorcount++;
   if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
     # If printing in construction space, put the error inside <pre></pre>
     print "<b>ERROR:</b>".join("\n",@_)."\n";
@@ -1377,6 +1380,7 @@
 }
 
 sub warning {
+  $warningcount++;
   if ($ENV{'request.state'} eq 'construct') {
     print "<b>W</b>ARNING<b>:</b>".join('<br />',@_)."<br />\n";
   }