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

raeburn raeburn@source.lon-capa.org
Wed, 16 Sep 2009 20:49:19 -0000


This is a MIME encoded message

--raeburn1253134159
Content-Type: text/plain

raeburn		Wed Sep 16 20:49:19 2009 EDT

  Modified files:              (Branch: GCI_1)
    /loncom/interface	lonpreferences.pm 
  Log:
  - lonpereferences.pm for GCI_1 updated to 2.8.X
  - Backport 1.131, 1.132, 1.134, 1.138, 1.139, 1.142, 1.148
  
  
--raeburn1253134159
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20090916204919.txt"

Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.125 loncom/interface/lonpreferences.pm:1.125.6.1
--- loncom/interface/lonpreferences.pm:1.125	Fri Jul 18 12:36:11 2008
+++ loncom/interface/lonpreferences.pm	Wed Sep 16 20:49:18 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.125 2008/07/18 12:36:11 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.125.6.1 2009/09/16 20:49:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -176,9 +176,10 @@
         $message=&mt('Set new preferred languages to ').'<tt>"'.$newlanguage.'"</tt>.';
     } else {
         &Apache::lonnet::del('environment',['languages']);
-        &Apache::lonnet::delenv('environment\.languages');
+        &Apache::lonnet::delenv('environment.languages');
         $message=&mt('Reset preferred language.');
     }
+    &Apache::loncommon::flush_langs_cache($user,$domain);
     $r->print(<<ENDVCSCREEN);
 $message
 ENDVCSCREEN
@@ -229,7 +230,7 @@
 <h3>$lt{'jsmath'}</h3> 
 <p>
 $jsMath_start
-<script type="text/javascript">
+<script type="text/javascript" language="JavaScript">
 if (jsMath.nofonts == 1) {
     document.writeln
         ('<div style="padding: 10; border-style: solid; border-width:3;'
@@ -259,7 +260,7 @@
 </p>
 ENDLSCREEN
     if ($env{'environment.texengine'} ne 'jsMath') {
-	$r->print('<script type="text/javascript">jsMath.Process()</script>');
+	$r->print('<script type="text/javascript" language="JavaScript">jsMath.Process()</script>');
     }
 }
 
@@ -285,7 +286,7 @@
         $message=&mt('Set new preferred math display to ').'<tt>"'.$newtexengine.'"</tt>.';
     } else {
         &Apache::lonnet::del('environment',['texengine']);
-        &Apache::lonnet::delenv('environment\.texengine');
+        &Apache::lonnet::delenv('environment.texengine');
         $message=&mt('Reset preferred math display.');
     }
 
@@ -424,7 +425,7 @@
         $message=&mt('Recent '.$role.'s Hotlist is Enabled');
     } else {
         &Apache::lonnet::del('environment',['recentroles']);
-        &Apache::lonnet::delenv('environment\.recentroles');
+        &Apache::lonnet::delenv('environment.recentroles');
         $message=&mt('Recent '.$role.'s Hotlist is Disabled');
     }
     if ($hotlist_n) {
@@ -519,7 +520,7 @@
         $message=&mt('Set new screenname to ').'<tt>"'.$newscreen.'."</tt>.';
     } else {
         &Apache::lonnet::del('environment',['screenname']);
-        &Apache::lonnet::delenv('environment\.screenname');
+        &Apache::lonnet::delenv('environment.screenname');
         $message=&mt('Reset screenname.');
     }
 # Nickname
@@ -532,7 +533,7 @@
         $message.=&mt('Set new nickname to ').'<tt>"'.$newscreen.'"</tt>.';
     } else {
         &Apache::lonnet::del('environment',['nickname']);
-        &Apache::lonnet::delenv('environment\.nickname');
+        &Apache::lonnet::delenv('environment.nickname');
         $message.=&mt('Reset nickname.');
     }
     &Apache::lonnet::devalidate_cache_new('namescache',$user.':'.$domain);
@@ -735,7 +736,7 @@
     my %allnot = &get_notifications(\%userenv);
     my $validatescript = &Apache::lonhtmlcommon::javascript_valid_email();
     my $jscript = qq|
