Diff for /loncom/xml/scripttag.pm between versions 1.153 and 1.159

version 1.153, 2010/05/23 12:29:25 version 1.159, 2011/12/10 18:11:05
Line 102  sub start_script { Line 102  sub start_script {
     ($Apache::lonhomework::viewgrades == 'F')) {      ($Apache::lonhomework::viewgrades == 'F')) {
     $Apache::lonxml::evaluate--;      $Apache::lonxml::evaluate--;
     my (undef,undef,$udom,$uname)=&Apache::lonnet::whichuser();      my (undef,undef,$udom,$uname)=&Apache::lonnet::whichuser();
     my $windowopen=&Apache::lonhtmlcommon::javascript_docopen();  
     my $start_page =  
  &Apache::loncommon::start_page('Script Vars', undef,  
        {'only_body' => 1,  
  'bgcolor'   => '#FFFFFF',  
  'js_ready'  => 1,});  
     my $end_page =  
  &Apache::loncommon::end_page({'js_ready' => 1,});  
   
     $uname =~s/\W//g;      $uname =~s/\W//g;
     $udom  =~s/\W//g;      $udom  =~s/\W//g;
     my $function_name =       my $function_name = 
  join('_','LONCAPA_scriptvars',$uname,$udom,   join('_','LONCAPA_scriptvars',$uname,$udom,
      $env{'form.counter'},$Apache::lonxml::curdepth);       $env{'form.counter'},$Apache::lonxml::curdepth);
     my $script_var ="<script type=\"text/javascript\">              &Apache::lonxml::add_script_result(
 // <![CDATA[               &Apache::loncommon::modal_adhoc_window($function_name,500,500,
     function $function_name() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('$start_page<pre>";                              '<pre>'.&Apache::run::dump($target,$safeeval).'</pre>',
     my $listing=&Apache::run::dump($target,$safeeval);                              &mt('Script Vars'))."<br />");
     $listing=~s/\\/\\\\/g;  
     $listing=~s/\'/\\\'/g;  
     $script_var.=$listing;  
     $script_var.= "<\\/pre>$end_page');newWindow.document.close();newWindow.focus()}  
 // ]]>  
 </script><a href=\"javascript:$function_name();void(0);\">".&mt('Script Vars')."</a><br />";  
     &Apache::lonxml::add_script_result($script_var);  
  }   }
     } elsif ($target eq "edit" ) {      } elsif ($target eq "edit" ) {
       #&Apache::run::run($bodytext,$safeeval);        #&Apache::run::run($bodytext,$safeeval);
Line 385  sub start_import { Line 369  sub start_import {
       return "";        return "";
     }      }
     my $importmode=&Apache::lonxml::get_param('importmode',$parstack,$safeeval);      my $importmode=&Apache::lonxml::get_param('importmode',$parstack,$safeeval);
     if ($importmode eq 'problem') {      if (($importmode eq 'problem') || ($importmode eq 'part')) {
        $file=~s/^\s*<problem>/<library>/s;  # We are using import to import published problems
        $file=~s/<\/problem>\s*$/<\/library>/s;         if (($importmode eq 'problem') || ($file=~/<part[^<]*>/s)) {
   # We explicitly don't want this to be a separate part or the problem already has parts
             $file=~s/^\s*<problem>/<library>/s;
     $file=~s/<\/problem>\s*$/<\/library>/s;
          } else {
   # We want this to be a separate part, but it currently is not
             $file=~s/^\s*<problem>/<library><part>/s;
     $file=~s/<\/problem>\s*$/<\/part><\/library>/s;
          }
     }      }
     my $dir=$location;      my $dir=$location;
     $dir=~s:/[^/]*$::;      $dir=~s:/[^/]*$::;
Line 406  sub start_import { Line 398  sub start_import {
     $location=~s/\s*$//s;      $location=~s/\s*$//s;
     $result.=&Apache::edit::editline($location,$bodytext,'',40);      $result.=&Apache::edit::editline($location,$bodytext,'',40);
     $result.=&Apache::edit::browse(undef,'textnode');      $result.=&Apache::edit::browse(undef,'textnode');
         $result.= '<label>'.&mt('Import as:').      $result.= '&nbsp;<label>'.&mt('Import as:').
               '<select name="importmode_'.$Apache::lonxml::curdepth.'">';                '<select name="importmode_'.$Apache::lonxml::curdepth.'">';
     foreach my $option ('','problem') {      my %options=&Apache::lonlocal::texthash(''        => 'as standard library',
                                               'problem' => 'as problem',
                                               'part'    => 'as problem part(s)');
       foreach my $option (sort(keys(%options))) {
        $result.='<option value="'.$option.'"';         $result.='<option value="'.$option.'"';
        if ($option eq &Apache::lonxml::get_param('importmode',$parstack,$safeeval)) {         if ($option eq &Apache::lonxml::get_param('importmode',$parstack,$safeeval)) {
           $result.=' selected="selected"';            $result.=' selected="selected"';
        }         }
        $result.='>'.($option?&mt('as problem'):&mt('as standard library')).'</option>';         $result.='>'.$options{$option}.'</option>';
     }      }
     $result.='</select></label>';      $result.='</select></label>';
     #FIXME this need to convert $bodytext to be a contruction space reference      #FIXME this need to convert $bodytext to be a contruction space reference
Line 429  sub start_import { Line 424  sub start_import {
     if ($id) {      if ($id) {
       $result.='" id="'.$id;        $result.='" id="'.$id;
     }      }
     $result.='">';      $result.='" importmode="'.$token->[2]{'importmode'}.'">';
     $result.=$bodytext;      $result.=$bodytext;
     $result.='</import>';      $result.='</import>';
   }    }
Line 616  sub start_algebra { Line 611  sub start_algebra {
  $inside = &Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);   $inside = &Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
  if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') {   if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') {
     my $style=&Apache::lonxml::get_param('style',$parstack,$safeeval);      my $style=&Apache::lonxml::get_param('style',$parstack,$safeeval);
     $result=&Apache::lontexconvert::algebra($inside,undef,$target,$style,$parstack,$safeeval);      $result=&Apache::lontexconvert::algebra($inside,$target,$style,$parstack,$safeeval);
  }   }
  $Apache::lonxml::post_evaluate=0;   $Apache::lonxml::post_evaluate=0;
     }      }

Removed from v.1.153  
changed lines
  Added in v.1.159


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