[LON-CAPA-cvs] cvs: loncom /publisher lonretrieve.pm lonrights.pm lonunauthorized.pm lonupload.pm

www lon-capa-cvs@mail.lon-capa.org
Mon, 22 Sep 2003 15:39:53 -0000


This is a MIME encoded message

--www1064245193
Content-Type: text/plain

www		Mon Sep 22 11:39:53 2003 EDT

  Modified files:              
    /loncom/publisher	lonretrieve.pm lonrights.pm lonunauthorized.pm 
                     	lonupload.pm 
  Log:
  Internationalization.
  
  
--www1064245193
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20030922113953.txt"

Index: loncom/publisher/lonretrieve.pm
diff -u loncom/publisher/lonretrieve.pm:1.22 loncom/publisher/lonretrieve.pm:1.23
--- loncom/publisher/lonretrieve.pm:1.22	Mon May 19 17:53:03 2003
+++ loncom/publisher/lonretrieve.pm	Mon Sep 22 11:39:53 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to retrieve an old version of a file
 #
-# $Id: lonretrieve.pm,v 1.22 2003/05/19 21:53:03 albertel Exp $
+# $Id: lonretrieve.pm,v 1.23 2003/09/22 15:39:53 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,6 +50,7 @@
 use Apache::Constants qw(:common :http :methods);
 use Apache::loncacc;
 use Apache::loncommon();
+use Apache::lonlocal;
 
 # ------------------------------------ Interface for selecting previous version
 sub phaseone {
@@ -71,9 +72,10 @@
     $r->print('<form action=/adm/retrieve method=post>'.
 	      '<input type=hidden name=filename value="/~'.$uname.$fn.'">'.
               '<input type=hidden name=phase value=two>'.
-              '<table border=2><tr><th>Select</th><th>Version</th>'.
-              '<th>Became this version on ...</th>'.
-              '<th>Metadata</th></tr>');
+              '<table border=2><tr><th>'.&mt('Select').'</th><th>'.
+	      &mt('Version').'</th>'.
+              '<th>'.&mt('Became this version on ...').'</th>'.
+              '<th>'.&mt('Metadata').'</th></tr>');
     my $filename;
     opendir(DIR,$resdir);
     while ($filename=readdir(DIR)) {
@@ -87,13 +89,13 @@
                      $version.'"></td><th>'.$version.'</th><td>'.
                      localtime($rmtime).'</td><td>'.
                      '<a href="'.$urldir.$filename.'.meta" target=cat>'.
-                     'Metadata Version '.$version.'</a>');
+                     &mt('Metadata Version').' '.$version.'</a>');
            if (&Apache::loncommon::fileembstyle($suffix) eq 'ssi') {
                $r->print(
                     '&nbsp;&nbsp;<a target=cat href="/adm/diff?filename=/~'.
                         $uname.$fn.
                         '&versiontwo=priv&versiontwo='.$version.
-                        '">Diffs with Version '.$version.'</a>');
+                        '">'.&mt('Diffs with Version').' '.$version.'</a>');
            }
            $r->print('</a></td></tr>');
         }
@@ -104,22 +106,22 @@
         $ratime,$rmtime,$rctime,
         $rblksize,$rblocks)=stat($resfn);
     $r->print('<tr><td><input type=radio name=version value="new"></td>'.
-              '<th>Current</th><td>'.localtime($rmtime).
+              '<th>'.&mt('Current').'</th><td>'.localtime($rmtime).
            '</td><td><a href="'.$urldir.$main.'.'.$suffix.'.meta" target=cat>'.
-              'Metadata current version</a>');           
+              &mt('Metadata current version').'</a>');           
            if (&Apache::loncommon::fileembstyle($suffix) eq 'ssi') {
                $r->print(
                     '&nbsp;&nbsp;<a target=cat href="/adm/diff?filename=/~'.
                         $uname.$fn.
                         '&versiontwo=priv'.
-                        '">Diffs with current Version</a>');
+                        '">'.&mt('Diffs with current Version').'</a>');
            }
            $r->print('</td></tr></table><p>'.
-           '<font size=+1 color=red>Retrieval of an old version will '.
-           'overwrite the file currently in construction space</font><p>'.
-           '<input type=submit value="Retrieve version"></form>');
+           '<font size=+1 color=red>'.
+&mt('Retrieval of an old version will overwrite the file currently in construction space').'</font><p>'.
+           '<input type=submit value="'.&mt('Retrieve version').'"></form>');
 } else {
-    $r->print('<h3>No previous versions published.</h3>');
+    $r->print('<h3>'.&mt('No previous versions published.').'</h3>');
 }
 }
 
