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