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

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

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