@@ -129,9 +131,9 @@
     if ($ENV{'form.version'}) {
         my $version=$ENV{'form.version'};
 	if ($version eq 'new') {
-	    $r->print('<h3>Retrieving current (most recent) version</h3>');
+	    $r->print('<h3>'.&mt('Retrieving current (most recent) version').'</h3>');
         } else {
-            $r->print('<h3>Retrieving old version '.$version.'</h3>');
+            $r->print('<h3>'.&mt('Retrieving old version').' '.$version.'</h3>');
         }
         my $logfile;
         my $ctarget='/home/'.$uname.'/public_html'.$fn;
@@ -142,12 +144,12 @@
         my $csource=$r->dir_config('lonDocRoot').'/res/'.$udom.'/'.$uname.$vfn;
         unless ($logfile=Apache::File->new('>>'.$ctarget.'.log')) {
 	  $r->print(
-         '<font color=red>No write permission to user directory, FAIL</font>');
+         '<font color=red>'.&mt('No write permission to user directory, FAIL').'</font>');
         }
         print $logfile 
 "\n\n================= Retrieve ".localtime()." ================\n".
 "Version: $version\nSource: $csource\nTarget: $ctarget\n";
-        $r->print('<p>Copying file: ');
+        $r->print('<p>'.&mt('Copying file').': ');
         if (copy($csource,$ctarget)) {
 	    $r->print('ok<p>');
             print $logfile "Copied sucessfully.\n\n";
@@ -157,10 +159,10 @@
             print $logfile "Copy failed: $error\n\n";
         }
         $r->print('<font size=+2><a href="/priv/'.$uname.$fn.
-                  '">Back to '.$fn.'</a></font>'); 
+                  '">'.&mt('Back to').' '.$fn.'</a></font>'); 
     } else {
        $r->print(
-   '<font size=+1 color=red>Please pick a version to retrieve</font><p>');
+   '<font size=+1 color=red>'.&mt('Please pick a version to retrieve').'</font><p>');
        &phaseone($r,$fn,$uname,$udom);
     }
 }
@@ -209,7 +211,7 @@
 
   $fn=~s/\/\~(\w+)//;
 
-  $r->content_type('text/html');
+  &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;
 
   $r->print('<html><head><title>LON-CAPA Construction Space</title></head>');
@@ -217,10 +219,11 @@
   $r->print(&Apache::loncommon::bodytag('Retrieve Published Resources'));
 
   
