[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm lonhtmlcommon.pm lonstatistics.pm /interface/statistics lonstudentassessment.pm
stredwic
lon-capa-cvs@mail.lon-capa.org
Fri, 26 Jul 2002 16:22:09 -0000
This is a MIME encoded message
--stredwic1027700529
Content-Type: text/plain
stredwic Fri Jul 26 12:22:09 2002 EDT
Modified files:
/loncom/interface loncoursedata.pm lonhtmlcommon.pm
lonstatistics.pm
/loncom/interface/statistics lonstudentassessment.pm
Log:
Added section selection. I added a new multiselect box for sections. All
students without a section number or a space or undefined will fall under
the none category. A list of possible sections for a course will be displayed.
Only students with a section number matching one of the selected sections
will be selectable in the students menu and/or display their report. If
the currently view student doesn't have the correct section when the section
selection changes, the student selection will revert to no student selected.
Note: To refresh the reports after changing which sections to display, press
the refresh button or any of the other onchange interface controls.
--stredwic1027700529
Content-Type: text/plain
Content-Disposition: attachment; filename="stredwic-20020726122209.txt"
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.6 loncom/interface/loncoursedata.pm:1.7
--- loncom/interface/loncoursedata.pm:1.6 Thu Jul 25 17:23:51 2002
+++ loncom/interface/loncoursedata.pm Fri Jul 26 12:22:09 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: loncoursedata.pm,v 1.6 2002/07/25 21:23:51 stredwic Exp $
+# $Id: loncoursedata.pm,v 1.7 2002/07/26 16:22:09 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -106,16 +106,16 @@
my ($courseDomain,$courseNumber)=split(/\_/,$courseID);
my %classlist;
-# my $modifiedTime = &GetFileTimestamp($courseDomain, $courseNumber,
-# 'classlist.db',
-# $Apache::lonnet::perlvar{'lonUsersDir'});
-
-# if($lastDownloadTime ne 'Not downloaded' &&
-# $lastDownloadTime >= $modifiedTime && $modifiedTime >= 0) {
-# $classlist{'lastDownloadTime'}=time;
-# $classlist{'UpToDate'} = 'true';
-# return \%classlist;
-# }
+ my $modifiedTime = &GetFileTimestamp($courseDomain, $courseNumber,
+ 'classlist.db',
+ $Apache::lonnet::perlvar{'lonUsersDir'});
+
+ if($lastDownloadTime ne 'Not downloaded' &&
+ $lastDownloadTime >= $modifiedTime && $modifiedTime >= 0) {
+ $classlist{'lastDownloadTime'}=time;
+ $classlist{'UpToDate'} = 'true';
+ return \%classlist;
+ }
%classlist=&Apache::lonnet::dump('classlist',$courseDomain, $courseNumber);
my ($checkForError)=keys (%classlist);
@@ -186,14 +186,15 @@
my %courseData;
my ($name,$domain) = split(/\:/,$namedata);
-# my $modifiedTime = &GetFileTimestamp($domain, $name,
-# $courseID.'.db',
-# $Apache::lonnet::perlvar{'lonUsersDir'});
-# if($lastDownloadTime >= $modifiedTime) {
-# $courseData{'lastDownloadTime'}=time;
-# $courseData{'UpToDate'} = 'true';
-# return \%courseData;
-# }
+ my $modifiedTime = &GetFileTimestamp($domain, $name,
+ $courseID.'.db',
+ $Apache::lonnet::perlvar{'lonUsersDir'});
+
+ if($lastDownloadTime >= $modifiedTime) {
+ $courseData{'lastDownloadTime'}=time;
+ $courseData{'UpToDate'} = 'true';
+ return \%courseData;
+ }
# Download course data
%courseData=&Apache::lonnet::dump($courseID, $domain, $name);
@@ -559,6 +560,17 @@
}
$cache->{$name.':Status'}=$status;
$cache->{$name.':section'}=$sec;
+
+ if($sec eq '' || !defined($sec) || $sec eq ' ') {
+ $sec = 'none';
+ }
+ if(defined($cache->{'sectionList'})) {
+ if($cache->{'sectionList'} !~ /(^$sec:|^$sec$|:$sec$|:$sec:)/) {
+ $cache->{'sectionList'} .= ':'.$sec;
+ }
+ } else {
+ $cache->{'sectionList'} = $sec;
+ }
}
$cache->{'ClasslistTimestamp'}=time;
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.4 loncom/interface/lonhtmlcommon.pm:1.5
--- loncom/interface/lonhtmlcommon.pm:1.4 Thu Jul 25 17:23:51 2002
+++ loncom/interface/lonhtmlcommon.pm Fri Jul 26 12:22:09 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.4 2002/07/25 21:23:51 stredwic Exp $
+# $Id: lonhtmlcommon.pm,v 1.5 2002/07/26 16:22:09 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -120,6 +120,26 @@
$Str .= '</select>'."\n";
}
+sub MultipleSectionSelect {
+ my ($sections,$selectedSections)=@_;
+
+ my $Str = '';
+ $Str .= '<select name="Section" multiple="" size="4">'."\n";
+
+ foreach (@$sections) {
+ $Str .= '<option';
+ foreach my $selected (@$selectedSections) {
+ if($_ eq $selected) {
+ $Str .= ' selected=""';
+ }
+ }
+ $Str .= '>'.$_.'</option>'."\n";
+ }
+ $Str .= '</select>'."\n";
+
+ return $Str;
+}
+
sub Title {
my ($pageName)=@_;
@@ -135,45 +155,6 @@
$Str .= '</h1></td><td align="right">'."\n";
$Str .= '<img align="right" src=/adm/lonIcons/lonlogos.gif>';
$Str .= '</td></tr></table>'."\n";
-# $Str .= '<h3>Current Time: '.localtime(time).'</h3><br><br><br>'."\n";
-
- return $Str;
-}
-
-sub CreateStatisticsMainMenu {
- my ($status, $reports)=@_;
-
- my $Str = '';
-
- $Str .= '<table border="0"><tbody><tr>'."\n";
- $Str .= '<td></td><td></td>'."\n";
- $Str .= '<td align="center"><b>Analysis Reports:</b></td>'."\n";
- $Str .= '<td align="center"><b>Student Status:</b></td></tr>'."\n";
- $Str .= '<tr>'."\n";
- $Str .= '<td align="center"><input type="submit" name="Refresh" ';
- $Str .= 'value="Refresh" /></td>'."\n";
- $Str .= '<td align="center"><input type="submit" name="DownloadAll" ';
- $Str .= 'value="Update All Student Data" /></td>'."\n";
- $Str .= '<td align="center">';
- $Str .= '<select name="reportSelected" onchange="document.';
- $Str .= 'Statistics.submit()">'."\n";
-
- foreach (sort(keys(%$reports))) {
- next if($_ eq 'reportSelected');
- $Str .= '<option name="'.$_.'"';
- if($reports->{'reportSelected'} eq $reports->{$_}) {
- $Str .= ' selected=""';
- }
- $Str .= '>'.$reports->{$_}.'</option>'."\n";
- }
- $Str .= '</select></td>'."\n";
-
- $Str .= '<td align="center">';
- $Str .= &StatusOptions($status, 'Statistics');
- $Str .= '</td>'."\n";
-
- $Str .= '</tr></tbody></table>'."\n";
- $Str .= '<hr>'."\n";
return $Str;
}
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.32 loncom/interface/lonstatistics.pm:1.33
--- loncom/interface/lonstatistics.pm:1.32 Thu Jul 25 17:23:51 2002
+++ loncom/interface/lonstatistics.pm Fri Jul 26 12:22:09 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonstatistics.pm,v 1.32 2002/07/25 21:23:51 stredwic Exp $
+# $Id: lonstatistics.pm,v 1.33 2002/07/26 16:22:09 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -99,6 +99,15 @@
$cache->{'StudentAssessmentStudent'} =
&Apache::lonnet::unescape($cache->{'StudentAssessmentStudent'});
+ if(defined($ENV{'form.Section'})) {
+ my @sectionsSelected = (ref($ENV{'form.Section'}) ?
+ @{$ENV{'form.Section'}} :
+ ($ENV{'form.Section'}));
+ $cache->{'sectionsSelected'} = join(':', @sectionsSelected);
+ } elsif(!defined($cache->{'sectionsSelected'})) {
+ $cache->{'sectionsSelected'} = $cache->{'sectionList'};
+ }
+
foreach (keys(%ENV)) {
if(/form\.Analyze:::/) {
# $cache->{'reportSelected'} = 'Analyze';
@@ -459,6 +468,44 @@
return $Str;
}
+sub CreateMainMenu {
+ my ($status, $reports)=@_;
+
+ my $Str = '';
+
+ $Str .= '<table border="0"><tbody><tr>'."\n";
+ $Str .= '<td></td><td></td>'."\n";
+ $Str .= '<td align="center"><b>Analysis Reports:</b></td>'."\n";
+ $Str .= '<td align="center"><b>Student Status:</b></td></tr>'."\n";
+ $Str .= '<tr>'."\n";
+ $Str .= '<td align="center"><input type="submit" name="Refresh" ';
+ $Str .= 'value="Refresh" /></td>'."\n";
+ $Str .= '<td align="center"><input type="submit" name="DownloadAll" ';
+ $Str .= 'value="Update All Student Data" /></td>'."\n";
+ $Str .= '<td align="center">';
+ $Str .= '<select name="reportSelected" onchange="document.';
+ $Str .= 'Statistics.submit()">'."\n";
+
+ foreach (sort(keys(%$reports))) {
+ next if($_ eq 'reportSelected');
+ $Str .= '<option name="'.$_.'"';
+ if($reports->{'reportSelected'} eq $reports->{$_}) {
+ $Str .= ' selected=""';
+ }
+ $Str .= '>'.$reports->{$_}.'</option>'."\n";
+ }
+ $Str .= '</select></td>'."\n";
+
+ $Str .= '<td align="center">';
+ $Str .= &Apache::lonhtmlcommon::StatusOptions($status, 'Statistics');
+ $Str .= '</td>'."\n";
+
+ $Str .= '</tr></tbody></table>'."\n";
+ $Str .= '<hr>'."\n";
+
+ return $Str;
+}
+
sub BuildStatistics {
my ($r)=@_;
@@ -502,9 +549,7 @@
$r->print(&Apache::lonhtmlcommon::Title('LON-CAPA Statistics'));
$r->print('<form name="Statistics" ');
$r->print('method="post" action="/adm/statistics">');
- $r->print(&Apache::lonhtmlcommon::CreateStatisticsMainMenu(
- $cache{'Status'},
- \%reports));
+ $r->print(&CreateMainMenu($cache{'Status'}, \%reports));
untie(%cache);
} else {
$r->print('<html><body>Unable to tie database.</body></html>');
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.2 loncom/interface/statistics/lonstudentassessment.pm:1.3
--- loncom/interface/statistics/lonstudentassessment.pm:1.2 Thu Jul 25 17:23:51 2002
+++ loncom/interface/statistics/lonstudentassessment.pm Fri Jul 26 12:22:09 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonstudentassessment.pm,v 1.2 2002/07/25 21:23:51 stredwic Exp $
+# $Id: lonstudentassessment.pm,v 1.3 2002/07/26 16:22:09 stredwic Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -51,6 +51,31 @@
$r->print('<html><body>Unable to tie database.</body></html>');
return;
}
+
+ # Remove students who don't have the proper section.
+ my @sectionsSelected = split(':',$cache{'sectionsSelected'});
+ for(my $studentIndex=((scalar @$students)-1); $studentIndex>=0;
+ $studentIndex--) {
+ my $value = $cache{$students->[$studentIndex].':section'};
+ my $found = 0;
+ foreach (@sectionsSelected) {
+ if($_ eq 'none') {
+ if($value eq '' || !defined($value) || $value eq ' ') {
+ $found = 1;
+ last;
+ }
+ } else {
+ if($value eq $_) {
+ $found = 1;
+ last;
+ }
+ }
+ }
+ if($found == 0) {
+ splice(@$students, $studentIndex, 1);
+ }
+ }
+
my $selectedName = &FindSelectedStudent(\%cache,
$cache{'StudentAssessmentStudent'},
$students);
@@ -83,10 +108,10 @@
untie(%cache);
$courseData =
&Apache::loncoursedata::DownloadCourseInformation($_,
- $courseID);
+ $courseID);
if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) {
&Apache::loncoursedata::ProcessStudentData(\%cache,
- $courseData, $_);
+ $courseData, $_);
untie(%cache);
} else {
last if($c->aborted());
@@ -142,6 +167,16 @@
$Ptr .= '<input type="submit" name="NextStudent" ';
$Ptr .= 'value="Next Student" />'."\n";
$Ptr .= '</td></tr></table>'."\n";
+ $Ptr .= '<table><tr><td align="center"><b>Select Sections</b>';
+ $Ptr .= '</td></tr>'."\n";
+
+ $Ptr .= '<tr><td align="center">'."\n";
+ my @sections = split(':',$cache->{'sectionList'});
+ my @selectedSections = split(':',$cache->{'sectionsSelected'});
+ $Ptr .= &Apache::lonhtmlcommon::MultipleSectionSelect(\@sections,
+ \@selectedSections,
+ 'Statistics');
+ $Ptr .= '</td></tr></table>'."\n";
return $Ptr;
}
@@ -151,7 +186,7 @@
$sequenceHeadings)=@_;
my $Str = '';
- $Str .= '<br><table border="0" cellpadding="0" cellspacing="0"><tr>'."\n";
+ $Str .= '<table border="0" cellpadding="0" cellspacing="0"><tr>'."\n";
my $displayString = '<td align="left"><pre><a href="/adm/statistics?';
$displayString .= 'sort=LINKDATA">DISPLAYDATA</a>FORMATTING';
@@ -501,31 +536,40 @@
sub FindSelectedStudent {
my($cache, $selectedName, $students)=@_;
- for(my $index=0;
- ($selectedName ne 'All Students') && ($index<(scalar @$students));
- $index++) {
+
+ if($selectedName eq 'All Students' ||
+ $selectedName eq 'No Student Selected') {
+ return $selectedName;
+ }
+
+ for(my $index=0; $index<(scalar @$students); $index++) {
my $fullname = $cache->{$students->[$index].':fullname'};
if($fullname eq $selectedName) {
if($cache->{'StudentAssessmentMove'} eq 'next') {
if($index == ((scalar @$students) - 1)) {
$selectedName = $students->[0];
+ return $selectedName;
} else {
$selectedName = $students->[$index+1];
+ return $selectedName;
}
} elsif($cache->{'StudentAssessmentMove'} eq 'previous') {
if($index == 0) {
$selectedName = $students->[-1];
+ return $selectedName;
} else {
$selectedName = $students->[$index-1];
+ return $selectedName;
}
} else {
$selectedName = $students->[$index];
+ return $selectedName;
}
last;
}
}
- return $selectedName;
+ return 'No Student Selected';
}
=pod
--stredwic1027700529--