Diff for /loncom/xml/lonxml.pm between versions 1.494 and 1.494.4.5

version 1.494, 2009/04/17 01:00:20 version 1.494.4.5, 2010/10/01 14:21:55
Line 243  sub tokeninputfield { Line 243  sub tokeninputfield {
         document.tokeninput.barcode.value='';          document.tokeninput.barcode.value='';
     }        }  
 </script>  </script>
 <form method="post" name="tokeninput">  <form method="post" name="tokeninput" action="">
 <table border="2" bgcolor="#FFFFBB">  <table border="2" bgcolor="#FFFFBB">
 <tr><th>DocID Checkin</th></tr>  <tr><th>DocID Checkin</th></tr>
 <tr><td>  <tr><td>
Line 251  sub tokeninputfield { Line 251  sub tokeninputfield {
 <tr>  <tr>
 <td>Scan in Barcode</td>  <td>Scan in Barcode</td>
 <td><input type="text" size="22" name="barcode"   <td><input type="text" size="22" name="barcode" 
 onChange="updatetoken()"/></td>  onchange="updatetoken()"/></td>
 </tr>  </tr>
 <tr><td><i>or</i> Type in DocID</td>  <tr><td><i>or</i> Type in DocID</td>
 <td>  <td>
Line 260  onChange="updatetoken()"/></td> Line 260  onChange="updatetoken()"/></td>
 <input type="text" size="5" name="codetwo" />  <input type="text" size="5" name="codetwo" />
 <b><font size="+2">*</font></b>  <b><font size="+2">*</font></b>
 <input type="text" size="10" name="codethree" value="$defhost"   <input type="text" size="10" name="codethree" value="$defhost" 
 onChange="this.value=this.value.toUpperCase()" />  onchange="this.value=this.value.toUpperCase()" />
 </td></tr>  </td></tr>
 </table>  </table>
 </td></tr>  </td></tr>
Line 757  sub init_safespace { Line 757  sub init_safespace {
   '&maxima_cas_formula_fix');    '&maxima_cas_formula_fix');
   
   $safehole->wrap(\&Apache::lonr::r_eval,$safeeval,'&r_eval');    $safehole->wrap(\&Apache::lonr::r_eval,$safeeval,'&r_eval');
     $safehole->wrap(\&Apache::lonr::Rentry,$safeeval,'&Rentry');
     $safehole->wrap(\&Apache::lonr::Rarray,$safeeval,'&Rarray');
   $safehole->wrap(\&Apache::lonr::r_check,$safeeval,'&r_check');    $safehole->wrap(\&Apache::lonr::r_check,$safeeval,'&r_check');
   $safehole->wrap(\&Apache::lonr::r_cas_formula_fix,$safeeval,    $safehole->wrap(\&Apache::lonr::r_cas_formula_fix,$safeeval,
                   '&r_cas_formula_fix');                    '&r_cas_formula_fix');
Line 1041  sub get_id { Line 1043  sub get_id {
     my ($parstack,$safeeval)=@_;      my ($parstack,$safeeval)=@_;
     my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);      my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
     if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\d\s[:punct:]])/) {      if ($env{'request.state'} eq 'construct' && $id =~ /([._]|[^\w\d\s[:punct:]])/) {
  &error(&mt("ID &quot;[_1]&quot; contains invalid characters, IDs are only allowed to contain letters, numbers, spaces and -",'<tt>'.$id.'</tt>'));   &error(&mt("ID [_1] contains invalid characters, IDs are only allowed to contain letters, numbers, spaces and -",'<tt>'.$id.'</tt>'));
     }      }
     if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }      if ($id =~ /^\s*$/) { $id = $Apache::lonxml::curdepth; }
     return $id;      return $id;
Line 1521  SIMPLECONTENT Line 1523  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 1544  sub renderingoptions { Line 1554  sub renderingoptions {
                        = &Apache::loncommon::plainlanguagedescription($_);                         = &Apache::loncommon::plainlanguagedescription($_);
         }          }
     }      }
     return      my $output;
        '<span class="LC_nobreak">'.      unless ($env{'form.forceedit'}) {
        &mt('Language:').' '.         $output .=
        &Apache::loncommon::select_form($env{'form.languages'},'languages',             '<span class="LC_nobreak">'.
                                                      %langchoices).'             &mt('Language:').' '.
      </span>             &Apache::loncommon::select_form(
      <span class="LC_nobreak">'.                 $env{'form.languages'},
                  'languages',
                  &Apache::lonlocal::texthash(%langchoices)).
              '</span>';
       }
       $output .=
        ' <span class="LC_nobreak">'.
        &mt('Math Rendering:').' '.         &mt('Math Rendering:').' '.
        &Apache::loncommon::select_form($env{'form.texengine'},'texengine',         &Apache::loncommon::select_form(
                                                      ('' => '',             $env{'form.texengine'},
                                                       'tth' => 'tth (TeX to HTML)',             'texengine',
                                                       'jsMath' => 'jsMath',             &Apache::lonlocal::texthash
                                                       'mimetex' => 'mimetex (Convert to Images)')).'                 (''        => '',
      </span>';                  'tth'     => 'tth (TeX to HTML)',
                   'jsMath'  => 'jsMath',
                   'mimetex' => 'mimetex (Convert to Images)')).
        '</span>';
       return $output;
 }  }
   
 sub inserteditinfo {  sub inserteditinfo {
Line 1704  sub handler { Line 1724  sub handler {
  $request->set_last_modified(&Apache::lonnet::metadata($request->uri,   $request->set_last_modified(&Apache::lonnet::metadata($request->uri,
       'lastrevisiondate'));        'lastrevisiondate'));
     }      }
       # Embedded Flash movies (e.g., from Camtasia) served from https will not display in IE
       #   if XML config file has expired from cache.
       if ($ENV{'SERVER_PORT'} == 443) {
           if ($request->uri =~ /\.xml$/) {
               my ($httpbrowser,$clientbrowser) =
                   &Apache::loncommon::decode_user_agent($request);
               if ($clientbrowser =~ /^explorer$/i) {
                   delete $request->headers_out->{'Cache-control'};
                   delete $request->headers_out->{'Pragma'};
                   my $expiration = time + 60;
                   my $date=strftime("%a, %d %b %Y %H:%M:%S GMT",gmtime($expiration));
                   $request->headers_out->set("Expires" => $date);
               }
           }
       }
     $request->send_http_header;      $request->send_http_header;
           
     return OK if $request->header_only;      return OK if $request->header_only;

Removed from v.1.494  
changed lines
  Added in v.1.494.4.5


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