![]() ![]() | ![]() |
- making few more logos go against lonhttpd
1: # The LearningOnline Network with CAPA 2: # Routines to control the menu 3: # 4: # $Id: lonmenu.pm,v 1.146 2005/02/13 22:52:48 albertel 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: # 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::lonmenu; 40: 41: use strict; 42: use Apache::lonnet(); 43: use Apache::Constants qw(:common); 44: use Apache::lonhtmlcommon(); 45: use Apache::loncommon(); 46: use Apache::lonenc(); 47: use Apache::lonlocal; 48: 49: use vars qw(@desklines $readdesk); 50: 51: 52: my @inlineremote; 53: my $font; 54: my $tabbg; 55: my $pgbg; 56: 57: # ================================================================ Little texts 58: 59: sub initlittle { 60: return &Apache::lonlocal::texthash('ret' => 'Return to Last Location', 61: 'nav' => 'Navigate Contents', 62: 'main' => 'Main Menu', 63: 'launch' => 'Launch Remote Control'); 64: } 65: 66: # ============================= This gets called at the top of the body section 67: 68: sub menubuttons { 69: my $forcereg=shift; 70: my $target =shift; 71: my $registration=shift; 72: my $titletable=shift; 73: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, 74: ['inhibitmenu']); 75: if ($ENV{'form.inhibitmenu'} eq 'yes') { return ''; } 76: 77: my $navmaps=''; 78: my $reloadlink=''; 79: my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'})); 80: my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.symb'})); 81: if ($ENV{'request.state'} eq 'construct') { 82: if (($ENV{'request.noversionuri'} eq '') || (!defined($ENV{'request.noversionuri'}))) { 83: my $returnurl = $ENV{'request.filename'}; 84: $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:; 85: $escurl = &Apache::lonnet::escape($returnurl); 86: } 87: } 88: if ($ENV{'browser.interface'} eq 'textual') { 89: # Textual display only 90: my %lt=&initlittle(); 91: $pgbg='#FFFFFF'; 92: $tabbg='#FFFFFF'; 93: $font='#000000'; 94: if ($ENV{'request.course.id'}) { 95: $navmaps=(<<ENDNAV); 96: <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">$lt{'nav'}</a> 97: ENDNAV 98: if (($ENV{'request.noversionuri'}=~/^\/adm\//) && 99: ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) && 100: ($ENV{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) { 101: my $escreload=&Apache::lonnet::escape('return:'); 102: $reloadlink=(<<ENDRELOAD); 103: <a href="/adm/flip?postdata=$escreload" target="_top"><font color="$font">$lt{'ret'}</font></a> 104: ENDRELOAD 105: } 106: } 107: my $form=&serverform(); 108: my $utility=&utilityfunctions(); 109: my $output=(<<ENDMAINMENU); 110: <script type="text/javascript"> 111: // BEGIN LON-CAPA Internal 112: $utility 113: </script> 114: <a href="/adm/menu" target="_top">$lt{'main'}</a> 115: $reloadlink $navmaps<br /> 116: <script type="text/javascript"> 117: // END LON-CAPA Internal 118: </script> 119: $form 120: ENDMAINMENU 121: if ($registration) { $output.=&innerregister($forcereg,$target); } 122: return $output."<hr />"; 123: } elsif ($ENV{'environment.remote'} eq 'off') { 124: # Remote Control is switched off 125: # figure out colors 126: my %lt=&initlittle(); 127: my $function='student'; 128: if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) { 129: $function='coordinator'; 130: } 131: if ($ENV{'request.role'}=~/^(su|dc|ad|li)/) { 132: $function='admin'; 133: } 134: if (($ENV{'request.role'}=~/^(au|ca)/) || 135: ($ENV{'request.noversionuri'}=~/^(\/priv|\~)/)) { 136: $function='author'; 137: } 138: my $domain=&Apache::loncommon::determinedomain(); 139: $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); 140: $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); 141: $font=&Apache::loncommon::designparm($function.'.font',$domain); 142: my $link=&Apache::loncommon::designparm($function.'.link',$domain); 143: my $alink=&Apache::loncommon::designparm($function.'.alink',$domain); 144: my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain); 145: my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain); 146: # Do we have a NAV link? 147: if ($ENV{'request.course.id'}) { 148: my $link='/adm/navmaps?postdata='.$escurl.'&postsymb='. 149: $escsymb; 150: if ($ENV{'environment.remotenavmap'} eq 'on') { 151: $link="javascript:gonav('".$link."')"; 152: } 153: $navmaps=(<<ENDNAV); 154: <td bgcolor="$tabbg"> 155: <a href="$link"><font color="$font">$lt{'nav'}</font></a></td> 156: ENDNAV 157: if ( 158: ($ENV{'request.noversionuri'}=~m[^/(res|public)/] && 159: $ENV{'request.symb'} eq '') 160: || 161: (($ENV{'request.noversionuri'}=~/^\/adm\//) && 162: ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) && 163: ($ENV{'request.noversionuri'}!~ 164: m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)]) 165: ) 166: ) { 167: my $escreload=&Apache::lonnet::escape('return:'); 168: $reloadlink=(<<ENDRELOAD); 169: <td bgcolor="$tabbg"> 170: <a href="/adm/flip?postdata=$escreload" target="_top"><font color="$font">$lt{'ret'}</font></a></td> 171: ENDRELOAD 172: } 173: } 174: my $reg=''; 175: if ($registration) { 176: $reg=&innerregister($forcereg,$target,$titletable); 177: } 178: my $form=&serverform(); 179: my $utility=&utilityfunctions(); 180: my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif"); 181: return (<<ENDINLINEMENU); 182: <script type="text/javascript"> 183: // BEGIN LON-CAPA Internal 184: $utility 185: </script> 186: <font face="Arial,Helvetica,sans-serif"><table bgcolor="$pgbg" width="100%" border="0" cellpadding="1" cellspacing="1"> 187: <tr> 188: <td bgcolor="$tabbg"> 189: <a href="/adm/menu" target="_top"><font color="$font">$lt{'main'}</font></a> 190: </td> 191: $reloadlink 192: $navmaps 193: <td bgcolor="$tabbg"> 194: <a href="/adm/remote?action=launch&url=$escurl" target="_top"> 195: <font color="$font">$lt{'launch'}</font></a></td> 196: <td bgcolor="$tabbg"> 197: <img align="right" src="$logo" /> 198: <b>LON-CAPA</b></td> 199: $form 200: </tr> 201: </table> 202: </font> 203: <script type="text/javascript"> 204: // END LON-CAPA Internal 205: </script> 206: $reg 207: ENDINLINEMENU 208: } else { 209: return ''; 210: } 211: } 212: 213: # ====================================== This gets called in the header section 214: 215: sub registerurl { 216: my $forcereg=shift; 217: my $target = shift; 218: my $result = ''; 219: if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } 220: my $force_title=''; 221: if ($ENV{'request.state'} eq 'construct') { 222: $force_title=&Apache::lonxml::display_title(); 223: } 224: if ($target eq 'edit') { 225: $result .="<script type=\"text/javascript\">\n". 226: "if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n". 227: &Apache::loncommon::browser_and_searcher_javascript(). 228: "\n</script>\n"; 229: } 230: if (($ENV{'browser.interface'} eq 'textual') || 231: ($ENV{'environment.remote'} eq 'off') || 232: ((($ENV{'request.publicaccess'}) || 233: (!&Apache::lonnet::is_on_map( 234: &Apache::lonnet::unescape($ENV{'request.noversionuri'})))) && 235: (!$forcereg))) { 236: return $result. 237: '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>'.$force_title; 238: } 239: # Graphical display after login only 240: if ($Apache::lonxml::registered && !$forcereg) { return ''; } 241: if ($target ne 'edit') { 242: $result.=&innerregister($forcereg,$target); 243: } 244: return $result.$force_title; 245: } 246: 247: # =========== This gets called in order to register a URL, both with the Remote 248: # =========== and in the body of the document 249: 250: sub innerregister { 251: my $forcereg=shift; 252: my $target = shift; 253: my $titletable = shift; 254: my $result = ''; 255: my ($uname,$thisdisfn); 256: my $const_space = ($ENV{'request.state'} eq 'construct'); 257: my $is_const_dir = 0; 258: 259: if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } 260: 261: $Apache::lonxml::registered=1; 262: 263: my $textinter=($ENV{'browser.interface'} eq 'textual'); 264: my $noremote=($ENV{'environment.remote'} eq 'off'); 265: 266: my $textual=($textinter || $noremote); 267: 268: @inlineremote=(); 269: undef @inlineremote; 270: 271: my $reopen=&Apache::lonmenu::reopenmenu(); 272: 273: my $newmail=''; 274: if ($noremote) { 275: $newmail='<font face="Arial,Helvetica,sans-serif"><table bgcolor="'.$pgbg.'" border="0" cellspacing="1" cellpadding="1" width="100%"><tr><td bgcolor="'.$tabbg.'">'; 276: } 277: if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) { 278: my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($ENV{'request.symb'}); 279: $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; 280: my $maptitle=&Apache::lonnet::gettitle($mapurl); 281: my $restitle=&Apache::lonnet::gettitle($resurl); 282: if ($maptitle && $maptitle ne 'default.sequence') { 283: $newmail.=', '.$maptitle; 284: } 285: if ($restitle) { 286: $newmail.=': '.$restitle; 287: } 288: $newmail.=' '; 289: } 290: if (&Apache::lonmsg::newmail()) { 291: $newmail=($textual? 292: '<b><a href="/adm/communicate" target="_top">You have new messages</a></b><br />': 293: 'swmenu.setstatus("you have","messages");'); 294: } 295: if ($ENV{'request.state'} eq 'construct') { 296: $newmail = $titletable; 297: } 298: if ($noremote) { 299: $newmail.='</td></tr></table></font>'; 300: } 301: my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');'); 302: my $tablestart=($noremote?'<font face="Arial,Helvetica,sans-serif"><table bgcolor="'.$pgbg.'" border="0" cellspacing="1" cellpadding="1" width="100%">':'').($textinter?'<br /><a href="#content">'.&mt('Skip to Content').'</a><br />':''); 303: my $tableend=($noremote?'</table></font>':'').($textinter?'<a name="content" />':''); 304: # ============================================================================= 305: # ============================ This is for URLs that actually can be registered 306: if (($ENV{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) { 307: # -- This applies to homework problems for users with grading privileges 308: my $crs='/'.$ENV{'request.course.id'}; 309: if ($ENV{'request.course.sec'}) { 310: $crs.='_'.$ENV{'request.course.sec'}; 311: } 312: $crs=~s/\_/\//g; 313: 314: my $hwkadd=''; 315: if ($ENV{'request.symb'} ne '' && 316: $ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) { 317: if (&Apache::lonnet::allowed('vgr',$crs)) { 318: $hwkadd.=&switch('','',7,1,'subm.gif','view sub-[_1]','missions[_1]', 319: "gocmd('/adm/grades','submission')", 320: 'View user submissions for this assessment resource'); 321: } 322: if (&Apache::lonnet::allowed('mgr',$crs)) { 323: $hwkadd.=&switch('','',7,2,'pgrd.gif','problem[_1]','grades[_3]', 324: "gocmd('/adm/grades','gradingmenu')", 325: 'Modify user grades for this assessment resource'); 326: } 327: } 328: if ($ENV{'request.symb'} ne '' && 329: &Apache::lonnet::allowed('opa',$crs)) { 330: $hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]', 331: "gocmd('/adm/parmset','set')", 332: 'Modify deadlines, etc, for this resource'); 333: } 334: # -- End Homework 335: ### 336: ### Determine whether or not to display the 'cstr' button for this 337: ### resource 338: ### 339: my $editbutton = ''; 340: if ($ENV{'user.author'}) { 341: if ($ENV{'request.role'}=~/^(ca|au)/) { 342: # Set defaults for authors 343: my ($top,$bottom) = ('con-','struct'); 344: my $action = "go('/priv/".$ENV{'user.name'}."');"; 345: my $cadom = $ENV{'request.role.domain'}; 346: my $caname = $ENV{'user.name'}; 347: my $desc = "Enter my resource construction space"; 348: # Set defaults for co-authors 349: if ($ENV{'request.role'} =~ /^ca/) { 350: ($cadom,$caname)=($ENV{'request.role'}=~/(\w+)\/(\w+)$/); 351: ($top,$bottom) = ('co con-','struct'); 352: $action = "go('/priv/".$caname."');"; 353: $desc = "Enter construction space as co-author"; 354: } 355: # Check that we are on the correct machine 356: my $home = &Apache::lonnet::homeserver($caname,$cadom); 357: my $allowed=0; 358: my @ids=&Apache::lonnet::current_machine_ids(); 359: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } 360: if (!$allowed) { 361: $editbutton=&switch('','',6,1,$top,,$bottom,$action,$desc); 362: } 363: } 364: ## 365: ## Determine if user can edit url. 366: ## 367: my $cfile=''; 368: my $cfuname=''; 369: my $cfudom=''; 370: if ($ENV{'request.filename'}) { 371: my $file=&Apache::lonnet::declutter($ENV{'request.filename'}); 372: $file=~s/^(\w+)\/(\w+)/\/priv\/$2/; 373: # Check that the user has permission to edit this resource 374: ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1); 375: if (defined($cfudom)) { 376: my $home=&Apache::lonnet::homeserver($cfuname,$cfudom); 377: my $allowed=0; 378: my @ids=&Apache::lonnet::current_machine_ids(); 379: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } 380: if ($allowed) { 381: $cfile=$file; 382: } 383: } 384: } 385: # Finally, turn the button on or off 386: if ($cfile && !$const_space) { 387: $editbutton=&switch 388: ('','',6,1,'cstr.gif','edit[_1]','resource[_2]', 389: "go('".$cfile."');","Edit this resource"); 390: } elsif ($editbutton eq '') { 391: $editbutton=&clear(6,1); 392: } 393: } 394: ### 395: ### 396: # Prepare the rest of the buttons 397: my $menuitems; 398: if ($const_space) { 399: my ($uname,$thisdisfn) = 400: ($ENV{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|); 401: my $currdir = '/priv/'.$uname.'/'.$thisdisfn; 402: if ($currdir =~ m-/$-) { 403: $is_const_dir = 1; 404: } else { 405: $currdir =~ s#[^/]+$##; 406: $menuitems=(<<ENDMENUITEMS); 407: s&6&1&list.gif&list[_1]&dir[_1]&golist('$currdir')&List current directory 408: s&6&2&rtrv.gif&retrieve[_1]&version[_1]&gocstr('/adm/retrieve','/~$uname/$thisdisfn')&Retrieve old version 409: s&6&3&pub.gif&publish[_1]&resource[_1]&gocstr('/adm/publish','/~$uname/$thisdisfn')&Publish this resource 410: s&7&1&del.gif&delete[_1]&resource[_2]&gocstr('/adm/cfile?action=delete','/~$uname/$thisdisfn')&Delete this resource 411: s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$thisdisfn')&Prepare a printable document 412: ENDMENUITEMS 413: } 414: } elsif (defined($ENV{'request.course.id'}) && 415: $ENV{'request.symb'} ne '') { 416: $menuitems=(<<ENDMENUITEMS); 417: c&3&1 418: s&2&1&back.gif&backward[_1]&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&1 419: s&2&3&forw.gif&forward[_1]&&gopost('/adm/flip','forward:'+currentURL)&Go to the next resource in the course sequence&3 420: c&6&3 421: c&8&1 422: c&8&2 423: s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document 424: s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&2 425: s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&2 426: ENDMENUITEMS 427: unless ($ENV{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { 428: $menuitems.=(<<ENDREALRES); 429: s&6&3&catalog.gif&catalog[_1]&info[_1]&catalog_info()&Show catalog information 430: s&8&1&eval.gif&evaluate[_1]&this[_1]&gopost('/adm/evaluate',currentURL,1)&Provide my evaluation of this resource 431: s&8&2&fdbk.gif&feedback[_1]&discuss[_1]&gopost('/adm/feedback',currentURL,1)&Provide feedback messages or contribute to the course discussion about this resource 432: ENDREALRES 433: } 434: } 435: my $buttons=''; 436: foreach (split(/\n/,$menuitems)) { 437: my ($command,@rest)=split(/\&/,$_); 438: if ($command eq 's') { 439: $buttons.=&switch('','',@rest); 440: } else { 441: $buttons.=&clear(@rest); 442: } 443: } 444: my $addremote=0; 445: foreach (@inlineremote) { if ($_ ne '') { $addremote=1; } } 446: if ($textual && $addremote) { 447: # Registered, textual output 448: my $inlinebuttons=''; 449: 450: if ($ENV{'browser.interface'} eq 'textual') { 451: $inlinebuttons= 452: join('',map { (defined($_)?$_:'') } @inlineremote); 453: } else { 454: $inlinebuttons=(<<ENDINLINE); 455: <tr><td>$inlineremote[21]</td><td> </td><td>$inlineremote[23]</td></tr> 456: <tr><td>$inlineremote[61]</td><td>$inlineremote[62]</td><td>$inlineremote[63]</td></tr> 457: <tr><td>$inlineremote[71]</td><td>$inlineremote[72]</td><td>$inlineremote[73]</td></tr> 458: <tr><td>$inlineremote[81]</td><td>$inlineremote[82]</td><td>$inlineremote[83]</td></tr> 459: <tr><td>$inlineremote[91]</td><td>$inlineremote[92]</td><td>$inlineremote[93]</td></tr> 460: ENDINLINE 461: } 462: if ($const_space && $is_const_dir) { 463: $inlinebuttons = ''; 464: } 465: $result =(<<ENDREGTEXT); 466: <script type="text/javascript"> 467: // BEGIN LON-CAPA Internal 468: </script> 469: $timesync 470: $newmail 471: $tablestart 472: $inlinebuttons 473: $tableend 474: <script type="text/javascript"> 475: // END LON-CAPA Internal 476: </script> 477: 478: ENDREGTEXT 479: # Registered, graphical output 480: } else { 481: my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$ENV{'request.noversionuri'}))[0])); 482: $requri=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($requri)); 483: my $cursymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'}); 484: my $navstatus=&get_nav_status(); 485: my $clearcstr; 486: if ($ENV{'user.adv'}) { $clearcstr='clearbut(6,1)'; } 487: $result = (<<ENDREGTHIS); 488: 489: <script type="text/javascript"> 490: // BEGIN LON-CAPA Internal 491: var swmenu=null; 492: 493: function LONCAPAreg() { 494: swmenu=$reopen; 495: swmenu.clearTimeout(swmenu.menucltim); 496: $timesync 497: $newmail 498: $buttons 499: swmenu.currentURL="$requri"; 500: swmenu.reloadURL=swmenu.currentURL+window.location.search; 501: swmenu.currentSymb="$cursymb"; 502: swmenu.reloadSymb="$cursymb"; 503: swmenu.currentStale=0; 504: $navstatus 505: $hwkadd 506: $editbutton 507: } 508: 509: function LONCAPAstale() { 510: swmenu=$reopen 511: swmenu.currentStale=1; 512: if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) { 513: swmenu.switchbutton 514: (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence'); 515: } 516: swmenu.clearbut(7,1); 517: swmenu.clearbut(7,2); 518: swmenu.clearbut(7,3); 519: swmenu.menucltim=swmenu.setTimeout( 520: 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+ 521: 'clearbut(9,1);clearbut(9,3);clearbut(6,3);$clearcstr', 522: 2000); 523: } 524: 525: // END LON-CAPA Internal 526: </script> 527: ENDREGTHIS 528: } 529: # ============================================================================= 530: } else { 531: # ========================================== This can or will not be registered 532: if ($textual) { 533: # Not registered, textual 534: $result= (<<ENDDONOTREGTEXT); 535: ENDDONOTREGTEXT 536: } else { 537: # Not registered, graphical 538: $result = (<<ENDDONOTREGTHIS); 539: 540: <script type="text/javascript"> 541: // BEGIN LON-CAPA Internal 542: var swmenu=null; 543: 544: function LONCAPAreg() { 545: swmenu=$reopen 546: $timesync 547: swmenu.currentStale=1; 548: swmenu.clearbut(2,1); 549: swmenu.clearbut(2,3); 550: swmenu.clearbut(8,1); 551: swmenu.clearbut(8,2); 552: swmenu.clearbut(8,3); 553: if (swmenu.currentURL) { 554: swmenu.switchbutton 555: (3,1,'reload.gif','return','location','go(currentURL)'); 556: } else { 557: swmenu.clearbut(3,1); 558: } 559: } 560: 561: function LONCAPAstale() { 562: } 563: 564: // END LON-CAPA Internal 565: </script> 566: ENDDONOTREGTHIS 567: } 568: # ============================================================================= 569: } 570: return $result; 571: } 572: 573: sub loadevents() { 574: if ($ENV{'request.state'} eq 'construct' || 575: $ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } 576: return 'LONCAPAreg();'; 577: } 578: 579: sub unloadevents() { 580: if ($ENV{'request.state'} eq 'construct' || 581: $ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } 582: return 'LONCAPAstale();'; 583: } 584: 585: # ============================================================= Start up remote 586: 587: sub startupremote { 588: my ($lowerurl)=@_; 589: if (($ENV{'browser.interface'} eq 'textual') || 590: ($ENV{'environment.remote'} eq 'off')) { 591: return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />'); 592: } 593: # 594: # The Remote actually gets launched! 595: # 596: my $configmenu=&rawconfig(); 597: my $esclowerurl=&Apache::lonnet::escape($lowerurl); 598: my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited'); 599: return(<<ENDREMOTESTARTUP); 600: <script type="text/javascript"> 601: var timestart; 602: function wheelswitch() { 603: if (typeof(document.wheel) != 'undefined') { 604: if (typeof(document.wheel.spin) != 'undefined') { 605: var date=new Date(); 606: var waited=Math.round(30-((date.getTime()-timestart)/1000)); 607: document.wheel.spin.value=$message; 608: } 609: } 610: if (window.status=='|') { 611: window.status='/'; 612: } else { 613: if (window.status=='/') { 614: window.status='-'; 615: } else { 616: if (window.status=='-') { 617: window.status='\\\\'; 618: } else { 619: if (window.status=='\\\\') { window.status='|'; } 620: } 621: } 622: } 623: } 624: 625: // ---------------------------------------------------------- The wait function 626: var canceltim; 627: function wait() { 628: if ((menuloaded==1) || (tim==1)) { 629: window.status='Done.'; 630: if (tim==0) { 631: clearTimeout(canceltim); 632: $configmenu 633: window.location='$lowerurl'; 634: } else { 635: window.location='/adm/remote?action=collapse&url=$esclowerurl'; 636: } 637: } else { 638: wheelswitch(); 639: setTimeout('wait();',200); 640: } 641: } 642: 643: function main() { 644: canceltim=setTimeout('tim=1;',30000); 645: window.status='-'; 646: var date=new Date(); 647: timestart=date.getTime(); 648: wait(); 649: } 650: 651: </script> 652: ENDREMOTESTARTUP 653: } 654: 655: sub setflags() { 656: return(<<ENDSETFLAGS); 657: <script type="text/javascript"> 658: menuloaded=0; 659: tim=0; 660: </script> 661: ENDSETFLAGS 662: } 663: 664: sub maincall() { 665: if (($ENV{'browser.interface'} eq 'textual') || 666: ($ENV{'environment.remote'} eq 'off')) { return ''; } 667: return(<<ENDMAINCALL); 668: <script type="text/javascript"> 669: main(); 670: </script> 671: ENDMAINCALL 672: } 673: 674: sub load_remote_msg { 675: my ($lowerurl)=@_; 676: 677: if (($ENV{'browser.interface'} eq 'textual') || 678: ($ENV{'environment.remote'} eq 'off')) { return ''; } 679: 680: my $esclowerurl=&Apache::lonnet::escape($lowerurl); 681: my $link=&mt('<a href="[_1]">Continue</a> on in Inline Menu mode', 682: "/adm/remote?action=collapse?url=$esclowerurl"); 683: return(<<ENDREMOTEFORM); 684: <p> 685: <form name="wheel"> 686: <input name="spin" type="text" size="60" /> 687: </form> 688: </p> 689: <p>$link</p> 690: ENDREMOTEFORM 691: } 692: # ================================================================= Reopen menu 693: 694: sub reopenmenu { 695: if (($ENV{'browser.interface'} eq 'textual') || 696: ($ENV{'environment.remote'} eq 'off')) { return ''; } 697: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; 698: my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); 699: return('window.open('.$nothing.',"'.$menuname.'","",false);'); 700: } 701: 702: # =============================================================== Open the menu 703: 704: sub open { 705: my $returnval=''; 706: if (($ENV{'browser.interface'} eq 'textual') || 707: ($ENV{'environment.remote'} eq 'off')) { 708: return '<script type="text/javascript">self.name="loncapaclient";</script>'; 709: } 710: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; 711: unless (shift eq 'unix') { 712: # resizing does not work on linux because of virtual desktop sizes 713: $returnval.=(<<ENDRESIZE); 714: if (window.screen) { 715: self.resizeTo(screen.availWidth-215,screen.availHeight-55); 716: self.moveTo(190,15); 717: } 718: ENDRESIZE 719: } 720: $returnval.=(<<ENDOPEN); 721: window.status='Opening LON-CAPA Remote Control'; 722: var menu=window.open("/res/adm/pages/menu.html","$menuname", 723: "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5"); 724: self.name='loncapaclient'; 725: ENDOPEN 726: return '<script type="text/javascript">'.$returnval.'</script>'; 727: } 728: 729: 730: # ================================================================== Raw Config 731: 732: sub clear { 733: my ($row,$col)=@_; 734: unless (($ENV{'browser.interface'} eq 'textual') || 735: ($ENV{'environment.remote'} eq 'off')) { 736: return "\n".qq(window.status+='.';swmenu.clearbut($row,$col);); 737: } else { 738: $inlineremote[10*$row+$col]=''; 739: return ''; 740: } 741: } 742: 743: # ============================================ Switch a button or create a link 744: # Switch acts on the javascript that is executed when a button is clicked. 745: # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)". 746: 747: sub switch { 748: my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$nobreak)=@_; 749: $act=~s/\$uname/$uname/g; 750: $act=~s/\$udom/$udom/g; 751: $top=&mt($top); 752: $bot=&mt($bot); 753: $desc=&mt($desc); 754: $img=&mt($img); 755: unless (($ENV{'browser.interface'} eq 'textual') || 756: ($ENV{'environment.remote'} eq 'off')) { 757: # Remote 758: return "\n". 759: qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc");); 760: } elsif ($ENV{'browser.interface'} eq 'textual') { 761: # Accessibility 762: if ($nobreak==2) { return ''; } 763: my $text=$top.' '.$bot; 764: $text=~s/\s*\-\s*//gs; 765: if ($nobreak) { 766: $inlineremote[10*$row+$col]= 767: '<a href="javascript:'.$act.';">'.$text.'</a>'; 768: } else { 769: $inlineremote[10*$row+$col]="\n<br />". 770: $desc.' <a href="javascript:'.$act.';">'.$text.'</a>'; 771: } 772: } else { 773: # Inline Remote 774: if ($nobreak==2) { return ''; } 775: my $text=$top.' '.$bot; 776: $text=~s/\s*\-\s*//gs; 777: 778: my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; 779: if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } 780: my $pic= 781: '<img border="0" alt="'.$text.'" src="http://'.$ENV{'HTTP_HOST'}. 782: ':'.$lonhttpdPort.'/res/adm/pages/'.$img.'" align="'. 783: ($nobreak==3?'right':'left').'" />'; 784: if (($ENV{'browser.interface'} eq 'textual') || ($ENV{'browser.interface'} eq 'faketextual')) { 785: # Accessibility 786: if ($nobreak==3) { 787: $inlineremote[10*$row+$col]="\n". 788: '<td width="40%" align="right"><font color="'.$font.'" size="+1">'.$text. 789: '</font></td><td width="10%" align="right" bgcolor="'.$tabbg.'">'. 790: '<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>'; 791: } elsif ($nobreak) { 792: $inlineremote[10*$row+$col]="\n<tr>". 793: '<td width="10%" align="left" bgcolor="'.$tabbg.'">'. 794: '<a href="javascript:'.$act.';">'.$pic. 795: '</a></td><td width="40%" align="left"><font color="'.$font.'" size="+1">'.$text.'</font></td>'; 796: } else { 797: $inlineremote[10*$row+$col]="\n<tr>". 798: '<td width="10%" align="left" bgcolor="'.$tabbg.'">'. 799: '<a href="javascript:'.$act.';">'.$pic. 800: '</a></td><td colspan="3"><font color="'.$font.'">'.$desc. 801: '</font></td></tr>'; 802: } 803: } else { 804: # Inline Menu 805: $inlineremote[10*$row+$col]= 806: '<a href="javascript:'.$act.';">'.$pic. 807: '</a><font color="'.$font.'" size="2">'.$desc. 808: '</font>'; 809: } 810: } 811: return ''; 812: } 813: 814: sub secondlevel { 815: my $output=''; 816: my 817: ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc)=@_; 818: if ($prt eq 'any') { 819: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc); 820: } elsif ($prt=~/^r(\w+)/) { 821: if ($rol eq $1) { 822: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc); 823: } 824: } 825: return $output; 826: } 827: 828: sub openmenu { 829: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; 830: if (($ENV{'browser.interface'} eq 'textual') || 831: ($ENV{'environment.remote'} eq 'off')) { return ''; } 832: my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); 833: return "window.open(".$nothing.",'".$menuname."');"; 834: } 835: 836: sub inlinemenu { 837: @inlineremote=(); 838: undef @inlineremote; 839: &rawconfig(1); 840: return join('',map { (defined($_)?$_:'') } @inlineremote); 841: } 842: 843: sub rawconfig { 844: my $textualoverride=shift; 845: my $output=''; 846: unless (($ENV{'browser.interface'} eq 'textual') || 847: ($ENV{'environment.remote'} eq 'off')) { 848: $output.= 849: "window.status='Opening Remote Control';var swmenu=".&openmenu(). 850: "\nwindow.status='Configuring Remote Control ';"; 851: } else { 852: unless ($textualoverride) { return ''; } 853: } 854: my $uname=$ENV{'user.name'}; 855: my $udom=$ENV{'user.domain'}; 856: my $adv=$ENV{'user.adv'}; 857: my $author=$ENV{'user.author'}; 858: my $crs=''; 859: if ($ENV{'request.course.id'}) { 860: $crs='/'.$ENV{'request.course.id'}; 861: if ($ENV{'request.course.sec'}) { 862: $crs.='_'.$ENV{'request.course.sec'}; 863: } 864: $crs=~s/\_/\//g; 865: } 866: my $pub=($ENV{'request.state'} eq 'published'); 867: my $con=($ENV{'request.state'} eq 'construct'); 868: my $rol=$ENV{'request.role'}; 869: my $requested_domain = $ENV{'request.role.domain'}; 870: foreach (@desklines) { 871: my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$_); 872: $prt=~s/\$uname/$uname/g; 873: $prt=~s/\$udom/$udom/g; 874: $prt=~s/\$crs/$crs/g; 875: $prt=~s/\$requested_domain/$requested_domain/g; 876: if ($pro eq 'clear') { 877: $output.=&clear($row,$col); 878: } elsif ($pro eq 'any') { 879: $output.=&secondlevel( 880: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc); 881: } elsif ($pro eq 'smp') { 882: unless ($adv) { 883: $output.=&secondlevel( 884: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc); 885: } 886: } elsif ($pro eq 'adv') { 887: if ($adv) { 888: $output.=&secondlevel( 889: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc); 890: } 891: } elsif (($pro=~/^p(\w+)/) && ($prt)) { 892: if (&Apache::lonnet::allowed($1,$prt)) { 893: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc); 894: } 895: } elsif ($pro eq 'course') { 896: if ($ENV{'request.course.fn'}) { 897: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc); 898: } 899: } elsif ($pro =~ /^courseenv_(.*)$/) { 900: my $key = $1; 901: if ($ENV{'course.'.$ENV{'request.course.id'}.'.'.$key}) { 902: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc); 903: } 904: } elsif ($pro =~ /^course_(.*)$/) { 905: # Check for permissions inside of a course 906: if (($ENV{'request.course.id'}) && 907: (&Apache::lonnet::allowed($1,$ENV{'request.course.id'}. 908: ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:'')) 909: )) { 910: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc); 911: } 912: } elsif ($pro eq 'author') { 913: if ($author) { 914: if ((($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) || 915: (($prt eq 'rau') && ($ENV{'request.role'}=~/^au/))) { 916: # Check that we are on the correct machine 917: my $cadom=$requested_domain; 918: my $caname=$ENV{'user.name'}; 919: if ($prt eq 'rca') { 920: ($cadom,$caname)= 921: ($ENV{'request.role'}=~/(\w+)\/(\w+)$/); 922: } 923: $act =~ s/\$caname/$caname/g; 924: my $home = &Apache::lonnet::homeserver($caname,$cadom); 925: my $allowed=0; 926: my @ids=&Apache::lonnet::current_machine_ids(); 927: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } 928: if ($allowed) { 929: $output.=switch($caname,$cadom, 930: $row,$col,$img,$top,$bot,$act,$desc); 931: } 932: } 933: } 934: } 935: } 936: unless (($ENV{'browser.interface'} eq 'textual') || 937: ($ENV{'environment.remote'} eq 'off')) { 938: $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';"; 939: if (&Apache::lonmsg::newmail()) { 940: $output.='swmenu.setstatus("you have","messages");'; 941: } 942: } 943: 944: return $output; 945: } 946: 947: # ======================================================================= Close 948: 949: sub close { 950: if (($ENV{'browser.interface'} eq 'textual') || 951: ($ENV{'environment.remote'} eq 'off')) { return ''; } 952: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; 953: return(<<ENDCLOSE); 954: <script type="text/javascript"> 955: window.status='Accessing Remote Control'; 956: menu=window.open("/adm/rat/empty.html","$menuname", 957: "height=350,width=150,scrollbars=no,menubar=no"); 958: window.status='Disabling Remote Control'; 959: menu.active=0; 960: menu.autologout=0; 961: window.status='Closing Remote Control'; 962: menu.close(); 963: window.status='Done.'; 964: </script> 965: ENDCLOSE 966: } 967: 968: # ====================================================================== Footer 969: 970: sub footer { 971: 972: } 973: 974: sub nav_control_js { 975: my $nav=($ENV{'environment.remotenavmap'} eq 'on'); 976: return (<<NAVCONTROL); 977: var w_loncapanav_flag="$nav"; 978: 979: 980: function gonav(url) { 981: if (w_loncapanav_flag != 1) { 982: gopost(url,''); 983: } else { 984: navwindow=window.open(url, 985: "loncapanav","height=600,width=400,scrollbars=1"); 986: } 987: } 988: NAVCONTROL 989: } 990: 991: sub utilityfunctions { 992: my $caller = shift; 993: unless (($ENV{'browser.interface'} eq 'textual') || 994: ($ENV{'environment.remote'} eq 'off') || ($caller eq '/adm/menu')) { return ''; } 995: my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$ENV{'request.noversionuri'}))[0])); 996: $currenturl=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($currenturl)); 997: 998: my $currentsymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'}); 999: my $nav_control=&nav_control_js(); 1000: return (<<ENDUTILITY) 1001: 1002: var currentURL="$currenturl"; 1003: var reloadURL="$currenturl"; 1004: var currentSymb="$currentsymb"; 1005: 1006: $nav_control 1007: 1008: function go(url) { 1009: if (url!='' && url!= null) { 1010: currentURL = null; 1011: currentSymb= null; 1012: window.location.href=url; 1013: } 1014: } 1015: 1016: function gopost(url,postdata) { 1017: if (url!='') { 1018: this.document.server.action=url; 1019: this.document.server.postdata.value=postdata; 1020: this.document.server.command.value=''; 1021: this.document.server.url.value=''; 1022: this.document.server.symb.value=''; 1023: this.document.server.submit(); 1024: } 1025: } 1026: 1027: function gocmd(url,cmd) { 1028: if (url!='') { 1029: this.document.server.action=url; 1030: this.document.server.postdata.value=''; 1031: this.document.server.command.value=cmd; 1032: this.document.server.url.value=currentURL; 1033: this.document.server.symb.value=currentSymb; 1034: this.document.server.submit(); 1035: } 1036: } 1037: 1038: function gocstr(url,filename) { 1039: if (url == '/adm/cfile?action=delete') { 1040: this.document.cstrdelete.filename.value = filename 1041: this.document.cstrdelete.submit(); 1042: return; 1043: } 1044: if (url == '/adm/printout') { 1045: this.document.cstrprint.postdata.value = filename 1046: this.document.cstrprint.curseed.value = 0; 1047: this.document.cstrprint.problemtype.value = 0; 1048: if (this.document.lonhomework) { 1049: if ((this.document.lonhomework.rndseed) && (this.document.lonhomework.rndseed.value != null) && (this.document.lonhomework.rndseed.value != '')) { 1050: this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value 1051: } 1052: if (this.document.lonhomework.problemtype) { 1053: for (var i=0; i<this.document.lonhomework.problemtype.options.length; i++) { 1054: if (this.document.lonhomework.problemtype.options[i].selected) { 1055: if (this.document.lonhomework.problemtype.options[i].value != null && this.document.lonhomework.problemtype.options[i].value != '') { 1056: this.document.cstrprint.problemtype.value = this.document.lonhomework.problemtype.options[i].value 1057: } 1058: } 1059: } 1060: } 1061: } 1062: this.document.cstrprint.submit(); 1063: return; 1064: } 1065: if (url !='') { 1066: this.document.constspace.filename.value = filename; 1067: this.document.constspace.action = url; 1068: this.document.constspace.submit(); 1069: } 1070: } 1071: 1072: function golist(url) { 1073: if (url!='' && url!= null) { 1074: currentURL = null; 1075: currentSymb= null; 1076: top.location.href=url; 1077: } 1078: } 1079: 1080: 1081: 1082: function catalog_info() { 1083: loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); 1084: } 1085: 1086: function chat_win() { 1087: lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); 1088: } 1089: ENDUTILITY 1090: } 1091: 1092: sub serverform { 1093: return(<<ENDSERVERFORM); 1094: 1095: <form name="server" action="/adm/logout" method="post" target="_top"> 1096: <input type="hidden" name="postdata" value="none" /> 1097: <input type="hidden" name="command" value="none" /> 1098: <input type="hidden" name="url" value="none" /> 1099: <input type="hidden" name="symb" value="none" /> 1100: </form> 1101: ENDSERVERFORM 1102: } 1103: 1104: sub constspaceform { 1105: return(<<ENDCONSTSPACEFORM); 1106: <form name="constspace" action="/adm/logout" method="post" target="_top"> 1107: <input type="hidden" name="filename" value="" /> 1108: </form> 1109: <form name="cstrdelete" action="/adm/cfile" method="post" target="_top"> 1110: <input type="hidden" name="action" value="delete" /> 1111: <input type="hidden" name="filename" value="" /> 1112: </form> 1113: <form name="cstrprint" action="/adm/printout" target="_parent" method="post"> 1114: <input type="hidden" name="postdata" value="" /> 1115: <input type="hidden" name="curseed" value="" /> 1116: <input type="hidden" name="problemtype" value="" /> 1117: </form> 1118: 1119: ENDCONSTSPACEFORM 1120: } 1121: 1122: 1123: sub get_nav_status { 1124: my $navstatus="swmenu.w_loncapanav_flag="; 1125: if ($ENV{'environment.remotenavmap'} eq 'on') { 1126: $navstatus.="1"; 1127: } else { 1128: $navstatus.="-1"; 1129: } 1130: return $navstatus; 1131: } 1132: 1133: # ================================================ Handler when called directly 1134: 1135: 1136: sub handler { 1137: my $r = shift; 1138: &Apache::loncommon::content_type($r,'text/html'); 1139: $r->send_http_header; 1140: return OK if $r->header_only; 1141: 1142: my $form; 1143: if ($ENV{'environment.remote'} ne 'off' && 1144: $ENV{'browser.interface'} ne 'textual') { 1145: $form=&serverform(); 1146: } 1147: my $bodytag=&Apache::loncommon::bodytag('Main Menu'); 1148: my $function='student'; 1149: if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) { 1150: $function='coordinator'; 1151: } 1152: if ($ENV{'request.role'}=~/^(su|dc|ad|li)/) { 1153: $function='admin'; 1154: } 1155: if (($ENV{'request.role'}=~/^(au|ca)/) || 1156: ($ENV{'request.noversionuri'}=~/^(\/priv|\~)/)) { 1157: $function='author'; 1158: } 1159: my $domain=&Apache::loncommon::determinedomain(); 1160: $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); 1161: $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); 1162: $font=&Apache::loncommon::designparm($function.'.font',$domain); 1163: my $script_tag; 1164: if ($ENV{'environment.remote'} ne 'off') { 1165: my $utility=&utilityfunctions('/adm/menu'); 1166: $script_tag=(<<ENDSCRIPT); 1167: <script type="text/javascript"> 1168: $utility 1169: </script> 1170: ENDSCRIPT 1171: } 1172: # ---- Print the screen, pretend to be in text mode to generate text-based menu 1173: unless ($ENV{'browser.interface'} eq 'textual') { 1174: $ENV{'browser.interface'}='faketextual'; 1175: $ENV{'environment.remote'}='off'; 1176: } 1177: $r->print(<<ENDHEADER); 1178: <html><head> 1179: <title>LON-CAPA Main Menu</title> 1180: $script_tag 1181: </head> 1182: $bodytag 1183: ENDHEADER 1184: $r->print('<table>'.&inlinemenu().'</table>'.$form); 1185: $r->print('</body></html>'); 1186: return OK; 1187: } 1188: 1189: # ================================================================ Main Program 1190: 1191: BEGIN { 1192: if (! defined($readdesk)) { 1193: { 1194: my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab'; 1195: if ( CORE::open( my $config,"<$tabfile") ) { 1196: while (my $configline=<$config>) { 1197: $configline=(split(/\#/,$configline))[0]; 1198: $configline=~s/^\s+//; 1199: chomp($configline); 1200: if ($configline) { 1201: $desklines[$#desklines+1]=$configline; 1202: } 1203: } 1204: CORE::close($config); 1205: } 1206: } 1207: $readdesk='done'; 1208: } 1209: } 1210: 1211: 1; 1212: __END__ 1213: 1214: 1215: 1216: 1217: 1218: 1219: