Annotation of loncom/interface/lonstatistics.pm, revision 1.32
1.1 albertel 1: # The LearningOnline Network with CAPA
2: # (Publication Handler
3: #
1.32 ! stredwic 4: # $Id: lonstatistics.pm,v 1.31 2002/07/25 19:30:24 minaeibi Exp $
1.1 albertel 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
28: # (Navigate problems for statistical reports
29: # YEAR=2001
1.15 minaeibi 30: # 5/5,7/9,7/25/1,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei
1.14 minaeibi 31: # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
1.1 albertel 32: # YEAR=2002
1.18 minaeibi 33: # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei
1.31 minaeibi 34: # 5/12,5/14,5/15,5/19,5/26,7/16,25/7 Behrouz Minaei
1.14 minaeibi 35: #
1.1 albertel 36: ###
37:
1.3 minaeibi 38: package Apache::lonstatistics;
1.1 albertel 39:
1.30 stredwic 40: use strict;
1.1 albertel 41: use Apache::Constants qw(:common :http);
42: use Apache::lonnet();
43: use Apache::lonhomework;
1.12 minaeibi 44: use Apache::loncommon;
1.29 stredwic 45: use Apache::loncoursedata;
46: use Apache::lonhtmlcommon;
1.30 stredwic 47: use Apache::lonproblemanalysis;
48: use Apache::lonproblemstatistics;
49: use Apache::lonstudentassessment;
1.29 stredwic 50: use Apache::lonchart;
1.1 albertel 51: use HTML::TokeParser;
52: use GDBM_File;
53:
1.27 stredwic 54:
55: sub CheckFormElement {
56: my ($cache, $ENVName, $cacheName, $default)=@_;
57:
58: if(defined($ENV{'form.'.$ENVName})) {
59: $cache->{$cacheName} = $ENV{'form.'.$ENVName};
60: } elsif(!defined($cache->{$cacheName})) {
61: $cache->{$cacheName} = $default;
62: }
63:
64: return;
65: }
66:
67: sub ProcessFormData{
1.29 stredwic 68: my ($cache)=@_;
1.27 stredwic 69:
1.29 stredwic 70: $cache->{'reportKey'} = 'false';
1.27 stredwic 71:
1.29 stredwic 72: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
1.30 stredwic 73: ['sort','download','reportSelected',
74: 'StudentAssessmentStudent']);
1.29 stredwic 75: &CheckFormElement($cache, 'Status', 'Status', 'Active');
76: &CheckFormElement($cache, 'postdata', 'reportSelected', 'Class list');
77: &CheckFormElement($cache, 'reportSelected', 'reportSelected',
78: 'Class list');
1.30 stredwic 79: $cache->{'reportSelected'} =
80: &Apache::lonnet::unescape($cache->{'reportSelected'});
1.29 stredwic 81: &CheckFormElement($cache, 'DownloadAll', 'DownloadAll', 'false');
82: &CheckFormElement($cache, 'sort', 'sort', 'fullname');
83: &CheckFormElement($cache, 'download', 'download', 'false');
84:
85: if(defined($ENV{'form.CreateStudentAssessment'}) ||
86: defined($ENV{'form.NextStudent'}) ||
87: defined($ENV{'form.PreviousStudent'})) {
88: $cache->{'reportSelected'} = 'Student Assessment';
89: }
90: if(defined($ENV{'form.NextStudent'})) {
91: $cache->{'StudentAssessmentMove'} = 'next';
92: } elsif(defined($ENV{'form.PreviousStudent'})) {
93: $cache->{'StudentAssessmentMove'} = 'previous';
94: } else {
95: $cache->{'StudentAssessmentMove'} = 'selected';
96: }
97: &CheckFormElement($cache, 'StudentAssessmentStudent',
1.30 stredwic 98: 'StudentAssessmentStudent', 'All Students');
99: $cache->{'StudentAssessmentStudent'} =
100: &Apache::lonnet::unescape($cache->{'StudentAssessmentStudent'});
1.29 stredwic 101:
102: foreach (keys(%ENV)) {
103: if(/form\.Analyze:::/) {
104: # $cache->{'reportSelected'} = 'Analyze';
105: # $cache->{'reportKey'} = 'Problem Analysis';
106: my ($uri, $title, $part, $problem);
107: (undef, $uri, $title, $part, $problem)=split(':::', $_);
108: $cache->{'AnalyzeURI'} = $uri;
109: $cache->{'AnalyzeTitle'} = $title;
110: $cache->{'AnalyzePart'} = $part;
111: $cache->{'AnalyzeProblem'} = $problem;
112:
113: &CheckFormElement($cache, 'Interval', 'Interval', '1');
1.27 stredwic 114: }
1.29 stredwic 115: }
1.27 stredwic 116:
1.29 stredwic 117: return;
1.27 stredwic 118:
1.29 stredwic 119: # Select page to display
120: if(defined($ENV{'form.ProblemStatistics'}) ||
121: defined($ENV{'form.ProblemStatisticsRecalculate'}) ||
122: defined($ENV{'form.DisplayCSVFormat'})) {
123: $cache->{'GoToPage'} = 'ProblemStatistics';
124: &CheckFormElement($cache, 'DisplayCSVFormat',
125: 'DisplayFormat', 'Display Table Format');
126: &CheckFormElement($cache, 'Ascend','ProblemStatisticsAscend',
127: 'Ascending');
128: &CheckFormElement($cache, 'Maps', 'ProblemStatisticsMap',
129: 'All Maps');
130: } elsif(defined($ENV{'form.ProblemAnalysis'})) {
131: $cache->{'GoToPage'} = 'ProblemAnalysis';
132: &CheckFormElement($cache, 'Interval', 'Interval', '1');
133: } elsif(defined($ENV{'form.DoDiffGraph'})) {
134: $cache->{'GoToPage'} = 'DoDiffGraph';
135: } elsif(defined($ENV{'form.PercentWrongGraph'})) {
136: $cache->{'GoToPage'} = 'PercentWrongGraph';
137: } elsif(defined($ENV{'form.ActivityLog'})) {
138: $cache->{'GoToPage'} = 'ActivityLog';
139: } else {
140: $cache->{'GoToPage'} = 'Menu';
141: }
1.27 stredwic 142:
1.29 stredwic 143: &CheckFormElement($cache, 'Status', 'Status', 'Active');
1.27 stredwic 144:
145: return;
146: }
147:
148: =pod
149:
150: =item &SortStudents()
151:
152: Determines which students to display and in which order. Which are
153: displayed are determined by their status(active/expired). The order
154: is determined by the sort button pressed (default to username). The
155: type of sorting is username, lastname, or section.
156:
157: =over 4
158:
159: Input: $students, $CacheData
160:
161: $students: A array pointer to a list of students (username:domain)
162:
163: $CacheData: A pointer to the hash tied to the cached data
164:
165: Output: \@order
166:
167: @order: An ordered list of students (username:domain)
168:
169: =back
170:
171: =cut
172:
173: sub SortStudents {
1.29 stredwic 174: my ($cache)=@_;
1.27 stredwic 175:
1.29 stredwic 176: my @students = split(':::',$cache->{'NamesOfStudents'});
1.27 stredwic 177: my @sorted1Students=();
1.29 stredwic 178: foreach (@students) {
179: if($cache->{'Status'} eq 'Any' ||
180: $cache->{$_.':Status'} eq $cache->{'Status'}) {
181: push(@sorted1Students, $_);
182: }
1.1 albertel 183: }
1.27 stredwic 184:
1.29 stredwic 185: my $sortBy = '';
186: if(defined($cache->{'sort'})) {
187: $sortBy = ':'.$cache->{'sort'};
1.27 stredwic 188: }
1.29 stredwic 189: my @order = sort { $cache->{$a.$sortBy} cmp $cache->{$b.$sortBy} ||
190: $cache->{$a.':fullname'} cmp $cache->{$b.':fullname'} }
191: @sorted1Students;
1.27 stredwic 192:
193: return \@order;
194: }
195:
1.32 ! stredwic 196: =pod
! 197:
! 198: =item &SpaceColumns()
! 199:
! 200: Determines the width of all the columns in the chart. It is based on
! 201: the max of the data for that column and its header.
! 202:
! 203: =over 4
! 204:
! 205: Input: $students, $studentInformation, $headings, $ChartDB
! 206:
! 207: $students: An array pointer to a list of students (username:domain)
! 208:
! 209: $studentInformatin: The type of data for the student information. It is
! 210: used as part of the key in $CacheData.
! 211:
! 212: $headings: The name of the student information columns.
! 213:
! 214: $ChartDB: The name of the cache database which is opened for read/write.
! 215:
! 216: Output: None - All data stored in cache.
! 217:
! 218: =back
! 219:
! 220: =cut
! 221:
! 222: sub SpaceColumns {
! 223: my ($students,$studentInformation,$headings,$cache)=@_;
! 224:
! 225: # Initialize Lengths
! 226: for(my $index=0; $index<(scalar @$headings); $index++) {
! 227: my @titleLength=split(//,$headings->[$index]);
! 228: $cache->{$studentInformation->[$index].':columnWidth'}=
! 229: scalar @titleLength;
! 230: }
! 231:
! 232: foreach my $name (@$students) {
! 233: foreach (@$studentInformation) {
! 234: my @dataLength=split(//,$cache->{$name.':'.$_});
! 235: my $length=(scalar @dataLength);
! 236: if($length > $cache->{$_.':columnWidth'}) {
! 237: $cache->{$_.':columnWidth'}=$length;
! 238: }
! 239: }
! 240: }
! 241:
! 242: return;
! 243: }
! 244:
1.27 stredwic 245: sub PrepareData {
1.32 ! stredwic 246: my ($c, $cacheDB, $studentInformation, $headings)=@_;
1.27 stredwic 247:
248: # Test for access to the cache data
249: my $courseID=$ENV{'request.course.id'};
250: my $isRecalculate=0;
1.29 stredwic 251: if(defined($ENV{'form.Recalculate'})) {
1.27 stredwic 252: $isRecalculate=1;
253: }
254:
1.29 stredwic 255: my $isCached = &Apache::loncoursedata::TestCacheData($cacheDB,
256: $isRecalculate);
1.27 stredwic 257: if($isCached < 0) {
258: return "Unable to tie hash to db file.";
259: }
260:
261: # Download class list information if not using cached data
262: my %cache;
1.29 stredwic 263: unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) {
264: return "Unable to tie hash to db file.";
265: }
266:
1.27 stredwic 267: if(!$isCached) {
268: my $processTopResourceMapReturn=
269: &Apache::loncoursedata::ProcessTopResourceMap(\%cache, $c);
270: if($processTopResourceMapReturn ne 'OK') {
271: untie(%cache);
272: return $processTopResourceMapReturn;
273: }
1.29 stredwic 274: }
1.27 stredwic 275:
1.29 stredwic 276: if($c->aborted()) {
277: untie(%cache);
278: return 'aborted';
279: }
1.27 stredwic 280:
1.29 stredwic 281: my $classlist=&Apache::loncoursedata::DownloadClasslist($courseID,
282: $cache{'ClasslistTimestamp'},
283: $c);
284: foreach (keys(%$classlist)) {
285: if(/^(con_lost|error|no_such_host)/i) {
1.27 stredwic 286: untie(%cache);
287: return "Error getting student data.";
288: }
1.29 stredwic 289: }
1.27 stredwic 290:
1.29 stredwic 291: if($c->aborted()) {
292: untie(%cache);
293: return 'aborted';
294: }
295:
296: # Active is a temporary solution, remember to change
297: Apache::loncoursedata::ProcessClasslist(\%cache,$classlist,$courseID,$c);
298: if($c->aborted()) {
299: untie(%cache);
300: return 'aborted';
301: }
1.27 stredwic 302:
1.29 stredwic 303: &ProcessFormData(\%cache);
304: my $students = &SortStudents(\%cache);
1.32 ! stredwic 305: &SpaceColumns($students, $studentInformation, $headings, \%cache);
! 306: $cache{'updateTime:columnWidth'}=24;
1.27 stredwic 307:
1.29 stredwic 308: if($cache{'download'} ne 'false') {
309: my $who = $cache{'download'};
310: my $courseData =
1.30 stredwic 311: &Apache::loncoursedata::DownloadCourseInformation(
1.29 stredwic 312: $who, $courseID,
313: $cache{$who.':lastDownloadTime'});
314: &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, $who);
315: $cache{'download'} = 'false';
316: } elsif($cache{'DownloadAll'} ne 'false') {
317: my @allStudents;
318: if($cache{'DownloadAll'} eq 'sorted') {
319: @allStudents = @$students;
320: } else {
321: @allStudents = split(':::', $cache{'NamesOfStudents'});
322: }
323: foreach (@allStudents) {
324: my $courseData =
1.30 stredwic 325: &Apache::loncoursedata::DownloadCourseInformation(
1.29 stredwic 326: $_, $courseID,
327: $cache{$_.':lastDownloadTime'});
328: &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData,
329: $_);
330: if($c->aborted()) {
331: untie(%cache);
332: return 'aborted';
333: }
1.27 stredwic 334: }
1.29 stredwic 335: $cache{'DownloadAll'} = 'false';
336: }
1.27 stredwic 337:
1.29 stredwic 338: if($c->aborted()) {
1.27 stredwic 339: untie(%cache);
1.29 stredwic 340: return 'aborted';
341: }
342:
343: untie(%cache);
344:
345: return ('OK', $students);
1.27 stredwic 346: }
347:
1.31 minaeibi 348:
1.27 stredwic 349: # Create progress
350: sub Create_PrgWin {
1.31 minaeibi 351: my ($r)=@_;
1.27 stredwic 352: $r->print(<<ENDPOP);
353: <script>
354: popwin=open('','popwin','width=400,height=100');
355: popwin.document.writeln('<html><body bgcolor="#88DDFF">'+
356: '<title>LON-CAPA Statistics</title>'+
357: '<h4>Computation Progress</h4>'+
358: '<form name=popremain>'+
359: '<input type=text size=35 name=remaining value=Starting></form>'+
360: '</body></html>');
361: popwin.document.close();
362: </script>
363: ENDPOP
364:
365: $r->rflush();
1.1 albertel 366: }
367:
1.27 stredwic 368: # update progress
369: sub Update_PrgWin {
1.31 minaeibi 370: my ($totalStudents,$index,$name,$r)=@_;
1.27 stredwic 371: $r->print('<script>popwin.document.popremain.remaining.value="'.
372: 'Computing '.$index.'/'.$totalStudents.': '.
373: $name.'";</script>');
374: $r->rflush();
375: }
1.1 albertel 376:
1.27 stredwic 377: # close Progress Line
378: sub Close_PrgWin {
1.31 minaeibi 379: my ($r)=@_;
1.27 stredwic 380: $r->print('<script>popwin.close()</script>');
381: $r->rflush();
1.25 minaeibi 382: }
383:
384: # For loading the colored table for display or un-colored for print
385: sub setbgcolor {
386: my $PrintTable=shift;
1.31 minaeibi 387: my %color;
1.25 minaeibi 388: if ($PrintTable){
389: $color{"gb"}="#FFFFFF";
390: $color{"red"}="#FFFFFF";
391: $color{"yellow"}="#FFFFFF";
392: $color{"green"}="#FFFFFF";
393: $color{"purple"}="#FFFFFF";
394: } else {
395: $color{"gb"}="#DDFFFF";
396: $color{"red"}="#FFDDDD";
397: $color{"yellow"}="#EEFFCC";
398: $color{"green"}="#DDFFDD";
399: $color{"purple"}="#FFDDFF";
400: }
1.27 stredwic 401:
1.31 minaeibi 402: return \%color;
1.1 albertel 403: }
404:
1.29 stredwic 405: sub BuildClasslist {
1.32 ! stredwic 406: my ($cacheDB,$students,$studentInformation,$headings)=@_;
1.29 stredwic 407:
408: my %cache;
409: unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {
410: return '<html><body>Unable to tie database.</body></html>';
1.1 albertel 411: }
412:
1.29 stredwic 413: my $Str='';
414: $Str .= '<table border="0"><tr><td bgcolor="#777777">'."\n";
415: $Str .= '<table border="0" cellpadding="3"><tr bgcolor="#e6ffff">'."\n";
416:
417: my $displayString = '<td align="left"><a href="/adm/statistics?';
418: $displayString .= 'sort=LINKDATA">DISPLAYDATA </a></td>'."\n";
1.32 ! stredwic 419: $Str .= &Apache::lonhtmlcommon::CreateHeadings(\%cache, $studentInformation,
! 420: $headings, $displayString);
1.29 stredwic 421: $Str .= '</tr>'."\n";
422: my $alternate=0;
423: foreach (@$students) {
424: my ($username, $domain) = split(':', $_);
425: if($alternate) {
1.32 ! stredwic 426: $Str .= '<tr bgcolor="#ffffe6">';
1.29 stredwic 427: } else {
1.32 ! stredwic 428: $Str .= '<tr bgcolor="#ffffc6">';
1.29 stredwic 429: }
430: $alternate = ($alternate + 1) % 2;
431: foreach my $data (@$studentInformation) {
1.32 ! stredwic 432: $Str .= '<td>';
1.29 stredwic 433: if($data eq 'fullname') {
434: $Str .= '<a href="/adm/statistics?reportSelected=';
1.30 stredwic 435: $Str .= &Apache::lonnet::escape('Student Assessment');
436: $Str .= '&StudentAssessmentStudent=';
437: $Str .= &Apache::lonnet::escape($cache{$_.':'.$data}).'">';
1.32 ! stredwic 438: $Str .= $cache{$_.':'.$data}.' ';
1.29 stredwic 439: $Str .= '</a>';
1.32 ! stredwic 440: } elsif($data eq 'updateTime') {
! 441: $Str .= '<a href="/adm/statistics?reportSelected=';
! 442: $Str .= &Apache::lonnet::escape('Class list');
! 443: $Str .= '&download='.$_.'">';
! 444: $Str .= $cache{$_.':'.$data}.' ';
! 445: $Str .= ' </a>';
! 446: } else {
! 447: $Str .= $cache{$_.':'.$data}.' ';
1.29 stredwic 448: }
449:
1.32 ! stredwic 450: $Str .= '</td>'."\n";
1.29 stredwic 451: }
1.1 albertel 452: }
1.29 stredwic 453:
1.32 ! stredwic 454: $Str .= '</tr>'."\n";
1.29 stredwic 455: $Str .= '</table></td></tr></table>'."\n";
456:
1.27 stredwic 457: untie(%cache);
1.1 albertel 458:
1.29 stredwic 459: return $Str;
1.1 albertel 460: }
461:
1.29 stredwic 462: sub BuildStatistics {
463: my ($r)=@_;
464:
465: my $c = $r->connection;
1.32 ! stredwic 466: my @studentInformation=('fullname','section','id','domain','username',
! 467: 'updateTime');
! 468: my @headings=('Full Name', 'Section', 'PID', 'Domain', 'User Name',
! 469: 'Last Updated');
! 470: my $spacing = ' ';
1.29 stredwic 471: my %reports = ('classlist' => 'Class list',
472: 'problem_statistics' => 'Problem Statistics',
473: 'student_assessment' => 'Student Assessment',
474: 'reportSelected' => 'Class list');
1.27 stredwic 475:
476: my %cache;
1.29 stredwic 477: my $courseID=$ENV{'request.course.id'};
478: my $cacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
479: "_$ENV{'user.domain'}_$courseID\_statistics.db";
480:
1.31 minaeibi 481: my %color=&setbgcolor(0);
1.32 ! stredwic 482: my ($returnValue, $students) = &PrepareData($c, $cacheDB,
! 483: \@studentInformation,
! 484: \@headings);
1.29 stredwic 485: if($returnValue ne 'OK') {
486: $r->print('<html><body>'.$returnValue."\n".'</body></html>');
487: return OK;
488: }
489:
490: my $GoToPage;
491: if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {
492: $GoToPage = $cache{'reportSelected'};
493: $reports{'reportSelected'} = $cache{'reportSelected'};
494: # if(defined($cache{'reportKey'}) && $cache{'reportKey'} ne 'false') {
495: # $reports{$cache{'reportKey'}} = $cache{'reportSelected'};
496: # }
497:
498: if(defined($cache{'OptionResponses'})) {
499: $reports{'problem_analysis'} = 'Problem Analysis';
500: }
501:
502: $r->print(&Apache::lonhtmlcommon::Title('LON-CAPA Statistics'));
503: $r->print('<form name="Statistics" ');
504: $r->print('method="post" action="/adm/statistics">');
505: $r->print(&Apache::lonhtmlcommon::CreateStatisticsMainMenu(
506: $cache{'Status'},
507: \%reports));
508: untie(%cache);
509: } else {
1.27 stredwic 510: $r->print('<html><body>Unable to tie database.</body></html>');
1.29 stredwic 511: return OK;
512: }
513:
514: if($GoToPage eq 'Activity Log') {
1.30 stredwic 515: &Apache::lonproblemstatistics::Activity();
1.29 stredwic 516: } elsif($GoToPage eq 'Problem Statistics') {
1.30 stredwic 517: $r->print(
518: &Apache::lonproblemstatistics::BuildProblemStatisticsPage($cacheDB,
519: $students,
520: $courseID,
1.31 minaeibi 521: $c,$r,
522: \%color));
1.29 stredwic 523: } elsif($GoToPage eq 'Problem Analysis') {
1.30 stredwic 524: $r->print(
525: &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB));
1.29 stredwic 526: } elsif($GoToPage eq 'Student Assessment') {
1.30 stredwic 527: $r->print(
528: &Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB,
1.32 ! stredwic 529: $students,
! 530: $courseID,
! 531: 'Statistics',
! 532: \@headings,
! 533: $spacing,
! 534: \@studentInformation,
! 535: $r, $c));
1.29 stredwic 536: } elsif($GoToPage eq 'Analyze') {
1.30 stredwic 537: $r->print(&Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB,
538: $students,
539: $courseID));
1.29 stredwic 540: } elsif($GoToPage eq 'DoDiffGraph') {
1.31 minaeibi 541: &Apache::lonproblemstatistics::BuildDiffGraph($r);
1.29 stredwic 542: } elsif($GoToPage eq 'PercentWrongGraph') {
1.31 minaeibi 543: &Apache::lonproblemstatistics::BuildWrongGraph($r);
1.29 stredwic 544: } elsif($GoToPage eq 'Class list') {
545: $r->print(&BuildClasslist($cacheDB, $students, \@studentInformation,
1.32 ! stredwic 546: \@headings));
1.27 stredwic 547: }
548:
549: $r->print('</form>'."\n");
1.29 stredwic 550: $r->print("\n".'</body>'."\n".'</html>');
551: $r->rflush();
1.27 stredwic 552:
1.29 stredwic 553: return OK;
1.27 stredwic 554: }
1.1 albertel 555:
556: # ================================================================ Main Handler
557:
558: sub handler {
1.31 minaeibi 559: my $r=shift;
1.1 albertel 560:
1.27 stredwic 561: unless(&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
562: $ENV{'user.error.msg'}=
563: $r->uri.":vgr:0:0:Cannot view grades for complete course";
564: return HTTP_NOT_ACCEPTABLE;
565: }
566:
567: # Set document type for header only
568: if($r->header_only) {
569: if ($ENV{'browser.mathml'}) {
570: $r->content_type('text/xml');
571: } else {
572: $r->content_type('text/html');
573: }
574: &Apache::loncommon::no_cache($r);
575: $r->send_http_header;
576: return OK;
577: }
578:
579: unless($ENV{'request.course.fn'}) {
1.1 albertel 580: my $requrl=$r->uri;
1.27 stredwic 581: $ENV{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";
582: return HTTP_NOT_ACCEPTABLE;
583: }
1.1 albertel 584:
1.27 stredwic 585: $r->content_type('text/html');
586: $r->send_http_header;
1.1 albertel 587:
1.29 stredwic 588: &BuildStatistics($r);
1.27 stredwic 589:
590: return OK;
1.1 albertel 591: }
592: 1;
593: __END__
1.31 minaeibi 594:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>