File:
[LON-CAPA] /
loncom /
publisher /
Attic /
lonconstruct.pm
Revision
1.30:
download - view:
text,
annotated -
select for diffs
Thu Apr 7 06:56:26 2005 UTC (19 years, 5 months ago) by
albertel
Branches:
MAIN
CVS tags:
version_2_0_X,
version_2_0_2,
version_2_0_1,
version_2_0_0,
version_1_99_3,
version_1_99_2,
version_1_99_1_tmcc,
version_1_99_1,
version_1_99_0_tmcc,
version_1_99_0,
HEAD
- ENV -> env
1: # The LearningOnline Network with CAPA
2: # Construction Space Page Wrapper for Construction
3: #
4: # $Id: lonconstruct.pm,v 1.30 2005/04/07 06:56:26 albertel 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 Apache::Log ();
37: use HTML::Entities();
38:
39: my $DEBUG = 0;
40: =pod
41:
42: =item Debug($request, $message)
43:
44: If debugging is enabled puts out a debuggin message determined by the
45: caller. The debug message goes to the Apache error log file. Debugging
46: is enabled by ssetting the module global DEBUG variable to nonzero (TRUE).
47:
48: Parameters:
49:
50: =over 4
51:
52: =item $request - The curretn request operation.
53:
54: =item $message - The message to put inthe log file.
55:
56: =back
57:
58: Returns:
59: nothing.
60:
61: =cut
62:
63: sub Debug {
64:
65: # Marshall the parameters.
66:
67: my $r = shift;
68: my $log = $r->log;
69: my $message = shift;
70:
71: # Put out the indicated message butonly if DEBUG is false.
72:
73: if ($DEBUG) {
74: $log->debug($message);
75: }
76: }
77:
78:
79: # ================================================================ Main Handler
80:
81: sub handler {
82: my $r=shift;
83:
84: # -------------------------------------------------------------- Build frameset
85:
86: &Apache::loncommon::content_type($r,'text/html');
87: $r->send_http_header;
88: return OK if $r->header_only;
89:
90: my $lowerframe=$r->path_info;
91: &Debug($r, "Initial URL for lower frame: ".$lowerframe);
92: $lowerframe=~s/^\//\/\~/;
93: &Debug($r, "Lower frame URL afer ~ subst: ".$lowerframe);
94: $lowerframe= &HTML::Entities::encode($lowerframe,'<>&"');
95: &Debug($r, "Lower frame URL after quote subst: ".$lowerframe);
96:
97: #
98: # Are we forcing edit mode?
99: #
100:
101: &Apache::loncommon::get_unprocessed_cgi
102: ($ENV{'QUERY_STRING'},['forceedit']);
103: if ($env{'form.forceedit'}) {
104: $lowerframe.='?editmode=Edit&problemmode=EditXML';
105: }
106: &Apache::loncommon::get_unprocessed_cgi
107: ($ENV{'QUERY_STRING'},['forceColoredit']);
108: if ($env{'form.forceColoredit'}) {
109: $lowerframe.='?editmode=Edit&problemmode=Edit';
110: }
111:
112: #
113: # Checking to see if we should display the topframe
114: #
115: my $toprows = 0;
116: my $topsrc = '';
117: if ($env{'environment.remote'} ne 'off') {
118: $toprows = '110';
119: $topsrc = '/adm/localize/adm/publisher.html';
120: }
121: my $html=&Apache::lonxml::xmlbegin();
122: $r->print(<<ENDPAGE);
123: $html
124: <head><title>LON-CAPA Construction Space</title>
125: <script type="text/javascript">
126: var lastknownpriv="$lowerframe";
127: </script>
128: </head>
129: <frameset rows="$toprows,*" border="0">
130: <frame src='$topsrc' />
131: <frame src="$lowerframe" name="LONCAPAToBePublished" />
132: </frameset>
133: </html>
134: ENDPAGE
135: return OK;
136: }
137: 1;
138: __END__
139:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>