--- loncom/interface/loncoursegroups.pm 2006/07/07 19:17:19 1.42
+++ loncom/interface/loncoursegroups.pm 2006/07/07 19:50:21 1.44
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursegroups.pm,v 1.42 2006/07/07 19:17:19 albertel Exp $
+# $Id: loncoursegroups.pm,v 1.44 2006/07/07 19:50:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1197,9 +1197,9 @@ sub general_settings_form {
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action,
3,$tools,$stored,$toolprivs,$fixedprivs,
\@available,$formname,$gpterm,$ucgpterm);
- &mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount,
- $states,$stored,$navbuttons,4,5,$rowColor1,
- $rowColor2,$gpterm,$ucgpterm,$crstype);
+ &mapping_options($r,$action,$formname,$page,$sectioncount,
+ $states,$stored,$navbuttons,4,5,
+ $gpterm,$ucgpterm,$crstype);
$nexttext = $$navbuttons{'mose'};
}
$prevtext = $$navbuttons{'gtpp'};
@@ -1491,10 +1491,10 @@ sub choose_members_form {
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action,
$specimg,$tools,$stored,$toolprivs,
$fixedprivs,\@available,$formname,$gpterm,$ucgpterm);
- my $newusers = &pick_new_members($r,$action,$formname,$tabcol,$rowColor1,
- $rowColor2,\@available,$idx,$stored,
- $memimg,$users,$userdata,$granularity,
- \%origmembers,$gpterm,$ucgpterm);
+ my $newusers = &pick_new_members($r,$action,$formname,\@available,$idx,
+ $stored,$memimg,$users,$userdata,
+ $granularity,\%origmembers,$gpterm,
+ $ucgpterm);
if ($newusers || $action eq 'create') {
&display_navbuttons($r,$formname,$$states{$action}[$page-1],
$$navbuttons{'gtps'},$$states{$action}[$page+1],
@@ -1632,9 +1632,8 @@ END
}
sub pick_new_members {
- my ($r,$action,$formname,$tabcol,$rowColor1,$rowColor2,$available,$idx,
- $stored,$img,$users,$userdata,$granularity,$origmembers,$gpterm,
- $ucgpterm) = @_;
+ my ($r,$action,$formname,$available,$idx,$stored,$img,$users,$userdata,
+ $granularity,$origmembers,$gpterm,$ucgpterm) = @_;
my %lt = &Apache::lonlocal::texthash(
'gpme' => "$ucgpterm membership",
'addm' => 'Add members',
@@ -1688,33 +1687,31 @@ sub pick_new_members {
}
$r->print('
');
- $r->print(&Apache::loncommon::start_data_table());
+ $r->print(&Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row());
$r->print('
-
-
- '.&mt('Add?').'
- '.&mt('Name').'
- '.&mt('Username').'
-
- '.&mt('Domain').'
- ID
- Section
+ '.&mt('Add?').'
+ '.&mt('Name').'
+ '.&mt('Username').'
+ '.&mt('Domain').'
+ '.&mt('ID').'
+ '.&mt('Section').'
');
if (@{$available} > 0) {
- $r->print(''.$lt{'func'}.' ');
+ $r->print(''.$lt{'func'}.' ');
}
- $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').'
- '.&mt('All:').' ');
+ '.&mt('All:').' ');
foreach my $tool (@{$available}) {
$r->print(' '.''.$tool.' ');
}
- $r->print(' ');
+ $r->print('');
}
}
my %Sortby = ();
@@ -1733,27 +1730,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('
- '.
- $fullname.' '.$uname.' '.
- $udom.' '.$id.' '.
- ''.$section.' ');
+ $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').
+ ' '.
+ ''.$fullname.' '.
+ ''.$uname.' '.
+ ''.$udom.' '.
+ ''.$id.' '.
+ ''.$section.' ');
if (@{$available} > 0) {
- $r->print(''.
+ $r->print(''.
' ');
foreach my $tool (@{$available}) {
if ($granularity eq 'Yes') {
@@ -1764,13 +1756,12 @@ sub pick_new_members {
$tool.'" value="'.$user.'" />'.$tool.' ');
}
}
- $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(&Apache::loncommon::end_data_table());
} else {
if ($totalusers > 0) {
$r->print($lt{'nnew'}.' '.$lt{'yoma'});
@@ -2446,9 +2437,9 @@ sub choose_privs_form {
if (keys(%{$sectioncount}) > 0) {
my $img1 = 7;
my $img2 = 8;
- &mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount,
+ &mapping_options($r,$action,$formname,$page,$sectioncount,
$states,$stored,$navbuttons,$img1,$img2,
- $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype);
+ $gpterm,$ucgpterm,$crstype);
}
}
my $prevtext = $$navbuttons{'gtps'};
@@ -2596,9 +2587,6 @@ sub member_privileges_form {
my %total;
if (keys(%{$usertools}) > 1) {
$r->print('
-
-
-
');
@@ -2663,30 +2651,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;
}
@@ -3089,9 +3069,8 @@ sub process_membership {
}
sub mapping_options {
- my ($r,$action,$formname,$page,$tabcol,$sectioncount,$states,$stored,
- $navbuttons,$img1,$img2,$rowColor1,$rowColor2,$gpterm,$ucgpterm,
- $crstype) = @_;
+ my ($r,$action,$formname,$page,$sectioncount,$states,$stored,
+ $navbuttons,$img1,$img2,$gpterm,$ucgpterm,$crstype) = @_;
my %lt = &Apache::lonlocal::texthash(
'auto' => "Settings for automatic $gpterm enrollment",
'gmma' => "$ucgpterm membership mapping to specific sections/roles",
@@ -3107,18 +3086,17 @@ sub mapping_options {
'auex' => "Automatically expire $gpterm membership when roles are removed?",
'mapr' => "Mapping of roles and sections affected by automatic $gpterm enrollment/disenrollment follows scheme chosen below.",
);
- &automapping($r,$action,$tabcol,$stored,\%lt,$img1);
+ &automapping($r,$action,$stored,\%lt,$img1);
$r->print('
');
- &mapping_settings($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,\%lt,
- $stored,$img2,$crstype);
+ &mapping_settings($r,$sectioncount,\%lt,$stored,$img2,$crstype);
return;
}
sub automapping {
- my ($r,$action,$tabcol,$stored,$lt,$image) = @_;
+ my ($r,$action,$stored,$lt,$image) = @_;
my $add = 'off';
my $drop = 'off';
if (exists($$stored{'autoadd'})) {
@@ -3129,52 +3107,24 @@ sub automapping {
}
&topic_bar($r,$image,$$lt{'endi'});
$r->print('
-
-
-
- '.$$lt{'gmma'}.': '.$$lt{'adds'}.' '.$$lt{'drops'}.'
-
-
-
-
-
-
-
-
+ '.$$lt{'gmma'}.': '.$$lt{'adds'}.' '.$$lt{'drops'}.'
'.$$lt{'auad'}.':
on off ');
if ($action eq 'modify') {
$r->print(' ('.$$lt{'curr'}.' '.$$lt{$add}.' )');
}
$r->print('
-
-
-
-
-
-
+
'.$$lt{'auex'}.':
on off ');
if ($action eq 'modify') {
$r->print(' ('.$$lt{'curr'}.' '.$$lt{$drop}.' )');
}
- $r->print('
-
-
-
-
-
-
-
- '.$$lt{'mapr'}.'
-
-
-');
+ $r->print(' '.$$lt{'mapr'});
}
sub mapping_settings {
- my ($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,$lt,$stored,$image,
- $crstype) = @_;
+ my ($r,$sectioncount,$lt,$stored,$image,$crstype) = @_;
my @sections = keys(%{$sectioncount});
if (@sections > 0) {
@sections = sort {$a cmp $b} @sections;
@@ -3182,23 +3132,17 @@ sub mapping_settings {
unshift(@sections,'all'); # Put 'all' at the front of the list
}
&topic_bar($r,$image,$$lt{'pirs'});
- $r->print('
-
-
-
-');
my @roles = &standard_roles();
my %customroles = &my_custom_roles();
- $r->print(&Apache::lonhtmlcommon::start_pick_box());
+ $r->print(&Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row());
$r->print('
-
'.&mt('Active?').'
'.&mt('Role').' ');
if (@sections > 0) {
- $r->print(''.&mt('Sections').' '."\n");
+ $r->print(''.&mt('Sections').' ');
}
- my $rowNum = 0;
- my $rowColor;
+ $r->print(&Apache::loncommon::end_data_table_header_row()."\n");
foreach my $role (@roles) {
my $plrole=&Apache::lonnet::plaintext($role,$crstype);
my $sections_sel;
@@ -3213,33 +3157,25 @@ sub mapping_settings {
'';
}
}
- if ($rowNum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $r->print(' print(&Apache::loncommon::start_data_table_row().
+ ''.$plrole.
- ' '.$sections_sel.' ');
- $rowNum ++;
+ ''.$sections_sel.
+ &Apache::loncommon::end_data_table_row());
}
foreach my $role (sort(keys(%customroles))) {
my $sections_sel;
if (@sections > 0) {
- $sections_sel = ''.§ions_selection(\@sections,'sec_'.$role).
- ' ';
+ $sections_sel =
+ ''.§ions_selection(\@sections,'sec_'.$role).' ';
}
- if ($rowNum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $r->print(' print(&Apache::loncommon::start_data_table_row().
+ ''.$role.' '.
- $sections_sel.' ');
- $rowNum ++;
+ $sections_sel.
+ &Apache::loncommon::end_data_table_row());
}
- $r->print(&Apache::lonhtmlcommon::end_pick_box());
+ $r->print(&Apache::loncommon::end_data_table());
return;
}