-<script type="text/javascript">
+<script type="text/javascript" language="JavaScript">
 function validate() {
     for (var i=0; i<document.prefs.numnotify.value; i++) {
         var checkaddress = 0;
@@ -940,7 +941,7 @@
                     .'<br />';
     } else {
         &Apache::lonnet::del('environment',['msgforward']);
-        &Apache::lonnet::delenv('environment\.msgforward');
+        &Apache::lonnet::delenv('environment.msgforward');
         $message.= &mt("Set message forwarding to 'off'.").'<br />';
     }
     my $critnotification;
@@ -980,7 +981,7 @@
         $message.=&mt('Set non-critical message notification address(es) to ').'<tt>"'.$notification.'"</tt>.<br />';
     } else {
         &Apache::lonnet::del('environment',['notification']);
-        &Apache::lonnet::delenv('environment\.notification');
+        &Apache::lonnet::delenv('environment.notification');
         $message.=&mt("Set non-critical message notification to 'off'.").'<br />';
     }
     if ($critnotification) {
@@ -989,7 +990,7 @@
         $message.=&mt('Set critical message notification address(es) to ').'<tt>"'.$critnotification.'"</tt>.<br />';
     } else {
         &Apache::lonnet::del('environment',['critnotification']);
-        &Apache::lonnet::delenv('environment\.critnotification');
+        &Apache::lonnet::delenv('environment.critnotification');
         $message.=&mt("Set critical message notification to 'off'.").'<br />';
     }
     if ($critnotification || $notification) {
@@ -999,7 +1000,7 @@
             $message.=&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');
+            &Apache::lonnet::delenv('environment.notifywithhtml');
             if ($totaladdresses == 1) {
                 $message.=&mt("Set notification address to receive excerpts with html stripped.");
             } else {
@@ -1008,7 +1009,7 @@
         }
     } else {
         &Apache::lonnet::del('environment',['notifywithhtml']);
-        &Apache::lonnet::delenv('environment\.notifywithhtml');
+        &Apache::lonnet::delenv('environment.notifywithhtml');
     }
     if ($message) {
         $message .= '<br /><hr />';
@@ -1115,7 +1116,7 @@
 	    $message.=&mt('Set '.$colortypes{$item}.' to ').'<tt>"'.$color.'"</tt>.<br />';
 	} else {
 	    &Apache::lonnet::del('environment',[$entry]);
-	    &Apache::lonnet::delenv('environment\.'.$entry);
+	    &Apache::lonnet::delenv('environment.'.$entry);
 	    $message.=&mt('Reset '.$colortypes{$item}.'.').'<br />';
 	}
     }
@@ -1219,7 +1220,7 @@
 sub jscript_send {
     my ($caller) = @_;
     my $output = qq|
-<script language="JavaScript">
+<script type="text/javascript" language="JavaScript">
 
     function send() {
         uextkey=this.document.client.elements.ukey_cpass.value;
@@ -1579,15 +1580,7 @@
 END
     $r->print(&Apache::loncommon::end_data_table_row().
 	      &Apache::loncommon::end_data_table());
-    $r->print(<<"END");
-<br />
-<br />
-<input type="submit" name="sub" value="Save Changes" />
-<br />
-<br />
-Note: $lt{'thde'}
-</form>
-END
+    $r->print('<br /><br /><input type="submit" name="sub" value="'.&mt('Save').'" /><br /><br />'.&mt('Note').': '.$lt{'thde'}.'</form>');
 }
                                                                                                                 
 sub verify_and_change_discussion {
@@ -1604,7 +1597,7 @@
         } else {
             $message .= &mt('In discussions: all posts will be displayed.').'<br />';
             &Apache::lonnet::del('environment',['discdisplay']);
-            &Apache::lonnet::delenv('environment\.discdisplay');
+            &Apache::lonnet::delenv('environment.discdisplay');
         }
     }
     if (defined($env{'form.discmark'}) ) {
@@ -1616,7 +1609,7 @@
         } else {
             $message.=&mt('In discussions: posts will be identified as "NEW" until marked as read by the reader.').'<br />';
             &Apache::lonnet::del('environment',['discmarkread']);
-            &Apache::lonnet::delenv('environment\.discmarkread');
+            &Apache::lonnet::delenv('environment.discmarkread');
         }
     }
     $r->print(<<ENDVCSCREEN);
