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

1.1       www         1: # The LearningOnline Network
                      2: # User Authentication Module
                      3: #
1.7     ! www         4: # $Id: lonremote.pm,v 1.6 2003/04/03 16:50:46 www 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: #
                     28: # 5/21/99,5/22,5/25,5/26,5/27,5/29,6/2,6/11,6/14,6/15
                     29: # 16/11,12/16,
                     30: # 1/14,2/24,2/28,2/29,3/7,5/29,5/30,5/31,6/1,6/5,6/29,
                     31: # 7/1,7/10,10/2,10/5,10/9,10/26,10/30,11/10,
                     32: # 05/28,05/29 Gerd Kortemeyer
                     33: # 07/28,08/03 Gerd Kortemeyer
                     34: # 8/20 Gerd Kortemeyer
                     35: 
                     36: package Apache::lonremote;
                     37: 
                     38: use strict;
                     39: use Apache::Constants qw(:common);
                     40: use Apache::loncommon();
                     41: use Apache::lonnet();
                     42: use Apache::lonmenu();
                     43: 
                     44: sub launchremote {
1.2       www        45:     my ($r,$lowerurl)=@_;
1.3       www        46:     &Apache::lonnet::put('environment',{'remote' => 'on'});
                     47:     &Apache::lonnet::appenv('environment.remote' => 'on');
1.1       www        48: # -------------------------------------------------------- Menu script and info
1.4       www        49:     my $windowinfo=&Apache::lonmenu::open($ENV{'browser.os'});
                     50:     my $startupremote=&Apache::lonmenu::startupremote($lowerurl);
                     51:     my $setflags=&Apache::lonmenu::setflags();
                     52:     my $maincall=&Apache::lonmenu::maincall();
1.7     ! www        53:     my $bodytag=&Apache::loncommon::bodytag('Launch Remote Control',undef,' ');
1.2       www        54:     $r->print(<<ENDLAUNCH);
1.1       www        55: <html>
                     56: <head>
1.2       www        57: <title>The LearningOnline Network with CAPA</title>
1.4       www        58: $startupremote
1.1       www        59: </head>
                     60: $bodytag
1.4       www        61: $setflags
                     62: $windowinfo
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.7     ! www        72:     my $bodytag=&Apache::loncommon::bodytag('Collapse Remote Control',undef,
        !            73:                                             ' ');
1.4       www        74:     my $windowinfo=&Apache::lonmenu::close();
1.6       www        75:     my $switch='<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'">';
1.2       www        76:     $r->print(<<ENDCOLLAPSE);
                     77: <html>
                     78: <head>
                     79: <title>The LearningOnline Network with CAPA</title>
1.6       www        80: $switch
1.2       www        81: </head>
                     82: $bodytag
1.4       www        83: $windowinfo
1.2       www        84: </body>
                     85: </html>
                     86: ENDCOLLAPSE
                     87:    &Apache::lonnet::put('environment',{'remote' => 'off'});
                     88:    &Apache::lonnet::appenv('environment.remote' => 'off');
1.1       www        89: }
                     90: 
                     91: sub handler {
                     92:     my $r = shift;
1.5       www        93:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                     94:                                             ['action','url']);
1.2       www        95:     unless ($ENV{'form.action'}) {
                     96: 	if ($ENV{'environment.remote'} eq 'on') {
                     97: 	    $ENV{'form.action'}='collapse';
                     98:         } else {
                     99: 	    $ENV{'form.action'}='launch';
                    100:         }
                    101:     }
1.5       www       102: 
                    103:     my $lowerurl=$ENV{'form.url'};
1.6       www       104:     unless ($lowerurl) { $lowerurl='/adm/menu'; }
1.5       www       105: 
1.2       www       106:     if ($ENV{'form.action'} eq 'launch') {
1.4       www       107: 	&launchremote($r,$lowerurl);
1.2       www       108:     } else {
1.4       www       109:         &collapseremote($r,$lowerurl);
1.2       www       110:     }
1.1       www       111:     return OK;
                    112: }
                    113: 
                    114: 1;
                    115: __END__
                    116: 
                    117: 

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