--- loncom/interface/statistics/lonstudentsubmissions.pm 2010/09/12 17:37:24 1.54.10.2 +++ loncom/interface/statistics/lonstudentsubmissions.pm 2011/11/18 22:35:33 1.54.10.4 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentsubmissions.pm,v 1.54.10.2 2010/09/12 17:37:24 raeburn Exp $ +# $Id: lonstudentsubmissions.pm,v 1.54.10.4 2011/11/18 22:35:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -77,7 +77,7 @@ sub BuildStudentSubmissionsPage { '
'.&mt('Loading student data...').'
'); $r->rflush(); # - if (exists($env{'form.problemchoice'}) && + if ((exists($env{'form.problemchoice'}) || (exists($env{'form.allproblems'}))) && ! exists($env{'form.SelectAnother'})) { foreach my $button (@SubmitButtons) { if ($button->{'name'} eq 'break') { @@ -95,16 +95,32 @@ sub BuildStudentSubmissionsPage { $r->print('
'.$/); $r->rflush(); # + + # + # Get resource objects + my $navmap = Apache::lonnavmaps::navmap->new(); + # Determine which problems we are to analyze my @Symbs = &Apache::lonstathelpers::get_selected_symbs('problemchoice'); + if (defined($navmap)) { + if ($env{'form.allproblems'}) { + my $iterator = $navmap->getIterator(undef, undef, undef, 1); + while (my $curRes = $iterator->next()) { + next if (! ref($curRes)); + if ($curRes->is_problem) { + my $symb = $curRes->symb; + unless(grep(/^\Q$symb\E$/,@Symbs)) { + push(@Symbs,$symb); + } + } + } + } + } foreach my $selected (@Symbs) { $r->print(''.$/); } - # - # Get resource objects - my $navmap = Apache::lonnavmaps::navmap->new(); if (!defined($navmap)) { $r->print('
'.&mt("Internal error").'
'); return; @@ -112,7 +128,9 @@ sub BuildStudentSubmissionsPage { my %already_seen; my (@Problems,$show_named); unless (&Apache::loncommon::needs_gci_custom()) { - $show_named = 1; + unless ($env{'form.anonymized'} eq 'true') { + $show_named = 1; + } } foreach my $symb (@Symbs) { my $resource = $navmap->getBySymb($symb); @@ -136,6 +154,9 @@ sub BuildStudentSubmissionsPage { $threshold = 10; } } + unless (&Apache::loncommon::needs_gci_custom()) { + $threshold = 0; + } # $r->print('

'. &Apache::lonstatistics::section_and_enrollment_description(). @@ -143,7 +164,7 @@ sub BuildStudentSubmissionsPage { if (! scalar(@Problems) || ! defined($Problems[0])) { $r->print('resource is undefined'); } elsif (!$show_named && @Students < $threshold) { - $r->print(&mt('The number of students matching the selection criteria is too few for display of submission data for anonymous surveys.').'
'.&mt('There must be at least [quant,_1,student].',$threshold).' '.&mt('Contact a Domain Coordinator if you need the threshold to be changed for this course.')); + $r->print(&mt('The number of students matching the selection criteria is too few for display of submission data for anonymous surveys.').'
'.&mt('There must be at least [quant,_1,student].',$threshold).' '.&mt('Contact the LON-CAPA [_1]Helpdesk[_2] if you need the threshold to be changed for this course.','$title}; } elsif ($single_response) { @@ -778,6 +802,9 @@ sub prepare_excel_output { my %start_col; foreach my $prob (@$Problems) { my $title = $prob->compTitle; + unless (&Apache::loncommon::needs_gci_custom()) { + ($title) = ($prob->src =~ m{/([^/]+)$}); + } $worksheet->write($title_row,$cols_output, $title,$format->{'h3'}); foreach my $partid (@{$prob->parts}) { @@ -819,16 +846,6 @@ sub prepare_excel_output { my $anonid = &Crypt::PasswdMD5::unix_md5_crypt($student->{'username'}, $salt); $anonid = substr($anonid,length($salt)+1); - foreach my $field (@StudentColumns) { - if ($show_named) { - $worksheet->write($student_row,$cols_output++, - $student->{$field}); - } else { - $worksheet->write($student_row,$cols_output++, - $anonid); - } - } - my $last_student_col = $cols_output-1; foreach my $prob (@$Problems) { foreach my $partid (@{$prob->parts}) { my @Response = $prob->responseIds($partid); @@ -878,7 +895,7 @@ sub prepare_excel_output { } } # Fill in the remaining rows with the students data - for (my $row = $student_row+1;$row<$max_row;$row++) { + for (my $row = $student_row;$row<$max_row;$row++) { my $cols = 0; foreach my $field (@StudentColumns) { if ($show_named) { @@ -1052,7 +1069,11 @@ sub prepare_csv_output { foreach my $prob (@$problems) { my %analysis = &Apache::lonstathelpers::get_problem_data($prob->src); $problem_analysis{$prob->src}=\%analysis; - $headers{'problem'}->[$max_column] = $prob->compTitle; + my $title = $prob->compTitle; + unless (&Apache::loncommon::needs_gci_custom()) { + ($title) = ($prob->src =~ m{/([^/]+)$}); + } + $headers{'problem'}->[$max_column] = $title; foreach my $partid (@{$prob->parts}) { $headers{'part'}->[$max_column] = $prob->part_display($partid); my $responses = [$prob->responseIds($partid)]; @@ -1244,7 +1265,19 @@ sub CreateInterface { $prob_status_checkbox .= 'checked="checked" '; } $prob_status_checkbox .= 'value="true" />'; - # + my $anon_checkbox; + unless (&Apache::loncommon::needs_gci_custom()) { + # + # anonymized checkbox + # + $anon_checkbox = ''. &mt('Show problem').' '.$prob_checkbox.'
'. @@ -1255,8 +1288,14 @@ sub CreateInterface { '
'. '
'. - ''; + '
'; + + unless (&Apache::loncommon::needs_gci_custom()) { + $Str .= '
'; + } + $Str .= ''; # $Str .= ''.$output_selector.''; #