Diff for /loncom/xml/scripttag.pm between versions 1.126 and 1.134.2.1

version 1.126, 2005/04/07 06:56:27 version 1.134.2.1, 2006/03/29 04:32:19
Line 105  sub start_script { Line 105  sub start_script {
     if ( $target eq "modified" ) {      if ( $target eq "modified" ) {
  $result=$token->[4].&Apache::edit::modifiedfield('/script',$parser);   $result=$token->[4].&Apache::edit::modifiedfield('/script',$parser);
     } elsif ( $target eq 'web' || $target eq 'tex' ||      } elsif ( $target eq 'web' || $target eq 'tex' ||
       $target eq 'grade' || $target eq 'answer' ||        $target eq 'grade' || $target eq 'webgrade' ||
       $target eq 'analyze' ) {        $target eq 'answer' || $target eq 'analyze' ) {
  my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser);   my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser);
  if (!$Apache::lonxml::default_homework_loaded) {   if (!$Apache::lonxml::default_homework_loaded) {
     &Apache::lonxml::default_homework_load($safeeval);      &Apache::lonxml::default_homework_load($safeeval);
Line 122  sub start_script { Line 122  sub start_script {
 // <![CDATA[  // <![CDATA[
     function LONCAPA_scriptvars_".$uname."_".$udom."_"."$Apache::lonxml::curdepth() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('<html><head><title>Script Vars</title></head><body bgcolor=\"#FFFFFF\"><pre>";      function LONCAPA_scriptvars_".$uname."_".$udom."_"."$Apache::lonxml::curdepth() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('<html><head><title>Script Vars</title></head><body bgcolor=\"#FFFFFF\"><pre>";
     my $listing=&Apache::run::dump($target,$safeeval);      my $listing=&Apache::run::dump($target,$safeeval);
       $listing=~s/\\/\\\\/g;
     $listing=~s/\'/\\\'/g;      $listing=~s/\'/\\\'/g;
     $listing=~s/\n/\\n/g;  
     $listing=~s/\r/\\r/g;  
     $result.=$listing;      $result.=$listing;
     $result.= "</pre></body></html>');newWindow.document.close();}      $result.= "</pre></body></html>');newWindow.document.close();newWindow.focus()}
 // ]]>  // ]]>
 </script><a href=\"javascript:LONCAPA_scriptvars_".$uname."_".$udom."_$Apache::lonxml::curdepth();void(0);\">Script Vars</a><br />";  </script><a href=\"javascript:LONCAPA_scriptvars_".$uname."_".$udom."_$Apache::lonxml::curdepth();void(0);\">Script Vars</a><br />";
  }   }
Line 173  sub start_display { Line 172  sub start_display {
   if ( $target eq "modified" ) {    if ( $target eq "modified" ) {
       $result=$token->[4].&Apache::edit::modifiedfield("/display",$parser);        $result=$token->[4].&Apache::edit::modifiedfield("/display",$parser);
   } elsif ( $target eq 'web' || $target eq 'tex' ||    } elsif ( $target eq 'web' || $target eq 'tex' ||
     $target eq 'grade' || $target eq 'answer' ||      $target eq 'grade' || $target eq 'webgrade' ||
       $target eq 'analyze') {      $target eq 'answer' || $target eq 'analyze') {
       my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/display",$parser);        my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/display",$parser);
       if (!$Apache::lonxml::default_homework_loaded) {        if (!$Apache::lonxml::default_homework_loaded) {
   &Apache::lonxml::default_homework_load($safeeval);    &Apache::lonxml::default_homework_load($safeeval);
Line 309  sub start_window { Line 308  sub start_window {
     } 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::text_arg('Text of Link:','linktext',$token,70);   $result.=&Apache::edit::text_arg('Text of Link:','linktext',$token,70);
  $result.=&Apache::edit::text_arg('Height:','width',$token,5);   $result.=&Apache::edit::text_arg('Height:','height',$token,5);
  $result.=&Apache::edit::text_arg('Width:','height',$token,5);   $result.=&Apache::edit::text_arg('Width:','width',$token,5);
  $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();   $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
     } elsif ($target eq 'modified') {      } elsif ($target eq 'modified') {
  my $constructtag=&Apache::edit::get_new_args($token,$parstack,   my $constructtag=&Apache::edit::get_new_args($token,$parstack,
      $safeeval,'linttext',       $safeeval,'linktext',
      'width','height');       'width','height');
  if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); }   if ($constructtag) { $result=&Apache::edit::rebuild_tag($token); }
     }      }
Line 351  sub start_import { Line 350  sub start_import {
   
   $bodytext=Apache::run::evaluate($bodytext,$safeeval,$$parstack[$#$parstack]);    $bodytext=Apache::run::evaluate($bodytext,$safeeval,$$parstack[$#$parstack]);
   
   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||    if ($target eq 'web' ||  $target eq 'webgrade' || $target eq 'grade' 
       $target eq 'tex' || $target eq 'analyze' ) {        || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze' ) {
     # FIXME this probably needs to be smart about construction vs.      # FIXME this probably needs to be smart about construction vs.
     # non construction space.      # non construction space.
     my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);      my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);
Line 443  sub start_standalone { Line 442  sub start_standalone {
   my $result='';    my $result='';
   if ($target eq 'web' ) {    if ($target eq 'web' ) {
     if ( $env{'request.course.id'} ) {      if ( $env{'request.course.id'} ) {
       my $inside = &Apache::lonxml::get_all_text("/standalone",$parser);        my $inside = &Apache::lonxml::get_all_text("/standalone",$parser,$style);
     } else {      } else {
       $result='<table bgcolor="#E1E1E1" border="2"><tr><td>';        $result='<table bgcolor="#E1E1E1" border="2"><tr><td>';
     }      }
Line 468  sub start_comment { Line 467  sub start_comment {
   my $result='';    my $result='';
   if ($target eq 'edit') {    if ($target eq 'edit') {
     $result=&Apache::edit::tag_start($target,$token);      $result=&Apache::edit::tag_start($target,$token);
     my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser);      my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser,$style);
     $result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4)      $result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4)
   } elsif ( $target eq 'modified') {    } elsif ( $target eq 'modified') {
     $result=$token->[4].&Apache::edit::modifiedfield("/comment",$parser);      $result=$token->[4].&Apache::edit::modifiedfield("/comment",$parser);
   } elsif ( $target eq 'web' || $target eq 'tex' || $target eq 'grade' ||    } elsif ( $target eq 'web' || $target eq 'tex' || $target eq 'grade' ||
     $target eq 'answer' || $target eq 'meta' || $target eq 'analyze') {      $target eq 'answer' || $target eq 'meta' || $target eq 'analyze') {
     #normally throw away comments      #normally throw away comments
     my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser);      my $bodytext=&Apache::lonxml::get_all_text("/comment",$parser,$style);
   }    }
   return $result;    return $result;
 }  }
Line 502  sub xmlparse { Line 501  sub xmlparse {
     @Apache::scripttag::parser_env;      @Apache::scripttag::parser_env;
   my @parser;    my @parser;
   &Apache::lonxml::newparser(\@parser,\$string);    &Apache::lonxml::newparser(\@parser,\$string);
     &Apache::lonxml::startredirection();
   my $result=&Apache::lonxml::inner_xmlparse($target,$tagstack,    my $result=&Apache::lonxml::inner_xmlparse($target,$tagstack,
      $parstack,\@parser,       $parstack,\@parser,
      $safeeval,$style);       $safeeval,$style);
     $result.=&Apache::lonxml::endredirection();
   &Apache::lonxml::debug("target is $target xmlparse recursion ending with $result");    &Apache::lonxml::debug("target is $target xmlparse recursion ending with $result");
   return $result;    return $result;
 }  }
Line 544  sub start_parse { Line 545  sub start_parse {
  }   }
  @Apache::scripttag::parser_env = @_;   @Apache::scripttag::parser_env = @_;
  $result=&Apache::run::run("return &xmlparse(q\0$inside\0);",$safeeval);   $result=&Apache::run::run("return &xmlparse(q\0$inside\0);",$safeeval);
    if ($target eq 'grade' || $target eq 'answer' ||
       $target eq 'analyze') {
       # grade/answer/analyxe should produce no output but if we
       # are redirecting, the redirecter should know what to do
       # with the output
       if (!$Apache::lonxml::redirection) { $result=''; }
    }
     }      }
     return $result;      return $result;
 }  }

Removed from v.1.126  
changed lines
  Added in v.1.134.2.1


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