[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonpreferences.pm

raeburn raeburn@source.lon-capa.org
Thu, 28 Jan 2010 15:40:10 -0000


This is a MIME encoded message

--raeburn1264693210
Content-Type: text/plain

raeburn		Thu Jan 28 15:40:10 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonpreferences.pm 
  Log:
  - Backport 1.175, 1.176, 1.177, 1.178, 1.179, 1.180, 1.181, 1.182.C
  
  
--raeburn1264693210
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20100128154010.txt"

Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.125.4.8 loncom/interface/lonpreferences.pm:1.125.4.9
--- loncom/interface/lonpreferences.pm:1.125.4.8	Fri Oct  9 04:13:55 2009
+++ loncom/interface/lonpreferences.pm	Thu Jan 28 15:40:10 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.125.4.8 2009/10/09 04:13:55 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.125.4.9 2010/01/28 15:40:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -156,8 +156,11 @@
 	               = &Apache::loncommon::plainlanguagedescription($_);
 	}
     }
-    my $selectionbox=&Apache::loncommon::select_form($language,'language',
-						     %langchoices);
+    my $selectionbox=
+           &Apache::loncommon::select_form(
+               $language,
+               'language',
+               &Apache::lonlocal::texthash(%langchoices));
     $r->print(<<ENDLSCREEN);
 <form name="prefs" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_languages" />
@@ -208,12 +211,15 @@
 		     'mimetex' => 'mimetex (Convert to Images)',
                      'raw' => 'Raw (Screen Reader)'
                      );
-    my $selectionbox=&Apache::loncommon::select_form($texengine,'texengine',
-						     %mathchoices);
+    my $selectionbox=
+           &Apache::loncommon::select_form(
+               $texengine,
+               'texengine',
+               &Apache::lonlocal::texthash(%mathchoices));
     my $jsMath_start=&Apache::lontexconvert::jsMath_header();
     my %lt=&Apache::lonlocal::texthash(
-      'headline' => 'Change Math Preferences',
-      'preftxt'  => 'Preferred method to display Math',
+      'headline' => 'Change how math is displayed',
+      'preftxt'  => 'Preferred method to display math',
       'change'   => 'Save',
       'exmpl'    => 'Examples',
       'jsmath'   => 'jsMath:',
@@ -268,7 +274,7 @@
 
 <h3>$lt{'tth'}</h3>
 <p>
-<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" height="200"></iframe>
+<iframe src="/res/adm/pages/math_example.tex?inhibitmenu=yes&texengine=tth" width="400" height="220"></iframe>
 </p>
 ENDLSCREEN
     if ($env{'environment.texengine'} ne 'jsMath') {
@@ -377,13 +383,20 @@
 </p>
 <form name="prefs" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_rolespref" />
-<br /><label>'.&mt('Enable Recent '.$role.'s Hotlist:').'
-<input type="checkbox"'.$checked.' name="recentroles" value="true" /></label>
-<br />'.&mt('Number of '.$role.'s in Hotlist:').'
-<select name="recentrolesn" size="1">
-'.$options.'
-</select>
-<p>'.&mt('This list below can be used to <q>freeze</q> '.$lc_role.'s on your screen. Those marked as frozen will not be removed from the list, even if they have not been used recently.').'
+<br />'.
+'<h2>'.&mt('Recent '.$role.'s Hotlist').'</h2>'.
+&Apache::lonhtmlcommon::start_pick_box().
+&Apache::lonhtmlcommon::row_title('<label for="Hotlist">'.&mt('Enable Recent '.$role.'s Hotlist').'</label>').
+'<input id="Hotlist" type="checkbox"'.$checked.' name="recentroles" value="true" />'.
+&Apache::lonhtmlcommon::row_closure().
+&Apache::lonhtmlcommon::row_title('<label for="NumberOfRoles">'.&mt('Number of '.$role.'s in Hotlist').'</label>').
+'<select name="recentrolesn" size="1" id ="NumberOfRoles">'.
+$options.
+'</select>'.
+&Apache::lonhtmlcommon::row_closure(1).
+&Apache::lonhtmlcommon::end_pick_box().
+'<br/><h2>'.&mt('Freeze Roles').'</h2>'.
+'<p>'.&mt('This list below can be used to <q>freeze</q> '.$lc_role.'s on your screen. Those marked as frozen will not be removed from the list, even if they have not been used recently.').'
 </p>
 '.$roles_check_list.'
 <br />
@@ -433,11 +446,11 @@
     if ($hotlist_flag) {
         &Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag});
         &Apache::lonnet::appenv({'environment.recentroles' => $hotlist_flag});
-        $message=&mt('Recent '.$role.'s Hotlist is Enabled');
+        $message=&Apache::lonhtmlcommon::confirm_success(&mt('Recent '.$role.'s Hotlist is Enabled.')." ".&mt('Display [_1] Most Recent '.$role.'s.',$hotlist_n));
     } else {
         &Apache::lonnet::del('environment',['recentroles']);
         &Apache::lonnet::delenv('environment.recentroles');
-        $message=&mt('Recent '.$role.'s Hotlist is Disabled');
+        $message=&Apache::lonhtmlcommon::confirm_success(&mt('Recent '.$role.'s Hotlist is Disabled'));
     }
     if ($hotlist_n) {
         &Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n});