@@ -1642,14 +1635,21 @@
 	    $whatsnewselect = '';
         }
     }
-    my %pagenames = (
+    my %pagenames = &Apache::lonlocal::texthash(
                        firstres => 'First resource',
-                       whatsnew => "What's new page",
+                       whatsnew => "What's New Page",
                     );
-    my $whatsnew_off=&mt('Display the [_1] in the course.','<b>first resource</b>');
-    my $whatsnew_on=&mt('Display the "[_1]" page - a summary of items in the course which require attention.',"<b>What's New</b>");
+    my $whatsnew_off=&mt('Display the [_1]first resource[_2] in the course.','<b>','</b>');
+    my $whatsnew_on=&mt("Display the [_1]What's New Page[_2] - a summary of items in the course which require attention.",'<b>','</b>');
 
-    $r->print('<br /><b>'.&mt('Set the default page to be displayed when you select a course role').'</b>&nbsp;'.&mt('(Currently: [_1])',$pagenames{$currvalue}).'<br />'.&mt('The global user preference you set for your courses can be overridden in an individual course by setting a course specific setting via the "[_1]" page in the course',"<i>What's New</i>").'<br /><br />');
+    $r->print('<br /><b>'
+             .&mt('Set the default page to be displayed when you select a course role')
+             .'</b>&nbsp;'
+             .&mt('(Currently: [_1])',$pagenames{$currvalue})
+             .'<br />'
+             .&mt("The global user preference you set for your courses can be overridden in an individual course by setting a course specific setting via the [_1]What's New Page[_2] in the course.",'<i>','</i>')
+             .'<br /><br />'
+    );
     $r->print(<<ENDLSCREEN);
 <form name="prefs" action="/adm/preferences" method="post">
 <input type="hidden" name="action" value="verify_and_change_coursepage" />
@@ -1681,7 +1681,7 @@
     } else {
         $message .= $lt{'apwb'}.'<br />';
         &Apache::lonnet::del('environment',['course_init_display']);
-        &Apache::lonnet::delenv('environment\.course_init_display');
+        &Apache::lonnet::delenv('environment.course_init_display');
     }
     my $refpage = $env{'form.refpage'};
     if (($env{'request.course.fn'}) && ($env{'request.course.id'})) {
@@ -1782,13 +1782,14 @@
                             text => 'Change Message Forwarding/Notification'},
                       printmenu => 'no',
                       subroutine => \&verify_and_change_msgforward }));
-    my $aboutmeaction=
-        '/adm/'.$env{'user.domain'}.'/'.$env{'user.name'}.'/aboutme';
-    push (@Options,{ action => 'none', 
-                     linktext =>
-                         q{Edit the 'About Me' Personal Information Screen},
-		     help => 'Prefs_About_Me',
-                     href => $aboutmeaction});
+    if (&Apache::lonnet::usertools_access($user,$domain,'aboutme')) {
+        my $aboutmeaction = '/adm/'.$domain.'/'.$user.'/aboutme';
+        push (@Options,{ action => 'none', 
+                         linktext =>
+                             q{Edit the 'About Me' Personal Information Screen},
+	   	         help => 'Prefs_About_Me',
+                         href => $aboutmeaction});
+    }
     push (@Options,({ action => 'changecolors',
                       linktext => 'Change Color Scheme',
                       href => '/adm/preferences',
@@ -2063,7 +2064,7 @@
 
 sub toggle_debug {
     if ($env{'user.debug'}) {
-        &Apache::lonnet::delenv('user\.debug');
+        &Apache::lonnet::delenv('user.debug');
     } else {
         &Apache::lonnet::appenv({'user.debug' => 1});
     }

--raeburn1253134159--