1: # The LearningOnline Network with CAPA
2: # Routines to control the menu
3: #
4: # $Id: lonmenu.pm,v 1.172 2006/04/10 18:49:56 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: sub get_colors {
68: my ($font,$pgbg,$tabbg);
69: if ($env{'browser.interface'} eq 'textual') {
70: $pgbg='#FFFFFF';
71: $tabbg='#FFFFFF';
72: $font='#000000';
73: } else {
74: my $domain =&Apache::loncommon::determinedomain();
75: my $function =&Apache::loncommon::get_users_function();
76:
77: $pgbg =&Apache::loncommon::designparm($function.'.pgbg', $domain);
78: $tabbg =&Apache::loncommon::designparm($function.'.tabbg',$domain);
79: $font =&Apache::loncommon::designparm($function.'.font', $domain);
80: }
81: return ($font,$pgbg,$tabbg);
82: }
83: # ============================= This gets called at the top of the body section
84:
85: sub menubuttons {
86: my $forcereg=shift;
87: my $target =shift;
88: my $registration=shift;
89: my $titletable=shift;
90: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
91: ['inhibitmenu']);
92: if (($env{'form.inhibitmenu'} eq 'yes') ||
93: ($ENV{'REQUEST_URI'} eq '/adm/logout')) { return ''; }
94: my %lt=&initlittle();
95: my $navmaps='';
96: my $reloadlink='';
97: my $docs='';
98: my $groups='';
99: my $showgroups=0;
100: my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
101: my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
102: my $face= 'face="Arial,Helvetica,sans-serif"';
103: if ($env{'request.state'} eq 'construct') {
104: if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {
105: my $returnurl = $env{'request.filename'};
106: $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;
107: $escurl = &Apache::lonnet::escape($returnurl);
108: }
109: }
110: if ($env{'request.course.id'}) {
111: my %coursegroups;
112: my $viewgrps_permission =
113: &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
114: if (!$viewgrps_permission) {
115: %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'});
116: }
117: if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
118: $showgroups = 1;
119: }
120: }
121:
122: my ($font,$pgbg,$tabbg) = &get_colors();
123:
124: if ($env{'browser.interface'} eq 'textual') {
125: # Textual display only
126: if ($env{'request.course.id'}) {
127: $navmaps=(<<ENDNAV);
128: <a href="/adm/navmaps?postdata=$escurl&postsymb=$escsymb" target="_top">$lt{'nav'}</a>
129: ENDNAV
130: if (($env{'request.noversionuri'}=~/^\/adm\//) &&
131: ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
132: ($env{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
133: my $escreload=&Apache::lonnet::escape('return:');
134: $reloadlink=(<<ENDRELOAD);
135: <a href="/adm/flip?postdata=$escreload" target="_top"><font $face color="$font">$lt{'ret'}</font></a>
136: ENDRELOAD
137: }
138: if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
139: $docs=(<<ENDDOCS);
140: <a href="/adm/coursedocs" target="_top"><font $face color="$font">$lt{'docs'}</font></a>
141: ENDDOCS
142: }
143: if ($showgroups) {
144: $groups =(<<ENDGROUPS);
145: <td bgcolor="$tabbg">
146: <a href="/adm/coursegroups" target="_top"><font $face color="$font">$lt{'groups'}</font></a></td>
147: ENDGROUPS
148: }
149: }
150: my $form=&serverform();
151: my $utility=&utilityfunctions();
152: my $output=(<<ENDMAINMENU);
153: <script type="text/javascript">
154: // BEGIN LON-CAPA Internal
155: $utility
156: </script>
157: <a href="/adm/menu" target="_top">$lt{'main'}</a>
158: $reloadlink $navmaps $docs $groups
159: <a href="/adm/roles" target="_top"><font $face color="$font">$lt{'roles'}</font></a>
160: <a href="/adm/logout" target="_top"><font $face color="$font">$lt{'exit'}</font></a>
161: <br />
162: <script type="text/javascript">
163: // END LON-CAPA Internal
164: </script>
165: $form
166: ENDMAINMENU
167: if ($registration) { $output.=&innerregister($forcereg,$target); }
168: return $output."<hr />";
169: } elsif ($env{'environment.remote'} eq 'off') {
170: # Remote Control is switched off
171: # figure out colors
172: my %lt=&initlittle();
173:
174: my $domain=&Apache::loncommon::determinedomain();
175: my $function =&Apache::loncommon::get_users_function();
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, $target, $titletable) = @_;
333: my $result = '';
334: my ($uname,$thisdisfn);
335: my $const_space = ($env{'request.state'} eq 'construct');
336: my $is_const_dir = 0;
337:
338: if ($env{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
339:
340: $Apache::lonxml::registered=1;
341:
342: my $textinter=($env{'browser.interface'} eq 'textual');
343: my $noremote=($env{'environment.remote'} eq 'off');
344:
345: my $textual=($textinter || $noremote);
346:
347: @inlineremote=();
348: undef @inlineremote;
349:
350: my $reopen=&Apache::lonmenu::reopenmenu();
351:
352: my ($font,$pgbg,$tabbg) = &get_colors();
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:
841: my ($font,$pgbg,$tabbg) = &get_colors();
842:
843: unless (($env{'browser.interface'} eq 'textual') ||
844: ($env{'environment.remote'} eq 'off')) {
845: # Remote
846: return "\n".
847: qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc"););
848: } elsif ($env{'browser.interface'} eq 'textual') {
849: # Accessibility
850: if ($nobreak==2) { return ''; }
851: my $text=$top.' '.$bot;
852: $text=~s/\s*\-\s*//gs;
853: if ($nobreak) {
854: $inlineremote[10*$row+$col]=
855: '<a href="javascript:'.$act.';">'.$text.'</a>';
856: } else {
857: $inlineremote[10*$row+$col]="\n<br />".
858: $desc.' <a href="javascript:'.$act.';">'.$text.'</a>';
859: }
860: } else {
861: # Inline Remote
862: if ($nobreak==2) { return ''; }
863: my $text=$top.' '.$bot;
864: $text=~s/\s*\-\s*//gs;
865:
866: my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'};
867: if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; }
868: my $pic=
869: '<img border="0" alt="'.$text.'" src="http://'.$ENV{'HTTP_HOST'}.
870: ':'.$lonhttpdPort.'/res/adm/pages/'.$img.'" align="'.
871: ($nobreak==3?'right':'left').'" />';
872: if (($env{'browser.interface'} eq 'textual') || ($env{'browser.interface'} eq 'faketextual')) {
873: # Accessibility
874: if ($nobreak==3) {
875: $inlineremote[10*$row+$col]="\n".
876: '<td width="40%" align="right"><font color="'.$font.'" size="+1">'.$text.
877: '</font></td><td width="10%" align="right" bgcolor="'.$tabbg.'">'.
878: '<a href="javascript:'.$act.';">'.$pic.'</a></td></tr>';
879: } elsif ($nobreak) {
880: $inlineremote[10*$row+$col]="\n<tr>".
881: '<td width="10%" align="left" bgcolor="'.$tabbg.'">'.
882: '<a href="javascript:'.$act.';">'.$pic.
883: '</a></td><td width="40%" align="left"><font color="'.$font.'" size="+1">'.$text.'</font></td>';
884: } else {
885: $inlineremote[10*$row+$col]="\n<tr>".
886: '<td width="10%" align="left" bgcolor="'.$tabbg.'">'.
887: '<a href="javascript:'.$act.';">'.$pic.
888: '</a></td><td colspan="3"><font color="'.$font.'">'.$desc.
889: '</font></td></tr>';
890: }
891: } else {
892: # Inline Menu
893: $inlineremote[10*$row+$col]=
894: '<a href="javascript:'.$act.';">'.$pic.
895: '</a><font color="'.$font.'" size="2">'.$desc.
896: '</font>';
897: }
898: }
899: return '';
900: }
901:
902: sub secondlevel {
903: my $output='';
904: my
905: ($uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc)=@_;
906: if ($prt eq 'any') {
907: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
908: } elsif ($prt=~/^r(\w+)/) {
909: if ($rol eq $1) {
910: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
911: }
912: }
913: return $output;
914: }
915:
916: sub openmenu {
917: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
918: if (($env{'browser.interface'} eq 'textual') ||
919: ($env{'environment.remote'} eq 'off')) { return ''; }
920: my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
921: return "window.open(".$nothing.",'".$menuname."');";
922: }
923:
924: sub inlinemenu {
925: @inlineremote=();
926: undef @inlineremote;
927: &rawconfig(1);
928: return join('',map { (defined($_)?$_:'') } @inlineremote);
929: }
930:
931: sub rawconfig {
932: my $textualoverride=shift;
933: my $output='';
934: unless (($env{'browser.interface'} eq 'textual') ||
935: ($env{'environment.remote'} eq 'off')) {
936: $output.=
937: "window.status='Opening Remote Control';var swmenu=".&openmenu().
938: "\nwindow.status='Configuring Remote Control ';";
939: } else {
940: unless ($textualoverride) { return ''; }
941: }
942: my $uname=$env{'user.name'};
943: my $udom=$env{'user.domain'};
944: my $adv=$env{'user.adv'};
945: my $author=$env{'user.author'};
946: my $crs='';
947: if ($env{'request.course.id'}) {
948: $crs='/'.$env{'request.course.id'};
949: if ($env{'request.course.sec'}) {
950: $crs.='_'.$env{'request.course.sec'};
951: }
952: $crs=~s/\_/\//g;
953: }
954: my $pub=($env{'request.state'} eq 'published');
955: my $con=($env{'request.state'} eq 'construct');
956: my $rol=$env{'request.role'};
957: my $requested_domain = $env{'request.role.domain'};
958: foreach (@desklines) {
959: my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$_);
960: $prt=~s/\$uname/$uname/g;
961: $prt=~s/\$udom/$udom/g;
962: $prt=~s/\$crs/$crs/g;
963: $prt=~s/\$requested_domain/$requested_domain/g;
964: if ($pro eq 'clear') {
965: $output.=&clear($row,$col);
966: } elsif ($pro eq 'any') {
967: $output.=&secondlevel(
968: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
969: } elsif ($pro eq 'smp') {
970: unless ($adv) {
971: $output.=&secondlevel(
972: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
973: }
974: } elsif ($pro eq 'adv') {
975: if ($adv) {
976: $output.=&secondlevel(
977: $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
978: }
979: } elsif (($pro=~/^p(\w+)/) && ($prt)) {
980: if (&Apache::lonnet::allowed($1,$prt)) {
981: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
982: }
983: } elsif ($pro eq 'course') {
984: if ($env{'request.course.fn'}) {
985: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
986: }
987: } elsif ($pro =~ /^courseenv_(.*)$/) {
988: my $key = $1;
989: if ($env{'course.'.$env{'request.course.id'}.'.'.$key}) {
990: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
991: }
992: } elsif ($pro =~ /^course_(.*)$/) {
993: # Check for permissions inside of a course
994: if (($env{'request.course.id'}) &&
995: (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
996: ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
997: )) {
998: $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
999: }
1000: } elsif ($pro eq 'author') {
1001: if ($author) {
1002: if ((($prt eq 'rca') && ($env{'request.role'}=~/^ca/)) ||
1003: (($prt eq 'rau') && ($env{'request.role'}=~/^au/))) {
1004: # Check that we are on the correct machine
1005: my $cadom=$requested_domain;
1006: my $caname=$env{'user.name'};
1007: if ($prt eq 'rca') {
1008: ($cadom,$caname)=
1009: ($env{'request.role'}=~/(\w+)\/(\w+)$/);
1010: }
1011: $act =~ s/\$caname/$caname/g;
1012: my $home = &Apache::lonnet::homeserver($caname,$cadom);
1013: my $allowed=0;
1014: my @ids=&Apache::lonnet::current_machine_ids();
1015: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
1016: if ($allowed) {
1017: $output.=switch($caname,$cadom,
1018: $row,$col,$img,$top,$bot,$act,$desc);
1019: }
1020: }
1021: }
1022: }
1023: }
1024: unless (($env{'browser.interface'} eq 'textual') ||
1025: ($env{'environment.remote'} eq 'off')) {
1026: $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
1027: if (&Apache::lonmsg::newmail()) {
1028: $output.='swmenu.setstatus("you have","messages");';
1029: }
1030: }
1031:
1032: return $output;
1033: }
1034:
1035: # ======================================================================= Close
1036:
1037: sub close {
1038: if (($env{'browser.interface'} eq 'textual') ||
1039: ($env{'environment.remote'} eq 'off')) { return ''; }
1040: my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
1041: return(<<ENDCLOSE);
1042: <script type="text/javascript">
1043: window.status='Accessing Remote Control';
1044: menu=window.open("/adm/rat/empty.html","$menuname",
1045: "height=350,width=150,scrollbars=no,menubar=no");
1046: window.status='Disabling Remote Control';
1047: menu.active=0;
1048: menu.autologout=0;
1049: window.status='Closing Remote Control';
1050: menu.close();
1051: window.status='Done.';
1052: </script>
1053: ENDCLOSE
1054: }
1055:
1056: # ====================================================================== Footer
1057:
1058: sub footer {
1059:
1060: }
1061:
1062: sub nav_control_js {
1063: my $nav=($env{'environment.remotenavmap'} eq 'on');
1064: return (<<NAVCONTROL);
1065: var w_loncapanav_flag="$nav";
1066:
1067:
1068: function gonav(url) {
1069: if (w_loncapanav_flag != 1) {
1070: gopost(url,'');
1071: } else {
1072: navwindow=window.open(url,
1073: "loncapanav","height=600,width=400,scrollbars=1");
1074: }
1075: }
1076: NAVCONTROL
1077: }
1078:
1079: sub utilityfunctions {
1080: my $caller = shift;
1081: unless (($env{'browser.interface'} eq 'textual') ||
1082: ($env{'environment.remote'} eq 'off') || ($caller eq '/adm/menu')) { return ''; }
1083: my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
1084: $currenturl=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($currenturl));
1085:
1086: my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
1087: my $nav_control=&nav_control_js();
1088: return (<<ENDUTILITY)
1089:
1090: var currentURL="$currenturl";
1091: var reloadURL="$currenturl";
1092: var currentSymb="$currentsymb";
1093:
1094: $nav_control
1095:
1096: function go(url) {
1097: if (url!='' && url!= null) {
1098: currentURL = null;
1099: currentSymb= null;
1100: window.location.href=url;
1101: }
1102: }
1103:
1104: function gopost(url,postdata) {
1105: if (url!='') {
1106: this.document.server.action=url;
1107: this.document.server.postdata.value=postdata;
1108: this.document.server.command.value='';
1109: this.document.server.url.value='';
1110: this.document.server.symb.value='';
1111: this.document.server.submit();
1112: }
1113: }
1114:
1115: function gocmd(url,cmd) {
1116: if (url!='') {
1117: this.document.server.action=url;
1118: this.document.server.postdata.value='';
1119: this.document.server.command.value=cmd;
1120: this.document.server.url.value=currentURL;
1121: this.document.server.symb.value=currentSymb;
1122: this.document.server.submit();
1123: }
1124: }
1125:
1126: function gocstr(url,filename) {
1127: if (url == '/adm/cfile?action=delete') {
1128: this.document.cstrdelete.filename.value = filename
1129: this.document.cstrdelete.submit();
1130: return;
1131: }
1132: if (url == '/adm/printout') {
1133: this.document.cstrprint.postdata.value = filename
1134: this.document.cstrprint.curseed.value = 0;
1135: this.document.cstrprint.problemtype.value = 0;
1136: if (this.document.lonhomework) {
1137: if ((this.document.lonhomework.rndseed) && (this.document.lonhomework.rndseed.value != null) && (this.document.lonhomework.rndseed.value != '')) {
1138: this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value
1139: }
1140: if (this.document.lonhomework.problemtype) {
1141: if (this.document.lonhomework.problemtype.value) {
1142: this.document.cstrprint.problemtype.value =
1143: this.document.lonhomework.problemtype.value;
1144: } else if (this.document.lonhomework.problemtype.options) {
1145: for (var i=0; i<this.document.lonhomework.problemtype.options.length; i++) {
1146: if (this.document.lonhomework.problemtype.options[i].selected) {
1147: if (this.document.lonhomework.problemtype.options[i].value != null && this.document.lonhomework.problemtype.options[i].value != '') {
1148: this.document.cstrprint.problemtype.value = this.document.lonhomework.problemtype.options[i].value
1149: }
1150: }
1151: }
1152: }
1153: }
1154: }
1155: this.document.cstrprint.submit();
1156: return;
1157: }
1158: if (url !='') {
1159: this.document.constspace.filename.value = filename;
1160: this.document.constspace.action = url;
1161: this.document.constspace.submit();
1162: }
1163: }
1164:
1165: function golist(url) {
1166: if (url!='' && url!= null) {
1167: currentURL = null;
1168: currentSymb= null;
1169: top.location.href=url;
1170: }
1171: }
1172:
1173:
1174:
1175: function catalog_info() {
1176: loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
1177: }
1178:
1179: function chat_win() {
1180: lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');
1181: }
1182:
1183: function group_chat(group) {
1184: var url = '/adm/groupchat?group='+group;
1185: var winName = 'LONchat_'+group;
1186: grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');
1187: }
1188: ENDUTILITY
1189: }
1190:
1191: sub serverform {
1192: return(<<ENDSERVERFORM);
1193: <form name="server" action="/adm/logout" method="POST" target="_top">
1194: <input type="hidden" name="postdata" value="none" />
1195: <input type="hidden" name="command" value="none" />
1196: <input type="hidden" name="url" value="none" />
1197: <input type="hidden" name="symb" value="none" />
1198: </form>
1199: ENDSERVERFORM
1200: }
1201:
1202: sub constspaceform {
1203: return(<<ENDCONSTSPACEFORM);
1204: <form name="constspace" action="/adm/logout" method="POST" target="_top">
1205: <input type="hidden" name="filename" value="" />
1206: </form>
1207: <form name="cstrdelete" action="/adm/cfile" method="POST" target="_top">
1208: <input type="hidden" name="action" value="delete" />
1209: <input type="hidden" name="filename" value="" />
1210: </form>
1211: <form name="cstrprint" action="/adm/printout" target="_parent" method="POST">
1212: <input type="hidden" name="postdata" value="" />
1213: <input type="hidden" name="curseed" value="" />
1214: <input type="hidden" name="problemtype" value="" />
1215: </form>
1216:
1217: ENDCONSTSPACEFORM
1218: }
1219:
1220:
1221: sub get_nav_status {
1222: my $navstatus="swmenu.w_loncapanav_flag=";
1223: if ($env{'environment.remotenavmap'} eq 'on') {
1224: $navstatus.="1";
1225: } else {
1226: $navstatus.="-1";
1227: }
1228: return $navstatus;
1229: }
1230:
1231: # ================================================================ Main Program
1232:
1233: BEGIN {
1234: if (! defined($readdesk)) {
1235: {
1236: my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab';
1237: if ( CORE::open( my $config,"<$tabfile") ) {
1238: while (my $configline=<$config>) {
1239: $configline=(split(/\#/,$configline))[0];
1240: $configline=~s/^\s+//;
1241: chomp($configline);
1242: if ($configline) {
1243: push(@desklines,$configline);
1244: }
1245: }
1246: CORE::close($config);
1247: }
1248: }
1249: $readdesk='done';
1250: }
1251: }
1252:
1253: 1;
1254: __END__
1255:
1256:
1257:
1258:
1259:
1260:
1261:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>