@@ -752,8 +765,9 @@
                                           all   => 'All',
                                           crit  => 'Critical only',
                                           reg   => 'Non-critical only',
-                                          foad  => 'Forwarding Address(es)',
-                                          noti  => 'Notification E-mail Address(es)', 
+                                          foad  => 'Forward to account(s)',
+                                          fwdm  => 'Forward messages to other account(s) in LON-CAPA',
+                                          noti  => 'E-mail notification of LON-CAPA messages',
                                           foad_exmpl => 'e.g. <tt>userA:domain1,userB:domain2,...</tt>',
                                           mnot  => 'E-mail Address(es) which should be notified about new LON-CAPA messages',
                                           mnot_exmpl => 'e.g. <tt>joe@doe.com</tt>',
@@ -828,11 +842,12 @@
     $r->print(<<ENDMSG);
 $jscript
 $message
-<h3>$lt{'foad'} $forwardingHelp</h3>
+<h3>$lt{'fwdm'} $forwardingHelp</h3>
 <form name="prefs" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_msgforward" />
 $lt{'foad'} ($lt{'foad_exmpl'}):
-<input type="text" size="40" value="$msgforward" name="msgforward" /><br />
+<input type="text" size="40" value="$msgforward" name="msgforward" />
+<br /><br />
 <h3>$lt{'noti'} $notificationHelp</h3>
 $lt{'mnot'} ($lt{'mnot_exmpl'}):<br />
 ENDMSG
@@ -877,7 +892,7 @@
                        '<input type="radio" name="notify_type_'.$num. 
                        '" value="'.$type.'" '.$chk{$type}.
                        ' onchange="javascript:address_changes('."'$num'".')" />'.
-                       $lt{$type}.'</label></span>&nbsp;';
+                       $lt{$type}.'</label></span>'.('&nbsp;' x4);
         }
         my $htmlon = '';
         my $htmloff = '';
@@ -889,7 +904,7 @@
         $output .= '</td><td><label><input type="radio" name="html_'.$num.
                    '" value="1" '.$htmlon.
                    ' onchange="javascript:address_changes('."'$num'".')" />'.
-                   &mt('Yes').'</label>&nbsp;'.
+                   &mt('Yes').'</label>'.('&nbsp;' x3).
                    '<label><input type="radio" name="html_'.$num.'" value="0" '.
                    $htmloff. ' onchange="javascript:address_changes('."'$num'".
 ')" />'.
@@ -914,10 +929,10 @@
         $output .= '<span class="LC_nobreak"><label>'.
                    '<input type="radio" name="notify_type_'.$num.
                    '" value="'.$type.'" '.$defchk{$type}.'/>'.
-                   $lt{$type}.'</label></span>&nbsp;';
+                   $lt{$type}.'</label></span>'.('&nbsp;' x4);
     }
     $output .= '</td><td><label><input type="radio" name="html_'.$num.
