[LON-CAPA-cvs] cvs: loncom /publisher loncfile.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 15 Dec 2003 20:44:06 -0000


This is a MIME encoded message

--sakharuk1071521046
Content-Type: text/plain

sakharuk		Mon Dec 15 15:44:06 2003 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  Localization is finished. All entries are in ru.pm.
  
  
--sakharuk1071521046
Content-Type: text/plain
Content-Disposition: attachment; filename="sakharuk-20031215154406.txt"

Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.46 loncom/publisher/loncfile.pm:1.47
--- loncom/publisher/loncfile.pm:1.46	Sat Dec 13 14:54:16 2003
+++ loncom/publisher/loncfile.pm	Mon Dec 15 15:44:06 2003
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.46 2003/12/13 19:54:16 taceyjo1 Exp $
+# $Id: loncfile.pm,v 1.47 2003/12/15 20:44:06 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -72,6 +72,7 @@
 use Apache::Log ();
 use Apache::lonnet;
 use Apache::loncommon();
+use Apache::lonlocal;
 
 my $DEBUG=0;
 my $r;				# Needs to be global for some stuff RF.
@@ -211,12 +212,12 @@
 s/^\/home\/$user\/public\_html\//\/home\/httpd\/html\/res\/$domain\/$user\//;
   my $result='';    
   if ( -d $construct ) {
-      return 'Error: destination for operation is an existing directory.';
+      return &mt('Error: destination for operation is an existing directory.');
   }
   if ( -e $published) {
-      $result.='<p><font color="red">Warning: target file exists, and has been published!</font></p>';
+      $result.='<p><font color="red">'.&mt('Warning: target file exists, and has been published!').'</font></p>';
   } elsif ( -e $construct) {
-      $result.='<p><font color="red">Warning: target file exists!</font></p>';
+      $result.='<p><font color="red">'.&mt('Warning: target file exists!').'</font></p>';
   }
   return $result;
 
@@ -260,7 +261,7 @@
     if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; }
     if ($oldsuffix ne $newsuffix) {
 	$result.=
-            '<p><font color="red">Warning: change of MIME type!</font></p>';
+            '<p><font color="red">'.&mt('Warning: change of MIME type!').'</font></p>';
     }
     return $result;
 }
@@ -269,7 +270,7 @@
     my ($request,$dest)=@_;
     #remove bad characters
     if  ($dest=~/[\#\?&]/) {
-	$request->print("<p><font color=\"red\">Invalid characters in requested name have been removed.</font></p>");
+	$request->print("<p><font color=\"red\">".&mt('Invalid characters in requested name have been removed.')."</font></p>");
 	$dest=~s/[\#\?&]//g;
     }
     return $dest;
@@ -312,9 +313,9 @@
 
 sub CloseForm1 {
    my ($request,  $fn) = @_;
-   $request->print('<p><input type="submit" value="Continue" /></p></form>');
+   $request->print('<p><input type="submit" value="'.&mt('Continue').'" /></p></form>');
    $request->print('<form action="'.&url($fn).
-     '" method="POST"><p><input type="submit" value="Cancel" /></p></form>');
+     '" method="POST"><p><input type="submit" value="'.&mt('Cancel').'" /></p></form>');
 }
 
 
@@ -344,7 +345,7 @@
 
 sub CloseForm2 {
   my ($request, $user, $fn) = @_;
-  $request->print('<h3><a href="'.&url($fn).'/">Done</a></h3>');
+  $request->print('<h3><a href="'.&url($fn).'/">'.&mt('Done').'</a></h3>');
 }
 
 =pod
@@ -410,20 +411,20 @@
 	    my $return=&exists($user, $domain, $newfilename);
 	    $request->print($return);
 	    if ($return =~/^Error:/) {
-		$request->print('<br /><a href="'.&url($fn).'">Cancel</a>');
+		$request->print('<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>');
 		return;
 	    }
 	    $request->print('<input type="hidden" name="newfilename" value="'.
 			    $newfilename.
-			    '" /><p>Rename '.&display($fn).
+			    '" /><p>'.&mt('Rename').' '.&display($fn).
 			    '</tt><br />to '.&display($newfilename).'?</p>');
 	    &CloseForm1($request, $fn);
 	} else {
-	    $request->print('<p>No new filename specified.</p></form>');
+	    $request->print('<p>'.&mt('No new filename specified.').'</p></form>');
 	    return;
 	}
     } else {
-	$request->print('<p> No such file: '.&display($fn).'</p></form>');
+	$request->print('<p> '.&mt('No such file').': '.&display($fn).'</p></form>');
 	return;
     }
     
