[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm loncoursegroups.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 07 Jul 2006 20:31:15 -0000
This is a MIME encoded message
--albertel1152304275
Content-Type: text/plain
albertel Fri Jul 7 16:31:15 2006 EDT
Modified files:
/loncom/interface loncommon.pm loncoursegroups.pm
Log:
- membership privlideges selector css
- elminate alot of rwocolor and tab color passing
--albertel1152304275
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060707163115.txt"
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.425 loncom/interface/loncommon.pm:1.426
--- loncom/interface/loncommon.pm:1.425 Fri Jul 7 15:34:20 2006
+++ loncom/interface/loncommon.pm Fri Jul 7 16:31:08 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.425 2006/07/07 19:34:20 albertel Exp $
+# $Id: loncommon.pm,v 1.426 2006/07/07 20:31:08 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3125,7 +3125,9 @@
h1, h2, h3, th { font-family: $sans }
a:focus { color: red; background: yellow }
table.thinborder { border-collapse: collapse; }
-table.thinborder tr th, table.thinborder tr td { border-style: solid; border-width: 1px}
+table.thinborder tr th { border-style: solid; border-width: 1px; background: $tabbg;}
+table.thinborder tr td { border-style: solid; border-width: 1px}
+
form, .inline { display: inline; }
.center { text-align: center; }
.LC_filename {font-family: $mono;}
@@ -3265,6 +3267,7 @@
table.LC_data_table, table.LC_mail_list {
border: 1px solid #000000;
border-collapse: separate;
+ border-spacing: 1px;
}
.LC_data_table_dense {
font-size: small;
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.44 loncom/interface/loncoursegroups.pm:1.45
--- loncom/interface/loncoursegroups.pm:1.44 Fri Jul 7 15:50:21 2006
+++ loncom/interface/loncoursegroups.pm Fri Jul 7 16:31:09 2006
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursegroups.pm,v 1.44 2006/07/07 19:50:21 albertel Exp $
+# $Id: loncoursegroups.pm,v 1.45 2006/07/07 20:31:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -103,7 +103,7 @@
}
if ($action eq 'create' || $action eq 'modify' || $action eq 'view') {
if ($view_permission || $manage_permission) {
- &group_administration($r,$action,$state,$cdom,$cnum,$function,
+ &group_administration($r,$action,$state,$cdom,$cnum,
$tabcol,\%functions,\%idx,$view_permission,
$manage_permission,$rowColor1,$rowColor2,
$gpterm,$ucgpterm,$crstype);
@@ -348,7 +348,7 @@
}
sub group_administration {
- my ($r,$action,$state,$cdom,$cnum,$function,$tabcol,$functions,$idx,
+ my ($r,$action,$state,$cdom,$cnum,$tabcol,$functions,$idx,
$view_permission,$manage_permission,$rowColor1,$rowColor2,$gpterm,
$ucgpterm,$crstype) = @_;
my %sectioncount = ();
@@ -869,7 +869,7 @@
\%sectioncount,$groupname,$description,$functions,
\@tools,$toolprivs,$fixedprivs,$startdate,$enddate,
\%users,\%userdata,$idx,\%memchg,\%usertools,
- $function,$view_permission,$manage_permission,
+ $view_permission,$manage_permission,
\%stored,$granularity,$quota,$specificity,\@types,\@roles,
\@sections,\%states,\%navbuttons,$rowColor1,$rowColor2,
$gpterm,$ucgpterm,$crstype);
@@ -962,7 +962,7 @@
sub display_control {
my ($r,$cdom,$cnum,$tabcol,$action,$state,$page,$sectioncount,$groupname,
$description,$functions,$tools,$toolprivs,$fixedprivs,$startdate,
- $enddate,$users,$userdata,$idx,$memchg,$usertools,$function,
+ $enddate,$users,$userdata,$idx,$memchg,$usertools,
$view_permission,$manage_permission,$stored,$granularity,$quota,
$specificity,$types,$roles,$sections,$states,$navbuttons,$rowColor1,
$rowColor2,$gpterm,$ucgpterm,$crstype) = @_;
@@ -981,20 +981,18 @@
$stored,$states,$navbuttons,$rowColor1,
$rowColor2,$gpterm,$ucgpterm,$crstype);
} elsif ($state eq 'pick_privs') {
- &choose_privs_form($r,$cdom,$cnum,$tabcol,$action,$state,$page,
+ &choose_privs_form($r,$cdom,$cnum,$action,$state,$page,
$startdate,$enddate,$tools,$functions,
$toolprivs,$fixedprivs,$userdata,$usertools,
$idx,$states,$stored,$sectioncount,$navbuttons,
- $rowColor1,$rowColor2,$gpterm,$ucgpterm,
- $crstype);
+ $gpterm,$ucgpterm,$crstype);
} elsif ($state eq 'result') {
- &process_request($r,$cdom,$cnum,$tabcol,$action,$state,$page,
+ &process_request($r,$cdom,$cnum,$action,$state,$page,
$groupname,$description,$specificity,$userdata,
$startdate,$enddate,$tools,$functions,
$toolprivs,$usertools,$idx,$types,$roles,
$sections,$states,$navbuttons,$memchg,
- $sectioncount,$stored,$rowColor1,$rowColor2,
- $gpterm,$ucgpterm,$crstype);
+ $sectioncount,$stored,$gpterm,$ucgpterm,$crstype);
}
} elsif ($action eq 'modify') {
my $groupname = $env{'form.groupname'};
@@ -1037,21 +1035,19 @@
$idx,$states,$stored,$sectioncount,$navbuttons,
$rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype);
} elsif ($state eq 'change_privs') {
- &change_privs_form($r,$cdom,$cnum,$tabcol,$action,$state,$page,
+ &change_privs_form($r,$cdom,$cnum,$action,$state,$page,
$startdate,$enddate,$tools,$functions,
$toolprivs,$fixedprivs,$userdata,$usertools,
$memchg,$idx,$states,$stored,$sectioncount,
- $navbuttons,$rowColor1,$rowColor2,$gpterm,
- $ucgpterm);
+ $navbuttons,$gpterm,$ucgpterm);
} elsif ($state eq 'chgresult' || $state eq 'memresult' ||
$state eq 'addresult') {
- &process_request($r,$cdom,$cnum,$tabcol,$action,$state,$page,
+ &process_request($r,$cdom,$cnum,$action,$state,$page,
$groupname,$description,$specificity,$userdata,
$startdate,$enddate,$tools,$functions,
$toolprivs,$usertools,$idx,$types,$roles,
$sections,$states,$navbuttons,$memchg,
- $sectioncount,$stored,$rowColor1,$rowColor2,
- $gpterm,$ucgpterm,$crstype);
+ $sectioncount,$stored,$gpterm,$ucgpterm,$crstype);
}
}
}
@@ -1886,8 +1882,7 @@
$r->print($lt{'sall'});
}
$r->print(' '.$lt{'defp'}.'<br /><br />');
- &display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools,
- $toolprivs,\@defprivs);
+ &display_defprivs($r,$tools,$toolprivs,\@defprivs);
}
}
return;
@@ -1961,7 +1956,11 @@
}
sub display_defprivs {
- my ($r,$tabcol,$rowColor1,$rowColor2,$tools,$toolprivs,$defprivs) = @_;
+ my ($r,$tools,$toolprivs,$defprivs) = @_;
+ my $function = &Apache::loncommon::get_users_function();
+ my $tabcol = &Apache::loncommon::designparm($function.'.tabbg');
+ my $rowColor1 = "#dddddd";
+ my $rowColor2 = "#eeeeee";
my %lt = &Apache::lonlocal::texthash(
'priv' => 'Privileges',
'func' => 'Function',
@@ -1974,7 +1973,7 @@
@{$currprivs{$tool}} = ();
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) {
if (ref($defprivs) eq 'ARRAY') {
- if (grep/^\Q$priv\E$/,@{$defprivs}) {
+ if (grep(/^\Q$priv\E$/,@{$defprivs})) {
push(@{$currprivs{$tool}},$priv);
}
}
@@ -2051,32 +2050,17 @@
my $prevtext = $$navbuttons{'gtpp'};
$r->print('
<br />
-<table width="100%" cellpadding="0" cellspacing="0" border="0">
');
&topic_bar($r,1,$lt{'grse'});
- $r->print('
- <tr>
- <td> </td>
- <td colspan="3">
-');
&print_current_settings($r,$action,$functions,$startdate,$enddate,
$groupname,$description,$granularity,$quota,
\@available,\@unavailable,$gpterm,$ucgpterm);
-$r->print('
-</td></tr><tr><td colspan="4"> </td></tr>');
&topic_bar($r,2,$lt{'mogm'});
- $r->print('
- <tr>
- <td> </td>
- <td colspan="3">
-');
¤t_membership($r,$cdom,$cnum,$formname,$tabcol,$rowColor1,
$rowColor2,$groupname,\@available,\@unavailable,
$fixedprivs,$granularity,$specificity);
- $r->print('</td>');
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,
$$states{$action}[$page+1],$nexttext);
- $r->print('</table>');
return;
}
@@ -2318,10 +2302,10 @@
sub change_privs_form {
- my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$startdate,$enddate,
- $tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools,
- $memchg,$idx,$states,$stored,$sectioncount,$navbuttons,$rowColor1,
- $rowColor2,$gpterm,$ucgpterm) = @_;
+ my ($r,$cdom,$cnum,$action,$formname,$page,$startdate,$enddate,
+ $tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools,
+ $memchg,$idx,$states,$stored,$sectioncount,$navbuttons,$gpterm,
+ $ucgpterm) = @_;
my @regexps = ('userpriv_');
my $nexttext;
my %lt = &Apache::lonlocal::texthash(
@@ -2336,7 +2320,6 @@
} else {
$nexttext = $$navbuttons{'mose'};
}
- $r->print('<br /><table width="100%" cellpadding="0" cellspacing="0" border="0">');
&topic_bar($r,3,&mt('Members to delete or expire'));
my $exp_or_del = 0;
if (ref($$memchg{'deletion'}) eq 'ARRAY') {
@@ -2346,7 +2329,7 @@
$r->print('<li>'.$$userdata{$user}[$$idx{fullname}].
' ('.$user.')</li>');
}
- $r->print('</ul></td><tr><td colspan="4"> </td></tr>');
+ $r->print('</ul>');
$exp_or_del += @{$$memchg{'deletion'}};
}
}
@@ -2357,23 +2340,20 @@
$r->print('<li>'.$$userdata{$user}[$$idx{fullname}].
' ('.$user.')</li>');
}
- $r->print('</ul></td><tr><td colspan="4"> </td></tr>');
+ $r->print('</ul>');
$exp_or_del += @{$$memchg{'expire'}};
}
}
if (!$exp_or_del) {
- $r->print('<tr><td> </td><td colspan="3">'.$lt{'nome'}.
- '</td></tr><tr><td colspan="4"> </td></tr>');
+ $r->print($lt{'nome'}.'<br />');
}
&topic_bar($r,4,&mt('[_1] member privileges',$ucgpterm));
- my $numchgs = &member_privileges_form($r,$tabcol,$action,$formname,$tools,
+ my $numchgs = &member_privileges_form($r,$action,$formname,$tools,
$toolprivs,$fixedprivs,$userdata,
$usertools,$idx,$memchg,$states,
- $stored,$rowColor1,$rowColor2,
- $gpterm);
- $r->print('</td></tr><tr><td colspan="4"> </td></tr>');
+ $stored,$gpterm);
my $prevtext = $$navbuttons{'gtps'};
if ($numchgs || $exp_or_del) {
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,
@@ -2381,7 +2361,6 @@
} else {
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext);
}
- $r->print('</table>');
return;
}
@@ -2405,10 +2384,10 @@
}
sub choose_privs_form {
- my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$startdate,$enddate,
- $tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools,$idx,
- $states,$stored,$sectioncount,$navbuttons,$rowColor1,$rowColor2,
- $gpterm,$ucgpterm,$crstype) = @_;
+ my ($r,$cdom,$cnum,$action,$formname,$page,$startdate,$enddate,
+ $tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools,$idx,
+ $states,$stored,$sectioncount,$navbuttons,$gpterm,$ucgpterm,
+ $crstype) = @_;
my @regexps = ('userpriv_');
my $nexttext;
@@ -2425,14 +2404,12 @@
$nexttext = $$navbuttons{'adme'};
}
- $r->print('<br /><table width="100%" cellpadding="0" cellspacing="0" border="0">');
&topic_bar($r,6,&mt('[_1] member privileges',$ucgpterm));
- &member_privileges_form($r,$tabcol,$action,$formname,$tools,$toolprivs,
+ &member_privileges_form($r,$action,$formname,$tools,$toolprivs,
$fixedprivs,$userdata,$usertools,$idx,undef,
- $states,$stored,$rowColor1,$rowColor2,$gpterm);
+ $states,$stored,$gpterm);
- $r->print('</td></tr><tr><td colspan="4"> </td></tr>');
if ($action eq 'create') {
if (keys(%{$sectioncount}) > 0) {
my $img1 = 7;
@@ -2445,7 +2422,6 @@
my $prevtext = $$navbuttons{'gtps'};
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,
$$states{$action}[$page+1],$nexttext);
- $r->print('</table>');
return;
}
@@ -2508,9 +2484,8 @@
}
sub member_privileges_form {
- my ($r,$tabcol,$action,$formname,$tools,$toolprivs,$fixedprivs,$userdata,
- $usertools,$idx,$memchg,$states,$stored,$rowColor1,$rowColor2,
- $gpterm) = @_;
+ my ($r,$action,$formname,$tools,$toolprivs,$fixedprivs,$userdata,
+ $usertools,$idx,$memchg,$states,$stored,$gpterm) = @_;
my %lt = &Apache::lonlocal::texthash(
'addp' => 'Additional privileges',
'fixp' => 'Fixed privileges',
@@ -2571,7 +2546,7 @@
}
$numchgs = @currmembers;
if (!$numchgs) {
- $r->print('<tr><td> </td><td colspan="3">'.$lt{'nogm'});
+ $r->print($lt{'nogm'});
return $numchgs;
}
}
@@ -2587,14 +2562,14 @@
my %total;
if (keys(%{$usertools}) > 1) {
$r->print('
- <table border="0" cellspacing="2" cellpadding="2" border="0">
+ <table border="0" cellspacing="2" cellpadding="2">
<tr>
');
foreach my $tool (@{$tools}) {
if (@{$showboxes{$tool}} > 0) {
$r->print('<td valign="top">');
- $r->print('<table class="thinborder"><tr bgcolor="'.
- $tabcol.'"><th colspan="'.$colspan.'">'.
+ $r->print('<table class="thinborder"><tr>'.
+ '<th colspan="'.$colspan.'">'.
$tool.'</th></tr><tr>');
my $privcount = 0;
foreach my $priv (@{$showboxes{$tool}}) {
@@ -2632,35 +2607,29 @@
$r->print('</tr></table></td><td> </td>');
}
}
- $r->print('</tr></table></td></tr>');
- $r->print('<tr><td colspan="4"> </td></tr>');
+ $r->print('</tr></table>');
}
- $r->print('<tr><td> </td><td colspan="3">');
- $r->print(&Apache::lonhtmlcommon::start_pick_box());
+ $r->print(&Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row());
$r->print(<<"END");
- <tr bgcolor="$tabcol">
- <th><b>$lt{'full'}</th>
- <th><b>$lt{'user'}</th>
+ <th>$lt{'full'}</th>
+ <th>$lt{'user'}</th>
<th>$lt{'doma'}</th>
<th colspan="$numtools">$lt{'addp'}</th>
- </tr>
END
- &member_privs_entries($r,$tabcol,$rowColor1,$rowColor2,
- $usertools,$toolprivs,$fixedprivs,
+ $r->print(&Apache::loncommon::end_data_table_header_row());
+ &member_privs_entries($r,$usertools,$toolprivs,$fixedprivs,
$userdata,$idx,\@showtools,\@defprivs,
\@excluded);
- $r->print('</td>');
- $r->print(&Apache::lonhtmlcommon::end_pick_box());
+ $r->print(&Apache::loncommon::end_data_table());
} else {
$r->print($lt{'forf'}.'<br />');
- &display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools,
- $toolprivs,\@defprivs);
+ &display_defprivs($r,$tools,$toolprivs,\@defprivs);
}
} else {
if (keys(%{$usertools}) > 0) {
$r->print($lt{'algr'}.'<br /><br />');
- &display_defprivs($r,$tabcol,$rowColor1,$rowColor2,$tools,
- $toolprivs,\@defprivs);
+ &display_defprivs($r,$tools,$toolprivs,\@defprivs);
} else {
$r->print($lt{'asno'}.'<br />');
}
@@ -2672,11 +2641,10 @@
}
sub process_request {
- my ($r,$cdom,$cnum,$tabcol,$action,$state,$page,$groupname,$description,
+ my ($r,$cdom,$cnum,$action,$state,$page,$groupname,$description,
$specificity,$userdata,$startdate,$enddate,$tools,$functions,$toolprivs,
$usertools,$idx,$types,$roles,$sections,$states,$navbuttons,$memchg,
- $sectioncount,$stored,$rowColor1,$rowColor2,$gpterm,$ucgpterm,
- $crstype) = @_;
+ $sectioncount,$stored,$gpterm,$ucgpterm,$crstype) = @_;
$r->print(&Apache::lonhtmlcommon::echo_form_input(
['origin','action','state','page','sortby']));
@@ -3087,10 +3055,6 @@
'mapr' => "Mapping of roles and sections affected by automatic $gpterm enrollment/disenrollment follows scheme chosen below.",
);
&automapping($r,$action,$stored,\%lt,$img1);
- $r->print('
- <tr>
- <td colspan="4"> </td>
- </tr>');
&mapping_settings($r,$sectioncount,\%lt,$stored,$img2,$crstype);
return;
}
@@ -3159,7 +3123,7 @@
}
$r->print(&Apache::loncommon::start_data_table_row().
'<td><input type="checkbox" '.
- 'name="autorole" value="'.$role.'"></td><td>'.$plrole.
+ 'name="autorole" value="'.$role.'" /></td><td>'.$plrole.
'</td>'.$sections_sel.
&Apache::loncommon::end_data_table_row());
}
@@ -3171,7 +3135,7 @@
}
$r->print(&Apache::loncommon::start_data_table_row().
'<td><input type="checkbox" '.
- 'value="'.$role.'"></td><td>'.$role.'</td>'.
+ 'value="'.$role.'" /></td><td>'.$role.'</td>'.
$sections_sel.
&Apache::loncommon::end_data_table_row());
}
@@ -3232,10 +3196,8 @@
}
sub member_privs_entries {
- my ($r,$tabcol,$rowColor1,$rowColor2,$usertools,$toolprivs,
- $fixedprivs,$userdata,$idx,$showtools,$defprivs,$excluded) = @_;
- my $rowColor;
- my $rowNum = 0;
+ my ($r,$usertools,$toolprivs,$fixedprivs,$userdata,$idx,$showtools,
+ $defprivs,$excluded) = @_;
foreach my $user (sort(keys(%{$usertools}))) {
if (defined($excluded)) {
if (ref($excluded) eq 'ARRAY') {
@@ -3245,19 +3207,14 @@
}
}
my ($uname,$udom) = split(/:/,$user);
- if ($rowNum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $r->print('<tr bgcolor="'.$rowColor.'">
+ $r->print(&Apache::loncommon::start_data_table_row().'
<td>'.$$userdata{$user}[$$idx{fullname}].'</td>
<td>'.$uname.'</td>
<td>'.$udom.'</td>
<td valign="top"><table><tr><td><b>Function</b></td></tr><tr><td><b>Fixed</b></td></tr><tr><td><b>Optional</b></td></tr></table></td>');
foreach my $tool (@{$showtools}) {
if (exists($$usertools{$user}{$tool})) {
- $r->print('<td valign="top"><table><tr bgcolor="'.$tabcol.'"><td colspan="2" align="center"><b>'.$tool.'</b></td></tr>');
+ $r->print('<td valign="top"><table><tr><th colspan="2">'.$tool.'</th></tr>');
my $privcount = 0;
my $fixed = '';
my $dynamic = '';
@@ -3280,10 +3237,10 @@
}
$r->print('<tr><td colspan="2"><nobr>'.$fixed.'</nobr></td></tr><tr>'.$dynamic.'</tr></table></td>');
} else {
- $r->print('<td valign="top"><table width="100%"><tr bgcolor="'.$tabcol.'"><td colspan="2" align="center"><b>'.$tool.'</b></td></tr><tr><td> </td></tr><tr><td> </td></tr></table></td>');
+ $r->print('<td valign="top"><table width="100%"><tr><th colspan="2">'.$tool.'</th></tr><tr><td> </td></tr><tr><td> </td></tr></table></td>');
}
}
- $rowNum ++;
+ $r->print(&Apache::loncommon::end_data_table_row());
}
}
@@ -3578,8 +3535,9 @@
my ($r,$imgnum,$title) = @_;
$r->print('
<div class="LC_topic_bar">
- <img src="/res/adm/pages/bl_step'.$imgnum.'.gif" />
- <span>'.$title.'<span>
+ <img alt="'.&mt('Step [_1]',$imgnum).
+ '"src="/res/adm/pages/bl_step'.$imgnum.'.gif" />
+ <span>'.$title.'</span>
</div>
');
return;
--albertel1152304275--