-               '" value="1" />'.&mt('Yes').'</label>&nbsp;'.
+               '" value="1" />'.&mt('Yes').'</label>'.('&nbsp;' x3).
                '<label><input type="radio" name="html_'.$num.'" value="0" '.
                ' checked="checked" />'.
                &mt('No').'</label></td>'.
@@ -955,28 +970,32 @@
     my $domain     = $env{'user.domain'};
     my $newscreen  = '';
     my $message='';
-    foreach (split(/\,/,$env{'form.msgforward'})) {
-	my ($msuser,$msdomain)=split(/[\@\:]/,$_);
+    foreach my $recip (split(/\,/,$env{'form.msgforward'})) {
+        my ($msuser,$msdomain);
+        if ($recip =~ /:/) {
+            ($msuser,$msdomain)=split(':',$recip);
+        } else {
+            ($msuser,$msdomain)=split(/\@/,$recip);
+        }
         $msuser = &LONCAPA::clean_username($msuser);
         $msdomain = &LONCAPA::clean_domain($msdomain);
         if (($msuser) && ($msdomain)) {
 	    if (&Apache::lonnet::homeserver($msuser,$msdomain) ne 'no_host') {
-               $newscreen.=$msuser.':'.$msdomain.',';
-	   } else {
-               $message.= &mt('No such user: ').'<tt>'.$msuser.':'.$msdomain.'</tt><br />';
-           }
+                $newscreen.=$msuser.':'.$msdomain.',';
+            } else {
+                $message.= &mt('No such user: ').'<tt>'.$msuser.':'.$msdomain.'</tt><br />';
+            }
         }
     }
     $newscreen=~s/\,$//;
     if ($newscreen) {
         &Apache::lonnet::put('environment',{'msgforward' => $newscreen});
         &Apache::lonnet::appenv({'environment.msgforward' => $newscreen});
-        $message .= &mt('Set message forwarding to ').'<tt>"'.$newscreen.'"</tt>.'
-                    .'<br />';
+        $message .= &Apache::lonhtmlcommon::confirm_success(&mt('Set message forwarding to ').'<tt>"'.$newscreen.'"</tt>.<br />');
     } else {
         &Apache::lonnet::del('environment',['msgforward']);
         &Apache::lonnet::delenv('environment.msgforward');
-        $message.= &mt("Set message forwarding to 'off'.").'<br />';
+        $message.= &Apache::lonhtmlcommon::confirm_success(&mt("Set message forwarding to 'off'.").'<br />');
     }
     my $critnotification;
     my $notification;
@@ -1012,33 +1031,33 @@
     if ($notification) {
         &Apache::lonnet::put('environment',{'notification' => $notification});
         &Apache::lonnet::appenv({'environment.notification' => $notification});
-        $message.=&mt('Set non-critical message notification address(es) to ').'<tt>"'.$notification.'"</tt>.<br />';
+        $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set non-critical message notification address(es) to ').'<tt>"'.$notification.'"</tt>.<br />');
     } else {
         &Apache::lonnet::del('environment',['notification']);
         &Apache::lonnet::delenv('environment.notification');
-        $message.=&mt("Set non-critical message notification to 'off'.").'<br />';
+        $message.=&Apache::lonhtmlcommon::confirm_success(&mt("Set non-critical message notification to 'off'.").'<br />');
     }
     if ($critnotification) {
         &Apache::lonnet::put('environment',{'critnotification' => $critnotification});
         &Apache::lonnet::appenv({'environment.critnotification' => $critnotification});
-        $message.=&mt('Set critical message notification address(es) to ').'<tt>"'.$critnotification.'"</tt>.<br />';
+        $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set critical message notification address(es) to ').'<tt>"'.$critnotification.'"</tt>.<br />');
     } else {
         &Apache::lonnet::del('environment',['critnotification']);
         &Apache::lonnet::delenv('environment.critnotification');
-        $message.=&mt("Set critical message notification to 'off'.").'<br />';
+        $message.=&Apache::lonhtmlcommon::confirm_success(&mt("Set critical message notification to 'off'.").'<br />');
     }
     if ($critnotification || $notification) {
         if ($notify_with_html) {
             &Apache::lonnet::put('environment',{'notifywithhtml' => $notify_with_html});
             &Apache::lonnet::appenv({'environment.notifywithhtml' => $notify_with_html});
-            $message.=&mt('Set address(es) to receive excerpts with html retained ').'<tt>"'.$notify_with_html.'"</tt>.';
+            $message.=&Apache::lonhtmlcommon::confirm_success(&mt('Set address(es) to receive excerpts with html retained ').'<tt>"'.$notify_with_html.'"</tt>.');
         } else {
             &Apache::lonnet::del('environment',['notifywithhtml']);
             &Apache::lonnet::delenv('environment.notifywithhtml');
             if ($totaladdresses == 1) {
-                $message.=&mt("Set notification address to receive excerpts with html stripped.");
+                $message.=&Apache::lonhtmlcommon::confirm_success(&mt("Set notification address to receive excerpts with html stripped."));
             } else {
-                $message.=&mt("Set all notification addresses to receive excerpts with html stripped.");
+                $message.=&Apache::lonhtmlcommon::confirm_success(&mt("Set all notification addresses to receive excerpts with html stripped."));
             }
         }
     } else {
@@ -1049,6 +1068,7 @@
         $message .= '<br /><hr />';
     }
     &Apache::loncommon::flush_email_cache($user,$domain);
