File:  [LON-CAPA] / loncom / localize / lonlocalize.pm
Revision 1.1: download - view: text, annotated - select for diffs
Fri Apr 7 22:03:55 2006 UTC (18 years ago) by albertel
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_X, version_2_5_99_1, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_3_X, version_2_3_99_0, version_2_3_2, version_2_3_1, version_2_3_0, version_2_2_X, version_2_2_99_1, version_2_2_99_0, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_12_X, version_2_11_X, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, bz6209-base, bz6209, bz5969, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox, BZ4492-merge, BZ4492-feature_horizontal_radioresponse
- moving handler into seperate file so lonlocal.pm can be used in CGI

    1: # The LearningOnline Network with CAPA
    2: # Localization handler
    3: #
    4: # $Id: lonlocalize.pm,v 1.1 2006/04/07 22:03:55 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: ######################################################################
   29: ######################################################################
   30: 
   31: =pod
   32: 
   33: =head1 NAME
   34: 
   35: Apache::lonlocalize - handler to localize html files
   36: 
   37: =head1 SYNOPSIS
   38: 
   39: When fed a URL it will replace instances of MT{text} with the result of 
   40: &mt(text)
   41: 
   42: 
   43: =cut
   44: 
   45: package Apache::lonlocalize;
   46: 
   47: use strict;
   48: use Apache::Constants qw(:common);
   49: use Apache::lonlocal;
   50: 
   51: # ----------------------------------------------- Handler Routine /adm/localize
   52: sub handler {
   53:     my $r=shift;
   54:     &Apache::lonlocal::get_language_handle($r);
   55:     &Apache::loncommon::content_type($r,'text/html');
   56:     $r->send_http_header;
   57:     return OK if $r->header_only;
   58: 
   59:     my $uri=$r->uri;
   60:     $uri=~s/^\/adm\/localize//;
   61:     my $fn=$Apache::lonnet::perlvar{'lonDocRoot'}.$uri;
   62: 
   63:     my $file=&Apache::lonnet::getfile($fn);
   64:     &Apache::lonlocal::transstatic(\$file);
   65:     $r->print($file);
   66:     return OK;
   67: }
   68: 
   69: 1;
   70: 
   71: __END__

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