@@ -458,10 +459,10 @@
   if( -e $fn) {
     $request->print('<input type="hidden" name="newfilename" value="'.
 		    $fn.'"/>');
-    $request->print('<p>Delete '.&display($fn).'?</p>');
+    $request->print('<p>'.&mt('Delete').' '.&display($fn).'?</p>');
     &CloseForm1($request, $fn);
   } else {
-    $request->print('<p>No such file: '.&display($fn).'</p></form>');
+    $request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>');
   }
 }
 
@@ -512,16 +513,16 @@
 	my $return=&exists($user, $domain, $newfilename);
 	$request->print($return);
 	if ($return =~/^Error:/) {
-	    $request->print('<br /><a href="'.&url($fn).'">Cancel</a>');
+	    $request->print('<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>');
 	    return;
 	}
 	$request->print('<input type="hidden" name="newfilename" value="'.
 			$newfilename.
-			'" /><p>Copy '.&display($fn).'<br />to '.
+			'" /><p>'.&mt('Copy').' '.&display($fn).'<br />to '.
 			&display($newfilename).'?</p>');
 	&CloseForm1($request, $fn);
     } else {
-	$request->print('<p>No such file: '.&display($fn).'</p></form>');
+	$request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>');
     }
 }
 
@@ -573,7 +574,7 @@
     $request->print('<font color="red">'.$result.'</font></form>');
   } else {
     $request->print('<input type="hidden" name="newfilename" value="'.
-		    $newfilename.'" /><p>Make new directory '.
+		    $newfilename.'" /><p>'.&mt('Make new directory').' '.
 		    &display($newfilename).'?</p>');
     &CloseForm1($request, $fn);
   }
@@ -584,10 +585,10 @@
    my ($request, $user, $domain, $fn) = @_;
    if( -e $fn) {
    	$request->print('<input type="hidden" name="newfilename" value="'.$fn.'"/>');
-   	$request->print('<p>Decompress '.&display($fn).'?</p>');
+   	$request->print('<p>'.&mt('Decompress').' '.&display($fn).'?</p>');
    	&CloseForm1($request, $fn);
    	} else {
-       		$request->print('<p>No such file: '.&display($fn).'</p></form>');
+       		$request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>');
      	  }
 }
 =pod
@@ -640,8 +641,8 @@
         ##Informs User (name).(number).(extension) not allowed 
 	if($newfilename =~ /\.(\d+)\.(\w+)$/){
 	    $r->print('<font color="red">'.$newfilename.
-		      ' - Bad Filename<br />(name).(number).(extension)'.
-		      ' Not Allowed</font>');
+		      ' - '.&mt('Bad Filename').'<br />('.&mt('name').').('.&mt('number').').('.&mt('extension').')'.
+		      ' '.&mt('Not Allowed').'</font>');
 	    return;
 	}
 	if ($newfilename !~ /\Q.$extension\E$/) {
@@ -656,12 +657,12 @@
     if($result) {
 	$request->print('<font color="red">'.$result.'</font></form>');
     } else {
-	$request->print('<p>Make new file '.&display($newfilename).'?</p>');
+	$request->print('<p>'.&mt('Make new file').' '.&display($newfilename).'?</p>');
 	$request->print('</form>');
 	$request->print('<form action="'.&url($newfilename).
-			'" method="POST"><p><input type="submit" value="Continue" /></p></form>');
+			'" method="POST"><p><input type="submit" value="'.&mt('Continue').'" /></p></form>');
 	$request->print('<form action="'.&url($fn).
-			'" method="POST"><p><input type="submit" value="Cancel" /></p></form>');
+			'" method="POST"><p><input type="submit" value="'.&mt('Cancel').'" /></p></form>');
     }
 }
 