-  $r->print('<h1>Retrieve previous versions of <tt>'.$fn.'</tt></h1>');
+  $r->print('<h1>'.&mt('Retrieve previous versions of').' <tt>'.$fn.'</tt></h1>');
   
   if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) {
-          $r->print('<h3><font color=red>Co-Author: '.$uname.' at '.$udom.
+          $r->print('<h3><font color=red>'.&mt('Co-Author').': '.$uname.
+		    &mt(' at ').$udom.
                '</font></h3>');
   }
 
Index: loncom/publisher/lonrights.pm
diff -u loncom/publisher/lonrights.pm:1.9 loncom/publisher/lonrights.pm:1.10
--- loncom/publisher/lonrights.pm:1.9	Thu Mar 27 20:53:55 2003
+++ loncom/publisher/lonrights.pm	Mon Sep 22 11:39:53 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to show and edit custom distribution rights
 #
-# $Id: lonrights.pm,v 1.9 2003/03/28 01:53:55 www Exp $
+# $Id: lonrights.pm,v 1.10 2003/09/22 15:39:53 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -36,11 +36,12 @@
 use Apache::loncommon();
 use HTML::LCParser;
 use Apache::File;
+use Apache::lonlocal;
 
 sub handler {
 
   my $r=shift;
-  $r->content_type('text/html');
+  &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;
 
   $r->print(
@@ -161,12 +162,17 @@
   my $parser=HTML::LCParser->new(\$contents);
   my $token;
   my $rulecounter=0;
-  my $colzero=($constructmode?'Edit action':'Rule');
+  my $colzero=&mt($constructmode?'Edit action':'Rule');
+my %lt=&Apache::loncommon::texthash('ef' => 'Effect',
+				    'do' => 'Domain',
+				    'co' => 'Course',
+				    'se' => 'Section/Group',
+				    'ro' => 'Role');
 # ---------------------------------------------------------- Start table output
   $r->print(<<ENDSTARTTABLE);
 <table border="2">
-    <tr><th>$colzero</th><th>Effect</th><th>Domain</th><th>Course</th>
-<th>Section</th><th>Role</th></tr>
+    <tr><th>$colzero</th><th>$lt{'ef'}</th><th>$lt{'do'}</th><th>$lt{'co'}</th>
+<th>$lt{'se'}</th><th>$lt{'ro'}</th></tr>
 ENDSTARTTABLE
 # --------------------------------------------------------------------- Default
 # Fast forward to first rule
@@ -193,7 +199,8 @@
   }
   $r->print('</td><td colspan="4">Default');
   if (($token->[2]->{'realm'}) || ($token->[2]->{'role'})) {
-      $r->print(' - <font color="red">Error! No default set.</font>');
+      $r->print(' - <font color="red">'.&mt('Error! No default set.').
+		'</font>');
   }
   $r->print('</td></tr>');
 # Additional roles
@@ -285,7 +292,7 @@
   $r->print('</table>');
 # ------------------------------------------------------------ End table output
   if ($constructmode) { 
-     $r->print('<input type="submit" name="store" value="Store" /></form>'); 
+     $r->print('<input type="submit" name="store" value="'.&mt('Store').'" /></form>'); 
   }
   $r->print('</body></html>');
   return OK;  
Index: loncom/publisher/lonunauthorized.pm
diff -u loncom/publisher/lonunauthorized.pm:1.1 loncom/publisher/lonunauthorized.pm:1.2
--- loncom/publisher/lonunauthorized.pm:1.1	Tue Sep 10 10:41:05 2002
+++ loncom/publisher/lonunauthorized.pm	Mon Sep 22 11:39:53 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Unauthorized to access construction space
 #
-# $Id: lonunauthorized.pm,v 1.1 2002/09/10 14:41:05 www Exp $
+# $Id: lonunauthorized.pm,v 1.2 2003/09/22 15:39:53 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,10 +33,11 @@
 use Apache::loncommon;
 use Apache::lonnet;
 use Apache::loncacc;
+use Apache::lonlocal;
 
 sub handler {
     my $r = shift;
-    $r->content_type('text/html');
+    &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
     return OK if $r->header_only;
 
@@ -57,28 +58,29 @@
 # figure out what went wrong
 
     if ($ownerdomain) {
-	$r->print('<h1>Choose another server</h1>'.
- "<p>The constuction space for this resource is located on another server.</p>"
-        );
+	$r->print('<h1>'.&mt('Choose another server').'</h1><p>'.
+&mt('The constuction space for this resource is located on another server.').
+'</p>');
         my $ownerhome=&Apache::lonnet::homeserver($ownername,$ownerdomain);
         unless ($ownerhome eq 'no_host') {
 	    $r->print(
- "<p>Please log into <tt>".$Apache::lonnet::hostname{$ownerhome}.
- "</tt> to edit.</p>");
+ "<p>".&mt('Please log into')." <tt>".$Apache::lonnet::hostname{$ownerhome}.
+ "</tt> ".&mt('to edit.')."</p>");
         }
     } else {
         $r->print(
-            "<h1>You do not have authoring privileges for this resource</h1>");
+            "<h1>".
+	&mt("You do not have authoring privileges for this resource")."</h1>");
         my ($realownername)=($ENV{'request.editurl'}=~/\/(?:\~|priv\/|home\/)(\w+)/);
         my $realownerhome=
       &Apache::lonnet::homeserver(
         $realownername,$r->dir_config('lonDefDomain'));
         unless ($realownerhome eq 'no_host') {
-           $r->print("<p>Contact ".
+           $r->print("<p>".&mt('Contact')." ".
     &Apache::loncommon::aboutmewrapper(
      &Apache::loncommon::plainname($realownername,
                                $r->dir_config('lonDefDomain')).'('.
-                               $realownername.' at '.
+                               $realownername.&mt(' at ').
                                $r->dir_config('lonDefDomain').')',
 			       $realownername,$r->dir_config('lonDefDomain')).
            ' for access.');
Index: loncom/publisher/lonupload.pm
diff -u loncom/publisher/lonupload.pm:1.19 loncom/publisher/lonupload.pm:1.20
--- loncom/publisher/lonupload.pm:1.19	Mon Aug  4 14:22:55 2003
+++ loncom/publisher/lonupload.pm	Mon Sep 22 11:39:53 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Handler to upload files into construction space
 #
-# $Id: lonupload.pm,v 1.19 2003/08/04 18:22:55 www Exp $
+# $Id: lonupload.pm,v 1.20 2003/09/22 15:39:53 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -40,6 +40,7 @@
 use Apache::Log();
 use Apache::lonnet;
 use HTML::Entities();
+use Apache::lonlocal;
 
 my $DEBUG=0;
 
@@ -98,32 +99,32 @@
  '<input type=hidden name=phase value=two>'.
  '<input type=hidden name=datatoken value="'.&upfile_store.'">'.
  '<input type=hidden name=uploaduname value="'.$uname.'">'.
- 'Store uploaded file as '.
+ &mt('Store uploaded file as ').
  '<input type=text size=50 name=filename value="'.$fn.'"><br>'.
- '<input type=submit value="Store"></form>');
+ '<input type=submit value="'.&mt('Store').'"></form>');
       # Check for bad extension and warn user
       if ($fn=~/\.(\w+)$/ && 
 	  (&Apache::loncommon::fileembstyle($1) eq 'hdn')) {
 	  $r->print(
  '<font color=red>'.
- 'The extension on this file, "'.$1.
- '", is reserved internally by LON-CAPA. <br \>'.
- 'Please change the extension.'.
+ &mt('The extension on this file,').' "'.$1.
+ '"'.&mt(', is reserved internally by LON-CAPA.').' <br \>'.
+ &mt('Please change the extension.').
  '</font>');
       } elsif($fn=~/\.(\w+)$/ && 
 	      !defined(&Apache::loncommon::fileembstyle($1))) {
 	  $r->print(
  '<font color=red>'.
- 'The extension on this file, "'.$1.
- '", is not recognized by LON-CAPA. <br \>'.
- 'Please change the extension.'.
+ &mt('The extension on this file,').' "'.$1.
+ '"'.&mt(', is not recognized by LON-CAPA.').' <br \>'.
+ &mt('Please change the extension.').
  '</font>');
       }
   } else {
-      $r->print('<font color=red>Illegal filename.</font>');
+      $r->print('<font color=red>'.&mt('Illegal filename.').'</font>');
   }
  } else {
-     $r->print('<font color=red>No upload file specified.</font>');
+     $r->print('<font color=red>'.&mt('No upload file specified.').'</font>');
  }
 }
 
