[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf /interface lonnavmaps.pm lonquickgrades.pm doc/loncapafiles loncapafiles.lpml

bowersj2 lon-capa-cvs@mail.lon-capa.org
Thu, 14 Nov 2002 21:36:23 -0000


bowersj2		Thu Nov 14 16:36:23 2002 EDT

  Added files:                 
    /loncom/interface	lonquickgrades.pm 

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom	loncapa_apache.conf 
    /loncom/interface	lonnavmaps.pm 
  Log:
  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.
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.188 doc/loncapafiles/loncapafiles.lpml:1.189
--- doc/loncapafiles/loncapafiles.lpml:1.188	Tue Nov 12 21:47:38 2002
+++ doc/loncapafiles/loncapafiles.lpml	Thu Nov 14 16:36:23 2002
@@ -3,7 +3,7 @@
 <!-- loncapafiles.lpml -->
 <!-- Scott Harrison -->
 
-<!-- $Id: loncapafiles.lpml,v 1.188 2002/11/13 02:47:38 harris41 Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.189 2002/11/14 21:36:23 bowersj2 Exp $ -->
 
 <!--
 
@@ -2294,6 +2294,15 @@
 <categoryname>handler</categoryname>
 <description>
 Handles navigational maps.
+</description>
+<status>works/unverified</status>
+</file>
+<file>
+<source>loncom/interface/lonquickgrades.pm</source>
+<target dist='default'>home/httpd/lib/perl/Apache/lonquickgrades.pm</target>
+<categoryname>handler</categoryname>
+<description>
+Student quick grades interface.
 </description>
 <status>works/unverified</status>
 </file>
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.25 loncom/loncapa_apache.conf:1.26
--- loncom/loncapa_apache.conf:1.25	Sat Nov  9 17:11:17 2002
+++ loncom/loncapa_apache.conf	Thu Nov 14 16:36:23 2002
@@ -1,7 +1,7 @@
 ##
 ## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
 ##
-## $Id: loncapa_apache.conf,v 1.25 2002/11/09 22:11:17 albertel Exp $
+## $Id: loncapa_apache.conf,v 1.26 2002/11/14 21:36:23 bowersj2 Exp $
 ##
 ## 1/11/2002 - Scott Harrison
 ## 2/19/2002 - Scott Harrison
@@ -532,6 +532,15 @@
 ErrorDocument     403 /adm/login
 ErrorDocument     406 /adm/roles
 ErrorDocument	  500 /adm/errorhandler
+</Location>
+
+<Location /adm/quickgrades>
+PerlAccessHandler       Apache::lonacc
+SetHandler perl-script
+PerlHandler Apache::lonquickgrades
+ErrorDocument     403 /adm/login
+ErrorDocument     406 /adm/roles
+ErrorDocument     500 /adm/errorhandler
 </Location>
 
 <Location /adm/groupsort>
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.105 loncom/interface/lonnavmaps.pm:1.106
--- loncom/interface/lonnavmaps.pm:1.105	Thu Nov 14 11:51:03 2002
+++ loncom/interface/lonnavmaps.pm	Thu Nov 14 16:36:23 2002
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.105 2002/11/14 16:51:03 bowersj2 Exp $
+# $Id: lonnavmaps.pm,v 1.106 2002/11/14 21:36:23 bowersj2 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -71,7 +71,7 @@
     &Apache::loncommon::no_cache($r);
     $r->send_http_header;
 
-    # Create the nav map the nav map
+    # Create the nav map
     my $navmap = Apache::lonnavmaps::navmap->new(
                         $ENV{"request.course.fn"}.".db",
                         $ENV{"request.course.fn"}."_parms.db", 1, 1);
@@ -435,11 +435,7 @@
                     'symb='.&Apache::lonnet::escape($curRes->symb()).
                     '"';
 
-                my $title = $curRes->title();
-                if (!$title) {
-                    $title = $curRes->src();
-                    $title = substr ($title, rindex($title, "/") + 1);
-                }
+                my $title = $curRes->compTitle();
                 my $partLabel = "";
                 my $newBranchText = "";
 
@@ -530,6 +526,7 @@
                 }
 
                 $r->print("  ${newBranchText}${linkopen}$icon${linkclose}\n");
+                #$r->print($curRes->awarded($part));
 
                 my $curMarkerBegin = "";
                 my $curMarkerEnd = "";
@@ -1782,6 +1779,8 @@
 
 =over 4
 
+=item * B<compTitle>: Returns a "composite title", that is equal to $res->title() if the resource has a title, and is otherwise the last part of the URL (e.g., "problem.problem").
+
 =item * B<ext>: Returns true if the resource is external.
 
 =item * B<goesto>: Returns the "goesto" value from the compiled nav map. (It is likely you want to use B<getNext> instead.)
@@ -1831,7 +1830,15 @@
 }
 sub title { my $self=shift; return $self->navHash("title_", 1); }
 sub to { my $self=shift; return $self->navHash("to_", 1); }
-
+sub compTitle {
+    my $self = shift;
+    my $title = $self->title();
+    if (!$title) {
+        $title = $self->src();
+        $title = substr($title, rindex($title, '/') + 1);
+    }
+    return $title;
+}
 =pod
 
 B<Predicate Testing the Resource>
@@ -1990,6 +1997,10 @@
             $self->parmval("answerdate", $part);
     }
     return $self->parmval("answerdate", $part);
+}
+sub awarded {
+    (my $self, my $part) = @_;
+    return $self->parmval("awarded", $part);
 }
 sub duedate {
     (my $self, my $part) = @_;

Index: loncom/interface/lonquickgrades.pm
+++ loncom/interface/lonquickgrades.pm
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
# $Id:
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
# Created Nov. 14, 2002 by Jeremy Bowers

package Apache::lonquickgrades;

use strict;
use Apache::Constants qw(:common :http);

sub handler {
    my $r = shift;

    &Apache::loncommon::get_unprocessed_cgi($ENV{QUERY_STRING});

    # Handle header-only request
    if ($r->header_only) {
        if ($ENV{'browser.mathml'}) {
            $r->content_type('text/xml');
        } else {
            $r->content_type('text/html');
        }
        $r->send_http_header;
        return OK;
    }

    # Send header, don't cache this page
    if ($ENV{'browser.mathml'}) {
        $r->content_type('text/xml');
    } else {
        $r->content_type('text/html');
    }
    &Apache::loncommon::no_cache($r);
    $r->send_http_header;

    # Create the nav map
    my $navmap = Apache::lonnavmaps::navmap->new(
                        $ENV{"request.course.fn"}.".db",
                        $ENV{"request.course.fn"}."_parms.db", 0, 0);

    if (!defined($navmap)) {
        my $requrl = $r->uri;
        $ENV{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized";
        return HTTP_NOT_ACCEPTABLE;
    }
 
    # Header
    $r->print(&Apache::loncommon::bodytag('Navigate Course Map','',
                                          ''));

    # End navmap using boilerplate

    my $iterator = $navmap->getIterator(undef, undef, undef, 1);
    my $depth = 1;
    $iterator->next(); # ignore first BEGIN_MAP
    my $curRes = $iterator->next();
   
    while ( $depth > 0 ) {
        if ($curRes == $iterator->BEGIN_MAP()) {$depth++;}
        if ($curRes == $iterator->END_MAP()) { $depth--; }

        if (ref($curRes) && $curRes->is_problem()) {
            my $title = $curRes->compTitle();
            $r->print($title . '<br />' . "\n");
        }

        $curRes = $iterator->next();
    }

    $r->print("</body></html>");

    return OK;
}

1;