[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm
raeburn
raeburn@source.lon-capa.org
Wed, 02 Jun 2010 14:49:38 -0000
raeburn Wed Jun 2 14:49:38 2010 EDT
Modified files:
/loncom/auth lonroles.pm
Log:
- HTML readability: move javascript used for ad hoc course or role selection outside
roles table.
- Coding style: eliminate $_.
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.246 loncom/auth/lonroles.pm:1.247
--- loncom/auth/lonroles.pm:1.246 Mon Mar 22 20:11:08 2010
+++ loncom/auth/lonroles.pm Wed Jun 2 14:49:38 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.246 2010/03/22 20:11:08 droeschl Exp $
+# $Id: lonroles.pm,v 1.247 2010/06/02 14:49:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -752,6 +752,13 @@
return OK;
}
# ----------------------------------------------------------------------- Table
+
+ if ($numdc > 0) {
+ $r->print(&coursepick_jscript());
+ $r->print(&Apache::loncommon::coursebrowser_javascript().
+ &Apache::loncommon::authorbrowser_javascript());
+ }
+
unless ((!&Apache::loncommon::show_course()) || ($nochoose) || ($countactive==1)) {
$r->print("<h2>".&mt('Select a Course to Enter')."</h2>\n");
}
@@ -763,28 +770,29 @@
$env{'form.destsymb'}.'" />');
}
}
+
my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole,$nochoose);
if ($env{'environment.recentroles'}) {
my %recent_roles =
&Apache::lonhtmlcommon::get_recent('roles',$env{'environment.recentrolesn'});
my $output='';
- foreach (sort(keys(%recent_roles))) {
- if (ref($roletext{'user.role.'.$_}) eq 'ARRAY') {
+ foreach my $role (sort(keys(%recent_roles))) {
+ if (ref($roletext{'user.role.'.$role}) eq 'ARRAY') {
$output.= &Apache::loncommon::start_data_table_row().
- $roletext{'user.role.'.$_}->[0].
+ $roletext{'user.role.'.$role}->[0].
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::continue_data_table_row().
- $roletext{'user.role.'.$_}->[1].
+ $roletext{'user.role.'.$role}->[1].
&Apache::loncommon::end_data_table_row();
- if ($_ =~ m-dc\./($match_domain)/-
+ if ($role =~ m{dc\./($match_domain)/}
&& $dcroles{$1}) {
$output .= &adhoc_roles_row($1,'recent');
}
} elsif ($numdc > 0) {
- unless ($_ =~/^error\:/) {
+ unless ($role =~/^error\:/) {
$output.=&display_cc_role('user.role.'.$_);
}
- }
+ }
}
if ($output) {
$r->print(&Apache::loncommon::start_data_table_empty_row()
@@ -797,12 +805,6 @@
$doheaders ++;
}
}
-
- if ($numdc > 0) {
- $r->print(&coursepick_jscript());
- $r->print(&Apache::loncommon::coursebrowser_javascript().
- &Apache::loncommon::authorbrowser_javascript());
- }
&print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles,\%roletext);
if ($countactive > 1) {
my $tremark='';