version 1.28, 2002/11/18 15:23:32
|
version 1.33, 2003/02/13 15:52:53
|
Line 36 package Apache::lonmenu;
|
Line 36 package Apache::lonmenu;
|
|
|
use strict; |
use strict; |
use Apache::lonnet; |
use Apache::lonnet; |
|
use Apache::Constants qw(:common); |
|
use Apache::loncommon; |
use Apache::File; |
use Apache::File; |
use vars qw(@desklines $readdesk); |
use vars qw(@desklines $readdesk); |
|
|
|
# ============================================================= Start up remote |
|
|
|
sub startupremote { |
|
my ($lowerurl)=@_; |
|
my $configmenu=&rawconfig(); |
|
return(<<ENDREMOTESTARTUP); |
|
<script> |
|
|
|
// ---------------------------------------------------------- The wait function |
|
var canceltim; |
|
function wait() { |
|
if ((menuloaded==1) || (tim==1)) { |
|
if (tim==0) { |
|
clearTimeout(canceltim); |
|
$configmenu |
|
window.location='$lowerurl'; |
|
} else { |
|
alert("Remote Control Timed Out."); |
|
} |
|
} else { |
|
setTimeout('wait();',100); |
|
} |
|
} |
|
|
|
function main() { |
|
canceltim=setTimeout('tim=1;',80000); |
|
wait(); |
|
} |
|
|
|
</script> |
|
ENDREMOTESTARTUP |
|
} |
|
|
|
sub setflags() { |
|
return(<<ENDSETFLAGS); |
|
<script> |
|
menuloaded=0; |
|
tim=0; |
|
</script> |
|
ENDSETFLAGS |
|
} |
|
|
|
sub maincall() { |
|
return(<<ENDMAINCALL); |
|
<script> |
|
main(); |
|
</script> |
|
ENDMAINCALL |
|
} |
|
# ================================================================= Reopen menu |
|
|
|
sub reopenmenu { |
|
my $nothing=''; |
|
my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; |
|
if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; } |
|
return('window.open("'.$nothing.'","'.$menuname.'","",false);'); |
|
} |
|
|
# =============================================================== Open the menu |
# =============================================================== Open the menu |
|
|
sub open { |
sub open { |
my $returnval=''; |
my $returnval=''; |
|
my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; |
unless (shift eq 'unix') { |
unless (shift eq 'unix') { |
# resizing does not work on linux because of virtual desktop sizes |
# resizing does not work on linux because of virtual desktop sizes |
$returnval.=(<<ENDRESIZE); |
$returnval.=(<<ENDRESIZE); |
Line 53 if (window.screen) {
|
Line 114 if (window.screen) {
|
ENDRESIZE |
ENDRESIZE |
} |
} |
$returnval.=(<<ENDOPEN); |
$returnval.=(<<ENDOPEN); |
var menu=window.open("/res/adm/pages/menu.html","LONCAPAmenu", |
var menu=window.open("/res/adm/pages/menu.html","$menuname", |
"height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5"); |
"height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5"); |
ENDOPEN |
ENDOPEN |
return '<script>'.$returnval.'</script>'; |
return '<script>'.$returnval.'</script>'; |
Line 104 sub secondlevel {
|
Line 165 sub secondlevel {
|
} |
} |
|
|
sub openmenu { |
sub openmenu { |
|
my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; |
if ($ENV{'browser.type'} eq 'explorer') { |
if ($ENV{'browser.type'} eq 'explorer') { |
return "window.open('javascript:void(0);','LONCAPAmenu');"; |
return "window.open('javascript:void(0);','".$menuname."');"; |
} else { |
} else { |
return "window.open('','LONCAPAmenu');"; |
return "window.open('','".$menuname."');"; |
} |
} |
} |
} |
|
|
sub rawconfig { |
sub rawconfig { |
my $r = shift; |
|
my $output="var swmenu=".&openmenu(); |
my $output="var swmenu=".&openmenu(); |
my $uname=$ENV{'user.name'}; |
my $uname=$ENV{'user.name'}; |
my $udom=$ENV{'user.domain'}; |
my $udom=$ENV{'user.domain'}; |
Line 161 sub rawconfig {
|
Line 222 sub rawconfig {
|
} |
} |
} elsif ($pro eq 'author') { |
} elsif ($pro eq 'author') { |
if ($author) { |
if ($author) { |
if (($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) { |
if ((($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) || |
|
(($prt eq 'rau') && ($ENV{'request.role'}=~/^au/))) { |
# Check that we are on the correct machine |
# Check that we are on the correct machine |
my ($cadom,$caname)= |
my $cadom=$requested_domain; |
|
my $caname=$ENV{'user.name'}; |
|
if ($prt eq 'rca') { |
|
($cadom,$caname)= |
($ENV{'request.role'}=~/(\w+)\/(\w+)$/); |
($ENV{'request.role'}=~/(\w+)\/(\w+)$/); |
|
} |
|
$act =~ s/\$caname/$caname/g; |
my $home = &Apache::lonnet::homeserver($caname,$cadom); |
my $home = &Apache::lonnet::homeserver($caname,$cadom); |
if ($home eq $r->dir_config('lonHostID')) { |
if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) { |
$output.=switch($caname,$cadom, |
$output.=switch($caname,$cadom, |
$row,$col,$img,$top,$bot,$act,$desc); |
$row,$col,$img,$top,$bot,$act,$desc); |
} |
} |
} elsif ($prt eq 'any') { |
|
my $home = &Apache::lonnet::homeserver |
|
($ENV{'user.name'},$ENV{'user.domain'}); |
|
if ($home eq $r->dir_config('lonHostID')) { |
|
$output.=switch |
|
($ENV{'user.name'},$ENV{'user.domain'}, |
|
$row,$col,$img,$top,$bot,$act,$desc); |
|
} |
|
} |
} |
} |
} |
} |
} |
Line 189 sub rawconfig {
|
Line 248 sub rawconfig {
|
# ======================================================================= Close |
# ======================================================================= Close |
|
|
sub close { |
sub close { |
|
my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; |
return(<<ENDCLOSE); |
return(<<ENDCLOSE); |
<script> |
<script> |
menu=window.open("/adm/rat/empty.html","LONCAPAmenu", |
menu=window.open("/adm/rat/empty.html","$menuname", |
"height=350,width=150,scrollbars=no,menubar=no"); |
"height=350,width=150,scrollbars=no,menubar=no"); |
|
menu.autologout=0; |
menu.close(); |
menu.close(); |
</script> |
</script> |
ENDCLOSE |
ENDCLOSE |
Line 204 sub footer {
|
Line 265 sub footer {
|
|
|
} |
} |
|
|
|
# ================================================ Handler when called directly |
|
|
|
|
|
sub handler { |
|
my $r = shift; |
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
|
return OK if $r->header_only; |
|
|
|
# ------------------------------------------------------------ Print the screen |
|
$r->print('<html><head><title>LON-CAPA Main Menu</title></head>'); |
|
$r->print('<body bgcolor="#FFFFFF">'); |
|
$r->print('<h1>LON-CAPA Main Menu</h1>'); |
|
$r->print('</body></html>'); |
|
return OK; |
|
} |
|
|
# ================================================================ Main Program |
# ================================================================ Main Program |
|
|
BEGIN { |
BEGIN { |
Line 223 BEGIN {
|
Line 301 BEGIN {
|
$readdesk='done'; |
$readdesk='done'; |
} |
} |
} |
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|