[LON-CAPA-cvs] cvs: loncom(GCI_2) /auth lonroles.pm

gci gci@source.lon-capa.org
Wed, 23 Sep 2009 16:45:17 -0000


gci		Wed Sep 23 16:45:17 2009 EDT

  Modified files:              (Branch: GCI_2)
    /loncom/auth	lonroles.pm 
  Log:
  - Customization for GCI.
  - Automatically select role if user only has one active role.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.231.6.1 loncom/auth/lonroles.pm:1.231.6.2
--- loncom/auth/lonroles.pm:1.231.6.1	Wed Sep 23 16:42:03 2009
+++ loncom/auth/lonroles.pm	Wed Sep 23 16:45:17 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.231.6.1 2009/09/23 16:42:03 gci Exp $
+# $Id: lonroles.pm,v 1.231.6.2 2009/09/23 16:45:17 gci Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -740,6 +740,27 @@
         }
         $r->print(&Apache::loncommon::end_page());
 	return OK;
+    } elsif ($countactive==1) { # Is there only one choice?
+        my $needs_switchserver;
+        if ($env{'user.author'}) {
+            $needs_switchserver = &check_needs_switchserver($possiblerole);
+        }
+        if ((!$needs_switchserver) && ($env{'request.role'} eq 'cm')) {
+            $r->print('<h3>'.&mt('Please stand by.').'</h3>'.
+                '<input type="hidden" name="'.$possiblerole.'" value="1" />'.
+            '<noscript><br /><input type="submit" name="submit" value="'.&mt('Continue').'" /></noscript>');
+            $r->print("</form>\n");
+            $r->rflush();
+            $r->print('<script type="text/javascript">document.forms.rolechoice.submit();</script>');
+            $r->print(&Apache::loncommon::end_page());
+            return OK;
+        }
+        if ($needs_switchserver) {
+            $r->print("<h2>".&mt('Server Switch Required')."</h2>\n".
+                      &mt('Construction Space access is only available from '.
+                          'the home server of the corresponding Author.').'<br />'.
+                      &mt("Click the 'Switch Server' link to go there.").'<br />');
+        }
     }
 # ----------------------------------------------------------------------- Table
     unless ((!&Apache::loncommon::show_course()) || ($nochoose) || ($countactive==1)) {