[LON-CAPA-cvs] cvs: loncom(version_2_1_X) /interface lonwhatsnew.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 22 Dec 2005 22:39:50 -0000


albertel		Thu Dec 22 17:39:50 2005 EDT

  Modified files:              (Branch: version_2_1_X)
    /loncom/interface	lonwhatsnew.pm 
  Log:
  - backport bugfixes from 1.40 and 1.41
  
  
Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.38.2.1 loncom/interface/lonwhatsnew.pm:1.38.2.2
--- loncom/interface/lonwhatsnew.pm:1.38.2.1	Mon Dec 19 18:24:40 2005
+++ loncom/interface/lonwhatsnew.pm	Thu Dec 22 17:39:49 2005
@@ -1,5 +1,5 @@
 #
-# $Id: lonwhatsnew.pm,v 1.38.2.1 2005/12/19 23:24:40 albertel Exp $
+# $Id: lonwhatsnew.pm,v 1.38.2.2 2005/12/22 22:39:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -109,7 +109,9 @@
 sub display_main_box {
     my ($r,$command,$checkallowed) = @_;
     my $domain=&Apache::loncommon::determinedomain();
-    my $tabbg=&Apache::loncommon::designparm('coordinator.tabbg',$domain);
+    my $function = &Apache::loncommon::get_users_function();
+    my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);
+
     $r->print('<table width="100%" border="0" cellpadding="5" cellspacing="0"><tr><td width="100%">');
 
     my %threshold_titles = (
@@ -136,8 +138,8 @@
                (&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) {
         &display_interval_config($r,\%interval_titles);
     } else {
-        &display_actions_box($r,$command,\%threshold_titles,\%interval_titles,
-                                                     $cdom,$crs,$checkallowed);
+	&display_actions_box($r,$tabbg,$command,\%threshold_titles,
+			     \%interval_titles,$cdom,$crs,$checkallowed);
     }
     $r->print(<<END_OF_BLOCK);
   </td>
@@ -199,8 +201,9 @@
 #-------------------------------
                                                                                 
 sub display_actions_box() {
-    my ($r,$command,$threshold_titles,$interval_titles,$cdom,$crs,
-                                                           $checkallowed) = @_;
+    my ($r,$tabbg,$command,$threshold_titles,$interval_titles,
+	$cdom,$crs,$checkallowed) = @_;
+
     my $rowColor1 = "#ffffff";
     my $rowColor2 = "#eeeeee";
 
@@ -237,24 +240,12 @@
     my $needitems = 0;
     my $boxcount = 0;
 
-    my $domain=&Apache::loncommon::determinedomain();
-    my $function;
-    if ($env{'request.role'}=~/^(cc|in|ta|ep)/) {
-        $function='coordinator';
-    }
-    if ($env{'request.role'}=~/^(su|dc|ad|li)/) {
-        $function='admin';
-    }
-
     my %threshold = (
                       av_attempts => 2,
                       degdiff => 0.5,
                       numstudents => 2,
                      );
 
-    my $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain);
-    my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);
-
     unless ($cid) {
         $r->print('<br /><b><center>'.$lt{'yacc'}.'</center></b><br /><br />');
         return;
@@ -797,9 +788,8 @@
     my $interval;
     my %settings = &Apache::lonnet::dump('nohist_whatsnew',$uname,$udom,$cid,':interval');
     my ($tmp) = %settings;
-    if ($tmp =~ /^Error/) {
-        &logthis();
-    } else {
+
+    unless ($tmp =~ /^(con_lost|error|no_such_host)/i) {
         $interval = $settings{$cid.':interval'};
     }
     return $interval;
@@ -940,11 +930,8 @@
     my ($cdom,$crs,$navmap,$changed,$starttime) = @_;
     my %changes=&Apache::lonnet::dump('versionupdate',$cdom,$crs);
     my ($tmp) = keys(%changes);
-    if ($tmp =~/^error\:/) {
-        &Apache::lonnet::logthis('Error retrieving version update information: '.
-        $tmp.' for '.$cdom.'_'.$crs.' in whatsnew');
-    } else {
-        if (keys(%changes) > 0) {
+    unless ($tmp =~ /^(con_lost|error|no_such_host)/i) {
+	if (keys(%changes) > 0) {
             foreach my $key (sort(keys(%changes))) {
                 if ($changes{$key} > $starttime) {
                     my $version;
@@ -1226,12 +1213,14 @@
     my ($uname,$udom,$cid) = @_;
     my %settings = &Apache::lonnet::dump('nohist_whatsnew',$udom,$uname,$cid); 
     my ($tmp) = keys(%settings);
-    if ($tmp=~/^error:/) {
+    if ($tmp=~/^(con_lost|error|no_such_host)/i) {
         %settings = ();
-        unless ($tmp eq 'error: 2 tie(GDBM) Failed while attempting dump') {
-            &logthis('Error retrieving whatsnew settings: '.$tmp.' for '.
-                                $uname.':'.$udom.' for course: '.$cid);
-        }
+	unless ($tmp =~ /^error: 2 /) {
+	    &Apache::lonnet::logthis('Error retrieving whatsnew settings: '.
+				     $tmp.' for '.$uname.':'.$udom.
+				     ' for course: '.$cid);
+
+	}
     }
     return %settings;
 }