[LON-CAPA-cvs] cvs: loncom /auth lonauth.pm /interface loncommon.pm

raeburn raeburn at source.lon-capa.org
Mon Nov 25 20:19:15 EST 2013


raeburn		Tue Nov 26 01:19:15 2013 EDT

  Modified files:              
    /loncom/auth	lonauth.pm 
    /loncom/interface	loncommon.pm 
  Log:
  - generate xhtml that satisifies w3c validation in cases where log-in failed.
  - loncommon::font_settings() takes an optional argument -- a reference to a HASH
    from which browser support for unicode and mathml can be extracted, in case
    where user is unauthenticated.
  
  
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.127 loncom/auth/lonauth.pm:1.128
--- loncom/auth/lonauth.pm:1.127	Sun Sep 29 00:49:24 2013
+++ loncom/auth/lonauth.pm	Tue Nov 26 01:19:12 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.127 2013/09/29 00:49:24 raeburn Exp $
+# $Id: lonauth.pm,v 1.128 2013/11/26 01:19:12 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -161,19 +161,33 @@
 
 sub failed {
     my ($r,$message,$form) = @_;
-    my $start_page = &Apache::loncommon::start_page('Unsuccessful Login',undef);
-    my $retry = '/adm/login?username='.$form->{'uname'}.
-                '&domain='.$form->{'udom'};
+    (undef,undef,undef,my $clientmathml,my $clientunicode) =
+        &Apache::loncommon::decode_user_agent();
+    my $args = {};
+    if ($clientunicode && !$clientmathml) {
+        $args = {'browser.unicode' => 1};
+    }
+
+    my $start_page = &Apache::loncommon::start_page('Unsuccessful Login',undef,$args);
+    my $uname = $form->{'uname'};
+    my $udom;
+    if (&Apache::lonnet::domain($form->{'udom'},'description') ne '') {
+        $udom = $form->{'udom'};
+    }  
+    my $retry = '/adm/login?username='.$form->{'uname'};
+    if ($udom) {
+        $retry .= '&domain='.$form->{'udom'}
+    }
     if (exists($form->{role})) {
-        $retry .= '&role='.$form->{role};
+        $retry .= '&role='.$form->{role};
     }
     if (exists($form->{symb})) {
-        $retry .= '&symb='.$form->{symb};
+        $retry .= '&symb='.$form->{symb};
     }
     my $end_page   = &Apache::loncommon::end_page();
     &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;
-    my $loginhelp = &loginhelpdisplay($form->{'udom'});
+    my $loginhelp = &loginhelpdisplay($udom);
     if ($loginhelp) {
         $loginhelp = '<p><a href="'.$loginhelp.'">'.&mt('Login problems?').'</a></p>';
     }
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1159 loncom/interface/loncommon.pm:1.1160
--- loncom/interface/loncommon.pm:1.1159	Mon Nov 25 20:18:55 2013
+++ loncom/interface/loncommon.pm	Tue Nov 26 01:19:15 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1159 2013/11/25 20:18:55 raeburn Exp $
+# $Id: loncommon.pm,v 1.1160 2013/11/26 01:19:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7282,7 +7282,7 @@
 
     my $result =
 	'<head>'.
-	&font_settings();
+	&font_settings($args);
 
     my $inhibitprint = &print_suppression();
 
@@ -7347,13 +7347,15 @@
 
 Returns neccessary <meta> to set the proper encoding
 
-Inputs: none
+Inputs: optional reference to HASH -- $args passed to &headtag()
 
 =cut
 
 sub font_settings {
+    my ($args) = @_;
     my $headerstring='';
-    if (!$env{'browser.mathml'} && $env{'browser.unicode'}) {
+    if ((!$env{'browser.mathml'} && $env{'browser.unicode'}) ||
+        ((ref($args) eq 'HASH') && ($args->{'browser.unicode'}))) {
 	$headerstring.=
 	    '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\n";
     }




More information about the LON-CAPA-cvs mailing list