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