--- loncom/interface/lonuserutils.pm 2008/01/01 20:27:29 1.39 +++ loncom/interface/lonuserutils.pm 2008/01/02 08:01:22 1.40 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Utility functions for managing LON-CAPA user accounts # -# $Id: lonuserutils.pm,v 1.39 2008/01/01 20:27:29 raeburn Exp $ +# $Id: lonuserutils.pm,v 1.40 2008/01/02 08:01:22 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1907,7 +1907,19 @@ END my $alert = &mt("You must select at least one user by checking a user's 'Select' checkbox"); my $singconfirm = &mt(' for a single user?'); my $multconfirm = &mt(' for multiple users?'); - my $date_sec_selector = &date_section_javascript($context,$setting,$statusmode); + my $date_sec_selector = &date_section_javascript($context,$setting,$statusmode); + my %lt = &Apache::lonlocal::texthash( + acwi => 'Access will be set to start immediately', + asyo => 'as you did not select an end date in the pop-up window', + accw => 'Access will be set to continue indefinitely', + asyd => 'as you did not select an end date in the pop-up window', + sewi => "Sections will be switched to 'No section'", + ayes => "as you either selected the 'No section' option", + oryo => 'or you did not select a section in the pop-up window', + arol => 'A role with no section will be added', + swbs => 'Sections will be switched to:', + rwba => 'Roles will be added for section(s):', + ); $r->print(< @@ -1933,12 +1945,47 @@ function verify_action (field) { } else { var message = document.studentform.bulkaction[document.studentform.bulkaction.selectedIndex].text; + var choice = document.studentform.bulkaction[document.studentform.bulkaction.selectedIndex].value; if (numchecked == 1) { message += singconf; } else { message += multconf; } + 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 == '')) { + datemsg = "\\n$lt{'acwi'},\\n$lt{'asyo'}.\\n"; + } + if ((document.studentform.enddate_month.value == '') && + (document.studentform.enddate_day.value == '') && + (document.studentform.enddate_year.value == '')) { + datemsg += "\\n$lt{'accw'},\\n$lt{'asyd'}.\\n"; + } + if (datemsg != '') { + message += "\\n"+datemsg; + } + } + 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; + if (secshow == '') { + if (rolefilter == 'st' || retained == 0 || retained == "") { + message += "\\n\\n$lt{'sewi'},\\n$lt{'ayes'},\\n$lt{'oryo'}.\\n"; + } else { + message += "\\n\\n$lt{'arol'}\\n$lt{'ayes'},\\n$lt{'oryo'}.\\n"; + } + } else { + if (rolefilter == 'st' || retained == 0 || retained == "") { + message += "\\n\\n$lt{'swbs'} "+secshow+".\\n"; + } else { + message += "\\n\\n$lt{'rwba'} "+secshow+".\\n"; + } + } + } if (confirm(message)) { document.studentform.phase.value = 'bulkchange'; document.studentform.submit(); @@ -2665,7 +2712,15 @@ function saveselections(formname) { END if ($env{'form.bulkaction'} eq 'chgsec') { $output .= <<"END"; - opener.document.$callingform.retainsec.value = formname.retainsec.value; + if (formname.retainsec.length > 1) { + for (var i=0; i 0) { if (grep(/^\Q$sec\E$/,@newsecs)) {