[LON-CAPA-cvs] cvs: loncom /interface londocs.pm lonmenu.pm lonpreferences.pm /localize lonlocal.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 07 Nov 2003 23:22:23 -0000


www		Fri Nov  7 18:22:23 2003 EDT

  Modified files:              
    /loncom/interface	londocs.pm lonmenu.pm lonpreferences.pm 
    /loncom/localize	lonlocal.pm 
  Log:
  Minoru had a better idea on how to show translators where material appears
  on the screen.
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.94 loncom/interface/londocs.pm:1.95
--- loncom/interface/londocs.pm:1.94	Tue Nov  4 14:18:16 2003
+++ loncom/interface/londocs.pm	Fri Nov  7 18:22:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.94 2003/11/04 19:18:16 www Exp $
+# $Id: londocs.pm,v 1.95 2003/11/07 23:22:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -796,7 +796,6 @@
     $r->send_http_header;
     return OK if $r->header_only;
 
-    &Apache::lonlocal::clearreroutetrans();
 # --------------------------------------------- Initialize help topics for this
   foreach ('Adding_Course_Doc','Main_Course_Documents',
            'Adding_External_Resource','Navigate_Content',
@@ -1283,7 +1282,7 @@
          &entryline(0,&mt("Click to download or use your browser's Save Link function"),$showdoc).'</table></p>');
   }
  }
- $r->print(&Apache::lonlocal::endreroutetrans().'</body></html>');
+ $r->print('</body></html>');
  return OK;
 } 
 
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.97 loncom/interface/lonmenu.pm:1.98
--- loncom/interface/lonmenu.pm:1.97	Sat Nov  1 11:37:21 2003
+++ loncom/interface/lonmenu.pm	Fri Nov  7 18:22:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.97 2003/11/01 16:37:21 www Exp $
+# $Id: lonmenu.pm,v 1.98 2003/11/07 23:22:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -66,7 +66,6 @@
 # ============================= This gets called at the top of the body section
 
 sub menubuttons {
-    &Apache::lonlocal::reroutetrans();
     my $forcereg=shift;
     my $target  =shift;
     my $registration=shift;
@@ -177,7 +176,6 @@
 # ====================================== This gets called in the header section
 
 sub registerurl {
-    &Apache::lonlocal::reroutetrans();
     my $forcereg=shift;
     my $target = shift;
     my $result = '';
@@ -213,7 +211,6 @@
 # =========== and in the body of the document
 
 sub innerregister {
-    &Apache::lonlocal::reroutetrans();
     my $forcereg=shift;
     my $target = shift;
     my $result = '';
@@ -894,8 +891,6 @@
     $r->send_http_header;
     return OK if $r->header_only;
 
-    &Apache::lonlocal::clearreroutetrans();
-
     my $form=&serverform();
     my $bodytag=&Apache::loncommon::bodytag('Main Menu');
     my $function='student';
@@ -928,7 +923,6 @@
 $bodytag
 ENDHEADER
     $r->print('<table>'.&inlinemenu().'</table>'.$form);
-    $r->print(&Apache::lonlocal::endreroutetrans());
     $r->print('</body></html>');
     return OK;
 }
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.31 loncom/interface/lonpreferences.pm:1.32
--- loncom/interface/lonpreferences.pm:1.31	Mon Sep 29 15:33:51 2003
+++ loncom/interface/lonpreferences.pm	Fri Nov  7 18:22:21 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.31 2003/09/29 19:33:51 www Exp $
+# $Id: lonpreferences.pm,v 1.32 2003/11/07 23:22:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -51,6 +51,7 @@
 use DynaLoader; # for Crypt::DES version
 use Apache::loncommon();
 use Apache::lonhtmlcommon();
+use Apache::lonlocal;
 
 #
 # Write lonnet::passwd to do the call below.
@@ -108,9 +109,9 @@
     my $user       = $ENV{'user.name'};
     my $domain     = $ENV{'user.domain'};
     my %userenv = &Apache::lonnet::get
-        ('environment',['languages','translator']);
+        ('environment',['languages']);
     my $language=$userenv{'languages'};
-    my $translator=$userenv{'translator'};
+
     my $bodytag=&Apache::loncommon::bodytag(
               'Change Your Language Preferences');
     $r->print(<<ENDLSCREEN);
@@ -122,13 +123,7 @@
 <br />Preferred language:
 <input type="text" size="5" value="$language" name="language" />
 ENDLSCREEN
-    if ($ENV{'user.adv'}) {
-	$r->print (<<ENDTRSC);
-<br />Willing to translate for language:
-<input type="text" size="5" value="$translator" name="translator" />
-ENDTRSC
-    }
-    $r->print('<br /><input type="submit" value="Change" /></form></body></html>');
+    $r->print('<br /><input type="submit" value="'.&mt('Change').'" /></form></body></html>');
 }
 
 
@@ -149,21 +144,6 @@
         &Apache::lonnet::delenv('environment\.languages');
         $message='Reset preferred language';
     }