+    $message=&Apache::loncommon::confirmwrapper($message);
     &msgforwardchanger($r,$message);
 }
 
@@ -1521,6 +1541,7 @@
     my $message;
     if ($result =~ /^ok$/) {
         $message = &Apache::lonhtmlcommon::confirm_success(&mt('The password for user [_1] was successfully changed.','<i>'.$user.'</i>'));
+        $message = &Apache::loncommon::confirmwrapper($message);
         if ($caller eq 'reset_by_email') {
             $r->print($message.'<br />');
         } else {
@@ -1749,19 +1770,19 @@
             my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; 
             my ($furl,$ferr)=
                 &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
-            $message .= '<br /><font size="+1"><a href="'.$furl.'">'.$lt{'gtts'}.' <i>'.&mt('now').'</i></a></font>';
+            $message .= '<br /><a href="'.$furl.'">'.$lt{'gtts'}.' <i>'.&mt('now').'</i></a>';
         } else {
-            $message .= '<br /><font size="+1"><a href="/adm/whatsnew?refpage='.
-                        $refpage.'">'.$lt{'dasp'}.'</a></font>';
+            $message .= '<br /><a href="/adm/whatsnew?refpage='.
+                        $refpage.'">'.$lt{'dasp'}.'</a>';
         }
     }
     $message = &Apache::lonhtmlcommon::confirm_success($message);
+    $message = &Apache::loncommon::confirmwrapper($message);
     $r->print(<<ENDVCSCREEN);
 $message
 ENDVCSCREEN
 }
 
-
 ######################################################
 #            other handler subroutines               #
 ######################################################
@@ -1831,14 +1852,15 @@
                       help     => 'Prefs_Messages',
                       breadcrumb => 
                           { href => '/adm/preferences?action=changemsgforward',
-                            text => 'Change Message Forwarding/Notification'},
+
+                            text => 'Messages & Notifications'},
                       subroutine => \&msgforwardchanger,
                       },
                     { action => 'verify_and_change_msgforward',
                       help   => 'Prefs_Messages',
                       breadcrumb => 
                           { href => '/adm/preferences?action=changemsgforward',
-                            text => 'Change Message Forwarding/Notification'},
+                            text => 'Messages & Notifications'},
                       printmenu => 'no',
                       subroutine => \&verify_and_change_msgforward }));
     if (&Apache::lonnet::usertools_access($user,$domain,'aboutme')) {
@@ -1930,12 +1952,12 @@
                       }));
 
     push (@Options,({ action   => 'changetexenginepref',
-                      linktext => 'Change How Math Equations Are Displayed',
+                      linktext => 'Math display settings',
                       href     => '/adm/preferences',
                       subroutine => \&texenginechanger,
                       breadcrumb =>
                           { href => '/adm/preferences?action=changetexenginepref',
-                            text => 'Change Math Pref'},
+                            text => 'Math display settings'},
                       },
                     { action   => 'verify_and_change_texengine',
                       subroutine => \&verify_and_change_texengine,

--raeburn1264693210--