File:
[LON-CAPA] /
loncom /
interface /
lonmenu.pm
Revision
1.47:
download - view:
text,
annotated -
select for diffs
Mon Mar 10 20:21:45 2003 UTC (21 years, 3 months ago) by
matthew
Branches:
MAIN
CVS tags:
HEAD
Created loncommon::decode_user_agent() subroutine with code removed from
lonauth.pm. The code was modified to not require $r be passed along
ad nauseum.
Created lonhtmlcommon::javascript_nothing which returns an appropriate value
of nothing for use as the first parameter for window.open. Most notably,
IE on macs get a different version, "'javascript:void(0);'", than everyone
one else, "''". Of course IE on PC appearantly used to require the former
but now requires the latter.
lonmenu.pm and lonspreadsheet.pm were modified to use javascript_nothing.
lonauth was modified to use decode_user_agent.
1: # The LearningOnline Network with CAPA
2: # Routines to control the menu
3: #
4: # $Id: lonmenu.pm,v 1.47 2003/03/10 20:21:45 matthew 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::lonhtmlcommon();
41: use Apache::loncommon;
42: use Apache::File;
43: use vars qw(@desklines $readdesk);
44:
45: # ============================= This gets called at the top of the body section
46:
47: sub menubuttons {
48: my $forcereg=shift;
49: my $target =shift;
50: my $registration=shift;
51: unless ($ENV{'browser.interface'} eq 'textual') { return ''; }
52: # Textual display only
53: my $output=(<<ENDMAINMENU);
54: <script>
55: // BEGIN LON-CAPA Internal
56: </script>
57: <a href="/adm/menu" target="_top">Main Menu</a><br />
58: <script>
59: // END LON-CAPA Internal
60: </script>
61: ENDMAINMENU
62: if ($registration) { $output.=&innerregister($forcereg,$target); }
63: return $output."<hr />";
64: }
65:
66: # ====================================== This gets called in the header section
67:
68: sub registerurl {
69: my $forcereg=shift;
70: my $target = shift;
71: my $result = '';
72:
73: if ($target eq 'edit') {
74: $result .="<script type=\"text/javascript\">\n".
75: "if (typeof swmenu != 'undefined') {swmenu.currentURL=null;}\n".
76: &Apache::loncommon::browser_and_searcher_javascript().
77: "\n</script>\n";
78: }
79: if (($ENV{'browser.interface'} eq 'textual') ||
80: ((($ENV{'request.publicaccess'}) ||
81: (!&Apache::lonnet::is_on_map($ENV{'REQUEST_URI'}))) &&
82: (!$forcereg))) {
83: return $result.
84: '<script type="text/javascript">function LONCAPAreg(){;} function LONCAPAstale(){}</script>';
85: }
86: # Graphical display after login only
87: if ($Apache::lonxml::registered && !$forcereg) { return ''; }
88: $result.=&innerregister($forcereg,$target);
89: return $result;
90: }
91:
92: # =========== This gets called in order to register a URL, both with the Remote
93: # =========== and in the body of the document
94:
95: sub innerregister {
96: my $forcereg=shift;
97: my $target = shift;
98: my $result = '';
99:
100: $Apache::lonxml::registered=1;
101:
102: my $textual=($ENV{'browser.interface'} eq 'textual');
103: my $reopen=&Apache::lonmenu::reopenmenu();
104:
105: my $newmail='';
106: if (&Apache::lonmsg::newmail()) {
107: $newmail=($textual?
108: '<b><a href="/adm/communicate">You have new messages</a></b><br />':
109: 'swmenu.setstatus("you have","messages");');
110: }
111: my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');');
112: # =============================================================================
113: # ============================ This is for URLs that actually can be registered
114: if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
115: # -- This applies to homework problems for users with grading privileges
116: my $hwkadd='';
117: if
118: ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
119: if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
120: $hwkadd.=&switch('','',7,1,'subm.gif','view sub','missions',
121: "gocmd('/adm/grades','submission')",
122: 'View user submissions for this assessment resource');
123: }
124: if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) {
125: $hwkadd.=&switch('','',7,2,'pgrd.gif','problem','grades',
126: "gocmd('/adm/grades','gradingmenu')",
127: 'Modify user grades for this assessment resource');
128: }
129: if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) {
130: $hwkadd.=&switch('','',7,3,'pparm.gif','problem','parms',
131: "gocmd('/adm/parmset','set')",
132: 'Modify deadlines, etc, for this assessment resource');
133: }
134: }
135: # -- End Homework
136: ###
137: ### Determine whether or not to display the 'cstr' button for this
138: ### resource
139: ###
140: my $editbutton = '';
141: if ($ENV{'user.author'}) {
142: if ($ENV{'request.role'}=~/^(ca|au)/) {
143: # Set defaults for authors
144: my ($top,$bottom) = ('con-','struct');
145: my $action = "go('/priv/".$ENV{'user.name'}."');";
146: my $cadom = $ENV{'request.role.domain'};
147: my $caname = $ENV{'user.name'};
148: my $desc = "Enter my resource construction space";
149: # Set defaults for co-authors
150: if ($ENV{'request.role'} =~ /^ca/) {
151: ($cadom,$caname)=($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
152: ($top,$bottom) = ('co con-','struct');
153: $action = "go('/priv/".$caname."');";
154: $desc = "Enter construction space as co-author";
155: }
156: # Check that we are on the correct machine
157: my $home = &Apache::lonnet::homeserver($caname,$cadom);
158: if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
159: $editbutton=&switch
160: ('','',6,1,$top,,$bottom,$action,$desc);
161: }
162: }
163: ##
164: ## Determine if user can edit url.
165: ##
166: my $cfile='';
167: my $cfuname='';
168: my $cfudom='';
169: if ($ENV{'request.filename'}) {
170: my $file=&Apache::lonnet::declutter($ENV{'request.filename'});
171: $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;
172: # Chech that the user has permission to edit this resource
173: ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
174: if (defined($cfudom)) {
175: if (&Apache::lonnet::homeserver($cfuname,$cfudom)
176: eq $Apache::lonnet::perlvar{'lonHostID'}) {
177: $cfile=$file;
178: }
179: }
180: }
181: # Finally, turn the button on or off
182: if ($cfile) {
183: $editbutton=&switch
184: ('','',6,1,'cstr.gif','edit','resource',
185: "go('".$cfile."');","Edit this resource");
186: } elsif ($editbutton eq '') {
187: $editbutton=&clear(6,1);
188: }
189: }
190: ###
191: ###
192: # Prepare the rest of the buttons
193: my $menuitems=(<<ENDMENUITEMS);
194: c&3&1
195: s&2&1&back.gif&backward&&gopost('/adm/flip','back:'+currentURL)&Go to the previous resource in the course sequence&1
196: s&2&3&forw.gif&forward&&gopost('/adm/flip','forward:'+currentURL)&Go to the next resource in the course sequence&1
197: s&6&3&catalog.gif&catalog&info&catalog_info()&Show catalog information
198: s&8&1&eval.gif&evaluate&this&gopost('/adm/evaluate',currentURL)&Provide my evaluation of this resource
199: s&8&2&fdbk.gif&feedback&discuss&gopost('/adm/feedback',currentURL)&Provide feedback messages or contribute to the course discussion about this resource
200: s&8&3&prt.gif&prepare&printout&gopost('/adm/printout',currentURL)&Prepare a printable document
201: s&9&1&sbkm.gif&set&bookmark&set_bookmark()&Set a bookmark for this resource&2
202: s&9&2&vbkm.gif&view&bookmark&edit_bookmarks()&Use or edit my bookmark collection&2
203: s&9&3&anot.gif&anno-&tations&annotate()&Make notes and annotations about this resource&2
204: ENDMENUITEMS
205: my $buttons='';
206: foreach (split(/\n/,$menuitems)) {
207: my ($command,@rest)=split(/\&/,$_);
208: if ($command eq 's') {
209: $buttons.=&switch('','',@rest);
210: } else {
211: $buttons.=&clear(@rest);
212: }
213: }
214: if ($textual) {
215: # Registered, textual output
216: my $utility=&utilityfunctions();
217: my $form=&serverform();
218: $result =(<<ENDREGTEXT);
219: <script>
220: // BEGIN LON-CAPA Internal
221: $utility
222: </script>
223: $timesync
224: $newmail
225: $buttons
226: $hwkadd
227: $editbutton
228: $form
229: <script>
230: //END LON-CAPA Internal
231: </script>
232:
233: ENDREGTEXT
234: # Registered, graphical output
235: } else {
236: $result = (<<ENDREGTHIS);
237:
238: <script language="JavaScript">
239: // BEGIN LON-CAPA Internal
240: var swmenu=null;
241:
242: function LONCAPAreg() {
243: swmenu=$reopen;
244: swmenu.clearTimeout(swmenu.menucltim);
245: $timesync
246: $newmail
247: $buttons
248: swmenu.currentURL=window.location.pathname;
249: swmenu.reloadURL=window.location.pathname+window.location.search;
250: swmenu.currentSymb="$ENV{'request.symb'}";
251: swmenu.reloadSymb="$ENV{'request.symb'}";
252: swmenu.currentStale=0;
253: $hwkadd
254: $editbutton
255: }
256:
257: function LONCAPAstale() {
258: swmenu=$reopen
259: swmenu.currentStale=1;
260: if (swmenu.reloadURL!='' && swmenu.reloadURL!= null) {
261: swmenu.switchbutton
262: (3,1,'reload.gif','return','location','go(reloadURL)','Return to the last known location in the course sequence');
263: }
264: swmenu.clearbut(7,1);
265: swmenu.clearbut(7,2);
266: swmenu.clearbut(7,3);
267: swmenu.menucltim=swmenu.setTimeout(
268: 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
269: 'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3);clearbut(6,1)',
270: 2000);
271:
272: }
273:
274: // END LON-CAPA Internal
275: </script>
276: ENDREGTHIS
277: }
278: # =============================================================================
279: } else {
280: # ========================================== This can or will not be registered
281: if ($textual) {
282: # Not registered, textual
283: $result= (<<ENDDONOTREGTEXT);
284: ENDDONOTREGTEXT
285: } else {
286: # Not registered, graphical
287: $result = (<<ENDDONOTREGTHIS);
288:
289: <script language="JavaScript">
290: // BEGIN LON-CAPA Internal
291: var swmenu=null;
292:
293: function LONCAPAreg() {
294: swmenu=$reopen
295: $timesync
296: swmenu.currentStale=1;
297: swmenu.clearbut(2,1);
298: swmenu.clearbut(2,3);
299: swmenu.clearbut(8,1);
300: swmenu.clearbut(8,2);
301: swmenu.clearbut(8,3);
302: if (swmenu.currentURL) {
303: swmenu.switchbutton
304: (3,1,'reload.gif','return','location','go(currentURL)');
305: } else {
306: swmenu.clearbut(3,1);
307: }
308: }
309:
310: function LONCAPAstale() {
311: }
312:
313: // END LON-CAPA Internal
314: </script>
315: ENDDONOTREGTHIS
316: }
317: # =============================================================================
318: }
319: return $result;
320: }
321:
322: sub loadevents() {
323: return 'LONCAPAreg();';
324: }
325:
326: sub unloadevents() {
327: return 'LONCAPAstale();';
328: }
329:
330: # ============================================================= Start up remote
331:
332: sub startupremote {
333: my ($lowerurl)=@_;
334: if ($ENV{'browser.interface'} eq 'textual') {
335: return ('<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url='.$lowerurl.'" />');
336: }
337: my $configmenu=&rawconfig();
338: return(<<ENDREMOTESTARTUP);
339: <script>
340:
341: function wheelswitch() {
342: if (window.status=='|') {
343: window.status='/';
344: } else {
345: if (window.status=='/') {
346: window.status='-';
347: } else {
348: if (window.status=='-') {
349: window.status='\\\\';
350: } else {
351: if (window.status=='\\\\') { window.status='|'; }
352: }
353: }
354: }
355: }
356:
357: // ---------------------------------------------------------- The wait function
358: var canceltim;
359: function wait() {
360: if ((menuloaded==1) || (tim==1)) {
361: window.status='Done.';
362: if (tim==0) {
363: clearTimeout(canceltim);
364: $configmenu
365: window.location='$lowerurl';
366: } else {
367: alert("Remote Control timed out. It is possible that it was blocked by pop-up window filters.");
368: }
369: } else {
370: wheelswitch();
371: setTimeout('wait();',200);
372: }
373: }
374:
375: function main() {
376: canceltim=setTimeout('tim=1;',60000);
377: window.status='-';
378: wait();
379: }
380:
381: </script>
382: ENDREMOTESTARTUP
383: }
384:
385: sub setflags() {
386: return(<<ENDSETFLAGS);
387: <script>
388: menuloaded=0;
389: tim=0;
390: </script>
391: ENDSETFLAGS
392: }
393:
394: sub maincall() {
395: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
396: return(<<ENDMAINCALL);
397: <script>
398: main();
399: </script>
400: ENDMAINCALL
401: }
402: # ================================================================= Reopen menu
403:
404: sub reopenmenu {
405: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
406: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
407: my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
408: return('window.open('.$nothing.',"'.$menuname.'","",false);');
409: }
410:
411: # =============================================================== Open the menu
412:
413: sub open {
414: my $returnval='';
415: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
416: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
417: unless (shift eq 'unix') {
418: # resizing does not work on linux because of virtual desktop sizes
419: $returnval.=(<<ENDRESIZE);
420: if (window.screen) {
421: self.resizeTo(screen.availWidth-215,screen.availHeight-55);
422: self.moveTo(190,15);
423: }
424: ENDRESIZE
425: }
426: $returnval.=(<<ENDOPEN);
427: window.status='Opening LON-CAPA Remote Control';
428: var menu=window.open("/res/adm/pages/menu.html","$menuname",
429: "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5");
430: ENDOPEN
431: return '<script>'.$returnval.'</script>';
432: }
433:
434:
435: # ================================================================== Raw Config
436:
437: sub clear {
438: my ($row,$col)=@_;
439: unless ($ENV{'browser.interface'} eq 'textual') {
440: return "\n".qq(window.status+='.';swmenu.clearbut($row,$col););
441: } else { return ''; }
442: }
443:
444: # ============================================ Switch a button or create a link
445: # Switch acts on the javascript that is executed when a button is clicked.
446: # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)".
447:
448: sub switch {
449: my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$nobreak)=@_;
450: $act=~s/\$uname/$uname/g;
451: $act=~s/\$udom/$udom/g;
452: unless ($ENV{'browser.interface'} eq 'textual') {
453: return "\n".
454: qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
455: } else {
456: if ($nobreak==2) { return ''; }
457: my $text=$top.' '.$bot;
458: $text=~s/\- //;
459: return "\n".($nobreak?' ':'<br />').
460: '<a href="javascript:'.$act.';" target="_top">'.$text.'</a> '.
461: ($nobreak?'':$desc);
462: }
463: }
464:
465: sub secondlevel {
466: my $output='';
467: my
468: ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc)=@_;
469: if ($prt eq 'any') {
470: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
471: } elsif ($prt=~/^r(\w+)/) {
472: if ($rol eq $1) {
473: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
474: }
475: }
476: return $output;
477: }
478:
479: sub openmenu {
480: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
481: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
482: my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
483: return "window.open(".$nothing.",'".$menuname."');";
484: }
485:
486: sub rawconfig {
487: my $textualoverride=shift;
488: my $output='';
489: unless ($ENV{'browser.interface'} eq 'textual') {
490: $output.=
491: "window.status='Opening Remote Control';var swmenu=".&openmenu().
492: "\nwindow.status='Configuring Remote Control ';";
493: } else {
494: unless ($textualoverride) { return ''; }
495: }
496: my $uname=$ENV{'user.name'};
497: my $udom=$ENV{'user.domain'};
498: my $adv=$ENV{'user.adv'};
499: my $author=$ENV{'user.author'};
500: my $crs='';
501: if ($ENV{'request.course.id'}) {
502: $crs='/'.$ENV{'request.course.id'};
503: if ($ENV{'request.course.sec'}) {
504: $crs.='_'.$ENV{'request.course.sec'};
505: }
506: $crs=~s/\_/\//g;
507: }
508: my $pub=($ENV{'request.state'} eq 'published');
509: my $con=($ENV{'request.state'} eq 'construct');
510: my $rol=$ENV{'request.role'};
511: my $requested_domain = $ENV{'request.role.domain'};
512: foreach (@desklines) {
513: my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$_);
514: $prt=~s/\$uname/$uname/g;
515: $prt=~s/\$udom/$udom/g;
516: $prt=~s/\$crs/$crs/g;
517: $prt=~s/\$requested_domain/$requested_domain/g;
518: if ($pro eq 'clear') {
519: $output.=&clear($row,$col);
520: } elsif ($pro eq 'any') {
521: $output.=&secondlevel(
522: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
523: } elsif ($pro eq 'smp') {
524: unless ($adv) {
525: $output.=&secondlevel(
526: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
527: }
528: } elsif ($pro eq 'adv') {
529: if ($adv) {
530: $output.=&secondlevel(
531: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
532: }
533: } elsif (($pro=~/p(\w+)/) && ($prt)) {
534: if (&Apache::lonnet::allowed($1,$prt)) {
535: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
536: }
537: } elsif ($pro eq 'course') {
538: if ($ENV{'request.course.fn'}) {
539: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
540: }
541: } elsif ($pro eq 'author') {
542: if ($author) {
543: if ((($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) ||
544: (($prt eq 'rau') && ($ENV{'request.role'}=~/^au/))) {
545: # Check that we are on the correct machine
546: my $cadom=$requested_domain;
547: my $caname=$ENV{'user.name'};
548: if ($prt eq 'rca') {
549: ($cadom,$caname)=
550: ($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
551: }
552: $act =~ s/\$caname/$caname/g;
553: my $home = &Apache::lonnet::homeserver($caname,$cadom);
554: if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
555: $output.=switch($caname,$cadom,
556: $row,$col,$img,$top,$bot,$act,$desc);
557: }
558: }
559: }
560: }
561: }
562: unless ($ENV{'browser.interface'} eq 'textual') {
563: $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
564: }
565: return $output;
566: }
567:
568: # ======================================================================= Close
569:
570: sub close {
571: if ($ENV{'browser.interface'} eq 'textual') { return ''; }
572: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
573: return(<<ENDCLOSE);
574: <script>
575: window.status='Accessing Remote Control';
576: menu=window.open("/adm/rat/empty.html","$menuname",
577: "height=350,width=150,scrollbars=no,menubar=no");
578: window.status='Disabling Remote Control';
579: menu.active=0;
580: menu.autologout=0;
581: window.status='Closing Remote Control';
582: menu.close();
583: window.status='Done.';
584: </script>
585: ENDCLOSE
586: }
587:
588: # ====================================================================== Footer
589:
590: sub footer {
591:
592: }
593:
594: sub utilityfunctions {
595: unless ($ENV{'browser.interface'} eq 'textual') { return ''; }
596: my $currenturl=$ENV{'REQUEST_URI'};
597: my $currentsymb=$ENV{'request.symb'};
598: return (<<ENDUTILITY)
599:
600: var currentURL="$currenturl";
601: var reloadURL="$currenturl";
602: var currentSymb="$currentsymb";
603:
604: function go(url) {
605: if (url!='' && url!= null) {
606: currentURL = null;
607: currentSymb= null;
608: window.location.href=url;
609: }
610: }
611:
612: function gopost(url,postdata) {
613: if (url!='') {
614: this.document.server.action=url;
615: this.document.server.postdata.value=postdata;
616: this.document.server.command.value='';
617: this.document.server.url.value='';
618: this.document.server.symb.value='';
619: this.document.server.submit();
620: }
621: }
622:
623: function gocmd(url,cmd) {
624: if (url!='') {
625: this.document.server.action=url;
626: this.document.server.postdata.value='';
627: this.document.server.command.value=cmd;
628: this.document.server.url.value=currentURL;
629: this.document.server.symb.value=currentSymb;
630: this.document.server.submit();
631: }
632: }
633: ENDUTILITY
634: }
635:
636: sub serverform {
637: return(<<ENDSERVERFORM);
638:
639: <form name="server" action="/adm/logout" method="post">
640: <input type="hidden" name="postdata" value="none" />
641: <input type="hidden" name="command" value="none" />
642: <input type="hidden" name="url" value="none" />
643: <input type="hidden" name="symb" value="none" />
644: </form>
645: ENDSERVERFORM
646: }
647: # ================================================ Handler when called directly
648:
649:
650: sub handler {
651: my $r = shift;
652: $r->content_type('text/html');
653: $r->send_http_header;
654: return OK if $r->header_only;
655:
656: my $utility=&utilityfunctions();
657: my $form=&serverform();
658: my $bodytag=&Apache::loncommon::bodytag('Main Menu');
659: # ------------------------------------------------------------ Print the screen
660: $r->print(<<ENDHEADER);
661: <html><head>
662: <title>LON-CAPA Main Menu</title>
663: <script>
664: $utility
665: </script>
666: </head>
667: $bodytag
668: ENDHEADER
669: $r->print(&rawconfig(1).$form);
670: $r->print('</body></html>');
671: return OK;
672: }
673:
674: # ================================================================ Main Program
675:
676: BEGIN {
677: if (! defined($readdesk)) {
678: {
679: my $config=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
680: '/mydesk.tab');
681: while (my $configline=<$config>) {
682: $configline=(split(/\#/,$configline))[0];
683: $configline=~s/^\s+//;
684: chomp($configline);
685: if ($configline) {
686: $desklines[$#desklines+1]=$configline;
687: }
688: }
689: }
690: $readdesk='done';
691: }
692: }
693:
694: 1;
695: __END__
696:
697:
698:
699:
700:
701:
702:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>