Diff for /loncom/xml/scripttag.pm between versions 1.158 and 1.160

version 1.158, 2011/12/09 22:04:55 version 1.160, 2011/12/19 01:49:32
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 $scriptblocklog=$start_page.  
                                &Apache::loncommon::start_scrollbox('500px','480px','480px').  
                                '<pre>'.&Apache::run::dump($target,$safeeval).'</pre>'.  
                                &Apache::loncommon::end_scrollbox().  
                                $end_page;  
             $scriptblocklog=~s/\'/\\'/gs;  
             &Apache::lonxml::add_script_result(              &Apache::lonxml::add_script_result(
              &Apache::loncommon::modal_adhoc_script($function_name,500,500,$scriptblocklog).               &Apache::loncommon::modal_adhoc_window($function_name,500,500,
                      "<a href=\"javascript:$function_name();void(0);\">".&mt('Script Vars')."</a><br />"                              '<pre>'.&Apache::run::dump($target,$safeeval).'</pre>',
                                               );                              &mt('Script Vars'))."<br />");
  }   }
     } elsif ($target eq "edit" ) {      } elsif ($target eq "edit" ) {
       #&Apache::run::run($bodytext,$safeeval);        #&Apache::run::run($bodytext,$safeeval);
Line 308  sub start_window { Line 293  sub start_window {
  $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:','height',$token,5);   $result.=&Apache::edit::text_arg('Height:','height',$token,5);
  $result.=&Apache::edit::text_arg('Width:','width',$token,5);   $result.=&Apache::edit::text_arg('Width:','width',$token,5);
  $result.=&Apache::edit::text_arg('Mime Type:','mimetype',$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,
Line 325  sub end_window { Line 309  sub end_window {
   my $result;    my $result;
   if ($target eq 'web' || $target eq 'webgrade') {    if ($target eq 'web' || $target eq 'webgrade') {
     my $output=&Apache::lonxml::endredirection;      my $output=&Apache::lonxml::endredirection;
     $output =~ s/[\n\r]/ /g;  
 #    $output = &HTML::Entities::encode($output,'<>&"\'');  
     $output =~ s/\'/\\\'/g;  
     my $linktext= &Apache::lonxml::get_param('linktext',$parstack,$safeeval);      my $linktext= &Apache::lonxml::get_param('linktext',$parstack,$safeeval);
     if (!$linktext) { $linktext='<sup>*</sup>'; }      if (!$linktext) { $linktext='<sup>*</sup>'; }
     my $width= &Apache::lonxml::get_param('width',$parstack,$safeeval);      my $width= &Apache::lonxml::get_param('width',$parstack,$safeeval);
     if (!$width) { $width='500'; }      if (!$width) { $width='500'; }
     my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval);      my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval);
     if (!$height) { $height='200'; }      if (!$height) { $height='200'; }
     my $mimetype= &Apache::lonxml::get_param('mimetype',$parstack,$safeeval)  
           || 'text/html';  
   
     my ($start_page,$end_page);      my ($start_page,$end_page);
     if ($mimetype eq 'text/html') {      $result=&Apache::loncommon::modal_adhoc_window
  $start_page =             ("LONCAPA_newwindow_$Apache::lonxml::curdepth",$width,$height,$output,$linktext);
     &Apache::loncommon::start_page($linktext, undef,  
    {'only_body' => 1,  
     'bgcolor'   => '#FFFFFF',  
     'js_ready'  => 1,});  
  $end_page =  
     &Apache::loncommon::end_page({'js_ready' => 1,});  
     }  
     $result = "<script type=\"text/javascript\">  
 //<!--  
  function LONCAPA_newwindow_$Apache::lonxml::curdepth() {  
 newWindow=open(".&Apache::lonhtmlcommon::javascript_nothing().",'new_W');  
 newWindow.close();  
 newWindow=open(".&Apache::lonhtmlcommon::javascript_nothing().",'new_W','width=$width,height=$height,scrollbars=1');  
 newWindow.".&Apache::lonhtmlcommon::javascript_docopen($mimetype).";  
 newWindow.document.writeln('$start_page $output $end_page');  
 newWindow.document.close();}  
 //-->  
 </script><a href=\"javascript:LONCAPA_newwindow_$Apache::lonxml::curdepth();void(0);\">$linktext</a>";  
   } elsif ($target eq 'tex') {    } elsif ($target eq 'tex') {
       $result = '}';        $result = '}';
   } else {    } else {

Removed from v.1.158  
changed lines
  Added in v.1.160


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