Annotation of loncom/interface/lonremote.pm, revision 1.29
1.1 www 1: # The LearningOnline Network
2: # User Authentication Module
3: #
1.29 ! raeburn 4: # $Id: lonremote.pm,v 1.28 2009/03/16 17:07:33 bisitz Exp $
1.1 www 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: #
1.11 www 28: ###
1.1 www 29:
30: package Apache::lonremote;
31:
32: use strict;
33: use Apache::Constants qw(:common);
34: use Apache::loncommon();
1.18 albertel 35: use Apache::lonnet;
1.1 www 36: use Apache::lonmenu();
1.11 www 37: use Apache::lonlocal;
1.1 www 38:
39: sub launchremote {
1.2 www 40: my ($r,$lowerurl)=@_;
1.3 www 41: &Apache::lonnet::put('environment',{'remote' => 'on'});
1.24 raeburn 42: &Apache::lonnet::appenv({'environment.remote' => 'on'});
1.1 www 43: # -------------------------------------------------------- Menu script and info
1.18 albertel 44: my $windowinfo=&Apache::lonmenu::open($env{'browser.os'});
1.4 www 45: my $startupremote=&Apache::lonmenu::startupremote($lowerurl);
1.27 schafran 46: my $start_page = &Apache::loncommon::start_page('Page Display Settings',
1.19 albertel 47: $startupremote);
48: my $end_page = &Apache::loncommon::end_page();
1.14 albertel 49: my $remoteinfo=&Apache::lonmenu::load_remote_msg($lowerurl);
1.4 www 50: my $setflags=&Apache::lonmenu::setflags();
51: my $maincall=&Apache::lonmenu::maincall();
1.11 www 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.");
1.2 www 53: $r->print(<<ENDLAUNCH);
1.19 albertel 54: $start_page
1.4 www 55: $setflags
56: $windowinfo
1.14 albertel 57: $message
58: $remoteinfo
1.5 www 59: $maincall
1.19 albertel 60: $end_page
1.2 www 61: ENDLAUNCH
62: }
63:
64: sub collapseremote {
65: my ($r,$lowerurl)=@_;
66: # -------------------------------------------------------- Menu script and info
1.26 raeburn 67: my $brcrum = [{href=>"/adm/preferences",text=>"Set User Preferences"},
68: {href=>"/adm/remote?url=/adm/preferences&action=collapse",text=>"Collapse Remote Control"}];
69: my $start_page =
70: &Apache::loncommon::start_page('Collapse Remote Control',
71: undef,
72: {'bread_crumbs' => $brcrum,
73: 'no_inline_link' => 1,});
1.20 albertel 74: my $end_page = &Apache::loncommon::end_page();
1.4 www 75: my $windowinfo=&Apache::lonmenu::close();
1.28 bisitz 76: # my $switch='<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />';
1.29 ! raeburn 77: 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 [_1]"Launch Remote Control"[_2] option in [_3]"Set my user preferences"[_2], accessible via the [_4]Main Menu[_2]','<a href="/adm/remote?action=launch">','</a>','<a href="/adm/preferences">','<a href="/adm/menu">').'</p>';
1.22 raeburn 78: my $continue = &mt('Continue');
1.2 www 79: $r->print(<<ENDCOLLAPSE);
1.19 albertel 80: $start_page
1.4 www 81: $windowinfo
1.12 albertel 82: <p>
83: $message
84: </p>
1.22 raeburn 85: <a href="$lowerurl">$continue</a>
1.19 albertel 86: $end_page
1.2 www 87: ENDCOLLAPSE
88: &Apache::lonnet::put('environment',{'remote' => 'off'});
1.24 raeburn 89: &Apache::lonnet::appenv({'environment.remote' => 'off'});
1.1 www 90: }
91:
92: sub handler {
93: my $r = shift;
1.5 www 94: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
95: ['action','url']);
1.18 albertel 96: unless ($env{'form.action'}) {
97: if ($env{'environment.remote'} ne 'off') {
98: $env{'form.action'}='collapse';
1.2 www 99: } else {
1.18 albertel 100: $env{'form.action'}='launch';
1.2 www 101: }
102: }
1.5 www 103:
1.18 albertel 104: my $lowerurl=$env{'form.url'};
1.6 www 105: unless ($lowerurl) { $lowerurl='/adm/menu'; }
1.9 albertel 106:
1.10 www 107: &Apache::loncommon::content_type($r,'text/html');
1.9 albertel 108: $r->send_http_header;
109: return OK if $r->header_only;
1.5 www 110:
1.18 albertel 111: if ($env{'form.action'} eq 'launch') {
1.4 www 112: &launchremote($r,$lowerurl);
1.2 www 113: } else {
1.4 www 114: &collapseremote($r,$lowerurl);
1.2 www 115: }
1.1 www 116: return OK;
117: }
118:
119: 1;
120: __END__
121:
122:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>