[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm structuretags.pm /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 19 Sep 2003 20:29:30 -0000


This is a MIME encoded message

--albertel1064003370
Content-Type: text/plain

albertel		Fri Sep 19 16:29:30 2003 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm structuretags.pm 
    /loncom/xml	lonxml.pm 
  Log:
  - start locaization of structuretags.pm
  - need to check form values against localized versions of string (it works!)
  - Need to stop enociding high ascci othewise no umlauts
  
  
--albertel1064003370
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20030919162930.txt"

Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.149 loncom/homework/lonhomework.pm:1.150
--- loncom/homework/lonhomework.pm:1.149	Fri Sep 19 10:11:11 2003
+++ loncom/homework/lonhomework.pm	Fri Sep 19 16:29:29 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.149 2003/09/19 14:11:11 www Exp $
+# $Id: lonhomework.pm,v 1.150 2003/09/19 20:29:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -90,8 +90,8 @@
 		return ('web');
 	    }
 	} else {
-	    if ( $ENV{'form.problemmode'} eq 'View' ||
-		 $ENV{'form.problemmode'} eq 'Discard Edits and View') {
+	    if ( $ENV{'form.problemmode'} eq &mt('View') ||
+		 $ENV{'form.problemmode'} eq &mt('Discard Edits and View')) {
 		if ( defined($ENV{'form.submitted'}) &&
 		     (!defined($ENV{'form.resetdata'})) &&
 		     (!defined($ENV{'form.newrandomization'}))) {
@@ -99,9 +99,9 @@
 		} else {
 		    return ('web','answer');
 		}
-	    } elsif ( $ENV{'form.problemmode'} eq 'Edit' ) {
+	    } elsif ( $ENV{'form.problemmode'} eq &mt('Edit') ) {
 		if ( $ENV{'form.submitted'} eq 'edit' ) {
-		    if ( $ENV{'form.submit'} eq 'Submit Changes and View' ) {
+		    if ( $ENV{'form.submit'} eq &mt('Submit Changes and View') ) {
 			return ('modified','web','answer');
 		    } else {
 			return ('modified','edit');
@@ -327,7 +327,7 @@
     my $filetmp =$file.".tmp";
     my $error=0;
 
-    if ($ENV{'form.Undo'} eq 'undo') {
+    if ($ENV{'form.Undo'} eq &mt('undo')) {
 	my $error=0;
 	if (!copy($file,$filetmp)) { $error=1; }
 	if ((!$error) && (!copy($filebak,$file))) { $error=1; }
@@ -468,7 +468,7 @@
 	if (!$error) { $problem=&Apache::lonnet::getfile($file); }
     }
     &Apache::lonhomework::showhashsubset(\%ENV,'^form');
-    if ( $ENV{'form.submit'} eq 'Submit Changes and View' ) {
+    if ( $ENV{'form.submit'} eq &mt('Submit Changes and View') ) {
 	&Apache::lonhomework::showhashsubset(\%ENV,'^form');
 	$ENV{'form.problemmode'}='View';
 	&renderpage($request,$file);
@@ -684,9 +684,9 @@
     my ($symb) = &Apache::lonxml::whichuser();
     &Apache::lonxml::debug('symb is '.$symb);
     if ($ENV{'request.state'} eq "construct" || $symb eq '') {
-	if ($ENV{'form.resetdata'} eq 'Reset Submissions' ||
-	    $ENV{'form.resetdata'} eq 'New Problem Variation' ||
-	    $ENV{'form.newrandomization'} eq 'New Randomization') {
+	if ($ENV{'form.resetdata'} eq &mt('Reset Submissions') ||
+	    $ENV{'form.resetdata'} eq &mt('New Problem Variation') ||
+	    $ENV{'form.newrandomization'} eq &mt('New Randomization')) {
 	    my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
 	    &Apache::lonnet::tmpreset($symb,'',$domain,$name);
 	    &Apache::lonxml::debug("Attempt reset");
@@ -701,9 +701,9 @@
 		#&view_or_edit_menu($request);
 		$ENV{'form.problemmode'}='View';
 		&renderpage($request,$file);
-	    } elsif ($ENV{'form.problemmode'} eq 'EditXML') {
+	    } elsif ($ENV{'form.problemmode'} eq &mt('EditXML')) {
 		&editxmlmode($request,$file);
-	    } elsif ($ENV{'form.problemmode'} eq 'Calculate answers') {
+	    } elsif ($ENV{'form.problemmode'} eq &mt('Calculate answers')) {
 		&analyze($request,$file);
 	    } else {
 		&renderpage($request,$file);
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.209 loncom/homework/structuretags.pm:1.210
--- loncom/homework/structuretags.pm:1.209	Wed Sep 10 17:18:07 2003
+++ loncom/homework/structuretags.pm	Fri Sep 19 16:29:29 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.209 2003/09/10 21:18:07 albertel Exp $
+# $Id: structuretags.pm,v 1.210 2003/09/19 20:29:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,6 +36,7 @@
 use Apache::lonnet;
 use Apache::File();
 use Apache::lonmenu;
+use Apache::lonlocal;
 
 BEGIN {
     &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext',
@@ -159,8 +160,8 @@
 		$ENV{'form.rndseed'}=$rndseed;
 	    }
 	}
-	if ($ENV{'form.resetdata'} eq 'New Problem Variation' ||
-	    $ENV{'form.newrandomization'} eq 'New Randomization') {
+	if ($ENV{'form.resetdata'} eq &mt('New Problem Variation') ||
+	    $ENV{'form.newrandomization'} eq &mt('New Randomization')) {
 	    srand(time);
 	    $rndseed=int(rand(2100000000));
 	    $ENV{'form.rndseed'}=$rndseed;
@@ -178,43 +179,44 @@
 
 sub problem_edit_header {
     return '<input type="hidden" name="submitted" value="edit" />
-       <input type="hidden" name="problemmode" value="Edit" />
-       <input type="submit" name="problemmode" value="Discard Edits and View" />
-       <input type="submit" name="problemmode" value="EditXML" />
-       <input type="submit" name="Undo" value="undo" /> <hr />
-       <input type="submit" name="submit" value="Submit Changes and Edit" />
-       <input type="submit" name="submit" value="Submit Changes and View" /><br /><p>&nbsp;</p><table border="0"><tr><td bgcolor="#DDDDDD">
+       <input type="hidden" name="problemmode" value="'.&mt('Edit').'" />
+       <input type="submit" name="problemmode" value="'.&mt('Discard Edits and View').'" />
+       <input type="submit" name="problemmode" value="'.&mt('EditXML').'" />
+       <input type="submit" name="Undo" value="'.&mt('undo').'" /> <hr />
+       <input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" />
+       <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" /><br /><p>&nbsp;</p><table border="0"><tr><td bgcolor="#DDDDDD">
       ';
 }
 
 sub problem_edit_footer {
-    return '</td></tr></table><br /><input type="submit" name="submit" value="Submit Changes and Edit" />
-    <input type="submit" name="submit" value="Submit Changes and View" />';
+    return '</td></tr></table><br /><input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" />
+    <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />';
 }
 
 sub problem_web_to_edit_header {
     my ($rndseed)=@_;
-    my $result.='<input type="hidden" name="problemmode" value="View" />
-             <input type="submit" name="problemmode" value="Edit" />
-             <input type="submit" name="problemmode" value="EditXML" />
-             <input type="submit" name="newrandomization" value="New Randomization" />
-             <input type="submit" name="resetdata" value="Reset Submissions" />
-             <nobr><input type="submit" name="changerandseed" value="Change Random Seed To:" />
+    my $result.='<input type="hidden" name="problemmode" value="'.&mt('View').'" />
+             <input type="submit" name="problemmode" value="'.&mt('Edit').'" />
+             <input type="submit" name="problemmode" value="'.&mt('EditXML').'" />
+             <input type="submit" name="newrandomization" value="'.&mt('New Randomization').'" />
+             <input type="submit" name="resetdata" value="'.&mt('Reset Submissions').'" />
+             <nobr><input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" />
               <input type="text" name="rndseed" width="10" value="'.
 	       $rndseed.'"
            onChange="javascript:document.lonhomework.changerandseed.click()" /></nobr>
              <input type="checkbox" name="showallfoils" ';
     if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; }
-    $result.= ' />&nbsp;Show&nbsp;All&nbsp;Foils
+    $result.= ' />'.&mt('&nbsp;Show&nbsp;All&nbsp;Foils').'
              <hr />';
     my $numtoanalyze=$ENV{'form.numtoanalyze'};
     if (!$numtoanalyze) { $numtoanalyze=20; }
-    $result.= '<input type="submit" name="problemmode" value="Calculate answers" /> for
+    $result.= '<input type="submit" name="problemmode" value='.
+	&mt('"Calculate answers').'" /> for
              <input type="text" name="numtoanalyze" value="'.
-		 $numtoanalyze.'" size="5" /> versions of this problem.'.
-		     &Apache::loncommon::help_open_topic("Analyze_Problem",
+	     $numtoanalyze.'" size="5" /> '.&mt('versions of this problem').
+	     '.'.&Apache::loncommon::help_open_topic("Analyze_Problem",
 						     '',undef,undef,300).
-		     '<hr />';
+						     '<hr />';
     return $result;
 }
 
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.278 loncom/xml/lonxml.pm:1.279
--- loncom/xml/lonxml.pm:1.278	Mon Sep 15 15:56:44 2003
+++ loncom/xml/lonxml.pm	Fri Sep 19 16:29:29 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.278 2003/09/15 19:56:44 www Exp $
+# $Id: lonxml.pm,v 1.279 2003/09/19 20:29:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -491,9 +491,9 @@
       }
 
       # Encode any high ASCII characters
-      if (!$Apache::lonxml::prevent_entity_encode) {
-	$result=&HTML::Entities::encode($result,"\200-\377");
-      }
+#      if (!$Apache::lonxml::prevent_entity_encode) {
+#	$result=&HTML::Entities::encode($result,"\200-\377");
+#      }
       if ($Apache::lonxml::redirection) {
 	$Apache::lonxml::outputstack['-1'] .= $result;
       } else {

--albertel1064003370--