[LON-CAPA-cvs] cvs: loncom /xml scripttag.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Sat, 17 Nov 2007 01:43:01 -0000


albertel		Fri Nov 16 20:43:01 2007 EDT

  Modified files:              
    /loncom/xml	scripttag.pm 
  Log:
  - mt
  - name the scriptvars links so they will be unique when grading mutliple students at the same time
  
  
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.144 loncom/xml/scripttag.pm:1.145
--- loncom/xml/scripttag.pm:1.144	Wed Oct 10 20:24:46 2007
+++ loncom/xml/scripttag.pm	Fri Nov 16 20:43:00 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.144 2007/10/11 00:24:46 albertel Exp $
+# $Id: scripttag.pm,v 1.145 2007/11/17 01:43:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -30,7 +30,8 @@
 
 use strict;
 use Apache::lonnet;
-use Apache::style;
+use Apache::lonlocal;
+use Apache::style();
 
 #Globals
 # this used to pass around the standard callsub arguments to a tag func
@@ -136,16 +137,19 @@
 
 	    $uname =~s/\W//g;
 	    $udom  =~s/\W//g;
+	    my $function_name = 
+		join('_','LONCAPA_scriptvars',$uname,$udom,
+		     $env{'form.counter'},$Apache::lonxml::curdepth);
 	    my $script_var ="<script type=\"text/javascript\">
 // <![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('$start_page<pre>";
+    function $function_name() {newWindow=open('','new_W','width=500,height=500,scrollbars=1,resizable=yes');newWindow.$windowopen;newWindow.document.writeln('$start_page<pre>";
 	    my $listing=&Apache::run::dump($target,$safeeval);
 	    $listing=~s/\\/\\\\/g;
 	    $listing=~s/\'/\\\'/g;
 	    $script_var.=$listing;
 	    $script_var.= "<\\/pre>$end_page');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:$function_name();void(0);\">".&mt('Script Vars')."</a><br />";
 	    &Apache::lonxml::add_script_result($script_var);
 	}
     } elsif ($target eq "edit" ) {
@@ -242,7 +246,7 @@
     my $script=&Apache::lonnet::getfile($location);
     if ($script == -1) {
       if ($target eq 'edit') {
-        $error='</tr><tr><td>Errors</td><td colspan="2"><b> Unable to find <i>'.$location.'</i></b></td>'."\n";
+        $error='</tr><tr><td>'.&mt('Errors').'</td><td colspan="2"><b>'.&mt(' Unable to find [_1]','<span class="LC_filename">'.$location.'</span>').'</b></td>'."\n";
       } else {
 	&Apache::lonxml::error("<b> Unable to find <i>$location</i> for scriptlib</b>");
 	return "";