[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm londropadd.pm lonpreferences.pm

www lon-capa-cvs-allow@mail.lon-capa.org
Tue, 17 Apr 2007 18:28:45 -0000


This is a MIME encoded message

--www1176834525
Content-Type: text/plain

www		Tue Apr 17 14:28:45 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm londropadd.pm lonpreferences.pm 
  Log:
  * Labels
  * Internationalization
  
  
--www1176834525
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20070417142845.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.526 loncom/interface/loncommon.pm:1.527
--- loncom/interface/loncommon.pm:1.526	Tue Apr 17 11:45:02 2007
+++ loncom/interface/loncommon.pm	Tue Apr 17 14:28:44 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.526 2007/04/17 15:45:02 www Exp $
+# $Id: loncommon.pm,v 1.527 2007/04/17 18:28:44 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3910,6 +3910,16 @@
   font-family: $sans;
 }
 
+.LC_dropadd_labeltext {
+  font-family: $sans;
+  text-align: right;
+}
+
+.LC_preferences_labeltext {
+  font-family: $sans;
+  text-align: right;
+}
+
 table.LC_aboutme_port {
   border: 0px;
   border-collapse: collapse;
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.158 loncom/interface/londropadd.pm:1.159
--- loncom/interface/londropadd.pm:1.158	Tue Apr 17 11:45:03 2007
+++ loncom/interface/londropadd.pm	Tue Apr 17 14:28:44 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.158 2007/04/17 15:45:03 www Exp $
+# $Id: londropadd.pm,v 1.159 2007/04/17 18:28:44 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -949,11 +949,11 @@
 <input type="hidden" name="state"  value="gotusername" />
 <h3>$lt{'eos'}</h3>
 <table>
-<tr><th><label for="cuname">$lt{'usr'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="cuname">$lt{'usr'}</label>:</td>
     <td><input type="text" name="cuname"  size="15" /></td></tr>
-<tr><th><label for="cudomain">$lt{'dom'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="cudomain">$lt{'dom'}</label>:</td>
     <td>$domform</td></tr>
-<tr><th>&nbsp;</th>
+<tr><td>&nbsp;</td>
     <td>
     <input type="submit" name="Begin Enrollment" value="$lt{'been'}" />
     </td></tr>
@@ -1022,17 +1022,17 @@
         $user_data_html = <<END;
 <h3>$lt{'udf'} $username\@$domain</h3>
 <table>
-<tr><th><label for="cfirst">$lt{'fn'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="cfirst">$lt{'fn'}</label>:</td>
     <td><input type="text" name="cfirst"  size="15"></td></tr>
-<tr><th><label for="cmiddle">$lt{'mn'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="cmiddle">$lt{'mn'}</label>:</td>
     <td><input type="text" name="cmiddle" size="15"></td></tr>
-<tr><th><label for="clast">$lt{'ln'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="clast">$lt{'ln'}</label>:</td>
     <td><input type="text" name="clast"   size="15"></td></tr>
-<tr><th><label for="cgen">$lt{'gen'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="cgen">$lt{'gen'}</label>:</td>
     <td><input type="text" name="cgen"    size="5"> </td></tr>
-<tr><th><label for="lcserver">$lt{'hs'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="lcserver">$lt{'hs'}</label>:</td>
     <td>$homeserver_form</td></tr>
-<tr><th><label for="emailaddress">$lt{'mail'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="emailaddress">$lt{'mail'}</label>:</td>
     <td><input type="text" name="emailaddress" size="20" /></td></tr>
 </table>
 <h3>$lt{'pswd'}</h3>
@@ -1062,23 +1062,23 @@
 <h3>$lt{'udf'} $username\@$domain</h3>
 <input type="hidden" name="lcserver" value="default" />
 <table>
-<tr><th><label for="cfirst">$lt{'fn'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="cfirst">$lt{'fn'}</label>:</td>
     <td>
     <input type="text" name="cfirst" value="$uenv{'firstname'}" size="15" />
     </td></tr>
-<tr><th><label for="cmiddle">$lt{'mn'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="cmiddle">$lt{'mn'}</label>:</td>
     <td>
     <input type="text" name="cmiddle" value="$uenv{'middlename'}" size="15" />
     </td></tr>
-<tr><th><label for="clast">$lt{'ln'}</label>:</th>
+<tr><td class="LC_dropadd_labeltext"><label for="clast">$lt{'ln'}</label>:</td>
     <td>
     <input type="text" name="clast"value="$uenv{'lastname'}" size="15" />
     </td></tr>
-<tr><th><label for="cgen">$lt{'gen'}</label>:</th>
-    <td>
+<tr><td><label for="cgen">$lt{'gen'}</label>:</td>
+    <td class="LC_dropadd_labeltext">
     <input type="text" name="cgen" value="$uenv{'generation'}" size="5" />
     </td></tr>
-<tr><th><label for="emailaddress">$lt{'mail'}</label>:</th>
+<tr><td><label for="emailaddress">$lt{'mail'}</label>:</td>
     <td>
     <input type="text" name="emailaddress" value="$uenv{'permanentemail'}" size="20" />
     </td></tr>
@@ -1143,13 +1143,13 @@
 
 <h3>$lt{'cd'}</h3>
 
-<p>$lt{'gs'}: <input type="text" name="csec" size="5" />
+<p><label for="csec">$lt{'gs'}</label>: <input type="text" name="csec" size="5" />
 <p>
 $date_table
 </p>
 <h3>$lt{'idsn'}</h3>
 <p>
-$lt{'idsn'}: <input type="text" name="cstid" size="10">
+<label for="cstid">$lt{'idsn'}</label>: <input type="text" name="cstid" size="10">
 </p><p>
 <label>
 <input type="checkbox" name="forceid" value="yes"> 
@@ -1234,9 +1234,9 @@
             $output_selector .= "\n".$option;
         }
         $output_selector .= '</select>';
-        $r->print(&mt('Output Format: [_1]',$output_selector).('&nbsp;'x3));
+        $r->print('<label>'.&mt('Output Format: [_1]',$output_selector).'</label>'.('&nbsp;'x3));
     }
-    $r->print(&mt('Student Status: [_1]',$status_select)."\n");
+    $r->print('<label>'.&mt('Student Status: [_1]',$status_select)."</label>\n");
     $r->print('<input type="submit" value="'.&mt('Update Display').'" />'.
               "\n</p>\n");
     #
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.98 loncom/interface/lonpreferences.pm:1.99
--- loncom/interface/lonpreferences.pm:1.98	Fri Apr 13 09:39:32 2007
+++ loncom/interface/lonpreferences.pm	Tue Apr 17 14:28:44 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.98 2007/04/13 13:39:32 www Exp $
+# $Id: lonpreferences.pm,v 1.99 2007/04/17 18:28:44 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -884,20 +884,29 @@
 
 sub client_form {
     my ($caller,$hexkey,$currentpass,$defdom) = @_;
+    my %lt=&Apache::lonlocal::texthash(
+                'email' => 'EMail Address',
+                'username' => 'Username',
+                'domain' => 'Domain',
+                'currentpass' => 'Current Password',
+                'newpass' => 'New Password',
+                'confirmpass' => 'Confirm Password',
+                'changepass' => 'Change Password');
+
     my $output = qq|
 <form name="client" >
 <table>
 |;
     if ($caller eq 'reset_by_email') {
         $output .= qq|
-<tr><td align="right"> E-mail address:                        </td>
+<tr><td class="LC_preferences_labeltext"><label for="email">$lt{'email'}</label>:</td>
     <td><input type="text" name="email" size="30" /> </td></tr>
-<tr><td align="right"> Username:                        </td>
+<tr><td class="LC_preferences_labeltext"><label for="uname">$lt{'username'}</label>:</td>
     <td>
      <input type="text" name="uname" size="15" />
      <input type="hidden" name="currentpass" value="$currentpass" />
     </td></tr>
-<tr><td align="right"> Domain:                               </td>
+<tr><td class="LC_preferences_labeltext"><label for="udom">$lt{'udom'}</label>:</td>
     <td>
 |;
         $output .= &Apache::loncommon::select_dom_form($defdom,'udom').'
@@ -906,17 +915,17 @@
 ';
     } else {
         $output .= qq|
-<tr><td align="right"> Current password:                      </td>
+<tr><td class="LC_preferences_labeltext"><label for="currentpass">$lt{'currentpass'}</label></td>
     <td><input type="password" name="currentpass" size="10"/> </td></tr>
 |;
     }
     $output .= <<"ENDFORM";
-<tr><td align="right"> New password:                          </td>
+<tr><td class="LC_preferences_labeltext"><label for="newpass_1">$lt{'newpass'}</label></td>
     <td><input type="password" name="newpass_1" size="10"  /> </td></tr>
-<tr><td align="right"> Confirm password:                      </td>
+<tr><td class="LC_preferences_labeltext"><label for="newpass_2">$lt{'confirmpass'}</label></td>
     <td><input type="password" name="newpass_2" size="10"  /> </td></tr>
 <tr><td colspan="2" align="center">
-    <input type="button" value="Change Password" onClick="send();">
+    <input type="button" value="$lt{'changepass'}" onClick="send();">
 </table>
 <input type="hidden" name="ukey_cpass"  value="$hexkey->{'ukey_cpass'}" />
 <input type="hidden" name="lkey_cpass"  value="$hexkey->{'lkey_cpass'}" />
@@ -967,14 +976,14 @@
         if ($user ne '' && $domain ne '') {
             $homeserver = &Apache::lonnet::homeserver($user,$domain);
             if ($homeserver eq 'no_host') {
-        &passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>".
-                         "Invalid username and/or domain .\n</p>",
+        &passwordchanger($r,"<p>\n<span class='LC_error'>".
+                         &mt("Invalid username and/or domain")."</span>\n</p>",
                          $caller,$mailtoken);
                 return 1;
             }
         } else {
-            &passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>".
-                             "Username and Domain were blank.\n</p>",
+            &passwordchanger($r,"<p>\n<span class='LC_error'>".
+                             &mt("Username and domain were blank")."</span>\n</p>",
                              $caller,$mailtoken);
             return 1;
         }
@@ -987,8 +996,9 @@
     # Check for authentication types that allow changing of the password.
     if ($currentauth !~ /^(unix|internal):/) {
         if ($caller eq 'reset_by_email') {
-            &passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>".
-                             "Authentication type for this user can not be changed by this mechanism..\n</p>",
+            &passwordchanger($r,"<p>\n<span class='LC_error'>".
+                             &mt("Authentication type for this user can not be changed by this mechanism").
+                             "</span>\n</p>",
                               $caller,$mailtoken);
             return 1;
         } else {
@@ -1004,8 +1014,9 @@
     unless (defined($currentpass) && 
 	    defined($newpass1)    && 
 	    defined($newpass2)    ){
-	&passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>".
-			 "One or more password fields were blank.\n</p>",$caller,$mailtoken);
+	&passwordchanger($r,"<p>\n<span class='LC_error'>".
+			 &mt("One or more password fields were blank").
+                         "</span>\n</p>",$caller,$mailtoken);
 	return;
     }
     # Get the keys
@@ -1017,10 +1028,10 @@
         if ($caller eq 'reset_by_email') {
             $tryagain_text = &mt('Please try again later.');
         }
+        my $unable=&mt("Unable to retrieve stored token for password decryption");
 	$r->print(<<ENDERROR);
 <p>
-<font color="#ff0000">ERROR:</font> Unable to retrieve stored token for
-password decryption.  $tryagain_text
+<span class="LC_error">$unable.  $tryagain_text</span>
 </p>
 ENDERROR
         # Probably should log an error here
@@ -1036,24 +1047,24 @@
         my %data = &Apache::lonnet::tmpget($mailtoken);
         if ($currentpass ne $data{'temppasswd'}) {
             &passwordchanger($r,
-                         '<font color="#ff0000">ERROR:</font>'.
-                         'Could not verify current authentication.  '.
-                         'Please try again.',$caller,$mailtoken);
+                         '<span class="LC_error">'.
+                         &mt('Could not verify current authentication').'.  '.
+                         &mt('Please try again').'.</span>',$caller,$mailtoken);
             return 1;
         }
     } 
     if ($newpass1 ne $newpass2) {
 	&passwordchanger($r,
-			 '<font color="#ff0000">ERROR:</font>'.
-			 'The new passwords you entered do not match.  '.
-			 'Please try again.',$caller,$mailtoken);
+			 '<span class="LC_error">'.
+			 &mt('The new passwords you entered do not match').'.  '.
+			 &mt('Please try again').'.</span>',$caller,$mailtoken);
 	return 1;
     }
     if (length($newpass1) < 7) {
 	&passwordchanger($r,
-			 '<font color="#ff0000">ERROR:</font>'.
-			 'Passwords must be a minimum of 7 characters long.  '.
-			 'Please try again.',$caller,$mailtoken);
+			 '<span class="LC_error">'.
+			 &mt('Passwords must be a minimum of 7 characters long').'.  '.
+			 &mt('Please try again').'</span>.',$caller,$mailtoken);
 	return 1;
     }
     #
@@ -1064,14 +1075,14 @@
     }
     if ($badpassword) {
 	# I can't figure out how to enter bad characters on my browser.
-	my $errormessage = <<"ENDERROR";
-<font color="#ff0000">ERROR:</font>
-The password you entered contained illegal characters.<br />
-Valid characters are: space and <br />
+	my $errormessage ='<span class="LC_error">'.
+           &mt('The password you entered contained illegal characters').'.<br />'.
+           &mt('Valid characters are').(<<"ENDERROR");
+: space and <br />
 <pre>
 !&quot;\#$%&amp;\'()*+,-./0123456789:;&lt;=&gt;?\@
 ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}~
-</pre>
+</pre></span>
 ENDERROR
         &passwordchanger($r,$errormessage,$caller,$mailtoken);
         return 1;
@@ -1082,15 +1093,11 @@
 	($user,$domain,$currentpass,$newpass1,$homeserver,$caller);
     # Inform the user the password has (not?) been changed
     if ($result =~ /^ok$/) {
-	$r->print(<<"ENDTEXT");
-<h3>The password for $user was successfully changed</h3>
-ENDTEXT
+	$r->print("<h3>".&mt('The password for [_1] was successfully changed',$user)."</h3>");
     } else {
 	# error error: run in circles, scream and shout
-        $r->print(<<ENDERROR);
-<h3><font color="#ff0000">The password for $user was not changed</font></h3>
-Please make sure your old password was entered correctly.
-ENDERROR
+        $r->print("<h3><span class='LC_error'>".&mt("The password for [_1] was not changed",$user)."</span></h3>".
+                  &mt('Please make sure your old password was entered correctly').'.');
         return 1;
     }
     return;

--www1176834525--