@@ -713,7 +714,7 @@
       if($newfilename) {
 	  &Copy1($r, $uname, $udom, $fn, $newfilename);
       } else {
-	  $r->print('<p>No new filename specified.</p></form>');
+	  $r->print('<p>'.&mt('No new filename specified.').'</p></form>');
       }
   } elsif ($ENV{'form.action'} eq 'newdir') {
       &NewDir1($r, $uname, $udom, $fn, $newfilename);
@@ -728,7 +729,7 @@
       if ($newfilename) {
 	  &NewFile1($r, $uname, $udom, $fn, $newfilename);
       } else {
-	  $r->print('<p>No new filename specified.</p></form>');
+	  $r->print('<p>'.&mt('No new filename specified.').'</p></form>');
       }
   }
 }
@@ -780,7 +781,7 @@
       my $oRN=$oldfile;
       my $nRN=$newfile;
       unless (rename($oldfile,$newfile)) {
-	  $request->print('<font color="red">Error: '.$!.'</font>');
+	  $request->print('<font color="red">'.&mt('Error').': '.$!.'</font>');
 	  return 0;
       }
       ## If old name.(extension) exits, move under new name.
@@ -815,7 +816,7 @@
 	  unlink $tmp2;
       }
   } else {
-      $request->print("<p> No such file: ".&display($oldfile).'</p></form>');
+      $request->print("<p> ".&mt('No such file').": ".&display($oldfile).'</p></form>');
       return 0;
   }
   return 1;
@@ -855,18 +856,18 @@
     my @files=readdir(DIR);
     shift @files; shift @files; # takes off . and ..
     if(@files) { 
-      $request->print('<font color="red"> Error: Directory Non Empty</font>'); 
+      $request->print('<font color="red"> '.&mt('Error: Directory Non Empty').'</font>'); 
       return 0;
     }
     else {   
       if(-e $filename) {
         unless(rmdir($filename)) {
-          $request->print('<font color="red">Error: '.$!.'</font>');
+          $request->print('<font color="red">'.&mt('Error').': '.$!.'</font>');
           return 0;
         }
       }
       else {
-        $request->print('<p> No such file. </p></form');
+        $request->print('<p> '.&mt('No such file').'. </p></form');
         return 0;
       }
 
@@ -876,12 +877,12 @@
   else {
     if(-e $filename) {
       unless(unlink($filename)) {
-        $request->print('<font color="red">Error: '.$!.'</font>');
+        $request->print('<font color="red">'.&mt('Error').': '.$!.'</font>');
         return 0;
       }
     }
     else {
-      $request->print('<p> No such file. </p></form');
+      $request->print('<p> '.&mt('No such file').'. </p></form');
       return 0;
   }
 	}
@@ -921,17 +922,17 @@
     &Debug($request ,"Will try to copy $oldfile to $newfile");
     if(-e $oldfile) {
 	unless (copy($oldfile, $newfile)) {
-	    $request->print('<font color="red"> copy Error: '.$!.'</font>');
+	    $request->print('<font color="red"> '.&mt('copy Error').': '.$!.'</font>');
 	    return 0;
 	} else {
 	    unless (chmod(0660, $newfile)) {
-		$request->print('<font color="red"> chmod error: '.$!.'</font>');
+		$request->print('<font color="red"> '.&mt('chmod error').': '.$!.'</font>');
 		return 0;
 	    }
 	    return 1;
 	}
     } else {
-	$request->print('<p> No such file </p>');
+	$request->print('<p> '.&mt('No such file').' </p>');
 	return 0;
     }
     return 1;
@@ -962,11 +963,11 @@
   my ($request, $user, $newdirectory) = @_;
   
   unless(mkdir($newdirectory, 02770)) {
-    $request->print('<font color="red">Error: '.$!.'</font>');
+    $request->print('<font color="red">'.&mt('Error').': '.$!.'</font>');
     return 0;
   }
   unless(chmod(02770, ($newdirectory))) {
-      $request->print('<font color="red"> Error: '.$!.'</font>');
+      $request->print('<font color="red"> '.&mt('Error').': '.$!.'</font>');
       return 0;
   }
   return 1;
@@ -1083,7 +1084,7 @@
 	    $dest = $ENV{'form.newfilename'};
      
 	} else {
-	    $r->print('<p>No New filename specified</p></form>');
+	    $r->print('<p>'.&mt('No New filename specified').'</p></form>');
 	    return;
 	}
 	
