--- loncom/interface/lonuserutils.pm 2008/05/09 17:55:25 1.53
+++ loncom/interface/lonuserutils.pm 2008/05/19 17:10:19 1.55
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.53 2008/05/09 17:55:25 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.55 2008/05/19 17:10:19 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -925,8 +925,15 @@ sub setup_date_selectors {
sub get_dates_from_form {
- my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate');
- my $enddate = &Apache::lonhtmlcommon::get_date_from_form('enddate');
+ my ($startname,$endname) = @_;
+ if ($startname eq '') {
+ $startname = 'startdate';
+ }
+ if ($endname eq '') {
+ $endname = 'enddate';
+ }
+ my $startdate = &Apache::lonhtmlcommon::get_date_from_form($startname);
+ my $enddate = &Apache::lonhtmlcommon::get_date_from_form($endname);
if ($env{'form.no_end_date'}) {
$enddate = 0;
}
@@ -1856,7 +1863,10 @@ sub process_date_info {
}
sub show_users_list {
- my ($r,$context,$mode,$permission,$statusmode,$userlist,$keylist)=@_;
+ my ($r,$context,$mode,$permission,$statusmode,$userlist,$keylist,$formname)=@_;
+ if ($formname eq '') {
+ $formname = 'studentform';
+ }
#
# Variables for excel output
my ($excel_workbook, $excel_sheet, $excel_filename,$row,$format);
@@ -1871,6 +1881,9 @@ sub show_users_list {
} else {
push(@sortable,'extent');
}
+ if ($mode eq 'pickauthor') {
+ @sortable = ('username','fullname','email','status');
+ }
if (!grep(/^\Q$sortby\E$/,@sortable)) {
$sortby = 'username';
}
@@ -1911,7 +1924,7 @@ function photowindow(photolink) {
END
}
}
- if ($mode ne 'autoenroll') {
+ if ($mode ne 'autoenroll' && $mode ne 'pickauthor') {
my $check_uncheck_js = &Apache::loncommon::check_uncheck_jscript();
my $alert = &mt("You must select at least one user by checking a user's 'Select' checkbox");
my $singconfirm = &mt(' for a single user?');
@@ -1953,8 +1966,8 @@ function verify_action (field) {
alert("$alert");
}
else {
- var message = document.studentform.bulkaction[document.studentform.bulkaction.selectedIndex].text;
- var choice = document.studentform.bulkaction[document.studentform.bulkaction.selectedIndex].value;
+ var message = document.$formname.bulkaction[document.$formname.bulkaction.selectedIndex].text;
+ var choice = document.$formname.bulkaction[document.$formname.bulkaction.selectedIndex].value;
if (numchecked == 1) {
message += singconf;
}
@@ -1963,14 +1976,14 @@ function verify_action (field) {
}
if (choice == 'chgdates' || choice == 'reenable' || choice == 'activate') {
var datemsg = '';
- if ((document.studentform.startdate_month.value == '') &&
- (document.studentform.startdate_day.value == '') &&
- (document.studentform.startdate_year.value == '')) {
+ if ((document.$formname.startdate_month.value == '') &&
+ (document.$formname.startdate_day.value == '') &&
+ (document.$formname.startdate_year.value == '')) {
datemsg = "\\n$lt{'acwi'},\\n$lt{'asyo'}.\\n";
}
- if ((document.studentform.enddate_month.value == '') &&
- (document.studentform.enddate_day.value == '') &&
- (document.studentform.enddate_year.value == '')) {
+ if ((document.$formname.enddate_month.value == '') &&
+ (document.$formname.enddate_day.value == '') &&
+ (document.$formname.enddate_year.value == '')) {
datemsg += "\\n$lt{'accw'},\\n$lt{'asyd'}.\\n";
}
if (datemsg != '') {
@@ -1978,9 +1991,9 @@ function verify_action (field) {
}
}
if (choice == 'chgsec') {
- var rolefilter = document.studentform.showrole.options[document.studentform.showrole.selectedIndex].value;
- var retained = document.studentform.retainsec.value;
- var secshow = document.studentform.newsecs.value;
+ var rolefilter = document.$formname.showrole.options[document.$formname.showrole.selectedIndex].value;
+ var retained = document.$formname.retainsec.value;
+ var secshow = document.$formname.newsecs.value;
if (secshow == '') {
if (rolefilter == 'st' || retained == 0 || retained == "") {
message += "\\n\\n$lt{'sewi'},\\n$lt{'ayes'},\\n$lt{'oryo'}.\\n";
@@ -1996,36 +2009,36 @@ function verify_action (field) {
}
}
if (confirm(message)) {
- document.studentform.phase.value = 'bulkchange';
- document.studentform.submit();
+ document.$formname.phase.value = 'bulkchange';
+ document.$formname.submit();
}
}
}
function username_display_launch(username,domain) {
var target;
- for (var i=0; i
');
}
my ($output,$actionselect,%canchange,%canchangesec);
- if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll') {
- if ($mode ne 'autoenroll') {
+ if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll' || $mode eq 'pickauthor') {
+ if ($mode ne 'autoenroll' && $mode ne 'pickauthor') {
if ($permission->{'cusr'}) {
- $actionselect = &select_actions($context,$setting,$statusmode);
+ $actionselect = &select_actions($context,$setting,$statusmode,$formname);
}
$r->print(<
';
if ($actionselect) {
$output .= <<"END";
-$lt{'ac'}: $actionselect
-
+$lt{'ac'}: $actionselect
+
END
my @allroles;
if ($env{'form.showrole'} eq 'Any') {
@@ -2198,16 +2216,20 @@ END
&Apache::loncommon::start_data_table_header_row();
if ($mode eq 'autoenroll') {
$output .= "
-