File:  [LON-CAPA] / loncom / interface / lonquickgrades.pm
Revision 1.1: download - view: text, annotated - select for diffs
Thu Nov 14 21:36:23 2002 UTC (21 years, 6 months ago) by bowersj2
Branches: MAIN
CVS tags: HEAD
Added a shell of the new student grades interface. Right now,
/adm/quickgrades just prints a list of all problems in the given course,
to be extended later.

Also a small change in navmaps to add a method for the "composite title",
which is the title if it exists, or the last part of the URL if not.

    1: # The LearningOnline Network with CAPA
    2: # Quick Student Grades Display
    3: #
    4: # $Id:
    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: # Created Nov. 14, 2002 by Jeremy Bowers
   29: 
   30: package Apache::lonquickgrades;
   31: 
   32: use strict;
   33: use Apache::Constants qw(:common :http);
   34: 
   35: sub handler {
   36:     my $r = shift;
   37: 
   38:     &Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});
   39: 
   40:     # Handle header-only request
   41:     if ($r->header_only) {
   42:         if ($ENV{'browser.mathml'}) {
   43:             $r->content_type('text/xml');
   44:         } else {
   45:             $r->content_type('text/html');
   46:         }
   47:         $r->send_http_header;
   48:         return OK;
   49:     }
   50: 
   51:     # Send header, don't cache this page
   52:     if ($ENV{'browser.mathml'}) {
   53:         $r->content_type('text/xml');
   54:     } else {
   55:         $r->content_type('text/html');
   56:     }
   57:     &Apache::loncommon::no_cache($r);
   58:     $r->send_http_header;
   59: 
   60:     # Create the nav map
   61:     my $navmap = Apache::lonnavmaps::navmap->new(
   62:                         $ENV{"request.course.fn"}.".db",
   63:                         $ENV{"request.course.fn"}."_parms.db", 0, 0);
   64: 
   65:     if (!defined($navmap)) {
   66:         my $requrl = $r->uri;
   67:         $ENV{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized";
   68:         return HTTP_NOT_ACCEPTABLE;
   69:     }
   70:  
   71:     # Header
   72:     $r->print(&Apache::loncommon::bodytag('Navigate Course Map','',
   73:                                           ''));
   74: 
   75:     # End navmap using boilerplate
   76: 
   77:     my $iterator = $navmap->getIterator(undef, undef, undef, 1);
   78:     my $depth = 1;
   79:     $iterator->next(); # ignore first BEGIN_MAP
   80:     my $curRes = $iterator->next();
   81:    
   82:     while ( $depth > 0 ) {
   83:         if ($curRes == $iterator->BEGIN_MAP()) {$depth++;}
   84:         if ($curRes == $iterator->END_MAP()) { $depth--; }
   85: 
   86:         if (ref($curRes) && $curRes->is_problem()) {
   87:             my $title = $curRes->compTitle();
   88:             $r->print($title . '<br />' . "\n");
   89:         }
   90: 
   91:         $curRes = $iterator->next();
   92:     }
   93: 
   94:     $r->print("</body></html>");
   95: 
   96:     return OK;
   97: }
   98: 
   99: 1;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>