--- loncom/publisher/Attic/lonconstruct.pm 2001/12/04 15:34:57 1.6 +++ loncom/publisher/Attic/lonconstruct.pm 2003/10/18 17:18:14 1.16 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construction Space Page Wrapper for Construction # -# $Id: lonconstruct.pm,v 1.6 2001/12/04 15:34:57 albertel Exp $ +# $Id: lonconstruct.pm,v 1.16 2003/10/18 17:18:14 taceyjo1 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,11 +36,56 @@ # # 11/22,11/23,11/28, # 03/30/01 Gerd Kortemeyer - package Apache::lonconstruct; + use strict; -use Apache::Constants qw(:common :http); +use Apache::Constants qw(:common :http :methods); +use Apache::lonnet; +use Apache::Log (); +use HTML::Entities(); + +my $DEBUG = 1; +=pod + +=item Debug($request, $message) + + If debugging is enabled puts out a debuggin message determined by the + caller. The debug message goes to the Apache error log file. Debugging + is enabled by ssetting the module global DEBUG variable to nonzero (TRUE). + + Parameters: + +=over 4 + +=item $request - The curretn request operation. + +=item $message - The message to put inthe log file. + +=back + + Returns: + nothing. + +=cut + +sub Debug { + + # Marshall the parameters. + + my $r = shift; + my $log = $r->log; + my $message = shift; + + # Put out the indicated message butonly if DEBUG is false. + + if ($DEBUG) { + $log->debug($message); + } +} + + + # ================================================================ Main Handler @@ -54,14 +99,42 @@ sub handler { return OK if $r->header_only; my $lowerframe=$r->path_info; - $lowerframe=~s/^\//\/\~/; + &Debug($r, "Initial URL for lower frame: ".$lowerframe); + $lowerframe=~s/^\//\/\~/; + &Debug($r, "Lower frame URL afer ~ subst: ".$lowerframe); + $lowerframe= &HTML::Entities::encode($lowerframe); + &Debug($r, "Lower frame URL after quote subst: ".$lowerframe); + +# +# Are we forcing edit mode? +# + + &Apache::loncommon::get_unprocessed_cgi + ($ENV{'QUERY_STRING'},['forceedit']); + if ($ENV{'form.forceedit'}) { + $lowerframe.='?editmode=Edit&problemmode=EditXML'; + } + &Apache::loncommon::get_unprocessed_cgi + ($ENV{'QUERY_STRING'},['forceColoredit']); + if ($ENV{'form.forceColoredit'}) { + $lowerframe.='?editmode=Edit&problemmode=Edit'; + } + &Apache::loncommon::get_unprocessed_cgi + ($ENV{'QUERY_STRING'},['decompress']); + if ($ENV{'form.decompress'}) { + $lowerframe='http://$ENV{'SERVER_NAME'}/cgi-bin/decompress.pl?decompress'; + } $r->print(< -LON-CAPA Construction Space - +LON-CAPA Construction Space + + + - + ENDPAGE