--- loncom/interface/lonpopulate.pm 2013/02/11 02:39:11 1.74 +++ loncom/interface/lonpopulate.pm 2016/11/09 00:48:52 1.85 @@ -1,5 +1,5 @@ # automated enrollment configuration handler -# $Id: lonpopulate.pm,v 1.74 2013/02/11 02:39:11 raeburn Exp $ +# $Id: lonpopulate.pm,v 1.85 2016/11/09 00:48:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -40,8 +40,8 @@ use LONCAPA::Enrollment; ############################################################### sub header { - my ($action) = @_; - my $args = &make_crumbs($action); + my ($action,$permref) = @_; + my $args = &make_crumbs($action,$permref); return &Apache::loncommon::start_page('Classlist Manager',undef,$args); } @@ -49,9 +49,9 @@ sub header { ############################################################### sub choose_header { - my ($action) = @_; + my ($action,$permref) = @_; my $notify_check = '/^note_[0-9]+$/'; - my %lt = + my %js_lt = &Apache::lonlocal::texthash( adds => 'You must select either "Enable" or "Disable" for nightly additions based on classlist changes', drop => 'You must select either "Enable" or "Disable" for nightly removals based on classlist changes', @@ -60,13 +60,25 @@ sub choose_header { eras => 'Click "OK" to erase all recipients, or "Cancel".', ynot => 'You have indicated that you want notification of roster changes messages to be sent, but you have not selected any recipients.', atle => 'You must check at least one checkbox, before proceeding to the next page', + noed => 'You do not have rights to modify automated enrollment settings', ); - $lt{'both'} = &mt('You have selected "No" for both addition and removal of students[_1] in the institutional classlist but not in your LON-CAPA course.[_1]','\\n'); - $lt{'nnot'} = &mt('You have indicated that you do not want notification of roster changes messages to be sent, but [_1] have been checked as recipients.[_2]',"'+totalnote+'",'\\n'); - - my $scripttag = <{'edit'})) { + $scripttag .= < 0) { if (formName.notify[1].checked == true) { - if (confirm('$lt{'nnot'}$lt{'eras'}')) { + if (confirm('$js_lt{'nnot'}$js_lt{'eras'}')) { checker = 1; } else { checker = 0; @@ -149,7 +161,7 @@ function process(calling,numauto,nummanu } } else { if (formName.notify[0].checked == true) { - alert('$lt{'ynot'}'); + alert('$js_lt{'ynot'}'); checker = 0; } } @@ -177,7 +189,7 @@ function process(calling,numauto,nummanu document.forms.studentform.state.value = "process"; } if (totcheck == 0) { - alert('$lt{'atle'}') + alert('$js_lt{'atle'}') checker = 0; } } @@ -186,6 +198,7 @@ function process(calling,numauto,nummanu } } ENDJSONE + } if ($action eq 'viewclass') { $scripttag .= &Apache::loncommon::check_uncheck_jscript(); $scripttag .= < ENDJS - my $args = &make_crumbs($action); + my $args = &make_crumbs($action,$permref); return &Apache::loncommon::start_page('Classlist Manager', $scripttag,$args); } sub make_crumbs { - my ($action) = @_; - my ($tasklong,$tasktitle) = &get_task_text(); + my ($action,$permref) = @_; + my ($tasklong,$tasktitle) = &get_task_text($permref); my $brcrum = [{href=>"/adm/createuser", text=>"User Management",}, {href=>"/adm/populate", @@ -230,7 +243,6 @@ sub make_crumbs { } elsif ($action eq 'newsections') { $action = 'sections'; } - my ($tasklong,$tasktitle) = &get_task_text(); my $text; if (ref($tasklong) eq 'HASH') { $text = $tasklong->{$action}; @@ -254,7 +266,6 @@ sub print_navmenu { '); - print STDERR "action is ||$action|| and state is ||$state||\n"; foreach my $task (@{$tasksref}) { if (($task eq $action) && ($state eq 'choose')) { $r->print(' @@ -282,16 +293,21 @@ sub print_navmenu { ############################################################### sub print_main_frame { - my ($r,$realm,$dom,$crs,$tasktitleref) = @_; + my ($r,$realm,$dom,$crs,$tasktitleref,$permref) = @_; my $action = "information"; if (exists($env{'form.action'}) ) { $action = $env{'form.action'}; } + my ($disabled,$readonly); + unless ($permref->{'edit'}) { + $disabled = ' disabled="disabled"'; + $readonly = 1; + } # Get course settings my %enrollvar; my %settings = &Apache::lonnet::dump('environment',$dom,$crs); - foreach my $item (keys %settings) { + foreach my $item (keys(%settings)) { if ($item =~ m/^internal\.(.+)$/) { $enrollvar{$1} = $settings{$item}; } elsif ($item =~ /^default_enrollment_(start|end)_date$/) { @@ -305,7 +321,9 @@ sub print_main_frame {   '.&mt('Use the menu on the left to choose an enrollment management task.').'

