Annotation of loncom/publisher/lonconstruct.pm, revision 1.38
1.1 www 1: # The LearningOnline Network with CAPA
1.38 ! raeburn 2: # Authoring Space Page Wrapper
1.6 albertel 3: #
1.38 ! raeburn 4: # $Id: lonconstruct.pm,v 1.37 2010/04/12 15:05:51 droeschl 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:
1.37 droeschl 120: # when the remote control existed we used to force the
121: # pages of construction space into a frameset.
122: # without remote control, we can elimnate this frameset
123: # and redirect to the url of the content frame.
124: # This keeps all URLs intact.
125: $r->internal_redirect($lowerframe);
1.1 www 126: return OK;
127: }
128: 1;
129: __END__
130:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>