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