Annotation of loncom/interface/lonmenu.pm, revision 1.41
1.1 www 1: # The LearningOnline Network with CAPA
2: # Routines to control the menu
3: #
1.41 ! www 4: # $Id: lonmenu.pm,v 1.40 2003/02/17 17:34:16 www Exp $
1.11 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: #
1.1 www 28: # (TeX Conversion Module
29: #
30: # 05/29/00,05/30 Gerd Kortemeyer)
31: #
1.8 www 32: # 10/05,05/28,05/30,06/01,06/08,06/09,07/04,08/07 Gerd Kortemeyer
1.17 matthew 33: # 02/15/02 Matthew Hall
1.1 www 34:
35: package Apache::lonmenu;
36:
37: use strict;
1.2 www 38: use Apache::lonnet;
1.33 www 39: use Apache::Constants qw(:common);
40: use Apache::loncommon;
1.2 www 41: use Apache::File;
42: use vars qw(@desklines $readdesk);
1.38 www 43:
1.40 www 44: # ============================= This gets called at the top of the body section
1.38 www 45:
46: sub menubuttons {
47: my $forcereg=shift;
48: my $target =shift;
1.40 www 49: my $registration=shift;
1.38 www 50: unless ($ENV{'browser.interface'} eq 'textual') { return ''; }
1.41 ! www 51: # Textual display only
1.39 www 52: my $output='<a href="/adm/menu">Main Menu</a><br />';
1.40 www 53: if ($registration) { $output.=&innerregister($forcereg,$target); }
1.39 www 54: return $output."<hr />";
1.38 www 55: }
56:
1.40 www 57: # ====================================== This gets called in the header section
1.38 www 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: }
1.41 ! www 77: # Graphical display after login only
1.38 www 78: if ($Apache::lonxml::registered && !$forcereg) { return ''; }
1.40 www 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:
1.38 www 91: $Apache::lonxml::registered=1;
1.40 www 92:
93: my $textual=($ENV{'browser.interface'} eq 'textual');
1.38 www 94: my $reopen=&Apache::lonmenu::reopenmenu();
1.40 www 95:
1.38 www 96: my $newmail='';
97: if (&Apache::lonmsg::newmail()) {
1.41 ! www 98: $newmail=($textual?
! 99: '<b><a href="/adm/communicate">You have new messages</a></b><br />':
1.40 www 100: 'swmenu.setstatus("you have","messages");');
1.38 www 101: }
1.40 www 102: my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');');
1.41 ! www 103: # =============================================================================
! 104: # ============================ This is for URLs that actually can be registered
1.38 www 105: if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
1.40 www 106: # -- This applies to homework problems for users with grading privileges
1.38 www 107: my $hwkadd='';
1.40 www 108: if
109: ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
1.38 www 110: if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
1.40 www 111: $hwkadd.=&switch('','',7,1,'subm.gif','view sub','missions',
112: "gocmd('/adm/grades','submission')",
113: 'View user submissions for this assessment resource');
1.38 www 114: }
115: if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
1.40 www 116: $hwkadd.=&switch('','',7,2,'pgrd.gif','problem','grades',
117: "gocmd('/adm/grades','gradingmenu')",
118: 'Modify user grades for this assessment resource');
1.38 www 119: }
120: if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
1.40 www 121: $hwkadd.=&switch('','',7,3,'pparm.gif','problem','parms',
122: "gocmd('/adm/parmset','set')",
123: 'Modify deadlines, etc, for this assessment resource');
1.38 www 124: }
125: }
1.40 www 126: # -- End Homework
1.38 www 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'}) {
1.40 www 150: $editbutton=&switch
1.38 www 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) {
1.40 www 174: $editbutton=&switch
1.38 www 175: ('','',6,1,'cstr.gif','edit','resource',
176: "go('".$cfile."');","Edit this resource");
177: } elsif ($editbutton eq '') {
1.40 www 178: $editbutton=&clear(6,1);
1.38 www 179: }
180: }
181: ###
182: ###
1.41 ! www 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);
1.38 www 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
1.41 ! www 226: $buttons
1.38 www 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
1.41 ! www 256: }
! 257: # =============================================================================
1.38 www 258: } else {
1.41 ! www 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);
1.38 www 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
1.41 ! www 294: }
! 295: # =============================================================================
1.38 www 296: }
297: return $result;
298: }
299:
300: sub loadevents() {
301: return 'LONCAPAreg();';
302: }
303:
304: sub unloadevents() {
305: return 'LONCAPAstale();';
306: }
1.30 www 307:
1.32 www 308: # ============================================================= Start up remote
309:
310: sub startupremote {
311: my ($lowerurl)=@_;
1.34 www 312: if ($ENV{'browser.interface'} eq 'textual') {
313: return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
314: }
1.32 www 315: my $configmenu=&rawconfig();
316: return(<<ENDREMOTESTARTUP);
317: <script>
318:
1.35 www 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:
1.32 www 335: // ---------------------------------------------------------- The wait function
336: var canceltim;
337: function wait() {
338: if ((menuloaded==1) || (tim==1)) {
1.35 www 339: window.status='Done.';
1.32 www 340: if (tim==0) {
341: clearTimeout(canceltim);
342: $configmenu
343: window.location='$lowerurl';
344: } else {
1.35 www 345: alert("Remote Control timed out. It is possible that it was blocked by pop-up window filters.");
1.32 www 346: }
347: } else {
1.35 www 348: wheelswitch();
349: setTimeout('wait();',200);
1.32 www 350: }
351: }
352:
353: function main() {
1.35 www 354: canceltim=setTimeout('tim=1;',60000);
355: window.status='-';
1.32 www 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() {
1.34 www 373: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
1.32 www 374: return(<<ENDMAINCALL);
375: <script>
376: main();
377: </script>
378: ENDMAINCALL
379: }
1.30 www 380: # ================================================================= Reopen menu
381:
382: sub reopenmenu {
383: my $nothing='';
1.34 www 384: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
1.30 www 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:
1.1 www 390: # =============================================================== Open the menu
391:
392: sub open {
1.22 www 393: my $returnval='';
1.34 www 394: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
1.30 www 395: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
1.22 www 396: unless (shift eq 'unix') {
397: # resizing does not work on linux because of virtual desktop sizes
398: $returnval.=(<<ENDRESIZE);
399: if (window.screen) {
1.28 www 400: self.resizeTo(screen.availWidth-215,screen.availHeight-55);
1.22 www 401: self.moveTo(190,15);
402: }
403: ENDRESIZE
404: }
405: $returnval.=(<<ENDOPEN);
1.35 www 406: window.status='Opening LON-CAPA Remote Control';
1.30 www 407: var menu=window.open("/res/adm/pages/menu.html","$menuname",
1.14 www 408: "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
1.1 www 409: ENDOPEN
1.22 www 410: return '<script>'.$returnval.'</script>';
1.1 www 411: }
412:
1.2 www 413:
414: # ================================================================== Raw Config
415:
1.3 www 416: sub clear {
417: my ($row,$col)=@_;
1.34 www 418: unless ($ENV{'browser.interface'} eq 'textual') {
1.35 www 419: return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
1.34 www 420: } else { return ''; }
1.3 www 421: }
422:
1.40 www 423: # ============================================ Switch a button or create a link
1.25 matthew 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(..)".
1.40 www 426:
1.2 www 427: sub switch {
1.40 www 428: my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$nobreak)=@_;
1.2 www 429: $act=~s/\$uname/$uname/g;
430: $act=~s/\$udom/$udom/g;
1.34 www 431: unless ($ENV{'browser.interface'} eq 'textual') {
432: return "\n".
1.35 www 433: qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
1.34 www 434: } else {
1.41 ! www 435: if ($nobreak==2) { return ''; }
1.34 www 436: my $text=$top.' '.$bot;
437: $text=~s/\- //;
1.40 www 438: return ($nobreak?'':'<br />').
1.41 ! www 439: '<a href="javascript:'.$act.';">'.$text.'</a> '.($nobreak?'':$desc);
1.34 www 440: }
1.2 www 441: }
442:
443: sub secondlevel {
444: my $output='';
445: my
1.27 www 446: ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc)=@_;
1.2 www 447: if ($prt eq 'any') {
1.27 www 448: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
1.2 www 449: } elsif ($prt=~/^r(\w+)/) {
450: if ($rol eq $1) {
1.27 www 451: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
1.2 www 452: }
453: }
454: return $output;
455: }
456:
1.18 www 457: sub openmenu {
1.30 www 458: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
1.34 www 459: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
1.18 www 460: if ($ENV{'browser.type'} eq 'explorer') {
1.30 www 461: return "window.open('javascript:void(0);','".$menuname."');";
1.18 www 462: } else {
1.30 www 463: return "window.open('','".$menuname."');";
1.18 www 464: }
465: }
466:
1.2 www 467: sub rawconfig {
1.34 www 468: my $textualoverride=shift;
469: my $output='';
470: unless ($ENV{'browser.interface'} eq 'textual') {
1.35 www 471: $output.=
472: "window.status='Opening Remote Control';var swmenu=".&openmenu().
473: "\nwindow.status='Configuring Remote Control ';";
1.34 www 474: } else {
475: unless ($textualoverride) { return ''; }
476: }
1.2 www 477: my $uname=$ENV{'user.name'};
478: my $udom=$ENV{'user.domain'};
479: my $adv=$ENV{'user.adv'};
1.4 www 480: my $author=$ENV{'user.author'};
1.5 www 481: my $crs='';
482: if ($ENV{'request.course.id'}) {
483: $crs='/'.$ENV{'request.course.id'};
1.7 www 484: if ($ENV{'request.course.sec'}) {
485: $crs.='_'.$ENV{'request.course.sec'};
486: }
1.8 www 487: $crs=~s/\_/\//g;
1.5 www 488: }
1.2 www 489: my $pub=($ENV{'request.state'} eq 'published');
490: my $con=($ENV{'request.state'} eq 'construct');
491: my $rol=$ENV{'request.role'};
1.25 matthew 492: my $requested_domain = $ENV{'request.role.domain'};
1.13 harris41 493: foreach (@desklines) {
1.27 www 494: my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$_);
1.3 www 495: $prt=~s/\$uname/$uname/g;
496: $prt=~s/\$udom/$udom/g;
1.5 www 497: $prt=~s/\$crs/$crs/g;
1.25 matthew 498: $prt=~s/\$requested_domain/$requested_domain/g;
1.3 www 499: if ($pro eq 'clear') {
1.4 www 500: $output.=&clear($row,$col);
1.3 www 501: } elsif ($pro eq 'any') {
1.2 www 502: $output.=&secondlevel(
1.27 www 503: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
1.2 www 504: } elsif ($pro eq 'smp') {
505: unless ($adv) {
506: $output.=&secondlevel(
1.27 www 507: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
1.2 www 508: }
509: } elsif ($pro eq 'adv') {
510: if ($adv) {
511: $output.=&secondlevel(
1.27 www 512: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
1.2 www 513: }
514: } elsif (($pro=~/p(\w+)/) && ($prt)) {
515: if (&Apache::lonnet::allowed($1,$prt)) {
1.27 www 516: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
1.4 www 517: }
1.26 www 518: } elsif ($pro eq 'course') {
519: if ($ENV{'request.course.fn'}) {
1.27 www 520: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
1.26 www 521: }
1.4 www 522: } elsif ($pro eq 'author') {
523: if ($author) {
1.29 matthew 524: if ((($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) ||
525: (($prt eq 'rau') && ($ENV{'request.role'}=~/^au/))) {
1.19 matthew 526: # Check that we are on the correct machine
1.29 matthew 527: my $cadom=$requested_domain;
528: my $caname=$ENV{'user.name'};
529: if ($prt eq 'rca') {
530: ($cadom,$caname)=
1.6 www 531: ($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
1.29 matthew 532: }
533: $act =~ s/\$caname/$caname/g;
1.19 matthew 534: my $home = &Apache::lonnet::homeserver($caname,$cadom);
1.32 www 535: if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
1.19 matthew 536: $output.=switch($caname,$cadom,
1.27 www 537: $row,$col,$img,$top,$bot,$act,$desc);
1.19 matthew 538: }
1.6 www 539: }
1.2 www 540: }
541: }
1.13 harris41 542: }
1.34 www 543: unless ($ENV{'browser.interface'} eq 'textual') {
1.35 www 544: $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
1.34 www 545: }
1.2 www 546: return $output;
547: }
548:
549: # ======================================================================= Close
1.1 www 550:
551: sub close {
1.35 www 552: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
1.30 www 553: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
1.1 www 554: return(<<ENDCLOSE);
555: <script>
1.35 www 556: window.status='Accessing Remote Control';
1.30 www 557: menu=window.open("/adm/rat/empty.html","$menuname",
1.1 www 558: "height=350,width=150,scrollbars=no,menubar=no");
1.35 www 559: window.status='Disabling Remote Control';
560: menu.active=0;
1.31 www 561: menu.autologout=0;
1.35 www 562: window.status='Closing Remote Control';
1.1 www 563: menu.close();
1.35 www 564: window.status='Done.';
1.1 www 565: </script>
566: ENDCLOSE
567: }
568:
569: # ====================================================================== Footer
570:
571: sub footer {
572:
1.33 www 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:
1.34 www 584: my $bodytag=&Apache::loncommon::bodytag('Main Menu');
1.33 www 585: # ------------------------------------------------------------ Print the screen
1.36 www 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
1.34 www 600: $r->print(&rawconfig(1));
1.33 www 601: $r->print('</body></html>');
602: return OK;
1.1 www 603: }
604:
1.2 www 605: # ================================================================ Main Program
606:
1.16 harris41 607: BEGIN {
1.15 matthew 608: if (! defined($readdesk)) {
1.14 www 609: {
1.10 albertel 610: my $config=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
611: '/mydesk.tab');
612: while (my $configline=<$config>) {
1.14 www 613: $configline=(split(/\#/,$configline))[0];
614: $configline=~s/^\s+//;
1.10 albertel 615: chomp($configline);
1.14 www 616: if ($configline) {
617: $desklines[$#desklines+1]=$configline;
618: }
1.2 www 619: }
1.14 www 620: }
621: $readdesk='done';
1.10 albertel 622: }
1.2 www 623: }
1.30 www 624:
1.1 www 625: 1;
626: __END__
627:
628:
629:
630:
631:
632:
633:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>