--- loncom/interface/lonuserutils.pm 2013/02/05 16:22:27 1.148 +++ loncom/interface/lonuserutils.pm 2013/02/19 17:30:35 1.149 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.148 2013/02/05 16:22:27 bisitz Exp $ +# $Id: lonuserutils.pm,v 1.149 2013/02/19 17:30:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -237,6 +237,8 @@ sub domain_roles_select { # Role types my @roletypes = ('domain','author','course','community'); my %lt = &role_type_names(); + my $onchangefirst = "updateCols('showrole')"; + my $onchangesecond = "updateCols('showrole')"; # # build up the menu information to be passed to # &Apache::loncommon::linked_select_forms @@ -283,7 +285,8 @@ sub domain_roles_select { my $result = &Apache::loncommon::linked_select_forms ('studentform',(' 'x3).&mt('Role: '),$env{'form.roletype'}, 'roletype','showrole',\%select_menus, - ['domain','author','course','community']); + ['domain','author','course','community'],$onchangefirst, + $onchangesecond); return $result; } @@ -1527,20 +1530,22 @@ sub print_userlist { } $r->print('
'. &column_checkboxes($context,$mode,$formname). - '

'); + ''); if ($env{'form.phase'} eq '') { - $r->print(&list_submit_button(&mt('Display List of Users'))."\n". + $r->print('
'. + &list_submit_button(&mt('Display List of Users'))."\n". ''); return; } if (!(($context eq 'domain') && (($env{'form.roletype'} eq 'course') || ($env{'form.roletype'} eq 'community')))) { - $r->print(&list_submit_button(&mt('Update Display'))."\n"); + $r->print('
'. + &list_submit_button(&mt('Update Display'))."\n"); } my @cols = &infocolumns($context,$mode); if (!@cols) { - $r->print('
'. + $r->print('
'. &mt('No user information selected for display.').''. ''."\n"); return; @@ -1583,7 +1588,7 @@ sub print_userlist { $r->print('
'.&mt('Searching ...').'
 
'); } } else { - $r->print('
'.&mt('Searching ...').'
'); + $r->print('
'.&mt('Searching ...').'
'); } $r->rflush(); if ($context eq 'course') { @@ -1880,9 +1885,6 @@ sub get_cols_array { 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'); } @@ -1897,6 +1899,9 @@ sub get_cols_array { ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'})) { push(@cols,'photos'); } + if ($context eq 'domain') { + push (@cols,'extent'); + } } return @cols; } @@ -1911,8 +1916,10 @@ sub column_checkboxes { if ($context eq 'course') { $disabledchk{'role'} = 1; $unchecked{'photo'} = 1; + $unchecked{'clicker'} = 1; + } elsif ($context eq 'domain') { + $unchecked{'extent'} = 1; } - $unchecked{'clicker'} = 1; $unchecked{'start'} = 1; $unchecked{'end'} = 1; } else { @@ -1922,9 +1929,17 @@ sub column_checkboxes { if (($env{'form.showrole'} ne 'Any') && ($env{'form.showrole'} ne 'cr')) { $disabledchk{'role'} = 1; } + if ($context eq 'domain') { + if (($env{'form.roletype'} eq 'course') || + ($env{'form.roletype'} eq 'community')) { + $disabledchk{'status'} = 1; + } elsif ($env{'form.roletype'} eq 'domain') { + $disabledchk{'extent'} = 1; + } + } } my $numposs = scalar(@cols); - my $numinrow = 8; + my $numinrow = 7; my %lt = &get_column_names($context); my $output = '
'.&mt('Information to show').''."\n".''. ''. @@ -1964,9 +1979,16 @@ sub column_checkboxes { } else { $output .= ''; } - $output .= ''; - + my $style; + if ($cols[$i] eq 'extent') { + if (($env{'form.roletype'} eq 'domain') || ($env{'form.roletype'} eq '')) { + $style = ' style="display: none;"'; + } + } + $output .= ''; } $output .= '
'; return $output; @@ -2000,11 +2022,12 @@ sub get_column_names { 'clicker' => "clicker-ID", ); if ($context eq 'domain' && $env{'form.roletype'} eq 'course') { - $lt{'extent'} = &mt('Course(s): description, section(s), status'); + $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'); + $lt{'extent'} = &mt('communities: description, section(s), status'); + } elsif (($context eq 'author') || + ($context eq 'domain' && $env{'form.roletype'} eq 'author')) { + $lt{'extent'} = &mt('author'); } return %lt; } @@ -2935,7 +2958,7 @@ END } else { $r->print(' '."\n"); } - } + } } else { $r->print(''.$in{$item}.''."\n"); } @@ -3429,7 +3452,7 @@ sub section_picker { ''."\n". ''."\n"; } else { - $secbox .= ''. $env{'request.course.sec'}; } @@ -3989,7 +4012,7 @@ sub upfile_drop_add { } elsif ($setting eq 'course') { $defaultrole = $env{'form.courserole'}; $defaultsec = $env{'form.sections'}; - } + } } elsif ($context eq 'author') { $defaultrole = $env{'form.defaultrole'}; } elsif ($context eq 'course') {