--- loncom/interface/loncoursegroups.pm 2006/07/07 17:11:04 1.41 +++ loncom/interface/loncoursegroups.pm 2006/07/07 19:34:20 1.43 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursegroups.pm,v 1.41 2006/07/07 17:11:04 albertel Exp $ +# $Id: loncoursegroups.pm,v 1.43 2006/07/07 19:34:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1182,7 +1182,7 @@ sub general_settings_form { $toolprivs,$fixedprivs,$sectioncount,$stored,$states,$navbuttons, $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype) = @_; my ($nexttext,$prevtext); - &groupsettings_options($r,$tabcol,$functions,$action,$formname,$stored,1, + &groupsettings_options($r,$functions,$action,$formname,$stored,1, $gpterm,$ucgpterm,$crstype); &access_date_settings($r,$action,$formname,$stored,2,$gpterm,$ucgpterm); if ($action eq 'create') { @@ -1209,7 +1209,7 @@ sub general_settings_form { } sub groupsettings_options { - my ($r,$tabcol,$functions,$action,$formname,$stored,$image,$gpterm, + my ($r,$functions,$action,$formname,$stored,$image,$gpterm, $ucgpterm,$crstype) = @_; my %lt = &Apache::lonlocal::texthash( 'gdat' => "$ucgpterm open and close dates", @@ -1225,9 +1225,9 @@ sub groupsettings_options { my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored); &topic_bar($r,$image,$lt{'gnde'}); $r->print(' - +
- + - + - + END my $numitems = keys(%{$functions}); my $halfnum = int($numitems/2); @@ -1280,7 +1280,7 @@ END - + - - - - - - - - - - - '); + $r->print(&Apache::lonhtmlcommon::start_pick_box('LC_group_priv_box'). + &Apache::lonhtmlcommon::row_title($lt{'func'},undef, + 'LC_groups_functionality')); + $r->print(join(''."\n"); - $r->print(&Apache::lonhtmlcommon::end_pick_box()); + $r->print(&Apache::lonhtmlcommon::row_title($lt{'fixp'},undef, + 'LC_groups_fixed'). + $fixed. + &Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::row_title($lt{'oppr'},undef, + 'LC_groups_optional'). + $dynamic. + &Apache::lonhtmlcommon::end_pick_box()); $r->print('
'); return; + } sub display_defprivs { @@ -2621,9 +2588,6 @@ sub member_privileges_form { my %total; if (keys(%{$usertools}) > 1) { $r->print(' - - -
'.$lt{'gnam'}.':'.$lt{'gnam'}.': '); if ($action eq 'create') { @@ -1240,13 +1240,13 @@ sub groupsettings_options {
$lt{'desc'}:$lt{'desc'}:
$lt{'func'}:$lt{'func'}:
'.&mt('Granularity:').''.&mt('Granularity:').' '.$lt{'doyo'}.'  '); if ($action eq 'modify') { $r->print('  ('.&mt('Currently set to "[_1]"', @@ -1290,7 +1290,7 @@ END
'.&mt('Disk quota: ').''); + '.&mt('Disk quota: ').''); if ($action eq 'create') { $r->print(&mt('If you enable the file repository for the [_1], allocate a disk quota.',$gpterm)); } else { @@ -1456,6 +1456,7 @@ sub choose_members_form { my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum,$gpterm, $ucgpterm,$crstype); if ($earlyout) { + $r->print($earlyout) &display_navbuttons($r,$formname,$$states{$action}[$page-1], $$navbuttons{'gtps'}); return; @@ -1507,6 +1508,7 @@ sub choose_members_form { sub display_navbuttons { my ($r,$formname,$prev,$prevtext,$next,$nexttext) = @_; + $r->print('
'); if ($prev) { $r->print(' '); } + $r->print('
'); } sub check_tools { @@ -1558,7 +1561,7 @@ sub print_current_settings { } if ($action eq 'create') { $r->print(' -
'.$lt{'ygrs'}.' +
'.$lt{'ygrs'}.'
'.$lt{'tfwa'}.'
'); } @@ -1670,9 +1673,6 @@ sub pick_new_members { &topic_bar($r,$img,$lt{'gpme'}); if (keys(%members) > 0) { $r->print(' -
  '); &check_uncheck_buttons($r,$formname,'member',$lt{'addm'}); @@ -1687,42 +1687,32 @@ sub pick_new_members { '); } $r->print('
-
 
  '); - $r->print(&Apache::lonhtmlcommon::start_pick_box()); + $r->print(&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row()); $r->print(' - - - - - - - - + '); + $r->print(''); } - $r->print(''); + $r->print(&Apache::loncommon::end_data_table_header_row()); if (@{$available} > 0) { if ($granularity eq 'Yes') { - $r->print(' + $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').' - '); + $r->print(''); } } my %Sortby = (); @@ -1741,27 +1731,22 @@ sub pick_new_members { push(@{$Sortby{$members{$user}[$$idx{fullname}]}},$user); } } - my $rowNum = 0; - my $rowColor; foreach my $key (sort(keys(%Sortby))) { foreach my $user (@{$Sortby{$key}}) { - if ($rowNum %2 == 1) { - $rowColor = $rowColor1; - } else { - $rowColor = $rowColor2; - } my $id = $members{$user}[$$idx{id}]; my $fullname = $members{$user}[$$idx{fullname}]; my $udom = $members{$user}[$$idx{udom}]; my $uname = $members{$user}[$$idx{uname}]; my $section = $members{$user}[$$idx{section}]; - $r->print(''. - ''); + $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense'). + ''. + ''. + ''. + ''. + ''. + ''); if (@{$available} > 0) { - $r->print(''); + $r->print(''); } - $r->print(''."\n"); - $rowNum ++; + $r->print(&Apache::loncommon::end_data_table_row()."\n"); } } - $r->print(&Apache::lonhtmlcommon::end_pick_box()); - $r->print(' - - '); + $r->print(&Apache::loncommon::end_data_table()); } else { - $r->print(' - - - - '); } return $newusers; } @@ -1897,8 +1870,8 @@ sub privilege_specificity { } else { $r->print($lt{'algm'}.'

'); } - &default_privileges($r,$action,$tabcol,$rowColor1,$rowColor2, - $tools,$toolprivs,$fixedprivs,$available); + &default_privileges($r,$action,$tools,$toolprivs,$fixedprivs, + $available); } else { if ($action eq 'create') { $r->print($lt{'asyo'}); @@ -1922,76 +1895,70 @@ sub privilege_specificity { } sub default_privileges { - my ($r,$action,$tabcol,$rowColor1,$rowColor2,$tools,$toolprivs, - $fixedprivs,$available) = @_; + my ($r,$action,$tools,$toolprivs,$fixedprivs,$available) = @_; my %lt = &Apache::lonlocal::texthash( 'addp' => 'Additional privileges', 'fixp' => 'Fixed privileges', 'oppr' => 'Optional privileges', 'func' => 'Function', ); - $r->print(&Apache::loncommon::start_data_table(). - &Apache::loncommon::start_data_table_header_row()); - $r->print(' - - - - - - - -
'.&mt('Add?').''.&mt('Name').''.&mt('Username').' - '.&mt('Domain').'IDSection'.&mt('Add?').' + '.&mt('Name').' + '.&mt('Username').' + '.&mt('Domain').' + '.&mt('ID').' + '.&mt('Section').' '); if (@{$available} > 0) { - $r->print(''.$lt{'func'}.''.$lt{'func'}.'
 '.&mt('All:').' '); + '.&mt('All:').' '); foreach my $tool (@{$available}) { $r->print('   '); } - $r->print('
- '. - $fullname.''.$uname.''. - $udom.''.$id.''.$section.''.$fullname.''.$uname.''.$udom.''.$id.''.$section.''. + $r->print(''. '       '); foreach my $tool (@{$available}) { if ($granularity eq 'Yes') { @@ -1772,30 +1757,18 @@ sub pick_new_members { $tool.'" value="'.$user.'" />'.$tool.'   '); } } - $r->print('
  -'); if ($totalusers > 0) { $r->print($lt{'nnew'}.'

'.$lt{'yoma'}); } else { $r->print($lt{'nome'}); } - $r->print(' -
'.$lt{'func'}.'
'.$lt{'fixp'}.'
'.$lt{'oppr'}.'
-
',@{$tools})); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + my $fixed = ''; + my $dynamic = ''; foreach my $tool (@{$tools}) { - $r->print(' - - - - - '); my $privcount = 0; - my $fixed = ''; - my $dynamic = ''; + if ($dynamic ne '') { + $dynamic .= ' - '); + $dynamic .= '
'.$tool.'
'; + } + $dynamic .= ''; foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { if (exists($$fixedprivs{$tool}{$priv})) { + if ($fixed ne '') { + $fixed .= ' - '."\n"; + '."\n"; } $dynamic .= ''."\n"; } } - if ($dynamic eq '') { - $dynamic = ''."\n"; + if ($privcount == 0) { + $dynamic .= ''."\n"; } if ($privcount < 3) { - $dynamic .= ' - - '."\n"; + $dynamic .= ' + '."\n"; } elsif ($privcount%2) { $dynamic = ''."\n"; } - $r->print(' - - - '."\n".$dynamic.''."\n".'
'; + } $fixed .= ''.$$toolprivs{$tool}{$priv}.' '; if ($action eq 'modify') { - if (grep/^$tool$/,@{$available}) { + if (grep(/^$tool$/,@{$available})) { $fixed .= ''.&mt('(on)').' '; } else { $fixed .= ''.&mt('(off)').' '; } } } else { - $privcount ++; + $privcount++; if ($privcount == 3) { $dynamic .= '
NoneNone
   
'.$fixed.'
'."\n".'
'; } - $r->print('
  '); @@ -2688,30 +2652,22 @@ END \@excluded); $r->print(''); $r->print(&Apache::lonhtmlcommon::end_pick_box()); - $r->print(' - - - -'); } else { - $r->print('
 
 '.$lt{'forf'}. - '
'); + $r->print($lt{'forf'}.'
'); &display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, $toolprivs,\@defprivs); } } else { if (keys(%{$usertools}) > 0) { - $r->print('
 '.$lt{'algr'}. - '

'); + $r->print($lt{'algr'}.'

'); &display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools, $toolprivs,\@defprivs); } else { - $r->print('
 '.$lt{'asno'}. - '
'); + $r->print($lt{'asno'}.'
'); } } } else { - $r->print('
 '.$lt{'asng'}); + $r->print($lt{'asng'}); } return $numchgs; } @@ -3396,11 +3352,11 @@ sub date_setting_table { my $perpetual = ''; - my $table = "\n". - ''. + my $table = "
'.&mt('Start:').'
\n". + ''. ''. ''."\n". - ''. + ''. ''. ''."\n". "
'.&mt('Start:').''.$startform.' 
'.&mt('End:').'
'.&mt('End:').''.$endform.''.$perpetual.'
\n"; @@ -3635,8 +3591,8 @@ sub validate_groupname { "existing $gpterm", ); - my $exitmsg = ''.$lt{'igna'}.'

'.$lt{'tgne'}.' "'. - $groupname.'" '; + my $exitmsg = ''.$lt{'igna'}.'

'. + $lt{'tgne'}.' "'.$groupname.'" '; my $dupmsg = $lt{'grna'}; my $earlyout; if (($groupname eq '') || ($groupname =~ /\W/)) {