--- loncom/interface/Attic/londropadd.pm 2005/11/01 20:47:15 1.131 +++ loncom/interface/Attic/londropadd.pm 2006/03/21 18:34:23 1.138 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to drop and add students in courses # -# $Id: londropadd.pm,v 1.131 2005/11/01 20:47:15 albertel Exp $ +# $Id: londropadd.pm,v 1.138 2006/03/21 18:34:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,15 +43,9 @@ use Apache::lonlocal; ############################################################### ############################################################### sub header { - my $html=&Apache::lonxml::xmlbegin(); - my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager'); - my $title = &mt('LON-CAPA Enrollment Manager'); + my $start_page=&Apache::loncommon::start_page('Enrollment Manager'); return(< -$title - -$bodytag +$start_page
ENDHEAD @@ -137,7 +131,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 +166,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) { @@ -1237,6 +1252,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') { @@ -1259,7 +1280,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("

@@ -1297,8 +1332,23 @@ 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"); + } + $r->print(" \n"); } elsif ($mode eq 'csv') { # # Open a file @@ -1436,8 +1486,21 @@ 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 @@ -1517,7 +1580,7 @@ sub print_modify_student_form { '

'. &mt('Unable to retrieve environment data for').' '.$sname. &mt('in domain').' '.$sdom.'

'. - &mt('Please contact your LON-CAPA administrator regarding this situation.').'

'); + &mt('Please contact your LON-CAPA administrator regarding this situation.').'

'.&Apache::loncommon::end_page()); return; } # determine the students starting and ending times and section @@ -1606,8 +1669,8 @@ $lt{'disn'}

$current_date_description

$date_table

- END + $r->print(&Apache::loncommon::end_page()); return; } @@ -1615,7 +1678,7 @@ END # modify a single students section # sub modify_single_student { - my $r = shift; + my ($r) = @_; # # Remove non alphanumeric values from the section $env{'form.section'} =~ s/\W//g; @@ -1757,8 +1820,8 @@ END $Masd - END + $r->print(&Apache::loncommon::end_page()); return; } @@ -1987,7 +2050,7 @@ sub print_first_courselist_upload_form { $str .= &Apache::loncommon::help_open_topic("Course_Convert_To_CSV", &mt("How do I create a CSV file from a spreadsheet")). "
\n"; - $str .= "\n\n"; + $str .= &Apache::loncommon::end_page(); $r->print($str); return; } @@ -2043,7 +2106,7 @@ sub upfile_drop_add { if (! exists($home_servers{$desiredhost})) { $r->print(''.&mt('Error').''. &mt('Invalid home server specified')); - $r->print("\n\n"); + $r->print(&Apache::loncommon::end_page()); return; } } @@ -2289,7 +2352,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; } # @@ -2297,11 +2361,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 # @@ -2314,7 +2388,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=', @@ -2403,7 +2478,7 @@ sub handler { } # # Finish up - $r->print(''); + $r->print(''.&Apache::loncommon::end_page()); return OK; }
$lt{'end'}
'."\n".' '. + ''. + $photo_options{$photochg}.' '.$lt{'photo'}."\n". + '
$section $start $end