Diff for /loncom/xml/scripttag.pm between versions 1.170 and 1.174

version 1.170, 2014/07/27 11:39:29 version 1.174, 2015/04/06 16:27:12
Line 118  sub start_script { Line 118  sub start_script {
     } elsif ($target eq "edit" ) {      } elsif ($target eq "edit" ) {
       #&Apache::run::run($bodytext,$safeeval);        #&Apache::run::run($bodytext,$safeeval);
       #$result="<br /> &lt;$token->[1]&gt; output: <br />$bodytext<br />Source:<br />";        #$result="<br /> &lt;$token->[1]&gt; output: <br />$bodytext<br />Source:<br />";
  my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser);      my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser);
  $result=&Apache::edit::tag_start($target,$token,'Script');      $result=&Apache::edit::tag_start($target,$token,'Script');
  $result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4);  
           my $depth = $Apache::lonxml::curdepth;
           $result.='<span id="LC_edit_problem_codemirror">';
           unless ($env{'environment.nocodemirror'}) {
               # only show button if codemirror activated
               $result.='<input type="button" id="fitsize'.$depth.'" value="'.&mt("Dynamic size").
               '" onclick="autosize(\''.$depth.'\')" />';
           }
           $result.=&Apache::edit::editfield($token->[1],$bodytext,'',80,4).'</span>';
   
           unless ($env{'environment.nocodemirror'}) {
               $result.='<script type="text/javascript">
                   var cm'.$depth.' = CodeMirror.fromTextArea(document.getElementById("homework_edit_'.$depth.'"),
                   {
                       mode: "perl",
                       lineWrapping: true,
                       lineNumbers: true,
                       tabSize: 4,
                       indentUnit: 4,
                       autoCloseBrackets: true,
                       styleActiveLine: true,
                       
                       extraKeys: {
                           "Tab": "indentMore",
                           "Shift-Tab": "indentLess"
                       }
                   });
                   if(sessionStorage.getItem("autosized_'.$depth.'") != null) {
                       document.getElementById("fitsize'.$depth.'").value = "'.&mt("Fixed size").'";
                       cm'.$depth.'.setSize("","auto");
                   }
               </script>';
           }
                   
   
     } elsif ($target eq 'meta') {      } elsif ($target eq 'meta') {
  my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser);   my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser);
     }      }
Line 141  sub start_script { Line 175  sub start_script {
                   }                    }
               }                }
           } elsif (($type eq 'text/javascript') && ($bodytext ne '')) {            } elsif (($type eq 'text/javascript') && ($bodytext ne '')) {
               if ($url =~ m{^\Q/uploaded/$cdom/$cnum/docs/\E}) {                if ($url =~ m{^\Q/uploaded/$cdom/$cnum/\E(docs|supplemental)/}) {
                   if ($bodytext =~ m{\.addMediaSrc\((["'])(?:(?!\1).)+\1\)}) {                    if ($bodytext =~ m{\.addMediaSrc\((["'])((?!\1).)+\1\);}) {
                       my $quote = $1;                        my $quote = $1;
                       if ($bodytext =~ m{\Q.addMediaSrc($quote\E([^$quote]+)\Q$quote)\E}) {                        if ($bodytext =~ m{\Q.addMediaSrc($quote\E([^$quote]+)\Q$quote)\E}) {
                           my $fname = $1;                            my $fname = $1;
Line 225  sub start_script { Line 259  sub start_script {
                           }                            }
                       }                        }
                   }                    }
                     if ($bodytext =~ m{loadScript\(\s*(['"])((?:(?!\1).)+\.js)\1,\s*function}is) {
                         my $fname = $2;
                         if ($fname) {
                             my $cleanhref =
                                 &Apache::londefdef::clean_docs_httpref($fname,$url,$cdom,$cnum);
                             if ($cleanhref) {
                                 &Apache::lonxml::extlink($cleanhref);
                             }
                         }
                     }
               }                }
           }            }
       }        }
Line 635  sub end_storetc { Line 679  sub end_storetc {
   
 sub start_physnet {  sub start_physnet {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $bodytext = '/adm/includes/physnet.sty';      my $bodytext = '/res/adm/includes/physnet.sty';
     my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);      my $location=&Apache::lonnet::filelocation($Apache::lonxml::pwd['-1'],$bodytext);
     my $cbistyletext=&Apache::lonnet::getfile($location);      my $cbistyletext=&Apache::lonnet::getfile($location);
   
     %$style = (%$style,&Apache::style::styleparser($target,$cbistyletext));      %$style = (%$style,&Apache::style::styleparser($target,$cbistyletext));
     $$parser['-1']->unget_token($token);      if (keys(%$style) && (($target eq 'web') || ($target eq 'tex'))) {
           $$parser['-1']->unget_token($token);
       }
 #    if ( defined($$style{'physnet'}) ) {  #    if ( defined($$style{'physnet'}) ) {
 #        &Apache::lonxml::newparser($parser,\$$style{'physnet'});  #        &Apache::lonxml::newparser($parser,\$$style{'physnet'});
 #    }  #    }

Removed from v.1.170  
changed lines
  Added in v.1.174


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