- + '); + if ($permref->{'edit'}) { + $r->print('   '.&mt('Use [_1]Automated adds/drops[_2] to enable or disable automatic nightly adds or drops in your LON-CAPA course based on institutional enrollment information.','"','"').' @@ -350,6 +368,57 @@ sub print_main_frame { '.&mt('Use [_1]View students and change type[_2] to display the current course roster, and (optionally) change enrollment type for selected students from "auto" to "manual" and vice versa.','"','"').' +   + '.&mt('Use [_1]Change zero enrollment failsafe[_2] to set number of existing enrollments in an institutional section above which no automated drops occur whenever section enrollment retrieved from institutional data is zero.','"','"').' + '); + } else { + if (($permref->{'view'}) || ($permref->{'view_section'} ne '')) { + $r->print(' + +   + '.&mt('Use [_1]Automated adds/drops[_2] to display status of automatic nightly adds or drops based on institutional enrollment information.','"','"').' + + +   + '.&mt('Use [_1]Enrollment dates[_2] to display the date of first automated enrollment and last automated enrollment for registered students.','"','"').' + + +   + '.&mt('Use [_1]Access dates[_2] to display the default start and/or end dates for student roles created by automated enrollment.','"','"').' + + +   + '.&mt('Use [_1]Notification of changes[_2] to display which course coordinators (if any) receive notification of enrollment changes.','"','"').' + + +   + '.&mt('Use [_1]Crosslisting[_2] to display enrollment settings for crosslisted classes.', + '"','"').' + + +   + '.&mt('Use [_1]Section settings[_2] to display sections included for enrollment.', + '"','"').' + + +   + '.&mt('Use [_1]Student photo settings[_2] to display settings for automatic import of photos for registered students.', + '"','"').' + + +   + '.&mt('Use [_1]Zero enrollment failsafe[_2] to set number of existing enrollments in an institutional section above which no automated drops occur whenever section enrollment retrieved from institutional data is zero.','"','"').' + '); + } + if (($permref->{'show'}) || ($permref->{'show_section'} ne '')) { + $r->print(' + +   + '.&mt('Use [_1]View students and enrollment type[_2] to display the current course roster and enrollment type ("auto" or "manual").','"','"').' + '); + } + $r->print(' +   @@ -357,6 +426,7 @@ sub print_main_frame { '.&mt('Note: if automated adds and/or drops are enabled, the nightly enrollment update will ONLY occur once the first enrollment date has been reached.').' '); + } } elsif ($action eq 'chgsettings') { my @autosets = (&mt('OFF'),&mt('ON')); $r->print(' @@ -374,15 +444,15 @@ sub print_main_frame { '.&mt('Additions based on classlist changes:').'  '); if ($enrollvar{autoadds}) { $r->print(' -