--- loncom/interface/Attic/londropadd.pm 2007/08/26 21:09:42 1.166
+++ loncom/interface/Attic/londropadd.pm 2008/09/11 14:47:21 1.174
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.166 2007/08/26 21:09:42 raeburn Exp $
+# $Id: londropadd.pm,v 1.174 2008/09/11 14:47:21 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -179,27 +179,27 @@ sub print_main_menu {
{ text => 'Create a new group',
help => 'Course_Create_Group',
permission => $permission->{'grp_manage'},
- url => '/adm/coursegroups?refpage=enrl&action=create',
+ url => '/adm/coursegroups?refpage=enrl&action=create',
},
{ text => 'Modify an existing group',
help => 'Course_Modify_Group',
permission => $permission->{'grp_manage'},
- url => '/adm/coursegroups?refpage=enrl&action=modify',
+ url => '/adm/coursegroups?refpage=enrl&action=modify',
},
{ text => 'Delete an existing group',
help => 'Course_Delete_Group',
permission => $permission->{'grp_manage'},
- url => '/adm/coursegroups?refpage=enrl&action=delete',
+ url => '/adm/coursegroups?refpage=enrl&action=delete',
},
{ text => 'Re-enable a deleted group',
help => 'Course_Reenable_Group',
permission => $permission->{'grp_manage'},
- url => '/adm/coursegroups?refpage=enrl&action=reenable',
+ url => '/adm/coursegroups?refpage=enrl&action=reenable',
},
{ text => 'Enter an existing group',
help => 'Course_Display_Group',
permission => $permission->{'grp_view'},
- url => '/adm/coursegroups?refpage=enrl&action=view',
+ url => '/adm/coursegroups?refpage=enrl&action=view',
},
);
my $menu_html = '';
@@ -262,8 +262,9 @@ sub print_upload_manager_header {
$password_choice = 'int';
}
#
- my $javascript_validations=&javascript_validations('auth',$krbdefdom,
- $password_choice);
+ my $javascript_validations =
+ &javascript_validations('auth',$krbdefdom,$password_choice,undef,
+ $env{'request.role.domain'});
my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':'');
$r->print('
'.&mt('Uploading Class List')."
\n".
"
\n".
@@ -293,7 +294,7 @@ sub print_upload_manager_header {
###############################################################
###############################################################
sub javascript_validations {
- my ($mode,$krbdefdom,$curr_authtype,$curr_authfield)=@_;
+ my ($mode,$krbdefdom,$curr_authtype,$curr_authfield,$domain)=@_;
my $authheader;
if ($mode eq 'auth') {
my %param = ( formname => 'studentform',
@@ -302,7 +303,7 @@ sub javascript_validations {
$authheader = &Apache::loncommon::authform_header(%param);
} elsif ($mode eq 'createcourse') {
my %param = ( formname => 'ccrs',
- kerb_def_dom => $krbdefdom,
+ kerb_def_dom => $krbdefdom,
curr_authtype => $curr_authtype );
$authheader = &Apache::loncommon::authform_header(%param);
} elsif ($mode eq 'modifycourse') {
@@ -331,6 +332,7 @@ sub javascript_validations {
my $function_name =(< 1) {
+ $auth_checks .= (< "Personal Data",
'fn' => "First Name",
'mn' => "Middle Name",
'ln' => "Last Name",
'gen' => "Generation",
'hs' => "Home Server",
- 'pswd' => "Password",
+ 'pswd' => "Login Data",
'psam' => "Please select an authentication mechanism",
'mail' => "Email Address"
);
@@ -1108,19 +1119,22 @@ sub print_enroll_single_student_form {
$lt{'pswd'}
$lt{'psam'}$authhelp
-
-$krbform
-
-$intform
-
-$locform
-
END
+ if ($krbform ne '') {
+ $user_data_html .= $krbform.'
';
+ }
+ if ($intform ne '') {
+ $user_data_html .= $intform.'
';
+ }
+ if ($locform ne '') {
+ $user_data_html .= $locform.'
';
+ }
+ $user_data_html .= "\n\n"
} else {
# User already exists. Do not worry about authentication
my %uenv = &Apache::lonnet::dump('environment',$ccdomain,$ccuname);
- $javascript_validations = &javascript_validations('noauth');
+ $javascript_validations = &Apache::lonuserutils::javascript_validations('noauth');
my %lt=&Apache::lonlocal::texthash(
'udf' => "User Data for",
'fn' => "First Name",
@@ -1146,7 +1160,7 @@ END
END
}
- my $date_table = &date_setting_table();
+ my $date_table = &Apache::lonuserutils::date_setting_table();
# Print it all out
my %lt=&Apache::lonlocal::texthash(
'cd' => "Course Data",
@@ -1364,6 +1378,11 @@ sub show_class_list {
}
my $displayphotos = $env{'form.displayphotos'};
+ if (! exists($env{'form.displayclickers'})) {
+ $env{'form.displayclickers'} = 'off';
+ }
+ my $displayclickers = $env{'form.displayclickers'};
+
# 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') {
@@ -1390,6 +1410,7 @@ END
'end' => "end date",
'type' => "enroll type/action",
'email' => "email address",
+ 'clicker'=> "clicker id",
'photo' => "photo",
);
unless ($mode eq 'autoenroll') {
@@ -1446,6 +1467,24 @@ function photowindow(photolink) {
$lt{'email'}
END
+
+# Clicker display on or off?
+
+ my %clicker_options = &Apache::lonlocal::texthash(
+ 'on' => 'Show',
+ 'off' => 'Hide',
+ );
+ my $clickerchg = 'on';
+ if ($displayclickers eq 'on') {
+ $clickerchg = 'off';
+ }
+ $r->print(' '."\n".' '.
+ ''.
+ $clicker_options{$clickerchg}.' '.$lt{'clicker'}."\n".
+ ' | '."\n");
+
+# Photo display on or off?
if ($env{'course.'.$env{'request.course.id'}.'.internal.showphoto'}) {
my %photo_options = &Apache::lonlocal::texthash(
'on' => 'Show',
@@ -1462,6 +1501,9 @@ END
' '."\n");
}
$r->print(" \n");
+
+# Done with the HTML header line
+
} elsif ($mode eq 'csv') {
#
# Open a file
@@ -1470,9 +1512,9 @@ END
time.'_'.rand(1000000000).'.csv';
unless ($CSVfile = Apache::File->new('>/home/httpd'.$CSVfilename)) {
$r->log_error("Couldn't open $CSVfilename for output $!");
- $r->print("Problems occured in writing the csv file. ".
- "This error has been logged. ".
- "Please alert your LON-CAPA administrator.");
+ $r->print(&mt('Problems occurred in writing the csv file. '
+ .'This error has been logged. '
+ .'Please alert your LON-CAPA administrator.'));
$CSVfile = undef;
}
#
@@ -1514,6 +1556,9 @@ END
"active groups","email address"],
$format->{'bold'});
}
+
+# Done with header lines in all formats
+
#
# Sort the students
my %index;
@@ -1557,12 +1602,8 @@ END
my %emails = &Apache::loncommon::getemails($username,$domain);
my $email;
- foreach my $type ('critnotification', 'permanentemail',
- 'notification') {
- if ($emails{$type} =~ /\S/) {
- $email = $emails{$type};
- last;
- }
+ if ($emails{'permanentemail'} =~ /\S/) {
+ $email = $emails{'permanentemail'};
}
if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') {
@@ -1626,6 +1667,19 @@ END
$active_groups |
$email |
END
+
+# Clickers
+ if ($displayclickers eq 'on') {
+ my $clickers =
+ (&Apache::lonnet::userenvironment($domain,$username,'clickers'))[1];
+ if ($clickers!~/\w/) { $clickers='-'; }
+ $r->print(''.$clickers.' | ');
+ } else {
+ $r->print(' | ');
+ }
+
+# Photos
+
if ($env{'course.'.$env{'request.course.id'}.
'.internal.showphoto'}) {
if ($displayphotos eq 'on') {
@@ -1715,8 +1769,8 @@ sub print_modify_student_form {
# determine the students name information
my %info=&Apache::lonnet::get('environment',
['firstname','middlename',
- 'lastname','generation','id'],
- $sdom, $sname);
+ 'lastname','generation','id',
+ 'permanentemail'], $sdom, $sname);
my ($tmp) = keys(%info);
if ($tmp =~ /^(con_lost|error|no_such_host)/i) {
$r->print(''.&mt('Error').''.
@@ -1755,7 +1809,8 @@ sub print_modify_student_form {
&Apache::lonlocal::locallocaltime($endtime)).'
';
}
- my $date_table = &date_setting_table($starttime,$endtime);
+ my $date_table =
+ &Apache::lonuserutils::date_setting_table($starttime,$endtime);
#
if (! exists($env{'form.Status'}) ||
$env{'form.Status'} !~ /^(Any|Expired|Active|Future)$/) {
@@ -1770,13 +1825,14 @@ sub print_modify_student_form {
'mn' => "Middle",
'ln' => "Last",
'gen' => "Generation",
+ 'email' => "E-mail address",
'sid' => "Student ID",
'disn' => "Disable ID/Student Number Safeguard and Force Change of Conflicting IDs (only do if you know what you are doing)",
'sec' => "Section",
'sm' => "Submit Modifications",
);
# Check if section name is valid
- my $section_check = §ion_check_js();
+ my $section_check = &Apache::lonuserutils::section_check_js();
$r->print(<<"END");
';
+ &Apache::loncreateuser::restore_prev_selections();
+ my $srch;
+ foreach my $item (@search) {
+ $srch->{$item} = $env{'form.'.$item};
+ }
+
if ($env{'form.state'} eq 'gotusername') {
- my $srch;
- foreach my $item (@search) {
- $srch->{$item} = $env{'form.'.$item};
- }
- print STDERR "phase = $env{'form.phase'}\n";
if ($env{'form.phase'} eq 'get_user_info') {
my ($currstate,$response,$forcenewuser,$results) =
&Apache::loncreateuser::user_search_result($srch);
+ if ($env{'form.currstate'} eq 'modify') {
+ $currstate = $env{'form.currstate'};
+ }
if ($currstate eq 'select') {
$r->print(&header());
&Apache::lonhtmlcommon::add_breadcrumb
@@ -2708,7 +2820,7 @@ sub handler {
&print_enroll_single_student_form($r,$jscript,$ccuname,
$ccdomain,$srch);
} else {
- &get_student_username_domain_form($r,$elements);
+ &get_student_username_domain_form($r,$elements,undef,$srch);
}
} elsif ($env{'form.state'} eq 'enrolling') {
$r->print(&header($jscript));
@@ -2729,9 +2841,10 @@ sub handler {
'Course_Add_Student'));
&enroll_single_student($r,\@search);
} else {
- &get_student_username_domain_form($r,$elements);
+ &get_student_username_domain_form($r,$elements,undef,$srch);
}
} elsif ($env{'form.action'} eq 'classlist' && $permission->{'view'}) {
+ $r->print(&header());
&Apache::lonhtmlcommon::add_breadcrumb
({href=>'/adm/dropadd?action=classlist',
text=>"View Classlist"});
@@ -2747,6 +2860,7 @@ sub handler {
&print_html_classlist($r,undef,$permission);
}
} elsif ($env{'form.action'} eq 'modifystudent' && $permission->{'enrl'}) {
+ $r->print(&header());
&Apache::lonhtmlcommon::add_breadcrumb
({href=>'/adm/dropadd?action=modifystudent',
text=>"Modify Student Data"});
@@ -2766,6 +2880,7 @@ sub handler {
&Apache::lonnet::logthis("Undetermined state in londropadd.pm. ".
"form.action = ".$env{'form.action'}.
"Someone should fix this.");
+ $r->print(&header());
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Enrollment Manager'));
&print_main_menu($r,$permission);
}