@@ -147,11 +148,11 @@
 	if ((-e $target) && ($ENV{'form.override'} ne 'Yes')) {
            $r->print(
  '<form action=/adm/upload method=post>'.
- 'File <tt>'.$fn.'</tt> exists. Overwrite? '.
+ &mt('File').' <tt>'.$fn.'</tt> '.&mt('exists. Overwrite?').' '.
  '<input type=hidden name=phase value=two>'.
  '<input type=hidden name=filename value="'."$url".'">'.
  '<input type=hidden name=datatoken value="'.$datatoken.'">'.
- '<input type=submit name=override value="Yes"></form>');
+ '<input type=submit name=override value="'.&mt('Yes').'"></form>');
        } else {
            my $source=$r->dir_config('lonDaemons').
 	                             '/tmp/'.$datatoken.'.tmp';
@@ -159,49 +160,50 @@
 	   if ($fn=~/\.(\w+)$/ && 
 	       (&Apache::loncommon::fileembstyle($1) eq 'hdn')) {
 	       $r->print(
- 'File <tt>'.$fn.'</tt> could not be copied.<br />'.
+ &mt('File').' <tt>'.$fn.'</tt> '.&mt('could not be copied.').'<br />'.
  '<font color=red>'.
- 'The extension on this file is reserved internally by LON-CAPA.'.
+ &mt('The extension on this file is reserved internally by LON-CAPA.').
  '</font>');
               $r->print('<p><font size=+2><a href="'.$path.
-                        '">Back to Directory</a></font>');
+                        '">'.&mt('Back to Directory').'</a></font>');
 	   } elsif ($fn=~/\.(\w+)$/ && 
 		    !defined(&Apache::loncommon::fileembstyle($1))) {
 	       $r->print(
- 'File <tt>'.$fn.'</tt> could not be copied.<br />'.
+ &mt('File').' <tt>'.$fn.'</tt> '.&mt('could not be copied.').'<br />'.
  '<font color=red>'.
- 'The extension on this file is not recognized by LON-CAPA.'.
+ &mt('The extension on this file is not recognized by LON-CAPA.').
  '</font>');
 	       $r->print('<p><font size=+2><a href="'.$path.
-                        '">Back to Directory</a></font>');
+                        '">'.&mt('Back to Directory').'</a></font>');
 	   } elsif (-d $target) {
 	       $r->print(
  'File <tt>'.$fn.'</tt> could not be copied.<br />'.
  '<font color=red>'.
- 'The target is an existing directory.'.
+ &mt('The target is an existing directory.').
  '</font>');
 	       $r->print('<p><font size=+2><a href="'.$path.
-                        '">Back to Directory</a></font>');
+                        '">'.&mt('Back to Directory').'</a></font>');
 	   } elsif (copy($source,$target)) {
 	       chmod(0660, $target); # Set permissions to rw-rw---.
-	      $r->print('File copied.');
+	      $r->print(&mt('File copied.'));
               $r->print('<p><font size=+2><a href="'.$url.
-                        '">View file</a></font>');
+                        '">'.&mt('View file').'</a></font>');
               $r->print('<p><font size=+2><a href="'.$path.
-                        '">Back to Directory</a></font>');
+                        '">'.&mt('Back to Directory').'</a></font>');
 	   } else {
               $r->print('Failed to copy: '.$!);
               $r->print('<p><font size=+2><a href="'.$path.
-                        '">Back to Directory</a></font>');
+                        '">'.&mt('Back to Directory').'</a></font>');
 	   }
        }
     } else {
        $r->print(
-   '<font size=+1 color=red>Please use browser "Back" button and pick a filename</font><p>');
+   '<font size=+1 color=red>'.
+&mt('Please use browser "Back" button and pick a filename').'</font><p>');
     }
   } else {
     $r->print(
-   '<font size=+1 color=red>Please use browser "Back" button and pick a filename</font><p>');
+   '<font size=+1 color=red>'.&mt('Please use browser "Back" button and pick a filename').'</font><p>');
   }
 }
 
@@ -248,7 +250,7 @@
 # ----------------------------------------------------------- Start page output
 
 
-  $r->content_type('text/html');
+  &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;
 
   $r->print('<html><head><title>LON-CAPA Construction Space</title></head>');
@@ -256,7 +258,8 @@
   $r->print(&Apache::loncommon::bodytag('Upload file to Construction Space'));
   
   if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) {
-          $r->print('<h3><font color=red>Co-Author: '.$uname.' at '.$udom.
+          $r->print('<h3><font color=red>'&mt('Co-Author').': '.$uname.
+&mt(' at ').$udom.
                '</font></h3>');
   }
 

--www1064245193--