Diff for /loncom/xml/lonxml.pm between versions 1.505.2.2 and 1.505.2.3

version 1.505.2.2, 2010/08/16 17:29:11 version 1.505.2.3, 2010/09/29 16:02:19
Line 1528  SIMPLECONTENT Line 1528  SIMPLECONTENT
   
 sub verify_html {  sub verify_html {
     my ($filecontents)=@_;      my ($filecontents)=@_;
     if ($filecontents!~/(?:\<|\&lt\;)(?:html|xml)[^\<]*(?:\>|\&gt\;)/is) {      my ($is_html,$is_xml);
        return &mt('File does not have [_1] or [_2] starting tag','&lt;html&gt;','&lt;xml&gt;');      if ($filecontents =~/(?:\<|\&lt\;)\?xml[^\<]*\?(?:\>|\&gt\;)/is) {
     }          $is_xml = 1;
     if ($filecontents!~/(?:\<|\&lt\;)\/(?:html|xml)(?:\>|\&gt\;)/is) {      } elsif ($filecontents =~/(?:\<|\&lt\;)html(?:\s+[^\<]+|\s*)[^\<]*(?:\>|\&gt\;)/is) {
        return &mt('File does not have [_1] or [_2] ending tag','&lt;html&gt;','&lt;xml&gt;');          $is_html = 1;
     }      }
     if ($filecontents!~/(?:\<|\&lt\;)(?:body|frameset)[^\<]*(?:\>|\&gt\;)/is) {      unless ($is_xml || $is_html) {
        return &mt('File does not have [_1] or [_2] starting tag','&lt;body&gt;','&lt;frameset&gt;');          return &mt('File does not have [_1] or [_2] starting tag','&lt;html&gt;','&lt;?xml ?&gt;');
     }      }
     if ($filecontents!~/(?:\<|\&lt\;)\/(?:body|frameset)[^\<]*(?:\>|\&gt\;)/is) {      if ($is_html) {
        return &mt('File does not have [_1] or [_2] ending tag','&lt;body&gt;','&lt;frameset&gt;');          if ($filecontents!~/(?:\<|\&lt\;)\/html(?:\>|\&gt\;)/is) {
               return &mt('File does not have [_1] ending tag','&lt;html&gt;');
           }
           if ($filecontents!~/(?:\<|\&lt\;)(?:body|frameset)[^\<]*(?:\>|\&gt\;)/is) {
               return &mt('File does not have [_1] or [_2] starting tag','&lt;body&gt;','&lt;frameset&gt;');
           }
           if ($filecontents!~/(?:\<|\&lt\;)\/(?:body|frameset)[^\<]*(?:\>|\&gt\;)/is) {
               return &mt('File does not have [_1] or [_2] ending tag','&lt;body&gt;','&lt;frameset&gt;');
           }
     }      }
     return '';      return '';
 }  }
Line 1631  FULLPAGE Line 1639  FULLPAGE
               $htmlerror='<span class="LC_error">'.$htmlerror.'</span>';                $htmlerror='<span class="LC_error">'.$htmlerror.'</span>';
           }            }
           if (&Apache::lonhtmlcommon::htmlareabrowser()) {            if (&Apache::lonhtmlcommon::htmlareabrowser()) {
               $textareaclass = 'class="LC_richDetectHtml"';                $textareaclass = 'class="LC_richDefaultOff"';
           }            }
       }        }
       my $editfooter=(<<ENDFOOTER);        my $editfooter=(<<ENDFOOTER);
Line 1807  ENDNOTFOUND Line 1815  ENDNOTFOUND
                 $result = &Apache::lontexconvert::converted(\$filecontents,                  $result = &Apache::lontexconvert::converted(\$filecontents,
                               $env{'form.texengine'});                                $env{'form.texengine'});
                 if ($env{'form.return_only_error_and_warning_counts'}) {                  if ($env{'form.return_only_error_and_warning_counts'}) {
                     if (&verify_html('<html><body>'.$result.'</body></html>')) {  
                         $errorcount++;  
                     }  
                     $result = "$errorcount:$warningcount";                      $result = "$errorcount:$warningcount";
                 }                  }
             } else {              } else {

Removed from v.1.505.2.2  
changed lines
  Added in v.1.505.2.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>