Diff for /loncom/xml/scripttag.pm between versions 1.67 and 1.74

version 1.67, 2002/03/22 20:05:19 version 1.74, 2002/07/17 18:00:03
Line 43  BEGIN { Line 43  BEGIN {
   &Apache::lonxml::register('Apache::scripttag',    &Apache::lonxml::register('Apache::scripttag',
     ('script','scriptlib','parserlib','import',      ('script','scriptlib','parserlib','import',
      'window','display','storetc','physnet',       'window','display','storetc','physnet',
      'standalone'));       'standalone','comment'));
 }  }
   
 sub start_script {  sub start_script {
Line 62  sub start_script { Line 62  sub start_script {
       if (($target eq 'answer') && ($Apache::lonhomework::viewgrades == 'F')) {        if (($target eq 'answer') && ($Apache::lonhomework::viewgrades == 'F')) {
  $Apache::lonxml::evaluate--;   $Apache::lonxml::evaluate--;
  $result.="<a href=\"javascript:newWindow=open(\'\',\'new_W\',\'width=500,height=200,scrollbars=1\');newWindow.document.open(\'text/html\',\'replace\');newWindow.document.writeln(\'<html><head><title>newwindow</title></head><body bgcolor=&quot;#FFFFFF&quot;><pre>";   $result.="<a href=\"javascript:newWindow=open(\'\',\'new_W\',\'width=500,height=200,scrollbars=1\');newWindow.document.open(\'text/html\',\'replace\');newWindow.document.writeln(\'<html><head><title>newwindow</title></head><body bgcolor=&quot;#FFFFFF&quot;><pre>";
  my $listing= &Apache::run::dump($target,$safeeval);   my $listing= &HTML::Entities::encode(&Apache::run::dump($target,$safeeval));
  $listing =~ s/\n/\\n/g;  
  $listing =~ s/\"/&quot;/g;  
  $listing =~ s/\'/&rsquo;/g;  
  $listing =~ s/</&lt;/g;  
  $listing =~ s/>/&gt;/g;  
  $listing =~ s/&/&amp;/g;  
  $result.=$listing;   $result.=$listing;
  $result.= "</pre></body></html>\');newWindow.document.close();void(0);\">Script Vars</a><br />";   $result.= "</pre></body></html>\');newWindow.document.close();void(0);\">Script Vars</a><br />";
       }        }
Line 98  sub end_script { Line 93  sub end_script {
     return $token->[2];      return $token->[2];
   } elsif ($target eq 'edit' ) {    } elsif ($target eq 'edit' ) {
     return &Apache::edit::end_table();      return &Apache::edit::end_table();
   } elsif (($ENV{'request.state'} eq 'construct') && ($target eq 'answer')) {    } elsif (($target eq 'answer')) {
     $Apache::lonxml::evaluate++;      $Apache::lonxml::evaluate++;
   }    }
   return '';    return '';
Line 161  sub start_scriptlib { Line 156  sub start_scriptlib {
   if ($target eq "edit" ) {    if ($target eq "edit" ) {
     $result=      $result=
       &Apache::edit::tag_start($target,$token,'New Script Functions').        &Apache::edit::tag_start($target,$token,'New Script Functions').
  &Apache::edit::editline($token->[1],$bodytext,'',40,1).   &Apache::edit::editline($token->[1],$bodytext,'',40).
   $error.'</td></tr>'.    $error.'</td></tr>'.
     &Apache::edit::end_table();      &Apache::edit::end_table();
   }    }
Line 206  sub start_parserlib { Line 201  sub start_parserlib {
   if ($target eq "edit" ) {    if ($target eq "edit" ) {
     $result=      $result=
       &Apache::edit::tag_start($target,$token,'New Tag Definitions').        &Apache::edit::tag_start($target,$token,'New Tag Definitions').
  &Apache::edit::editline($token->[1],$bodytext,'',40,1).   &Apache::edit::editline($token->[1],$bodytext,'',40).
   $error.'</td></tr>'.    $error.'</td></tr>'.
     &Apache::edit::end_table();      &Apache::edit::end_table();
   }    }
Line 277  sub start_import { Line 272  sub start_import {
     &Apache::lonxml::newparser($parser,\$file,$dir);      &Apache::lonxml::newparser($parser,\$file,$dir);
   } elsif ($target eq "edit" ) {    } elsif ($target eq "edit" ) {
     $result.=&Apache::edit::tag_start($target,$token);      $result.=&Apache::edit::tag_start($target,$token);
     $result.=&Apache::edit::editline($token->[1],$bodytext,'',40,1);      $result.=&Apache::edit::editline($token->[1],$bodytext,'',40);
     #FIXME this need to convert $bodytext to be a contruction space reference      #FIXME this need to convert $bodytext to be a contruction space reference
     #my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);      #my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);
     #$result.="Click<a href=\"$location\">here</a> to edit<br />"      #$result.="Click<a href=\"$location\">here</a> to edit<br />"
Line 299  sub start_import { Line 294  sub start_import {
 }  }
   
 sub end_import {  sub end_import {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   pop(@Apache::inputtags::import);    pop(@Apache::inputtags::import);
   return '';    my $result;
     if ($target eq 'edit' ) { $result=&Apache::edit::end_table(); }
     return $result;
 }  }
   
 sub start_storetc {  sub start_storetc {
Line 350  sub end_standalone { Line 348  sub end_standalone {
   return '';    return '';
 }  }
   
   sub start_comment {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result='';
     if ($target eq 'edit') {
       $result=&Apache::edit::tag_start($target,$token);
       my $bodytext=&Apache::lonxml::get_all_text("/comment",$$parser[$#$parser]);
       $result.=&Apache::edit::editfield($token->[1],$bodytext,'',40,4)
     } elsif ( $target eq 'modified') {
       $result=$token->[4].&Apache::edit::modifiedfield($token);
     } elsif ( $target eq 'web' || $target eq 'tex' ||
       $target eq 'grade' || $target eq 'answer' || $target eq 'meta') {
       #normally throw away comments
       my $bodytext=&Apache::lonxml::get_all_text("/comment",$$parser[$#$parser]);
     }
     return $result;
   }
   
   sub end_comment {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     if ($target eq 'edit' ) { return &Apache::edit::end_table(); }
     return '';
   }
   
   
 sub xmlparse {  sub xmlparse {
   my ($string) = @_;    my ($string) = @_;

Removed from v.1.67  
changed lines
  Added in v.1.74


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