Diff for /loncom/interface/lonuserutils.pm between versions 1.139 and 1.140

version 1.139, 2012/08/19 00:18:16 version 1.140, 2012/08/21 01:50:34
Line 1444  sub print_userlist { Line 1444  sub print_userlist {
     if ($env{'form.Status'} !~ /^(Any|Expired|Active|Future)$/) {      if ($env{'form.Status'} !~ /^(Any|Expired|Active|Future)$/) {
         $env{'form.Status'} = 'Active';          $env{'form.Status'} = 'Active';
     }      }
       my $onchange = "javascript:updateCols('Status');";
     my $status_select = &Apache::lonhtmlcommon::StatusOptions      my $status_select = &Apache::lonhtmlcommon::StatusOptions
         ($env{'form.Status'});          ($env{'form.Status'},undef,undef,$onchange);
   
     if ($env{'form.showrole'} eq '') {      if ($env{'form.showrole'} eq '') {
         if ($context eq 'course') {          if ($context eq 'course') {
Line 1478  sub print_userlist { Line 1479  sub print_userlist {
     $r->print('<form name="studentform" method="post" action="/adm/createuser">'."\n".      $r->print('<form name="studentform" method="post" action="/adm/createuser">'."\n".
               '<input type="hidden" name="action" value="'.                '<input type="hidden" name="action" value="'.
               $env{'form.action'}.'" />');                $env{'form.action'}.'" />');
     $r->print("<p>\n");      $r->print('<div>'."\n");
     if ($env{'form.action'} ne 'modifystudent') {      if ($env{'form.action'} ne 'modifystudent') {
         my %lt=&Apache::lonlocal::texthash('csv' => "CSV",          my %lt=&Apache::lonlocal::texthash('csv' => "CSV",
                                            'excel' => "Excel",                                             'excel' => "Excel",
                                            'html'  => 'HTML');                                             'html'  => 'HTML');
         my $output_selector = '<select size="1" name="output" >';          my $output_selector = '<select size="1" name="output" onchange="javascript:updateCols('."'output'".');" >';
         foreach my $outputformat ('html','csv','excel') {          foreach my $outputformat ('html','csv','excel') {
             my $option = '<option value="'.$outputformat.'"';              my $option = '<option value="'.$outputformat.'"';
             if ($outputformat eq $env{'form.output'}) {              if ($outputformat eq $env{'form.output'}) {
Line 1493  sub print_userlist { Line 1494  sub print_userlist {
             $output_selector .= "\n".$option;              $output_selector .= "\n".$option;
         }          }
         $output_selector .= '</select>';          $output_selector .= '</select>';
         $r->print('<label><span class="LC_nobreak">'          $r->print('<span class="LC_nobreak">'
                  .&mt('Output Format: [_1]',$output_selector)                   .&mt('Output Format: [_1]',$output_selector)
                  .'</span></label>'.('&nbsp;'x3));                   .'</span>'.('&nbsp;'x3));
     }      }
     $r->print('<label><span class="LC_nobreak">'      $r->print('<span class="LC_nobreak">'
              .&mt('User Status: [_1]',$status_select)               .&mt('User Status: [_1]',$status_select)
              .'</span></label>'.('&nbsp;'x3)."\n");               .'</span>'.('&nbsp;'x3)."\n");
     my $roleselected = '';      my $roleselected = '';
     if ($env{'form.showrole'} eq 'Any') {      if ($env{'form.showrole'} eq 'Any') {
        $roleselected = ' selected="selected"';          $roleselected = ' selected="selected"'; 
Line 1510  sub print_userlist { Line 1511  sub print_userlist {
         ($cnum,$cdom) = &get_course_identity();          ($cnum,$cdom) = &get_course_identity();
         $r->print(&section_group_filter($cnum,$cdom));          $r->print(&section_group_filter($cnum,$cdom));
     }      }
       $r->print('</div><div class="LC_left_float">'.
                 &column_checkboxes($context,$mode,$formname).
                 '</div><br clear="all" />');
     if ($env{'form.phase'} eq '') {      if ($env{'form.phase'} eq '') {
         $r->print('<br /><br />'.&list_submit_button(&mt('Display List of Users')).          $r->print(&list_submit_button(&mt('Display List of Users'))."\n".
                   "\n</p>\n".  
                   '<input type="hidden" name="phase" value="" /></form>');                    '<input type="hidden" name="phase" value="" /></form>');
         return;          return;
     }      }
     if (!(($context eq 'domain') &&       if (!(($context eq 'domain') && 
           (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) {            (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) {
         $r->print(          $r->print(&list_submit_button(&mt('Update Display'))."\n");
             "\n</p>\n"      }
            .'<p>'  
            .&list_submit_button(&mt('Update Display'))      my @cols = &infocolumns($context,$mode);  
            ."</p>\n"      if (!@cols) {
         );           $r->print('<hr /><span class="LC_warning">'.
                      &mt('No user information selected for display.').'</span>'.
                      '<input type="hidden" name="phase" value="display" /></form>'."\n");
            return;
     }      }
     my ($indexhash,$keylist) = &make_keylist_array();      my ($indexhash,$keylist) = &make_keylist_array();
     my (%userlist,%userinfo,$clearcoursepick);      my (%userlist,%userinfo,$clearcoursepick);
Line 1565  sub print_userlist { Line 1571  sub print_userlist {
             $r->print('<hr />'.&mt('Searching').' ...<br />&nbsp;<br />');              $r->print('<hr />'.&mt('Searching').' ...<br />&nbsp;<br />');
         }          }
     } else {      } else {
         $r->print('<hr />'.&mt('Searching').' ...<br />&nbsp;<br />');          $r->print('<hr /><div id="searching">'.&mt('Searching').' ...</div>');
     }      }
     $r->rflush();      $r->rflush();
     if ($context eq 'course') {      if ($context eq 'course') {
Line 1719  sub print_userlist { Line 1725  sub print_userlist {
     }      }
     $r->print('<input type="hidden" name="phase" value="'.      $r->print('<input type="hidden" name="phase" value="'.
               $env{'form.phase'}.'" /></form>');                $env{'form.phase'}.'" /></form>');
       return;
 }  }
   
 sub role_filter {  sub role_filter {
Line 1731  sub role_filter { Line 1738  sub role_filter {
     my ($role_select);      my ($role_select);
     if ($context eq 'domain') {      if ($context eq 'domain') {
         $role_select = &domain_roles_select();          $role_select = &domain_roles_select();
         $output = '<label><span class="LC_nobreak">'          $output = '<span class="LC_nobreak">'
                  .&mt('Role Type: [_1]',$role_select)                   .&mt('Role Type: [_1]',$role_select)
                  .'</span></label>';                   .'</span>';
     } else {      } else {
         $role_select = '<select name="showrole">'."\n".          $role_select = '<select name="showrole" onchange="javascript:updateCols('."'showrole'".');">'."\n".
                        '<option value="Any" '.$roleselected.'>'.                         '<option value="Any" '.$roleselected.'>'.
                        &mt('Any role').'</option>';                         &mt('Any role').'</option>';
         my ($roletype,$crstype);          my ($roletype,$crstype);
Line 1762  sub role_filter { Line 1769  sub role_filter {
             $role_select .= '<option value="'.$role.'"'.$roleselected.'>'.$plrole.'</option>';              $role_select .= '<option value="'.$role.'"'.$roleselected.'>'.$plrole.'</option>';
         }          }
         $role_select .= '</select>';          $role_select .= '</select>';
         $output = '<label><span class="LC_nobreak">'          $output = '<span class="LC_nobreak">'
                  .&mt('Role: [_1]',$role_select)                   .&mt('Role: [_1]',$role_select)
                  .'</span></label> ';                   .'</span>';
     }      }
     return $output;      return $output;
 }  }
Line 1827  sub section_group_filter { Line 1834  sub section_group_filter {
     return $output;      return $output;
 }  }
   
   sub infocolumns {
       my ($context,$mode) = @_;
       my @cols;
       if (($mode eq 'pickauthor') || ($mode eq 'autoenroll')) {
           @cols = &get_cols_array($context,$mode);
       } else {
           my @posscols = &get_cols_array($context,$mode);
           if ($env{'form.phase'} ne '') {
               my @checkedcols = &Apache::loncommon::get_env_multiple('form.showcol');
               foreach my $col (@checkedcols) {
                   if (grep(/^$col$/,@posscols)) {
                       push(@cols,$col);
                   }
               }
           } else {
               @cols = @posscols;
           }
       }
       return @cols;
   }
   
   sub get_cols_array {
       my ($context,$mode) = @_;
       my @cols;
       if ($mode eq 'pickauthor') {
           @cols = ('username','fullname','status','email');
       } else {
           @cols = ('username','domain','id','fullname');
           if ($context eq 'course') {
               push(@cols,'section');
           }
           push(@cols,('start','end','role'));
           if ($context eq 'domain') {
               push (@cols,'extent');
           }
           unless (($mode eq 'autoenroll') && ($env{'form.Status'} ne 'Any')) {
               push(@cols,'status');
           }
           if ($context eq 'course') {
               push(@cols,'groups');
           }
           push(@cols,'email');
           if (($context eq 'course') && ($mode ne 'autoenroll')) {
               push(@cols,'lastlogin','clicker');
           }
           if (($context eq 'course') && ($mode ne 'autoenroll') &&
               ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'})) {
               push(@cols,'photos');
           }
       }
       return @cols;
   }
   
   sub column_checkboxes {
       my ($context,$mode,$formname) = @_;
       my @cols = &get_cols_array($context,$mode);
       my @showncols = &Apache::loncommon::get_env_multiple('form.showcol');
       my (%disabledchk,%unchecked);
       if ($env{'form.phase'} eq '') {
           $disabledchk{'status'} = 1;
           if ($context eq 'course') {
               $disabledchk{'role'} = 1;
               $unchecked{'photo'} = 1;
           }
           $unchecked{'clicker'} = 1;
           $unchecked{'start'} = 1;
           $unchecked{'end'} = 1;
       } else {
           if ($env{'form.Status'} ne 'Any') {
               $disabledchk{'status'} = 1;
           }
           if ($env{'form.showrole'} ne 'Any') {
               $disabledchk{'role'} = 1; 
           }
       }
       my $numposs = scalar(@cols);
       my $numinrow = 8;
       my %lt = &get_column_names($context);
       my $output = '<fieldset><legend>'.&mt('Information to show').'</legend>'."\n".'<span class="LC_nobreak">'.
                    '<input type="button" onclick="javascript:checkAll(document.'.$formname.'.showcol);" value="'.&mt('check all').'" />'.
                    ('&nbsp;'x3).
                    '<input type="button" onclick="javascript:uncheckAll(document.'.$formname.'.showcol);" value="'.&mt('uncheck all').'" />'.
                    '</span><table>';
       
       for (my $i=0; $i<$numposs; $i++) {
           my $rem = $i%($numinrow);
           if ($rem == 0) {
               if ($i > 0) {
                   $output .= '</tr>';
               }
               $output .= '<tr>';
           }
           my $checked;
           if ($env{'form.phase'} eq '') {
               $checked = ' checked="checked"';
               if ($unchecked{$cols[$i]}) { 
                  $checked = '';
               }
               if ($disabledchk{$cols[$i]}) {
                   $checked = ' disabled="disabled"';
               }
           } elsif (grep(/^\Q$cols[$i]\E$/,@showncols)) {
               $checked = ' checked="checked"';
           } elsif ($disabledchk{$cols[$i]}) {
               $checked = ' disabled="disabled"';
           }
           if ($i == $numposs-1) {
               my $colsleft = $numinrow-$rem;
               if ($colsleft > 1) {
                   $output .= '<td colspan="'.$colsleft.'">';
               } else {
                   $output .= '<td>';
               }
           } else {
               $output .= '<td>';
           }
           $output .= '<label><input id="showcol'.$cols[$i].'" type="checkbox" name="showcol" value="'.$cols[$i].'"'.$checked.' />'.
                      $lt{$cols[$i]}.'</label></td>';
   
       }
       $output .= '</tr></table></fieldset>';
       return $output;
   }
   
 sub list_submit_button {  sub list_submit_button {
     my ($text) = @_;      my ($text) = @_;
     return '<input type="button" name="updatedisplay" value="'.$text.'" onclick="javascript:display_update()" />';      return '<input type="button" name="updatedisplay" value="'.$text.'" onclick="javascript:display_update()" />';
 }  }
   
   sub get_column_names {
       my ($context) = @_;
       my %lt = &Apache::lonlocal::texthash(
           'username'   => "username",
           'domain'     => "domain",
           'id'         => 'ID',
           'fullname'   => "name",
           'section'    => "section",
           'groups'     => "active groups",
           'start'      => "start date",
           'end'        => "end date",
           'status'     => "status",
           'role'       => "role",
           'type'       => "enroll type/action",
           'email'      => "e-mail address",
           'photo'      => "photo",
           'lastlogin'  => "last login",
           'extent'     => "extent",
           'ca'         => "check all",
           'ua'         => "uncheck all",
           'clicker'    => "clicker-ID",
       );
       if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
           $lt{'extent'} = &mt('Course(s): description, section(s), status');
       } elsif ($context eq 'domain' && $env{'form.roletype'} eq 'community') {
           $lt{'extent'} = &mt('Communities: description, section(s), status');
       } elsif ($context eq 'author') {
           $lt{'extent'} = &mt('Author');
       }
       return %lt;
   }
   
 sub gather_userinfo {  sub gather_userinfo {
     my ($context,$format,$userlist,$indexhash,$userinfo,$rolehash,$permission) = @_;      my ($context,$format,$userlist,$indexhash,$userinfo,$rolehash,$permission) = @_;
     my $viewablesec;      my $viewablesec;
Line 2195  sub show_users_list { Line 2358  sub show_users_list {
         $sortby = 'username';          $sortby = 'username';
     }      }
     my $setting = $env{'form.roletype'};      my $setting = $env{'form.roletype'};
     my ($cid,$cdom,$cnum,$classgroups,$displayphotos,$displayclickers,$crstype);      my ($cid,$cdom,$cnum,$classgroups,$crstype);
     if ($context eq 'course') {      if ($context eq 'course') {
         $cid = $env{'request.course.id'};          $cid = $env{'request.course.id'};
         $crstype = &Apache::loncommon::course_type();          $crstype = &Apache::loncommon::course_type();
Line 2205  sub show_users_list { Line 2368  sub show_users_list {
         if ($mode eq 'autoenroll') {          if ($mode eq 'autoenroll') {
             $env{'form.showrole'} = 'st';              $env{'form.showrole'} = 'st';
         } else {          } else {
             if (! exists($env{'form.displayphotos'})) {  
                 $env{'form.displayphotos'} = 'off';  
             }  
             $displayphotos = $env{'form.displayphotos'};  
             if (! exists($env{'form.displayclickers'})) {  
                 $env{'form.displayclickers'} = 'off';  
             }  
             $displayclickers = $env{'form.displayclickers'};  
             if ($env{'course.'.$cid.'.internal.showphoto'}) {              if ($env{'course.'.$cid.'.internal.showphoto'}) {
                 $r->print('                  $r->print('
 <script type="text/javascript">  <script type="text/javascript">
Line 2228  function photowindow(photolink) { Line 2383  function photowindow(photolink) {
 </script>  </script>
                ');                 ');
             }              }
             $r->print(<<END);  
 <input type="hidden" name="displayphotos" value="$displayphotos" />  
 <input type="hidden" name="displayclickers" value="$displayclickers" />  
 END  
         }          }
     } elsif ($context eq 'domain') {      } elsif ($context eq 'domain') {
         if ($setting eq 'community') {          if ($setting eq 'community') {
Line 2241  END Line 2392  END
         }          }
     }      }
     if ($mode ne 'autoenroll' && $mode ne 'pickauthor') {      if ($mode ne 'autoenroll' && $mode ne 'pickauthor') {
         my $check_uncheck_js = &Apache::loncommon::check_uncheck_jscript();  
         my $date_sec_selector = &date_section_javascript($context,$setting,$statusmode);          my $date_sec_selector = &date_section_javascript($context,$setting,$statusmode);
         my $verify_action_js = &bulkaction_javascript($formname);          my $verify_action_js = &bulkaction_javascript($formname);
         $r->print(<<END);          $r->print(<<END);
   
 <script type="text/javascript" language="Javascript">  <script type="text/javascript" language="Javascript">
 // <![CDATA[  // <![CDATA[
 $check_uncheck_js  
   
 $verify_action_js  $verify_action_js
   
Line 2306  END Line 2455  END
     $r->print(<<END);      $r->print(<<END);
 <input type="hidden" name="sortby" value="$sortby" />  <input type="hidden" name="sortby" value="$sortby" />
 END  END
       my @cols = &infocolumns($context,$mode);
     my %lt=&Apache::lonlocal::texthash(      my %coltxt = &get_column_names($context);
                        'username'   => "username",      my %acttxt = &Apache::lonlocal::texthash(
                        'domain'     => "domain",  
                        'id'         => 'ID',  
                        'fullname'   => "name",  
                        'section'    => "section",  
                        'groups'     => "active groups",  
                        'start'      => "start date",  
                        'end'        => "end date",  
                        'status'     => "status",  
                        'role'       => "role",  
                        'type'       => "enroll type/action",  
                        'email'      => "e-mail address",  
                        'photo'      => "photo",  
                        'lastlogin'  => "last login",   
                        'extent'     => "extent",  
                        'pr'         => "Proceed",                         'pr'         => "Proceed",
                        'ca'         => "check all",  
                        'ua'         => "uncheck all",  
                        'ac'         => "Action to take for selected users",                         'ac'         => "Action to take for selected users",
                        'link'       => "Behavior of clickable username link for each user",                         'link'       => "Behavior of clickable username link for each user",
                        'aboutme'    => "Display a user's personal information page",                         'aboutme'    => "Display a user's personal information page",
                        'owin'       => "Open in a new window",                         'owin'       => "Open in a new window",
                        'modify'     => "Modify a user's information",                         'modify'     => "Modify a user's information",
                        'track'      => "View a user's recent activity",                         'track'      => "View a user's recent activity",
                        'clicker'    => "Clicker-ID",  
                       );                        );
     if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {      my %lt = (%coltxt,%acttxt);
         $lt{'extent'} = &mt('Course(s): description, section(s), status');  
     } elsif ($context eq 'domain' && $env{'form.roletype'} eq 'community') {  
         $lt{'extent'} = &mt('Communities: description, section(s), status');  
     } elsif ($context eq 'author') {  
         $lt{'extent'} = &mt('Author');   
     }  
     my @cols;  
     if ($mode eq 'pickauthor') {  
         @cols = ('username','fullname','status','email');  
     } else {  
         @cols = ('username','domain','id','fullname');  
         if ($context eq 'course') {  
             push(@cols,'section');  
         }  
         if (!($context eq 'domain' && ($env{'form.roletype'} eq 'course')  
                               && ($env{'form.roletype'} eq 'community'))) {   
             push(@cols,('start','end'));  
         }  
         if ($env{'form.showrole'} eq 'Any' || $env{'form.showrole'} eq 'cr') {  
             push(@cols,'role');  
         }  
         if ($context eq 'domain' && ($env{'form.roletype'} eq 'author' ||  
                                     $env{'form.roletype'} eq 'course' ||  
                                     $env{'form.roletype'} eq 'community')) {  
             push (@cols,'extent');  
         }  
         if (($statusmode eq 'Any') &&   
             (!($context eq 'domain' && (($env{'form.roletype'} eq 'course')  
              || ($env{'form.roletype'} eq 'community'))))) {  
             push(@cols,'status');  
         }  
         if ($context eq 'course') {  
             push(@cols,'groups');  
         }  
         push(@cols,'email');  
         if ($context eq 'course') {  
             push(@cols,'lastlogin');  
         }  
     }  
   
     my $rolefilter = $env{'form.showrole'};      my $rolefilter = $env{'form.showrole'};
     if ($env{'form.showrole'} eq 'cr') {      if ($env{'form.showrole'} eq 'cr') {
         $rolefilter = &mt('custom');            $rolefilter = &mt('custom');  
Line 2385  END Line 2477  END
     if ($mode ne 'autoenroll') {      if ($mode ne 'autoenroll') {
         $results_description = &results_header_row($rolefilter,$statusmode,          $results_description = &results_header_row($rolefilter,$statusmode,
                                                    $context,$permission,$mode,$crstype);                                                     $context,$permission,$mode,$crstype);
         $r->print('<b>'.$results_description.'</b><br /><br />');          $r->print('<b>'.$results_description.'</b><br clear="all" />');
     }      }
     my ($output,$actionselect,%canchange,%canchangesec);      my ($output,$actionselect,%canchange,%canchangesec);
     if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll' || $mode eq 'pickauthor') {      if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll' || $mode eq 'pickauthor') {
Line 2481  END Line 2573  END
             }              }
             $output .= '</td><td valign="top"  style="border-left: 1px solid;"><span class="LC_nobreak"><input type="checkbox" name="userwin" value="1"'.$checkwin.' />'.$lt{'owin'}.'</span></td></tr></table></fieldset></div>';              $output .= '</td><td valign="top"  style="border-left: 1px solid;"><span class="LC_nobreak"><input type="checkbox" name="userwin" value="1"'.$checkwin.' />'.$lt{'owin'}.'</span></td></tr></table></fieldset></div>';
         }          }
         $output .= "\n".'<div class="LC_clear_float_footer">&nbsp;</div>'."\n".          $output .= "\n".'<br clear="all" />'."\n".
                   &Apache::loncommon::start_data_table().                    &Apache::loncommon::start_data_table().
                   &Apache::loncommon::start_data_table_header_row();                    &Apache::loncommon::start_data_table_header_row();
         if ($mode eq 'autoenroll') {          if ($mode eq 'autoenroll') {
Line 2498  END Line 2590  END
             $output .= "<th><a href=\"javascript:document.$formname.sortby.value='$item';document.$formname.submit();\">$lt{$item}</a></th>\n";              $output .= "<th><a href=\"javascript:document.$formname.sortby.value='$item';document.$formname.submit();\">$lt{$item}</a></th>\n";
         }          }
         my %role_types = &role_type_names();          my %role_types = &role_type_names();
         if ($context eq 'course' && $mode ne 'autoenroll') {  
             if ($env{'form.showrole'} eq 'st' || $env{'form.showrole'} eq 'Any') {  
                 # Clicker display on or off?  
                 my %clicker_options = (  
                                         'on' => 'Show',  
                                         'off' => 'Hide',  
                                       );  
                 my $clickerchg = 'on';  
                 if ($displayclickers eq 'on') {  
                     $clickerchg = 'off';  
                 }  
                 $output .= '    <th>'."\n".'     '  
                         .&mt('[_1]'.$clicker_options{$clickerchg}.'[_2] clicker id'  
                             ,'<a href="javascript:document.'.$formname.'.displayclickers.value='  
                              ."'".$clickerchg."'".';document.'.$formname.'.submit();">'  
                             ,'</a>')  
                         ."\n".'    </th>'."\n";  
   
                 # Photo display on or off?  
                 if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {  
                     my %photo_options = &Apache::lonlocal::texthash(  
                                                             'on' => 'Show',  
                                                             'off' => 'Hide',  
                                                                 );  
                     my $photochg = 'on';  
                     if ($displayphotos eq 'on') {  
                         $photochg = 'off';  
                     }  
                     $output .= '    <th>'."\n".'     '.  
                 '<a href="javascript:document.'.$formname.'.displayphotos.value='.  
                       "'".$photochg."'".';document.'.$formname.'.submit();">'.  
                       $photo_options{$photochg}.'</a>&nbsp;'.$lt{'photo'}."\n".  
                       '    </th>'."\n";  
                 }  
             }  
         }  
         $output .= &Apache::loncommon::end_data_table_header_row();          $output .= &Apache::loncommon::end_data_table_header_row();
 # Done with the HTML header line  # Done with the HTML header line
     } elsif ($mode eq 'csv') {      } elsif ($mode eq 'csv') {
Line 2554  END Line 2610  END
             $CSVfile = undef;              $CSVfile = undef;
         }          }
         #          #
         push @cols,'clicker';  
         # Write headers and data to file          # Write headers and data to file
         print $CSVfile '"'.$results_description.'"'."\n";           print $CSVfile '"'.$results_description.'"'."\n"; 
         print $CSVfile '"'.join('","',map {          print $CSVfile '"'.join('","',map {
             &Apache::loncommon::csv_translate($lt{$_})              &Apache::loncommon::csv_translate($lt{$_})
             } (@cols))."\"\n";              } (@cols))."\"\n";
     } elsif ($mode eq 'excel') {      } elsif ($mode eq 'excel') {
         push @cols,'clicker';  
         # Create the excel spreadsheet          # Create the excel spreadsheet
         ($excel_workbook,$excel_filename,$format) =          ($excel_workbook,$excel_filename,$format) =
             &Apache::loncommon::create_workbook($r);              &Apache::loncommon::create_workbook($r);
Line 2685  END Line 2739  END
                     }                      }
                 }                  }
                 if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {                  if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
                     if (($displayphotos eq 'on') && ($role eq 'st')) {                      if ((grep/^photo$/,@cols) && ($role eq 'st')) {
                         $userlist->{$user}->[$index{'photo'}] =                          $userlist->{$user}->[$index{'photo'}] =
                             &Apache::lonnet::retrievestudentphoto($udom,$uname,'jpg');                              &Apache::lonnet::retrievestudentphoto($udom,$uname,'jpg');
                         $userlist->{$user}->[$index{'thumbnail'}] =                          $userlist->{$user}->[$index{'thumbnail'}] =
Line 2829  END Line 2883  END
                         $showitem = $ltstatus{$in{$item}};                          $showitem = $ltstatus{$in{$item}};
                     }                      }
                     $r->print('<td>'.$showitem.'</td>'."\n");                      $r->print('<td>'.$showitem.'</td>'."\n");
                 } else {                  } elsif ($item eq 'photo') {
                     $r->print('<td>'.$in{$item}.'</td>'."\n");                       if (($context eq 'course') && ($mode ne 'autoenroll') && 
                 }                           ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'})) { 
             }                           if ($role eq 'st') {
             if (($context eq 'course') && ($mode ne 'autoenroll')) {                               $r->print('<td align="right"><a href="javascript:photowindow('."'".$in{'photo'}."'".')"><img src="'.$in{'thumbnail'}.'" border="1" alt="" /></a></td>');
                 if ($env{'form.showrole'} eq 'st' || $env{'form.showrole'} eq 'Any') {                           } else {
                     if ($displayclickers eq 'on') {                               $r->print('<td>&nbsp;</td>');
                         my $clickers =                           }
                        }
                   } elsif ($item eq 'clicker') {
                       if (($context eq 'course') && ($mode ne 'autoenroll')) {
                           if ($env{'form.showrole'} eq 'st' || $env{'form.showrole'} eq 'Any') {
                               my $clickers =
                    (&Apache::lonnet::userenvironment($in{'domain'},$in{'username'},'clickers'))[1];                     (&Apache::lonnet::userenvironment($in{'domain'},$in{'username'},'clickers'))[1];
                         if ($clickers!~/\w/) { $clickers='-'; }                              if ($clickers!~/\w/) { $clickers='-'; }
                         $r->print('<td>'.$clickers.'</td>');                              $r->print('<td>'.$clickers.'</td>');
                     } else {  
                         $r->print('    <td>&nbsp;</td>  ');  
                     }  
                     if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {  
                         if ($displayphotos eq 'on' && $role eq 'st' && $in{'photo'} ne '') {  
                             $r->print('    <td align="right"><a href="javascript:photowindow('."'".$in{'photo'}."'".')"><img src="'.$in{'thumbnail'}.'" border="1" alt="" /></a></td>');  
                         } else {                          } else {
                             $r->print('    <td>&nbsp;</td>  ');                               $r->print('<td>&nbsp;</td>'."\n");
                         }                          } 
                     }                      } 
                   } else {
                       $r->print('<td>'.$in{$item}.'</td>'."\n");
                 }                  }
             }              }
             $r->print(&Apache::loncommon::end_data_table_row());              $r->print(&Apache::loncommon::end_data_table_row());

Removed from v.1.139  
changed lines
  Added in v.1.140


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>