@@ -1094,7 +1095,7 @@
 	}
 	$dest = $newdir."/"
     }
-    $r->print('<h3><a href="'.&url($dest).'">Done</a></h3>');
+    $r->print('<h3><a href="'.&url($dest).'">'.&mt('Done').'</a></h3>');
 }
 
 sub handler {
@@ -1167,10 +1168,10 @@
   $r->print(&Apache::loncommon::bodytag('Construction Space File Operation'));
 
   
-  $r->print('<h3>Location: '.&display($fn).'</h3>');
+  $r->print('<h3>'.&mt('Location').': '.&display($fn).'</h3>');
   
   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.' at '.$udom.
                '</font></h3>');
   }
 
@@ -1178,15 +1179,15 @@
   &Debug($r, "loncfile::handler Form action is $ENV{'form.action'} ");
   if ($ENV{'form.action'} eq 'delete') {
       
-      $r->print('<h3>Delete</h3>');
+      $r->print('<h3>'.&mt('Delete').'</h3>');
   } elsif ($ENV{'form.action'} eq 'rename') {
-      $r->print('<h3>Rename</h3>');
+      $r->print('<h3>'.&mt('Rename').'</h3>');
   } elsif ($ENV{'form.action'} eq 'newdir') {
-      $r->print('<h3>New Directory</h3>');
+      $r->print('<h3>'.&mt('New Directory').'</h3>');
   } elsif ($ENV{'form.action'} eq 'decompress') {
-      $r->print('<h3>Decompress</h3>');
+      $r->print('<h3>'.&mt('Decompress').'</h3>');
   } elsif ($ENV{'form.action'} eq 'copy') {
-      $r->print('<h3>Copy</h3>');
+      $r->print('<h3>'.&mt('Copy').'</h3>');
   } elsif ($ENV{'form.action'} eq 'newfile' ||
 	   $ENV{'form.action'} eq 'newhtmlfile' ||
 	   $ENV{'form.action'} eq 'newproblemfile' ||
@@ -1195,9 +1196,9 @@
 	   $ENV{'form.action'} eq 'newrightsfile' ||
 	   $ENV{'form.action'} eq 'newstyfile' ||
            $ENV{'form.action'} eq 'Select Action' ) {
-      $r->print('<h3>New Resource</h3>');
+      $r->print('<h3>'.&mt('New Resource').'</h3>');
   } else {
-     $r->print('<p>Unknown Action '.$ENV{'form.action'}.' </p></body></html>');
+     $r->print('<p>'.&mt('Unknown Action').' '.$ENV{'form.action'}.' </p></body></html>');
      return OK;  
   }
   if ($ENV{'form.phase'} eq 'two') {

--sakharuk1071521046--