Annotation of loncom/interface/lonmainmenu.pm, revision 1.2

1.1       albertel    1: # The LearningOnline Network with CAPA
                      2: # displays the main menu
                      3: #
1.2     ! albertel    4: # $Id: lonmainmenu.pm,v 1.1 2006/04/07 22:28:40 albertel Exp $
1.1       albertel    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: # There are two parameters controlling the action of this module:
                     30: #
                     31: # browser.interface - if this is 'textual', it overrides the second parameter
                     32: # and goes to screen reader PDA mode
                     33: #
                     34: # environment.remote - if this is 'on', the routines controll the remote
                     35: # control, otherwise they render the main window controls; ignored it
                     36: # browser.interface is 'textual'
                     37: #
                     38: 
                     39: package Apache::lonmainmenu;
                     40: 
                     41: use strict;
                     42: use Apache::Constants qw(:common);
                     43: use Apache::loncommon();
1.2     ! albertel   44: use Apache::lonnet;
        !            45: use Apache::lonmenu();
1.1       albertel   46: 
                     47: sub handler {
                     48:     my $r = shift;
                     49:     &Apache::loncommon::no_cache($r);
                     50:     &Apache::loncommon::content_type($r,'text/html');
                     51:     $r->send_http_header;
                     52:     return OK if $r->header_only;
                     53: 
                     54:     my $form;
                     55:     if ($env{'environment.remote'} ne 'off' &&
                     56: 	$env{'browser.interface'} ne 'textual') {
                     57: 	$form=&Apache::lonmenu::serverform();
                     58:     }
                     59:     my $function='student';
                     60:     if ($env{'request.role'}=~/^(cc|in|ta|ep)/) {
                     61: 	$function='coordinator';
                     62:     }
                     63:     if ($env{'request.role'}=~/^(su|dc|ad|li)/) {
                     64: 	$function='admin';
                     65:     }
                     66:     if (($env{'request.role'}=~/^(au|ca)/) ||
                     67: 	($env{'request.noversionuri'}=~/^(\/priv|\~)/)) {
                     68: 	$function='author';
                     69:     }
                     70:     my $domain=&Apache::loncommon::determinedomain();
1.2     ! albertel   71:     # FIXME these don't have the effect on the vars in lonmenu
        !            72:     # that they used to have
        !            73:     my $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain);
        !            74:     my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);
        !            75:     my $font=&Apache::loncommon::designparm($function.'.font',$domain);
1.1       albertel   76:     my $script_tag;
                     77:     if ($env{'environment.remote'} ne 'off') {
                     78:         my $utility=&Apache::lonmenu::utilityfunctions('/adm/menu');
                     79:         $script_tag=(<<ENDSCRIPT);
                     80: <script type="text/javascript">
                     81: $utility
                     82: </script>
                     83: ENDSCRIPT
                     84:     }
                     85: # ---- Print the screen, pretend to be in text mode to generate text-based menu
                     86:     unless ($env{'browser.interface'} eq 'textual') {
                     87: 	$env{'browser.interface'}='faketextual';
                     88: 	$env{'environment.remote'}='off';
                     89:     }
                     90:     $r->print(&Apache::loncommon::start_page('Main Menu',$script_tag));
                     91:     $r->print('<table>'.&Apache::lonmenu::inlinemenu().'</table>'.$form);
                     92:     $r->print(&Apache::loncommon::end_page());
                     93:     return OK;
                     94: }
                     95: 
                     96: 
                     97: 1;
                     98: __END__
                     99: 
                    100: 
                    101: 
                    102: 
                    103: 
                    104: 
                    105: 

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