-    if ($ENV{'user.adv'}) {
-	$message.='<br />';
-	my $newtrans  = $ENV{'form.translator'};
-	$newtrans=~s/[^\-\w]//g;
-	if ($newtrans) {
-	    &Apache::lonnet::put('environment',{'translator' => $newtrans});
-	    &Apache::lonnet::appenv('environment.translator' => $newtrans);
-	    $message.='Set translator to '.$newtrans;
-	} else {
-	    &Apache::lonnet::del('environment',['translator']);
-	    &Apache::lonnet::delenv('environment\.translator');
-	    $message.='Reset translator';
-	}
-    }
-
     my $bodytag=&Apache::loncommon::bodytag(
                     'Change Your Language Preferences');
     $r->print(<<ENDVCSCREEN);
Index: loncom/localize/lonlocal.pm
diff -u loncom/localize/lonlocal.pm:1.25 loncom/localize/lonlocal.pm:1.26
--- loncom/localize/lonlocal.pm:1.25	Sat Oct 11 17:06:11 2003
+++ loncom/localize/lonlocal.pm	Fri Nov  7 18:22:22 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Localization routines
 #
-# $Id: lonlocal.pm,v 1.25 2003/10/11 21:06:11 www Exp $
+# $Id: lonlocal.pm,v 1.26 2003/11/07 23:22:22 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -171,8 +171,6 @@
 our @ISA = qw (Exporter);
 our @EXPORT = qw(mt mtn ns);
 
-my $reroute;
-
 # ========================================================= The language handle
 
 use vars qw($lh);
@@ -181,32 +179,12 @@
 
 sub mt (@) {
 #    my $fh=Apache::File->new('>>/home/www/loncapa/loncom/localize/localize/newphrases.txt');
-#    print $fh join('',@_)."\n";
+#    print $fh @_[0]."\n";
 #    $fh->close();
-    unless ($ENV{'environment.translator'}) {
-	if ($lh) {
-	    return $lh->maketext(@_);
-	} else {
-	    return @_;
-	}
+    if ($lh) {
+	return $lh->maketext(@_);
     } else {
-	if ($lh) {
-	    my $trans=$lh->maketext(@_);
-	    my $link='<a target="trans" href="/cgi-bin/translator.pl?arg1='.
-		&Apache::lonnet::escape($_[0]).'&arg2='.
-		&Apache::lonnet::escape($_[1]).'&arg3='.
-		&Apache::lonnet::escape($_[2]).'&lang='.
-		$ENV{'environment.translator'}.
-		'">[['.$trans.']]</a>';
-	    if ($ENV{'transreroute'}) {
-		$reroute.=$link;
-		return $trans;
-	    } else {
-		return $link;
-	    }
-	} else {
-	    return @_;
-	}
+	return @_;
     }
 }
 
@@ -251,28 +229,6 @@
 	$hash{$_}=&mt($hash{$_});
     }
     return %hash;
-}
-# ======================================================== Re-route translation
-
-sub clearreroutetrans {
-    &reroutetrans();
-    $reroute='';
-}
-
-# ======================================================== Re-route translation
-
-sub reroutetrans {
-    $ENV{'transreroute'}=1;
-}
-
-# ==================================================== End re-route translation
-sub endreroutetrans {
-    $ENV{'transreroute'}=0;
-    if ($ENV{'environment.translator'}) {
-	return $reroute;
-    } else {
-	return '';
-    }
 }
 
 # ========= Get a handle (do not invoke in vain, leave this to access handlers)