File:  [LON-CAPA] / loncom / publisher / Attic / lonconstruct.pm
Revision 1.35: download - view: text, annotated - select for diffs
Wed Nov 19 19:15:02 2008 UTC (15 years, 6 months ago) by jms
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_99_1, version_2_8_99_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, bz6209-base, bz6209, bz5969, bz2851, HEAD, GCI_3, GCI_2, BZ5971-printing-apage, BZ5434-fox
Added POD comments

    1: # The LearningOnline Network with CAPA
    2: # Construction Space Page Wrapper for Construction
    3: #
    4: # $Id: lonconstruct.pm,v 1.35 2008/11/19 19:15:02 jms 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
   34: 
   35: =head1 NAME
   36: 
   37: Apache::lonconstruct
   38: 
   39: =head1 SYNOPSIS
   40: 
   41: Page wrapper for handling construction space.
   42: 
   43: This is part of the LearningOnline Network with CAPA project
   44: described at http://www.lon-capa.org.
   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: 
   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: 
   79: sub Debug {
   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: } 
   86: 
   87: # ================================================================ Main Handler
   88: 
   89: sub handler {
   90:    my $r=shift;
   91: 
   92: # -------------------------------------------------------------- Build frameset
   93: 
   94:    &Apache::loncommon::content_type($r,'text/html');
   95:    $r->send_http_header;
   96:    return OK if $r->header_only;
   97: 
   98:    my $lowerframe=$r->path_info;
   99:    &Debug($r, "Initial URL for lower frame: ".$lowerframe);
  100:    $lowerframe=~s/^\//\/\~/;
  101:    &Debug($r, "Lower frame URL afer ~ subst: ".$lowerframe);
  102:    $lowerframe= &HTML::Entities::encode($lowerframe,'<>&"');
  103:    &Debug($r, "Lower frame URL after quote subst: ".$lowerframe);
  104: 
  105: #
  106: # Are we forcing edit mode?
  107: #
  108: 
  109:    &Apache::loncommon::get_unprocessed_cgi
  110:         ($ENV{'QUERY_STRING'},['forceedit']);
  111:    if ($env{'form.forceedit'}) {
  112:        $lowerframe.='?editmode=Edit&problemmode=editxml';
  113:    }	
  114:    &Apache::loncommon::get_unprocessed_cgi
  115:         ($ENV{'QUERY_STRING'},['forceColoredit']);
  116:    if ($env{'form.forceColoredit'}) {
  117:        $lowerframe.='?editmode=Edit&problemmode=edit';
  118:    }
  119: 
  120: #
  121: # Checking to see if we should display the topframe
  122: #
  123:    my $toprows = 0;
  124:    my $topsrc = '';
  125:    if ($env{'environment.remote'} ne 'off') {
  126:        $toprows = '110';
  127:        $topsrc = '/adm/localize/adm/publisher.html';
  128:    }
  129: 
  130:    my $js=qq|
  131: <script type="text/javascript">
  132: var lastknownpriv="$lowerframe";
  133: </script>
  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
  147: <frame src='$topsrc' />
  148: <frame src="$lowerframe" name="LONCAPAToBePublished" />
  149: $end_page
  150: ENDPAGE
  151:    return OK;
  152: }
  153: 1;
  154: __END__
  155: 

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