File:  [LON-CAPA] / loncom / interface / Attic / lonremote.pm
Revision 1.15: download - view: text, annotated - select for diffs
Fri Oct 29 20:44:30 2004 UTC (19 years, 8 months ago) by raeburn
Branches: MAIN
CVS tags: version_1_3_X, version_1_3_3, version_1_3_2, version_1_3_1, version_1_3_0, version_1_2_99_1, version_1_2_99_0, HEAD
Eliminate requirement for Remote Control when entering Construction Space.

    1: # The LearningOnline Network
    2: # User Authentication Module
    3: #
    4: # $Id: lonremote.pm,v 1.15 2004/10/29 20:44:30 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 $remoteinfo=&Apache::lonmenu::load_remote_msg($lowerurl);
   47:     my $setflags=&Apache::lonmenu::setflags();
   48:     my $maincall=&Apache::lonmenu::maincall();
   49:     my $bodytag=&Apache::loncommon::bodytag('Launch Remote Control');
   50:     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.");
   51:     $r->print(<<ENDLAUNCH);
   52: <html>
   53: <head>
   54: <title>The LearningOnline Network with CAPA</title>
   55: $startupremote
   56: </head>
   57: $bodytag
   58: $setflags
   59: $windowinfo
   60: $message
   61: $remoteinfo
   62: $maincall
   63: </body>
   64: </html>
   65: ENDLAUNCH
   66: }
   67: 
   68: sub collapseremote {
   69:     my ($r,$lowerurl)=@_;
   70: # -------------------------------------------------------- Menu script and info
   71:     my $bodytag=&Apache::loncommon::bodytag('Collapse Remote Control');
   72:     my $windowinfo=&Apache::lonmenu::close();
   73: #    my $switch='<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'">';
   74:     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>'; 
   75:     $r->print(<<ENDCOLLAPSE);
   76: <html>
   77: <head>
   78: <title>The LearningOnline Network with CAPA</title>
   79: </head>
   80: $bodytag
   81: $windowinfo
   82: <p>
   83: $message
   84: </p>
   85: <a href="$lowerurl">Continue</a>
   86: </body>
   87: </html>
   88: ENDCOLLAPSE
   89:    &Apache::lonnet::put('environment',{'remote' => 'off'});
   90:    &Apache::lonnet::appenv('environment.remote' => 'off');
   91: }
   92: 
   93: sub handler {
   94:     my $r = shift;
   95:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
   96:                                             ['action','url']);
   97:     unless ($ENV{'form.action'}) {
   98: 	if ($ENV{'environment.remote'} eq 'on') {
   99: 	    $ENV{'form.action'}='collapse';
  100:         } else {
  101: 	    $ENV{'form.action'}='launch';
  102:         }
  103:     }
  104: 
  105:     my $lowerurl=$ENV{'form.url'};
  106:     unless ($lowerurl) { $lowerurl='/adm/menu'; }
  107: 
  108:     &Apache::loncommon::content_type($r,'text/html');
  109:     $r->send_http_header;
  110:     return OK if $r->header_only;
  111: 
  112:     if ($ENV{'form.action'} eq 'launch') {
  113: 	&launchremote($r,$lowerurl);
  114:     } else {
  115:         &collapseremote($r,$lowerurl);
  116:     }
  117:     return OK;
  118: }
  119: 
  120: 1;
  121: __END__
  122: 
  123: 

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