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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 05 Jan 2008 18:36:26 -0000


raeburn		Sat Jan  5 13:36:26 2008 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm loncoursedata.pm 
  Log:
  bugs 5661, 5662.
  - request for urls to access photos (both thumbnails and full size images) served from library server (via token mechanism), moved to occur during first pass of %userlist.
  - eliminates timing problems caused when tokens were being requested as table display was being generated.  
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.43 loncom/interface/lonuserutils.pm:1.44
--- loncom/interface/lonuserutils.pm:1.43	Sat Jan  5 10:19:32 2008
+++ loncom/interface/lonuserutils.pm	Sat Jan  5 13:36:26 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.43 2008/01/05 15:19:32 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.44 2008/01/05 18:36:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1788,6 +1788,7 @@
     $index->{'email'} = &Apache::loncoursedata::CL_PERMANENTEMAIL();
     $index->{'role'} = &Apache::loncoursedata::CL_ROLE();
     $index->{'extent'} = &Apache::loncoursedata::CL_EXTENT();
+    $index->{'photo'} = &Apache::loncoursedata::CL_PHOTO();
     foreach my $key (keys(%{$index})) {
         $keylist->[$index->{$key}] = $key;
     }
@@ -2339,6 +2340,13 @@
                         next;
                     }
                 }
+                if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
+                    if (($displayphotos eq 'on') && ($role eq 'st')) {
+                        $userlist->{$user}->[$index{'photo'}] =
+                            &Apache::lonnet::retrievestudentphoto($udom,$uname,
+                                                                'gif','thumbnail');
+                    }
+                }
             }
         }
         my %emails   = &Apache::loncommon::getemails($uname,$udom);
@@ -2470,11 +2478,8 @@
                         $r->print('    <td>&nbsp;</td>  ');
                     }
                     if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
-                        if ($displayphotos eq 'on' && $sdata->[$index{'role'}] eq 'st') {
-                            my $imgurl =
-                        &Apache::lonnet::retrievestudentphoto($in{'domain'},$in{'username'},
-                                                          'gif','thumbnail');
-                            $r->print('    <td align="right"><a href="javascript:photowindow('."'".&Apache::lonnet::studentphoto($in{'domain'},$in{'username'},'jpg')."'".')"><img src="'.$imgurl.'" border="1"></a></td>');
+                        if ($displayphotos eq 'on' && $role eq 'st' && $in{'photo'} ne '') {
+                            $r->print('    <td align="right"><a href="javascript:photowindow('."'".&Apache::lonnet::studentphoto($in{'domain'},$in{'username'},'jpg')."'".')"><img src="'.$in{'photo'}.'" border="1"></a></td>');
                         } else {
                             $r->print('    <td>&nbsp;</td>  ');
                         }
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.184 loncom/interface/loncoursedata.pm:1.185
--- loncom/interface/loncoursedata.pm:1.184	Mon Nov  5 23:39:19 2007
+++ loncom/interface/loncoursedata.pm	Sat Jan  5 13:36:26 2008
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursedata.pm,v 1.184 2007/11/06 04:39:19 raeburn Exp $
+# $Id: loncoursedata.pm,v 1.185 2008/01/05 18:36:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3103,6 +3103,7 @@
 sub CL_PERMANENTEMAIL { return 11; }
 sub CL_ROLE     { return 12; }
 sub CL_EXTENT   { return 13; }
+sub CL_PHOTO   { return 14; }
 
 sub get_classlist {
     my ($cdom,$cnum) = @_;