File:  [LON-CAPA] / loncom / publisher / Attic / lonconstruct.pm
Revision 1.34: download - view: text, annotated - select for diffs
Sun Feb 3 01:11:01 2008 UTC (16 years, 3 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_8_X, 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, HEAD, GCI_1
Bug 5607

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

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