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