Annotation of loncom/interface/lonremote.pm, revision 1.17

1.1       www         1: # The LearningOnline Network
                      2: # User Authentication Module
                      3: #
1.17    ! albertel    4: # $Id: lonremote.pm,v 1.16 2005/01/31 19:24:02 albertel 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();
                     35: use Apache::lonnet();
                     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'});
                     42:     &Apache::lonnet::appenv('environment.remote' => 'on');
1.1       www        43: # -------------------------------------------------------- Menu script and info
1.4       www        44:     my $windowinfo=&Apache::lonmenu::open($ENV{'browser.os'});
1.17    ! albertel   45:     my $html=&Apache::lonxml::xmlbegin();
1.4       www        46:     my $startupremote=&Apache::lonmenu::startupremote($lowerurl);
1.14      albertel   47:     my $remoteinfo=&Apache::lonmenu::load_remote_msg($lowerurl);
1.4       www        48:     my $setflags=&Apache::lonmenu::setflags();
                     49:     my $maincall=&Apache::lonmenu::maincall();
1.8       www        50:     my $bodytag=&Apache::loncommon::bodytag('Launch Remote Control');
1.11      www        51:     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        52:     $r->print(<<ENDLAUNCH);
1.17    ! albertel   53: $html
1.1       www        54: <head>
1.2       www        55: <title>The LearningOnline Network with CAPA</title>
1.4       www        56: $startupremote
1.1       www        57: </head>
                     58: $bodytag
1.4       www        59: $setflags
                     60: $windowinfo
1.14      albertel   61: $message
                     62: $remoteinfo
1.5       www        63: $maincall
1.1       www        64: </body>
                     65: </html>
1.2       www        66: ENDLAUNCH
                     67: }
                     68: 
                     69: sub collapseremote {
                     70:     my ($r,$lowerurl)=@_;
                     71: # -------------------------------------------------------- Menu script and info
1.17    ! albertel   72:     my $html=&Apache::lonxml::xmlbegin();
1.8       www        73:     my $bodytag=&Apache::loncommon::bodytag('Collapse Remote Control');
1.4       www        74:     my $windowinfo=&Apache::lonmenu::close();
1.12      albertel   75: #    my $switch='<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'">';
1.13      albertel   76:     my $message='<p>'.&mt("The external menu (Remote Control) has been disabled, and you will be working with the smaller inline menu.\nYou may have either closed the Remote Control window, or it was blocked by a pop-up window filter in your browser.\nTo use the Remote Control, disable the filter for this site, and re-launch the Remote Control from the inline menu.").'</p>'; 
1.2       www        77:     $r->print(<<ENDCOLLAPSE);
1.17    ! albertel   78: $html
1.2       www        79: <head>
                     80: <title>The LearningOnline Network with CAPA</title>
                     81: </head>
                     82: $bodytag
1.4       www        83: $windowinfo
1.12      albertel   84: <p>
                     85: $message
                     86: </p>
                     87: <a href="$lowerurl">Continue</a>
1.2       www        88: </body>
                     89: </html>
                     90: ENDCOLLAPSE
                     91:    &Apache::lonnet::put('environment',{'remote' => 'off'});
                     92:    &Apache::lonnet::appenv('environment.remote' => 'off');
1.1       www        93: }
                     94: 
                     95: sub handler {
                     96:     my $r = shift;
1.5       www        97:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                     98:                                             ['action','url']);
1.2       www        99:     unless ($ENV{'form.action'}) {
1.16      albertel  100: 	if ($ENV{'environment.remote'} ne 'off') {
1.2       www       101: 	    $ENV{'form.action'}='collapse';
                    102:         } else {
                    103: 	    $ENV{'form.action'}='launch';
                    104:         }
                    105:     }
1.5       www       106: 
                    107:     my $lowerurl=$ENV{'form.url'};
1.6       www       108:     unless ($lowerurl) { $lowerurl='/adm/menu'; }
1.9       albertel  109: 
1.10      www       110:     &Apache::loncommon::content_type($r,'text/html');
1.9       albertel  111:     $r->send_http_header;
                    112:     return OK if $r->header_only;
1.5       www       113: 
1.2       www       114:     if ($ENV{'form.action'} eq 'launch') {
1.4       www       115: 	&launchremote($r,$lowerurl);
1.2       www       116:     } else {
1.4       www       117:         &collapseremote($r,$lowerurl);
1.2       www       118:     }
1.1       www       119:     return OK;
                    120: }
                    121: 
                    122: 1;
                    123: __END__
                    124: 
                    125: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>