1: # The LearningOnline Network with CAPA
2: # Routines to control the menu
3: #
4: # $Id: lonmenu.pm,v 1.43 2003/02/20 18:00:31 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" target="_top">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: my $utility=&utilityfunctions();
208: my $form=&serverform();
209: $result =(<<ENDREGTEXT);
210: <script>
211: // BEGIN LON-CAPA Internal
212: $utility
213: </script>
214: $timesync
215: $newmail
216: $buttons
217: $hwkadd
218: $editbutton
219: $form
220: <script>
221: //END LON-CAPA Internal
222: </script>
223:
224: ENDREGTEXT
225: # Registered, graphical output
226: } else {
227: $result = (<<ENDREGTHIS);
228:
229: <script language="JavaScript">
230: // BEGIN LON-CAPA Internal
231: var swmenu=null;
232:
233: function LONCAPAreg() {
234: swmenu=$reopen;
235: swmenu.clearTimeout(swmenu.menucltim);
236: $timesync
237: $newmail
238: $buttons
239: swmenu.currentURL=window.location.pathname;
240: swmenu.reloadURL=window.location.pathname;
241: swmenu.currentSymb="$ENV{'request.symb'}";
242: swmenu.reloadSymb="$ENV{'request.symb'}";
243: swmenu.currentStale=0;
244: $hwkadd
245: $editbutton
246: }
247:
248: function LONCAPAstale() {
249: swmenu=$reopen
250: swmenu.currentStale=1;
251: if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) {
252: swmenu.switchbutton
253: (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
254: }
255: swmenu.clearbut(7,1);
256: swmenu.clearbut(7,2);
257: swmenu.clearbut(7,3);
258: swmenu.menucltim=swmenu.setTimeout(
259: 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
260: 'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3);clearbut(6,1)',
261: 2000);
262:
263: }
264:
265: // END LON-CAPA Internal
266: </script>
267: ENDREGTHIS
268: }
269: # =============================================================================
270: } else {
271: # ========================================== This can or will not be registered
272: if ($textual) {
273: # Not registered, textual
274: $result= (<<ENDDONOTREGTEXT);
275: ENDDONOTREGTEXT
276: } else {
277: # Not registered, graphical
278: $result = (<<ENDDONOTREGTHIS);
279:
280: <script language="JavaScript">
281: // BEGIN LON-CAPA Internal
282: var swmenu=null;
283:
284: function LONCAPAreg() {
285: swmenu=$reopen
286: $timesync
287: swmenu.currentStale=1;
288: swmenu.clearbut(2,1);
289: swmenu.clearbut(2,3);
290: swmenu.clearbut(8,1);
291: swmenu.clearbut(8,2);
292: swmenu.clearbut(8,3);
293: if (swmenu.currentURL) {
294: swmenu.switchbutton
295: (3,1,'reload.gif','return','location','go(currentURL)');
296: } else {
297: swmenu.clearbut(3,1);
298: }
299: }
300:
301: function LONCAPAstale() {
302: }
303:
304: // END LON-CAPA Internal
305: </script>
306: ENDDONOTREGTHIS
307: }
308: # =============================================================================
309: }
310: return $result;
311: }
312:
313: sub loadevents() {
314: return 'LONCAPAreg();';
315: }
316:
317: sub unloadevents() {
318: return 'LONCAPAstale();';
319: }
320:
321: # ============================================================= Start up remote
322:
323: sub startupremote {
324: my ($lowerurl)=@_;
325: if ($ENV{'browser.interface'} eq 'textual') {
326: return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
327: }
328: my $configmenu=&rawconfig();
329: return(<<ENDREMOTESTARTUP);
330: <script>
331:
332: function wheelswitch() {
333: if (window.status=='|') {
334: window.status='/';
335: } else {
336: if (window.status=='/') {
337: window.status='-';
338: } else {
339: if (window.status=='-') {
340: window.status='\\\\';
341: } else {
342: if (window.status=='\\\\') { window.status='|'; }
343: }
344: }
345: }
346: }
347:
348: // ---------------------------------------------------------- The wait function
349: var canceltim;
350: function wait() {
351: if ((menuloaded==1) || (tim==1)) {
352: window.status='Done.';
353: if (tim==0) {
354: clearTimeout(canceltim);
355: $configmenu
356: window.location='$lowerurl';
357: } else {
358: alert("Remote Control timed out. It is possible that it was blocked by pop-up window filters.");
359: }
360: } else {
361: wheelswitch();
362: setTimeout('wait();',200);
363: }
364: }
365:
366: function main() {
367: canceltim=setTimeout('tim=1;',60000);
368: window.status='-';
369: wait();
370: }
371:
372: </script>
373: ENDREMOTESTARTUP
374: }
375:
376: sub setflags() {
377: return(<<ENDSETFLAGS);
378: <script>
379: menuloaded=0;
380: tim=0;
381: </script>
382: ENDSETFLAGS
383: }
384:
385: sub maincall() {
386: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
387: return(<<ENDMAINCALL);
388: <script>
389: main();
390: </script>
391: ENDMAINCALL
392: }
393: # ================================================================= Reopen menu
394:
395: sub reopenmenu {
396: my $nothing='';
397: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
398: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
399: if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; }
400: return('window.open("'.$nothing.'","'.$menuname.'","",false);');
401: }
402:
403: # =============================================================== Open the menu
404:
405: sub open {
406: my $returnval='';
407: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
408: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
409: unless (shift eq 'unix') {
410: # resizing does not work on linux because of virtual desktop sizes
411: $returnval.=(<<ENDRESIZE);
412: if (window.screen) {
413: self.resizeTo(screen.availWidth-215,screen.availHeight-55);
414: self.moveTo(190,15);
415: }
416: ENDRESIZE
417: }
418: $returnval.=(<<ENDOPEN);
419: window.status='Opening LON-CAPA Remote Control';
420: var menu=window.open("/res/adm/pages/menu.html","$menuname",
421: "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
422: ENDOPEN
423: return '<script>'.$returnval.'</script>';
424: }
425:
426:
427: # ================================================================== Raw Config
428:
429: sub clear {
430: my ($row,$col)=@_;
431: unless ($ENV{'browser.interface'} eq 'textual') {
432: return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
433: } else { return ''; }
434: }
435:
436: # ============================================ Switch a button or create a link
437: # Switch acts on the javascript that is executed when a button is clicked.
438: # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
439:
440: sub switch {
441: my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$nobreak)=@_;
442: $act=~s/\$uname/$uname/g;
443: $act=~s/\$udom/$udom/g;
444: unless ($ENV{'browser.interface'} eq 'textual') {
445: return "\n".
446: qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
447: } else {
448: if ($nobreak==2) { return ''; }
449: my $text=$top.' '.$bot;
450: $text=~s/\- //;
451: return "\n".($nobreak?' ':'<br />').
452: '<a href="javascript:'.$act.';" target="_top">'.$text.'</a> '.
453: ($nobreak?'':$desc);
454: }
455: }
456:
457: sub secondlevel {
458: my $output='';
459: my
460: ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc)=@_;
461: if ($prt eq 'any') {
462: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
463: } elsif ($prt=~/^r(\w+)/) {
464: if ($rol eq $1) {
465: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
466: }
467: }
468: return $output;
469: }
470:
471: sub openmenu {
472: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
473: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
474: if ($ENV{'browser.type'} eq 'explorer') {
475: return "window.open('javascript:void(0);','".$menuname."');";
476: } else {
477: return "window.open('','".$menuname."');";
478: }
479: }
480:
481: sub rawconfig {
482: my $textualoverride=shift;
483: my $output='';
484: unless ($ENV{'browser.interface'} eq 'textual') {
485: $output.=
486: "window.status='Opening Remote Control';var swmenu=".&openmenu().
487: "\nwindow.status='Configuring Remote Control ';";
488: } else {
489: unless ($textualoverride) { return ''; }
490: }
491: my $uname=$ENV{'user.name'};
492: my $udom=$ENV{'user.domain'};
493: my $adv=$ENV{'user.adv'};
494: my $author=$ENV{'user.author'};
495: my $crs='';
496: if ($ENV{'request.course.id'}) {
497: $crs='/'.$ENV{'request.course.id'};
498: if ($ENV{'request.course.sec'}) {
499: $crs.='_'.$ENV{'request.course.sec'};
500: }
501: $crs=~s/\_/\//g;
502: }
503: my $pub=($ENV{'request.state'} eq 'published');
504: my $con=($ENV{'request.state'} eq 'construct');
505: my $rol=$ENV{'request.role'};
506: my $requested_domain = $ENV{'request.role.domain'};
507: foreach (@desklines) {
508: my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$_);
509: $prt=~s/\$uname/$uname/g;
510: $prt=~s/\$udom/$udom/g;
511: $prt=~s/\$crs/$crs/g;
512: $prt=~s/\$requested_domain/$requested_domain/g;
513: if ($pro eq 'clear') {
514: $output.=&clear($row,$col);
515: } elsif ($pro eq 'any') {
516: $output.=&secondlevel(
517: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
518: } elsif ($pro eq 'smp') {
519: unless ($adv) {
520: $output.=&secondlevel(
521: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
522: }
523: } elsif ($pro eq 'adv') {
524: if ($adv) {
525: $output.=&secondlevel(
526: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
527: }
528: } elsif (($pro=~/p(\w+)/) && ($prt)) {
529: if (&Apache::lonnet::allowed($1,$prt)) {
530: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
531: }
532: } elsif ($pro eq 'course') {
533: if ($ENV{'request.course.fn'}) {
534: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
535: }
536: } elsif ($pro eq 'author') {
537: if ($author) {
538: if ((($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) ||
539: (($prt eq 'rau') && ($ENV{'request.role'}=~/^au/))) {
540: # Check that we are on the correct machine
541: my $cadom=$requested_domain;
542: my $caname=$ENV{'user.name'};
543: if ($prt eq 'rca') {
544: ($cadom,$caname)=
545: ($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
546: }
547: $act =~ s/\$caname/$caname/g;
548: my $home = &Apache::lonnet::homeserver($caname,$cadom);
549: if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
550: $output.=switch($caname,$cadom,
551: $row,$col,$img,$top,$bot,$act,$desc);
552: }
553: }
554: }
555: }
556: }
557: unless ($ENV{'browser.interface'} eq 'textual') {
558: $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
559: }
560: return $output;
561: }
562:
563: # ======================================================================= Close
564:
565: sub close {
566: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
567: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
568: return(<<ENDCLOSE);
569: <script>
570: window.status='Accessing Remote Control';
571: menu=window.open("/adm/rat/empty.html","$menuname",
572: "height=350,width=150,scrollbars=no,menubar=no");
573: window.status='Disabling Remote Control';
574: menu.active=0;
575: menu.autologout=0;
576: window.status='Closing Remote Control';
577: menu.close();
578: window.status='Done.';
579: </script>
580: ENDCLOSE
581: }
582:
583: # ====================================================================== Footer
584:
585: sub footer {
586:
587: }
588:
589: sub utilityfunctions {
590: unless ($ENV{'browser.interface'} eq 'textual') { return ''; }
591: my $currenturl=$ENV{'REQUEST_URI'};
592: my $currentsymb=$ENV{'request.symb'};
593: return (<<ENDUTILITY)
594:
595: var currentURL="$currenturl";
596: var reloadURL="$currenturl";
597: var currentSymb="$currentsymb";
598:
599: function go(url) {
600: if (url!='' && url!= null) {
601: currentURL = null;
602: currentSymb= null;
603: window.location.href=url;
604: }
605: }
606:
607: function gopost(url,postdata) {
608: if (url!='') {
609: this.document.server.action=url;
610: this.document.server.postdata.value=postdata;
611: this.document.server.command.value='';
612: this.document.server.url.value='';
613: this.document.server.symb.value='';
614: this.document.server.submit();
615: }
616: }
617:
618: function gocmd(url,cmd) {
619: if (url!='') {
620: this.document.server.action=url;
621: this.document.server.postdata.value='';
622: this.document.server.command.value=cmd;
623: this.document.server.url.value=currentURL;
624: this.document.server.symb.value=currentSymb;
625: this.document.server.submit();
626: }
627: }
628: ENDUTILITY
629: }
630:
631: sub serverform {
632: return(<<ENDSERVERFORM);
633:
634: <form name="server" action="/adm/logout" method="post">
635: <input type="hidden" name="postdata" value="none" />
636: <input type="hidden" name="command" value="none" />
637: <input type="hidden" name="url" value="none" />
638: <input type="hidden" name="symb" value="none" />
639: </form>
640: ENDSERVERFORM
641: }
642: # ================================================ Handler when called directly
643:
644:
645: sub handler {
646: my $r = shift;
647: $r->content_type('text/html');
648: $r->send_http_header;
649: return OK if $r->header_only;
650:
651: my $utility=&utilityfunctions();
652: my $form=&serverform();
653: my $bodytag=&Apache::loncommon::bodytag('Main Menu');
654: # ------------------------------------------------------------ Print the screen
655: $r->print(<<ENDHEADER);
656: <html><head>
657: <title>LON-CAPA Main Menu</title>
658: <script>
659: $utility
660: </script>
661: </head>
662: $bodytag
663: ENDHEADER
664: $r->print(&rawconfig(1).$form);
665: $r->print('</body></html>');
666: return OK;
667: }
668:
669: # ================================================================ Main Program
670:
671: BEGIN {
672: if (! defined($readdesk)) {
673: {
674: my $config=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
675: '/mydesk.tab');
676: while (my $configline=<$config>) {
677: $configline=(split(/\#/,$configline))[0];
678: $configline=~s/^\s+//;
679: chomp($configline);
680: if ($configline) {
681: $desklines[$#desklines+1]=$configline;
682: }
683: }
684: }
685: $readdesk='done';
686: }
687: }
688:
689: 1;
690: __END__
691:
692:
693:
694:
695:
696:
697:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>