--- loncom/interface/Attic/londropadd.pm 2005/04/07 07:34:52 1.128
+++ loncom/interface/Attic/londropadd.pm 2006/02/18 01:27:07 1.137
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.128 2005/04/07 07:34:52 albertel Exp $
+# $Id: londropadd.pm,v 1.137 2006/02/18 01:27:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -137,7 +137,8 @@ sub domain_form {
###############################################################
# Menu Phase One
sub print_main_menu {
- my ($r,$enrl_permission,$view_permission)=@_;
+ my ($r,$enrl_permission,$view_permission,$grp_manage_permission,
+ $grp_view_permission)=@_;
#
my ($cdom,$cnum) = split/_/,$env{'request.course.id'};
my @menu =
@@ -171,6 +172,26 @@ sub print_main_menu {
permission => &Apache::lonnet::auto_run($cnum,$cdom),
url => '/adm/populate',
},
+ { text => 'Create a new group',
+ help => 'Course_Create_Group',
+ permission => $grp_manage_permission,
+ url => '/adm/coursegroups?refpage=enrl&action=create',
+ },
+ { text => 'Modify an existing group',
+ help => 'Course_Modify_Group',
+ permission => $grp_manage_permission,
+ url => '/adm/coursegroups?refpage=enrl&action=modify',
+ },
+ { text => 'Delete an existing group',
+ help => 'Course_Delete_Group',
+ permission => $grp_manage_permission,
+ url => '/adm/coursegroups?refpage=enrl&action=delete',
+ },
+ { text => 'Enter an existing group',
+ help => 'Course_Display_Group',
+ permission => $grp_view_permission,
+ url => '/adm/coursegroups?refpage=enrl&action=view',
+ },
);
my $menu_html = '';
foreach my $menu_item (@menu) {
@@ -253,8 +274,8 @@ sub print_upload_manager_header {
$r->print(' ');
- $r->print(' '.
- &mt('Ignore First Line'));
+ $r->print(' '.
+ &mt('Ignore First Line').' ');
$r->print("
\n".
'');
@@ -607,6 +628,7 @@ sub print_upload_manager_footer {
$Str .= ''.&mt('Login Type')." \n";
$Str .= "\n".
&mt('Note: this will not take effect if the user already exists').
+ &Apache::loncommon::help_open_topic('Auth_Options').
"
\n";
$Str .= $krbform."\n
\n".
$intform."\n
\n".
@@ -616,14 +638,14 @@ sub print_upload_manager_footer {
$Str .= "
".&mt('Starting and Ending Dates')." \n";
$Str .= "\n".$date_table."
\n";
$Str .= "".&mt('Full Update')." \n";
- $Str .= ' '.
+ $Str .= ' '.
' '.&mt('Full update (also print list of users not enrolled anymore)').
- "\n";
+ " \n";
$Str .= "".&mt('Student Number')." \n";
- $Str .= "\n".' ';
+ $Str .= "
\n".' ';
$Str .= &mt('Disable ID/Student Number Safeguard and Force Change '.
'of Conflicting IDs (only do if you know what you are doing)').
- "\n
\n";
+ "\n
\n";
$Str .= ' '." \n";
$Str .= &mt('Note: for large courses, this operation may be time '.
@@ -852,16 +874,16 @@ sub date_setting_table {
my ($starttime,$endtime,$mode) = @_;
my ($startform,$endform)=&setup_date_selectors($starttime,$endtime,$mode);
my $dateDefault = ''.
- ' '.
- &mt('make these dates the default for future enrollment');
+ ' '.
+ &mt('make these dates the default for future enrollment').' ';
if ($mode eq 'create_enrolldates' || $mode eq 'create_defaultdates') {
$dateDefault = ' ';
}
- my $perpetual = ' '.&mt('no ending date').' ';
+ $perpetual.= ' /> '.&mt('no ending date').' ';
if ($mode eq 'create_enrolldates') {
$perpetual = ' ';
}
@@ -986,6 +1008,7 @@ sub print_enroll_single_student_form {
'psam' => "Please select an authentication mechanism",
'mail' => "Email Address"
);
+ my $authhelp=&Apache::loncommon::help_open_topic('Auth_Options');
$user_data_html = <$lt{'udf'} $username\@$domain
$lt{'pswd'}
-$lt{'psam'}
+$lt{'psam'}$authhelp
$krbform
@@ -1115,8 +1138,10 @@ $date_table
$lt{'idsn'}:
+
$lt{'disn'}
+
@@ -1233,6 +1258,11 @@ sub show_class_list {
if ($sortby !~ /^(username|domain|section|fullname|id|start|end|type)$/) {
$sortby = 'username';
}
+ if (! exists($env{'form.displayphotos'})) {
+ $env{'form.displayphotos'} = 'off';
+ }
+ my $displayphotos = $env{'form.displayphotos'};
+
# Print out header
unless ($mode eq 'autoenroll') {
$r->print(<print(<
+
END
if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll') {
if ($linkto eq 'aboutme') {
@@ -1255,7 +1286,8 @@ END
'sec' => "section",
'start' => "start date",
'end' => "end date",
- 'type' => "enroll type/action"
+ 'type' => "enroll type/action",
+ 'photo' => "photo",
);
unless ($mode eq 'autoenroll') {
$r->print(<
END
}
+ if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
+ $r->print('
+
+ ');
+ }
$r->print("
@@ -1293,8 +1338,23 @@ END
$lt{'end'}
-
END
+ if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
+ my %photo_options = &Apache::lonlocal::texthash(
+ 'on' => 'Show',
+ 'off' => 'Hide',
+ );
+ my $photochg = 'on';
+ if ($displayphotos eq 'on') {
+ $photochg = 'off';
+ }
+ $r->print(' '."\n".' '.
+ ''.
+ $photo_options{$photochg}.' '.$lt{'photo'}."\n".
+ ' '."\n");
+ }
+ $r->print(" \n");
} elsif ($mode eq 'csv') {
#
# Open a file
@@ -1391,16 +1451,16 @@ END
$studentcount++;
my $cellentry;
if ($type eq 'auto') {
- $cellentry = ''.&mt('auto').' Change';
+ $cellentry = ''.&mt('auto').' Change ';
$autocount ++;
} else {
- $cellentry = ''.&mt('manual').' Change';
+ $cellentry = '';
@@ -1432,8 +1492,21 @@ END
$section
$start
$end
-
END
+ if ($env{'course.'.$env{'request.course.id'}.
+ '.internal.showphoto'}) {
+ if ($displayphotos eq 'on') {
+ my $imgurl =
+ &Apache::lonnet::retrievestudentphoto($domain,
+ $username,'gif',
+ 'thumbnail');
+
+ $r->print(' ');
+ } else {
+ $r->print(' ');
+ }
+ }
+ $r->print(' ');
} elsif ($mode eq 'csv') {
next if (! defined($CSVfile));
# no need to bother with $linkto
@@ -1460,9 +1533,13 @@ END
$name,$section]);
my $col = 5;
foreach my $time ($start,$end) {
- $excel_sheet->write($row,$col++,
+ if (defined($time) && $time != 0) {
+ $excel_sheet->write($row,$col++,
&Apache::lonstathelpers::calc_serial($time),
$format->{'date'});
+ } else {
+ $excel_sheet->write($row,$col++,'none');
+ }
}
$excel_sheet->write($row,$col++,$status);
$row++;
@@ -1588,8 +1665,10 @@ $info{'lastname'} $info{'generation'}, $
$lt{'sid'} :
+
$lt{'disn'}
+
$lt{'sec'} :
@@ -1969,8 +2048,8 @@ sub print_first_courselist_upload_form {
$str .= "\n";
$str .= ' '."\n";
- $str .= ' '.
- &mt('Ignore First Line')."
\n";
+ $str .= ' '.
+ &mt('Ignore First Line')." \n";
$str .= &Apache::loncommon::help_open_topic("Course_Create_Class_List",
&mt("How do I create a class list from a spreadsheet")).
" \n";
@@ -2279,7 +2358,8 @@ sub handler {
if (! ($env{'request.course.fn'})) {
# Not in a course
$env{'user.error.msg'}=
- "/adm/dropadd:cst:0:0:Cannot drop or add students";
+ "/adm/dropadd:cst:0:0:Cannot manage or view course groups, ".
+ "or drop or add students";
return HTTP_NOT_ACCEPTABLE;
}
#
@@ -2287,11 +2367,21 @@ sub handler {
&Apache::lonnet::allowed('vcl',$env{'request.course.id'});
my $enrl_permission =
&Apache::lonnet::allowed('cst',$env{'request.course.id'});
- if (! $view_permission && ! $enrl_permission) {
+
+ my $grp_view_permission =
+ &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
+ my $grp_manage_permission =
+ &Apache::lonnet::allowed('mdg',$env{'request.course.id'});
+
+
+ if (! $grp_view_permission && ! $grp_manage_permission &&
+ ! $view_permission && ! $enrl_permission) {
$env{'user.error.msg'}=
- "/adm/dropadd:cst:0:0:Cannot drop or add students";
- return HTTP_NOT_ACCEPTABLE;
+ "/adm/coursegroups:cst:0:0:Cannot manage or view course groups, ".
+ "or drop or add students";
+ return HTTP_NOT_ACCEPTABLE;
}
+
#
# Only output the header information if they did not request csv format
#
@@ -2304,7 +2394,8 @@ sub handler {
if (! exists($env{'form.action'})) {
$r->print(&Apache::lonhtmlcommon::breadcrumbs
(undef,'Enrollment Manager'));
- &print_main_menu($r,$enrl_permission,$view_permission);
+ &print_main_menu($r,$enrl_permission,$view_permission,$grp_manage_permission,
+ $grp_view_permission);
} elsif ($env{'form.action'} eq 'upload' && $enrl_permission) {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>'/adm/dropadd?action=upload&state=',