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