Annotation of loncom/publisher/lonconstruct.pm, revision 1.26

1.1       www         1: # The LearningOnline Network with CAPA
1.6       albertel    2: # Construction Space Page Wrapper for Construction
                      3: #
1.26    ! raeburn     4: # $Id: lonconstruct.pm,v 1.25 2004/12/01 17:10:55 albertel Exp $
1.6       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/
1.1       www        27: #
                     28: #
                     29: # (Page Handler
                     30: #
                     31: # (TeX Content Handler
                     32: #
                     33: # 05/29/00,05/30 Gerd Kortemeyer)
                     34: # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23,
                     35: # 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16 Gerd Kortemeyer)
                     36: #
1.3       www        37: # 11/22,11/23,11/28,
                     38: # 03/30/01 Gerd Kortemeyer
1.7       foxr       39: package Apache::lonconstruct;
1.1       www        40: 
                     41: 
                     42: use strict;
1.24      raeburn    43: use Apache::Constants qw(:common :http :methods);
1.7       foxr       44: use Apache::lonnet;
                     45: use Apache::Log ();
1.8       foxr       46: use HTML::Entities();
1.7       foxr       47: 
1.17      taceyjo1   48: my $DEBUG = 0;
1.7       foxr       49: =pod
                     50: 
                     51: =item Debug($request, $message)
                     52: 
                     53:   If debugging is enabled puts out a debuggin message determined by the
                     54:   caller.  The debug message goes to the Apache error log file. Debugging
                     55:   is enabled by ssetting the module global DEBUG variable to nonzero (TRUE).
                     56: 
                     57:  Parameters:
                     58: 
                     59: =over 4
                     60:  
                     61: =item $request - The curretn request operation.
                     62: 
                     63: =item $message - The message to put inthe log file.
                     64: 
                     65: =back
                     66:   
                     67:  Returns:
                     68:    nothing.
                     69: 
                     70: =cut
                     71: 
                     72: sub Debug {
                     73:   
                     74:   # Marshall the parameters.
                     75:   
                     76:   my $r       = shift;
                     77:   my $log     = $r->log;
                     78:   my $message = shift;
                     79:   
                     80:   # Put out the indicated message butonly if DEBUG is false.
                     81:   
                     82:   if ($DEBUG) {
                     83:     $log->debug($message);
                     84:   }
                     85: }
                     86: 
                     87: 
1.1       www        88: # ================================================================ Main Handler
                     89: 
                     90: sub handler {
                     91:    my $r=shift;
                     92: 
                     93: # -------------------------------------------------------------- Build frameset
                     94: 
                     95:    $r->content_type('text/html');
                     96:    $r->send_http_header;
                     97:    return OK if $r->header_only;
                     98: 
                     99:    my $lowerframe=$r->path_info;
1.26    ! raeburn   100:    my $type='file';
        !           101:    if ($lowerframe =~ /\/$/) {
        !           102:        $type = 'dir';
        !           103:    }
1.7       foxr      104:    &Debug($r, "Initial URL for lower frame: ".$lowerframe);
1.1       www       105:    $lowerframe=~s/^\//\/\~/;
1.7       foxr      106:    &Debug($r, "Lower frame URL afer ~ subst: ".$lowerframe);
1.22      albertel  107:    $lowerframe= &HTML::Entities::encode($lowerframe,'<>&"');
1.15      taceyjo1  108:    &Debug($r, "Lower frame URL after quote subst: ".$lowerframe);
1.13      www       109: 
                    110: #
                    111: # Are we forcing edit mode?
                    112: #
                    113: 
                    114:    &Apache::loncommon::get_unprocessed_cgi
                    115:         ($ENV{'QUERY_STRING'},['forceedit']);
                    116:    if ($ENV{'form.forceedit'}) {
                    117:        $lowerframe.='?editmode=Edit&problemmode=EditXML';
1.14      taceyjo1  118:    }	
                    119:    &Apache::loncommon::get_unprocessed_cgi
                    120:         ($ENV{'QUERY_STRING'},['forceColoredit']);
                    121:    if ($ENV{'form.forceColoredit'}) {
                    122:        $lowerframe.='?editmode=Edit&problemmode=Edit';
1.13      www       123:    }
1.23      raeburn   124: 
                    125: #
                    126: # Checking to see if we should display the topframe
                    127: #
                    128:    my $toprows = 0;
                    129:    my $topsrc = '';
1.25      albertel  130:    if ($ENV{'environment.remote'} ne 'off') {
1.23      raeburn   131:        $toprows = '110';
1.26    ! raeburn   132:        $topsrc = '/adm/pubmenu?disp='.$type;
1.23      raeburn   133:    }
1.1       www       134:    $r->print(<<ENDPAGE);
                    135: <html>
1.12      www       136: <head><title>LON-CAPA Construction Space</title>
                    137: <script language="JavaScript">
                    138: var lastknownpriv="$lowerframe";
                    139: </script>
                    140: </head>
1.23      raeburn   141: <frameset rows="$toprows,*" border="0">
                    142: <frame src='$topsrc'>
1.7       foxr      143: <frame src="$lowerframe" name="LONCAPAToBePublished">
1.1       www       144: </frameset>
                    145: </html>
                    146: ENDPAGE
                    147:    return OK;
                    148: }
                    149: 1;
                    150: __END__
                    151: 

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