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

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

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