File:
[LON-CAPA] /
loncom /
interface /
Attic /
lonremote.pm
Revision
1.24:
download - view:
text,
annotated -
select for diffs
Wed Mar 12 02:45:07 2008 UTC (16 years, 4 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_99_1,
version_2_6_99_0,
HEAD,
GCI_1
Change arguments accepted by lonnet::appenv() to:
1. reference to hash
2. (optional) reference to array.
Change all instances where lonnet::appenv() is called to replace first argument passed (originally a hash) to a reference to the hash.
- Modify lonnet.pm rev 1.35 code intended to prevent "dangerous" modifications of the environment, so it will actually do this.
- Allow these modifications to be made in certain instances:
DC switching to adhoc role
CC switching to a different course role in the current course.
user self-enrolling as a student
1: # The LearningOnline Network
2: # User Authentication Module
3: #
4: # $Id: lonremote.pm,v 1.24 2008/03/12 02:45:07 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::lonremote;
31:
32: use strict;
33: use Apache::Constants qw(:common);
34: use Apache::loncommon();
35: use Apache::lonnet;
36: use Apache::lonmenu();
37: use Apache::lonlocal;
38:
39: sub launchremote {
40: my ($r,$lowerurl)=@_;
41: &Apache::lonnet::put('environment',{'remote' => 'on'});
42: &Apache::lonnet::appenv({'environment.remote' => 'on'});
43: # -------------------------------------------------------- Menu script and info
44: my $windowinfo=&Apache::lonmenu::open($env{'browser.os'});
45: my $startupremote=&Apache::lonmenu::startupremote($lowerurl);
46: my $start_page = &Apache::loncommon::start_page('Remote Control',
47: $startupremote);
48: my $end_page = &Apache::loncommon::end_page();
49: my $remoteinfo=&Apache::lonmenu::load_remote_msg($lowerurl);
50: my $setflags=&Apache::lonmenu::setflags();
51: my $maincall=&Apache::lonmenu::maincall();
52: my $message=&mt("Launching of the Remote Control menu will fail if pop-up window filters are active. To use the Remote Control, disable the filter for this site.");
53: $r->print(<<ENDLAUNCH);
54: $start_page
55: $setflags
56: $windowinfo
57: $message
58: $remoteinfo
59: $maincall
60: $end_page
61: ENDLAUNCH
62: }
63:
64: sub collapseremote {
65: my ($r,$lowerurl)=@_;
66: # -------------------------------------------------------- Menu script and info
67: my $start_page = &Apache::loncommon::start_page('Collapse Remote Control',
68: undef,
69: {'no_inline_link' => 1,});
70: my $end_page = &Apache::loncommon::end_page();
71: my $windowinfo=&Apache::lonmenu::close();
72: # my $switch='<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'">';
73: my $message='<p>'.&mt("The external menu (Remote Control) has been disabled, and you will be working with the smaller inline menu. You may have either closed the Remote Control window, or it was blocked by a pop-up window filter in your browser. To use the Remote Control, disable the filter for this site, and re-launch the Remote Control from the inline menu.").'</p>';
74: my $continue = &mt('Continue');
75: $r->print(<<ENDCOLLAPSE);
76: $start_page
77: $windowinfo
78: <p>
79: $message
80: </p>
81: <a href="$lowerurl">$continue</a>
82: $end_page
83: ENDCOLLAPSE
84: &Apache::lonnet::put('environment',{'remote' => 'off'});
85: &Apache::lonnet::appenv({'environment.remote' => 'off'});
86: }
87:
88: sub handler {
89: my $r = shift;
90: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
91: ['action','url']);
92: unless ($env{'form.action'}) {
93: if ($env{'environment.remote'} ne 'off') {
94: $env{'form.action'}='collapse';
95: } else {
96: $env{'form.action'}='launch';
97: }
98: }
99:
100: my $lowerurl=$env{'form.url'};
101: unless ($lowerurl) { $lowerurl='/adm/menu'; }
102:
103: &Apache::loncommon::content_type($r,'text/html');
104: $r->send_http_header;
105: return OK if $r->header_only;
106:
107: if ($env{'form.action'} eq 'launch') {
108: &launchremote($r,$lowerurl);
109: } else {
110: &collapseremote($r,$lowerurl);
111: }
112: return OK;
113: }
114:
115: 1;
116: __END__
117:
118:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>