Annotation of loncom/interface/lonhelper.pm, revision 1.2

1.1       bowersj2    1: # The LearningOnline Network with CAPA
                      2: # .helper XML handler to implement the LON-CAPA helper
                      3: #
                      4: # $Id: lonnavmaps.pm,v 1.160 2003/03/13 20:56:13 albertel Exp $
                      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: # (Page Handler
                     29: #
                     30: # (.helper handler
                     31: #
                     32: 
                     33: package Apache::lonhelper;
1.2     ! bowersj2   34: use Apache::Constants qw(:common);
        !            35: use Apache::File;
        !            36: 
        !            37: BEGIN {
        !            38:     &Apache::lonxml::register('Apache::lonhelper', 
        !            39:                               ('helper'));
        !            40: }
        !            41: 
        !            42: my $r;
        !            43: 
        !            44: sub handler {
        !            45:     $r = shift;
        !            46:     $ENV{'request.uri'} = $r->uri();
        !            47:     my $filename = '/home/httpd/html' . $r->uri();
        !            48:     my $fh = Apache::File->new($filename);
        !            49:     my $file;
        !            50:     read $fh, $file, 1000000000;
        !            51: 
        !            52:     $result = &Apache::lonxml::xmlparse($r, 'helper', $file);
        !            53:                                         
        !            54: 
        !            55:     $r->print("\n\n$result");
        !            56:     return OK;
        !            57: }
        !            58: 
        !            59: sub start_helper {
        !            60:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
        !            61: 
        !            62:     if ($target ne 'helper') {
        !            63:         return '';
        !            64:     }
        !            65:     
        !            66:     return 'Helper started.';
        !            67: }
        !            68: 
        !            69: sub end_helper {
        !            70:     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
        !            71:     
        !            72:     return 'Helper ended.';
        !            73: }
1.1       bowersj2   74: 
                     75: 1;
                     76: 
                     77: __END__

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