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

musolffc musolffc at source.lon-capa.org
Tue May 20 16:19:09 EDT 2014


musolffc		Tue May 20 20:19:09 2014 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  New function: critical_redirect()
  Accepts an interval parameter indicating how often to check for critical 
  messages.  If critical messages have not been checked for within the given
  interval, a check will be made and a redirect url to the critical message 
  will be returned if it exists.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1189 loncom/interface/loncommon.pm:1.1190
--- loncom/interface/loncommon.pm:1.1189	Fri May 16 18:32:51 2014
+++ loncom/interface/loncommon.pm	Tue May 20 20:19:08 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1189 2014/05/16 18:32:51 raeburn Exp $
+# $Id: loncommon.pm,v 1.1190 2014/05/20 20:19:08 musolffc Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -15634,6 +15634,25 @@
     return $outgoing;
 }
 
+# Checks for critical messages and returns a redirect url if one exists.
+# $interval indicates how often to check for messages.
+sub critical_redirect {
+    my ($interval) = @_;
+    if ((time-$env{'user.criticalcheck.time'})>$interval) {
+        my @what=&Apache::lonnet::dump('critical', $env{'user.domain'}, 
+                                        $env{'user.name'});
+        &Apache::lonnet::appenv({'user.criticalcheck.time'=>time});
+        my ($redirecturl,$redirectsymb);
+        if ($what[0]) {
+	    if (($what[0] ne 'con_lost') && ($what[0]!~/^error\:/)) {
+	        $redirecturl='/adm/email?critical=display';
+            }
+	    my $url=&Apache::lonnet::absolute_url().$redirecturl;
+            return (1, $url);
+        } 
+    } else { return 0; }
+}
+
 # Use:
 #   my $answer=reply("encrypt:passwd:$udom:$uname:$upass",$tryserver);
 #




More information about the LON-CAPA-cvs mailing list