File:  [LON-CAPA] / loncom / interface / lonmenu.pm
Revision 1.41: download - view: text, annotated - select for diffs
Mon Feb 17 19:28:54 2003 UTC (21 years, 3 months ago) by www
Branches: MAIN
CVS tags: HEAD
Still got a long way to go on the textual interface, but should not
interfere with Remote.
Next steps: write JavaScripts or equivalent to handle function calls
on textual interface, move configuration out of lonmenu.pm into
mydesk.tab (which is part of generally cleaning this up).

    1: # The LearningOnline Network with CAPA
    2: # Routines to control the menu
    3: #
    4: # $Id: lonmenu.pm,v 1.41 2003/02/17 19:28:54 www 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: # (TeX Conversion Module
   29: #
   30: # 05/29/00,05/30 Gerd Kortemeyer)
   31: #
   32: # 10/05,05/28,05/30,06/01,06/08,06/09,07/04,08/07 Gerd Kortemeyer
   33: # 02/15/02 Matthew Hall
   34: 
   35: package Apache::lonmenu;
   36: 
   37: use strict;
   38: use Apache::lonnet;
   39: use Apache::Constants qw(:common);
   40: use Apache::loncommon;
   41: use Apache::File;
   42: use vars qw(@desklines $readdesk);
   43: 
   44: # ============================= This gets called at the top of the body section
   45: 
   46: sub menubuttons {
   47:     my $forcereg=shift;
   48:     my $target  =shift;
   49:     my $registration=shift;
   50:     unless ($ENV{'browser.interface'} eq 'textual') { return ''; }
   51: # Textual display only
   52:     my $output='<a href="/adm/menu">Main Menu</a><br />';
   53:     if ($registration) { $output.=&innerregister($forcereg,$target); }
   54:     return $output."<hr />";
   55: }
   56: 
   57: # ====================================== This gets called in the header section
   58: 
   59: sub registerurl {
   60:     my $forcereg=shift;
   61:     my $target = shift;
   62:     my $result = '';
   63:     
   64:     if ($target eq 'edit') {
   65:         $result .="<script type=\"text/javascrtipt\">\n".
   66:             "if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n".
   67:             &Apache::loncommon::browser_and_searcher_javascript().
   68:                 "\n</script>\n";
   69:     }
   70:     if (($ENV{'browser.interface'} eq 'textual') ||
   71:         ((($ENV{'request.publicaccess'}) || 
   72:          (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
   73:         (!$forcereg))) {
   74: 	return $result.
   75:          '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>';
   76:     }
   77: # Graphical display after login only
   78:     if ($Apache::lonxml::registered && !$forcereg) { return ''; }
   79:     $result.=&innerregister($forcereg,$target);
   80:     return $result;
   81: }
   82: 
   83: # =========== This gets called in order to register a URL, both with the Remote
   84: # =========== and in the body of the document
   85: 
   86: sub innerregister {
   87:     my $forcereg=shift;
   88:     my $target = shift;
   89:     my $result = '';
   90: 
   91:     $Apache::lonxml::registered=1;
   92: 
   93:     my $textual=($ENV{'browser.interface'} eq 'textual');
   94:     my $reopen=&Apache::lonmenu::reopenmenu();
   95: 
   96:     my $newmail='';
   97:     if (&Apache::lonmsg::newmail()) { 
   98:        $newmail=($textual?
   99:  '<b><a href="/adm/communicate">You have new messages</a></b><br />':
  100:                           'swmenu.setstatus("you have","messages");');
  101:     }
  102:     my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');');
  103: # =============================================================================
  104: # ============================ This is for URLs that actually can be registered
  105:     if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
  106: # -- This applies to homework problems for users with grading privileges
  107:         my $hwkadd='';
  108:         if 
  109:       ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
  110: 	    if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
  111: 		$hwkadd.=&switch('','',7,1,'subm.gif','view sub','missions',
  112:                        "gocmd('/adm/grades','submission')",
  113: 		       'View user submissions for this assessment resource');
  114:             }
  115: 	    if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
  116: 		$hwkadd.=&switch('','',7,2,'pgrd.gif','problem','grades',
  117:                        "gocmd('/adm/grades','gradingmenu')",
  118:                        'Modify user grades for this assessment resource');
  119:             }
  120: 	    if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
  121: 		$hwkadd.=&switch('','',7,3,'pparm.gif','problem','parms',
  122:                        "gocmd('/adm/parmset','set')",
  123:                        'Modify deadlines, etc, for this assessment resource');
  124:             }
  125: 	}
  126: # -- End Homework
  127:         ###
  128:         ### Determine whether or not to display the 'cstr' button for this
  129:         ### resource
  130:         ###
  131:         my $editbutton = '';
  132:         if ($ENV{'user.author'}) {
  133:             if ($ENV{'request.role'}=~/^(ca|au)/) {
  134:                 # Set defaults for authors
  135:                 my ($top,$bottom) = ('con-','struct');
  136:                 my $action = "go('/priv/".$ENV{'user.name'}."');";
  137:                 my $cadom  = $ENV{'request.role.domain'};
  138:                 my $caname = $ENV{'user.name'};
  139:                 my $desc = "Enter my resource construction space";
  140:                 # Set defaults for co-authors
  141:                 if ($ENV{'request.role'} =~ /^ca/) { 
  142:                     ($cadom,$caname)=($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
  143:                     ($top,$bottom) = ('co con-','struct');
  144:                     $action = "go('/priv/".$caname."');";
  145:                     $desc = "Enter construction space as co-author";
  146:                 }
  147:                 # Check that we are on the correct machine
  148:                 my $home = &Apache::lonnet::homeserver($caname,$cadom);
  149:                 if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
  150:                     $editbutton=&switch
  151:                         ('','',6,1,$top,,$bottom,$action,$desc);
  152:                 }
  153:             }
  154:             ##
  155:             ## Determine if user can edit url.
  156:             ##
  157:             my $cfile='';
  158:             my $cfuname='';
  159:             my $cfudom='';
  160:             if ($ENV{'request.filename'}) {
  161:                 my $file=&Apache::lonnet::declutter($ENV{'request.filename'});
  162:                 $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;
  163:                 # Chech that the user has permission to edit this resource
  164:                 ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
  165:                 if (defined($cfudom)) {
  166:                     if (&Apache::lonnet::homeserver($cfuname,$cfudom) 
  167:                         eq $Apache::lonnet::perlvar{'lonHostID'}) {
  168:                         $cfile=$file;
  169:                     }
  170:                 }
  171:             }        
  172:             # Finally, turn the button on or off
  173:             if ($cfile) {
  174:                 $editbutton=&switch
  175:                     ('','',6,1,'cstr.gif','edit','resource',
  176:                      "go('".$cfile."');","Edit this resource");
  177:             } elsif ($editbutton eq '') {
  178:                 $editbutton=&clear(6,1);
  179:             }
  180:         }
  181:         ###
  182:         ###
  183: # Prepare the rest of the buttons
  184: 	my $menuitems=(<<ENDMENUITEMS);
  185: c&3&1
  186: s&2&1&back.gif&backward&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&1
  187: s&2&3&forw.gif&forward&&gopost('/adm/flip','forward:'+currentURL)&Go to the next resource in the course sequence&1
  188: s&6&3&catalog.gif&catalog&info&catalog_info()&Show catalog information
  189: s&8&1&eval.gif&evaluate&this&gopost('/adm/evaluate',currentURL)&Provide my evaluation of this resource
  190: s&8&2&fdbk.gif&feedback&discuss&gopost('/adm/feedback',currentURL)&Provide feedback messages or contribute to the course discussion about this resource
  191: s&8&3&prt.gif&prepare&printout&gopost('/adm/printout',currentURL)&Prepare a printable document
  192: s&9&1&sbkm.gif&set&bookmark&set_bookmark()&Set a bookmark for this resource&2
  193: s&9&2&vbkm.gif&view&bookmark&edit_bookmarks()&Use or edit my bookmark collection&2
  194: s&9&3&anot.gif&anno-&tations&annotate()&Make notes and annotations about this resource&2
  195: ENDMENUITEMS
  196:         my $buttons='';
  197:         foreach (split(/\n/,$menuitems)) {
  198: 	    my ($command,@rest)=split(/\&/,$_);
  199:             if ($command eq 's') {
  200: 		$buttons.=&switch('','',@rest);
  201:             } else {
  202:                 $buttons.=&clear(@rest);
  203:             }
  204:         }
  205:         if ($textual) {
  206: # Registered, textual output
  207: 	    $result =(<<ENDREGTEXT);
  208: $timesync
  209: $newmail
  210: $buttons
  211: $hwkadd
  212: $editbutton
  213: ENDREGTEXT
  214: # Registered, graphical output
  215:         } else {
  216: 	    $result = (<<ENDREGTHIS);
  217:      
  218: <script language="JavaScript">
  219: // BEGIN LON-CAPA Internal
  220: 
  221:     function LONCAPAreg() {
  222: 	  swmenu=$reopen;
  223:           swmenu.clearTimeout(swmenu.menucltim);
  224:           $timesync
  225:           $newmail
  226:           $buttons
  227: 	  swmenu.currentURL=window.location.pathname;
  228:           swmenu.reloadURL=window.location.pathname;
  229:           swmenu.currentSymb="$ENV{'request.symb'}";
  230:           swmenu.reloadSymb="$ENV{'request.symb'}";
  231:           swmenu.currentStale=0;
  232:           $hwkadd
  233:           $editbutton
  234:     }
  235: 
  236:     function LONCAPAstale() {
  237: 	  swmenu=$reopen
  238:           swmenu.currentStale=1;
  239:           if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) { 
  240:              swmenu.switchbutton
  241:              (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
  242: 	  }
  243:           swmenu.clearbut(7,1);
  244:           swmenu.clearbut(7,2);
  245:           swmenu.clearbut(7,3);
  246:           swmenu.menucltim=swmenu.setTimeout(
  247:  'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
  248:  'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3);clearbut(6,1)',
  249: 			  2000);
  250: 
  251:       }
  252: 
  253: // END LON-CAPA Internal
  254: </script>
  255: ENDREGTHIS
  256:         }
  257: # =============================================================================
  258:     } else {
  259: # ========================================== This can or will not be registered
  260:         if ($textual) {
  261: # Not registered, textual
  262: 	    $result= (<<ENDDONOTREGTEXT);
  263: ENDDONOTREGTEXT
  264:         } else {
  265: # Not registered, graphical
  266:            $result = (<<ENDDONOTREGTHIS);
  267: 
  268: <script language="JavaScript">
  269: // BEGIN LON-CAPA Internal
  270: 
  271:     function LONCAPAreg() {
  272: 	  swmenu=$reopen
  273:           $timesync
  274:           swmenu.currentStale=1;
  275:           swmenu.clearbut(2,1);
  276:           swmenu.clearbut(2,3);
  277:           swmenu.clearbut(8,1);
  278:           swmenu.clearbut(8,2);
  279:           swmenu.clearbut(8,3);
  280:           if (swmenu.currentURL) {
  281:              swmenu.switchbutton
  282:               (3,1,'reload.gif','return','location','go(currentURL)');
  283:  	  } else {
  284: 	      swmenu.clearbut(3,1);
  285:           }
  286:     }
  287: 
  288:     function LONCAPAstale() {
  289:     }
  290: 
  291: // END LON-CAPA Internal
  292: </script>
  293: ENDDONOTREGTHIS
  294:        }
  295: # =============================================================================
  296:     }
  297:     return $result;
  298: }
  299: 
  300: sub loadevents() {
  301:     return 'LONCAPAreg();';
  302: }
  303: 
  304: sub unloadevents() {
  305:     return 'LONCAPAstale();';
  306: }
  307: 
  308: # ============================================================= Start up remote
  309: 
  310: sub startupremote {
  311:     my ($lowerurl)=@_;
  312:     if ($ENV{'browser.interface'} eq 'textual') {
  313:      return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
  314:     }
  315:     my $configmenu=&rawconfig();
  316:     return(<<ENDREMOTESTARTUP);
  317: <script>
  318: 
  319: function wheelswitch() {
  320:    if (window.status=='|') { 
  321:       window.status='/'; 
  322:    } else {
  323:       if (window.status=='/') {
  324:          window.status='-';
  325:       } else {
  326:          if (window.status=='-') { 
  327:             window.status='\\\\'; 
  328:          } else {
  329:             if (window.status=='\\\\') { window.status='|'; }
  330:          }
  331:       }
  332:    } 
  333: }
  334: 
  335: // ---------------------------------------------------------- The wait function
  336: var canceltim;
  337: function wait() {
  338:    if ((menuloaded==1) || (tim==1)) {
  339:       window.status='Done.';
  340:       if (tim==0) {
  341:          clearTimeout(canceltim);
  342:          $configmenu
  343:          window.location='$lowerurl';  
  344:       } else {
  345:          alert("Remote Control timed out. It is possible that it was blocked by pop-up window filters.");
  346:       }
  347:    } else {
  348:       wheelswitch();
  349:       setTimeout('wait();',200);
  350:    }
  351: }
  352: 
  353: function main() {
  354:    canceltim=setTimeout('tim=1;',60000);
  355:    window.status='-';
  356:    wait();
  357: }
  358: 
  359: </script>
  360: ENDREMOTESTARTUP
  361: }
  362: 
  363: sub setflags() {
  364:     return(<<ENDSETFLAGS);
  365: <script>
  366:     menuloaded=0;
  367:     tim=0;
  368: </script>
  369: ENDSETFLAGS
  370: }
  371: 
  372: sub maincall() {
  373:     if ($ENV{'browser.interface'} eq 'textual') { return ''; }
  374:     return(<<ENDMAINCALL);
  375: <script>
  376:     main();
  377: </script>
  378: ENDMAINCALL
  379: }
  380: # ================================================================= Reopen menu
  381: 
  382: sub reopenmenu {
  383:    my $nothing='';
  384:    if ($ENV{'browser.interface'} eq 'textual') { return ''; }
  385:    my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
  386:    if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; }
  387:    return('window.open("'.$nothing.'","'.$menuname.'","",false);');
  388: } 
  389: 
  390: # =============================================================== Open the menu
  391: 
  392: sub open {
  393:     my $returnval='';
  394:     if ($ENV{'browser.interface'} eq 'textual') { return ''; }
  395:     my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
  396:     unless (shift eq 'unix') {
  397: # resizing does not work on linux because of virtual desktop sizes
  398:        $returnval.=(<<ENDRESIZE);
  399: if (window.screen) {
  400:     self.resizeTo(screen.availWidth-215,screen.availHeight-55);
  401:     self.moveTo(190,15);
  402: }
  403: ENDRESIZE
  404:     }
  405:     $returnval.=(<<ENDOPEN);
  406: window.status='Opening LON-CAPA Remote Control';
  407: var menu=window.open("/res/adm/pages/menu.html","$menuname",
  408: "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
  409: ENDOPEN
  410:     return '<script>'.$returnval.'</script>';
  411: }
  412: 
  413: 
  414: # ================================================================== Raw Config
  415: 
  416: sub clear {
  417:     my ($row,$col)=@_;
  418:     unless ($ENV{'browser.interface'} eq 'textual') {
  419:        return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
  420:    } else { return ''; }
  421: }
  422: 
  423: # ============================================ Switch a button or create a link
  424: # Switch acts on the javascript that is executed when a button is clicked.  
  425: # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
  426: 
  427: sub switch {
  428:     my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$nobreak)=@_;
  429:     $act=~s/\$uname/$uname/g;
  430:     $act=~s/\$udom/$udom/g;
  431:     unless ($ENV{'browser.interface'} eq 'textual') {
  432:        return "\n".
  433:  qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
  434:    } else {
  435:        if ($nobreak==2) { return ''; }
  436:        my $text=$top.' '.$bot;
  437:        $text=~s/\- //;
  438:        return ($nobreak?'':'<br />').
  439:         '<a href="javascript:'.$act.';">'.$text.'</a> '.($nobreak?'':$desc);
  440:    }
  441: }
  442: 
  443: sub secondlevel {
  444:     my $output='';
  445:     my 
  446:     ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc)=@_;
  447:     if ($prt eq 'any') {
  448: 	   $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
  449:     } elsif ($prt=~/^r(\w+)/) {
  450:         if ($rol eq $1) {
  451:            $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
  452:         }
  453:     }
  454:     return $output;
  455: }
  456: 
  457: sub openmenu {
  458:     my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
  459:     if ($ENV{'browser.interface'} eq 'textual') { return ''; }
  460:     if ($ENV{'browser.type'} eq 'explorer') {
  461:        return "window.open('javascript:void(0);','".$menuname."');";
  462:    } else {
  463:        return "window.open('','".$menuname."');";
  464:    }
  465: }
  466: 
  467: sub rawconfig {
  468:     my $textualoverride=shift;
  469:     my $output='';
  470:     unless ($ENV{'browser.interface'} eq 'textual') {
  471:        $output.=
  472:  "window.status='Opening Remote Control';var swmenu=".&openmenu().
  473: "\nwindow.status='Configuring Remote Control ';";
  474:     } else {
  475:        unless ($textualoverride) { return ''; }
  476:     }
  477:     my $uname=$ENV{'user.name'};
  478:     my $udom=$ENV{'user.domain'};
  479:     my $adv=$ENV{'user.adv'};
  480:     my $author=$ENV{'user.author'};
  481:     my $crs='';
  482:     if ($ENV{'request.course.id'}) {
  483:        $crs='/'.$ENV{'request.course.id'};
  484:        if ($ENV{'request.course.sec'}) {
  485: 	   $crs.='_'.$ENV{'request.course.sec'};
  486:        }
  487:        $crs=~s/\_/\//g;
  488:     }
  489:     my $pub=($ENV{'request.state'} eq 'published');
  490:     my $con=($ENV{'request.state'} eq 'construct');
  491:     my $rol=$ENV{'request.role'};
  492:     my $requested_domain = $ENV{'request.role.domain'};
  493:     foreach (@desklines) {
  494:         my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$_);
  495:         $prt=~s/\$uname/$uname/g;
  496:         $prt=~s/\$udom/$udom/g;
  497:         $prt=~s/\$crs/$crs/g; 
  498:         $prt=~s/\$requested_domain/$requested_domain/g;
  499:         if ($pro eq 'clear') {
  500: 	    $output.=&clear($row,$col);
  501:         } elsif ($pro eq 'any') {
  502:                $output.=&secondlevel(
  503: 	  $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
  504: 	} elsif ($pro eq 'smp') {
  505:             unless ($adv) {
  506:                $output.=&secondlevel(
  507:           $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
  508:             }
  509:         } elsif ($pro eq 'adv') {
  510:             if ($adv) {
  511:                $output.=&secondlevel(
  512: 	  $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
  513:             }
  514:         } elsif (($pro=~/p(\w+)/) && ($prt)) {
  515: 	    if (&Apache::lonnet::allowed($1,$prt)) {
  516:                $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
  517:             }
  518:         } elsif ($pro eq 'course') {
  519:             if ($ENV{'request.course.fn'}) {
  520:                $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
  521: 	    }
  522:         } elsif ($pro eq 'author') {
  523:             if ($author) {
  524:                 if ((($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) ||
  525:                     (($prt eq 'rau') && ($ENV{'request.role'}=~/^au/))) {
  526:                     # Check that we are on the correct machine
  527:                     my $cadom=$requested_domain;
  528:                     my $caname=$ENV{'user.name'};
  529:                     if ($prt eq 'rca') {
  530: 		       ($cadom,$caname)=
  531:                                ($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
  532:                     }                       
  533:                     $act =~ s/\$caname/$caname/g;
  534:                     my $home = &Apache::lonnet::homeserver($caname,$cadom);
  535:                     if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
  536:                         $output.=switch($caname,$cadom,
  537:                                         $row,$col,$img,$top,$bot,$act,$desc);
  538:                     }
  539:                 }
  540:             }
  541:         }
  542:     }
  543:     unless ($ENV{'browser.interface'} eq 'textual') {
  544:        $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
  545:     }
  546:     return $output;
  547: }
  548: 
  549: # ======================================================================= Close
  550: 
  551: sub close {
  552:     if ($ENV{'browser.interface'} eq 'textual') { return ''; }
  553:     my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
  554:     return(<<ENDCLOSE);
  555: <script>
  556: window.status='Accessing Remote Control';
  557: menu=window.open("/adm/rat/empty.html","$menuname",
  558:                  "height=350,width=150,scrollbars=no,menubar=no");
  559: window.status='Disabling Remote Control';
  560: menu.active=0;
  561: menu.autologout=0;
  562: window.status='Closing Remote Control';
  563: menu.close();
  564: window.status='Done.';
  565: </script>
  566: ENDCLOSE
  567: }
  568: 
  569: # ====================================================================== Footer
  570: 
  571: sub footer {
  572: 
  573: }
  574: 
  575: # ================================================ Handler when called directly
  576: 
  577: 
  578: sub handler {
  579:     my $r = shift;
  580:     $r->content_type('text/html');
  581:     $r->send_http_header;
  582:     return OK if $r->header_only;
  583: 
  584:     my $bodytag=&Apache::loncommon::bodytag('Main Menu');
  585: # ------------------------------------------------------------ Print the screen
  586:     $r->print(<<ENDHEADER);
  587: <html><head>
  588: <title>LON-CAPA Main Menu</title>
  589: <script>
  590: function go(url) {
  591:     window.location=url;
  592: }
  593: function gopost(url) {
  594:     window.location=url;
  595: }
  596: </script>
  597: </head>
  598: $bodytag
  599: ENDHEADER
  600:     $r->print(&rawconfig(1));
  601:     $r->print('</body></html>');
  602:     return OK;
  603: }
  604: 
  605: # ================================================================ Main Program
  606: 
  607: BEGIN {
  608:   if (! defined($readdesk)) {
  609:    {
  610:     my $config=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
  611: 				  '/mydesk.tab');
  612:     while (my $configline=<$config>) {
  613:        $configline=(split(/\#/,$configline))[0];
  614:        $configline=~s/^\s+//;
  615:        chomp($configline);
  616:        if ($configline) {
  617:           $desklines[$#desklines+1]=$configline;
  618:        }
  619:     }
  620:    }
  621:    $readdesk='done';
  622:   }
  623: }
  624: 
  625: 1;
  626: __END__
  627: 
  628: 
  629: 
  630: 
  631: 
  632: 
  633: 

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